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