[BACK]Return to gp_init.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / pari / src / gp

Annotation of OpenXM_contrib/pari/src/gp/gp_init.c, Revision 1.1.1.1

1.1       maekawa     1: /*******************************************************************/
                      2: /*                                                                 */
                      3: /*                    GP-SPECIFIC FUNCTIONS                        */
                      4: /*                                                                 */
                      5: /*******************************************************************/
                      6: /* $Id: gp_init.c,v 1.1.1.1 1999/09/16 13:47:39 karim Exp $ */
                      7: #include "pari.h"
                      8: #include "../graph/rect.h"
                      9:
                     10: void  addhelp(entree *ep, char *s);
                     11: void  allocatemem0(unsigned long newsize);
                     12: GEN   default0(char *a, char *b, long flag);
                     13: void  error0(GEN *g);
                     14: GEN   extern0(char *cmd);
                     15: void  gp_quit(void);
                     16: GEN   input0();
                     17: void  kill0(entree *ep);
                     18: void  print0(GEN *g,long flag);
                     19: GEN   read0(char *s);
                     20: long  setprecr(long n);
                     21: void  system0(char *cmd);
                     22: int   whatnow(char *s, int silent);
                     23: void  write0(char *s, GEN *g, long flag);
                     24:
                     25: static void
                     26: whatnow0(char *s) { whatnow(s,0); }
                     27:
                     28: entree functions_gp[]={
                     29: {"allocatemem",0,(void*)allocatemem0,11,"vD0,L,"},
                     30: {"default",0,(void*)default0,11,"D\"\",r,D\"\",s,D0,L,"},
                     31: {"error",0,(void*)error0,11,"vs*"},
                     32: {"extern",1,(void*)extern0,11,"s"},
                     33: {"input",0,(void*)input0,11,""},
                     34: {"global",88,NULL,11,NULL},
                     35: {"print",0,(void*)print0,11,"vs*D0,L,"},
                     36: {"print1",0,(void*)print0,11,"vs*D4,L,"},
                     37: {"printp",0,(void*)print0,11,"vs*D2,L,"},
                     38: {"printp1",0,(void*)print0,11,"vs*D6,L,"},
                     39: {"printtex",0,(void*)print0,11,"vs*D3,L,"},
                     40: {"quit",0,(void*)gp_quit,11,"v"},
                     41: {"read",0,(void*)read0,11,"D\"\",s,"},
                     42: {"system",70,(void*) system0,11,"vs"},
                     43: {"whatnow",1,(void*)whatnow0,11,"vr"},
                     44: {"write",0,(void*)write0,11,"vss*D0,L,"},
                     45: {"write1",0,(void*)write0,11,"vss*D4,L,"},
                     46: {"writetex",0,(void*)write0,11,"vss*D3,L,"},
                     47:
                     48: {NULL,0,NULL,0,NULL} /* sentinel */
                     49: };
                     50:
                     51: char *helpmessages_gp[]={
                     52:   "allocatemem({s=0}): allocates a new stack of s bytes. doubles the stack if s is omitted",
                     53:   "default({opt},{v},{flag}): set the default opt to v. If v is omitted, print the current default for opt. If no argument is given, print a list of all defaults as well as their values. If flag is non-zero, return the result instead of printing it on screen. See manual for details",
                     54:   "error(\"msg\"): abort script with error message msg",
                     55:   "extern(cmd): execute shell command cmd, and feeds the result to GP (as if loading from file)",
                     56:   "input(): read an expression from the input file or standard input",
                     57:   "global(x): declare x to be a global variable",
                     58:   "print(a): outputs a (in raw format) ending with newline",
                     59:   "print1(a): outputs a (in raw format) without ending with newline",
                     60:   "printp(a): outputs a (in beautified format) ending with newline",
                     61:   "printp1(a): outputs a (in beautified format) without ending with newline",
                     62:   "printtex(a): outputs a in TeX format",
                     63:   "quit(): quits GP and return to the system",
                     64:   "read({filename}): read from the input file filename. If filename is omitted, reread last input file (be it from readfile or \\r)",
                     65:   "system(a): a being a string, execute the system command a (not valid on every machine)",
                     66:   "whatnow(fun): if f was present in GP version 1.39.15 or lower, gives the new function name",
                     67:   "write(filename,a): write the string expression a (same output as print) to filename",
                     68:   "write1(filename,a): write the string expression a (same output as print1) to filename",
                     69:   "writetex(filename,a): write the string expression a (same format as print) to filename, in TeX format",
                     70: };
                     71:
                     72: /* Backward Compatibility */
                     73:
                     74: static GEN
                     75: gtype(GEN x)
                     76: {
                     77:   return stoi(typ(x));
                     78: }
                     79:
                     80: static GEN
                     81: gsettype(GEN x,long t)
                     82: {
                     83:   x=gcopy(x); settyp(x,t); return x;
                     84: }
                     85:
                     86: static long
                     87: setserieslength(long n)
                     88: {
                     89:   long m=precdl;
                     90:   if(n>0) precdl=n;
                     91:   return m;
                     92: }
                     93:
                     94: entree functions_oldgp[] = {
                     95: {"allocatemem",11,(void *)allocatemem0,2,"vLp"},
                     96: {"box",35,(void *)rectbox,10,"vLGG"},
                     97: {"color",2,(void *)rectcolor,2,"vLL"},
                     98: {"cursor",11,(void*)rectcursor,10,"vLp"},
                     99: {"default",0,(void*)default0,11,"D\"\",r,D\"\",s,D0,L,"},
                    100: {"draw",1,(void*)rectdraw,10,"vGp"},
                    101: {"initrect",34,(void*)initrect,10,"vLLL"},
                    102: {"kill",85,(void*)kill0,11,"vS"},
                    103: {"killrect",11,(void *)killrect,10,"vL"},
                    104: {"line",35,(void *)rectline,10,"vLGG"},
                    105: {"lines",35,(void *)rectlines,10,"vLGG"},
                    106: {"move",35,(void*)rectmove,10,"vLGG"},
                    107: {"plot",37,(void *)plot,10,"vV=GGIp"},
                    108: {"ploth",37,(void *)ploth,10,"V=GGIp"},
                    109: {"ploth2",37,(void *)ploth2,10,"V=GGIp"},
                    110: {"plothmult",37,(void *)plothmult,10,"V=GGIp"},
                    111: {"plothraw",2,(void *)plothraw,10,"GGp"},
                    112: {"point",35,(void *)rectpoint,10,"vLGG"},
                    113: {"points",35,(void *)rectpoints,10,"vLGG"},
                    114: {"postdraw",1,(void *)postdraw,10,"vG"},
                    115: {"postploth",37,(void *)postploth,10,"V=GGIpD0,L,D0,L,"},
                    116: {"postploth2",37,(void *)postploth2,10,"V=GGIpD0,L,"},
                    117: {"postplothraw",2,(void *)postplothraw,10,"GGD0,L,"},
                    118: {"pprint",0,(void*)print0,11,"vs*D2,L,"},
                    119: {"pprint1",0,(void*)print0,11,"vs*D6,L,"},
                    120: {"print",0,(void*)print0,11,"vs*D0,L,"},
                    121: {"print1",0,(void*)print0,11,"vs*D4,L,"},
                    122: {"rbox",35,(void *)rectrbox,10,"vLGG"},
                    123: {"read",0,(void *)input0,11,""},
                    124: {"rline",35,(void *)rectrline,10,"vLGG"},
                    125: {"rlines",35,(void *)rectlines,10,"vLGG"},
                    126: {"rmove",35,(void *)rectrmove,10,"vLGG"},
                    127: {"rpoint",35,(void *)rectrpoint,10,"vLGG"},
                    128: {"rpoints",35,(void *)rectpoints,10,"vLGG"},
                    129: {"scale",59,(void *)rectscale,10,"vLGGGG"},
                    130: {"setprecision",15,(void *)setprecr,2,"Ll"},
                    131: {"setserieslength",15,(void *)setserieslength,2,"Ll"},
                    132: {"settype",21,(void *)gsettype,2,"GL"},
                    133: {"string",57,(void*)rectstring,10,"vLs"},
                    134: {"system",70,(void*) system0,11,"vs"},
                    135: {"texprint",0,(void*)print0,11,"vs*D3,L,"},
                    136: {"type",1,(void *)gtype,2,"Gp"},
                    137:
                    138: {NULL,0,NULL,0,NULL} /* sentinel */
                    139: };
                    140:
                    141: char *helpmessages_oldgp[] = {
                    142:   "allocatemem(s)=allocates a new stack of s bytes, or doubles the stack if size is 0",
                    143:   "box(w,x2,y2)=if the cursor is at position (x1,y1), draw a box with diagonal (x1,y1) and (x2,y2) in rectwindow w (cursor does not move)",
                    144:   "color(w,c)=set default color to c in rectwindow. Possible values for c are 1=sienna, 2=cornsilk, 3=red, 4=black, 5=grey, 6=blue, 7=gainsborough",
                    145:   "cursor(w)=current position of cursor in rectwindow w",
                    146:   "default({opt},{v},{flag}): set the default opt to v. If v is omitted, print the current default for opt. If no argument is given, print a list of all defaults as well as their values. If flag is non-zero, return the result instead of printing it on screen. See manual for details",
                    147:   "draw(list)=draw vector of rectwindows list at indicated x,y positions; list is a vector w1,x1,y1,w2,x2,y2,etc...",
                    148:   "initrect(w,x,y)=initialize rectwindow w to size x,y",
                    149:   "kill(x)= kills the present value of the variable or function x. Returns new value or 0",
                    150:   "killrect(w)=erase the rectwindow w",
                    151:   "line(w,x2,y2)=if cursor is at position (x1,y1), draw a line from (x1,y1) to (x2,y2) (and move the cursor) in the rectwindow w",
                    152:   "lines(w,listx,listy)=draws an open polygon in rectwindow w where listx and listy contain the x (resp. y) coordinates of the vertices",
                    153:   "move(w,x,y)=move cursor to position x,y in rectwindow w",
                    154:   "plot(X=a,b,expr)=crude plot of expression expr, X goes from a to b",
                    155:   "ploth(X=a,b,expr)=plot of expression expr, X goes from a to b in high resolution",
                    156:   "ploth2(X=a,b,[expr1,expr2])=plot of points [expr1,expr2], X goes from a to b in high resolution",
                    157:   "plothmult(X=a,b,[expr1,...])=plot of expressions expr1,..., X goes from a to b in high resolution",
                    158:   "plothraw(listx,listy)=plot in high resolution points whose x (resp. y) coordinates are in listx (resp. listy)",
                    159:   "point(w,x,y)=draw a point (and move cursor) at position x,y in rectwindow w",
                    160:   "points(w,listx,listy)=draws in rectwindow w the points whose x (resp y) coordinates are in listx (resp listy)",
                    161:   "postdraw(list)=same as plotdraw, except that the output is a PostScript program in file \"pari.ps\"",
                    162:   "postploth(X=a,b,expr)=same as ploth, except that the output is a PostScript program in the file \"pari.ps\"",
                    163:   "postploth2(X=a,b,[expr1,expr2])=same as ploth2, except that the output is a PostScript program in the file \"pari.ps\"",
                    164:   "postplothraw(listx,listy)=same as plothraw, except that the output is a PostScript program in the file \"pari.ps\"",
                    165:   "pprint(a)=outputs a in beautified format ending with newline",
                    166:   "pprint1(a)=outputs a in beautified format without ending with newline",
                    167:   "print(a)=outputs a in raw format ending with newline",
                    168:   "print1(a)=outputs a in raw format without ending with newline",
                    169:   "rbox(w,dx,dy)=if the cursor is at (x1,y1), draw a box with diagonal (x1,y1)-(x1+dx,y1+dy) in rectwindow w (cursor does not move)",
                    170:   "read()=read an expression from the input file or standard input",
                    171:   "rline(w,dx,dy)=if the cursor is at (x1,y1), draw a line from (x1,y1) to (x1+dx,y1+dy) (and move the cursor) in the rectwindow w",
                    172:   "rlines(w,dx,dy)=draw in rectwindow w the points given by vector of first coordinates xsand vector of second coordinates, connect them by lines",
                    173:   "rmove(w,dx,dy)=move cursor to position (dx,dy) relative to the present position in the rectwindow w",
                    174:   "rpoint(w,dx,dy)=draw a point (and move cursor) at position dx,dy relative to present position of the cursor in rectwindow w",
                    175:   "rpoints(w,xs,ys)=draw in rectwindow w the points given by vector of first coordinates xs and vector of second coordinates ys",
                    176:   "scale(w,x1,x2,y1,y2)=scale the coordinates in rectwindow w so that x goes from x1 to x2 and y from y1 to y2 (y2<y1 is allowed)",
                    177:   "setprecision(n)=set the current precision to n decimal digits if n>0, or return the current precision if n<=0",
                    178:   "setserieslength(n)=set the default length of power series to n if n>0, or return the current default length if n<=0",
                    179:   "settype(x,t)=make a copy of x with type t (to use with extreme care)",
                    180:   "string(w,x)=draw in rectwindow w the string corresponding to x, where x is either a string, or a number in R, written in format 9.3",
                    181:   "system(a): a being a string, execute the system command a (not valid on every machine)",
                    182:   "texprint(a)=outputs a in TeX format",
                    183:   "type(x)=internal type number of the GEN x"
                    184: };

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>