1 | #ifndef IPSHELL_H |
---|
2 | #define IPSHELL_H |
---|
3 | /**************************************** |
---|
4 | * Computer Algebra System SINGULAR * |
---|
5 | ****************************************/ |
---|
6 | /* |
---|
7 | * ABSTRACT |
---|
8 | */ |
---|
9 | #include <stdio.h> |
---|
10 | //#include <kernel/structs.h> |
---|
11 | #include <kernel/ideals.h> |
---|
12 | #include <Singular/lists.h> |
---|
13 | #include <Singular/fevoices.h> |
---|
14 | |
---|
15 | struct _ssubexpr; |
---|
16 | typedef struct _ssubexpr *Subexpr; |
---|
17 | |
---|
18 | BOOLEAN spectrumProc ( leftv,leftv ); |
---|
19 | BOOLEAN spectrumfProc( leftv,leftv ); |
---|
20 | BOOLEAN spaddProc ( leftv,leftv,leftv ); |
---|
21 | BOOLEAN spmulProc ( leftv,leftv,leftv ); |
---|
22 | BOOLEAN semicProc ( leftv,leftv,leftv ); |
---|
23 | BOOLEAN semicProc3 ( leftv,leftv,leftv,leftv ); |
---|
24 | |
---|
25 | BOOLEAN iiAssignCR(leftv, leftv); |
---|
26 | |
---|
27 | BOOLEAN iiARROW (leftv, char*,char *); |
---|
28 | |
---|
29 | extern leftv iiCurrArgs; |
---|
30 | extern idhdl iiCurrProc; |
---|
31 | extern int iiOp; /* the current operation*/ |
---|
32 | extern const char * currid; |
---|
33 | extern int iiRETURNEXPR_len; |
---|
34 | extern sleftv iiRETURNEXPR; |
---|
35 | #ifdef USE_IILOCALRING |
---|
36 | extern ring *iiLocalRing; |
---|
37 | #endif |
---|
38 | //extern cmdnames cmds[]; |
---|
39 | extern const char *lastreserved; |
---|
40 | extern const char *singular_date; /* tesths.cc, set by final compile */ |
---|
41 | extern int myynest; |
---|
42 | extern int printlevel; |
---|
43 | extern int si_echo; |
---|
44 | |
---|
45 | |
---|
46 | extern BOOLEAN yyInRingConstruction; /* 1: during ring construction */ |
---|
47 | |
---|
48 | int IsCmd(const char *n, int & tok); |
---|
49 | |
---|
50 | BOOLEAN iiPStart(idhdl pn, sleftv * sl); |
---|
51 | BOOLEAN iiEStart(char* example, procinfo *pi); |
---|
52 | BOOLEAN iiAllStart(procinfov pi, char *p,feBufferTypes t, int l); |
---|
53 | void type_cmd(leftv v); |
---|
54 | void test_cmd(int i); |
---|
55 | void list_cmd(int typ, const char* what, const char * prefix, |
---|
56 | BOOLEAN iterate, BOOLEAN fullname=FALSE); |
---|
57 | //char * iiStringMatrix(matrix im, int dim, char ch=','); |
---|
58 | void killlocals(int v); |
---|
59 | int exprlist_length(leftv v); |
---|
60 | const char * Tok2Cmdname(int i); |
---|
61 | const char * iiTwoOps(int t); |
---|
62 | int iiOpsTwoChar(const char *s); |
---|
63 | |
---|
64 | int IsPrime(int i); |
---|
65 | |
---|
66 | BOOLEAN iiWRITE(leftv res,leftv exprlist); |
---|
67 | BOOLEAN iiExport(leftv v, int toLev); |
---|
68 | BOOLEAN iiExport(leftv v, int toLev, package pack); |
---|
69 | BOOLEAN iiInternalExport (leftv v, int toLev, package pack); |
---|
70 | char * iiGetLibName(procinfov v); |
---|
71 | char * iiGetLibProcBuffer( procinfov pi, int part=1 ); |
---|
72 | char * iiProcName(char *buf, char & ct, char* &e); |
---|
73 | char * iiProcArgs(char *e,BOOLEAN withParenth); |
---|
74 | BOOLEAN iiLibCmd( char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force ); |
---|
75 | /* sees wheter library lib has already been loaded |
---|
76 | if yes, writes filename of lib into where and returns TRUE, |
---|
77 | if no, returns FALSE |
---|
78 | */ |
---|
79 | /// load lib/module given in v |
---|
80 | BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport = FALSE); |
---|
81 | BOOLEAN iiLocateLib(const char* lib, char* where); |
---|
82 | leftv iiMap(map theMap, const char * what); |
---|
83 | void iiMakeResolv(resolvente r, int length, int rlen, char * name, int typ0, |
---|
84 | intvec ** weights=NULL); |
---|
85 | BOOLEAN jjMINRES(leftv res, leftv v); |
---|
86 | BOOLEAN jjBETTI(leftv res, leftv v); |
---|
87 | BOOLEAN jjBETTI2(leftv res, leftv u, leftv v); |
---|
88 | BOOLEAN jjBETTI2_ID(leftv res, leftv u, leftv v); |
---|
89 | BOOLEAN jjIMPORTFROM(leftv res, leftv u, leftv v); |
---|
90 | BOOLEAN jjLIST_PL(leftv res, leftv v); |
---|
91 | |
---|
92 | BOOLEAN jjVARIABLES_P(leftv res, leftv u); |
---|
93 | BOOLEAN jjVARIABLES_ID(leftv res, leftv u); |
---|
94 | |
---|
95 | int iiRegularity(lists L); |
---|
96 | leftv singular_system(sleftv h); |
---|
97 | BOOLEAN jjSYSTEM(leftv res, leftv v); |
---|
98 | void iiDebug(); |
---|
99 | BOOLEAN iiCheckRing(int i); |
---|
100 | poly iiHighCorner(ideal i, int ak); |
---|
101 | char * iiConvName(const char *libname); |
---|
102 | BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib, |
---|
103 | idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror); |
---|
104 | |
---|
105 | // converts a resolution into a list of modules |
---|
106 | lists syConvRes(syStrategy syzstr,BOOLEAN toDel=FALSE,int add_row_shift=0); |
---|
107 | // converts a list of modules into a minimal resolution |
---|
108 | syStrategy syForceMin(lists li); |
---|
109 | // converts a list of modules into a resolution |
---|
110 | syStrategy syConvList(lists li,BOOLEAN toDel); |
---|
111 | |
---|
112 | BOOLEAN syBetti1(leftv res, leftv u); |
---|
113 | BOOLEAN syBetti2(leftv res, leftv u, leftv w); |
---|
114 | |
---|
115 | /* ================================================================== */ |
---|
116 | /* Expressions : */ |
---|
117 | BOOLEAN iiExprArith1(leftv res, sleftv* a, int op); |
---|
118 | BOOLEAN iiExprArith2(leftv res, sleftv* a, int op, sleftv* b, |
---|
119 | BOOLEAN proccall=FALSE); |
---|
120 | BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c); |
---|
121 | BOOLEAN iiExprArithM(leftv res, sleftv* a, int op); |
---|
122 | BOOLEAN iiApply(leftv res,leftv a, int op, leftv proc); |
---|
123 | |
---|
124 | typedef BOOLEAN (*proc1)(leftv,leftv); |
---|
125 | |
---|
126 | #ifdef GENTABLE |
---|
127 | typedef char * (*Proc1)(char *); |
---|
128 | struct sValCmd1 |
---|
129 | { |
---|
130 | proc1 p; |
---|
131 | short cmd; |
---|
132 | short res; |
---|
133 | short arg; |
---|
134 | short valid_for; |
---|
135 | }; |
---|
136 | |
---|
137 | typedef BOOLEAN (*proc2)(leftv,leftv,leftv); |
---|
138 | struct sValCmd2 |
---|
139 | { |
---|
140 | proc2 p; |
---|
141 | short cmd; |
---|
142 | short res; |
---|
143 | short arg1; |
---|
144 | short arg2; |
---|
145 | short valid_for; |
---|
146 | }; |
---|
147 | |
---|
148 | typedef BOOLEAN (*proc3)(leftv,leftv,leftv,leftv); |
---|
149 | struct sValCmd3 |
---|
150 | { |
---|
151 | proc3 p; |
---|
152 | short cmd; |
---|
153 | short res; |
---|
154 | short arg1; |
---|
155 | short arg2; |
---|
156 | short arg3; |
---|
157 | short valid_for; |
---|
158 | }; |
---|
159 | struct sValCmdM |
---|
160 | { |
---|
161 | proc1 p; |
---|
162 | short cmd; |
---|
163 | short res; |
---|
164 | short number_of_args; /* -1: any, -2: any >0, .. */ |
---|
165 | short valid_for; |
---|
166 | }; |
---|
167 | extern struct sValCmd2 dArith2[]; |
---|
168 | extern struct sValCmd1 dArith1[]; |
---|
169 | extern struct sValCmd3 dArith3[]; |
---|
170 | extern struct sValCmdM dArithM[]; |
---|
171 | #endif |
---|
172 | |
---|
173 | /* ================================================================== */ |
---|
174 | /* Assigments : */ |
---|
175 | BOOLEAN iiAssign(leftv left, leftv right); |
---|
176 | |
---|
177 | typedef BOOLEAN (*proci)(leftv,leftv,Subexpr); |
---|
178 | struct sValAssign_sys |
---|
179 | { |
---|
180 | proc1 p; |
---|
181 | short res; |
---|
182 | short arg; |
---|
183 | }; |
---|
184 | |
---|
185 | struct sValAssign |
---|
186 | { |
---|
187 | proci p; |
---|
188 | short res; |
---|
189 | short arg; |
---|
190 | }; |
---|
191 | |
---|
192 | BOOLEAN iiParameter(leftv p); |
---|
193 | BOOLEAN iiAlias(leftv p); |
---|
194 | |
---|
195 | int iiTokType(int op); |
---|
196 | /* ================================================================== */ |
---|
197 | int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl* root, |
---|
198 | BOOLEAN isring = FALSE, BOOLEAN init_b=TRUE); |
---|
199 | BOOLEAN iiMake_proc(idhdl pn, package pack, sleftv* sl); |
---|
200 | // from misc.cc: |
---|
201 | char * showOption(); |
---|
202 | BOOLEAN setOption(leftv res, leftv v); |
---|
203 | /* ================================================================== */ |
---|
204 | char * versionString(); |
---|
205 | /* ================================================================== */ |
---|
206 | void singular_example(char *str); |
---|
207 | |
---|
208 | BOOLEAN iiTryLoadLib(leftv v, const char *id); |
---|
209 | |
---|
210 | int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic, |
---|
211 | BOOLEAN(*func)(leftv res, leftv v)); |
---|
212 | |
---|
213 | void iiCheckPack(package &p); |
---|
214 | #ifndef SING_NDEBUG |
---|
215 | void checkall(); |
---|
216 | #endif |
---|
217 | |
---|
218 | void rSetHdl(idhdl h); |
---|
219 | ring rInit(sleftv* pn, sleftv* rv, sleftv* ord); |
---|
220 | idhdl rDefault(const char *s); |
---|
221 | |
---|
222 | idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n=NULL); |
---|
223 | idhdl rFindHdl(ring r, idhdl n); |
---|
224 | void rKill(idhdl h); |
---|
225 | void rKill(ring r); |
---|
226 | lists scIndIndset(ideal S, BOOLEAN all, ideal Q); |
---|
227 | BOOLEAN mpKoszul(leftv res,leftv c/*ip*/, leftv b/*in*/, leftv id); |
---|
228 | BOOLEAN mpJacobi(leftv res,leftv a); |
---|
229 | BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w); |
---|
230 | BOOLEAN kQHWeight(leftv res,leftv v); |
---|
231 | BOOLEAN kWeight(leftv res,leftv id); |
---|
232 | BOOLEAN loSimplex( leftv res, leftv args ); |
---|
233 | BOOLEAN loNewtonP( leftv res, leftv arg1 ); |
---|
234 | BOOLEAN nuMPResMat( leftv res, leftv arg1, leftv arg2 ); |
---|
235 | BOOLEAN nuLagSolve( leftv res, leftv arg1, leftv arg2, leftv arg3 ); |
---|
236 | BOOLEAN nuVanderSys( leftv res, leftv arg1, leftv arg2, leftv arg3); |
---|
237 | BOOLEAN nuUResSolve( leftv res, leftv args ); |
---|
238 | |
---|
239 | BOOLEAN jjCHARSERIES(leftv res, leftv u); |
---|
240 | /* |
---|
241 | BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w); |
---|
242 | #if 0 |
---|
243 | BOOLEAN jjIS_SQR_FREE(leftv res, leftv u); |
---|
244 | #endif |
---|
245 | */ |
---|
246 | /* ================================================================== */ |
---|
247 | void paPrint(const char *n,package p); |
---|
248 | /* ================================================================== */ |
---|
249 | |
---|
250 | |
---|
251 | BOOLEAN iiTestAssume(leftv a, leftv b); |
---|
252 | |
---|
253 | /* table inteface for iiAddCproc */ |
---|
254 | BOOLEAN iiExprArith1Tab(leftv res, leftv a, int op, struct sValCmd1* dArith1, int i); |
---|
255 | #endif |
---|
256 | |
---|