[0e1846] | 1 | #ifndef IPSHELL_H |
---|
| 2 | #define IPSHELL_H |
---|
| 3 | /**************************************** |
---|
| 4 | * Computer Algebra System SINGULAR * |
---|
| 5 | ****************************************/ |
---|
| 6 | /* |
---|
| 7 | * ABSTRACT |
---|
| 8 | */ |
---|
| 9 | #include <stdio.h> |
---|
[f5a3a23] | 10 | //#include <kernel/structs.h> |
---|
[599326] | 11 | #include <kernel/ideals.h> |
---|
[f5a3a23] | 12 | #include <Singular/lists.h> |
---|
[cf19a8] | 13 | #include <Singular/fevoices.h> |
---|
[508937] | 14 | |
---|
[0e051f] | 15 | struct _ssubexpr; |
---|
| 16 | typedef struct _ssubexpr *Subexpr; |
---|
| 17 | |
---|
[47a4c2] | 18 | BOOLEAN spectrumProc ( leftv,leftv ); |
---|
| 19 | BOOLEAN spectrumfProc( leftv,leftv ); |
---|
| 20 | BOOLEAN spaddProc ( leftv,leftv,leftv ); |
---|
| 21 | BOOLEAN spmulProc ( leftv,leftv,leftv ); |
---|
| 22 | BOOLEAN semicProc ( leftv,leftv,leftv ); |
---|
| 23 | BOOLEAN semicProc3 ( leftv,leftv,leftv,leftv ); |
---|
[0e1846] | 24 | |
---|
[33d610] | 25 | BOOLEAN iiAssignCR(leftv, leftv); |
---|
| 26 | |
---|
[6be074] | 27 | BOOLEAN iiARROW (leftv, char*,char *); |
---|
| 28 | |
---|
[0e1846] | 29 | extern leftv iiCurrArgs; |
---|
[f71681] | 30 | extern idhdl iiCurrProc; |
---|
[0e1846] | 31 | extern int iiOp; /* the current operation*/ |
---|
[85e68dd] | 32 | extern const char * currid; |
---|
[0e1846] | 33 | extern int iiRETURNEXPR_len; |
---|
[f92a39] | 34 | extern sleftv iiRETURNEXPR; |
---|
[0a3ddd] | 35 | #ifdef USE_IILOCALRING |
---|
[0e1846] | 36 | extern ring *iiLocalRing; |
---|
[77ff8e] | 37 | #endif |
---|
[2617dd5] | 38 | //extern cmdnames cmds[]; |
---|
[85e68dd] | 39 | extern const char *lastreserved; |
---|
[995a6a] | 40 | extern const char *singular_date; /* tesths.cc, set by final compile */ |
---|
[72a01e] | 41 | extern int myynest; |
---|
| 42 | extern int printlevel; |
---|
| 43 | extern int si_echo; |
---|
| 44 | |
---|
[923c27] | 45 | |
---|
[34fbd93] | 46 | extern BOOLEAN yyInRingConstruction; /* 1: during ring construction */ |
---|
[0e1846] | 47 | |
---|
[2c52262] | 48 | int IsCmd(const char *n, int & tok); |
---|
[6bc5bb] | 49 | |
---|
[057e93c] | 50 | BOOLEAN iiPStart(idhdl pn, sleftv * sl); |
---|
| 51 | BOOLEAN iiEStart(char* example, procinfo *pi); |
---|
[ba73e9] | 52 | BOOLEAN iiAllStart(procinfov pi, char *p,feBufferTypes t, int l); |
---|
[103560] | 53 | void type_cmd(leftv v); |
---|
[0e1846] | 54 | void test_cmd(int i); |
---|
[7da3cd] | 55 | void list_cmd(int typ, const char* what, const char * prefix, |
---|
| 56 | BOOLEAN iterate, BOOLEAN fullname=FALSE); |
---|
[8dde75] | 57 | //char * iiStringMatrix(matrix im, int dim, char ch=','); |
---|
[0e1846] | 58 | void killlocals(int v); |
---|
| 59 | int exprlist_length(leftv v); |
---|
[85e68dd] | 60 | const char * Tok2Cmdname(int i); |
---|
| 61 | const char * iiTwoOps(int t); |
---|
[06c0b3] | 62 | int iiOpsTwoChar(const char *s); |
---|
| 63 | |
---|
[0e1846] | 64 | BOOLEAN iiWRITE(leftv res,leftv exprlist); |
---|
| 65 | BOOLEAN iiExport(leftv v, int toLev); |
---|
[9d864a] | 66 | BOOLEAN iiExport(leftv v, int toLev, package pack); |
---|
| 67 | BOOLEAN iiInternalExport (leftv v, int toLev, package pack); |
---|
[2ba9a6] | 68 | char * iiGetLibName(procinfov v); |
---|
| 69 | char * iiGetLibProcBuffer( procinfov pi, int part=1 ); |
---|
[0e1846] | 70 | char * iiProcName(char *buf, char & ct, char* &e); |
---|
| 71 | char * iiProcArgs(char *e,BOOLEAN withParenth); |
---|
[22ed4c] | 72 | BOOLEAN iiLibCmd( char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force ); |
---|
[698457] | 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 | */ |
---|
[6babcbc] | 77 | /// load lib/module given in v |
---|
[e2202ee] | 78 | BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport = FALSE); |
---|
[ea63bfc] | 79 | BOOLEAN jjLOAD_TRY(const char *s); |
---|
[698457] | 80 | BOOLEAN iiLocateLib(const char* lib, char* where); |
---|
[85e68dd] | 81 | leftv iiMap(map theMap, const char * what); |
---|
[0e1846] | 82 | void iiMakeResolv(resolvente r, int length, int rlen, char * name, int typ0, |
---|
| 83 | intvec ** weights=NULL); |
---|
| 84 | BOOLEAN jjMINRES(leftv res, leftv v); |
---|
| 85 | BOOLEAN jjBETTI(leftv res, leftv v); |
---|
[7f14f2] | 86 | BOOLEAN jjBETTI2(leftv res, leftv u, leftv v); |
---|
[709ab0] | 87 | BOOLEAN jjBETTI2_ID(leftv res, leftv u, leftv v); |
---|
[762bfd] | 88 | BOOLEAN jjIMPORTFROM(leftv res, leftv u, leftv v); |
---|
[146d90] | 89 | BOOLEAN jjLIST_PL(leftv res, leftv v); |
---|
[7f14f2] | 90 | |
---|
[f46646] | 91 | BOOLEAN jjVARIABLES_P(leftv res, leftv u); |
---|
| 92 | BOOLEAN jjVARIABLES_ID(leftv res, leftv u); |
---|
| 93 | |
---|
[0e1846] | 94 | int iiRegularity(lists L); |
---|
| 95 | leftv singular_system(sleftv h); |
---|
| 96 | BOOLEAN jjSYSTEM(leftv res, leftv v); |
---|
| 97 | void iiDebug(); |
---|
| 98 | BOOLEAN iiCheckRing(int i); |
---|
[f99917f] | 99 | poly iiHighCorner(ideal i, int ak); |
---|
[f43a74] | 100 | char * iiConvName(const char *libname); |
---|
[e2202ee] | 101 | BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib, |
---|
[bf4ff72] | 102 | idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror); |
---|
| 103 | |
---|
[8fa9ea] | 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 |
---|
| 107 | syStrategy syForceMin(lists li); |
---|
| 108 | // converts a list of modules into a resolution |
---|
| 109 | syStrategy syConvList(lists li,BOOLEAN toDel); |
---|
| 110 | |
---|
[ae3ad6] | 111 | BOOLEAN syBetti1(leftv res, leftv u); |
---|
| 112 | BOOLEAN syBetti2(leftv res, leftv u, leftv w); |
---|
| 113 | |
---|
[0e1846] | 114 | /* ================================================================== */ |
---|
| 115 | /* Expressions : */ |
---|
| 116 | BOOLEAN iiExprArith1(leftv res, sleftv* a, int op); |
---|
| 117 | BOOLEAN iiExprArith2(leftv res, sleftv* a, int op, sleftv* b, |
---|
| 118 | BOOLEAN proccall=FALSE); |
---|
| 119 | BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c); |
---|
| 120 | BOOLEAN iiExprArithM(leftv res, sleftv* a, int op); |
---|
[78c0dbe] | 121 | BOOLEAN iiApply(leftv res,leftv a, int op, leftv proc); |
---|
[0e1846] | 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; |
---|
[ee9485] | 133 | short valid_for; |
---|
[0e1846] | 134 | }; |
---|
| 135 | |
---|
| 136 | typedef BOOLEAN (*proc2)(leftv,leftv,leftv); |
---|
| 137 | struct sValCmd2 |
---|
| 138 | { |
---|
| 139 | proc2 p; |
---|
| 140 | short cmd; |
---|
| 141 | short res; |
---|
| 142 | short arg1; |
---|
| 143 | short arg2; |
---|
[ee9485] | 144 | short valid_for; |
---|
[0e1846] | 145 | }; |
---|
| 146 | |
---|
| 147 | typedef BOOLEAN (*proc3)(leftv,leftv,leftv,leftv); |
---|
| 148 | struct sValCmd3 |
---|
| 149 | { |
---|
| 150 | proc3 p; |
---|
| 151 | short cmd; |
---|
| 152 | short res; |
---|
| 153 | short arg1; |
---|
| 154 | short arg2; |
---|
| 155 | short arg3; |
---|
[ee9485] | 156 | short valid_for; |
---|
[0e1846] | 157 | }; |
---|
| 158 | struct sValCmdM |
---|
| 159 | { |
---|
| 160 | proc1 p; |
---|
| 161 | short cmd; |
---|
| 162 | short res; |
---|
| 163 | short number_of_args; /* -1: any, -2: any >0, .. */ |
---|
[ee9485] | 164 | short valid_for; |
---|
[0e1846] | 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 : */ |
---|
[4a74cc] | 174 | BOOLEAN iiAssign(leftv left, leftv right, BOOLEAN toplevel=TRUE); |
---|
[0e1846] | 175 | |
---|
| 176 | typedef BOOLEAN (*proci)(leftv,leftv,Subexpr); |
---|
| 177 | struct sValAssign_sys |
---|
| 178 | { |
---|
| 179 | proc1 p; |
---|
| 180 | short res; |
---|
| 181 | short arg; |
---|
| 182 | }; |
---|
| 183 | |
---|
| 184 | struct sValAssign |
---|
| 185 | { |
---|
| 186 | proci p; |
---|
| 187 | short res; |
---|
| 188 | short arg; |
---|
| 189 | }; |
---|
| 190 | |
---|
| 191 | BOOLEAN iiParameter(leftv p); |
---|
[ea947e] | 192 | BOOLEAN iiAlias(leftv p); |
---|
[91ef34] | 193 | |
---|
| 194 | int iiTokType(int op); |
---|
[0e1846] | 195 | /* ================================================================== */ |
---|
| 196 | int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl* root, |
---|
[0a3ddd] | 197 | BOOLEAN isring = FALSE, BOOLEAN init_b=TRUE); |
---|
[5edb77] | 198 | BOOLEAN iiMake_proc(idhdl pn, package pack, sleftv* sl); |
---|
[0e1846] | 199 | // from misc.cc: |
---|
[979a09f] | 200 | char * showOption(); |
---|
[0e1846] | 201 | BOOLEAN setOption(leftv res, leftv v); |
---|
| 202 | /* ================================================================== */ |
---|
[9ea9c6] | 203 | char * versionString(); |
---|
[706c95] | 204 | /* ================================================================== */ |
---|
| 205 | void singular_example(char *str); |
---|
[a3bc95e] | 206 | |
---|
[85e68dd] | 207 | BOOLEAN iiTryLoadLib(leftv v, const char *id); |
---|
[5c5638] | 208 | |
---|
[ce0ca7] | 209 | int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic, |
---|
[b90cc8] | 210 | BOOLEAN(*func)(leftv res, leftv v)); |
---|
| 211 | |
---|
[d66a7d] | 212 | void iiCheckPack(package &p); |
---|
[7fe9e13] | 213 | #ifndef SING_NDEBUG |
---|
[5c5638] | 214 | void checkall(); |
---|
| 215 | #endif |
---|
[2b7f4e] | 216 | |
---|
[88ece17] | 217 | void rSetHdl(idhdl h); |
---|
[d35711] | 218 | ring rInit(leftv pn, leftv rv, leftv ord); |
---|
[2b7f4e] | 219 | idhdl rDefault(const char *s); |
---|
| 220 | |
---|
[6cc7f5] | 221 | idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n=NULL); |
---|
[cbe2a4c] | 222 | idhdl rFindHdl(ring r, idhdl n); |
---|
[1085d4] | 223 | void rKill(idhdl h); |
---|
| 224 | void rKill(ring r); |
---|
[bf38a4] | 225 | lists scIndIndset(ideal S, BOOLEAN all, ideal Q); |
---|
| 226 | BOOLEAN mpKoszul(leftv res,leftv c/*ip*/, leftv b/*in*/, leftv id); |
---|
[15ff9a] | 227 | BOOLEAN mpJacobi(leftv res,leftv a); |
---|
| 228 | BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w); |
---|
| 229 | BOOLEAN kQHWeight(leftv res,leftv v); |
---|
| 230 | BOOLEAN kWeight(leftv res,leftv id); |
---|
| 231 | BOOLEAN loSimplex( leftv res, leftv args ); |
---|
| 232 | BOOLEAN loNewtonP( leftv res, leftv arg1 ); |
---|
[c10515] | 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); |
---|
| 236 | BOOLEAN nuUResSolve( leftv res, leftv args ); |
---|
[15ff9a] | 237 | |
---|
[f0168a5] | 238 | BOOLEAN jjCHARSERIES(leftv res, leftv u); |
---|
| 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 | */ |
---|
[95197e] | 245 | /* ================================================================== */ |
---|
| 246 | void paPrint(const char *n,package p); |
---|
| 247 | /* ================================================================== */ |
---|
[f0168a5] | 248 | |
---|
[88ece17] | 249 | |
---|
[6b5a71] | 250 | BOOLEAN iiTestAssume(leftv a, leftv b); |
---|
[e25346] | 251 | |
---|
| 252 | /* table inteface for iiAddCproc */ |
---|
[1438fbb] | 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 | 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 |
---|
| 265 | BOOLEAN 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 |
---|
| 275 | BOOLEAN 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 |
---|
| 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 | ); |
---|
[f0e7c4] | 292 | |
---|
| 293 | BOOLEAN iiBranchTo(leftv r, leftv args); |
---|
| 294 | |
---|
[afbc156] | 295 | #ifdef SINGULAR_4_1 |
---|
| 296 | BOOLEAN rDecompose_CF(leftv res,const coeffs C); |
---|
| 297 | #endif |
---|
[a3bc95e] | 298 | #endif |
---|
[0e1846] | 299 | |
---|