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

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

1.1       noro        1: /* $Id: gp_init.c,v 1.11 2001/09/18 11:04:49 karim Exp $
                      2:
                      3: Copyright (C) 2000  The PARI group.
                      4:
                      5: This file is part of the PARI/GP package.
                      6:
                      7: PARI/GP is free software; you can redistribute it and/or modify it under the
                      8: terms of the GNU General Public License as published by the Free Software
                      9: Foundation. It is distributed in the hope that it will be useful, but WITHOUT
                     10: ANY WARRANTY WHATSOEVER.
                     11:
                     12: Check the License for details. You should have received a copy of it, along
                     13: with the package; see the file 'COPYING'. If not, write to the Free Software
                     14: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
                     15:
                     16: /*******************************************************************/
                     17: /*                                                                 */
                     18: /*                    GP-SPECIFIC FUNCTIONS                        */
                     19: /*                                                                 */
                     20: /*******************************************************************/
                     21: #include "pari.h"
                     22: #include "../graph/rect.h"
                     23:
                     24: extern void  addhelp(entree *ep, char *s);
                     25: extern void  allocatemem0(unsigned long newsize);
                     26: extern GEN   default0(char *a, char *b, long flag);
                     27: extern void  error0(GEN *g);
                     28: extern GEN   extern0(char *cmd);
                     29: extern void  gp_quit(void);
                     30: extern void  gpwritebin(char *s, GEN x);
                     31: extern GEN   input0();
                     32: extern void  kill0(entree *ep);
                     33: extern void  print0(GEN *g,long flag);
                     34: extern GEN   read0(char *s);
                     35: extern long  setprecr(long n);
                     36: extern void  system0(char *cmd);
                     37: extern GEN   trap0(char *e, char *f, char *r);
                     38: extern int   whatnow(char *s, int silent);
                     39: extern void  write0(char *s, GEN *g, long flag);
                     40:
                     41: static void
                     42: whatnow0(char *s) { whatnow(s,0); }
                     43:
                     44: entree functions_gp[]={
                     45: {"allocatemem",0,(void*)allocatemem0,11,"vD0,L,"},
                     46: {"default",0,(void*)default0,11,"D\"\",r,D\"\",s,D0,L,"},
                     47: {"error",0,(void*)error0,11,"vs*"},
                     48: {"extern",1,(void*)extern0,11,"s"},
                     49: {"input",0,(void*)input0,11,""},
                     50: {"global",88,NULL,11,NULL},
                     51: {"print",0,(void*)print0,11,"vs*D0,L,"},
                     52: {"print1",0,(void*)print0,11,"vs*D5,L,"},
                     53: {"printp",0,(void*)print0,11,"vs*D2,L,"},
                     54: {"printp1",0,(void*)print0,11,"vs*D7,L,"},
                     55: {"printtex",0,(void*)print0,11,"vs*D4,L,"},
                     56: {"quit",0,(void*)gp_quit,11,"v"},
                     57: {"read",0,(void*)read0,11,"D\"\",s,"},
                     58: {"system",70,(void*)system0,11,"vs"},
                     59: {"trap",0,(void*)trap0,11,"D\"\",r,DI,DI"},
                     60: {"whatnow",1,(void*)whatnow0,11,"vr"},
                     61: {"write",99,(void*)write0,11,"vss*D0,L,"},
                     62: {"write1",99,(void*)write0,11,"vss*D5,L,"},
                     63: {"writebin",99,(void*)gpwritebin,11,"vsDG"},
                     64: {"writetex",99,(void*)write0,11,"vss*D4,L,"},
                     65:
                     66: {NULL,0,NULL,0,NULL} /* sentinel */
                     67: };
                     68:
                     69: char *helpmessages_gp[]={
                     70:   "allocatemem({s=0}): allocates a new stack of s bytes. doubles the stack if s is omitted",
                     71:   "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",
                     72:   "error(\"msg\"): abort script with error message msg",
                     73:   "extern(cmd): execute shell command cmd, and feeds the result to GP (as if loading from file)",
                     74:   "input(): read an expression from the input file or standard input",
                     75:   "global(x): declare x to be a global variable",
                     76:   "print(a): outputs a (in raw format) ending with newline",
                     77:   "print1(a): outputs a (in raw format) without ending with newline",
                     78:   "printp(a): outputs a (in beautified format) ending with newline",
                     79:   "printp1(a): outputs a (in beautified format) without ending with newline",
                     80:   "printtex(a): outputs a in TeX format",
                     81:   "quit(): quits GP and return to the system",
                     82:   "read({filename}): read from the input file filename. If filename is omitted, reread last input file (be it from readfile or \\r)",
                     83:   "system(a): a being a string, execute the system command a (not valid on every machine)",
                     84:   "trap({err}, {rec}, {seq}): try to execute seq, trapping error err (all of them if err ommitted); sequence rec is executed if the error occurs and is the result of the command. When seq is omitted, define rec as a default handler for error err (a break loop will be started if rec omitted). If rec is the empty string \"\" pop out the last default handler",
                     85:   "whatnow(fun): if f was present in GP version 1.39.15 or lower, gives the new function name",
                     86:   "write(filename,a): write the string expression a (same output as print) to filename",
                     87:   "write1(filename,a): write the string expression a (same output as print1) to filename",
                     88:   "writebin(filename,{x}): write x as a binary object to file filename. If x is omitted, write all session variables",
                     89:   "writetex(filename,a): write the string expression a (same format as print) to filename, in TeX format",
                     90: };
                     91:
                     92: /* Backward Compatibility */
                     93:
                     94: static GEN
                     95: gtype(GEN x)
                     96: {
                     97:   return stoi(typ(x));
                     98: }
                     99:
                    100: static GEN
                    101: gsettype(GEN x,long t)
                    102: {
                    103:   x=gcopy(x); settyp(x,t); return x;
                    104: }
                    105:
                    106: static long
                    107: setserieslength(long n)
                    108: {
                    109:   long m=precdl;
                    110:   if(n>0) precdl=n;
                    111:   return m;
                    112: }
                    113:
                    114: entree functions_oldgp[] = {
                    115: {"allocatemem",11,(void *)allocatemem0,2,"vLp"},
                    116: {"box",35,(void *)rectbox,10,"vLGG"},
                    117: {"color",2,(void *)rectcolor,2,"vLL"},
                    118: {"cursor",11,(void*)rectcursor,10,"vLp"},
                    119: {"default",0,(void*)default0,11,"D\"\",r,D\"\",s,D0,L,"},
                    120: {"draw",1,(void*)rectdraw,10,"vGp"},
                    121: {"initrect",34,(void*)initrect,10,"vLLL"},
                    122: {"kill",85,(void*)kill0,11,"vS"},
                    123: {"killrect",11,(void *)killrect,10,"vL"},
                    124: {"line",35,(void *)rectline,10,"vLGG"},
                    125: {"lines",35,(void *)rectlines,10,"vLGG"},
                    126: {"move",35,(void*)rectmove,10,"vLGG"},
                    127: {"plot",99,(void *)plot,10,"vV=GGIDGDGp"},
                    128: {"ploth",37,(void *)ploth,10,"V=GGIp"},
                    129: {"ploth2",37,(void *)ploth2,10,"V=GGIp"},
                    130: {"plothmult",37,(void *)plothmult,10,"V=GGIp"},
                    131: {"plothraw",2,(void *)plothraw,10,"GGp"},
                    132: {"point",35,(void *)rectpoint,10,"vLGG"},
                    133: {"points",35,(void *)rectpoints,10,"vLGG"},
                    134: {"postdraw",1,(void *)postdraw,10,"vG"},
                    135: {"postploth",37,(void *)postploth,10,"V=GGIpD0,L,D0,L,"},
                    136: {"postploth2",37,(void *)postploth2,10,"V=GGIpD0,L,"},
                    137: {"postplothraw",2,(void *)postplothraw,10,"GGD0,L,"},
                    138: {"pprint",0,(void*)print0,11,"vs*D2,L,"},
                    139: {"pprint1",0,(void*)print0,11,"vs*D7,L,"},
                    140: {"print",0,(void*)print0,11,"vs*D0,L,"},
                    141: {"print1",0,(void*)print0,11,"vs*D5,L,"},
                    142: {"rbox",35,(void *)rectrbox,10,"vLGG"},
                    143: {"read",0,(void *)input0,11,""},
                    144: {"rline",35,(void *)rectrline,10,"vLGG"},
                    145: {"rlines",35,(void *)rectlines,10,"vLGG"},
                    146: {"rmove",35,(void *)rectrmove,10,"vLGG"},
                    147: {"rpoint",35,(void *)rectrpoint,10,"vLGG"},
                    148: {"rpoints",35,(void *)rectpoints,10,"vLGG"},
                    149: {"scale",59,(void *)rectscale,10,"vLGGGG"},
                    150: {"setprecision",15,(void *)setprecr,2,"lL"},
                    151: {"setserieslength",15,(void *)setserieslength,2,"lL"},
                    152: {"settype",21,(void *)gsettype,2,"GL"},
                    153: {"string",57,(void*)rectstring,10,"vLs"},
                    154: {"system",70,(void*) system0,11,"vs"},
                    155: {"texprint",0,(void*)print0,11,"vs*D4,L,"},
                    156: {"type",1,(void *)gtype,2,"Gp"},
                    157:
                    158: {NULL,0,NULL,0,NULL} /* sentinel */
                    159: };
                    160:
                    161: char *helpmessages_oldgp[] = {
                    162:   "allocatemem(s)=allocates a new stack of s bytes, or doubles the stack if size is 0",
                    163:   "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)",
                    164:   "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",
                    165:   "cursor(w)=current position of cursor in rectwindow w",
                    166:   "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",
                    167:   "draw(list)=draw vector of rectwindows list at indicated x,y positions; list is a vector w1,x1,y1,w2,x2,y2,etc...",
                    168:   "initrect(w,x,y)=initialize rectwindow w to size x,y",
                    169:   "kill(x)= kills the present value of the variable or function x. Returns new value or 0",
                    170:   "killrect(w)=erase the rectwindow w",
                    171:   "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",
                    172:   "lines(w,listx,listy)=draws an open polygon in rectwindow w where listx and listy contain the x (resp. y) coordinates of the vertices",
                    173:   "move(w,x,y)=move cursor to position x,y in rectwindow w",
                    174:   "plot(X=a,b,expr)=crude plot of expression expr, X goes from a to b",
                    175:   "ploth(X=a,b,expr)=plot of expression expr, X goes from a to b in high resolution",
                    176:   "ploth2(X=a,b,[expr1,expr2])=plot of points [expr1,expr2], X goes from a to b in high resolution",
                    177:   "plothmult(X=a,b,[expr1,...])=plot of expressions expr1,..., X goes from a to b in high resolution",
                    178:   "plothraw(listx,listy)=plot in high resolution points whose x (resp. y) coordinates are in listx (resp. listy)",
                    179:   "point(w,x,y)=draw a point (and move cursor) at position x,y in rectwindow w",
                    180:   "points(w,listx,listy)=draws in rectwindow w the points whose x (resp y) coordinates are in listx (resp listy)",
                    181:   "postdraw(list)=same as plotdraw, except that the output is a PostScript program in file \"pari.ps\"",
                    182:   "postploth(X=a,b,expr)=same as ploth, except that the output is a PostScript program in the file \"pari.ps\"",
                    183:   "postploth2(X=a,b,[expr1,expr2])=same as ploth2, except that the output is a PostScript program in the file \"pari.ps\"",
                    184:   "postplothraw(listx,listy)=same as plothraw, except that the output is a PostScript program in the file \"pari.ps\"",
                    185:   "pprint(a)=outputs a in beautified format ending with newline",
                    186:   "pprint1(a)=outputs a in beautified format without ending with newline",
                    187:   "print(a)=outputs a in raw format ending with newline",
                    188:   "print1(a)=outputs a in raw format without ending with newline",
                    189:   "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)",
                    190:   "read()=read an expression from the input file or standard input",
                    191:   "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",
                    192:   "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",
                    193:   "rmove(w,dx,dy)=move cursor to position (dx,dy) relative to the present position in the rectwindow w",
                    194:   "rpoint(w,dx,dy)=draw a point (and move cursor) at position dx,dy relative to present position of the cursor in rectwindow w",
                    195:   "rpoints(w,xs,ys)=draw in rectwindow w the points given by vector of first coordinates xs and vector of second coordinates ys",
                    196:   "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)",
                    197:   "setprecision(n)=set the current precision to n decimal digits if n>0, or return the current precision if n<=0",
                    198:   "setserieslength(n)=set the default length of power series to n if n>0, or return the current default length if n<=0",
                    199:   "settype(x,t)=make a copy of x with type t (to use with extreme care)",
                    200:   "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",
                    201:   "system(a): a being a string, execute the system command a (not valid on every machine)",
                    202:   "texprint(a)=outputs a in TeX format",
                    203:   "type(x)=internal type number of the GEN x"
                    204: };

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