source: git/Singular/ipid.h @ e48debd

spielwiese
Last change on this file since e48debd was e48debd, checked in by Hans Schönemann <hannes@…>, 25 years ago
*hannes: no .h file should include mod2.h git-svn-id: file:///usr/local/Singular/svn/trunk@2766 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 5.0 KB
Line 
1#ifndef IPID_H
2#define IPID_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: ipid.h,v 1.24 1998-12-16 18:43:39 Singular Exp $ */
7/*
8* ABSTRACT: identfier handling
9*/
10#include <string.h>
11#include "structs.h"
12#include "subexpr.h"
13
14struct sip_sring
15{
16  idhdl      idroot; /* local objects */
17  int*       order;  /* array of orderings */
18  int*       block0; /* starting pos.*/
19  int*       block1; /* ending pos.*/
20  char**     parameter; /* names of parameters */
21  number     minpoly;
22  short**    wvhdl;  /* array of weight vectors */
23  char **    names;  /* array of variable names */
24  /* extension to the ring structure: qring */
25  ideal      qideal;
26#ifdef SDRING
27  short      partN;
28#endif
29  short      ch;     /* characteristic */
30  short      N;      /* number of vars */
31
32  short      P;      /* number of pars */
33  short      OrdSgn; /* 1 for polynomial rings, -1 otherwise */
34
35  short      ref;
36
37  // what follows below here should be set by rComplete, _only_
38  int       *VarOffset;   /* controls indexing of exponents */
39  short     VarCompIndex; /* location of component in exp vector */
40  short     VarLowIndex;  /* lowest index of an exponent */
41  short     VarHighIndex; /* Highest index of an expoentn */
42
43#ifdef RDEBUG
44  short      no; /* unique id for rings */
45#endif
46};
47
48struct sip_sideal
49{
50  poly*  m;
51  long rank;
52  int nrows;
53  int ncols;
54  #define IDELEMS(i) ((i)->ncols)
55  inline int& idelems(void) { return ncols; }
56};
57
58struct sip_smap
59{
60  poly *m;
61  char *preimage;
62  int nrows;
63  int ncols;
64};
65
66struct sip_command
67{
68  sleftv arg1; /*arg1 to build_in, proc to proc_call*/
69  sleftv arg2; /*NULL or arg2 to build_in, args to proc_call*/
70  sleftv arg3; /*NULL or arg3*/
71  short argc; /*0,1,2,3 to build_in, -1 otherwise*/
72  short op;   /* build_in or PROC_CMD*/
73};
74
75struct sip_package
76{
77  idhdl         idroot; /* local objects */
78  char          *libname;
79  short         ref;
80  language_defs language;
81  BOOLEAN       loaded;
82  void          *handle;
83};
84
85inline package paCopy(package pack)
86{
87  pack->ref++;
88  return pack;
89}
90
91union uutypes;
92
93union uutypes
94{
95  int           i;
96  ring          uring;
97  poly          p;
98  number        n;
99  ideal         uideal;
100  map           umap;
101  matrix        umatrix;
102  char *        ustring;
103  intvec *      iv;
104  lists         l;
105  si_link       li;
106  package       pack;
107  procinfo *    pinf;
108};
109
110class idrec
111{
112  public:
113  /* !! do not change the first 6 entries !! (see subexpr.h: sleftv) */
114  idhdl      next;
115  char *     id;
116  utypes     data;
117  BITSET     flag;
118  attr       attribute;
119  idtyp      typ;
120
121  short      lev;
122  short      ref;
123
124#define IDNEXT(a)    ((a)->next)
125#define IDTYP(a)     ((a)->typ)
126#define IDFLAG(a)    ((a)->flag)
127#define IDLEV(a)     ((a)->lev)
128#define IDID(a)      ((a)->id)
129#define IDATTR(a)    ((a)->attribute)
130
131#define IDINT(a)    ((a)->data.i)
132#define IDDATA(a)   ((a)->data.ustring)
133#define IDRING(a)   ((a)->data.uring)
134#define IDINTVEC(a) ((a)->data.iv)
135#define IDPOLY(a)   ((a)->data.p)
136#define IDNUMBER(a) ((a)->data.n)
137#define IDIDEAL(a)  (((a)->data).uideal)
138#define IDMATRIX(a) (((a)->data).umatrix)
139#define IDMAP(a)    (((a)->data).umap)
140#define IDSTRING(a) ((a)->data.ustring)
141#define IDLIST(a)   ((a)->data.l)
142#define IDLINK(a)   ((a)->data.li)
143#define IDPACKAGE(a) ((a)->data.pack)
144#define IDPROC(a)   ((a)->data.pinf)
145
146  idrec() { memset(this,0,sizeof(*this)); }
147  idhdl get(const char * s, int lev);
148  idhdl set(char * s, int lev, idtyp t, BOOLEAN init=TRUE);
149//  ~idrec();
150};
151
152class namerec {
153  public:
154  namehdl    next;
155  namehdl    root;
156  package    pack;
157  char *     name;
158  int        lev;
159  BOOLEAN    isroot;
160#define NSROOT(a) ((a)->pack->idroot)
161#define NSPACK(a) ((a)->pack)
162
163  int        myynest;
164  idhdl      currRingHdl;
165  ring       currRing;
166
167 namerec()  { memset(this,0,sizeof(*this)); }
168  //namehdl    Set(idhdl root);
169  namehdl    pop(BOOLEAN change_nesting=FALSE);
170  namehdl    push(package pack, char *name, int nesting=-1, BOOLEAN init=FALSE);
171  idhdl      get(const char * s, int lev, BOOLEAN root=FALSE);
172};
173
174extern namehdl namespaceroot;
175#ifdef HAVE_NAMESPACES
176#  define IDROOT (NSROOT(namespaceroot))
177#else /* HAVE_NAMESPACES */
178extern idhdl      idroot;
179#  define IDROOT idroot
180#endif /* HAVE_NAMESPACES */
181
182extern idhdl      currRingHdl;
183/*extern ring     currRing;  in structs.h */
184extern ideal      currQuotient;
185
186char *idhdl2id(idhdl pck, idhdl h);
187void  iiname2hdl(const char *name, idhdl *pck, idhdl *id);
188idhdl enterid(char * a, int lev, idtyp t, idhdl* root, BOOLEAN init=TRUE);
189idhdl ggetid(const char *n, BOOLEAN local = FALSE);
190idhdl ggetid(const char *n, BOOLEAN local, idhdl *packhdl);
191void  killid(char * a, idhdl * i);
192void  killhdl(idhdl h);
193void  killhdl(idhdl h, idhdl * ih);
194lists ipNameList(idhdl root);
195void  ipMoveId(idhdl h);
196BOOLEAN checkPackage(package pack);
197
198#define FLAG_STD   0
199#define FLAG_DRING 1
200#define FLAG_DOPERATOR 2
201#define hasFlag(A,F) Sy_inset((F),(A)->flag)
202#define setFlag(A,F) (A)->flag|=Sy_bit(F)
203#define resetFlag(A,F) (A)->flag&=~Sy_bit(F)
204void ipListFlag(idhdl h);
205#endif
206
207
Note: See TracBrowser for help on using the repository browser.