source: git/Singular/ipid.h @ 1ce62fa

fieker-DuValspielwiese
Last change on this file since 1ce62fa was ce9c2d, checked in by Hans Schönemann <hannes@…>, 25 years ago
*hannes: aligne structures git-svn-id: file:///usr/local/Singular/svn/trunk@2874 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 3.8 KB
RevLine 
[0e1846]1#ifndef IPID_H
2#define IPID_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
[ce9c2d]6/* $Id: ipid.h,v 1.25 1999-02-26 15:32:05 Singular Exp $ */
[0e1846]7/*
[6ae4f5]8* ABSTRACT: identfier handling
[0e1846]9*/
10#include <string.h>
11#include "structs.h"
12#include "subexpr.h"
13
14struct sip_command
15{
16  sleftv arg1; /*arg1 to build_in, proc to proc_call*/
17  sleftv arg2; /*NULL or arg2 to build_in, args to proc_call*/
18  sleftv arg3; /*NULL or arg3*/
19  short argc; /*0,1,2,3 to build_in, -1 otherwise*/
20  short op;   /* build_in or PROC_CMD*/
21};
22
23struct sip_package
24{
[daeb6d]25  idhdl         idroot; /* local objects */
26  char          *libname;
27  short         ref;
[0a3ddd]28  language_defs language;
[a8213b0]29  BOOLEAN       loaded;
[cd6b45]30  void          *handle;
[0e1846]31};
32
[daeb6d]33inline package paCopy(package pack)
34{
35  pack->ref++;
36  return pack;
37}
38
[0e1846]39union uutypes;
40
41union uutypes
42{
43  int           i;
44  ring          uring;
45  poly          p;
46  number        n;
47  ideal         uideal;
48  map           umap;
49  matrix        umatrix;
50  char *        ustring;
51  intvec *      iv;
52  lists         l;
53  si_link       li;
54  package       pack;
[2ba9a6]55  procinfo *    pinf;
[0e1846]56};
57
58class idrec
59{
60  public:
61  /* !! do not change the first 6 entries !! (see subexpr.h: sleftv) */
62  idhdl      next;
63  char *     id;
64  utypes     data;
65  BITSET     flag;
66  attr       attribute;
67  idtyp      typ;
68
69  short      lev;
[46d09b]70  short      ref;
[0e1846]71
72#define IDNEXT(a)    ((a)->next)
73#define IDTYP(a)     ((a)->typ)
74#define IDFLAG(a)    ((a)->flag)
75#define IDLEV(a)     ((a)->lev)
76#define IDID(a)      ((a)->id)
77#define IDATTR(a)    ((a)->attribute)
78
79#define IDINT(a)    ((a)->data.i)
80#define IDDATA(a)   ((a)->data.ustring)
81#define IDRING(a)   ((a)->data.uring)
82#define IDINTVEC(a) ((a)->data.iv)
83#define IDPOLY(a)   ((a)->data.p)
84#define IDNUMBER(a) ((a)->data.n)
85#define IDIDEAL(a)  (((a)->data).uideal)
86#define IDMATRIX(a) (((a)->data).umatrix)
87#define IDMAP(a)    (((a)->data).umap)
88#define IDSTRING(a) ((a)->data.ustring)
89#define IDLIST(a)   ((a)->data.l)
90#define IDLINK(a)   ((a)->data.li)
91#define IDPACKAGE(a) ((a)->data.pack)
[2ba9a6]92#define IDPROC(a)   ((a)->data.pinf)
[0e1846]93
94  idrec() { memset(this,0,sizeof(*this)); }
95  idhdl get(const char * s, int lev);
96  idhdl set(char * s, int lev, idtyp t, BOOLEAN init=TRUE);
97//  ~idrec();
98};
99
[46d09b]100class namerec {
101  public:
102  namehdl    next;
103  namehdl    root;
104  package    pack;
105  char *     name;
106  int        lev;
[6d281ac]107  BOOLEAN    isroot;
[46d09b]108#define NSROOT(a) ((a)->pack->idroot)
[6d281ac]109#define NSPACK(a) ((a)->pack)
[5812c69]110
[77ff8e]111  int        myynest;
112  idhdl      currRingHdl;
113  ring       currRing;
[6d281ac]114
115 namerec()  { memset(this,0,sizeof(*this)); }
[46d09b]116  //namehdl    Set(idhdl root);
[0a3ddd]117  namehdl    pop(BOOLEAN change_nesting=FALSE);
118  namehdl    push(package pack, char *name, int nesting=-1, BOOLEAN init=FALSE);
[6d281ac]119  idhdl      get(const char * s, int lev, BOOLEAN root=FALSE);
[46d09b]120};
[0e1846]121
[46d09b]122extern namehdl namespaceroot;
[77ff8e]123#ifdef HAVE_NAMESPACES
[6d281ac]124#  define IDROOT (NSROOT(namespaceroot))
[46d09b]125#else /* HAVE_NAMESPACES */
[0e1846]126extern idhdl      idroot;
[6d281ac]127#  define IDROOT idroot
[46d09b]128#endif /* HAVE_NAMESPACES */
129
[0e1846]130extern idhdl      currRingHdl;
131/*extern ring     currRing;  in structs.h */
132extern ideal      currQuotient;
133
[6d281ac]134char *idhdl2id(idhdl pck, idhdl h);
[f8995b]135void  iiname2hdl(const char *name, idhdl *pck, idhdl *id);
[0e1846]136idhdl enterid(char * a, int lev, idtyp t, idhdl* root, BOOLEAN init=TRUE);
[6d281ac]137idhdl ggetid(const char *n, BOOLEAN local = FALSE);
138idhdl ggetid(const char *n, BOOLEAN local, idhdl *packhdl);
[0e1846]139void  killid(char * a, idhdl * i);
140void  killhdl(idhdl h);
141void  killhdl(idhdl h, idhdl * ih);
142lists ipNameList(idhdl root);
143void  ipMoveId(idhdl h);
[0a3ddd]144BOOLEAN checkPackage(package pack);
[0e1846]145
146#define FLAG_STD   0
147#define FLAG_DRING 1
148#define FLAG_DOPERATOR 2
149#define hasFlag(A,F) Sy_inset((F),(A)->flag)
150#define setFlag(A,F) (A)->flag|=Sy_bit(F)
151#define resetFlag(A,F) (A)->flag&=~Sy_bit(F)
152void ipListFlag(idhdl h);
153#endif
[47faf56]154
155
Note: See TracBrowser for help on using the repository browser.