source: git/Singular/subexpr.h @ 6d281ac

spielwiese
Last change on this file since 6d281ac was 6d281ac, checked in by Kai Krüger <krueger@…>, 26 years ago
grammar.y ipid.cc ipid.h iplib.cc lists.h ring.cc ring.h subexpr.cc subexpr.h tok.h * Added char *idhdl2id(idhdl pck, idhdl h) changed ggetid(const char *n, BOOLEAN local, idhdl *packhdl) Added parameter to rFindHdl() Changed rKill() for namespaces Added idhdl currRingHdl; to class namerec Added idhdl packhdl, req_packhdl to class slevftv Added inline const char * Fullname() to class slevftv Changed syMake(leftv v,char * id, idhdl packhdl) Added char *iiSleftv2name(leftv v) Added ALIAS_CMD to tok.h git-svn-id: file:///usr/local/Singular/svn/trunk@2481 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 4.4 KB
Line 
1#ifndef SUBEXPR_H
2#define SUBEXPR_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: subexpr.h,v 1.7 1998-08-25 13:33:23 krueger Exp $ */
7/*
8* ABSTRACT: handling of leftv
9*/
10
11#include <string.h>
12#include "structs.h"
13
14struct _ssubexpr
15{
16  struct _ssubexpr * next;
17  int start;
18};
19
20typedef struct _ssubexpr sSubexpr;
21typedef sSubexpr * Subexpr;
22
23extern const char sNoName[];
24extern BOOLEAN siq;
25extern char *iiSleftv2name(leftv v);
26
27class sleftv;
28typedef sleftv * leftv;
29class sleftv
30{
31  public:
32  /* !! do not change the first 6 entries !! (see ipid.h: idrec) */
33    leftv       next;
34    char *      name;
35    void *      data;
36    BITSET      flag;
37    attr        attribute;
38    int         rtyp;
39                 /* the type of the expression, describes the data field
40                  * (E) markes the type field in iparith
41                  * (S) markes the rtyp in sleftv
42                  * ANY_TYPE:   data is int: real type or 0    (E)
43                  * DEF_CMD:    all types, no change in sleftv (E)
44                  * IDHDL: existing variable         (E)
45                  * IDHDL: variable, data is idhdl   (S)
46                  * COMMAND: data is command         (S)
47                  * INT_CMD:      int constant, data is int  (E,S)
48                  * INTVEC_CMD:   intvec constant, data is intvec * (E,S)
49                  * POLY_CMD:     poly constant, data is poly (E,S)
50                  * ....
51                  */
52    Subexpr e;    /* holds the indices for indexed values */
53    idhdl       packhdl;
54    idhdl       req_packhdl;
55    inline void Init() { memset(this,0,sizeof(*this)); }
56    void Set(int val);
57    void Print(leftv store=NULL,int spaces=0);
58    void CleanUp();
59    char * String(void *d=NULL);
60    void Copy(leftv e);
61    void * CopyD();
62    attr CopyA();
63    void * CopyD(int t);
64    inline const char * Name()
65    {
66      if ((name!=NULL) && (e==NULL)) return name;
67      else return sNoName;
68    }
69    inline const char * Fullname()
70    {
71      if ((name!=NULL) && (e==NULL)) return(iiSleftv2name(this));
72      else return sNoName;
73    }
74    int  Typ();
75    int  LTyp(); /* returns LIST_CMD for l[i], otherwise returns Typ() */
76    void * Data();
77    leftv LData(); /* returns &(l[i]) for l[i], otherwise returns this */
78    leftv LHdl();
79    attr * Attribute();
80    inline leftv Next() { return next; }
81    int listLength();
82    int Eval(); /*replace a COMMAND by its result otherwise by CopyD*/
83};
84
85#define IDSROOT(a) (IDPACKAGE(((sleftv)a).packhdl)->idroot)
86
87extern sleftv sLastPrinted;
88
89struct _sssym
90{
91  idhdl   h;
92  Subexpr e;
93};
94typedef struct _sssym ssym;
95typedef ssym * sym;
96
97void syMake(leftv v,char * name, idhdl packhdl = NULL);
98BOOLEAN assumeStdFlag(leftv h);
99
100class proc_singular
101{
102public:
103  long   proc_start;       // position where proc is starting
104  long   def_end;          // position where proc header is ending
105  long   help_start;       // position where help is starting
106  long   help_end;         // position where help is starting
107  long   body_start;       // position where proc-body is starting
108  long   body_end;         // position where proc-body is ending
109  long   example_start;    // position where example is starting
110  long   proc_end;         // position where proc is ending
111  int    proc_lineno;
112  int    body_lineno;
113  int    example_lineno;
114  char   *body;
115};
116
117struct proc_object
118{
119//public:
120  BOOLEAN (*function)(leftv res, leftv v);
121};
122
123union uprocinfodata;
124
125union uprocinfodata
126{
127public:
128  proc_singular  s;        // data of Singular-procedure
129  struct proc_object    o; // pointer to binary-function
130};
131
132typedef union uprocinfodata procinfodata;
133
134typedef enum { LANG_NONE, LANG_SINGULAR, LANG_C } language_defs;
135
136class procinfo
137{
138public:
139  char          *libname;
140  char          *procname;
141  language_defs language;
142  short         ref;
143  char          is_static;        // if set, proc not accessible for user
144  procinfodata  data;
145};
146
147inline procinfov piCopy(procinfov pi)
148{
149  pi->ref++;
150  return pi;
151}
152void piKill(procinfov l);
153char *piProcinfo(procinfov pi, char *request);
154void piShowProcinfo(procinfov pi, char *txt);
155#ifdef HAVE_LIBPARSER
156class libstack
157{
158 public:
159  libstackv next;
160  char      *libname;
161  BOOLEAN   to_be_done;
162  int       cnt;
163  void      push(char *p, char * libname);
164  libstackv pop(char *p);
165  inline char *get() { return(libname); }
166};
167#endif /* HAVE_LIBPARSER */
168#endif
Note: See TracBrowser for help on using the repository browser.