=================================================================== RCS file: /home/cvs/OpenXM_contrib/pari-2.2/src/graph/Attic/plotport.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -p -r1.1 -r1.2 --- OpenXM_contrib/pari-2.2/src/graph/Attic/plotport.c 2001/10/02 11:17:07 1.1 +++ OpenXM_contrib/pari-2.2/src/graph/Attic/plotport.c 2002/09/11 07:26:57 1.2 @@ -1,4 +1,4 @@ -/* $Id: plotport.c,v 1.1 2001/10/02 11:17:07 noro Exp $ +/* $Id: plotport.c,v 1.2 2002/09/11 07:26:57 noro Exp $ Copyright (C) 2000 The PARI group. @@ -26,11 +26,13 @@ extern void pop_val(entree *ep); extern void postdraw0(long *w, long *x, long *y, long lw); extern void postdraw00(long *w, long *x, long *y, long lw, long scale); extern void rectdraw0(long *w, long *x, long *y, long lw, long do_free); -static void PARI_get_psplot(); +static void PARI_get_psplot(void); static long current_color[NUMRECT]; PariRect **rectgraph = NULL; PARI_plot pari_plot, pari_psplot; +PARI_plot *pari_plot_engine = &pari_plot; +PARI_plot pari_X11plot; /* Used if BOTH_GNUPLOT_AND_X11 */ long rectpoint_itype = 0; long rectline_itype = 0; @@ -108,7 +110,8 @@ static GEN quark_gen; void plot(entree *ep, GEN a, GEN b, char *ch,GEN ysmlu,GEN ybigu, long prec) { - long av = avma, av2,limite,jz,j,i,sig; + long jz, j, i, sig; + gpmem_t av = avma, av2, limite; int jnew, jpre = 0; /* for lint */ GEN p1,p2,ysml,ybig,x,diff,dyj,dx,y[ISCR+1]; screen scr; @@ -137,7 +140,7 @@ plot(entree *ep, GEN a, GEN b, char *ch,GEN ysmlu,GEN x = addrr(x,dx); if (low_stack(limite, stack_lim(av2,1))) { - long tetpil=avma; + gpmem_t tetpil=avma; if (DEBUGMEM>1) err(warnmem,"plot"); x = gerepile(av2,tetpil,rcopy(x)); } @@ -186,7 +189,7 @@ plot(entree *ep, GEN a, GEN b, char *ch,GEN ysmlu,GEN /** **/ /********************************************************************/ void -init_graph() +init_graph(void) { int n; @@ -203,10 +206,12 @@ init_graph() } void -free_graph() +free_graph(void) { int i; + if (!rectgraph) + return; for (i=0; i MAXDTOL) err(affer2); - * return (long)t; - * } - */ - static void rectmove0(long ne, double x, double y, long relative) { @@ -1208,81 +1199,77 @@ gtodblList(GEN data, long flags) if (! is_vec_t(tx)) err(talker,"not a vector in gtodblList"); if (!nl) return NULL; - lx1=lg(data[1]); + lx1 = lg(data[1]); + if (nl == 1) err(talker,"single vector in gtodblList"); /* Allocate memory, then convert coord. to double */ - l=(dblPointList*) gpmalloc(nl*sizeof(dblPointList)); + l = (dblPointList*) gpmalloc(nl*sizeof(dblPointList)); for (i=0; i= l[0].nb) { free(l); return NULL; } + xsml = xbig = l[i ].d[0]; + ysml = ybig = l[i+1].d[0]; + + for (i=0; i < l[0].nb; i+=2) { - u=i+1; - for (j=0; jxbig) xbig=l[i].d[j]; + if (l[i].d[j] < xsml) xsml = l[i].d[j]; + else if (l[i].d[j] > xbig) xbig = l[i].d[j]; - if (l[u].d[j]ybig) ybig=l[u].d[j]; + if (l[u].d[j] < ysml) ysml = l[u].d[j]; + else if (l[u].d[j] > ybig) ybig = l[u].d[j]; } } } else { - l[0].nb=nl-1; - for (j=0; jxbig) xbig=l[0].d[j]; + if (l[0].d[j] < xsml) xsml = l[0].d[j]; + else if (l[0].d[j] > xbig) xbig = l[0].d[j]; } - for (i=1; i<=l[0].nb; i++) - { - for (j=0; jybig) ybig=l[i].d[j]; + if (l[i].d[j] < ysml) ysml = l[i].d[j]; + else if (l[i].d[j] > ybig) ybig = l[i].d[j]; } - } } - l[0].xsml=xsml; l[0].xbig=xbig; - l[0].ysml=ysml; l[0].ybig=ybig; + l[0].xsml = xsml; l[0].xbig = xbig; + l[0].ysml = ysml; l[0].ybig = ybig; return l; } @@ -1291,7 +1278,7 @@ single_recursion(dblPointList *pl,char *ch,entree *ep, GEN xright,GEN yright,long depth) { GEN xx,yy; - long av=avma; + gpmem_t av=avma; double dy=pl[0].ybig - pl[0].ysml; if (depth==RECUR_MAXDEPTH) return; @@ -1319,7 +1306,7 @@ param_recursion(dblPointList *pl,char *ch,entree *ep, GEN yleft, GEN tright,GEN xright,GEN yright, long depth) { GEN tt,xx,yy, p1; - long av=avma; + gpmem_t av=avma; double dy=pl[0].ybig - pl[0].ysml; double dx=pl[0].xbig - pl[0].xsml; @@ -1358,7 +1345,8 @@ rectplothin(entree *ep, GEN a, GEN b, char *ch, long p long recur=flags & PLOT_RECURSIVE; GEN p1,dx,x,xleft,xright,yleft,yright,tleft,tright; dblPointList *pl; - long tx,av = avma,av2,i,j,sig,nc,nl,nbpoints; + long tx, i, j, sig, nc, nl, nbpoints; + gpmem_t av = avma, av2; double xsml,xbig,ysml,ybig,fx,fy; if (!testpoints) @@ -1526,7 +1514,8 @@ extern GEN polint_i(GEN xa, GEN ya, GEN x, long n, GEN static void rectsplines(long ne, double *x, double *y, long lx, long flag) { - long i, j, oldavma = avma; + long i, j; + gpmem_t oldavma = avma; GEN tas, xa = cgetg(lx+1, t_VEC), ya = cgetg(lx+1, t_VEC); entree *var0 = varentries[ordvar[0]]; @@ -1543,7 +1532,7 @@ rectsplines(long ne, double *x, double *y, long lx, lo } else tas = NULL; /* for lint */ for (i = 0; i <= lx - 4; i++) { - long oavma = avma; + gpmem_t oavma = avma; xa++; ya++; if (flag & PLOT_PARAMETRIC) { @@ -1600,7 +1589,8 @@ rectplothrawin(long stringrect, long drawrect, dblPoin GEN res; dblPointList y,x; double xsml,xbig,ysml,ybig,tmp; - long ltype, ltop=avma; + long ltype; + gpmem_t ltop=avma; long i,nc,nbpoints, w[2], wx[2], wy[2]; w[0]=stringrect; w[1]=drawrect; @@ -1785,7 +1775,7 @@ static GEN plothraw0(long stringrect, long drawrect, GEN listx, GEN listy, long flags) { PARI_plot *output = init_output(flags); - long data[] = {evaltyp(t_VEC) | m_evallg(3), 0, 0}; + long data[] = {evaltyp(t_VEC) | _evallg(3), 0, 0}; dblPointList *pl; data[1] = (long) listx; @@ -1844,7 +1834,7 @@ postploth2(entree *ep, GEN a, GEN b, char *ch, long pr } GEN -plothsizes() +plothsizes(void) { return plothsizes_flag(0); } @@ -1895,7 +1885,7 @@ static void ps_string(FILE *psfile, int x, int y, char #define JSCR 800 /* 1120 en haute resolution */ static void -PARI_get_psplot() +PARI_get_psplot(void) { pari_psplot.height = JSCR - 60; pari_psplot.width = ISCR - 40;