Igor Schein on Thu, 22 Jul 1999 16:30:24 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

compiling with g++ on Solaris


Hi,

I compiled pari-2.0.16 with g++ 2.91.66 ( part of egcs-1.1.2 )
on Solaris.  2 patches are needed.  The first one fixes
the error with prototyping, which gcc lets go, but g++
picks up (maybe it makes sense to eventually put it in paridecl.h?):

--- src/basemath/buch1.c~	Tue Jun 29 08:10:55 1999
+++ src/basemath/buch1.c	Thu Jul 22 16:01:58 1999
@@ -30,7 +30,7 @@
 static GEN  **powsubfactorbase, subfactorbase,Disc,sqrtD,isqrtD;
 
 GEN buchquad(GEN D, double c, double c2, long RELSUP0, long flag, long prec);
-GEN roots_to_pol_intern(GEN L, GEN a, long v, long plus);
+GEN roots_to_pol_intern(GEN L, GEN a, long v, int plus);
 
 GEN
 quadclassunit0(GEN x, long flag, GEN data, long prec)
--- src/modules/stark.c~	Tue Jun 29 08:11:52 1999
+++ src/modules/stark.c	Thu Jul 22 16:21:09 1999
@@ -11,7 +11,7 @@
 
 #define EXTRA_PREC (DEFAULTPREC-1)
 
-GEN roots_to_pol_intern(GEN L, GEN a, long v, long plus);
+GEN roots_to_pol_intern(GEN L, GEN a, long v, int plus);
 static int*** computean(GEN dtcr,  long nmax, long prec);
 
 /********************************************************************/

The second one changes all occurences of variables 'new' and 'class' into
their french translations ( my arbirary choice ), because they're C++
keywords and offend the compiler:

--- src/language/es.c.orig	Tue Jun 29 11:07:33 1999
+++ src/language/es.c	Thu Jul 22 14:49:12 1999
@@ -1844,16 +1844,16 @@
 pariFILE *
 newfile(FILE *f, char *name, int type)
 {
-  pariFILE *new = (pariFILE*) gpmalloc(strlen(name) + 1 + sizeof(pariFILE));
-  new->type = type;
-  new->name = strcpy((char*)(new+1), name);
-  new->file = f;
-  new->prev = last_file;
-  new->next = NULL;
-  if (last_file) last_file->next = new;
+  pariFILE *nouveau = (pariFILE*) gpmalloc(strlen(name) + 1 + sizeof(pariFILE));
+  nouveau->type = type;
+  nouveau->name = strcpy((char*)(nouveau+1), name);
+  nouveau->file = f;
+  nouveau->prev = last_file;
+  nouveau->next = NULL;
+  if (last_file) last_file->next = nouveau;
   if (DEBUGFILES)
     fprintferr("I/O: opening file %s (code %d) \n",name,type);
-  return last_file = new;
+  return last_file = nouveau;
 }
 
 static void
@@ -2088,22 +2088,22 @@
 void
 gp_expand_path(char *v)
 {
-  char **new, **old, *s;
+  char **nouveau, **old, *s;
   int i, n = 0;
 
   v = pari_strdup(v);
   for (s=v; *s; s++)
     if (*s == PATH_SEPARATOR) { *s = 0; n++; }
-  new = (char**) gpmalloc((n + 2)*sizeof(char *));
+  nouveau = (char**) gpmalloc((n + 2)*sizeof(char *));
 
   for (s=v, i=0; i<=n; i++)
   {
     char *end = s + strlen(s), *f = end;
     while (f > s && *--f == '/') *f = 0;
-    new[i] = expand_tilde(s);
+    nouveau[i] = expand_tilde(s);
     s = end + 1; /* next PATH component */
   }
-  new[i] = NULL; old = dir_list; dir_list = new;
+  nouveau[i] = NULL; old = dir_list; dir_list = nouveau;
   if (old)
   {
     for ( ; *old; old++) free(*old);
--- src/gp/gp.c.orig	Tue Jun 29 11:12:49 1999
+++ src/gp/gp.c	Thu Jul 22 14:51:28 1999
@@ -276,15 +276,15 @@
 {
   if (*v)
   {
-    long new = get_int(v,0);
-    if (*n == new) return gnil;
-    if (new > Max || new < Min)
+    long nouveau = get_int(v,0);
+    if (*n == nouveau) return gnil;
+    if (nouveau > Max || nouveau < Min)
     {
       sprintf(thestring, "default: incorrect value for %s [%ld-%ld]:",
 	      s, Min, Max);
       err(talker2, thestring, v,v);
     }
-    *n = new;
+    *n = nouveau;
   }
   switch(flag)
   {
@@ -507,18 +507,18 @@
 static GEN
 sd_histsize(char *v, int flag)
 {
-  long new = histsize;
-  GEN r = sd_numeric(v,flag,"histsize",&new, 1,
+  long nouveau = histsize;
+  GEN r = sd_numeric(v,flag,"histsize",&nouveau, 1,
                      (VERYBIGINT / sizeof(long)) - 1,NULL);
-  if (new != histsize)
+  if (nouveau != histsize)
   {
-    long i = new*sizeof(GEN);
+    long i = nouveau*sizeof(GEN);
     GEN *gg = (GEN *) gpmalloc(i); memset(gg,0,i);
 
     if (tglobal)
     {
-      long k = (tglobal-1) % new;
-      long kmin = k - min(new,histsize), j = k;
+      long k = (tglobal-1) % nouveau;
+      long kmin = k - min(nouveau,histsize), j = k;
 
       i = (tglobal-1) % histsize;
       while (k > kmin)
@@ -526,7 +526,7 @@
 	gg[j] = hist[i];
 	hist[i] = NULL;
 	if (!i) i = histsize;
-	if (!j) j = new;
+	if (!j) j = nouveau;
 	i--; j--; k--;
       }
       while (hist[i])
@@ -536,7 +536,7 @@
 	i--;
       }
     }
-    free((void*)hist); hist=gg; histsize=new;
+    free((void*)hist); hist=gg; histsize=nouveau;
   }
   return r;
 }
@@ -574,16 +574,16 @@
 static GEN
 sd_parisize(char *v, int flag)
 {
-  long new = parisize;
-  GEN r = sd_numeric(v,flag,"parisize",&new, 10000,VERYBIGINT,NULL);
-  if (new != parisize)
+  long nouveau = parisize;
+  GEN r = sd_numeric(v,flag,"parisize",&nouveau, 10000,VERYBIGINT,NULL);
+  if (nouveau != parisize)
   {
     if (flag != d_INITRC)
     {
-      parisize = allocatemoremem(new);
+      parisize = allocatemoremem(nouveau);
       longjmp(local_environnement[bufindex], 0);
     }
-    parisize = new;
+    parisize = nouveau;
   }
   return r;
 }
@@ -591,16 +591,16 @@
 static GEN
 sd_primelimit(char *v, int flag)
 {
-  long new = primelimit;
-  GEN r = sd_numeric(v,flag,"primelimit",&new, 0,VERYBIGINT,NULL);
-  if (new != primelimit)
+  long nouveau = primelimit;
+  GEN r = sd_numeric(v,flag,"primelimit",&nouveau, 0,VERYBIGINT,NULL);
+  if (nouveau != primelimit)
   {
     if (flag != d_INITRC)
     {
-      byteptr ptr = initprimes(new);
+      byteptr ptr = initprimes(nouveau);
       free(diffptr); diffptr = ptr;
     }
-    primelimit = new;
+    primelimit = nouveau;
   }
   return r;
 }
@@ -1627,9 +1627,9 @@
       len = *ptlbuf - (s - *ptbuf);
       if (len < 512)
       {
-	long new = *ptlbuf << 1, l = s - *ptbuf;
+	long nouveau = *ptlbuf << 1, l = s - *ptbuf;
 	len += *ptlbuf;
-	fix_buffer(new, ptbuf, ptlbuf);
+	fix_buffer(nouveau, ptbuf, ptlbuf);
 	s = *ptbuf + l;
       }
     }
@@ -1689,10 +1689,10 @@
 	s1 += 4;
 	if (find == fnum-1)
 	{
-	  long new = fnum << 1;
-	  flist = (char**)gprealloc(flist, new*sizeof(char*),
+	  long nouveau = fnum << 1;
+	  flist = (char**)gprealloc(flist, nouveau*sizeof(char*),
 	                                  fnum*sizeof(char*));
-	  fnum = new;
+	  fnum = nouveau;
 	}
 	flist[find++] = s2 = gpmalloc(strlen(s1) + 1);
 	if (*s1 == '"') (void)readstring(s1, s2, NULL);
--- src/modules/stark.c~	Tue Jun 29 08:11:52 1999
+++ src/modules/stark.c	Thu Jul 22 15:01:04 1999
@@ -628,7 +628,7 @@
   long av = avma, av2, G, ms, j, i, nz, zcard, q, l, N;
   GEN chi, nc, dc, p1, cond0, cond1, elts, Msign, umod2, lambda, nf;
   GEN sg, p2, chib, diff, vt, z, idg, mu, idh, zid, zstruc, zgen, zchi;
-  GEN allclass, class, bnr, beta, s, tr, p3, den, muslambda, pi;
+  GEN allclass, classe, bnr, beta, s, tr, p3, den, muslambda, pi;
 
   chi   = (GEN)datachi[8];
   /* trivial case */
@@ -717,8 +717,8 @@
     for (j = 1; j <= ms; j++)
       if (gcmp1((GEN)p2[j])) p1 = element_mul(nf, p1, (GEN)elts[j]);
 
-    class = isprincipalray(bnr, p1);
-    zchi[i] = (long)ComputeImagebyChar(chi, class, 0);
+    classe = isprincipalray(bnr, p1);
+    zchi[i] = (long)ComputeImagebyChar(chi, classe, 0);
     zgen[i] = (long)p1;
   }
 
@@ -772,8 +772,8 @@
     avma = av2;
   }
 
-  class = isprincipalray(bnr, idh);
-  s = gmul(s, ComputeImagebyChar(chi, class, 0));
+  classe = isprincipalray(bnr, idh);
+  s = gmul(s, ComputeImagebyChar(chi, classe, 0));
   s = gdiv(s, gsqrt(nc, prec));
 
   p1 = gsubgs(gabs(s, prec), 1);


Igor