source: git/Singular/subexpr.h @ 666c90

spielwiese
Last change on this file since 666c90 was 5dc702, checked in by Hans Schönemann <hannes@…>, 20 years ago
*hannes: moved defs git-svn-id: file:///usr/local/Singular/svn/trunk@6956 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 3.7 KB
Line 
1#ifndef SUBEXPR_H
2#define SUBEXPR_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: subexpr.h,v 1.34 2003-12-09 18:15:26 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 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    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#ifdef HAVE_NS
56    package     packhdl;
57    package     req_packhdl;
58#endif /* HAVE_NS */
59    inline void Init() { memset(this,0,sizeof(*this)); }
60    void Set(int val);
61    void Print(leftv store=NULL,int spaces=0);
62    void CleanUp(ring r=currRing);
63    char * String(void *d=NULL, BOOLEAN typed = FALSE, int dim = 1);
64    void Copy(leftv e);
65    attr CopyA();
66    void * CopyD(int t);
67    void * CopyD() { return CopyD(Typ()); }
68    inline const char * Name()
69    {
70      if ((name!=NULL) && (e==NULL)) return name;
71      else return sNoName;
72    }
73    inline const char * Fullname()
74    {
75      if ((name!=NULL) && (e==NULL)) return(iiSleftv2name(this));
76      else return sNoName;
77    }
78    int  Typ();
79    int  LTyp(); /* returns LIST_CMD for l[i], otherwise returns Typ() */
80    void * Data();
81    void SetData(void* value);
82    leftv LData(); /* returns &(l[i]) for l[i], otherwise returns this */
83    leftv LHdl();
84    attr * Attribute();
85    inline leftv Next() { return next; }
86    int listLength();
87    int Eval(); /*replace a COMMAND by its result otherwise by CopyD*/
88    BOOLEAN RingDependend();
89};
90
91inline BOOLEAN RingDependend(int t) { return (BEGIN_RING<t)&&(t<END_RING); }
92extern sleftv sLastPrinted;
93
94struct _sssym
95{
96  idhdl   h;
97  Subexpr e;
98};
99typedef struct _sssym ssym;
100typedef ssym * sym;
101
102void syMake(leftv v,char * name, idhdl packhdl = NULL);
103BOOLEAN assumeStdFlag(leftv h);
104
105inline procinfov piCopy(procinfov pi)
106{
107  pi->ref++;
108  return pi;
109}
110BOOLEAN piKill(procinfov l);
111char *piProcinfo(procinfov pi, char *request);
112void piShowProcinfo(procinfov pi, char *txt);
113#ifdef HAVE_LIBPARSER
114class libstack
115{
116 public:
117  libstackv next;
118  char      *libname;
119  BOOLEAN   to_be_done;
120  int       cnt;
121  void      push(char *p, char * libname);
122  libstackv pop(char *p);
123  inline char *get() { return(libname); }
124};
125#endif /* HAVE_LIBPARSER */
126
127typedef enum { LT_NONE, LT_NOTFOUND, LT_SINGULAR, LT_ELF, LT_HPUX} lib_types;
128lib_types type_of_LIB(char *newlib, char *fullname);
129
130#ifndef OM_ALLOC_H
131struct omBin_s;
132#endif
133
134extern omBin_s* sSubexpr_bin;
135extern omBin_s* procinfo_bin;
136extern omBin_s* libstack_bin;
137
138#endif
Note: See TracBrowser for help on using the repository browser.