source: git/Singular/subexpr.h @ 7cdf528

spielwiese
Last change on this file since 7cdf528 was 6be769, checked in by Kai Krüger <krueger@…>, 26 years ago
Changes for help-section of procedures git-svn-id: file:///usr/local/Singular/svn/trunk@1672 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 4.1 KB
Line 
1#ifndef SUBEXPR_H
2#define SUBEXPR_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: subexpr.h,v 1.6 1998-05-09 14:34:32 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   help_end;         // position where help is starting
97  long   body_start;       // position where proc-body is starting
98  long   body_end;         // position where proc-body is ending
99  long   example_start;    // position where example is starting
100  long   proc_end;         // position where proc is ending
101  int    proc_lineno;
102  int    body_lineno;
103  int    example_lineno;
104  char   *body;
105};
106
107struct proc_object
108{
109//public:
110  BOOLEAN (*function)(leftv res, leftv v);
111};
112
113union uprocinfodata;
114
115union uprocinfodata
116{
117public:
118  proc_singular  s;        // data of Singular-procedure
119  struct proc_object    o; // pointer to binary-function
120};
121
122typedef union uprocinfodata procinfodata;
123
124typedef enum { LANG_NONE, LANG_SINGULAR, LANG_C } language_defs;
125
126class procinfo
127{
128public:
129  char          *libname;
130  char          *procname;
131  language_defs language;
132  short         ref;
133  char          is_static;        // if set, proc not accessible for user
134  procinfodata  data;
135};
136
137inline procinfov piCopy(procinfov pi)
138{
139  pi->ref++;
140  return pi;
141}
142void piKill(procinfov l);
143char *piProcinfo(procinfov pi, char *request);
144void piShowProcinfo(procinfov pi, char *txt);
145#ifdef HAVE_LIBPARSER
146class libstack
147{
148 public:
149  libstackv next;
150  char      *libname;
151  BOOLEAN   to_be_done;
152  int       cnt;
153  void      push(char *p, char * libname);
154  libstackv pop(char *p);
155  inline char *get() { return(libname); }
156};
157#endif /* HAVE_LIBPARSER */
158#endif
Note: See TracBrowser for help on using the repository browser.