source: git/Singular/ipshell.h @ a1848a

spielwiese
Last change on this file since a1848a was a1848a, checked in by Hans Schoenemann <hannes@…>, 16 months ago
simplify: more static and removed some
  • Property mode set to 100644
File size: 10.3 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_VAR leftv iiCurrArgs;
30EXTERN_VAR idhdl iiCurrProc;
31EXTERN_VAR int iiOp; /* the current operation*/
32extern const char *  currid;
33EXTERN_VAR int     iiRETURNEXPR_len;
34EXTERN_INST_VAR sleftv  iiRETURNEXPR;
35EXTERN_VAR ring   *iiLocalRing;
36//extern cmdnames cmds[];
37extern const char *lastreserved;
38EXTERN_VAR int myynest;
39EXTERN_VAR int printlevel;
40EXTERN_VAR int si_echo;
41
42
43EXTERN_VAR BOOLEAN yyInRingConstruction; /* 1: during ring construction */
44
45int     IsCmd(const char *n, int & tok);
46
47BOOLEAN iiPStart(idhdl pn, leftv sl);
48BOOLEAN iiEStart(char* example, procinfo *pi);
49BOOLEAN iiAllStart(procinfov pi, const 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);
65/// find the library of an proc
66static inline char *  iiGetLibName(const procinfov pi) { return pi->libname; }
67char *  iiGetLibProcBuffer( procinfov pi, int part=1 );
68char *  iiProcName(char *buf, char & ct, char* &e);
69char *  iiProcArgs(char *e,BOOLEAN withParenth);
70BOOLEAN iiLibCmd( const char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force );
71/* sees wheter library lib has already been loaded
72   if yes, writes filename of lib into where and returns TRUE,
73   if  no, returns FALSE
74*/
75/// load lib/module given in v
76BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport = FALSE);
77BOOLEAN jjLOAD_TRY(const char *s);
78BOOLEAN iiLocateLib(const char* lib, char* where);
79leftv   iiMap(map theMap, const char * what);
80void    iiMakeResolv(resolvente r, int length, int rlen, char * name, int typ0,
81           intvec ** weights=NULL);
82BOOLEAN jjMINRES(leftv res, leftv v);
83BOOLEAN jjBETTI(leftv res, leftv v);
84BOOLEAN jjBETTI2(leftv res, leftv u, leftv v);
85BOOLEAN jjBETTI2_ID(leftv res, leftv u, leftv v);
86BOOLEAN jjIMPORTFROM(leftv res, leftv u, leftv v);
87BOOLEAN jjLIST_PL(leftv res, leftv v);
88
89BOOLEAN jjVARIABLES_P(leftv res, leftv u);
90BOOLEAN jjVARIABLES_ID(leftv res, leftv u);
91
92int     iiRegularity(lists L);
93leftv   singular_system(sleftv h);
94BOOLEAN jjSYSTEM(leftv res, leftv v);
95void    iiDebug();
96BOOLEAN iiCheckRing(int i);
97poly    iiHighCorner(ideal i, int ak);
98char *  iiConvName(const char *libname);
99BOOLEAN iiGetLibStatus(const char *lib);
100BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib,
101                         idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror);
102
103// converts a resolution into a list of modules
104lists syConvRes(syStrategy syzstr,BOOLEAN toDel=FALSE,int add_row_shift=0);
105// converts a list of modules into a minimal resolution
106//syStrategy syForceMin(lists li);
107// converts a list of modules into a resolution
108syStrategy syConvList(lists li);
109
110BOOLEAN syBetti1(leftv res, leftv u);
111BOOLEAN syBetti2(leftv res, leftv u, leftv w);
112
113/* ================================================================== */
114/* Expressions : */
115BOOLEAN iiExprArith1(leftv res, sleftv* a, int op);
116BOOLEAN iiExprArith2(leftv res, sleftv* a, int op, sleftv* b,
117                     BOOLEAN proccall=FALSE);
118BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c);
119BOOLEAN iiExprArithM(leftv res, sleftv* a, int op);
120BOOLEAN iiApply(leftv res,leftv a, int op, leftv proc);
121
122typedef BOOLEAN (*proc1)(leftv,leftv);
123
124#ifdef GENTABLE
125struct sValCmd1
126{
127  proc1 p;
128  short cmd;
129  short res;
130  short arg;
131  short valid_for;
132};
133
134typedef BOOLEAN (*proc2)(leftv,leftv,leftv);
135struct sValCmd2
136{
137  proc2 p;
138  short cmd;
139  short res;
140  short arg1;
141  short arg2;
142  short valid_for;
143};
144
145typedef BOOLEAN (*proc3)(leftv,leftv,leftv,leftv);
146struct sValCmd3
147{
148  proc3 p;
149  short cmd;
150  short res;
151  short arg1;
152  short arg2;
153  short arg3;
154  short valid_for;
155};
156struct sValCmdM
157{
158  proc1 p;
159  short cmd;
160  short res;
161  short number_of_args; /* -1: any, -2: any >0, .. */
162  short valid_for;
163};
164extern const struct sValCmd2 dArith2[];
165extern const struct sValCmd1 dArith1[];
166extern const struct sValCmd3 dArith3[];
167extern const struct sValCmdM dArithM[];
168#endif
169
170/* ================================================================== */
171/* Assigments : */
172BOOLEAN iiAssign(leftv left, leftv right, BOOLEAN toplevel=TRUE);
173coeffs jjSetMinpoly(coeffs cf, number a);
174
175typedef BOOLEAN (*proci)(leftv,leftv,Subexpr);
176struct sValAssign_sys
177{
178  proc1 p;
179  short res;
180  short arg;
181};
182
183struct sValAssign
184{
185  proci p;
186  short res;
187  short arg;
188};
189
190BOOLEAN iiParameter(leftv p);
191BOOLEAN iiAlias(leftv p);
192
193int iiTokType(int op);
194/* ================================================================== */
195int     iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl* root,
196  BOOLEAN isring = FALSE, BOOLEAN init_b=TRUE);
197BOOLEAN iiMake_proc(idhdl pn, package pack, leftv sl);
198void* iiCallLibProc1(const char* n, void *arg, int arg_type, BOOLEAN &err);
199leftv ii_CallLibProcM(const char* n, void **args, int *arg_types, const ring R, BOOLEAN &err);
200ideal ii_CallProcId2Id(const char* lib,const char* proc, ideal arg,const ring R);
201int ii_CallProcId2Int(const char* lib,const char* proc, ideal arg,const ring R);
202// from misc.cc:
203char *  showOption();
204BOOLEAN setOption(leftv res, leftv v);
205/* ================================================================== */
206char * versionString();
207/* ================================================================== */
208void  singular_example(char *str);
209
210BOOLEAN iiTryLoadLib(leftv v, const char *id);
211
212int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic,
213               BOOLEAN(*func)(leftv res, leftv v));
214
215void iiCheckPack(package &p);
216#ifndef SING_NDEBUG
217void checkall();
218#endif
219
220void rSetHdl(idhdl h);
221ring rInit(leftv pn, leftv rv, leftv ord);
222idhdl  rDefault(const char *s);
223
224idhdl rFindHdl(ring r, idhdl n);
225void   rKill(idhdl h);
226void   rKill(ring r);
227lists scIndIndset(ideal S, BOOLEAN all, ideal Q);
228BOOLEAN mpKoszul(leftv res,leftv c/*ip*/, leftv b/*in*/, leftv id);
229BOOLEAN mpJacobi(leftv res,leftv a);
230BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w);
231BOOLEAN kQHWeight(leftv res,leftv v);
232BOOLEAN kWeight(leftv res,leftv id);
233BOOLEAN loSimplex( leftv res, leftv args );
234BOOLEAN loNewtonP( leftv res, leftv arg1 );
235BOOLEAN nuMPResMat( leftv res, leftv arg1, leftv arg2 );
236BOOLEAN nuLagSolve( leftv res, leftv arg1, leftv arg2, leftv arg3 );
237BOOLEAN nuVanderSys( leftv res, leftv arg1, leftv arg2, leftv arg3);
238BOOLEAN nuUResSolve( leftv res, leftv args );
239
240BOOLEAN jjCHARSERIES(leftv res, leftv u);
241/*
242BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w);
243#if 0
244BOOLEAN jjIS_SQR_FREE(leftv res, leftv u);
245#endif
246*/
247/* ================================================================== */
248void paPrint(const char *n,package p);
249/* ================================================================== */
250
251
252BOOLEAN iiTestAssume(leftv a, leftv b);
253
254/* table interface for iiAddCproc */
255/// apply an operation 'op' to an argument a
256/// return TRUE on failure
257BOOLEAN iiExprArith1Tab(leftv res,///< [out] pre-allocated result
258                        leftv a,  ///< [in]  argument
259                        int op,   ///< [in]  operation
260                        const struct sValCmd1* dA1, ///< [in] table of possible proc
261                                                  ///< assumes dArith1[0].cmd==op
262                        int at,   ///< [in] a->Typ()
263                        const struct sConvertTypes *dConvertTypes ///< [in] table of type conversions
264                        );
265/// apply an operation 'op' to arguments a and a->next
266/// return TRUE on failure
267BOOLEAN iiExprArith2Tab(leftv res,///< [out] pre-allocated result
268                        leftv a,  ///< [in]  2 arguments
269                        int op,   ///< [in]  operation
270                        const struct sValCmd2* dA2,///< [in] table of possible proc
271                                   ///< assumes dA2[0].cmd==op
272                        int at,    ///< [in] a->Typ()
273                        const struct sConvertTypes *dConvertTypes ///< [in] table of type conversions
274                        );
275/// apply an operation 'op' to arguments a, a->next and a->next->next
276/// return TRUE on failure
277BOOLEAN iiExprArith3Tab(leftv res, ///< [out] pre-allocated result
278                        leftv a,   ///< [in]  3 arguments
279                        int op,    ///< [in]  operation
280                        const struct sValCmd3* dA3,///< [in] table of possible proc
281                                   ///< assumes dA3[0].cmd==op
282                        int at,    ///< [in] a->Typ()
283                        const struct sConvertTypes *dConvertTypes ///< [in] table of type conversions
284                        );
285
286/// check a list of arguemys against a given field of types
287/// return TRUE if the types match
288/// return FALSE (and, if report) report an error via Werror otherwise
289BOOLEAN iiCheckTypes(leftv args,/// < [in] argument list (may be NULL)
290                      const short *type_list,///< [in] field of types
291                                             ///< len, t1,t2,...
292                      int report=0  /// ;in] report error?
293                      );
294
295BOOLEAN iiBranchTo(leftv r, leftv args);
296
297lists rDecompose(const ring r);
298
299lists rDecompose_list_cf(const ring r);
300BOOLEAN rDecompose_CF(leftv res,const coeffs C);
301ring rCompose(const lists  L, const BOOLEAN check_comp=TRUE, const long bitmask=0x7fff, const int isLetterplace=FALSE);
302
303void iiSetReturn(const leftv h);
304#endif
305
Note: See TracBrowser for help on using the repository browser.