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