[0e1846] | 1 | #ifndef LISTS_H |
---|
| 2 | #define LISTS_H |
---|
| 3 | /**************************************** |
---|
| 4 | * Computer Algebra System SINGULAR * |
---|
| 5 | ****************************************/ |
---|
[341696] | 6 | /* $Id$ */ |
---|
[0e1846] | 7 | /* |
---|
| 8 | * ABSTRACT: handling of the list type |
---|
| 9 | */ |
---|
[b1dfaf] | 10 | #include <omalloc/omalloc.h> |
---|
[599326] | 11 | #include <kernel/structs.h> |
---|
| 12 | #include <kernel/ideals.h> |
---|
| 13 | #include <Singular/subexpr.h> |
---|
| 14 | #include <Singular/tok.h> |
---|
[b7b08c] | 15 | |
---|
[a3bc95e] | 16 | #ifdef MDEBUG |
---|
| 17 | #define INLINE_THIS |
---|
[0f1252] | 18 | #else |
---|
| 19 | #define INLINE_THIS inline |
---|
| 20 | #endif |
---|
[0e1846] | 21 | |
---|
[bfcb41] | 22 | extern omBin slists_bin; |
---|
[0e1846] | 23 | class slists |
---|
| 24 | { |
---|
| 25 | public: |
---|
[16acb0] | 26 | void Clean(ring r=currRing) |
---|
[0e1846] | 27 | { |
---|
| 28 | if (this!=NULL) |
---|
| 29 | { |
---|
| 30 | if (nr>=0) |
---|
| 31 | { |
---|
| 32 | int i; |
---|
| 33 | for(i=nr;i>=0;i--) |
---|
| 34 | { |
---|
[16acb0] | 35 | if (m[i].rtyp!=DEF_CMD) m[i].CleanUp(r); |
---|
[0e1846] | 36 | } |
---|
[c232af] | 37 | omFreeSize((ADDRESS)m, (nr+1)*sizeof(sleftv)); |
---|
[0e1846] | 38 | nr=-1; |
---|
| 39 | } |
---|
[bfcb41] | 40 | //omFreeSize((ADDRESS)this, sizeof(slists)); |
---|
| 41 | omFreeBin((ADDRESS)this,slists_bin); |
---|
[0e1846] | 42 | } |
---|
| 43 | } |
---|
[0f1252] | 44 | INLINE_THIS void Init(int l=0); |
---|
[0e1846] | 45 | int nr; /* the number of elements in the list -1 */ |
---|
| 46 | /* -1: empty list */ |
---|
| 47 | sleftv *m; /* field of sleftv */ |
---|
| 48 | }; |
---|
| 49 | |
---|
[f5a3a23] | 50 | typedef slists * lists; |
---|
| 51 | |
---|
[0e1846] | 52 | lists lCopy(lists L); |
---|
| 53 | lists lInsert0(lists ul, leftv v, int pos); |
---|
| 54 | BOOLEAN lInsert(leftv res, leftv u, leftv v); |
---|
| 55 | BOOLEAN lInsert3(leftv res, leftv u, leftv v, leftv w); |
---|
| 56 | BOOLEAN lAppend(leftv res, leftv u, leftv v); |
---|
| 57 | BOOLEAN lDelete(leftv res, leftv u, leftv v); |
---|
| 58 | BOOLEAN lAdd(leftv res, leftv u, leftv v); |
---|
| 59 | BOOLEAN lRingDependend(lists L); |
---|
[a79a128] | 60 | char* lString(lists l, BOOLEAN typed = FALSE, int dim = 1); |
---|
[4b2155] | 61 | |
---|
[0e1846] | 62 | |
---|
[f43a74] | 63 | lists liMakeResolv(resolvente r, int length, int reallen, int typ0, intvec ** weights,int add_row_shift); |
---|
[25003c] | 64 | resolvente liFindRes(lists L, int * len, int *typ0,intvec *** weights=NULL); |
---|
[0f1252] | 65 | |
---|
| 66 | #if ! defined(MDEBUG) || defined(LISTS_CC) |
---|
[50cbdc] | 67 | INLINE_THIS void slists::Init(int l) |
---|
[c232af] | 68 | { nr=l-1; m=(sleftv *)((l>0) ? omAlloc0(l*sizeof(sleftv)): NULL); |
---|
[0f1252] | 69 | } |
---|
| 70 | #endif |
---|
| 71 | |
---|
| 72 | #undef INLINE_THIS |
---|
| 73 | |
---|
[0e1846] | 74 | #endif |
---|