My Project  UNKNOWN_GIT_VERSION
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 #include "Singular/fevoices.h" /* for sNoName_fe*/
21 
24 {
25 public:
26  long proc_start; // position where proc is starting
27  long proc_end; // position where proc is ending
28  long def_end; // position where proc header is ending
29  long help_start; // position where help is starting
30  long help_end; // position where help is starting
31  long body_start; // position where proc-body is starting
32  long body_end; // position where proc-body is ending
33  long example_start; // position where example is starting
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 BOOLEAN siq;
77 
78 class sleftv;
79 typedef sleftv * leftv;
80 
81 /// Class used for (list of) interpreter objects
82 class sleftv
83 {
84  public:
85  /* !! do not change the first 6 entries !! (see ipid.h: idrec) */
87  const char *name;
88  void * data;
91  int rtyp;
92  /* the type of the expression, describes the data field
93  * (E) markes the type field in iparith
94  * (S) markes the rtyp in sleftv
95  * ANY_TYPE: data is int: real type or 0 (E)
96  * DEF_CMD: all types, no change in sleftv (E)
97  * IDHDL: existing variable (E)
98  * IDHDL: variable, data is idhdl (S)
99  * COMMAND: data is command (S)
100  * INT_CMD: int constant, data is int (E,S)
101  * INTVEC_CMD: intvec constant, data is intvec * (E,S)
102  * POLY_CMD: poly constant, data is poly (E,S)
103  * ....
104  */
105  Subexpr e; /* holds the indices for indexed values */
106  package req_packhdl;
107  inline void Init() { memset(this,0,sizeof(*this)); }
108  void CleanUp(ring r=currRing);
109 
110  /// Called by type_cmd (e.g. "r;") or as default in jPRINT
111  void Print(leftv store=NULL,int spaces=0);
112 
113  /// Called for conversion to string (used by string(..), write(..),..)
114  char * String(void *d=NULL, BOOLEAN typed = FALSE, int dim = 1);
115 
116  void Copy(leftv e);
117  attr CopyA();
118  void * CopyD(int t);
119  void * CopyD() { return CopyD(Typ()); }
120  inline const char * Name()
121  {
122  if ((name!=NULL) && (e==NULL)) return name;
123  else return sNoName_fe;
124  }
125  inline const char * Fullname()
126  {
127  if ((name!=NULL) && (e==NULL)) return(this->name);
128  else return sNoName_fe;
129  }
130  int Typ();
131  int LTyp(); /* returns LIST_CMD for l[i], otherwise returns Typ() */
132  void * Data();
133  leftv LData(); /* returns &(l[i]) for l[i], otherwise returns this */
134  //leftv LHdl();
135  attr * Attribute();
136  inline leftv Next() { return next; }
137  int listLength();
138  int Eval(); /*replace a COMMAND by its result otherwise by CopyD*/
140 };
141 
142 inline BOOLEAN RingDependend(int t) { return (BEGIN_RING<t)&&(t<END_RING); }
143 extern sleftv sLastPrinted;
144 
145 void syMake(leftv v,const char * name, package pa = NULL);
147 
149 {
150  pi->ref++;
151  return pi;
152 }
154 const char *piProcinfo(procinfov pi, const char *request);
155 void piShowProcinfo(procinfov pi, char *txt);
156 #ifdef HAVE_LIBPARSER
157 class libstack;
158 typedef libstack * libstackv;
159 
160 class libstack
161 {
162  public:
164  char *libname;
166  int cnt;
167  void push(const char *p, char * libname);
168  libstackv pop(const char *p);
169  inline char *get() { return(libname); }
170 };
171 #endif /* HAVE_LIBPARSER */
172 
173 extern omBin sSubexpr_bin;
174 extern omBin procinfo_bin;
175 extern omBin libstack_bin;
176 
177 void s_internalDelete(const int t, void *d, const ring r);
178 
179 #endif
dim
int dim(ideal I, ring r)
Definition: tropicalStrategy.cc:23
FALSE
#define FALSE
Definition: auxiliary.h:94
proc_singular::body
char * body
Definition: subexpr.h:36
piKill
BOOLEAN piKill(procinfov l)
Definition: ipid.cc:666
_ssubexpr
Definition: subexpr.h:69
libstack::cnt
int cnt
Definition: subexpr.h:166
libstack::to_be_done
BOOLEAN to_be_done
Definition: subexpr.h:165
procinfo::language
language_defs language
Definition: subexpr.h:59
procinfov
procinfo * procinfov
Definition: subexpr.h:66
procinfo::ref
short ref
Definition: subexpr.h:60
piShowProcinfo
void piShowProcinfo(procinfov pi, char *txt)
uprocinfodata
Definition: subexpr.h:46
procinfo::trace_flag
char trace_flag
Definition: subexpr.h:62
LANG_TOP
@ LANG_TOP
Definition: subexpr.h:22
LANG_SINGULAR
@ LANG_SINGULAR
Definition: subexpr.h:22
libstack::libname
char * libname
Definition: subexpr.h:164
attrib.h
piCopy
procinfov piCopy(procinfov pi)
Definition: subexpr.h:148
libstack
Definition: subexpr.h:161
LANG_MAX
@ LANG_MAX
Definition: subexpr.h:22
grammar.h
BITSET
#define BITSET
Definition: structs.h:18
proc_singular
Definition: subexpr.h:24
sLastPrinted
sleftv sLastPrinted
Definition: subexpr.cc:52
proc_singular::example_start
long example_start
Definition: subexpr.h:33
s_internalDelete
void s_internalDelete(const int t, void *d, const ring r)
Definition: subexpr.cc:520
libstack::get
char * get()
Definition: subexpr.h:169
procinfo
Definition: subexpr.h:54
sattr
Definition: attrib.h:21
sleftv::attribute
attr attribute
Definition: subexpr.h:89
_ssubexpr::next
struct _ssubexpr * next
Definition: subexpr.h:70
sleftv
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
syMake
void syMake(leftv v, const char *name, package pa=NULL)
Definition: subexpr.cc:1584
proc_singular::def_end
long def_end
Definition: subexpr.h:28
proc_singular::body_lineno
int body_lineno
Definition: subexpr.h:34
siq
BOOLEAN siq
Definition: subexpr.cc:54
sleftv::Fullname
const char * Fullname()
Definition: subexpr.h:125
next
ListNode * next
Definition: janet.h:31
pi
#define pi
Definition: libparse.cc:1143
currRing
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
BEGIN_RING
@ BEGIN_RING
Definition: grammar.cc:282
proc_singular::help_start
long help_start
Definition: subexpr.h:29
sleftv::flag
BITSET flag
Definition: subexpr.h:90
sleftv::name
const char * name
Definition: subexpr.h:87
RingDependend
BOOLEAN RingDependend(int t)
Definition: subexpr.h:142
procinfo::libname
char * libname
Definition: subexpr.h:56
res
CanonicalForm res
Definition: facAbsFact.cc:64
BOOLEAN
int BOOLEAN
Definition: auxiliary.h:85
libstack_bin
omBin libstack_bin
Definition: subexpr.cc:49
sNoName_fe
const char sNoName_fe[]
Definition: fevoices.cc:56
sleftv::Init
void Init()
Definition: subexpr.h:107
h
static Poly * h
Definition: janet.cc:972
mod2.h
sleftv::Next
leftv Next()
Definition: subexpr.h:136
sleftv::data
void * data
Definition: subexpr.h:88
procinfo::procname
char * procname
Definition: subexpr.h:57
LANG_C
@ LANG_C
Definition: subexpr.h:22
proc_singular::help_chksum
long help_chksum
Definition: subexpr.h:37
fevoices.h
proc_object
Definition: subexpr.h:40
END_RING
@ END_RING
Definition: grammar.cc:310
assumeStdFlag
BOOLEAN assumeStdFlag(leftv h)
Definition: subexpr.cc:1558
LANG_NONE
@ LANG_NONE
Definition: subexpr.h:22
sleftv::e
Subexpr e
Definition: subexpr.h:105
uprocinfodata::o
struct proc_object o
Definition: subexpr.h:49
proc_singular::proc_end
long proc_end
Definition: subexpr.h:27
ring.h
omBin
omBin_t * omBin
Definition: omStructs.h:12
procinfo::data
procinfodata data
Definition: subexpr.h:63
LANG_MIX
@ LANG_MIX
Definition: subexpr.h:22
proc_singular::help_end
long help_end
Definition: subexpr.h:30
Print
#define Print
Definition: emacs.cc:80
piProcinfo
const char * piProcinfo(procinfov pi, const char *request)
Definition: ipid.cc:642
proc_singular::example_lineno
int example_lineno
Definition: subexpr.h:35
language_defs
language_defs
Definition: subexpr.h:22
name
char name(const Variable &v)
Definition: factory.h:180
tok.h
sleftv::rtyp
int rtyp
Definition: subexpr.h:91
libstackv
libstack * libstackv
Definition: subexpr.h:157
NULL
#define NULL
Definition: omList.c:10
l
int l
Definition: cfEzgcd.cc:93
proc_singular::body_end
long body_end
Definition: subexpr.h:32
procinfo::is_static
char is_static
Definition: subexpr.h:61
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
p
int p
Definition: cfModGcd.cc:4019
sleftv::Name
const char * Name()
Definition: subexpr.h:120
uprocinfodata::s
proc_singular s
Definition: subexpr.h:48
leftv
sleftv * leftv
Definition: subexpr.h:78
procinfo_bin
omBin procinfo_bin
Definition: subexpr.cc:48
Copy
static number Copy(number a, const coeffs r)
Definition: flintcf_Q.cc:201
proc_singular::proc_start
long proc_start
Definition: subexpr.h:26
_ssubexpr::start
int start
Definition: subexpr.h:71
libstack::next
libstackv next
Definition: subexpr.h:163
package
ip_package * package
Definition: structs.h:46
sleftv::next
leftv next
Definition: subexpr.h:86
proc_singular::body_start
long body_start
Definition: subexpr.h:31
sleftv::CopyD
void * CopyD()
Definition: subexpr.h:119
sSubexpr_bin
omBin sSubexpr_bin
Definition: subexpr.cc:46