source: git/Singular/subexpr.h @ 08a955

fieker-DuValspielwiese
Last change on this file since 08a955 was 6ce030f, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
removal of the $Id$ svn tag from everywhere NOTE: the git SHA1 may be used instead (only on special places) NOTE: the libraries Singular/LIB/*.lib still contain the marker due to our current use of svn
  • Property mode set to 100644
File size: 3.6 KB
RevLine 
[0e1846]1#ifndef SUBEXPR_H
2#define SUBEXPR_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/*
[6ae4f5]7* ABSTRACT: handling of leftv
[0e1846]8*/
[f6b5f0]9
[0e1846]10#include <string.h>
[fb85f97]11
12#include <polys/monomials/ring.h>
13
14#include <kernel/febase.h>
15//#include <kernel/structs.h>
16
[599326]17#include <Singular/grammar.h>
18#include <Singular/tok.h>
[3ec6bba]19#include <Singular/attrib.h>
[0e1846]20
21struct _ssubexpr
22{
23  struct _ssubexpr * next;
24  int start;
25};
26
[0e051f]27typedef struct _ssubexpr *Subexpr;
[0e1846]28
29extern const char sNoName[];
30extern BOOLEAN siq;
[85e68dd]31extern const char *iiSleftv2name(leftv v);
[0e1846]32
33class sleftv;
34typedef sleftv * leftv;
[fb85f97]35
36/// Class used for (list of) interpreter objects
[0e1846]37class sleftv
38{
39  public:
40  /* !! do not change the first 6 entries !! (see ipid.h: idrec) */
41    leftv       next;
[85e68dd]42    const char *name;
[0e1846]43    void *      data;
44    attr        attribute;
[472f39]45    BITSET      flag;
[0e1846]46    int         rtyp;
47                 /* the type of the expression, describes the data field
48                  * (E) markes the type field in iparith
49                  * (S) markes the rtyp in sleftv
50                  * ANY_TYPE:   data is int: real type or 0    (E)
51                  * DEF_CMD:    all types, no change in sleftv (E)
52                  * IDHDL: existing variable         (E)
53                  * IDHDL: variable, data is idhdl   (S)
54                  * COMMAND: data is command         (S)
55                  * INT_CMD:      int constant, data is int  (E,S)
56                  * INTVEC_CMD:   intvec constant, data is intvec * (E,S)
57                  * POLY_CMD:     poly constant, data is poly (E,S)
58                  * ....
59                  */
60    Subexpr e;    /* holds the indices for indexed values */
[bd4cb92]61    package     req_packhdl;
[0e1846]62    inline void Init() { memset(this,0,sizeof(*this)); }
[16acb0]63    void CleanUp(ring r=currRing);
[fb85f97]64   
65    /// Called by type_cmd (e.g. "r;") or as default in jPRINT
66    void Print(leftv store=NULL,int spaces=0);
67   
68    /// Called for conversion to string (used by string(..), write(..),..)
[a79a128]69    char * String(void *d=NULL, BOOLEAN typed = FALSE, int dim = 1);
[fb85f97]70   
[0e1846]71    void Copy(leftv e);
[f879c9]72    attr CopyA();
[0e1846]73    void * CopyD(int t);
[2166ad3]74    void * CopyD() { return CopyD(Typ()); }
[0e1846]75    inline const char * Name()
76    {
77      if ((name!=NULL) && (e==NULL)) return name;
78      else return sNoName;
79    }
[c12cf96]80    inline const char * Fullname()
81    {
82      if ((name!=NULL) && (e==NULL)) return(iiSleftv2name(this));
83      else return sNoName;
84    }
[0e1846]85    int  Typ();
86    int  LTyp(); /* returns LIST_CMD for l[i], otherwise returns Typ() */
87    void * Data();
88    leftv LData(); /* returns &(l[i]) for l[i], otherwise returns this */
89    leftv LHdl();
90    attr * Attribute();
91    inline leftv Next() { return next; }
92    int listLength();
93    int Eval(); /*replace a COMMAND by its result otherwise by CopyD*/
[4cbe5d]94    BOOLEAN RingDependend();
[0e1846]95};
96
[df5fc1]97inline BOOLEAN RingDependend(int t) { return (BEGIN_RING<t)&&(t<END_RING); }
[0e1846]98extern sleftv sLastPrinted;
99
[85e68dd]100void syMake(leftv v,const char * name, idhdl packhdl = NULL);
[0e1846]101BOOLEAN assumeStdFlag(leftv h);
102
[2ba9a6]103inline procinfov piCopy(procinfov pi)
104{
105  pi->ref++;
106  return pi;
107}
[b2a49b]108BOOLEAN piKill(procinfov l);
[85e68dd]109const char *piProcinfo(procinfov pi, const char *request);
[2ba9a6]110void piShowProcinfo(procinfov pi, char *txt);
[6a51ef]111#ifdef HAVE_LIBPARSER
[a48753]112class libstack;
113typedef libstack *  libstackv;
114
[6a51ef]115class libstack
116{
117 public:
118  libstackv next;
119  char      *libname;
120  BOOLEAN   to_be_done;
121  int       cnt;
122  void      push(char *p, char * libname);
123  libstackv pop(char *p);
124  inline char *get() { return(libname); }
125};
126#endif /* HAVE_LIBPARSER */
[cd6b45]127
[020ef9]128extern omBin sSubexpr_bin;
129extern omBin procinfo_bin;
130extern omBin libstack_bin;
[c232af]131
[c4dab4]132void s_internalDelete(const int t,  void *d, const ring r);
133
[0e1846]134#endif
Note: See TracBrowser for help on using the repository browser.