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