1 | #ifndef IPID_H |
---|
2 | #define IPID_H |
---|
3 | /**************************************** |
---|
4 | * Computer Algebra System SINGULAR * |
---|
5 | ****************************************/ |
---|
6 | /* $Id: ipid.h,v 1.42 2006-09-25 14:22:15 Singular Exp $ */ |
---|
7 | /* |
---|
8 | * ABSTRACT: identfier handling |
---|
9 | */ |
---|
10 | #include <string.h> |
---|
11 | #include "structs.h" |
---|
12 | #ifdef TOK_H |
---|
13 | #include "subexpr.h" |
---|
14 | #endif |
---|
15 | |
---|
16 | struct sip_command |
---|
17 | { |
---|
18 | sleftv arg1; /*arg1 to build_in, proc to proc_call*/ |
---|
19 | sleftv arg2; /*NULL or arg2 to build_in, args to proc_call*/ |
---|
20 | sleftv arg3; /*NULL or arg3*/ |
---|
21 | short argc; /*0,1,2,3 to build_in, -1 otherwise*/ |
---|
22 | short op; /* build_in or PROC_CMD*/ |
---|
23 | }; |
---|
24 | |
---|
25 | struct sip_package |
---|
26 | { |
---|
27 | idhdl idroot; /* local objects */ |
---|
28 | char *libname; |
---|
29 | short ref; |
---|
30 | language_defs language; |
---|
31 | BOOLEAN loaded; |
---|
32 | void *handle; |
---|
33 | }; |
---|
34 | |
---|
35 | inline package paCopy(package pack) |
---|
36 | { |
---|
37 | pack->ref++; |
---|
38 | return pack; |
---|
39 | } |
---|
40 | |
---|
41 | inline void paKill(package pack) |
---|
42 | { |
---|
43 | pack->ref--; |
---|
44 | } |
---|
45 | |
---|
46 | class proclevel { |
---|
47 | public: |
---|
48 | proclevel * next; |
---|
49 | idhdl cRingHdl; |
---|
50 | ring cRing; |
---|
51 | #ifdef HAVE_NS |
---|
52 | idhdl cPackHdl; |
---|
53 | package cPack; |
---|
54 | #endif |
---|
55 | char * name; |
---|
56 | proclevel() { memset(this,0,sizeof(*this)); } |
---|
57 | void push(char *); |
---|
58 | void pop(); |
---|
59 | }; |
---|
60 | extern proclevel *procstack; |
---|
61 | |
---|
62 | typedef struct |
---|
63 | { |
---|
64 | int (*iiAddCproc)(char *libname, char *procname, BOOLEAN pstatic, |
---|
65 | BOOLEAN(*func)(leftv res, leftv v)); |
---|
66 | int (*iiArithAddCmd)(char *szName, short nAlias, short nTokval, |
---|
67 | short nToktype, short nPos); |
---|
68 | |
---|
69 | } SModulFunctions; |
---|
70 | |
---|
71 | |
---|
72 | /*extern idhdl currRingHdl; in structs.h */ |
---|
73 | /*extern ring currRing; in structs.h */ |
---|
74 | /*extern ideal currQuotient; in structs.h */ |
---|
75 | |
---|
76 | char *idhdl2id(idhdl pck, idhdl h); |
---|
77 | void iiname2hdl(const char *name, idhdl *pck, idhdl *id); |
---|
78 | idhdl enterid(char * a, int lev, idtyp t, idhdl* root, BOOLEAN init=TRUE); |
---|
79 | idhdl ggetid(const char *n, BOOLEAN local = FALSE); |
---|
80 | idhdl ggetid(const char *n, BOOLEAN local, idhdl *packhdl); |
---|
81 | void killid(char * a, idhdl * i); |
---|
82 | #ifdef HAVE_NS |
---|
83 | void killhdl(idhdl h, package prooti=currPack); |
---|
84 | #else |
---|
85 | void killhdl(idhdl h); |
---|
86 | #endif |
---|
87 | void killhdl2(idhdl h, idhdl * ih, ring r); |
---|
88 | lists ipNameList(idhdl root); |
---|
89 | void ipMoveId(idhdl h); |
---|
90 | BOOLEAN checkPackage(package pack); |
---|
91 | #ifdef HAVE_NS |
---|
92 | idhdl packFindHdl(package r); |
---|
93 | #endif |
---|
94 | |
---|
95 | #define FLAG_STD 0 |
---|
96 | #define FLAG_TWOSTD 3 |
---|
97 | #define hasFlag(A,F) Sy_inset((F),(A)->flag) |
---|
98 | #define setFlag(A,F) (A)->flag|=Sy_bit(F) |
---|
99 | #define resetFlag(A,F) (A)->flag&=~Sy_bit(F) |
---|
100 | void ipListFlag(idhdl h); |
---|
101 | |
---|
102 | #ifndef OM_ALLOC_H |
---|
103 | struct omBin_s; |
---|
104 | #endif |
---|
105 | |
---|
106 | extern omBin_s* sip_command_bin; |
---|
107 | extern omBin_s* ip_command_bin; |
---|
108 | extern omBin_s* sip_package_bin; |
---|
109 | extern omBin_s* ip_package_bin; |
---|
110 | extern omBin_s* idrec_bin; |
---|
111 | extern omBin_s* namerec_bin; |
---|
112 | #endif |
---|
113 | |
---|
114 | |
---|