1 | #ifndef SUBEXPR_H |
---|
2 | #define SUBEXPR_H |
---|
3 | /**************************************** |
---|
4 | * Computer Algebra System SINGULAR * |
---|
5 | ****************************************/ |
---|
6 | /* $Id: subexpr.h,v 1.3 1997-04-09 12:20:15 Singular Exp $ */ |
---|
7 | /* |
---|
8 | * ABSTRACT: handling of leftv |
---|
9 | */ |
---|
10 | |
---|
11 | #include <string.h> |
---|
12 | #include "structs.h" |
---|
13 | |
---|
14 | struct _ssubexpr |
---|
15 | { |
---|
16 | struct _ssubexpr * next; |
---|
17 | int start; |
---|
18 | }; |
---|
19 | |
---|
20 | typedef struct _ssubexpr sSubexpr; |
---|
21 | typedef sSubexpr * Subexpr; |
---|
22 | |
---|
23 | extern const char sNoName[]; |
---|
24 | extern BOOLEAN siq; |
---|
25 | |
---|
26 | class sleftv; |
---|
27 | typedef sleftv * leftv; |
---|
28 | class sleftv |
---|
29 | { |
---|
30 | public: |
---|
31 | /* !! do not change the first 6 entries !! (see ipid.h: idrec) */ |
---|
32 | leftv next; |
---|
33 | char * name; |
---|
34 | void * data; |
---|
35 | BITSET flag; |
---|
36 | attr attribute; |
---|
37 | int rtyp; |
---|
38 | /* the type of the expression, describes the data field |
---|
39 | * (E) markes the type field in iparith |
---|
40 | * (S) markes the rtyp in sleftv |
---|
41 | * ANY_TYPE: data is int: real type or 0 (E) |
---|
42 | * DEF_CMD: all types, no change in sleftv (E) |
---|
43 | * IDHDL: existing variable (E) |
---|
44 | * IDHDL: variable, data is idhdl (S) |
---|
45 | * COMMAND: data is command (S) |
---|
46 | * INT_CMD: int constant, data is int (E,S) |
---|
47 | * INTVEC_CMD: intvec constant, data is intvec * (E,S) |
---|
48 | * POLY_CMD: poly constant, data is poly (E,S) |
---|
49 | * .... |
---|
50 | */ |
---|
51 | Subexpr e; /* holds the indices for indexed values */ |
---|
52 | inline void Init() { memset(this,0,sizeof(*this)); } |
---|
53 | void Set(int val); |
---|
54 | void Print(leftv store=NULL,int spaces=0); |
---|
55 | void CleanUp(); |
---|
56 | char * String(void *d=NULL); |
---|
57 | void Copy(leftv e); |
---|
58 | void * CopyD(); |
---|
59 | attr CopyA(); |
---|
60 | void * CopyD(int t); |
---|
61 | inline const char * Name() |
---|
62 | { |
---|
63 | if ((name!=NULL) && (e==NULL)) return name; |
---|
64 | else return sNoName; |
---|
65 | } |
---|
66 | int Typ(); |
---|
67 | int LTyp(); /* returns LIST_CMD for l[i], otherwise returns Typ() */ |
---|
68 | void * Data(); |
---|
69 | leftv LData(); /* returns &(l[i]) for l[i], otherwise returns this */ |
---|
70 | leftv LHdl(); |
---|
71 | attr * Attribute(); |
---|
72 | inline leftv Next() { return next; } |
---|
73 | int listLength(); |
---|
74 | int Eval(); /*replace a COMMAND by its result otherwise by CopyD*/ |
---|
75 | }; |
---|
76 | |
---|
77 | extern sleftv sLastPrinted; |
---|
78 | |
---|
79 | struct _sssym |
---|
80 | { |
---|
81 | idhdl h; |
---|
82 | Subexpr e; |
---|
83 | }; |
---|
84 | typedef struct _sssym ssym; |
---|
85 | typedef ssym * sym; |
---|
86 | |
---|
87 | void syMake(leftv v,char * name); |
---|
88 | BOOLEAN assumeStdFlag(leftv h); |
---|
89 | |
---|
90 | #endif |
---|