source: git/Singular/ipshell.h @ e54c6ee

spielwiese
Last change on this file since e54c6ee was e54c6ee, checked in by Hans Schoenemann <hannes@…>, 8 years ago
Singular_4_1: new names; Ring. Matrix, Number, construction cf[x], ....
  • Property mode set to 100644
File size: 9.7 KB
Line 
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
15struct _ssubexpr;
16typedef struct _ssubexpr *Subexpr;
17
18BOOLEAN    spectrumProc ( leftv,leftv );
19BOOLEAN    spectrumfProc( leftv,leftv );
20BOOLEAN    spaddProc    ( leftv,leftv,leftv );
21BOOLEAN    spmulProc    ( leftv,leftv,leftv );
22BOOLEAN    semicProc   ( leftv,leftv,leftv );
23BOOLEAN    semicProc3   ( leftv,leftv,leftv,leftv );
24
25BOOLEAN iiAssignCR(leftv, leftv);
26
27BOOLEAN iiARROW (leftv, char*,char *);
28
29extern leftv iiCurrArgs;
30extern idhdl iiCurrProc;
31extern int iiOp; /* the current operation*/
32extern const char *  currid;
33extern int     iiRETURNEXPR_len;
34extern sleftv  iiRETURNEXPR;
35extern ring   *iiLocalRing;
36//extern cmdnames cmds[];
37extern const char *lastreserved;
38extern int myynest;
39extern int printlevel;
40extern int si_echo;
41
42
43extern BOOLEAN yyInRingConstruction; /* 1: during ring construction */
44
45int     IsCmd(const char *n, int & tok);
46
47BOOLEAN iiPStart(idhdl pn, sleftv * sl);
48BOOLEAN iiEStart(char* example, procinfo *pi);
49BOOLEAN iiAllStart(procinfov pi, char *p,feBufferTypes t, int l);
50void    type_cmd(leftv v);
51void    test_cmd(int i);
52void    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=',');
55void    killlocals(int v);
56int     exprlist_length(leftv v);
57const char *  Tok2Cmdname(int i);
58const char *  iiTwoOps(int t);
59int           iiOpsTwoChar(const char *s);
60
61BOOLEAN iiWRITE(leftv res,leftv exprlist);
62BOOLEAN iiExport(leftv v, int toLev);
63BOOLEAN iiExport(leftv v, int toLev, package pack);
64BOOLEAN iiInternalExport (leftv v, int toLev, package pack);
65char *  iiGetLibName(procinfov v);
66char *  iiGetLibProcBuffer( procinfov pi, int part=1 );
67char *  iiProcName(char *buf, char & ct, char* &e);
68char *  iiProcArgs(char *e,BOOLEAN withParenth);
69BOOLEAN 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
75BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport = FALSE);
76BOOLEAN jjLOAD_TRY(const char *s);
77BOOLEAN iiLocateLib(const char* lib, char* where);
78leftv   iiMap(map theMap, const char * what);
79void    iiMakeResolv(resolvente r, int length, int rlen, char * name, int typ0,
80           intvec ** weights=NULL);
81BOOLEAN jjMINRES(leftv res, leftv v);
82BOOLEAN jjBETTI(leftv res, leftv v);
83BOOLEAN jjBETTI2(leftv res, leftv u, leftv v);
84BOOLEAN jjBETTI2_ID(leftv res, leftv u, leftv v);
85BOOLEAN jjIMPORTFROM(leftv res, leftv u, leftv v);
86BOOLEAN jjLIST_PL(leftv res, leftv v);
87
88BOOLEAN jjVARIABLES_P(leftv res, leftv u);
89BOOLEAN jjVARIABLES_ID(leftv res, leftv u);
90
91int     iiRegularity(lists L);
92leftv   singular_system(sleftv h);
93BOOLEAN jjSYSTEM(leftv res, leftv v);
94void    iiDebug();
95BOOLEAN iiCheckRing(int i);
96poly    iiHighCorner(ideal i, int ak);
97char *  iiConvName(const char *libname);
98BOOLEAN 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
102lists syConvRes(syStrategy syzstr,BOOLEAN toDel=FALSE,int add_row_shift=0);
103// converts a list of modules into a minimal resolution
104syStrategy syForceMin(lists li);
105// converts a list of modules into a resolution
106syStrategy syConvList(lists li);
107
108BOOLEAN syBetti1(leftv res, leftv u);
109BOOLEAN syBetti2(leftv res, leftv u, leftv w);
110
111/* ================================================================== */
112/* Expressions : */
113BOOLEAN iiExprArith1(leftv res, sleftv* a, int op);
114BOOLEAN iiExprArith2(leftv res, sleftv* a, int op, sleftv* b,
115                     BOOLEAN proccall=FALSE);
116BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c);
117BOOLEAN iiExprArithM(leftv res, sleftv* a, int op);
118BOOLEAN iiApply(leftv res,leftv a, int op, leftv proc);
119
120typedef BOOLEAN (*proc1)(leftv,leftv);
121
122#ifdef GENTABLE
123struct sValCmd1
124{
125  proc1 p;
126  short cmd;
127  short res;
128  short arg;
129  short valid_for;
130};
131
132typedef BOOLEAN (*proc2)(leftv,leftv,leftv);
133struct sValCmd2
134{
135  proc2 p;
136  short cmd;
137  short res;
138  short arg1;
139  short arg2;
140  short valid_for;
141};
142
143typedef BOOLEAN (*proc3)(leftv,leftv,leftv,leftv);
144struct 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};
154struct 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};
162extern struct sValCmd2 dArith2[];
163extern struct sValCmd1 dArith1[];
164extern struct sValCmd3 dArith3[];
165extern struct sValCmdM dArithM[];
166#endif
167
168/* ================================================================== */
169/* Assigments : */
170BOOLEAN iiAssign(leftv left, leftv right, BOOLEAN toplevel=TRUE);
171
172typedef BOOLEAN (*proci)(leftv,leftv,Subexpr);
173struct sValAssign_sys
174{
175  proc1 p;
176  short res;
177  short arg;
178};
179
180struct sValAssign
181{
182  proci p;
183  short res;
184  short arg;
185};
186
187BOOLEAN iiParameter(leftv p);
188BOOLEAN iiAlias(leftv p);
189
190int iiTokType(int op);
191/* ================================================================== */
192int     iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl* root,
193  BOOLEAN isring = FALSE, BOOLEAN init_b=TRUE);
194BOOLEAN iiMake_proc(idhdl pn, package pack, sleftv* sl);
195// from misc.cc:
196char *  showOption();
197BOOLEAN setOption(leftv res, leftv v);
198/* ================================================================== */
199char * versionString();
200/* ================================================================== */
201void  singular_example(char *str);
202
203BOOLEAN iiTryLoadLib(leftv v, const char *id);
204
205int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic,
206               BOOLEAN(*func)(leftv res, leftv v));
207
208void iiCheckPack(package &p);
209#ifndef SING_NDEBUG
210void checkall();
211#endif
212
213void rSetHdl(idhdl h);
214ring rInit(leftv pn, leftv rv, leftv ord);
215idhdl  rDefault(const char *s);
216
217idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n=NULL);
218idhdl rFindHdl(ring r, idhdl n);
219void   rKill(idhdl h);
220void   rKill(ring r);
221lists scIndIndset(ideal S, BOOLEAN all, ideal Q);
222BOOLEAN mpKoszul(leftv res,leftv c/*ip*/, leftv b/*in*/, leftv id);
223BOOLEAN mpJacobi(leftv res,leftv a);
224BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w);
225BOOLEAN kQHWeight(leftv res,leftv v);
226BOOLEAN kWeight(leftv res,leftv id);
227BOOLEAN loSimplex( leftv res, leftv args );
228BOOLEAN loNewtonP( leftv res, leftv arg1 );
229BOOLEAN nuMPResMat( leftv res, leftv arg1, leftv arg2 );
230BOOLEAN nuLagSolve( leftv res, leftv arg1, leftv arg2, leftv arg3 );
231BOOLEAN nuVanderSys( leftv res, leftv arg1, leftv arg2, leftv arg3);
232BOOLEAN nuUResSolve( leftv res, leftv args );
233
234BOOLEAN jjCHARSERIES(leftv res, leftv u);
235/*
236BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w);
237#if 0
238BOOLEAN jjIS_SQR_FREE(leftv res, leftv u);
239#endif
240*/
241/* ================================================================== */
242void paPrint(const char *n,package p);
243/* ================================================================== */
244
245
246BOOLEAN iiTestAssume(leftv a, leftv b);
247
248/* table interface for iiAddCproc */
249/// apply an operation 'op' to an argument a
250/// return TRUE on failure
251BOOLEAN 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
261BOOLEAN 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
271BOOLEAN 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
283BOOLEAN 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
289BOOLEAN iiBranchTo(leftv r, leftv args);
290
291lists rDecompose(const ring r);
292
293#ifdef SINGULAR_4_1
294lists rDecompose_list_cf(const ring r);
295BOOLEAN rDecompose_CF(leftv res,const coeffs C);
296#endif
297#endif
298
Note: See TracBrowser for help on using the repository browser.