1 | #ifndef IPSHELL_H |
---|
2 | #define IPSHELL_H |
---|
3 | /**************************************** |
---|
4 | * Computer Algebra System SINGULAR * |
---|
5 | ****************************************/ |
---|
6 | /* $Id: ipshell.h,v 1.52 2008-03-19 17:44:35 Singular Exp $ */ |
---|
7 | /* |
---|
8 | * ABSTRACT |
---|
9 | */ |
---|
10 | #include <stdio.h> |
---|
11 | #include "structs.h" |
---|
12 | |
---|
13 | |
---|
14 | extern int traceit ; |
---|
15 | #define TRACE_SHOW_PROC 1 |
---|
16 | #define TRACE_SHOW_LINENO 2 |
---|
17 | #define TRACE_SHOW_LINE 4 |
---|
18 | #define TRACE_SHOW_RINGS 8 |
---|
19 | #define TRACE_SHOW_LINE1 16 |
---|
20 | #define TRACE_BREAKPOINT 32 |
---|
21 | #define TRACE_TMP_BREAKPOINT 64 |
---|
22 | extern leftv iiCurrArgs; |
---|
23 | extern int iiOp; /* the current operation*/ |
---|
24 | extern int myynest; |
---|
25 | extern const char * currid; |
---|
26 | extern int iiRETURNEXPR_len; |
---|
27 | extern sleftv *iiRETURNEXPR; |
---|
28 | #ifdef USE_IILOCALRING |
---|
29 | extern ring *iiLocalRing; |
---|
30 | #endif |
---|
31 | extern cmdnames cmds[]; |
---|
32 | extern const char *lastreserved; |
---|
33 | extern const char *singular_date; |
---|
34 | |
---|
35 | extern BOOLEAN yyInRingConstruction; /* 1: during ring construction */ |
---|
36 | |
---|
37 | int IsCmd(const char *n, int & tok); |
---|
38 | short IsCmdToken(short tok); |
---|
39 | |
---|
40 | BOOLEAN iiPStart(idhdl pn, sleftv * sl); |
---|
41 | BOOLEAN iiEStart(char* example, procinfo *pi); |
---|
42 | void type_cmd(idhdl h); |
---|
43 | void test_cmd(int i); |
---|
44 | void list_cmd(int typ, const char* what, const char * prefix, |
---|
45 | BOOLEAN iterate, BOOLEAN fullname=FALSE); |
---|
46 | //char * iiStringMatrix(matrix im, int dim, char ch=','); |
---|
47 | void killlocals(int v); |
---|
48 | int exprlist_length(leftv v); |
---|
49 | const char * Tok2Cmdname(int i); |
---|
50 | const char * iiTwoOps(int t); |
---|
51 | int IsPrime(int i); |
---|
52 | |
---|
53 | BOOLEAN iiWRITE(leftv res,leftv exprlist); |
---|
54 | BOOLEAN iiExport(leftv v, int toLev); |
---|
55 | #ifdef HAVE_NS |
---|
56 | BOOLEAN iiExport(leftv v, int toLev, idhdl roothdl); |
---|
57 | BOOLEAN iiInternalExport (leftv v, int toLev, idhdl roothdl); |
---|
58 | #endif /* HAVE_NS */ |
---|
59 | char * iiGetLibName(procinfov v); |
---|
60 | char * iiGetLibProcBuffer( procinfov pi, int part=1 ); |
---|
61 | char * iiProcName(char *buf, char & ct, char* &e); |
---|
62 | char * iiProcArgs(char *e,BOOLEAN withParenth); |
---|
63 | BOOLEAN iiLibCmd( char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force ); |
---|
64 | /* sees wheter library lib has already been loaded |
---|
65 | if yes, writes filename of lib into where and returns TRUE, |
---|
66 | if no, returns FALSE |
---|
67 | */ |
---|
68 | BOOLEAN iiLocateLib(const char* lib, char* where); |
---|
69 | leftv iiMap(map theMap, const char * what); |
---|
70 | void iiMakeResolv(resolvente r, int length, int rlen, char * name, int typ0, |
---|
71 | intvec ** weights=NULL); |
---|
72 | BOOLEAN jjMINRES(leftv res, leftv v); |
---|
73 | BOOLEAN jjBETTI(leftv res, leftv v); |
---|
74 | BOOLEAN jjBETTI2(leftv res, leftv u, leftv v); |
---|
75 | BOOLEAN jjBETTI2_ID(leftv res, leftv u, leftv v); |
---|
76 | BOOLEAN jjIMPORTFROM(leftv res, leftv u, leftv v); |
---|
77 | |
---|
78 | BOOLEAN jjVARIABLES_P(leftv res, leftv u); |
---|
79 | BOOLEAN jjVARIABLES_ID(leftv res, leftv u); |
---|
80 | |
---|
81 | int iiRegularity(lists L); |
---|
82 | leftv singular_system(sleftv h); |
---|
83 | BOOLEAN jjSYSTEM(leftv res, leftv v); |
---|
84 | void iiDebug(); |
---|
85 | BOOLEAN iiCheckRing(int i); |
---|
86 | poly iiHighCorner(ideal i, int ak); |
---|
87 | char * iiConvName(const char *libname); |
---|
88 | BOOLEAN iiLoadLIB(FILE *fp, char *libnamebuf, char *newlib, |
---|
89 | idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror); |
---|
90 | |
---|
91 | |
---|
92 | /* ================================================================== */ |
---|
93 | /* Expressions : */ |
---|
94 | BOOLEAN iiExprArith1(leftv res, sleftv* a, int op); |
---|
95 | BOOLEAN iiExprArith2(leftv res, sleftv* a, int op, sleftv* b, |
---|
96 | BOOLEAN proccall=FALSE); |
---|
97 | BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c); |
---|
98 | BOOLEAN iiExprArithM(leftv res, sleftv* a, int op); |
---|
99 | |
---|
100 | typedef BOOLEAN (*proc1)(leftv,leftv); |
---|
101 | |
---|
102 | #ifdef __GNUC__ |
---|
103 | #if (__GNUC__ < 3) |
---|
104 | #define INIT_BUG 1 |
---|
105 | void jjInitTab1(); |
---|
106 | #endif |
---|
107 | #endif |
---|
108 | |
---|
109 | #ifdef GENTABLE |
---|
110 | typedef char * (*Proc1)(char *); |
---|
111 | struct sValCmd1 |
---|
112 | { |
---|
113 | proc1 p; |
---|
114 | short cmd; |
---|
115 | short res; |
---|
116 | short arg; |
---|
117 | #ifdef HAVE_PLURAL |
---|
118 | short valid_for_plural; |
---|
119 | #endif |
---|
120 | }; |
---|
121 | |
---|
122 | typedef BOOLEAN (*proc2)(leftv,leftv,leftv); |
---|
123 | struct sValCmd2 |
---|
124 | { |
---|
125 | proc2 p; |
---|
126 | short cmd; |
---|
127 | short res; |
---|
128 | short arg1; |
---|
129 | short arg2; |
---|
130 | #ifdef HAVE_PLURAL |
---|
131 | short valid_for_plural; |
---|
132 | #endif |
---|
133 | }; |
---|
134 | |
---|
135 | typedef BOOLEAN (*proc3)(leftv,leftv,leftv,leftv); |
---|
136 | struct sValCmd3 |
---|
137 | { |
---|
138 | proc3 p; |
---|
139 | short cmd; |
---|
140 | short res; |
---|
141 | short arg1; |
---|
142 | short arg2; |
---|
143 | short arg3; |
---|
144 | #ifdef HAVE_PLURAL |
---|
145 | short valid_for_plural; |
---|
146 | #endif |
---|
147 | }; |
---|
148 | struct sValCmdM |
---|
149 | { |
---|
150 | proc1 p; |
---|
151 | short cmd; |
---|
152 | short res; |
---|
153 | short number_of_args; /* -1: any, -2: any >0, .. */ |
---|
154 | #ifdef HAVE_PLURAL |
---|
155 | short valid_for_plural; |
---|
156 | #endif |
---|
157 | }; |
---|
158 | extern struct sValCmd2 dArith2[]; |
---|
159 | extern struct sValCmd1 dArith1[]; |
---|
160 | extern struct sValCmd3 dArith3[]; |
---|
161 | extern struct sValCmdM dArithM[]; |
---|
162 | #endif |
---|
163 | |
---|
164 | /* ================================================================== */ |
---|
165 | /* Assigments : */ |
---|
166 | BOOLEAN iiAssign(leftv left, leftv right); |
---|
167 | |
---|
168 | typedef BOOLEAN (*proci)(leftv,leftv,Subexpr); |
---|
169 | struct sValAssign_sys |
---|
170 | { |
---|
171 | proc1 p; |
---|
172 | short res; |
---|
173 | short arg; |
---|
174 | }; |
---|
175 | |
---|
176 | struct sValAssign |
---|
177 | { |
---|
178 | proci p; |
---|
179 | short res; |
---|
180 | short arg; |
---|
181 | }; |
---|
182 | |
---|
183 | BOOLEAN iiParameter(leftv p); |
---|
184 | /* ================================================================== */ |
---|
185 | int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl* root, |
---|
186 | BOOLEAN isring = FALSE, BOOLEAN init_b=TRUE); |
---|
187 | #ifdef HAVE_NS |
---|
188 | sleftv * iiMake_proc(idhdl pn, package pack, sleftv* sl); |
---|
189 | #else /* HAVE_NS */ |
---|
190 | sleftv * iiMake_proc(idhdl pn, sleftv* sl); |
---|
191 | #endif /* HAVE_NS */ |
---|
192 | // from misc.cc: |
---|
193 | char * showOption(); |
---|
194 | BOOLEAN setOption(leftv res, leftv v); |
---|
195 | /* ================================================================== */ |
---|
196 | char * versionString(); |
---|
197 | /* ================================================================== */ |
---|
198 | void singular_example(char *str); |
---|
199 | |
---|
200 | BOOLEAN iiTryLoadLib(leftv v, const char *id); |
---|
201 | |
---|
202 | #ifdef HAVE_NS |
---|
203 | void listall(int showproc=1); |
---|
204 | void iiCheckPack(package &p); |
---|
205 | #ifndef NDEBUG |
---|
206 | void checkall(); |
---|
207 | #endif |
---|
208 | #endif |
---|
209 | #endif |
---|
210 | |
---|