source: git/Singular/subexpr.h @ 1085d4

spielwiese
Last change on this file since 1085d4 was 3ec6bba, checked in by Martin Lee <martinlee84@…>, 13 years ago
added lists.h to ipid.h added attrib.h to subexpr.h
  • Property mode set to 100644
File size: 3.5 KB
Line 
1#ifndef SUBEXPR_H
2#define SUBEXPR_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id$ */
7/*
8* ABSTRACT: handling of leftv
9*/
10
11#include <string.h>
12#include <Singular/grammar.h>
13#include <Singular/tok.h>
14//#include <kernel/structs.h>
15#include <Singular/attrib.h>
16#include <kernel/febase.h>
17#include <polys/monomials/ring.h>
18
19struct _ssubexpr
20{
21  struct _ssubexpr * next;
22  int start;
23};
24
25typedef struct _ssubexpr *Subexpr;
26
27extern const char sNoName[];
28extern BOOLEAN siq;
29extern const char *iiSleftv2name(leftv v);
30
31class sleftv;
32typedef sleftv * leftv;
33class sleftv
34{
35  public:
36  /* !! do not change the first 6 entries !! (see ipid.h: idrec) */
37    leftv       next;
38    const char *name;
39    void *      data;
40    attr        attribute;
41    BITSET      flag;
42    int         rtyp;
43                 /* the type of the expression, describes the data field
44                  * (E) markes the type field in iparith
45                  * (S) markes the rtyp in sleftv
46                  * ANY_TYPE:   data is int: real type or 0    (E)
47                  * DEF_CMD:    all types, no change in sleftv (E)
48                  * IDHDL: existing variable         (E)
49                  * IDHDL: variable, data is idhdl   (S)
50                  * COMMAND: data is command         (S)
51                  * INT_CMD:      int constant, data is int  (E,S)
52                  * INTVEC_CMD:   intvec constant, data is intvec * (E,S)
53                  * POLY_CMD:     poly constant, data is poly (E,S)
54                  * ....
55                  */
56    Subexpr e;    /* holds the indices for indexed values */
57    package     req_packhdl;
58    inline void Init() { memset(this,0,sizeof(*this)); }
59    void Print(leftv store=NULL,int spaces=0);
60    void CleanUp(ring r=currRing);
61    char * String(void *d=NULL, BOOLEAN typed = FALSE, int dim = 1);
62    void Copy(leftv e);
63    attr CopyA();
64    void * CopyD(int t);
65    void * CopyD() { return CopyD(Typ()); }
66    inline const char * Name()
67    {
68      if ((name!=NULL) && (e==NULL)) return name;
69      else return sNoName;
70    }
71    inline const char * Fullname()
72    {
73      if ((name!=NULL) && (e==NULL)) return(iiSleftv2name(this));
74      else return sNoName;
75    }
76    int  Typ();
77    int  LTyp(); /* returns LIST_CMD for l[i], otherwise returns Typ() */
78    void * Data();
79    leftv LData(); /* returns &(l[i]) for l[i], otherwise returns this */
80    leftv LHdl();
81    attr * Attribute();
82    inline leftv Next() { return next; }
83    int listLength();
84    int Eval(); /*replace a COMMAND by its result otherwise by CopyD*/
85    BOOLEAN RingDependend();
86};
87
88inline BOOLEAN RingDependend(int t) { return (BEGIN_RING<t)&&(t<END_RING); }
89extern sleftv sLastPrinted;
90
91void syMake(leftv v,const char * name, idhdl packhdl = NULL);
92BOOLEAN assumeStdFlag(leftv h);
93
94inline procinfov piCopy(procinfov pi)
95{
96  pi->ref++;
97  return pi;
98}
99BOOLEAN piKill(procinfov l);
100const char *piProcinfo(procinfov pi, const char *request);
101void piShowProcinfo(procinfov pi, char *txt);
102#ifdef HAVE_LIBPARSER
103class libstack;
104typedef libstack *  libstackv;
105
106class libstack
107{
108 public:
109  libstackv next;
110  char      *libname;
111  BOOLEAN   to_be_done;
112  int       cnt;
113  void      push(char *p, char * libname);
114  libstackv pop(char *p);
115  inline char *get() { return(libname); }
116};
117#endif /* HAVE_LIBPARSER */
118
119extern omBin sSubexpr_bin;
120extern omBin procinfo_bin;
121extern omBin libstack_bin;
122
123void s_internalDelete(const int t,  void *d, const ring r);
124
125#endif
Note: See TracBrowser for help on using the repository browser.