source: git/Singular/subexpr.h @ 0fb34ba

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