source: git/Singular/subexpr.h @ 472f39

spielwiese
Last change on this file since 472f39 was 472f39, checked in by Hans Schönemann <hannes@…>, 25 years ago
* hannes: gmalloc.c: 64-bit cleanups (part 1) ipid.h, subexpr.h: aligment changes ipid.cc: new funktion: idrec::String (for idhdl) silink.cc: slReadAscii2 introduced, silink.cc: String-fixes for idhdl git-svn-id: file:///usr/local/Singular/svn/trunk@3235 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 4.7 KB
Line 
1#ifndef SUBEXPR_H
2#define SUBEXPR_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: subexpr.h,v 1.18 1999-07-06 13:35:34 Singular 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    attr        attribute;
37    BITSET      flag;
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#ifdef HAVE_NAMESPACES
54    idhdl       packhdl;
55    idhdl       req_packhdl;
56#define IDSROOT(a) (IDPACKAGE(((sleftv)a).packhdl)->idroot)
57#endif /* HAVE_NAMESPACES */
58    inline void Init() { memset(this,0,sizeof(*this)); }
59    void Set(int val);
60    void Print(leftv store=NULL,int spaces=0);
61    void CleanUp();
62    char * String(void *d=NULL, BOOLEAN typed = FALSE, int dim = 1);
63    void Copy(leftv e);
64    void * CopyD();
65    attr CopyA();
66    void * CopyD(int t);
67    inline const char * Name()
68    {
69      if ((name!=NULL) && (e==NULL)) return name;
70      else return sNoName;
71    }
72    inline const char * Fullname()
73    {
74      if ((name!=NULL) && (e==NULL)) return(iiSleftv2name(this));
75      else return sNoName;
76    }
77    int  Typ();
78    int  LTyp(); /* returns LIST_CMD for l[i], otherwise returns Typ() */
79    void * Data();
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};
87
88extern sleftv sLastPrinted;
89
90struct _sssym
91{
92  idhdl   h;
93  Subexpr e;
94};
95typedef struct _sssym ssym;
96typedef ssym * sym;
97
98void syMake(leftv v,char * name, idhdl packhdl = NULL);
99BOOLEAN assumeStdFlag(leftv h);
100
101class proc_singular
102{
103public:
104  long   proc_start;       // position where proc is starting
105  long   def_end;          // position where proc header is ending
106  long   help_start;       // position where help is starting
107  long   help_end;         // position where help is starting
108  long   body_start;       // position where proc-body is starting
109  long   body_end;         // position where proc-body is ending
110  long   example_start;    // position where example is starting
111  long   proc_end;         // position where proc is ending
112  int    proc_lineno;
113  int    body_lineno;
114  int    example_lineno;
115  char   *body;
116};
117
118struct proc_object
119{
120//public:
121  BOOLEAN (*function)(leftv res, leftv v);
122};
123
124union uprocinfodata;
125
126union uprocinfodata
127{
128public:
129  proc_singular  s;        // data of Singular-procedure
130  struct proc_object    o; // pointer to binary-function
131};
132
133typedef union uprocinfodata procinfodata;
134
135typedef enum { LANG_NONE, LANG_TOP, LANG_SINGULAR, LANG_C, LANG_MAX} language_defs;
136// LANG_TOP     : Toplevel package only
137// LANG_SINGULAR:
138// LANG_C       :
139class procinfo
140{
141public:
142  char          *libname;
143  char          *procname;
144  language_defs language;
145  short         ref;
146  char          is_static;        // if set, proc not accessible for user
147  char          trace_flag;
148  procinfodata  data;
149};
150
151inline procinfov piCopy(procinfov pi)
152{
153  pi->ref++;
154  return pi;
155}
156void piKill(procinfov l);
157char *piProcinfo(procinfov pi, char *request);
158void piShowProcinfo(procinfov pi, char *txt);
159#ifdef HAVE_LIBPARSER
160class libstack
161{
162 public:
163  libstackv next;
164  char      *libname;
165  BOOLEAN   to_be_done;
166  int       cnt;
167  void      push(char *p, char * libname);
168  libstackv pop(char *p);
169  inline char *get() { return(libname); }
170};
171#endif /* HAVE_LIBPARSER */
172
173typedef enum { LT_NONE, LT_SINGULAR, LT_ELF, LT_HPUX} lib_types;
174lib_types type_of_LIB(char *newlib, char *fullname);
175#endif
Note: See TracBrowser for help on using the repository browser.