source: git/Singular/ipid.h @ daeb6d

spielwiese
Last change on this file since daeb6d was daeb6d, checked in by Kai Krüger <krueger@…>, 26 years ago
tesths.cc subexpr.h subexpr.cc ipshell.h ipshell.cc iplib.cc ipid.h ipid.cc ipassign.cc iparith.cc ChangeLog - Added assignment <package>=<package> via ref-counter rewriten killhdl for packages - Added libname,language to packages - exportto(Up,...) 'Up' defined in syMake - listvar() shows toplevel-packages too. git-svn-id: file:///usr/local/Singular/svn/trunk@2589 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 4.9 KB
Line 
1#ifndef IPID_H
2#define IPID_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: ipid.h,v 1.19 1998-10-22 12:26:13 krueger 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  char          *libname;
78  short         ref;
79  language_defs language;
80};
81
82inline package paCopy(package pack)
83{
84  pack->ref++;
85  return pack;
86}
87
88union uutypes;
89
90union uutypes
91{
92  int           i;
93  ring          uring;
94  poly          p;
95  number        n;
96  ideal         uideal;
97  map           umap;
98  matrix        umatrix;
99  char *        ustring;
100  intvec *      iv;
101  lists         l;
102  si_link       li;
103  package       pack;
104  procinfo *    pinf;
105};
106
107class idrec
108{
109  public:
110  /* !! do not change the first 6 entries !! (see subexpr.h: sleftv) */
111  idhdl      next;
112  char *     id;
113  utypes     data;
114  BITSET     flag;
115  attr       attribute;
116  idtyp      typ;
117
118  short      lev;
119  short      ref;
120
121#define IDNEXT(a)    ((a)->next)
122#define IDTYP(a)     ((a)->typ)
123#define IDFLAG(a)    ((a)->flag)
124#define IDLEV(a)     ((a)->lev)
125#define IDID(a)      ((a)->id)
126#define IDATTR(a)    ((a)->attribute)
127
128#define IDINT(a)    ((a)->data.i)
129#define IDDATA(a)   ((a)->data.ustring)
130#define IDRING(a)   ((a)->data.uring)
131#define IDINTVEC(a) ((a)->data.iv)
132#define IDPOLY(a)   ((a)->data.p)
133#define IDNUMBER(a) ((a)->data.n)
134#define IDIDEAL(a)  (((a)->data).uideal)
135#define IDMATRIX(a) (((a)->data).umatrix)
136#define IDMAP(a)    (((a)->data).umap)
137#define IDSTRING(a) ((a)->data.ustring)
138#define IDLIST(a)   ((a)->data.l)
139#define IDLINK(a)   ((a)->data.li)
140#define IDPACKAGE(a) ((a)->data.pack)
141#define IDPROC(a)   ((a)->data.pinf)
142
143  idrec() { memset(this,0,sizeof(*this)); }
144  idhdl get(const char * s, int lev);
145  idhdl set(char * s, int lev, idtyp t, BOOLEAN init=TRUE);
146//  ~idrec();
147};
148
149class namerec {
150  public:
151  namehdl    next;
152  namehdl    root;
153  package    pack;
154  char *     name;
155  int        lev;
156  BOOLEAN    isroot;
157#define NSROOT(a) ((a)->pack->idroot)
158#define NSPACK(a) ((a)->pack)
159
160  int        myynest;
161  idhdl      currRingHdl;
162  ring       currRing;
163
164 namerec()  { memset(this,0,sizeof(*this)); }
165  //namehdl    Set(idhdl root);
166  namehdl    pop(BOOLEAN change_nesting=FALSE);
167  namehdl    push(package pack, char *name, int nesting=-1, BOOLEAN init=FALSE);
168  idhdl      get(const char * s, int lev, BOOLEAN root=FALSE);
169};
170
171extern namehdl namespaceroot;
172#ifdef HAVE_NAMESPACES
173#  define IDROOT (NSROOT(namespaceroot))
174#else /* HAVE_NAMESPACES */
175extern idhdl      idroot;
176#  define IDROOT idroot
177#endif /* HAVE_NAMESPACES */
178
179extern idhdl      currRingHdl;
180/*extern ring     currRing;  in structs.h */
181extern ideal      currQuotient;
182
183char *idhdl2id(idhdl pck, idhdl h);
184void  iiname2hdl(char *name, idhdl *pck, idhdl *id);
185idhdl enterid(char * a, int lev, idtyp t, idhdl* root, BOOLEAN init=TRUE);
186idhdl ggetid(const char *n, BOOLEAN local = FALSE);
187idhdl ggetid(const char *n, BOOLEAN local, idhdl *packhdl);
188void  killid(char * a, idhdl * i);
189void  killhdl(idhdl h);
190void  killhdl(idhdl h, idhdl * ih);
191lists ipNameList(idhdl root);
192void  ipMoveId(idhdl h);
193BOOLEAN checkPackage(package pack);
194
195#define FLAG_STD   0
196#define FLAG_DRING 1
197#define FLAG_DOPERATOR 2
198#define hasFlag(A,F) Sy_inset((F),(A)->flag)
199#define setFlag(A,F) (A)->flag|=Sy_bit(F)
200#define resetFlag(A,F) (A)->flag&=~Sy_bit(F)
201void ipListFlag(idhdl h);
202#endif
203
204
Note: See TracBrowser for help on using the repository browser.