My Project  debian-1:4.1.1-p2+ds-4build4
Data Structures | Macros | Typedefs | Functions | Variables
ipid.h File Reference
#include "Singular/idrec.h"
#include "Singular/subexpr.h"
#include "Singular/lists.h"

Go to the source code of this file.

Data Structures

struct  ip_command
 
struct  ip_package
 
class  proclevel
 
struct  SModulFunctions
 
struct  soptionStruct
 

Macros

#define IDROOT   (currPack->idroot)
 
#define FLAG_STD   0
 
#define FLAG_TWOSTD   3
 
#define FLAG_QRING   4
 
#define hasFlag(A, F)   Sy_inset((F),(A)->flag)
 
#define setFlag(A, F)   (A)->flag|=Sy_bit(F)
 
#define resetFlag(A, F)   (A)->flag&=~Sy_bit(F)
 
#define IDNEXT(a)   ((a)->next)
 
#define IDTYP(a)   ((a)->typ)
 
#define IDFLAG(a)   ((a)->flag)
 
#define IDLEV(a)   ((a)->lev)
 
#define IDID(a)   ((a)->id)
 
#define IDATTR(a)   ((a)->attribute)
 
#define IDINT(a)   ((int)(long)((a)->data.ustring))
 
#define IDDATA(a)   ((a)->data.ustring)
 
#define IDRING(a)   ((a)->data.uring)
 
#define IDINTVEC(a)   ((a)->data.iv)
 
#define IDBIMAT(a)   ((a)->data.bim)
 
#define IDPOLY(a)   ((a)->data.p)
 
#define IDBIGINT(a)   ((a)->data.n)
 
#define IDNUMBER(a)   ((a)->data.n)
 
#define IDIDEAL(a)   ((a)->data.uideal)
 
#define IDMATRIX(a)   ((a)->data.umatrix)
 
#define IDMAP(a)   ((a)->data.umap)
 
#define IDSTRING(a)   ((a)->data.ustring)
 
#define IDLIST(a)   ((a)->data.l)
 
#define IDLINK(a)   ((a)->data.li)
 
#define IDPACKAGE(a)   ((a)->data.pack)
 
#define IDPROC(a)   ((a)->data.pinf)
 

Typedefs

typedef ip_command * command
 
typedef int(* SModulFunc_t) (SModulFunctions *)
 

Functions

package paCopy (package pack)
 
void paKill (package pack)
 
BOOLEAN load_builtin (const char *newlib, BOOLEAN autoexport, SModulFunc_t init)
 
void module_help_main (const char *newlib, const char *help)
 
void module_help_proc (const char *newlib, const char *p, const char *help)
 
idhdl enterid (const char *a, int lev, int t, idhdl *root, BOOLEAN init=TRUE, BOOLEAN serach=TRUE)
 
idhdl ggetid (const char *n)
 
void killid (const char *a, idhdl *i)
 
void killhdl (idhdl h, package prooti=currPack)
 
void killhdl2 (idhdl h, idhdl *ih, ring r)
 
lists ipNameList (idhdl root)
 
lists ipNameListLev (idhdl root, int lev)
 
void ipMoveId (idhdl h)
 
BOOLEAN checkPackage (package pack)
 
idhdl packFindHdl (package r)
 
void jjNormalizeQRingP (poly &p)
 
void jjNormalizeQRingId (leftv I)
 
void * idrecDataInit (int t)
 
void ipListFlag (idhdl h)
 

Variables

idhdl currPackHdl
 
idhdl basePackHdl
 
package currPack
 
package basePack
 
proclevelprocstack
 
idhdl currRingHdl
 
omBin sip_command_bin
 
omBin sip_package_bin
 
omBin idrec_bin
 
omBin sleftv_bin
 
coeffs coeffs_BIGINT
 
const struct soptionStruct optionStruct []
 
const struct soptionStruct verboseStruct []
 

Data Structure Documentation

◆ sip_command

struct sip_command

Definition at line 24 of file ipid.h.

Data Fields
sleftv arg1
sleftv arg2
sleftv arg3
short argc
short op

◆ sip_package

struct sip_package

Definition at line 33 of file ipid.h.

Data Fields
void * handle
idhdl idroot
language_defs language
char * libname
BOOLEAN loaded
short ref

◆ soptionStruct

struct soptionStruct

Definition at line 145 of file ipid.h.

Data Fields
const char * name
unsigned resetval
unsigned setval

Macro Definition Documentation

◆ FLAG_QRING

#define FLAG_QRING   4

Definition at line 106 of file ipid.h.

◆ FLAG_STD

#define FLAG_STD   0

Definition at line 104 of file ipid.h.

◆ FLAG_TWOSTD

#define FLAG_TWOSTD   3

Definition at line 105 of file ipid.h.

◆ hasFlag

#define hasFlag (   A,
 
)    Sy_inset((F),(A)->flag)

Definition at line 107 of file ipid.h.

◆ IDATTR

#define IDATTR (   a)    ((a)->attribute)

Definition at line 118 of file ipid.h.

◆ IDBIGINT

#define IDBIGINT (   a)    ((a)->data.n)

Definition at line 126 of file ipid.h.

◆ IDBIMAT

#define IDBIMAT (   a)    ((a)->data.bim)

Definition at line 124 of file ipid.h.

◆ IDDATA

#define IDDATA (   a)    ((a)->data.ustring)

Definition at line 121 of file ipid.h.

◆ IDFLAG

#define IDFLAG (   a)    ((a)->flag)

Definition at line 115 of file ipid.h.

◆ IDID

#define IDID (   a)    ((a)->id)

Definition at line 117 of file ipid.h.

◆ IDIDEAL

#define IDIDEAL (   a)    ((a)->data.uideal)

Definition at line 128 of file ipid.h.

◆ IDINT

#define IDINT (   a)    ((int)(long)((a)->data.ustring))

Definition at line 120 of file ipid.h.

◆ IDINTVEC

#define IDINTVEC (   a)    ((a)->data.iv)

Definition at line 123 of file ipid.h.

◆ IDLEV

#define IDLEV (   a)    ((a)->lev)

Definition at line 116 of file ipid.h.

◆ IDLINK

#define IDLINK (   a)    ((a)->data.li)

Definition at line 133 of file ipid.h.

◆ IDLIST

#define IDLIST (   a)    ((a)->data.l)

Definition at line 132 of file ipid.h.

◆ IDMAP

#define IDMAP (   a)    ((a)->data.umap)

Definition at line 130 of file ipid.h.

◆ IDMATRIX

#define IDMATRIX (   a)    ((a)->data.umatrix)

Definition at line 129 of file ipid.h.

◆ IDNEXT

#define IDNEXT (   a)    ((a)->next)

Definition at line 113 of file ipid.h.

◆ IDNUMBER

#define IDNUMBER (   a)    ((a)->data.n)

Definition at line 127 of file ipid.h.

◆ IDPACKAGE

#define IDPACKAGE (   a)    ((a)->data.pack)

Definition at line 134 of file ipid.h.

◆ IDPOLY

#define IDPOLY (   a)    ((a)->data.p)

Definition at line 125 of file ipid.h.

◆ IDPROC

#define IDPROC (   a)    ((a)->data.pinf)

Definition at line 135 of file ipid.h.

◆ IDRING

#define IDRING (   a)    ((a)->data.uring)

Definition at line 122 of file ipid.h.

◆ IDROOT

#define IDROOT   (currPack->idroot)

Definition at line 18 of file ipid.h.

◆ IDSTRING

#define IDSTRING (   a)    ((a)->data.ustring)

Definition at line 131 of file ipid.h.

◆ IDTYP

#define IDTYP (   a)    ((a)->typ)

Definition at line 114 of file ipid.h.

◆ resetFlag

#define resetFlag (   A,
 
)    (A)->flag&=~Sy_bit(F)

Definition at line 109 of file ipid.h.

◆ setFlag

#define setFlag (   A,
 
)    (A)->flag|=Sy_bit(F)

Definition at line 108 of file ipid.h.

Typedef Documentation

◆ command

typedef ip_command* command

Definition at line 22 of file ipid.h.

◆ SModulFunc_t

typedef int(* SModulFunc_t) (SModulFunctions *)

Definition at line 80 of file ipid.h.

Function Documentation

◆ checkPackage()

BOOLEAN checkPackage ( package  pack)

◆ enterid()

idhdl enterid ( const char *  a,
int  lev,
int  t,
idhdl root,
BOOLEAN  init = TRUE,
BOOLEAN  serach = TRUE 
)

Definition at line 257 of file ipid.cc.

258 {
259  if (s==NULL) return NULL;
260  if (root==NULL) return NULL;
261  idhdl h;
262  s=omStrDup(s);
263  // idhdl *save_root=root;
264  if (t==PACKAGE_CMD)
265  {
266  if (root!=&(basePack->idroot))
267  {
268  root=&(basePack->idroot);
269  }
270  }
271  // is it already defined in root ?
272  if ((h=(*root)->get(s,lev))!=NULL)
273  {
274  if (IDLEV(h)==lev)
275  {
276  if ((IDTYP(h) == t)||(t==DEF_CMD))
277  {
278  if (IDTYP(h)==PACKAGE_CMD)
279  {
280  if (strcmp(s,"Top")==0)
281  {
282  goto errlabel;
283  }
284  else return h;
285  }
286  else
287  {
288  if (BVERBOSE(V_REDEFINE))
289  Warn("redefining %s (%s)",s,my_yylinebuf);
290  if (s==IDID(h)) IDID(h)=NULL;
291  killhdl2(h,root,currRing);
292  }
293  }
294  else
295  goto errlabel;
296  }
297  }
298  // is it already defined in currRing->idroot ?
299  else if (search && (currRing!=NULL)&&((*root) != currRing->idroot))
300  {
301  if ((h=currRing->idroot->get(s,lev))!=NULL)
302  {
303  if (IDLEV(h)==lev)
304  {
305  if ((IDTYP(h) == t)||(t==DEF_CMD))
306  {
307  if (BVERBOSE(V_REDEFINE))
308  Warn("redefining %s (%s)",s,my_yylinebuf);
309  if (s==IDID(h)) IDID(h)=NULL;
310  killhdl2(h,&currRing->idroot,currRing);
311  }
312  else
313  goto errlabel;
314  }
315  }
316  }
317  // is it already defined in idroot ?
318  else if (search && (*root != IDROOT))
319  {
320  if ((h=IDROOT->get(s,lev))!=NULL)
321  {
322  if (IDLEV(h)==lev)
323  {
324  if ((IDTYP(h) == t)||(t==DEF_CMD))
325  {
326  if (BVERBOSE(V_REDEFINE))
327  Warn("redefining %s (%s)",s,my_yylinebuf);
328  if (s==IDID(h)) IDID(h)=NULL;
329  killhdl2(h,&IDROOT,NULL);
330  }
331  else
332  goto errlabel;
333  }
334  }
335  }
336  *root = (*root)->set(s, lev, t, init);
337 #ifndef SING_NDEBUG
338  checkall();
339 #endif
340  return *root;
341 
342  errlabel:
343  //Werror("identifier `%s` in use(lev h=%d,typ=%d,t=%d, curr=%d)",s,IDLEV(h),IDTYP(h),t,lev);
344  Werror("identifier `%s` in use",s);
345  //listall();
346  omFree((ADDRESS)s);
347  return NULL;
348 }
void * ADDRESS
Definition: auxiliary.h:133
Definition: idrec.h:35
idhdl set(const char *s, int lev, int t, BOOLEAN init=TRUE)
Definition: ipid.cc:216
#define Warn
Definition: emacs.cc:77
const CanonicalForm int s
Definition: facAbsFact.cc:55
int search(const CFArray &A, const CanonicalForm &F, int i, int j)
search for F in A between index i and j
char my_yylinebuf[80]
Definition: febase.cc:43
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:407
package basePack
Definition: ipid.cc:60
#define IDID(a)
Definition: ipid.h:117
#define IDROOT
Definition: ipid.h:18
#define IDLEV(a)
Definition: ipid.h:116
#define IDTYP(a)
Definition: ipid.h:114
static Poly * h
Definition: janet.cc:972
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omFree(addr)
Definition: omAllocDecl.h:261
#define NULL
Definition: omList.c:10
#define BVERBOSE(a)
Definition: options.h:35
#define V_REDEFINE
Definition: options.h:45
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void Werror(const char *fmt,...)
Definition: reporter.cc:189
@ PACKAGE_CMD
Definition: tok.h:149
@ DEF_CMD
Definition: tok.h:58

◆ ggetid()

idhdl ggetid ( const char *  n)

Definition at line 513 of file ipid.cc.

514 {
515  idhdl h = IDROOT->get(n,myynest);
516  if ((h!=NULL)&&(IDLEV(h)==myynest)) return h;
517  if (currRing!=NULL)
518  {
519  idhdl h2 = currRing->idroot->get(n,myynest);
520  if (h2!=NULL) return h2;
521  }
522  if (h!=NULL) return h;
523  if (basePack!=currPack)
524  return basePack->idroot->get(n,myynest);
525  return NULL;
526 }
int myynest
Definition: febase.cc:41
package currPack
Definition: ipid.cc:59

◆ idrecDataInit()

void* idrecDataInit ( int  t)

Definition at line 127 of file ipid.cc.

128 {
129  switch (t)
130  {
131  //the type with init routines:
132 #ifdef SINGULAR_4_2
133  case CNUMBER_CMD:
134  return (void*)n2Init(0,NULL);
135  case CPOLY_CMD:
136  return (void*)p2Init(0,NULL);
137  case CMATRIX_CMD:
138 #endif
139  case BIGINTMAT_CMD:
140  return (void *)new bigintmat();
141  case INTVEC_CMD:
142  case INTMAT_CMD:
143  return (void *)new intvec();
144  case NUMBER_CMD:
145  {
146  if (currRing!=NULL) return (void *) nInit(0);
147  else return NULL;
148  }
149  case BIGINT_CMD:
150  return (void *) n_Init(0, coeffs_BIGINT);
151  case IDEAL_CMD:
152  case MODUL_CMD:
153  case MATRIX_CMD:
154  return (void*) idInit(1,1);
155  case MAP_CMD:
156  {
157  map m = (map)idInit(1,1);
158  m->preimage = omStrDup(IDID(currRingHdl));
159  return (void *)m;
160  }
161  case STRING_CMD:
162  return (void *)omAlloc0(1);
163  case LIST_CMD:
164  {
166  l->Init();
167  return (void*)l;
168  }
169  //the types with the standard init: set the struct to zero
170  case LINK_CMD:
171  return (void*) omAlloc0Bin(sip_link_bin);
172  case RING_CMD:
173  return NULL;
174  case PACKAGE_CMD:
175  {
176  package pa=(package)omAlloc0Bin(sip_package_bin);
177  pa->language=LANG_NONE;
178  pa->loaded = FALSE;
179  return (void*)pa;
180  }
181  case PROC_CMD:
182  {
184  pi->ref=1;
185  pi->language=LANG_NONE;
186  return (void*)pi;
187  }
188  case RESOLUTION_CMD:
189  return (void *)omAlloc0(sizeof(ssyStrategy));
190  //other types: without init (int,script,poly,def,package)
191  case CRING_CMD:
192  case INT_CMD:
193  case DEF_CMD:
194  case POLY_CMD:
195  case VECTOR_CMD:
196  case QRING_CMD:
197  return (void*)0L;
198  default:
199  {
200  if (t>MAX_TOK)
201  {
202 #ifdef BLACKBOX_DEVEL
203  Print("bb-type %d\n",t);
204 #endif
205  blackbox *bb=getBlackboxStuff(t);
206  if (bb!=NULL)
207  return (void *)bb->blackbox_Init(bb);
208  }
209  else
210  Werror("unknown type in idrecDataInit:%d",t);
211  break;
212  }
213  }
214  return (void *)0L;
215 }
#define FALSE
Definition: auxiliary.h:94
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:16
int l
Definition: cfEzgcd.cc:93
int m
Definition: cfEzgcd.cc:121
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:400
Matrices of numbers.
Definition: bigintmat.h:52
Definition: intvec.h:21
Definition: lists.h:23
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:539
#define Print
Definition: emacs.cc:80
@ IDEAL_CMD
Definition: grammar.cc:283
@ MATRIX_CMD
Definition: grammar.cc:285
@ BIGINTMAT_CMD
Definition: grammar.cc:278
@ MAP_CMD
Definition: grammar.cc:284
@ PROC_CMD
Definition: grammar.cc:280
@ INTMAT_CMD
Definition: grammar.cc:279
@ MODUL_CMD
Definition: grammar.cc:286
@ VECTOR_CMD
Definition: grammar.cc:290
@ RESOLUTION_CMD
Definition: grammar.cc:289
@ NUMBER_CMD
Definition: grammar.cc:287
@ POLY_CMD
Definition: grammar.cc:288
@ RING_CMD
Definition: grammar.cc:281
coeffs coeffs_BIGINT
Definition: ipid.cc:52
idhdl currRingHdl
Definition: ipid.cc:61
#define pi
Definition: libparse.cc:1143
omBin slists_bin
Definition: lists.cc:23
slists * lists
Definition: mpr_numeric.h:146
#define nInit(i)
Definition: numbers.h:25
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define omAlloc0(size)
Definition: omAllocDecl.h:211
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
procinfo * procinfov
Definition: structs.h:63
omBin procinfo_bin
Definition: subexpr.cc:47
@ LANG_NONE
Definition: subexpr.h:22
@ BIGINT_CMD
Definition: tok.h:38
@ CRING_CMD
Definition: tok.h:56
@ LIST_CMD
Definition: tok.h:118
@ INTVEC_CMD
Definition: tok.h:101
@ CMATRIX_CMD
Definition: tok.h:46
@ CNUMBER_CMD
Definition: tok.h:47
@ LINK_CMD
Definition: tok.h:117
@ QRING_CMD
Definition: tok.h:158
@ STRING_CMD
Definition: tok.h:183
@ CPOLY_CMD
Definition: tok.h:48
@ INT_CMD
Definition: tok.h:96
@ MAX_TOK
Definition: tok.h:215

◆ ipListFlag()

void ipListFlag ( idhdl  h)

Definition at line 528 of file ipid.cc.

529 {
530  if (hasFlag(h,FLAG_STD)) PrintS(" (SB)");
531 #ifdef HAVE_PLURAL
532  if (hasFlag(h,FLAG_TWOSTD)) PrintS(" (2SB)");
533 #endif
534 }
#define hasFlag(A, F)
Definition: ipid.h:107
#define FLAG_TWOSTD
Definition: ipid.h:105
#define FLAG_STD
Definition: ipid.h:104
void PrintS(const char *s)
Definition: reporter.cc:284

◆ ipMoveId()

void ipMoveId ( idhdl  h)

Definition at line 613 of file ipid.cc.

614 {
615  if ((currRing!=NULL)&&(tomove!=NULL))
616  {
617  if (RingDependend(IDTYP(tomove))
618  || ((IDTYP(tomove)==LIST_CMD) && (lRingDependend(IDLIST(tomove)))))
619  {
620  /*move 'tomove' to ring id's*/
621  if (ipSwapId(tomove,IDROOT,currRing->idroot))
622  ipSwapId(tomove,basePack->idroot,currRing->idroot);
623  }
624  else
625  {
626  /*move 'tomove' to global id's*/
627  ipSwapId(tomove,currRing->idroot,IDROOT);
628  }
629  }
630 }
int RingDependend(int t)
Definition: gentable.cc:29
static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
Definition: ipid.cc:588
#define IDLIST(a)
Definition: ipid.h:132
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199

◆ ipNameList()

lists ipNameList ( idhdl  root)

Definition at line 536 of file ipid.cc.

537 {
538  idhdl h=root;
539  /* compute the length */
540  int l=0;
541  while (h!=NULL) { l++; h=IDNEXT(h); }
542  /* allocate list */
544  L->Init(l);
545  /* copy names */
546  h=root;
547  l=0;
548  while (h!=NULL)
549  {
550  /* list is initialized with 0 => no need to clear anything */
551  L->m[l].rtyp=STRING_CMD;
552  L->m[l].data=omStrDup(IDID(h));
553  l++;
554  h=IDNEXT(h);
555  }
556  return L;
557 }
int rtyp
Definition: subexpr.h:91
void * data
Definition: subexpr.h:88
sleftv * m
Definition: lists.h:45
INLINE_THIS void Init(int l=0)
#define IDNEXT(a)
Definition: ipid.h:113

◆ ipNameListLev()

lists ipNameListLev ( idhdl  root,
int  lev 
)

Definition at line 559 of file ipid.cc.

560 {
561  idhdl h=root;
562  /* compute the length */
563  int l=0;
564  while (h!=NULL) { if (IDLEV(h)==lev) l++; h=IDNEXT(h); }
565  /* allocate list */
567  L->Init(l);
568  /* copy names */
569  h=root;
570  l=0;
571  while (h!=NULL)
572  {
573  if (IDLEV(h)==lev)
574  {
575  /* list is initialized with 0 => no need to clear anything */
576  L->m[l].rtyp=STRING_CMD;
577  L->m[l].data=omStrDup(IDID(h));
578  l++;
579  }
580  h=IDNEXT(h);
581  }
582  return L;
583 }

◆ jjNormalizeQRingId()

void jjNormalizeQRingId ( leftv  I)

Definition at line 2140 of file ipassign.cc.

2141 {
2142  if ((currRing->qideal!=NULL) && (!hasFlag(I,FLAG_QRING)))
2143  {
2144  if (I->e==NULL)
2145  {
2146  ideal I0=(ideal)I->Data();
2147  switch (I->Typ())
2148  {
2149  case IDEAL_CMD:
2150  case MODUL_CMD:
2151  {
2152  ideal F=idInit(1,1);
2153  ideal II=kNF(F,currRing->qideal,I0);
2154  idDelete(&F);
2155  if (I->rtyp!=IDHDL)
2156  {
2157  idDelete((ideal*)&(I0));
2158  I->data=II;
2159  }
2160  else
2161  {
2162  idhdl h=(idhdl)I->data;
2163  idDelete((ideal*)&IDIDEAL(h));
2164  IDIDEAL(h)=II;
2165  setFlag(h,FLAG_QRING);
2166  }
2167  break;
2168  }
2169  default: break;
2170  }
2171  setFlag(I,FLAG_QRING);
2172  }
2173  }
2174 }
int Typ()
Definition: subexpr.cc:992
void * Data()
Definition: subexpr.cc:1134
Subexpr e
Definition: subexpr.h:105
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define setFlag(A, F)
Definition: ipid.h:108
#define IDIDEAL(a)
Definition: ipid.h:128
#define FLAG_QRING
Definition: ipid.h:106
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2813
idrec * idhdl
Definition: ring.h:21
#define IDHDL
Definition: tok.h:31

◆ jjNormalizeQRingP()

void jjNormalizeQRingP ( poly &  p)

Definition at line 2175 of file ipassign.cc.

2176 {
2177  if((p!=NULL) && (currRing->qideal!=NULL))
2178  {
2179  ideal F=idInit(1,1);
2180  poly p2=kNF(F,currRing->qideal,p);
2181  pNormalize(p2);
2182  idDelete(&F);
2183  pDelete(&p);
2184  p=p2;
2185  }
2186 }
int p
Definition: cfModGcd.cc:4019
#define pDelete(p_ptr)
Definition: polys.h:173
#define pNormalize(p)
Definition: polys.h:303

◆ killhdl()

void killhdl ( idhdl  h,
package  prooti = currPack 
)

Definition at line 376 of file ipid.cc.

377 {
378  int t=IDTYP(h);
379  if (((BEGIN_RING<t) && (t<END_RING))
380  || ((t==LIST_CMD) && (lRingDependend((lists)IDDATA(h)))))
381  killhdl2(h,&currRing->idroot,currRing);
382  else
383  {
384  if(t==PACKAGE_CMD)
385  {
386  killhdl2(h,&(basePack->idroot),NULL);
387  }
388  else
389  {
390  idhdl s=proot->idroot;
391  while ((s!=h) && (s!=NULL)) s=s->next;
392  if (s!=NULL)
393  killhdl2(h,&(proot->idroot),NULL);
394  else if (basePack!=proot)
395  {
396  idhdl s=basePack->idroot;
397  while ((s!=h) && (s!=NULL)) s=s->next;
398  if (s!=NULL)
399  killhdl2(h,&(basePack->idroot),currRing);
400  else
401  killhdl2(h,&(currRing->idroot),currRing);
402  }
403  }
404  }
405 }
@ END_RING
Definition: grammar.cc:308
@ BEGIN_RING
Definition: grammar.cc:282
#define IDDATA(a)
Definition: ipid.h:121

◆ killhdl2()

void killhdl2 ( idhdl  h,
idhdl ih,
ring  r 
)

Definition at line 407 of file ipid.cc.

408 {
409  //printf("kill %s, id %x, typ %d lev: %d\n",IDID(h),(int)IDID(h),IDTYP(h),IDLEV(h));
410  idhdl hh;
411 
412  if (TEST_V_ALLWARN
413  && (IDLEV(h)!=myynest)
414  &&(IDLEV(h)==0))
415  {
416  if (((*ih)==basePack->idroot)
417  || ((currRing!=NULL)&&((*ih)==currRing->idroot)))
418  Warn("kill global `%s` at line >>%s<<\n",IDID(h),my_yylinebuf);
419  }
420  if (h->attribute!=NULL)
421  {
422  if ((IDTYP(h)==RING_CMD)&&(IDRING(h)!=r))
423  h->attribute->killAll(IDRING(h));
424  else
425  h->attribute->killAll(r);
426  h->attribute=NULL;
427  }
428  if (IDTYP(h) == PACKAGE_CMD)
429  {
430  if (((IDPACKAGE(h)->language==LANG_C)&&(IDPACKAGE(h)->idroot!=NULL))
431  || (strcmp(IDID(h),"Top")==0))
432  {
433  Warn("cannot kill `%s`",IDID(h));
434  return;
435  }
436  // any objects defined for this package ?
437  if ((IDPACKAGE(h)->ref<=0) && (IDPACKAGE(h)->idroot!=NULL))
438  {
439  if (currPack==IDPACKAGE(h))
440  {
443  }
444  idhdl * hd = &IDRING(h)->idroot;
445  idhdl hdh = IDNEXT(*hd);
446  idhdl temp;
447  while (hdh!=NULL)
448  {
449  temp = IDNEXT(hdh);
450  killhdl2(hdh,&(IDPACKAGE(h)->idroot),NULL);
451  hdh = temp;
452  }
453  killhdl2(*hd,hd,NULL);
454  if (IDPACKAGE(h)->libname!=NULL) omFree((ADDRESS)(IDPACKAGE(h)->libname));
455  }
456  paKill(IDPACKAGE(h));
459  }
460  else if (IDTYP(h)==RING_CMD)
461  rKill(h);
462  else if (IDDATA(h)!=NULL)
464  // general -------------------------------------------------------------
465  // now dechain it and delete idrec
466  if (IDID(h)!=NULL) // OB: ?????
467  omFree((ADDRESS)IDID(h));
468  IDID(h)=NULL;
469  IDDATA(h)=NULL;
470  if (h == (*ih))
471  {
472  // h is at the beginning of the list
473  *ih = IDNEXT(h) /* ==*ih */;
474  }
475  else if (ih!=NULL)
476  {
477  // h is somethere in the list:
478  hh = *ih;
479  loop
480  {
481  if (hh==NULL)
482  {
483  PrintS(">>?<< not found for kill\n");
484  return;
485  }
486  idhdl hhh = IDNEXT(hh);
487  if (hhh == h)
488  {
489  IDNEXT(hh) = IDNEXT(hhh);
490  break;
491  }
492  hh = hhh;
493  }
494  }
496 }
omBin idrec_bin
Definition: ipid.cc:50
idhdl currPackHdl
Definition: ipid.cc:57
idhdl packFindHdl(package r)
Definition: ipid.cc:742
#define IDPACKAGE(a)
Definition: ipid.h:134
void paKill(package pack)
Definition: ipid.h:49
#define IDRING(a)
Definition: ipid.h:122
void iiCheckPack(package &p)
Definition: ipshell.cc:1536
void rKill(ring r)
Definition: ipshell.cc:6076
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
#define TEST_V_ALLWARN
Definition: options.h:140
#define loop
Definition: structs.h:78
void s_internalDelete(const int t, void *d, const ring r)
Definition: subexpr.cc:491
@ LANG_C
Definition: subexpr.h:22

◆ killid()

void killid ( const char *  a,
idhdl i 
)

Definition at line 349 of file ipid.cc.

350 {
351  if (id!=NULL)
352  {
353  idhdl h = (*ih)->get(id,myynest);
354 
355  // id not found in global list, is it defined in current ring ?
356  if (h==NULL)
357  {
358  if ((currRing!=NULL) && (*ih != (currRing->idroot)))
359  {
360  h = currRing->idroot->get(id,myynest);
361  if (h!=NULL)
362  {
363  killhdl2(h,&(currRing->idroot),currRing);
364  return;
365  }
366  }
367  Werror("`%s` is not defined",id);
368  return;
369  }
370  killhdl2(h,ih,currRing);
371  }
372  else
373  WerrorS("kill what ?");
374 }
void WerrorS(const char *s)
Definition: feFopen.cc:24

◆ load_builtin()

BOOLEAN load_builtin ( const char *  newlib,
BOOLEAN  autoexport,
SModulFunc_t  init 
)

Definition at line 1197 of file iplib.cc.

1198 {
1199  int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic,
1200  BOOLEAN(*func)(leftv res, leftv v));
1201 /*
1202  typedef int (*fktn_t)(int(*iiAddCproc)(const char *libname, const char *procname,
1203  BOOLEAN pstatic,
1204  BOOLEAN(*func)(leftv res, leftv v)));
1205 */
1206  // SModulFunc_t fktn;
1207  idhdl pl;
1208  char *plib = iiConvName(newlib);
1209  // BOOLEAN RET=TRUE;
1210  // int token;
1211 
1212  pl = basePack->idroot->get(plib,0); // search PACKAGE only in Top
1213  if ((pl!=NULL)
1214  &&(IDTYP(pl)==PACKAGE_CMD))
1215  {
1216  if(IDPACKAGE(pl)->language==LANG_C)
1217  {
1218  if (BVERBOSE(V_LOAD_LIB)) Warn( "(builtin) %s already loaded", newlib);
1219  omFree(plib);
1220  return FALSE;
1221  }
1222  }
1223  else
1224  {
1225  pl = enterid( plib,0, PACKAGE_CMD, &IDROOT, TRUE );
1226  IDPACKAGE(pl)->libname=omStrDup(newlib);
1227  }
1228  IDPACKAGE(pl)->language = LANG_C;
1229 
1230  IDPACKAGE(pl)->handle=(void *)NULL;
1231  SModulFunctions sModulFunctions;
1232 
1233  package s=currPack;
1234  currPack=IDPACKAGE(pl);
1235  if( init!= NULL)
1236  {
1237  sModulFunctions.iiArithAddCmd = iiArithAddCmd;
1238  if (autoexport) sModulFunctions.iiAddCproc = iiAddCprocTop;
1239  else sModulFunctions.iiAddCproc = iiAddCproc;
1240  (*init)(&sModulFunctions);
1241  }
1242  if (BVERBOSE(V_LOAD_LIB)) Print( "// ** loaded (builtin) %s \n", newlib);
1243  currPack->loaded=1;
1244  currPack=s;
1245 
1246  return FALSE;
1247 }
int BOOLEAN
Definition: auxiliary.h:85
#define TRUE
Definition: auxiliary.h:98
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
CanonicalForm res
Definition: facAbsFact.cc:64
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:257
int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: iplib.cc:1005
char * iiConvName(const char *libname)
Definition: iplib.cc:1331
int iiAddCprocTop(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: iplib.cc:1078
int iiArithAddCmd(const char *szName, short nAlias, short nTokval, short nToktype, short nPos)
Definition: iparith.cc:9024
#define V_LOAD_LIB
Definition: options.h:47
int(* iiArithAddCmd)(const char *szName, short nAlias, short nTokval, short nToktype, short nPos)
Definition: ipid.h:71
int(* iiAddCproc)(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: ipid.h:69

◆ module_help_main()

void module_help_main ( const char *  newlib,
const char *  help 
)

Definition at line 1249 of file iplib.cc.

1250 {
1251  char *plib = iiConvName(newlib);
1252  idhdl pl = basePack->idroot->get(plib,0);
1253  if ((pl==NULL)||(IDTYP(pl)!=PACKAGE_CMD))
1254  Werror(">>%s<< is not a package (trying to add package help)",plib);
1255  else
1256  {
1257  package s=currPack;
1258  currPack=IDPACKAGE(pl);
1259  idhdl h=enterid("info",0,STRING_CMD,&IDROOT,FALSE);
1260  IDSTRING(h)=omStrDup(help);
1261  currPack=s;
1262  }
1263 }
#define IDSTRING(a)
Definition: ipid.h:131
#define help
Definition: libparse.cc:1228

◆ module_help_proc()

void module_help_proc ( const char *  newlib,
const char *  p,
const char *  help 
)

Definition at line 1264 of file iplib.cc.

1265 {
1266  char *plib = iiConvName(newlib);
1267  idhdl pl = basePack->idroot->get(plib,0);
1268  if ((pl==NULL)||(IDTYP(pl)!=PACKAGE_CMD))
1269  Werror(">>%s<< is not a package(trying to add help for %s)",plib,p);
1270  else
1271  {
1272  package s=currPack;
1273  currPack=IDPACKAGE(pl);
1274  char buff[256];
1275  buff[255]='\0';
1276  strncpy(buff,p,255);
1277  strncat(buff,"_help",255-strlen(p));
1278  idhdl h=enterid(buff,0,STRING_CMD,&IDROOT,FALSE);
1279  IDSTRING(h)=omStrDup(help);
1280  currPack=s;
1281  }
1282 }

◆ packFindHdl()

idhdl packFindHdl ( package  r)

Definition at line 742 of file ipid.cc.

743 {
744  idhdl h=basePack->idroot;
745  while (h!=NULL)
746  {
747  if ((IDTYP(h)==PACKAGE_CMD)
748  && (IDPACKAGE(h)==r))
749  return h;
750  h=IDNEXT(h);
751  }
752  return NULL;
753 }

◆ paCopy()

package paCopy ( package  pack)
inline

Definition at line 43 of file ipid.h.

44 {
45  pack->ref++;
46  return pack;
47 }

◆ paKill()

void paKill ( package  pack)
inline

Definition at line 49 of file ipid.h.

50 {
51  pack->ref--;
52 }

Variable Documentation

◆ basePack

package basePack
extern

Definition at line 60 of file ipid.cc.

◆ basePackHdl

idhdl basePackHdl
extern

Definition at line 58 of file ipid.cc.

◆ coeffs_BIGINT

coeffs coeffs_BIGINT
extern

Definition at line 52 of file ipid.cc.

◆ currPack

package currPack
extern

Definition at line 59 of file ipid.cc.

◆ currPackHdl

idhdl currPackHdl
extern

Definition at line 57 of file ipid.cc.

◆ currRingHdl

idhdl currRingHdl
extern

Definition at line 61 of file ipid.cc.

◆ idrec_bin

omBin idrec_bin
extern

Definition at line 50 of file ipid.cc.

◆ optionStruct

const struct soptionStruct optionStruct[]
extern

Definition at line 448 of file misc_ip.cc.

◆ procstack

proclevel* procstack
extern

Definition at line 54 of file ipid.cc.

◆ sip_command_bin

omBin sip_command_bin
extern

Definition at line 47 of file ipid.cc.

◆ sip_package_bin

omBin sip_package_bin
extern

Definition at line 48 of file ipid.cc.

◆ sleftv_bin

omBin sleftv_bin
extern

Definition at line 46 of file subexpr.cc.

◆ verboseStruct

const struct soptionStruct verboseStruct[]
extern

Definition at line 448 of file misc_ip.cc.