source: git/Singular/subexpr.h @ 06c0b3

spielwiese
Last change on this file since 06c0b3 was fb85f97, checked in by Oleksandr Motsak <motsak@…>, 13 years ago
FIX: rings are printed with details only via "print(r); " not via "r; " CHG: minor cleanup
  • 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$ */
7/*
8* ABSTRACT: handling of leftv
9*/
10
11#include <string.h>
12
13#include <polys/monomials/ring.h>
14
15#include <kernel/febase.h>
16//#include <kernel/structs.h>
17
18#include <Singular/grammar.h>
19#include <Singular/tok.h>
20#include <Singular/attrib.h>
21
22struct _ssubexpr
23{
24  struct _ssubexpr * next;
25  int start;
26};
27
28typedef struct _ssubexpr *Subexpr;
29
30extern const char sNoName[];
31extern BOOLEAN siq;
32extern const char *iiSleftv2name(leftv v);
33
34class sleftv;
35typedef sleftv * leftv;
36
37/// Class used for (list of) interpreter objects
38class sleftv
39{
40  public:
41  /* !! do not change the first 6 entries !! (see ipid.h: idrec) */
42    leftv       next;
43    const char *name;
44    void *      data;
45    attr        attribute;
46    BITSET      flag;
47    int         rtyp;
48                 /* the type of the expression, describes the data field
49                  * (E) markes the type field in iparith
50                  * (S) markes the rtyp in sleftv
51                  * ANY_TYPE:   data is int: real type or 0    (E)
52                  * DEF_CMD:    all types, no change in sleftv (E)
53                  * IDHDL: existing variable         (E)
54                  * IDHDL: variable, data is idhdl   (S)
55                  * COMMAND: data is command         (S)
56                  * INT_CMD:      int constant, data is int  (E,S)
57                  * INTVEC_CMD:   intvec constant, data is intvec * (E,S)
58                  * POLY_CMD:     poly constant, data is poly (E,S)
59                  * ....
60                  */
61    Subexpr e;    /* holds the indices for indexed values */
62    package     req_packhdl;
63    inline void Init() { memset(this,0,sizeof(*this)); }
64    void CleanUp(ring r=currRing);
65   
66    /// Called by type_cmd (e.g. "r;") or as default in jPRINT
67    void Print(leftv store=NULL,int spaces=0);
68   
69    /// Called for conversion to string (used by string(..), write(..),..)
70    char * String(void *d=NULL, BOOLEAN typed = FALSE, int dim = 1);
71   
72    void Copy(leftv e);
73    attr CopyA();
74    void * CopyD(int t);
75    void * CopyD() { return CopyD(Typ()); }
76    inline const char * Name()
77    {
78      if ((name!=NULL) && (e==NULL)) return name;
79      else return sNoName;
80    }
81    inline const char * Fullname()
82    {
83      if ((name!=NULL) && (e==NULL)) return(iiSleftv2name(this));
84      else return sNoName;
85    }
86    int  Typ();
87    int  LTyp(); /* returns LIST_CMD for l[i], otherwise returns Typ() */
88    void * Data();
89    leftv LData(); /* returns &(l[i]) for l[i], otherwise returns this */
90    leftv LHdl();
91    attr * Attribute();
92    inline leftv Next() { return next; }
93    int listLength();
94    int Eval(); /*replace a COMMAND by its result otherwise by CopyD*/
95    BOOLEAN RingDependend();
96};
97
98inline BOOLEAN RingDependend(int t) { return (BEGIN_RING<t)&&(t<END_RING); }
99extern sleftv sLastPrinted;
100
101void syMake(leftv v,const char * name, idhdl packhdl = NULL);
102BOOLEAN assumeStdFlag(leftv h);
103
104inline procinfov piCopy(procinfov pi)
105{
106  pi->ref++;
107  return pi;
108}
109BOOLEAN piKill(procinfov l);
110const char *piProcinfo(procinfov pi, const char *request);
111void piShowProcinfo(procinfov pi, char *txt);
112#ifdef HAVE_LIBPARSER
113class libstack;
114typedef libstack *  libstackv;
115
116class libstack
117{
118 public:
119  libstackv next;
120  char      *libname;
121  BOOLEAN   to_be_done;
122  int       cnt;
123  void      push(char *p, char * libname);
124  libstackv pop(char *p);
125  inline char *get() { return(libname); }
126};
127#endif /* HAVE_LIBPARSER */
128
129extern omBin sSubexpr_bin;
130extern omBin procinfo_bin;
131extern omBin libstack_bin;
132
133void s_internalDelete(const int t,  void *d, const ring r);
134
135#endif
Note: See TracBrowser for help on using the repository browser.