source: git/Singular/subexpr.h @ d3e630

spielwiese
Last change on this file since d3e630 was d3e630, checked in by Hans Schönemann <hannes@…>, 15 years ago
*hannes: code cleanup (see ChangeLog) git-svn-id: file:///usr/local/Singular/svn/trunk@12029 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • 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: subexpr.h,v 1.37 2009-07-28 14:19:05 Singular Exp $ */
7/*
8* ABSTRACT: handling of leftv
9*/
10
11#include <string.h>
12#include "grammar.h"
13#include "tok.h"
14#include "structs.h"
15
16struct _ssubexpr
17{
18  struct _ssubexpr * next;
19  int start;
20};
21
22typedef struct _ssubexpr sSubexpr;
23typedef sSubexpr * Subexpr;
24
25extern const char sNoName[];
26extern BOOLEAN siq;
27extern const char *iiSleftv2name(leftv v);
28
29class sleftv;
30typedef sleftv * leftv;
31class sleftv
32{
33  public:
34  /* !! do not change the first 6 entries !! (see ipid.h: idrec) */
35    leftv       next;
36    const char *name;
37    void *      data;
38    attr        attribute;
39    BITSET      flag;
40    int         rtyp;
41                 /* the type of the expression, describes the data field
42                  * (E) markes the type field in iparith
43                  * (S) markes the rtyp in sleftv
44                  * ANY_TYPE:   data is int: real type or 0    (E)
45                  * DEF_CMD:    all types, no change in sleftv (E)
46                  * IDHDL: existing variable         (E)
47                  * IDHDL: variable, data is idhdl   (S)
48                  * COMMAND: data is command         (S)
49                  * INT_CMD:      int constant, data is int  (E,S)
50                  * INTVEC_CMD:   intvec constant, data is intvec * (E,S)
51                  * POLY_CMD:     poly constant, data is poly (E,S)
52                  * ....
53                  */
54    Subexpr e;    /* holds the indices for indexed values */
55    package     packhdl;
56    package     req_packhdl;
57    inline void Init() { memset(this,0,sizeof(*this)); }
58    void Set(int val);
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    void SetData(void* value);
80    leftv LData(); /* returns &(l[i]) for l[i], otherwise returns this */
81    leftv LHdl();
82    attr * Attribute();
83    inline leftv Next() { return next; }
84    int listLength();
85    int Eval(); /*replace a COMMAND by its result otherwise by CopyD*/
86    BOOLEAN RingDependend();
87};
88
89inline BOOLEAN RingDependend(int t) { return (BEGIN_RING<t)&&(t<END_RING); }
90extern sleftv sLastPrinted;
91
92struct _sssym
93{
94  idhdl   h;
95  Subexpr e;
96};
97typedef struct _sssym ssym;
98typedef ssym * sym;
99
100void syMake(leftv v,const char * name, idhdl packhdl = NULL);
101BOOLEAN assumeStdFlag(leftv h);
102
103inline procinfov piCopy(procinfov pi)
104{
105  pi->ref++;
106  return pi;
107}
108BOOLEAN piKill(procinfov l);
109const char *piProcinfo(procinfov pi, const char *request);
110void piShowProcinfo(procinfov pi, char *txt);
111#ifdef HAVE_LIBPARSER
112class libstack
113{
114 public:
115  libstackv next;
116  char      *libname;
117  BOOLEAN   to_be_done;
118  int       cnt;
119  void      push(char *p, char * libname);
120  libstackv pop(char *p);
121  inline char *get() { return(libname); }
122};
123#endif /* HAVE_LIBPARSER */
124
125#ifndef OM_ALLOC_H
126struct omBin_s;
127#endif
128
129extern omBin_s* sSubexpr_bin;
130extern omBin_s* procinfo_bin;
131extern omBin_s* libstack_bin;
132
133#endif
Note: See TracBrowser for help on using the repository browser.