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 extern ring *iiLocalRing;
36 //extern cmdnames cmds[];
37 extern const char *lastreserved;
38 extern int myynest;
39 extern int printlevel;
40 extern int si_echo;
41 
42 
43 extern BOOLEAN yyInRingConstruction; /* 1: during ring construction */
44 
45 int IsCmd(const char *n, int & tok);
46 
47 BOOLEAN iiPStart(idhdl pn, sleftv * sl);
48 BOOLEAN iiEStart(char* example, procinfo *pi);
50 void type_cmd(leftv v);
51 void test_cmd(int i);
52 void list_cmd(int typ, const char* what, const char * prefix,
53  BOOLEAN iterate, BOOLEAN fullname=FALSE);
54 //char * iiStringMatrix(matrix im, int dim, char ch=',');
55 void killlocals(int v);
57 const char * Tok2Cmdname(int i);
58 const char * iiTwoOps(int t);
59 int iiOpsTwoChar(const char *s);
60 
61 BOOLEAN iiWRITE(leftv res,leftv exprlist);
62 BOOLEAN iiExport(leftv v, int toLev);
63 BOOLEAN iiExport(leftv v, int toLev, package pack);
64 BOOLEAN iiInternalExport (leftv v, int toLev, package pack);
65 char * iiGetLibName(procinfov v);
66 char * iiGetLibProcBuffer( procinfov pi, int part=1 );
67 char * iiProcName(char *buf, char & ct, char* &e);
68 char * iiProcArgs(char *e,BOOLEAN withParenth);
69 BOOLEAN iiLibCmd( char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force );
70 /* sees wheter library lib has already been loaded
71  if yes, writes filename of lib into where and returns TRUE,
72  if no, returns FALSE
73 */
74 /// load lib/module given in v
75 BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport = FALSE);
76 BOOLEAN jjLOAD_TRY(const char *s);
77 BOOLEAN iiLocateLib(const char* lib, char* where);
78 leftv iiMap(map theMap, const char * what);
79 void iiMakeResolv(resolvente r, int length, int rlen, char * name, int typ0,
80  intvec ** weights=NULL);
87 
90 
91 int iiRegularity(lists L);
94 void iiDebug();
95 BOOLEAN iiCheckRing(int i);
96 poly iiHighCorner(ideal i, int ak);
97 char * iiConvName(const char *libname);
98 BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib,
99  idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror);
100 
101 // converts a resolution into a list of modules
102 lists syConvRes(syStrategy syzstr,BOOLEAN toDel=FALSE,int add_row_shift=0);
103 // converts a list of modules into a minimal resolution
105 // converts a list of modules into a resolution
107 
110 
111 /* ================================================================== */
112 /* Expressions : */
113 BOOLEAN iiExprArith1(leftv res, sleftv* a, int op);
115  BOOLEAN proccall=FALSE);
117 BOOLEAN iiExprArithM(leftv res, sleftv* a, int op);
119 
120 typedef BOOLEAN (*proc1)(leftv,leftv);
121 
122 #ifdef GENTABLE
123 struct sValCmd1
124 {
125  proc1 p;
126  short cmd;
127  short res;
128  short arg;
129  short valid_for;
130 };
131 
133 struct sValCmd2
134 {
135  proc2 p;
136  short cmd;
137  short res;
138  short arg1;
139  short arg2;
140  short valid_for;
141 };
142 
144 struct sValCmd3
145 {
146  proc3 p;
147  short cmd;
148  short res;
149  short arg1;
150  short arg2;
151  short arg3;
152  short valid_for;
153 };
154 struct sValCmdM
155 {
156  proc1 p;
157  short cmd;
158  short res;
159  short number_of_args; /* -1: any, -2: any >0, .. */
160  short valid_for;
161 };
162 extern struct sValCmd2 dArith2[];
163 extern struct sValCmd1 dArith1[];
164 extern struct sValCmd3 dArith3[];
165 extern struct sValCmdM dArithM[];
166 #endif
167 
168 /* ================================================================== */
169 /* Assigments : */
170 BOOLEAN iiAssign(leftv left, leftv right, BOOLEAN toplevel=TRUE);
171 
172 typedef BOOLEAN (*proci)(leftv,leftv,Subexpr);
173 struct sValAssign_sys
174 {
176  short res;
177  short arg;
178 };
179 
180 struct sValAssign
181 {
183  short res;
184  short arg;
185 };
186 
189 
190 int iiTokType(int op);
191 /* ================================================================== */
192 int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl* root,
193  BOOLEAN isring = FALSE, BOOLEAN init_b=TRUE);
194 BOOLEAN iiMake_proc(idhdl pn, package pack, sleftv* sl);
195 // from misc.cc:
196 char * showOption();
198 /* ================================================================== */
199 char * versionString();
200 /* ================================================================== */
201 void singular_example(char *str);
202 
203 BOOLEAN iiTryLoadLib(leftv v, const char *id);
204 
205 int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic,
206  BOOLEAN(*func)(leftv res, leftv v));
207 
208 void iiCheckPack(package &p);
209 #ifndef SING_NDEBUG
210 void checkall();
211 #endif
212 
213 void rSetHdl(idhdl h);
214 ring rInit(leftv pn, leftv rv, leftv ord);
215 idhdl rDefault(const char *s);
216 
217 idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n=NULL);
218 idhdl rFindHdl(ring r, idhdl n);
219 void rKill(idhdl h);
220 void rKill(ring r);
221 lists scIndIndset(ideal S, BOOLEAN all, ideal Q);
222 BOOLEAN mpKoszul(leftv res,leftv c/*ip*/, leftv b/*in*/, leftv id);
227 BOOLEAN loSimplex( leftv res, leftv args );
228 BOOLEAN loNewtonP( leftv res, leftv arg1 );
229 BOOLEAN nuMPResMat( leftv res, leftv arg1, leftv arg2 );
230 BOOLEAN nuLagSolve( leftv res, leftv arg1, leftv arg2, leftv arg3 );
231 BOOLEAN nuVanderSys( leftv res, leftv arg1, leftv arg2, leftv arg3);
233 
235 /*
236 BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w);
237 #if 0
238 BOOLEAN jjIS_SQR_FREE(leftv res, leftv u);
239 #endif
240 */
241 /* ================================================================== */
242 void paPrint(const char *n,package p);
243 /* ================================================================== */
244 
245 
247 
248 /* table interface for iiAddCproc */
249 /// apply an operation 'op' to an argument a
250 /// return TRUE on failure
251 BOOLEAN iiExprArith1Tab(leftv res,///< [out] pre-allocated result
252  leftv a, ///< [in] argument
253  int op, ///< [in] operation
254  const struct sValCmd1* dA1, ///< [in] table of possible proc
255  ///< assumes dArith1[0].cmd==op
256  int at, ///< [in] a->Typ()
257  const struct sConvertTypes *dConvertTypes ///< [in] table of type conversions
258  );
259 /// apply an operation 'op' to arguments a and a->next
260 /// return TRUE on failure
261 BOOLEAN iiExprArith2Tab(leftv res,///< [out] pre-allocated result
262  leftv a, ///< [in] 2 arguments
263  int op, ///< [in] operation
264  const struct sValCmd2* dA2,///< [in] table of possible proc
265  ///< assumes dA2[0].cmd==op
266  int at, ///< [in] a->Typ()
267  const struct sConvertTypes *dConvertTypes ///< [in] table of type conversions
268  );
269 /// apply an operation 'op' to arguments a, a->next and a->next->next
270 /// return TRUE on failure
271 BOOLEAN iiExprArith3Tab(leftv res, ///< [out] pre-allocated result
272  leftv a, ///< [in] 3 arguments
273  int op, ///< [in] operation
274  const struct sValCmd3* dA3,///< [in] table of possible proc
275  ///< assumes dA3[0].cmd==op
276  int at, ///< [in] a->Typ()
277  const struct sConvertTypes *dConvertTypes ///< [in] table of type conversions
278  );
279 
280 /// check a list of arguemys against a given field of types
281 /// return TRUE if the types match
282 /// return FALSE (and, if report) report an error via Werror otherwise
283 BOOLEAN iiCheckTypes(leftv args,/// < [in] argument list (may be NULL)
284  const short *type_list,///< [in] field of types
285  ///< len, t1,t2,...
286  int report=0 /// ;in] report error?
287  );
288 
290 
291 lists rDecompose(const ring r);
292 
293 #ifdef SINGULAR_4_1
294 lists rDecompose_list_cf(const ring r);
296 #endif
297 #endif
298 
const char * currid
Definition: grammar.cc:171
BOOLEAN semicProc3(leftv, leftv, leftv, leftv)
Definition: ipshell.cc:4416
BOOLEAN iiEStart(char *example, procinfo *pi)
Definition: iplib.cc:591
void list_cmd(int typ, const char *what, const char *prefix, BOOLEAN iterate, BOOLEAN fullname=FALSE)
Definition: ipshell.cc:415
BOOLEAN iiTryLoadLib(leftv v, const char *id)
Definition: iplib.cc:656
BOOLEAN iiBranchTo(leftv r, leftv args)
Definition: ipshell.cc:1181
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:888
ip_package * package
Definition: structs.h:46
char * iiConvName(const char *libname)
Definition: iplib.cc:1184
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:6460
idhdl rDefault(const char *s)
Definition: ipshell.cc:1523
const CanonicalForm int s
Definition: facAbsFact.cc:55
char * iiProcArgs(char *e, BOOLEAN withParenth)
Definition: iplib.cc:127
BOOLEAN iiLocateLib(const char *lib, char *where)
Definition: iplib.cc:704
unsigned char * proc[NUM_PROC]
Definition: checklibs.c:14
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
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:7480
CanonicalForm fp
Definition: cfModGcd.cc:4043
BOOLEAN jjBETTI2_ID(leftv res, leftv u, leftv v)
Definition: ipshell.cc:901
BOOLEAN jjVARIABLES_P(leftv res, leftv u)
Definition: ipshell.cc:6206
Definition: lists.h:22
lists rDecompose(const ring r)
Definition: ipshell.cc:2023
const struct sConvertTypes dConvertTypes[]
Definition: table.h:1184
BOOLEAN(* proc3)(leftv, leftv, leftv, leftv)
Definition: ipshell.h:143
char * versionString()
Definition: misc_ip.cc:778
#define FALSE
Definition: auxiliary.h:97
proci p
Definition: ipshell.h:182
BOOLEAN iiAssign(leftv left, leftv right, BOOLEAN toplevel=TRUE)
Definition: ipassign.cc:1780
return P p
Definition: myNF.cc:203
BOOLEAN iiWRITE(leftv res, leftv exprlist)
Definition: ipshell.cc:582
idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n=NULL)
Definition: ipshell.cc:6121
BOOLEAN iiAssignCR(leftv, leftv)
Definition: ipshell.cc:6402
int printlevel
Definition: febase.cc:42
void killlocals(int v)
Definition: ipshell.cc:376
BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib, idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror)
Definition: iplib.cc:807
char * showOption()
Definition: misc_ip.cc:717
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:4712
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:8294
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:8686
char * iiGetLibProcBuffer(procinfov pi, int part=1)
int iiRegularity(lists L)
Definition: ipshell.cc:958
const char * lastreserved
Definition: ipshell.cc:80
#define TRUE
Definition: auxiliary.h:101
syStrategy syConvList(lists li)
Definition: ipshell.cc:3161
BOOLEAN syBetti1(leftv res, leftv u)
Definition: ipshell.cc:3076
void iiDebug()
Definition: ipshell.cc:986
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:4813
sleftv * leftv
Definition: structs.h:60
BOOLEAN jjIMPORTFROM(leftv res, leftv u, leftv v)
Definition: ipassign.cc:2172
short valid_for
Definition: gentable.cc:72
void paPrint(const char *n, package p)
Definition: ipshell.cc:6229
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition: iparith.cc:8634
lists syConvRes(syStrategy syzstr, BOOLEAN toDel=FALSE, int add_row_shift=0)
Definition: ipshell.cc:3088
#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:908
int iiOpsTwoChar(const char *s)
Definition: ipshell.cc:119
BOOLEAN jjBETTI2(leftv res, leftv u, leftv v)
Definition: ipshell.cc:922
void type_cmd(leftv v)
Definition: ipshell.cc:244
short res
Definition: gentable.cc:70
leftv iiCurrArgs
Definition: ipshell.cc:78
sleftv iiRETURNEXPR
Definition: iplib.cc:471
BOOLEAN iiAlias(leftv p)
Definition: ipid.cc:743
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:4560
BOOLEAN mpJacobi(leftv res, leftv a)
Definition: ipshell.cc:2976
poly res
Definition: myNF.cc:322
BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport=FALSE)
load lib/module given in v
Definition: iparith.cc:5332
poly iiHighCorner(ideal i, int ak)
Definition: ipshell.cc:1485
BOOLEAN jjLOAD_TRY(const char *s)
Definition: iparith.cc:5396
const ring r
Definition: syzextra.cc:208
BOOLEAN(* proci)(leftv, leftv, Subexpr)
Definition: ipshell.h:172
BOOLEAN(* proc2)(leftv, leftv, leftv)
Definition: ipshell.h:132
short cmd
Definition: gentable.cc:69
Definition: intvec.h:14
BOOLEAN spaddProc(leftv, leftv, leftv)
Definition: ipshell.cc:4333
BOOLEAN kWeight(leftv res, leftv id)
Definition: ipshell.cc:3206
BOOLEAN semicProc(leftv, leftv, leftv)
Definition: ipshell.cc:4456
int IsCmd(const char *n, int &tok)
Definition: iparith.cc:8830
BOOLEAN setOption(leftv res, leftv v)
Definition: misc_ip.cc:575
BOOLEAN iiLibCmd(char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force)
Definition: iplib.cc:718
The main handler for Singular numbers which are suitable for Singular polynomials.
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1568
BOOLEAN jjVARIABLES_ID(leftv res, leftv u)
Definition: ipshell.cc:6214
int status int void * buf
Definition: si_signals.h:59
void rSetHdl(idhdl h)
Definition: ipshell.cc:5017
BOOLEAN iiApply(leftv res, leftv a, int op, leftv proc)
Definition: ipshell.cc:6319
lists scIndIndset(ideal S, BOOLEAN all, ideal Q)
Definition: ipshell.cc:1024
void iiMakeResolv(resolvente r, int length, int rlen, char *name, int typ0, intvec **weights=NULL)
Definition: ipshell.cc:768
BOOLEAN rDecompose_CF(leftv res, const coeffs C)
Definition: ipshell.cc:1817
leftv iiMap(map theMap, const char *what)
Definition: ipshell.cc:609
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:4583
char name(const Variable &v)
Definition: factory.h:178
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:8222
BOOLEAN iiARROW(leftv, char *, char *)
Definition: ipshell.cc:6368
BOOLEAN syBetti2(leftv res, leftv u, leftv w)
Definition: ipshell.cc:3053
int iiOp
Definition: iparith.cc:227
idhdl iiCurrProc
Definition: ipshell.cc:79
BOOLEAN loSimplex(leftv res, leftv args)
Implementation of the Simplex Algorithm.
Definition: ipshell.cc:4474
leftv singular_system(sleftv h)
int iiTokType(int op)
Definition: iparith.cc:242
char * iiGetLibName(procinfov v)
Definition: iplib.cc:101
#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:1385
BOOLEAN yyInRingConstruction
Definition: grammar.cc:172
int exprlist_length(leftv v)
Definition: ipshell.cc:546
void iiCheckPack(package &p)
Definition: ipshell.cc:1509
#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:1339
char * iiProcName(char *buf, char &ct, char *&e)
Definition: iplib.cc:113
BOOLEAN iiParameter(leftv p)
Definition: ipshell.cc:1251
const char * iiTwoOps(int t)
Definition: gentable.cc:252
syStrategy syForceMin(lists li)
Definition: ipshell.cc:3190
int si_echo
Definition: febase.cc:41
BOOLEAN mpKoszul(leftv res, leftv c, leftv b, leftv id)
Definition: ipshell.cc:2998
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:3228
lists rDecompose_list_cf(const ring r)
Definition: ipshell.cc:1890
BOOLEAN spectrumfProc(leftv, leftv)
Definition: ipshell.cc:4089
void test_cmd(int i)
Definition: ipshell.cc:508
ring * iiLocalRing
Definition: iplib.cc:470
BOOLEAN spectrumProc(leftv, leftv)
Definition: ipshell.cc:4038
BOOLEAN iiPStart(idhdl pn, sleftv *sl)
Definition: iplib.cc:371
BOOLEAN jjMINRES(leftv res, leftv v)
Definition: ipshell.cc:867
ideal * resolvente
Definition: ideals.h:20
BOOLEAN jjCHARSERIES(leftv res, leftv u)
Definition: ipshell.cc:3252
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:5503
BOOLEAN spmulProc(leftv, leftv, leftv)
Definition: ipshell.cc:4375
BOOLEAN iiAllStart(procinfov pi, char *p, feBufferTypes t, int l)
Definition: iplib.cc:311
BOOLEAN iiMake_proc(idhdl pn, package pack, sleftv *sl)
Definition: iplib.cc:501
polyrec * poly
Definition: hilb.h:10
void rKill(idhdl h)
Definition: ipshell.cc:6095
BOOLEAN(* proc1)(leftv, leftv)
Definition: ipshell.h:120
BOOLEAN loNewtonP(leftv res, leftv arg1)
compute Newton Polytopes of input polynomials
Definition: ipshell.cc:4468
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:88
BOOLEAN iiTestAssume(leftv a, leftv b)
Definition: ipshell.cc:6341
const poly b
Definition: syzextra.cc:213
BOOLEAN iiCheckRing(int i)
Definition: ipshell.cc:1465
int p
Definition: gentable.cc:68
BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w)
Definition: ipshell.cc:3245
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:1124
int iiRETURNEXPR_len
Definition: iplib.cc:472