source: git/Singular/ipshell.h @ d35711

spielwiese
Last change on this file since d35711 was d35711, checked in by Hans Schoenemann <hannes@…>, 8 years ago
simplified rInit, avoid changing input parameters
  • 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;
35#ifdef USE_IILOCALRING
36extern ring   *iiLocalRing;
37#endif
38//extern cmdnames cmds[];
39extern const char *lastreserved;
40extern const char *singular_date; /* tesths.cc, set by final compile */
41extern int myynest;
42extern int printlevel;
43extern int si_echo;
44
45
46extern BOOLEAN yyInRingConstruction; /* 1: during ring construction */
47
48int     IsCmd(const char *n, int & tok);
49
50BOOLEAN iiPStart(idhdl pn, sleftv * sl);
51BOOLEAN iiEStart(char* example, procinfo *pi);
52BOOLEAN iiAllStart(procinfov pi, char *p,feBufferTypes t, int l);
53void    type_cmd(leftv v);
54void    test_cmd(int i);
55void    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=',');
58void    killlocals(int v);
59int     exprlist_length(leftv v);
60const char *  Tok2Cmdname(int i);
61const char *  iiTwoOps(int t);
62int           iiOpsTwoChar(const char *s);
63
64BOOLEAN iiWRITE(leftv res,leftv exprlist);
65BOOLEAN iiExport(leftv v, int toLev);
66BOOLEAN iiExport(leftv v, int toLev, package pack);
67BOOLEAN iiInternalExport (leftv v, int toLev, package pack);
68char *  iiGetLibName(procinfov v);
69char *  iiGetLibProcBuffer( procinfov pi, int part=1 );
70char *  iiProcName(char *buf, char & ct, char* &e);
71char *  iiProcArgs(char *e,BOOLEAN withParenth);
72BOOLEAN 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
78BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport = FALSE);
79BOOLEAN jjLOAD_TRY(const char *s);
80BOOLEAN iiLocateLib(const char* lib, char* where);
81leftv   iiMap(map theMap, const char * what);
82void    iiMakeResolv(resolvente r, int length, int rlen, char * name, int typ0,
83           intvec ** weights=NULL);
84BOOLEAN jjMINRES(leftv res, leftv v);
85BOOLEAN jjBETTI(leftv res, leftv v);
86BOOLEAN jjBETTI2(leftv res, leftv u, leftv v);
87BOOLEAN jjBETTI2_ID(leftv res, leftv u, leftv v);
88BOOLEAN jjIMPORTFROM(leftv res, leftv u, leftv v);
89BOOLEAN jjLIST_PL(leftv res, leftv v);
90
91BOOLEAN jjVARIABLES_P(leftv res, leftv u);
92BOOLEAN jjVARIABLES_ID(leftv res, leftv u);
93
94int     iiRegularity(lists L);
95leftv   singular_system(sleftv h);
96BOOLEAN jjSYSTEM(leftv res, leftv v);
97void    iiDebug();
98BOOLEAN iiCheckRing(int i);
99poly    iiHighCorner(ideal i, int ak);
100char *  iiConvName(const char *libname);
101BOOLEAN 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
105lists syConvRes(syStrategy syzstr,BOOLEAN toDel=FALSE,int add_row_shift=0);
106// converts a list of modules into a minimal resolution
107syStrategy syForceMin(lists li);
108// converts a list of modules into a resolution
109syStrategy syConvList(lists li,BOOLEAN toDel);
110
111BOOLEAN syBetti1(leftv res, leftv u);
112BOOLEAN syBetti2(leftv res, leftv u, leftv w);
113
114/* ================================================================== */
115/* Expressions : */
116BOOLEAN iiExprArith1(leftv res, sleftv* a, int op);
117BOOLEAN iiExprArith2(leftv res, sleftv* a, int op, sleftv* b,
118                     BOOLEAN proccall=FALSE);
119BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c);
120BOOLEAN iiExprArithM(leftv res, sleftv* a, int op);
121BOOLEAN iiApply(leftv res,leftv a, int op, leftv proc);
122
123typedef BOOLEAN (*proc1)(leftv,leftv);
124
125#ifdef GENTABLE
126typedef char * (*Proc1)(char *);
127struct sValCmd1
128{
129  proc1 p;
130  short cmd;
131  short res;
132  short arg;
133  short valid_for;
134};
135
136typedef BOOLEAN (*proc2)(leftv,leftv,leftv);
137struct sValCmd2
138{
139  proc2 p;
140  short cmd;
141  short res;
142  short arg1;
143  short arg2;
144  short valid_for;
145};
146
147typedef BOOLEAN (*proc3)(leftv,leftv,leftv,leftv);
148struct 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};
158struct 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};
166extern struct sValCmd2 dArith2[];
167extern struct sValCmd1 dArith1[];
168extern struct sValCmd3 dArith3[];
169extern struct sValCmdM dArithM[];
170#endif
171
172/* ================================================================== */
173/* Assigments : */
174BOOLEAN iiAssign(leftv left, leftv right, BOOLEAN toplevel=TRUE);
175
176typedef BOOLEAN (*proci)(leftv,leftv,Subexpr);
177struct sValAssign_sys
178{
179  proc1 p;
180  short res;
181  short arg;
182};
183
184struct sValAssign
185{
186  proci p;
187  short res;
188  short arg;
189};
190
191BOOLEAN iiParameter(leftv p);
192BOOLEAN iiAlias(leftv p);
193
194int iiTokType(int op);
195/* ================================================================== */
196int     iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl* root,
197  BOOLEAN isring = FALSE, BOOLEAN init_b=TRUE);
198BOOLEAN iiMake_proc(idhdl pn, package pack, sleftv* sl);
199// from misc.cc:
200char *  showOption();
201BOOLEAN setOption(leftv res, leftv v);
202/* ================================================================== */
203char * versionString();
204/* ================================================================== */
205void  singular_example(char *str);
206
207BOOLEAN iiTryLoadLib(leftv v, const char *id);
208
209int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic,
210               BOOLEAN(*func)(leftv res, leftv v));
211
212void iiCheckPack(package &p);
213#ifndef SING_NDEBUG
214void checkall();
215#endif
216
217void rSetHdl(idhdl h);
218ring rInit(leftv pn, leftv rv, leftv ord);
219idhdl  rDefault(const char *s);
220
221idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n=NULL);
222idhdl rFindHdl(ring r, idhdl n);
223void   rKill(idhdl h);
224void   rKill(ring r);
225lists scIndIndset(ideal S, BOOLEAN all, ideal Q);
226BOOLEAN mpKoszul(leftv res,leftv c/*ip*/, leftv b/*in*/, leftv id);
227BOOLEAN mpJacobi(leftv res,leftv a);
228BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w);
229BOOLEAN kQHWeight(leftv res,leftv v);
230BOOLEAN kWeight(leftv res,leftv id);
231BOOLEAN loSimplex( leftv res, leftv args );
232BOOLEAN loNewtonP( leftv res, leftv arg1 );
233BOOLEAN nuMPResMat( leftv res, leftv arg1, leftv arg2 );
234BOOLEAN nuLagSolve( leftv res, leftv arg1, leftv arg2, leftv arg3 );
235BOOLEAN nuVanderSys( leftv res, leftv arg1, leftv arg2, leftv arg3);
236BOOLEAN nuUResSolve( leftv res, leftv args );
237
238BOOLEAN jjCHARSERIES(leftv res, leftv u);
239/*
240BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w);
241#if 0
242BOOLEAN jjIS_SQR_FREE(leftv res, leftv u);
243#endif
244*/
245/* ================================================================== */
246void paPrint(const char *n,package p);
247/* ================================================================== */
248
249
250BOOLEAN iiTestAssume(leftv a, leftv b);
251
252/* table inteface for iiAddCproc */
253/// apply an operation 'op' to an argument a
254/// return TRUE on failure
255BOOLEAN iiExprArith1Tab(leftv res,///< [out] pre-allocated result
256                        leftv a,  ///< [in]  argument
257                        int op,   ///< [in]  operation
258                        struct sValCmd1* dA1, ///< [in] table of possible proc
259                                                  ///< assumes dArith1[0].cmd==op
260                        int at,   ///< [in] a->Typ()
261                        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
265BOOLEAN iiExprArith2Tab(leftv res,///< [out] pre-allocated result
266                        leftv a,  ///< [in]  2 arguments
267                        int op,   ///< [in]  operation
268                        struct sValCmd2* dA2,///< [in] table of possible proc
269                                   ///< assumes dA2[0].cmd==op
270                        int at,    ///< [in] a->Typ()
271                        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
275BOOLEAN iiExprArith3Tab(leftv res, ///< [out] pre-allocated result
276                        leftv a,   ///< [in]  3 arguments
277                        int op,    ///< [in]  operation
278                        struct sValCmd3* dA3,///< [in] table of possible proc
279                                   ///< assumes dA3[0].cmd==op
280                        int at,    ///< [in] a->Typ()
281                        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
287BOOLEAN 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
293BOOLEAN iiBranchTo(leftv r, leftv args);
294
295#ifdef SINGULAR_4_1
296BOOLEAN rDecompose_CF(leftv res,const coeffs C);
297#endif
298#endif
299
Note: See TracBrowser for help on using the repository browser.