source: git/Singular/ipid.h @ 5812c69

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