[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; |
---|
[72a01e] | 40 | extern int myynest; |
---|
| 41 | extern int printlevel; |
---|
| 42 | extern int si_echo; |
---|
| 43 | |
---|
[923c27] | 44 | |
---|
[34fbd93] | 45 | extern BOOLEAN yyInRingConstruction; /* 1: during ring construction */ |
---|
[0e1846] | 46 | |
---|
[2c52262] | 47 | int IsCmd(const char *n, int & tok); |
---|
[6bc5bb] | 48 | |
---|
[057e93c] | 49 | BOOLEAN iiPStart(idhdl pn, sleftv * sl); |
---|
| 50 | BOOLEAN iiEStart(char* example, procinfo *pi); |
---|
[ba73e9] | 51 | BOOLEAN iiAllStart(procinfov pi, char *p,feBufferTypes t, int l); |
---|
[103560] | 52 | void type_cmd(leftv v); |
---|
[0e1846] | 53 | void test_cmd(int i); |
---|
[7da3cd] | 54 | void list_cmd(int typ, const char* what, const char * prefix, |
---|
| 55 | BOOLEAN iterate, BOOLEAN fullname=FALSE); |
---|
[8dde75] | 56 | //char * iiStringMatrix(matrix im, int dim, char ch=','); |
---|
[0e1846] | 57 | void killlocals(int v); |
---|
| 58 | int exprlist_length(leftv v); |
---|
[85e68dd] | 59 | const char * Tok2Cmdname(int i); |
---|
| 60 | const char * iiTwoOps(int t); |
---|
[06c0b3] | 61 | int iiOpsTwoChar(const char *s); |
---|
| 62 | |
---|
[0e1846] | 63 | BOOLEAN iiWRITE(leftv res,leftv exprlist); |
---|
| 64 | BOOLEAN iiExport(leftv v, int toLev); |
---|
[9d864a] | 65 | BOOLEAN iiExport(leftv v, int toLev, package pack); |
---|
| 66 | BOOLEAN iiInternalExport (leftv v, int toLev, package pack); |
---|
[2ba9a6] | 67 | char * iiGetLibName(procinfov v); |
---|
| 68 | char * iiGetLibProcBuffer( procinfov pi, int part=1 ); |
---|
[0e1846] | 69 | char * iiProcName(char *buf, char & ct, char* &e); |
---|
| 70 | char * iiProcArgs(char *e,BOOLEAN withParenth); |
---|
[22ed4c] | 71 | BOOLEAN iiLibCmd( char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force ); |
---|
[698457] | 72 | /* sees wheter library lib has already been loaded |
---|
| 73 | if yes, writes filename of lib into where and returns TRUE, |
---|
| 74 | if no, returns FALSE |
---|
| 75 | */ |
---|
[6babcbc] | 76 | /// load lib/module given in v |
---|
[e2202ee] | 77 | BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport = FALSE); |
---|
[ea63bfc] | 78 | BOOLEAN jjLOAD_TRY(const char *s); |
---|
[698457] | 79 | BOOLEAN iiLocateLib(const char* lib, char* where); |
---|
[85e68dd] | 80 | leftv iiMap(map theMap, const char * what); |
---|
[0e1846] | 81 | void iiMakeResolv(resolvente r, int length, int rlen, char * name, int typ0, |
---|
| 82 | intvec ** weights=NULL); |
---|
| 83 | BOOLEAN jjMINRES(leftv res, leftv v); |
---|
| 84 | BOOLEAN jjBETTI(leftv res, leftv v); |
---|
[7f14f2] | 85 | BOOLEAN jjBETTI2(leftv res, leftv u, leftv v); |
---|
[709ab0] | 86 | BOOLEAN jjBETTI2_ID(leftv res, leftv u, leftv v); |
---|
[762bfd] | 87 | BOOLEAN jjIMPORTFROM(leftv res, leftv u, leftv v); |
---|
[146d90] | 88 | BOOLEAN jjLIST_PL(leftv res, leftv v); |
---|
[7f14f2] | 89 | |
---|
[f46646] | 90 | BOOLEAN jjVARIABLES_P(leftv res, leftv u); |
---|
| 91 | BOOLEAN jjVARIABLES_ID(leftv res, leftv u); |
---|
| 92 | |
---|
[0e1846] | 93 | int iiRegularity(lists L); |
---|
| 94 | leftv singular_system(sleftv h); |
---|
| 95 | BOOLEAN jjSYSTEM(leftv res, leftv v); |
---|
| 96 | void iiDebug(); |
---|
| 97 | BOOLEAN iiCheckRing(int i); |
---|
[f99917f] | 98 | poly iiHighCorner(ideal i, int ak); |
---|
[f43a74] | 99 | char * iiConvName(const char *libname); |
---|
[e2202ee] | 100 | BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib, |
---|
[bf4ff72] | 101 | idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror); |
---|
| 102 | |
---|
[8fa9ea] | 103 | // converts a resolution into a list of modules |
---|
| 104 | lists 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 |
---|
[fc866f6] | 108 | syStrategy syConvList(lists li); |
---|
[8fa9ea] | 109 | |
---|
[ae3ad6] | 110 | BOOLEAN syBetti1(leftv res, leftv u); |
---|
| 111 | BOOLEAN syBetti2(leftv res, leftv u, leftv w); |
---|
| 112 | |
---|
[0e1846] | 113 | /* ================================================================== */ |
---|
| 114 | /* Expressions : */ |
---|
| 115 | BOOLEAN iiExprArith1(leftv res, sleftv* a, int op); |
---|
| 116 | BOOLEAN iiExprArith2(leftv res, sleftv* a, int op, sleftv* b, |
---|
| 117 | BOOLEAN proccall=FALSE); |
---|
| 118 | BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c); |
---|
| 119 | BOOLEAN iiExprArithM(leftv res, sleftv* a, int op); |
---|
[78c0dbe] | 120 | BOOLEAN iiApply(leftv res,leftv a, int op, leftv proc); |
---|
[0e1846] | 121 | |
---|
| 122 | typedef BOOLEAN (*proc1)(leftv,leftv); |
---|
| 123 | |
---|
| 124 | #ifdef GENTABLE |
---|
| 125 | typedef char * (*Proc1)(char *); |
---|
| 126 | struct sValCmd1 |
---|
| 127 | { |
---|
| 128 | proc1 p; |
---|
| 129 | short cmd; |
---|
| 130 | short res; |
---|
| 131 | short arg; |
---|
[ee9485] | 132 | short valid_for; |
---|
[0e1846] | 133 | }; |
---|
| 134 | |
---|
| 135 | typedef BOOLEAN (*proc2)(leftv,leftv,leftv); |
---|
| 136 | struct sValCmd2 |
---|
| 137 | { |
---|
| 138 | proc2 p; |
---|
| 139 | short cmd; |
---|
| 140 | short res; |
---|
| 141 | short arg1; |
---|
| 142 | short arg2; |
---|
[ee9485] | 143 | short valid_for; |
---|
[0e1846] | 144 | }; |
---|
| 145 | |
---|
| 146 | typedef BOOLEAN (*proc3)(leftv,leftv,leftv,leftv); |
---|
| 147 | struct sValCmd3 |
---|
| 148 | { |
---|
| 149 | proc3 p; |
---|
| 150 | short cmd; |
---|
| 151 | short res; |
---|
| 152 | short arg1; |
---|
| 153 | short arg2; |
---|
| 154 | short arg3; |
---|
[ee9485] | 155 | short valid_for; |
---|
[0e1846] | 156 | }; |
---|
| 157 | struct sValCmdM |
---|
| 158 | { |
---|
| 159 | proc1 p; |
---|
| 160 | short cmd; |
---|
| 161 | short res; |
---|
| 162 | short number_of_args; /* -1: any, -2: any >0, .. */ |
---|
[ee9485] | 163 | short valid_for; |
---|
[0e1846] | 164 | }; |
---|
| 165 | extern struct sValCmd2 dArith2[]; |
---|
| 166 | extern struct sValCmd1 dArith1[]; |
---|
| 167 | extern struct sValCmd3 dArith3[]; |
---|
| 168 | extern struct sValCmdM dArithM[]; |
---|
| 169 | #endif |
---|
| 170 | |
---|
| 171 | /* ================================================================== */ |
---|
| 172 | /* Assigments : */ |
---|
[4a74cc] | 173 | BOOLEAN iiAssign(leftv left, leftv right, BOOLEAN toplevel=TRUE); |
---|
[0e1846] | 174 | |
---|
| 175 | typedef BOOLEAN (*proci)(leftv,leftv,Subexpr); |
---|
| 176 | struct sValAssign_sys |
---|
| 177 | { |
---|
| 178 | proc1 p; |
---|
| 179 | short res; |
---|
| 180 | short arg; |
---|
| 181 | }; |
---|
| 182 | |
---|
| 183 | struct sValAssign |
---|
| 184 | { |
---|
| 185 | proci p; |
---|
| 186 | short res; |
---|
| 187 | short arg; |
---|
| 188 | }; |
---|
| 189 | |
---|
| 190 | BOOLEAN iiParameter(leftv p); |
---|
[ea947e] | 191 | BOOLEAN iiAlias(leftv p); |
---|
[91ef34] | 192 | |
---|
| 193 | int iiTokType(int op); |
---|
[0e1846] | 194 | /* ================================================================== */ |
---|
| 195 | int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl* root, |
---|
[0a3ddd] | 196 | BOOLEAN isring = FALSE, BOOLEAN init_b=TRUE); |
---|
[5edb77] | 197 | BOOLEAN iiMake_proc(idhdl pn, package pack, sleftv* sl); |
---|
[0e1846] | 198 | // from misc.cc: |
---|
[979a09f] | 199 | char * showOption(); |
---|
[0e1846] | 200 | BOOLEAN setOption(leftv res, leftv v); |
---|
| 201 | /* ================================================================== */ |
---|
[9ea9c6] | 202 | char * versionString(); |
---|
[706c95] | 203 | /* ================================================================== */ |
---|
| 204 | void singular_example(char *str); |
---|
[a3bc95e] | 205 | |
---|
[85e68dd] | 206 | BOOLEAN iiTryLoadLib(leftv v, const char *id); |
---|
[5c5638] | 207 | |
---|
[ce0ca7] | 208 | int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic, |
---|
[b90cc8] | 209 | BOOLEAN(*func)(leftv res, leftv v)); |
---|
| 210 | |
---|
[d66a7d] | 211 | void iiCheckPack(package &p); |
---|
[7fe9e13] | 212 | #ifndef SING_NDEBUG |
---|
[5c5638] | 213 | void checkall(); |
---|
| 214 | #endif |
---|
[2b7f4e] | 215 | |
---|
[88ece17] | 216 | void rSetHdl(idhdl h); |
---|
[d35711] | 217 | ring rInit(leftv pn, leftv rv, leftv ord); |
---|
[2b7f4e] | 218 | idhdl rDefault(const char *s); |
---|
| 219 | |
---|
[6cc7f5] | 220 | idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n=NULL); |
---|
[cbe2a4c] | 221 | idhdl rFindHdl(ring r, idhdl n); |
---|
[1085d4] | 222 | void rKill(idhdl h); |
---|
| 223 | void rKill(ring r); |
---|
[bf38a4] | 224 | lists scIndIndset(ideal S, BOOLEAN all, ideal Q); |
---|
| 225 | BOOLEAN mpKoszul(leftv res,leftv c/*ip*/, leftv b/*in*/, leftv id); |
---|
[15ff9a] | 226 | BOOLEAN mpJacobi(leftv res,leftv a); |
---|
| 227 | BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w); |
---|
| 228 | BOOLEAN kQHWeight(leftv res,leftv v); |
---|
| 229 | BOOLEAN kWeight(leftv res,leftv id); |
---|
| 230 | BOOLEAN loSimplex( leftv res, leftv args ); |
---|
| 231 | BOOLEAN loNewtonP( leftv res, leftv arg1 ); |
---|
[c10515] | 232 | BOOLEAN nuMPResMat( leftv res, leftv arg1, leftv arg2 ); |
---|
| 233 | BOOLEAN nuLagSolve( leftv res, leftv arg1, leftv arg2, leftv arg3 ); |
---|
| 234 | BOOLEAN nuVanderSys( leftv res, leftv arg1, leftv arg2, leftv arg3); |
---|
| 235 | BOOLEAN nuUResSolve( leftv res, leftv args ); |
---|
[15ff9a] | 236 | |
---|
[f0168a5] | 237 | BOOLEAN jjCHARSERIES(leftv res, leftv u); |
---|
| 238 | /* |
---|
| 239 | BOOLEAN jjRESULTANT(leftv res, leftv u, leftv v, leftv w); |
---|
| 240 | #if 0 |
---|
| 241 | BOOLEAN jjIS_SQR_FREE(leftv res, leftv u); |
---|
| 242 | #endif |
---|
| 243 | */ |
---|
[95197e] | 244 | /* ================================================================== */ |
---|
| 245 | void paPrint(const char *n,package p); |
---|
| 246 | /* ================================================================== */ |
---|
[f0168a5] | 247 | |
---|
[88ece17] | 248 | |
---|
[6b5a71] | 249 | BOOLEAN iiTestAssume(leftv a, leftv b); |
---|
[e25346] | 250 | |
---|
| 251 | /* table inteface for iiAddCproc */ |
---|
[1438fbb] | 252 | /// apply an operation 'op' to an argument a |
---|
| 253 | /// return TRUE on failure |
---|
| 254 | BOOLEAN iiExprArith1Tab(leftv res,///< [out] pre-allocated result |
---|
| 255 | leftv a, ///< [in] argument |
---|
| 256 | int op, ///< [in] operation |
---|
[cd73d1] | 257 | const struct sValCmd1* dA1, ///< [in] table of possible proc |
---|
[1438fbb] | 258 | ///< assumes dArith1[0].cmd==op |
---|
| 259 | int at, ///< [in] a->Typ() |
---|
[cd73d1] | 260 | const struct sConvertTypes *dConvertTypes ///< [in] table of type conversions |
---|
[1438fbb] | 261 | ); |
---|
| 262 | /// apply an operation 'op' to arguments a and a->next |
---|
| 263 | /// return TRUE on failure |
---|
| 264 | BOOLEAN iiExprArith2Tab(leftv res,///< [out] pre-allocated result |
---|
| 265 | leftv a, ///< [in] 2 arguments |
---|
| 266 | int op, ///< [in] operation |
---|
[cd73d1] | 267 | const struct sValCmd2* dA2,///< [in] table of possible proc |
---|
[1438fbb] | 268 | ///< assumes dA2[0].cmd==op |
---|
| 269 | int at, ///< [in] a->Typ() |
---|
[cd73d1] | 270 | const struct sConvertTypes *dConvertTypes ///< [in] table of type conversions |
---|
[1438fbb] | 271 | ); |
---|
| 272 | /// apply an operation 'op' to arguments a, a->next and a->next->next |
---|
| 273 | /// return TRUE on failure |
---|
| 274 | BOOLEAN iiExprArith3Tab(leftv res, ///< [out] pre-allocated result |
---|
| 275 | leftv a, ///< [in] 3 arguments |
---|
| 276 | int op, ///< [in] operation |
---|
[cd73d1] | 277 | const struct sValCmd3* dA3,///< [in] table of possible proc |
---|
[1438fbb] | 278 | ///< assumes dA3[0].cmd==op |
---|
| 279 | int at, ///< [in] a->Typ() |
---|
[cd73d1] | 280 | const struct sConvertTypes *dConvertTypes ///< [in] table of type conversions |
---|
[1438fbb] | 281 | ); |
---|
| 282 | |
---|
| 283 | /// check a list of arguemys against a given field of types |
---|
| 284 | /// return TRUE if the types match |
---|
| 285 | /// return FALSE (and, if report) report an error via Werror otherwise |
---|
| 286 | BOOLEAN iiCheckTypes(leftv args,/// < [in] argument list (may be NULL) |
---|
| 287 | const short *type_list,///< [in] field of types |
---|
| 288 | ///< len, t1,t2,... |
---|
| 289 | int report=0 /// ;in] report error? |
---|
| 290 | ); |
---|
[f0e7c4] | 291 | |
---|
| 292 | BOOLEAN iiBranchTo(leftv r, leftv args); |
---|
| 293 | |
---|
[b541aa] | 294 | lists rDecompose(const ring r); |
---|
| 295 | |
---|
[afbc156] | 296 | #ifdef SINGULAR_4_1 |
---|
[b541aa] | 297 | lists rDecompose_list_cf(const ring r); |
---|
[afbc156] | 298 | BOOLEAN rDecompose_CF(leftv res,const coeffs C); |
---|
| 299 | #endif |
---|
[a3bc95e] | 300 | #endif |
---|
[0e1846] | 301 | |
---|