ipshell.h
Go to the documentation of this file.
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 
24 
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);
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);
60 const char * Tok2Cmdname(int i);
61 const char * iiTwoOps(int t);
62 int iiOpsTwoChar(const char *s);
63 
64 BOOLEAN iiWRITE(leftv res,leftv exprlist);
65 BOOLEAN iiExport(leftv v, int toLev);
66 BOOLEAN iiExport(leftv v, int toLev, package pack);
67 BOOLEAN iiInternalExport (leftv v, int toLev, package pack);
68 char * iiGetLibName(procinfov v);
69 char * iiGetLibProcBuffer( procinfov pi, int part=1 );
70 char * iiProcName(char *buf, char & ct, char* &e);
71 char * iiProcArgs(char *e,BOOLEAN withParenth);
72 BOOLEAN iiLibCmd( char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force );
73 /* sees wheter library lib has already been loaded
74  if yes, writes filename of lib into where and returns TRUE,
75  if no, returns FALSE
76 */
77 /// load lib/module given in v
78 BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport = FALSE);
79 BOOLEAN jjLOAD_TRY(const char *s);
80 BOOLEAN iiLocateLib(const char* lib, char* where);
81 leftv iiMap(map theMap, const char * what);
82 void iiMakeResolv(resolvente r, int length, int rlen, char * name, int typ0,
83  intvec ** weights=NULL);
90 
93 
94 int iiRegularity(lists L);
97 void iiDebug();
98 BOOLEAN iiCheckRing(int i);
99 poly iiHighCorner(ideal i, int ak);
100 char * iiConvName(const char *libname);
101 BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib,
102  idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror);
103 
104 // converts a resolution into a list of modules
105 lists syConvRes(syStrategy syzstr,BOOLEAN toDel=FALSE,int add_row_shift=0);
106 // converts a list of modules into a minimal resolution
108 // converts a list of modules into a resolution
110 
113 
114 /* ================================================================== */
115 /* Expressions : */
116 BOOLEAN iiExprArith1(leftv res, sleftv* a, int op);
118  BOOLEAN proccall=FALSE);
120 BOOLEAN iiExprArithM(leftv res, sleftv* a, int op);
122 
123 typedef BOOLEAN (*proc1)(leftv,leftv);
124 
125 #ifdef GENTABLE
126 typedef char * (*Proc1)(char *);
127 struct sValCmd1
128 {
129  proc1 p;
130  short cmd;
131  short res;
132  short arg;
133  short valid_for;
134 };
135 
137 struct sValCmd2
138 {
139  proc2 p;
140  short cmd;
141  short res;
142  short arg1;
143  short arg2;
144  short valid_for;
145 };
146 
148 struct sValCmd3
149 {
150  proc3 p;
151  short cmd;
152  short res;
153  short arg1;
154  short arg2;
155  short arg3;
156  short valid_for;
157 };
158 struct sValCmdM
159 {
160  proc1 p;
161  short cmd;
162  short res;
163  short number_of_args; /* -1: any, -2: any >0, .. */
164  short valid_for;
165 };
166 extern struct sValCmd2 dArith2[];
167 extern struct sValCmd1 dArith1[];
168 extern struct sValCmd3 dArith3[];
169 extern struct sValCmdM dArithM[];
170 #endif
171 
172 /* ================================================================== */
173 /* Assigments : */
174 BOOLEAN iiAssign(leftv left, leftv right, BOOLEAN toplevel=TRUE);
175 
176 typedef BOOLEAN (*proci)(leftv,leftv,Subexpr);
177 struct sValAssign_sys
178 {
180  short res;
181  short arg;
182 };
183 
184 struct sValAssign
185 {
187  short res;
188  short arg;
189 };
190 
193 
194 int iiTokType(int op);
195 /* ================================================================== */
196 int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl* root,
197  BOOLEAN isring = FALSE, BOOLEAN init_b=TRUE);
198 BOOLEAN iiMake_proc(idhdl pn, package pack, sleftv* sl);
199 // from misc.cc:
200 char * showOption();
202 /* ================================================================== */
203 char * versionString();
204 /* ================================================================== */
205 void singular_example(char *str);
206 
207 BOOLEAN iiTryLoadLib(leftv v, const char *id);
208 
209 int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic,
210  BOOLEAN(*func)(leftv res, leftv v));
211 
212 void iiCheckPack(package &p);
213 #ifndef SING_NDEBUG
214 void checkall();
215 #endif
216 
217 void rSetHdl(idhdl h);
218 ring rInit(leftv pn, leftv rv, leftv ord);
219 idhdl rDefault(const char *s);
220 
221 idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n=NULL);
222 idhdl rFindHdl(ring r, idhdl n);
223 void rKill(idhdl h);
224 void rKill(ring r);
225 lists scIndIndset(ideal S, BOOLEAN all, ideal Q);
226 BOOLEAN mpKoszul(leftv res,leftv c/*ip*/, leftv b/*in*/, leftv id);
231 BOOLEAN loSimplex( leftv res, leftv args );
232 BOOLEAN loNewtonP( leftv res, leftv arg1 );
233 BOOLEAN nuMPResMat( leftv res, leftv arg1, leftv arg2 );
234 BOOLEAN nuLagSolve( leftv res, leftv arg1, leftv arg2, leftv arg3 );
235 BOOLEAN nuVanderSys( leftv res, leftv arg1, leftv arg2, leftv arg3);
237 
239 /*
240 BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w);
241 #if 0
242 BOOLEAN jjIS_SQR_FREE(leftv res, leftv u);
243 #endif
244 */
245 /* ================================================================== */
246 void paPrint(const char *n,package p);
247 /* ================================================================== */
248 
249 
251 
252 /* table inteface for iiAddCproc */
253 /// apply an operation 'op' to an argument a
254 /// return TRUE on failure
255 BOOLEAN iiExprArith1Tab(leftv res,///< [out] pre-allocated result
256  leftv a, ///< [in] argument
257  int op, ///< [in] operation
258  const struct sValCmd1* dA1, ///< [in] table of possible proc
259  ///< assumes dArith1[0].cmd==op
260  int at, ///< [in] a->Typ()
261  const struct sConvertTypes *dConvertTypes ///< [in] table of type conversions
262  );
263 /// apply an operation 'op' to arguments a and a->next
264 /// return TRUE on failure
265 BOOLEAN iiExprArith2Tab(leftv res,///< [out] pre-allocated result
266  leftv a, ///< [in] 2 arguments
267  int op, ///< [in] operation
268  const struct sValCmd2* dA2,///< [in] table of possible proc
269  ///< assumes dA2[0].cmd==op
270  int at, ///< [in] a->Typ()
271  const struct sConvertTypes *dConvertTypes ///< [in] table of type conversions
272  );
273 /// apply an operation 'op' to arguments a, a->next and a->next->next
274 /// return TRUE on failure
275 BOOLEAN iiExprArith3Tab(leftv res, ///< [out] pre-allocated result
276  leftv a, ///< [in] 3 arguments
277  int op, ///< [in] operation
278  const struct sValCmd3* dA3,///< [in] table of possible proc
279  ///< assumes dA3[0].cmd==op
280  int at, ///< [in] a->Typ()
281  const struct sConvertTypes *dConvertTypes ///< [in] table of type conversions
282  );
283 
284 /// check a list of arguemys against a given field of types
285 /// return TRUE if the types match
286 /// return FALSE (and, if report) report an error via Werror otherwise
287 BOOLEAN iiCheckTypes(leftv args,/// < [in] argument list (may be NULL)
288  const short *type_list,///< [in] field of types
289  ///< len, t1,t2,...
290  int report=0 /// ;in] report error?
291  );
292 
294 
295 lists rDecompose(const ring r);
296 
297 #ifdef SINGULAR_4_1
298 lists rDecompose_list_cf(const ring r);
300 #endif
301 #endif
302 
const char * currid
Definition: grammar.cc:172
BOOLEAN semicProc3(leftv, leftv, leftv, leftv)
Definition: ipshell.cc:4426
BOOLEAN iiEStart(char *example, procinfo *pi)
Definition: iplib.cc:655
void list_cmd(int typ, const char *what, const char *prefix, BOOLEAN iterate, BOOLEAN fullname=FALSE)
Definition: ipshell.cc:420
BOOLEAN iiTryLoadLib(leftv v, const char *id)
Definition: iplib.cc:741
BOOLEAN iiBranchTo(leftv r, leftv args)
Definition: ipshell.cc:1178
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:400
BOOLEAN jjBETTI(leftv res, leftv v)
Definition: ipshell.cc:896
ip_package * package
Definition: structs.h:46
char * iiConvName(const char *libname)
Definition: iplib.cc:1269
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report=0)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
Definition: ipshell.cc:6492
idhdl rDefault(const char *s)
Definition: ipshell.cc:1532
const CanonicalForm int s
Definition: facAbsFact.cc:55
char * iiProcArgs(char *e, BOOLEAN withParenth)
Definition: iplib.cc:128
BOOLEAN iiLocateLib(const char *lib, char *where)
Definition: iplib.cc:789
unsigned char * proc[NUM_PROC]
Definition: checklibs.c:14
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
void singular_example(char *str)
Definition: misc_ip.cc:439
const poly a
Definition: syzextra.cc:212
int myynest
Definition: febase.cc:46
BOOLEAN jjLIST_PL(leftv res, leftv v)
Definition: iparith.cc:7495
CanonicalForm fp
Definition: cfModGcd.cc:4043
BOOLEAN jjBETTI2_ID(leftv res, leftv u, leftv v)
Definition: ipshell.cc:909
BOOLEAN jjVARIABLES_P(leftv res, leftv u)
Definition: ipshell.cc:6238
Definition: lists.h:22
lists rDecompose(const ring r)
Definition: ipshell.cc:2030
const struct sConvertTypes dConvertTypes[]
Definition: table.h:1172
BOOLEAN(* proc3)(leftv, leftv, leftv, leftv)
Definition: ipshell.h:147
char * versionString()
Definition: misc_ip.cc:778
#define FALSE
Definition: auxiliary.h:140
proci p
Definition: ipshell.h:186
BOOLEAN iiAssign(leftv left, leftv right, BOOLEAN toplevel=TRUE)
Definition: ipassign.cc:1783
return P p
Definition: myNF.cc:203
BOOLEAN iiWRITE(leftv res, leftv exprlist)
Definition: ipshell.cc:590
idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n=NULL)
Definition: ipshell.cc:6145
BOOLEAN iiAssignCR(leftv, leftv)
Definition: ipshell.cc:6434
syStrategy syConvList(lists li, BOOLEAN toDel)
Definition: ipshell.cc:3170
int printlevel
Definition: febase.cc:42
void killlocals(int v)
Definition: ipshell.cc:380
BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib, idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror)
Definition: iplib.cc:892
char * showOption()
Definition: misc_ip.cc:721
BOOLEAN nuVanderSys(leftv res, leftv arg1, leftv arg2, leftv arg3)
COMPUTE: polynomial p with values given by v at points p1,..,pN derived from p; more precisely: consi...
Definition: ipshell.cc:4725
BOOLEAN iiExprArith1Tab(leftv res, leftv a, int op, const struct sValCmd1 *dA1, int at, const struct sConvertTypes *dConvertTypes)
apply an operation &#39;op&#39; to an argument a return TRUE on failure
Definition: iparith.cc:8286
short arg
Definition: gentable.cc:71
BOOLEAN iiExprArith3Tab(leftv res, leftv a, int op, const struct sValCmd3 *dA3, int at, const struct sConvertTypes *dConvertTypes)
apply an operation &#39;op&#39; to arguments a, a->next and a->next->next return TRUE on failure ...
Definition: iparith.cc:8678
char * iiGetLibProcBuffer(procinfov pi, int part=1)
int iiRegularity(lists L)
Definition: ipshell.cc:957
const char * lastreserved
Definition: ipshell.cc:81
#define TRUE
Definition: auxiliary.h:144
BOOLEAN syBetti1(leftv res, leftv u)
Definition: ipshell.cc:3085
void iiDebug()
Definition: ipshell.cc:985
BOOLEAN nuUResSolve(leftv res, leftv args)
solve a multipolynomial system using the u-resultant Input ideal must be 0-dimensional and (currRing-...
Definition: ipshell.cc:4826
sleftv * leftv
Definition: structs.h:60
BOOLEAN jjIMPORTFROM(leftv res, leftv u, leftv v)
Definition: ipassign.cc:2175
short valid_for
Definition: gentable.cc:72
void paPrint(const char *n, package p)
Definition: ipshell.cc:6261
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition: iparith.cc:8626
lists syConvRes(syStrategy syzstr, BOOLEAN toDel=FALSE, int add_row_shift=0)
Definition: ipshell.cc:3097
#define Q
Definition: sirandom.c:25
int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: iplib.cc:993
int iiOpsTwoChar(const char *s)
Definition: ipshell.cc:120
BOOLEAN jjBETTI2(leftv res, leftv u, leftv v)
Definition: ipshell.cc:930
void type_cmd(leftv v)
Definition: ipshell.cc:246
short res
Definition: gentable.cc:70
leftv iiCurrArgs
Definition: ipshell.cc:79
sleftv iiRETURNEXPR
Definition: iplib.cc:517
BOOLEAN iiAlias(leftv p)
Definition: ipid.cc:745
Definition: idrec.h:34
BOOLEAN nuMPResMat(leftv res, leftv arg1, leftv arg2)
returns module representing the multipolynomial resultant matrix Arguments 2: ideal i...
Definition: ipshell.cc:4570
BOOLEAN mpJacobi(leftv res, leftv a)
Definition: ipshell.cc:2985
poly res
Definition: myNF.cc:322
BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport=FALSE)
load lib/module given in v
Definition: iparith.cc:5345
poly iiHighCorner(ideal i, int ak)
Definition: ipshell.cc:1492
BOOLEAN jjLOAD_TRY(const char *s)
Definition: iparith.cc:5409
const ring r
Definition: syzextra.cc:208
BOOLEAN(* proci)(leftv, leftv, Subexpr)
Definition: ipshell.h:176
BOOLEAN(* proc2)(leftv, leftv, leftv)
Definition: ipshell.h:136
short cmd
Definition: gentable.cc:69
Definition: intvec.h:14
BOOLEAN spaddProc(leftv, leftv, leftv)
Definition: ipshell.cc:4343
const char * singular_date
BOOLEAN kWeight(leftv res, leftv id)
Definition: ipshell.cc:3216
BOOLEAN semicProc(leftv, leftv, leftv)
Definition: ipshell.cc:4466
int IsCmd(const char *n, int &tok)
Definition: iparith.cc:8822
BOOLEAN setOption(leftv res, leftv v)
Definition: misc_ip.cc:575
BOOLEAN iiLibCmd(char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force)
Definition: iplib.cc:803
The main handler for Singular numbers which are suitable for Singular polynomials.
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1577
BOOLEAN jjVARIABLES_ID(leftv res, leftv u)
Definition: ipshell.cc:6246
void checkall()
Definition: misc_ip.cc:1011
int status int void * buf
Definition: si_signals.h:59
void rSetHdl(idhdl h)
Definition: ipshell.cc:5030
BOOLEAN iiApply(leftv res, leftv a, int op, leftv proc)
Definition: ipshell.cc:6351
lists scIndIndset(ideal S, BOOLEAN all, ideal Q)
Definition: ipshell.cc:1023
void iiMakeResolv(resolvente r, int length, int rlen, char *name, int typ0, intvec **weights=NULL)
Definition: ipshell.cc:776
BOOLEAN rDecompose_CF(leftv res, const coeffs C)
Definition: ipshell.cc:1824
leftv iiMap(map theMap, const char *what)
Definition: ipshell.cc:617
int i
Definition: cfEzgcd.cc:123
BOOLEAN nuLagSolve(leftv res, leftv arg1, leftv arg2, leftv arg3)
find the (complex) roots an univariate polynomial Determines the roots of an univariate polynomial us...
Definition: ipshell.cc:4593
BOOLEAN iiExprArith2Tab(leftv res, leftv a, int op, const struct sValCmd2 *dA2, int at, const struct sConvertTypes *dConvertTypes)
apply an operation &#39;op&#39; to arguments a and a->next return TRUE on failure
Definition: iparith.cc:8214
BOOLEAN iiARROW(leftv, char *, char *)
Definition: ipshell.cc:6400
BOOLEAN syBetti2(leftv res, leftv u, leftv w)
Definition: ipshell.cc:3062
int iiOp
Definition: iparith.cc:229
idhdl iiCurrProc
Definition: ipshell.cc:80
BOOLEAN loSimplex(leftv res, leftv args)
Implementation of the Simplex Algorithm.
Definition: ipshell.cc:4484
leftv singular_system(sleftv h)
int iiTokType(int op)
Definition: iparith.cc:244
char * iiGetLibName(procinfov v)
Definition: iplib.cc:102
#define pi
Definition: libparse.cc:1143
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
feBufferTypes
Definition: fevoices.h:16
BOOLEAN iiExport(leftv v, int toLev)
Definition: ipshell.cc:1392
BOOLEAN yyInRingConstruction
Definition: grammar.cc:173
char name(const Variable &v)
Definition: variable.h:95
int exprlist_length(leftv v)
Definition: ipshell.cc:554
void iiCheckPack(package &p)
Definition: ipshell.cc:1516
#define NULL
Definition: omList.c:10
BOOLEAN iiExprArith1(leftv res, sleftv *a, int op)
BOOLEAN iiInternalExport(leftv v, int toLev, package pack)
Definition: ipshell.cc:1346
char * iiProcName(char *buf, char &ct, char *&e)
Definition: iplib.cc:114
BOOLEAN iiParameter(leftv p)
Definition: ipshell.cc:1248
const char * iiTwoOps(int t)
Definition: gentable.cc:252
syStrategy syForceMin(lists li)
Definition: ipshell.cc:3200
int si_echo
Definition: febase.cc:41
BOOLEAN mpKoszul(leftv res, leftv c, leftv b, leftv id)
Definition: ipshell.cc:3007
BOOLEAN iiExprArithM(leftv res, sleftv *a, int op)
const CanonicalForm & w
Definition: facAbsFact.cc:55
strat ak
Definition: myNF.cc:321
BOOLEAN iiExprArith2(leftv res, sleftv *a, int op, sleftv *b, BOOLEAN proccall=FALSE)
BOOLEAN kQHWeight(leftv res, leftv v)
Definition: ipshell.cc:3238
lists rDecompose_list_cf(const ring r)
Definition: ipshell.cc:1897
BOOLEAN spectrumfProc(leftv, leftv)
Definition: ipshell.cc:4099
void test_cmd(int i)
Definition: ipshell.cc:516
ring * iiLocalRing
Definition: iplib.cc:515
BOOLEAN spectrumProc(leftv, leftv)
Definition: ipshell.cc:4048
BOOLEAN iiPStart(idhdl pn, sleftv *sl)
Definition: iplib.cc:372
BOOLEAN jjMINRES(leftv res, leftv v)
Definition: ipshell.cc:875
ideal * resolvente
Definition: ideals.h:20
BOOLEAN jjCHARSERIES(leftv res, leftv u)
Definition: ipshell.cc:3262
char libnamebuf[128]
Definition: libparse.cc:1096
BOOLEAN jjSYSTEM(leftv res, leftv v)
Definition: extra.cc:245
const char * Tok2Cmdname(int i)
Definition: gentable.cc:128
ring rInit(leftv pn, leftv rv, leftv ord)
Definition: ipshell.cc:5516
BOOLEAN spmulProc(leftv, leftv, leftv)
Definition: ipshell.cc:4385
BOOLEAN iiAllStart(procinfov pi, char *p, feBufferTypes t, int l)
Definition: iplib.cc:312
BOOLEAN iiMake_proc(idhdl pn, package pack, sleftv *sl)
Definition: iplib.cc:563
polyrec * poly
Definition: hilb.h:10
void rKill(idhdl h)
Definition: ipshell.cc:6126
BOOLEAN(* proc1)(leftv, leftv)
Definition: ipshell.h:123
BOOLEAN loNewtonP(leftv res, leftv arg1)
compute Newton Polytopes of input polynomials
Definition: ipshell.cc:4478
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN iiTestAssume(leftv a, leftv b)
Definition: ipshell.cc:6373
const poly b
Definition: syzextra.cc:213
BOOLEAN iiCheckRing(int i)
Definition: ipshell.cc:1472
int p
Definition: gentable.cc:68
BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w)
Definition: ipshell.cc:3255
int l
Definition: cfEzgcd.cc:94
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring=FALSE, BOOLEAN init_b=TRUE)
Definition: ipshell.cc:1123
int iiRETURNEXPR_len
Definition: iplib.cc:518