Loading...
Searching...
No Matches
subexpr.h
Go to the documentation of this file.
#ifndef SUBEXPR_H
#define SUBEXPR_H
/****************************************
* Computer Algebra System SINGULAR *
****************************************/
/*
* ABSTRACT: handling of leftv
*/
#include <string.h>
#include "polys/monomials/ring.h"
//#include "Singular/ipid.h"
#include "kernel/mod2.h"
#include "Singular/grammar.h"
#include "Singular/tok.h"
#include "Singular/attrib.h"
#include "Singular/fevoices.h" /* for sNoName_fe*/
typedef enum { LANG_NONE, LANG_TOP, LANG_SINGULAR, LANG_C, LANG_MIX, LANG_MAX} language_defs;
class proc_singular
{
public:
long proc_start; // position where proc is starting
long proc_end; // position where proc is ending
long def_end; // position where proc header is ending
long help_start; // position where help is starting
long help_end; // position where help is starting
long body_start; // position where proc-body is starting
long body_end; // position where proc-body is ending
long example_start; // position where example is starting
int body_lineno;
int example_lineno;
char *body;
long help_chksum;
};
struct proc_object
{
//public:
BOOLEAN (*function)(leftv res, leftv v);
};
union uprocinfodata
{
public:
proc_singular s; // data of Singular-procedure
struct proc_object o; // pointer to binary-function
};
typedef union uprocinfodata procinfodata;
class procinfo
{
public:
char *libname;
char *procname;
package pack;
language_defs language;
short ref;
char is_static; // if set, proc not accessible for user
char trace_flag;
procinfodata data;
};
typedef procinfo * procinfov;
struct _ssubexpr
{
struct _ssubexpr * next;
int start;
};
typedef struct _ssubexpr *Subexpr;
EXTERN_VAR BOOLEAN siq;
class sleftv;
typedef sleftv * leftv;
/// Class used for (list of) interpreter objects
class sleftv
{
public:
/* !! do not change the first 6 entries !! (see ipid.h: idrec) */
leftv next;
const char *name;
void * data;
attr attribute;
BITSET flag;
int rtyp;
/* the type of the expression, describes the data field
* (E) marks the type field in iparith
* (S) marks the rtyp in sleftv
* ANY_TYPE: data is int: real type or 0 (E)
* DEF_CMD: all types, no change in sleftv (E)
* IDHDL: existing variable (E)
* IDHDL: variable, data is idhdl (S)
* COMMAND: data is command (S)
* INT_CMD: int constant, data is int (E,S)
* INTVEC_CMD: intvec constant, data is intvec * (E,S)
* POLY_CMD: poly constant, data is poly (E,S)
* ....
*/
Subexpr e; /* holds the indices for indexed values */
package req_packhdl;
inline void Init() { memset(this,0,sizeof(*this)); }
void CleanUp(ring r=currRing);
/// Called by type_cmd (e.g. "r;") or as default in jPRINT
void Print(leftv store=NULL,int spaces=0);
/// Called for conversion to string (used by string(..), write(..),..)
char * String(void *d=NULL, BOOLEAN typed = FALSE, int dim = 1);
void Copy(leftv e);
attr CopyA();
void * CopyD(int t);
void * CopyD() { return CopyD(Typ()); }
inline const char * Name()
{
if ((name!=NULL) && (e==NULL)) return name;
else return sNoName_fe;
}
inline const char * Fullname()
{
if ((name!=NULL) && (e==NULL)) return(this->name);
else return sNoName_fe;
}
int Typ();
int LTyp(); /* returns LIST_CMD for l[i], otherwise returns Typ() */
void * Data();
leftv LData(); /* returns &(l[i]) for l[i], otherwise returns this */
//leftv LHdl();
attr * Attribute();
inline leftv Next() { return next; }
int listLength();
int Eval(); /*replace a COMMAND by its result otherwise by CopyD*/
BOOLEAN RingDependend();
};
inline BOOLEAN RingDependend(int t) { return (BEGIN_RING<t)&&(t<END_RING); }
EXTERN_INST_VAR sleftv sLastPrinted;
void syMake(leftv v,const char * name, package pa = NULL);
void syMakeMonom(leftv v,const char * name);
BOOLEAN assumeStdFlag(leftv h);
inline procinfov piCopy(procinfov pi)
{
pi->ref++;
return pi;
}
BOOLEAN piKill(procinfov l);
const char *piProcinfo(procinfov pi, const char *request);
void piShowProcinfo(procinfov pi, char *txt);
#ifdef HAVE_LIBPARSER
class libstack;
typedef libstack * libstackv;
class libstack
{
public:
libstackv next;
char *libname;
BOOLEAN to_be_done;
int cnt;
void push(const char *p, char * libname);
libstackv pop(const char *p);
inline char *get() { return(libname); }
};
#endif /* HAVE_LIBPARSER */
EXTERN_VAR omBin sSubexpr_bin;
EXTERN_VAR omBin procinfo_bin;
EXTERN_VAR omBin libstack_bin;
void s_internalDelete(const int t, void *d, const ring r);
#endif
attrib.h
attr
sattr * attr
Definition attrib.h:16
BITSET
#define BITSET
Definition auxiliary.h:85
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
FALSE
#define FALSE
Definition auxiliary.h:97
l
int l
Definition cfEzgcd.cc:100
p
int p
Definition cfModGcd.cc:4086
libstack
Definition subexpr.h:162
libstack::push
void push(const char *p, char *libname)
Definition iplib.cc:1510
libstack::get
char * get()
Definition subexpr.h:170
libstack::next
libstackv next
Definition subexpr.h:164
libstack::pop
libstackv pop(const char *p)
Definition iplib.cc:1531
libstack::cnt
int cnt
Definition subexpr.h:167
libstack::libname
char * libname
Definition subexpr.h:165
libstack::to_be_done
BOOLEAN to_be_done
Definition subexpr.h:166
sleftv
Class used for (list of) interpreter objects.
Definition subexpr.h:83
sleftv::Typ
int Typ()
Definition subexpr.cc:1048
sleftv::name
const char * name
Definition subexpr.h:87
sleftv::rtyp
int rtyp
Definition subexpr.h:91
sleftv::Init
void Init()
Definition subexpr.h:107
sleftv::next
leftv next
Definition subexpr.h:86
sleftv::CopyD
void * CopyD()
Definition subexpr.h:119
sleftv::Name
const char * Name()
Definition subexpr.h:120
sleftv::data
void * data
Definition subexpr.h:88
sleftv::Next
leftv Next()
Definition subexpr.h:136
sleftv::flag
BITSET flag
Definition subexpr.h:90
sleftv::Fullname
const char * Fullname()
Definition subexpr.h:125
sleftv::e
Subexpr e
Definition subexpr.h:105
sleftv::attribute
attr attribute
Definition subexpr.h:89
pa
static BOOLEAN pa(leftv res, leftv args)
Definition cohomo.cc:3770
Print
#define Print
Definition emacs.cc:80
res
CanonicalForm res
Definition facAbsFact.cc:60
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
name
char name(const Variable &v)
Definition factory.h:189
sNoName_fe
const char sNoName_fe[]
Definition fevoices.cc:57
fevoices.h
Copy
static number Copy(number a, const coeffs)
Definition flintcf_Q.cc:215
RingDependend
static int RingDependend(int t)
Definition gentable.cc:23
EXTERN_INST_VAR
#define EXTERN_INST_VAR
Definition globaldefs.h:9
EXTERN_VAR
#define EXTERN_VAR
Definition globaldefs.h:6
END_RING
@ END_RING
Definition grammar.cc:311
BEGIN_RING
@ BEGIN_RING
Definition grammar.cc:283
grammar.h
piKill
BOOLEAN piKill(procinfov pi)
Definition ipid.cc:747
piProcinfo
const char * piProcinfo(procinfov pi, const char *request)
Definition ipid.cc:723
h
STATIC_VAR Poly * h
Definition janet.cc:971
pi
#define pi
Definition libparse.cc:1145
mod2.h
NULL
#define NULL
Definition omList.c:12
omBin
omBin_t * omBin
Definition omStructs.h:12
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
ring.h
package
ip_package * package
Definition structs.h:39
leftv
sleftv * leftv
Definition structs.h:53
procinfov
procinfo * procinfov
Definition structs.h:56
sSubexpr_bin
VAR omBin sSubexpr_bin
Definition subexpr.cc:40
procinfo_bin
VAR omBin procinfo_bin
Definition subexpr.cc:42
syMake
void syMake(leftv v, const char *id, package pa)
Definition subexpr.cc:1613
libstack_bin
VAR omBin libstack_bin
Definition subexpr.cc:43
s_internalDelete
void s_internalDelete(const int t, void *d, const ring r)
Definition subexpr.cc:518
sLastPrinted
INST_VAR sleftv sLastPrinted
Definition subexpr.cc:46
siq
VAR BOOLEAN siq
Definition subexpr.cc:48
assumeStdFlag
BOOLEAN assumeStdFlag(leftv h)
Definition subexpr.cc:1587
syMakeMonom
void syMakeMonom(leftv v, const char *id)
Definition subexpr.cc:1917
procinfo::libname
char * libname
Definition subexpr.h:56
procinfo::language
language_defs language
Definition subexpr.h:59
_ssubexpr::start
int start
Definition subexpr.h:71
piCopy
procinfov piCopy(procinfov pi)
Definition subexpr.h:149
proc_singular::body
char * body
Definition subexpr.h:36
proc_singular::help_start
long help_start
Definition subexpr.h:29
proc_singular::example_lineno
int example_lineno
Definition subexpr.h:35
procinfo::data
procinfodata data
Definition subexpr.h:63
procinfo::procname
char * procname
Definition subexpr.h:57
proc_singular::def_end
long def_end
Definition subexpr.h:28
leftv
sleftv * leftv
Definition subexpr.h:79
proc_singular::help_end
long help_end
Definition subexpr.h:30
proc_singular::proc_end
long proc_end
Definition subexpr.h:27
proc_singular::example_start
long example_start
Definition subexpr.h:33
procinfo::trace_flag
char trace_flag
Definition subexpr.h:62
_ssubexpr::next
struct _ssubexpr * next
Definition subexpr.h:70
proc_singular::help_chksum
long help_chksum
Definition subexpr.h:37
piShowProcinfo
void piShowProcinfo(procinfov pi, char *txt)
uprocinfodata::s
proc_singular s
Definition subexpr.h:48
procinfo::is_static
char is_static
Definition subexpr.h:61
proc_singular::proc_start
long proc_start
Definition subexpr.h:26
language_defs
language_defs
Definition subexpr.h:22
LANG_MAX
@ LANG_MAX
Definition subexpr.h:22
LANG_SINGULAR
@ LANG_SINGULAR
Definition subexpr.h:22
LANG_NONE
@ LANG_NONE
Definition subexpr.h:22
LANG_MIX
@ LANG_MIX
Definition subexpr.h:22
LANG_C
@ LANG_C
Definition subexpr.h:22
LANG_TOP
@ LANG_TOP
Definition subexpr.h:22
proc_singular::body_start
long body_start
Definition subexpr.h:31
procinfo::ref
short ref
Definition subexpr.h:60
uprocinfodata::o
struct proc_object o
Definition subexpr.h:49
proc_singular::body_end
long body_end
Definition subexpr.h:32
proc_singular::body_lineno
int body_lineno
Definition subexpr.h:34
libstackv
libstack * libstackv
Definition subexpr.h:159
proc_object::function
BOOLEAN(* function)(leftv res, leftv v)
Definition subexpr.h:42
proc_singular
Definition subexpr.h:24
procinfo
Definition subexpr.h:54
_ssubexpr
Definition subexpr.h:69
proc_object
Definition subexpr.h:40
uprocinfodata
Definition subexpr.h:46
tok.h
dim
int dim(ideal I, ring r)
Definition tropicalStrategy.cc:23