subexpr.h
Go to the documentation of this file.
1 #ifndef SUBEXPR_H
2 #define SUBEXPR_H
3 /****************************************
4 * Computer Algebra System SINGULAR *
5 ****************************************/
6 /*
7 * ABSTRACT: handling of leftv
8 */
9 
10 #include <string.h>
11 
12 #include <polys/monomials/ring.h>
13 
14 //#include <Singular/ipid.h>
15 
16 #include <kernel/mod2.h>
17 #include <Singular/grammar.h>
18 #include <Singular/tok.h>
19 #include <Singular/attrib.h>
20 
23 {
24 public:
25  long proc_start; // position where proc is starting
26  long def_end; // position where proc header is ending
27  long help_start; // position where help is starting
28  long help_end; // position where help is starting
29  long body_start; // position where proc-body is starting
30  long body_end; // position where proc-body is ending
31  long example_start; // position where example is starting
32  long proc_end; // position where proc is ending
36  char *body;
38 };
40 {
41 //public:
42  BOOLEAN (*function)(leftv res, leftv v);
43 };
44 
46 {
47 public:
48  proc_singular s; // data of Singular-procedure
49  struct proc_object o; // pointer to binary-function
50 };
51 typedef union uprocinfodata procinfodata;
52 
53 class procinfo
54 {
55 public:
56  char *libname;
57  char *procname;
58  package pack;
60  short ref;
61  char is_static; // if set, proc not accessible for user
62  char trace_flag;
63  procinfodata data;
64 };
65 
66 typedef procinfo * procinfov;
67 
68 struct _ssubexpr
69 {
70  struct _ssubexpr * next;
71  int start;
72 };
73 
74 typedef struct _ssubexpr *Subexpr;
75 
76 extern const char sNoName[];
77 extern BOOLEAN siq;
78 extern const char *iiSleftv2name(leftv v);
79 
80 class sleftv;
81 typedef sleftv * leftv;
82 
83 /// Class used for (list of) interpreter objects
84 class sleftv
85 {
86  public:
87  /* !! do not change the first 6 entries !! (see ipid.h: idrec) */
88  leftv next;
89  const char *name;
90  void * data;
93  int rtyp;
94  /* the type of the expression, describes the data field
95  * (E) markes the type field in iparith
96  * (S) markes the rtyp in sleftv
97  * ANY_TYPE: data is int: real type or 0 (E)
98  * DEF_CMD: all types, no change in sleftv (E)
99  * IDHDL: existing variable (E)
100  * IDHDL: variable, data is idhdl (S)
101  * COMMAND: data is command (S)
102  * INT_CMD: int constant, data is int (E,S)
103  * INTVEC_CMD: intvec constant, data is intvec * (E,S)
104  * POLY_CMD: poly constant, data is poly (E,S)
105  * ....
106  */
107  Subexpr e; /* holds the indices for indexed values */
108  package req_packhdl;
109  inline void Init() { memset(this,0,sizeof(*this)); }
110  void CleanUp(ring r=currRing);
111 
112  /// Called by type_cmd (e.g. "r;") or as default in jPRINT
113  void Print(leftv store=NULL,int spaces=0);
114 
115  /// Called for conversion to string (used by string(..), write(..),..)
116  char * String(void *d=NULL, BOOLEAN typed = FALSE, int dim = 1);
117 
118  void Copy(leftv e);
119  attr CopyA();
120  void * CopyD(int t);
121  void * CopyD() { return CopyD(Typ()); }
122  inline const char * Name()
123  {
124  if ((name!=NULL) && (e==NULL)) return name;
125  else return sNoName;
126  }
127  inline const char * Fullname()
128  {
129  if ((name!=NULL) && (e==NULL)) return(iiSleftv2name(this));
130  else return sNoName;
131  }
132  int Typ();
133  int LTyp(); /* returns LIST_CMD for l[i], otherwise returns Typ() */
134  void * Data();
135  leftv LData(); /* returns &(l[i]) for l[i], otherwise returns this */
136  //leftv LHdl();
137  attr * Attribute();
138  inline leftv Next() { return next; }
139  int listLength();
140  int Eval(); /*replace a COMMAND by its result otherwise by CopyD*/
142 };
143 
144 inline BOOLEAN RingDependend(int t) { return (BEGIN_RING<t)&&(t<END_RING); }
145 extern sleftv sLastPrinted;
146 
147 void syMake(leftv v,const char * name, package pa = NULL);
148 BOOLEAN assumeStdFlag(leftv h);
149 
150 inline procinfov piCopy(procinfov pi)
151 {
152  pi->ref++;
153  return pi;
154 }
155 BOOLEAN piKill(procinfov l);
156 const char *piProcinfo(procinfov pi, const char *request);
157 void piShowProcinfo(procinfov pi, char *txt);
158 #ifdef HAVE_LIBPARSER
159 class libstack;
160 typedef libstack * libstackv;
161 
162 class libstack
163 {
164  public:
165  libstackv next;
166  char *libname;
168  int cnt;
169  void push(const char *p, char * libname);
170  libstackv pop(const char *p);
171  inline char *get() { return(libname); }
172 };
173 #endif /* HAVE_LIBPARSER */
174 
175 extern omBin sSubexpr_bin;
176 extern omBin procinfo_bin;
177 extern omBin libstack_bin;
178 
179 void s_internalDelete(const int t, void *d, const ring r);
180 
181 #endif
proc_singular s
Definition: subexpr.h:48
int cnt
Definition: subexpr.h:168
sleftv * leftv
Definition: subexpr.h:80
ip_package * package
Definition: structs.h:46
static number Copy(number a, const coeffs r)
Definition: flintcf_Q.cc:230
sleftv sLastPrinted
Definition: subexpr.cc:55
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
int proc_lineno
Definition: subexpr.h:33
omBin_t * omBin
Definition: omStructs.h:12
#define Print
Definition: emacs.cc:83
omBin procinfo_bin
Definition: subexpr.cc:51
char * libname
Definition: subexpr.h:166
Definition: attrib.h:15
Subexpr e
Definition: subexpr.h:107
BITSET flag
Definition: subexpr.h:92
procinfo * procinfov
Definition: subexpr.h:66
libstackv next
Definition: subexpr.h:165
omBin sSubexpr_bin
Definition: subexpr.cc:49
#define FALSE
Definition: auxiliary.h:97
return P p
Definition: myNF.cc:203
long example_start
Definition: subexpr.h:31
void piShowProcinfo(procinfov pi, char *txt)
int body_lineno
Definition: subexpr.h:34
language_defs language
Definition: subexpr.h:59
const char * iiSleftv2name(leftv v)
Definition: subexpr.cc:1936
BOOLEAN to_be_done
Definition: subexpr.h:167
BOOLEAN RingDependend(int t)
Definition: subexpr.h:144
void s_internalDelete(const int t, void *d, const ring r)
Definition: subexpr.cc:482
void Init()
Definition: subexpr.h:109
void * CopyD()
Definition: subexpr.h:121
short ref
Definition: subexpr.h:60
const char sNoName[]
Definition: subexpr.cc:56
procinfov piCopy(procinfov pi)
Definition: subexpr.h:150
#define BITSET
Definition: structs.h:18
struct _ssubexpr * next
Definition: subexpr.h:70
const char * Name()
Definition: subexpr.h:122
const char * Fullname()
Definition: subexpr.h:127
void * data
Definition: subexpr.h:90
char * procname
Definition: subexpr.h:57
poly res
Definition: myNF.cc:322
Definition: subexpr.h:21
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long help_start
Definition: subexpr.h:27
const ring r
Definition: syzextra.cc:208
long def_end
Definition: subexpr.h:26
void syMake(leftv v, const char *name, package pa=NULL)
Definition: subexpr.cc:1484
char * libname
Definition: subexpr.h:56
leftv Next()
Definition: subexpr.h:138
const char * name
Definition: subexpr.h:89
BOOLEAN siq
Definition: subexpr.cc:58
long proc_end
Definition: subexpr.h:32
procinfodata data
Definition: subexpr.h:63
BOOLEAN assumeStdFlag(leftv h)
Definition: subexpr.cc:1458
long help_end
Definition: subexpr.h:28
omBin libstack_bin
Definition: subexpr.cc:52
int dim(ideal I, ring r)
long help_chksum
Definition: subexpr.h:37
char name(const Variable &v)
Definition: factory.h:178
leftv next
Definition: subexpr.h:88
char is_static
Definition: subexpr.h:61
language_defs
Definition: subexpr.h:21
const char * piProcinfo(procinfov pi, const char *request)
Definition: ipid.cc:623
#define pi
Definition: libparse.cc:1143
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
int example_lineno
Definition: subexpr.h:35
#define NULL
Definition: omList.c:10
long proc_start
Definition: subexpr.h:25
int start
Definition: subexpr.h:71
int rtyp
Definition: subexpr.h:93
libstack * libstackv
Definition: subexpr.h:159
BOOLEAN piKill(procinfov l)
Definition: ipid.cc:647
attr attribute
Definition: subexpr.h:91
long body_start
Definition: subexpr.h:29
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:88
char trace_flag
Definition: subexpr.h:62
char * body
Definition: subexpr.h:36
int l
Definition: cfEzgcd.cc:94
ListNode * next
Definition: janet.h:31
long body_end
Definition: subexpr.h:30