source: git/Singular/subexpr.h @ c4bbf1f

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