source: git/Singular/subexpr.h @ fb85f97

fieker-DuValspielwiese
Last change on this file since fb85f97 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
RevLine 
[0e1846]1#ifndef SUBEXPR_H
2#define SUBEXPR_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
[341696]6/* $Id$ */
[0e1846]7/*
[6ae4f5]8* ABSTRACT: handling of leftv
[0e1846]9*/
[f6b5f0]10
[0e1846]11#include <string.h>
[fb85f97]12
13#include <polys/monomials/ring.h>
14
15#include <kernel/febase.h>
16//#include <kernel/structs.h>
17
[599326]18#include <Singular/grammar.h>
19#include <Singular/tok.h>
[3ec6bba]20#include <Singular/attrib.h>
[0e1846]21
22struct _ssubexpr
23{
24  struct _ssubexpr * next;
25  int start;
26};
27
[0e051f]28typedef struct _ssubexpr *Subexpr;
[0e1846]29
30extern const char sNoName[];
31extern BOOLEAN siq;
[85e68dd]32extern const char *iiSleftv2name(leftv v);
[0e1846]33
34class sleftv;
35typedef sleftv * leftv;
[fb85f97]36
37/// Class used for (list of) interpreter objects
[0e1846]38class sleftv
39{
40  public:
41  /* !! do not change the first 6 entries !! (see ipid.h: idrec) */
42    leftv       next;
[85e68dd]43    const char *name;
[0e1846]44    void *      data;
45    attr        attribute;
[472f39]46    BITSET      flag;
[0e1846]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 */
[bd4cb92]62    package     req_packhdl;
[0e1846]63    inline void Init() { memset(this,0,sizeof(*this)); }
[16acb0]64    void CleanUp(ring r=currRing);
[fb85f97]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(..),..)
[a79a128]70    char * String(void *d=NULL, BOOLEAN typed = FALSE, int dim = 1);
[fb85f97]71   
[0e1846]72    void Copy(leftv e);
[f879c9]73    attr CopyA();
[0e1846]74    void * CopyD(int t);
[2166ad3]75    void * CopyD() { return CopyD(Typ()); }
[0e1846]76    inline const char * Name()
77    {
78      if ((name!=NULL) && (e==NULL)) return name;
79      else return sNoName;
80    }
[c12cf96]81    inline const char * Fullname()
82    {
83      if ((name!=NULL) && (e==NULL)) return(iiSleftv2name(this));
84      else return sNoName;
85    }
[0e1846]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*/
[4cbe5d]95    BOOLEAN RingDependend();
[0e1846]96};
97
[df5fc1]98inline BOOLEAN RingDependend(int t) { return (BEGIN_RING<t)&&(t<END_RING); }
[0e1846]99extern sleftv sLastPrinted;
100
[85e68dd]101void syMake(leftv v,const char * name, idhdl packhdl = NULL);
[0e1846]102BOOLEAN assumeStdFlag(leftv h);
103
[2ba9a6]104inline procinfov piCopy(procinfov pi)
105{
106  pi->ref++;
107  return pi;
108}
[b2a49b]109BOOLEAN piKill(procinfov l);
[85e68dd]110const char *piProcinfo(procinfov pi, const char *request);
[2ba9a6]111void piShowProcinfo(procinfov pi, char *txt);
[6a51ef]112#ifdef HAVE_LIBPARSER
[a48753]113class libstack;
114typedef libstack *  libstackv;
115
[6a51ef]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 */
[cd6b45]128
[020ef9]129extern omBin sSubexpr_bin;
130extern omBin procinfo_bin;
131extern omBin libstack_bin;
[c232af]132
[c4dab4]133void s_internalDelete(const int t,  void *d, const ring r);
134
[0e1846]135#endif
Note: See TracBrowser for help on using the repository browser.