version 1.1, 2001/10/02 11:17:07 |
version 1.2, 2002/09/11 07:26:57 |
Line 26 extern void pop_val(entree *ep); |
|
Line 26 extern void pop_val(entree *ep); |
|
extern void postdraw0(long *w, long *x, long *y, long lw); |
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 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); |
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]; |
static long current_color[NUMRECT]; |
PariRect **rectgraph = NULL; |
PariRect **rectgraph = NULL; |
PARI_plot pari_plot, pari_psplot; |
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 rectpoint_itype = 0; |
long rectline_itype = 0; |
long rectline_itype = 0; |
|
|
Line 108 static GEN quark_gen; |
|
Line 110 static GEN quark_gen; |
|
void |
void |
plot(entree *ep, GEN a, GEN b, char *ch,GEN ysmlu,GEN ybigu, long prec) |
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 */ |
int jnew, jpre = 0; /* for lint */ |
GEN p1,p2,ysml,ybig,x,diff,dyj,dx,y[ISCR+1]; |
GEN p1,p2,ysml,ybig,x,diff,dyj,dx,y[ISCR+1]; |
screen scr; |
screen scr; |
Line 137 plot(entree *ep, GEN a, GEN b, char *ch,GEN ysmlu,GEN |
|
Line 140 plot(entree *ep, GEN a, GEN b, char *ch,GEN ysmlu,GEN |
|
x = addrr(x,dx); |
x = addrr(x,dx); |
if (low_stack(limite, stack_lim(av2,1))) |
if (low_stack(limite, stack_lim(av2,1))) |
{ |
{ |
long tetpil=avma; |
gpmem_t tetpil=avma; |
if (DEBUGMEM>1) err(warnmem,"plot"); |
if (DEBUGMEM>1) err(warnmem,"plot"); |
x = gerepile(av2,tetpil,rcopy(x)); |
x = gerepile(av2,tetpil,rcopy(x)); |
} |
} |
Line 186 plot(entree *ep, GEN a, GEN b, char *ch,GEN ysmlu,GEN |
|
Line 189 plot(entree *ep, GEN a, GEN b, char *ch,GEN ysmlu,GEN |
|
/** **/ |
/** **/ |
/********************************************************************/ |
/********************************************************************/ |
void |
void |
init_graph() |
init_graph(void) |
{ |
{ |
int n; |
int n; |
|
|
|
|
} |
} |
|
|
void |
void |
free_graph() |
free_graph(void) |
{ |
{ |
int i; |
int i; |
|
|
|
if (!rectgraph) |
|
return; |
for (i=0; i<NUMRECT; i++) |
for (i=0; i<NUMRECT; i++) |
{ |
{ |
PariRect *e=rectgraph[i]; |
PariRect *e=rectgraph[i]; |
|
|
free((void *)e); |
free((void *)e); |
} |
} |
free((void *)rectgraph); |
free((void *)rectgraph); |
|
rectgraph = 0; |
} |
} |
|
|
static PariRect * |
static PariRect * |
check_rect(long ne) |
check_rect(long ne) |
{ |
{ |
if (!GOODRECT(ne)) |
if (!GOODRECT(ne)) |
err(talker,"not an rplot vector type in graphic function"); |
err(talker, |
|
"incorrect rectwindow number in graphic function (%ld not in [0, %ld])", |
|
ne, NUMRECT-1); |
return rectgraph[ne]; |
return rectgraph[ne]; |
} |
} |
|
|
Line 229 static PariRect * |
|
Line 237 static PariRect * |
|
check_rect_init(long ne) |
check_rect_init(long ne) |
{ |
{ |
PariRect *e = check_rect(ne); |
PariRect *e = check_rect(ne); |
if (!RHead(e)) |
if (!RHead(e)) err(talker,"you must initialize the rectwindow first"); |
err(talker,"you must initialize the rectwindow first"); |
|
return e; |
return e; |
} |
} |
|
|
Line 309 rectscale(long ne, GEN x1, GEN x2, GEN y1, GEN y2) |
|
Line 316 rectscale(long ne, GEN x1, GEN x2, GEN y1, GEN y2) |
|
rectscale0(ne, gtodouble(x1), gtodouble(x2), gtodouble(y1), gtodouble(y2)); |
rectscale0(ne, gtodouble(x1), gtodouble(x2), gtodouble(y1), gtodouble(y2)); |
} |
} |
|
|
/* |
|
* #ifdef LONG_IS_64BIT |
|
* # define MAXDTOL 9223372036854775807.0 |
|
* #else |
|
* # define MAXDTOL 2147483647.0 |
|
* #endif |
|
* |
|
* |
|
* long |
|
* DTOL(double t) |
|
* { |
|
* if (fabs(t) > MAXDTOL) err(affer2); |
|
* return (long)t; |
|
* } |
|
*/ |
|
|
|
static void |
static void |
rectmove0(long ne, double x, double y, long relative) |
rectmove0(long ne, double x, double y, long relative) |
{ |
{ |
Line 1208 gtodblList(GEN data, long flags) |
|
Line 1199 gtodblList(GEN data, long flags) |
|
|
|
if (! is_vec_t(tx)) err(talker,"not a vector in gtodblList"); |
if (! is_vec_t(tx)) err(talker,"not a vector in gtodblList"); |
if (!nl) return NULL; |
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 */ |
/* Allocate memory, then convert coord. to double */ |
l=(dblPointList*) gpmalloc(nl*sizeof(dblPointList)); |
l = (dblPointList*) gpmalloc(nl*sizeof(dblPointList)); |
for (i=0; i<nl-1; i+=2) |
for (i=0; i<nl-1; i+=2) |
{ |
{ |
u=i+1; |
u = i+1; |
x=(GEN)data[u]; tx = typ(x); |
x = (GEN)data[u]; tx = typ(x); |
y=(GEN)data[u+1]; ty = typ(y); |
y = (GEN)data[u+1]; ty = typ(y); |
if (!is_vec_t(tx) || !is_vec_t(ty)) err(ploter4); |
if (!is_vec_t(tx) || !is_vec_t(ty)) err(ploter4); |
lx=lg(x); if (lg(y)!=lx) err(ploter5); |
lx = lg(x); if (lg(y) != lx) err(ploter5); |
if (!param && lx != lx1) err(ploter5); |
if (!param && lx != lx1) err(ploter5); |
lx--; |
|
|
|
if (lx) |
lx--; |
|
l[i].d = (double*) gpmalloc(lx*sizeof(double)); |
|
l[u].d = (double*) gpmalloc(lx*sizeof(double)); |
|
for (j=0; j<lx; j=v) |
{ |
{ |
l[i].d = (double*) gpmalloc(lx*sizeof(double)); |
v = j+1; |
l[u].d = (double*) gpmalloc(lx*sizeof(double)); |
l[i].d[j] = gtodouble((GEN)x[v]); |
|
l[u].d[j] = gtodouble((GEN)y[v]); |
for (j=0; j<lx; j=v) |
|
{ |
|
v=j+1; |
|
l[i].d[j]=gtodouble((GEN)x[v]); |
|
l[u].d[j]=gtodouble((GEN)y[v]); |
|
} |
|
} |
} |
l[i].nb=l[u].nb=lx; |
l[i].nb = l[u].nb = lx; |
} |
} |
|
|
xsml=xbig=l[0].d[0]; ysml=ybig=l[1].d[0]; |
|
|
|
/* Now compute extremas */ |
/* Now compute extremas */ |
if (param) |
if (param) |
{ |
{ |
l[0].nb=nl/2; |
l[0].nb = nl/2; |
for (i=0; i<l[0].nb; i+=2) |
for (i=0; i < l[0].nb; i+=2) |
|
if (l[i+1].nb) break; |
|
if (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; |
u = i+1; |
for (j=0; j<l[u].nb; j++) |
for (j=0; j < l[u].nb; j++) |
{ |
{ |
if (l[i].d[j]<xsml) |
if (l[i].d[j] < xsml) xsml = l[i].d[j]; |
xsml=l[i].d[j]; |
else if (l[i].d[j] > xbig) xbig = l[i].d[j]; |
else |
|
if (l[i].d[j]>xbig) xbig=l[i].d[j]; |
|
|
|
if (l[u].d[j]<ysml) |
if (l[u].d[j] < ysml) ysml = l[u].d[j]; |
ysml=l[u].d[j]; |
else if (l[u].d[j] > ybig) ybig = l[u].d[j]; |
else |
|
if (l[u].d[j]>ybig) ybig=l[u].d[j]; |
|
} |
} |
} |
} |
} |
} |
else |
else |
{ |
{ |
l[0].nb=nl-1; |
if (!l[0].nb) { free(l); return NULL; } |
for (j=0; j<l[1].nb; j++) |
l[0].nb = nl-1; |
|
|
|
xsml = xbig = l[0].d[0]; |
|
ysml = ybig = l[1].d[0]; |
|
|
|
for (j=0; j < l[1].nb; j++) |
{ |
{ |
if (l[0].d[j]<xsml) |
if (l[0].d[j] < xsml) xsml = l[0].d[j]; |
xsml=l[0].d[j]; |
else if (l[0].d[j] > xbig) xbig = 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 (i=1; i <= l[0].nb; i++) |
{ |
for (j=0; j < l[i].nb; j++) |
for (j=0; j<l[i].nb; j++) |
|
{ |
{ |
if (l[i].d[j]<ysml) |
if (l[i].d[j] < ysml) ysml = l[i].d[j]; |
ysml=l[i].d[j]; |
else if (l[i].d[j] > ybig) ybig = 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].xsml = xsml; l[0].xbig = xbig; |
l[0].ysml=ysml; l[0].ybig=ybig; |
l[0].ysml = ysml; l[0].ybig = ybig; |
return l; |
return l; |
} |
} |
|
|
Line 1291 single_recursion(dblPointList *pl,char *ch,entree *ep, |
|
Line 1278 single_recursion(dblPointList *pl,char *ch,entree *ep, |
|
GEN xright,GEN yright,long depth) |
GEN xright,GEN yright,long depth) |
{ |
{ |
GEN xx,yy; |
GEN xx,yy; |
long av=avma; |
gpmem_t av=avma; |
double dy=pl[0].ybig - pl[0].ysml; |
double dy=pl[0].ybig - pl[0].ysml; |
|
|
if (depth==RECUR_MAXDEPTH) return; |
if (depth==RECUR_MAXDEPTH) return; |
Line 1319 param_recursion(dblPointList *pl,char *ch,entree *ep, |
|
Line 1306 param_recursion(dblPointList *pl,char *ch,entree *ep, |
|
GEN yleft, GEN tright,GEN xright,GEN yright, long depth) |
GEN yleft, GEN tright,GEN xright,GEN yright, long depth) |
{ |
{ |
GEN tt,xx,yy, p1; |
GEN tt,xx,yy, p1; |
long av=avma; |
gpmem_t av=avma; |
double dy=pl[0].ybig - pl[0].ysml; |
double dy=pl[0].ybig - pl[0].ysml; |
double dx=pl[0].xbig - pl[0].xsml; |
double dx=pl[0].xbig - pl[0].xsml; |
|
|
Line 1358 rectplothin(entree *ep, GEN a, GEN b, char *ch, long p |
|
Line 1345 rectplothin(entree *ep, GEN a, GEN b, char *ch, long p |
|
long recur=flags & PLOT_RECURSIVE; |
long recur=flags & PLOT_RECURSIVE; |
GEN p1,dx,x,xleft,xright,yleft,yright,tleft,tright; |
GEN p1,dx,x,xleft,xright,yleft,yright,tleft,tright; |
dblPointList *pl; |
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; |
double xsml,xbig,ysml,ybig,fx,fy; |
|
|
if (!testpoints) |
if (!testpoints) |
Line 1526 extern GEN polint_i(GEN xa, GEN ya, GEN x, long n, GEN |
|
Line 1514 extern GEN polint_i(GEN xa, GEN ya, GEN x, long n, GEN |
|
static void |
static void |
rectsplines(long ne, double *x, double *y, long lx, long flag) |
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); |
GEN tas, xa = cgetg(lx+1, t_VEC), ya = cgetg(lx+1, t_VEC); |
entree *var0 = varentries[ordvar[0]]; |
entree *var0 = varentries[ordvar[0]]; |
|
|
Line 1543 rectsplines(long ne, double *x, double *y, long lx, lo |
|
Line 1532 rectsplines(long ne, double *x, double *y, long lx, lo |
|
} |
} |
else tas = NULL; /* for lint */ |
else tas = NULL; /* for lint */ |
for (i = 0; i <= lx - 4; i++) { |
for (i = 0; i <= lx - 4; i++) { |
long oavma = avma; |
gpmem_t oavma = avma; |
|
|
xa++; ya++; |
xa++; ya++; |
if (flag & PLOT_PARAMETRIC) { |
if (flag & PLOT_PARAMETRIC) { |
Line 1600 rectplothrawin(long stringrect, long drawrect, dblPoin |
|
Line 1589 rectplothrawin(long stringrect, long drawrect, dblPoin |
|
GEN res; |
GEN res; |
dblPointList y,x; |
dblPointList y,x; |
double xsml,xbig,ysml,ybig,tmp; |
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]; |
long i,nc,nbpoints, w[2], wx[2], wy[2]; |
|
|
w[0]=stringrect; w[1]=drawrect; |
w[0]=stringrect; w[1]=drawrect; |
|
|
plothraw0(long stringrect, long drawrect, GEN listx, GEN listy, long flags) |
plothraw0(long stringrect, long drawrect, GEN listx, GEN listy, long flags) |
{ |
{ |
PARI_plot *output = init_output(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; |
dblPointList *pl; |
|
|
data[1] = (long) listx; |
data[1] = (long) listx; |
Line 1844 postploth2(entree *ep, GEN a, GEN b, char *ch, long pr |
|
Line 1834 postploth2(entree *ep, GEN a, GEN b, char *ch, long pr |
|
} |
} |
|
|
GEN |
GEN |
plothsizes() |
plothsizes(void) |
{ |
{ |
return plothsizes_flag(0); |
return plothsizes_flag(0); |
} |
} |
Line 1895 static void ps_string(FILE *psfile, int x, int y, char |
|
Line 1885 static void ps_string(FILE *psfile, int x, int y, char |
|
#define JSCR 800 /* 1120 en haute resolution */ |
#define JSCR 800 /* 1120 en haute resolution */ |
|
|
static void |
static void |
PARI_get_psplot() |
PARI_get_psplot(void) |
{ |
{ |
pari_psplot.height = JSCR - 60; |
pari_psplot.height = JSCR - 60; |
pari_psplot.width = ISCR - 40; |
pari_psplot.width = ISCR - 40; |