source: git/Singular/ipid.h @ fdc537

fieker-DuValspielwiese
Last change on this file since fdc537 was 416465, checked in by Olaf Bachmann <obachman@…>, 25 years ago
* bug-fixes from work with Thomas git-svn-id: file:///usr/local/Singular/svn/trunk@3826 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****************************************/
[416465]6/* $Id: ipid.h,v 1.28 1999-11-15 17:20:10 obachman 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  attr       attribute;
[472f39]66  BITSET     flag;
[0e1846]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);
[472f39]97  char * String();
[0e1846]98//  ~idrec();
99};
100
[46d09b]101class namerec {
102  public:
103  namehdl    next;
104  namehdl    root;
105  package    pack;
106  char *     name;
107  int        lev;
[6d281ac]108  BOOLEAN    isroot;
[46d09b]109#define NSROOT(a) ((a)->pack->idroot)
[6d281ac]110#define NSPACK(a) ((a)->pack)
[5812c69]111
[77ff8e]112  int        myynest;
113  idhdl      currRingHdl;
114  ring       currRing;
[6d281ac]115
116 namerec()  { memset(this,0,sizeof(*this)); }
[46d09b]117  //namehdl    Set(idhdl root);
[0a3ddd]118  namehdl    pop(BOOLEAN change_nesting=FALSE);
119  namehdl    push(package pack, char *name, int nesting=-1, BOOLEAN init=FALSE);
[6d281ac]120  idhdl      get(const char * s, int lev, BOOLEAN root=FALSE);
[46d09b]121};
[0e1846]122
[46d09b]123extern namehdl namespaceroot;
[77ff8e]124#ifdef HAVE_NAMESPACES
[6d281ac]125#  define IDROOT (NSROOT(namespaceroot))
[46d09b]126#else /* HAVE_NAMESPACES */
[0e1846]127extern idhdl      idroot;
[6d281ac]128#  define IDROOT idroot
[46d09b]129#endif /* HAVE_NAMESPACES */
130
[0e1846]131extern idhdl      currRingHdl;
132/*extern ring     currRing;  in structs.h */
133extern ideal      currQuotient;
134
[6d281ac]135char *idhdl2id(idhdl pck, idhdl h);
[f8995b]136void  iiname2hdl(const char *name, idhdl *pck, idhdl *id);
[0e1846]137idhdl enterid(char * a, int lev, idtyp t, idhdl* root, BOOLEAN init=TRUE);
[6d281ac]138idhdl ggetid(const char *n, BOOLEAN local = FALSE);
139idhdl ggetid(const char *n, BOOLEAN local, idhdl *packhdl);
[0e1846]140void  killid(char * a, idhdl * i);
141void  killhdl(idhdl h);
142void  killhdl(idhdl h, idhdl * ih);
143lists ipNameList(idhdl root);
144void  ipMoveId(idhdl h);
[0a3ddd]145BOOLEAN checkPackage(package pack);
[0e1846]146
147#define FLAG_STD   0
148#define FLAG_DRING 1
149#define FLAG_DOPERATOR 2
150#define hasFlag(A,F) Sy_inset((F),(A)->flag)
151#define setFlag(A,F) (A)->flag|=Sy_bit(F)
152#define resetFlag(A,F) (A)->flag&=~Sy_bit(F)
153void ipListFlag(idhdl h);
[b7b08c]154
155#if HAVE_ASO == 1
156#include "ipid.aso"
157#endif
158
[0e1846]159#endif
[47faf56]160
161
Note: See TracBrowser for help on using the repository browser.