My Project  debian-1:4.1.2-p1+ds-2
Functions | Variables
ipid.cc File Reference
#include "kernel/mod2.h"
#include "misc/options.h"
#include "misc/intvec.h"
#include "coeffs/numbers.h"
#include "coeffs/bigintmat.h"
#include "polys/matpol.h"
#include "polys/monomials/ring.h"
#include "kernel/polys.h"
#include "kernel/ideals.h"
#include "kernel/GBEngine/syz.h"
#include "Singular/tok.h"
#include "Singular/ipshell.h"
#include "Singular/fevoices.h"
#include "Singular/lists.h"
#include "Singular/attrib.h"
#include "Singular/links/silink.h"
#include "Singular/ipid.h"
#include "Singular/blackbox.h"
#include "Singular/number2.h"
#include "polys/mod_raw.h"

Go to the source code of this file.

Functions

void paCleanUp (package pack)
 
int iiS2I (const char *s)
 
void * idrecDataInit (int t)
 
idhdl enterid (const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
 
void killid (const char *id, idhdl *ih)
 
void killhdl (idhdl h, package proot)
 
void killhdl2 (idhdl h, idhdl *ih, ring r)
 
idhdl ggetid (const char *n)
 
void ipListFlag (idhdl h)
 
lists ipNameList (idhdl root)
 
lists ipNameListLev (idhdl root, int lev)
 
static int ipSwapId (idhdl tomove, idhdl &root1, idhdl &root2)
 
void ipMoveId (idhdl tomove)
 
const char * piProcinfo (procinfov pi, const char *request)
 
BOOLEAN piKill (procinfov pi)
 
idhdl packFindHdl (package r)
 
BOOLEAN iiAlias (leftv p)
 

Variables

VAR omBin sip_command_bin = omGetSpecBin(sizeof(sip_command))
 
VAR omBin sip_package_bin = omGetSpecBin(sizeof(sip_package))
 
VAR omBin idrec_bin = omGetSpecBin(sizeof(idrec))
 
VAR coeffs coeffs_BIGINT
 
VAR proclevelprocstack =NULL
 
VAR idhdl currPackHdl = NULL
 
VAR idhdl basePackHdl = NULL
 
VAR package currPack = NULL
 
VAR package basePack = NULL
 
VAR idhdl currRingHdl = NULL
 

Function Documentation

◆ enterid()

idhdl enterid ( const char *  s,
int  lev,
int  t,
idhdl root,
BOOLEAN  init,
BOOLEAN  search 
)

Definition at line 265 of file ipid.cc.

266 {
267  if (s==NULL) return NULL;
268  if (root==NULL) return NULL;
269  idhdl h;
270  s=omStrDup(s);
271  // idhdl *save_root=root;
272  if (t==PACKAGE_CMD)
273  {
274  if (root!=&(basePack->idroot))
275  {
276  root=&(basePack->idroot);
277  }
278  }
279  // is it already defined in root ?
280  if ((h=(*root)->get(s,lev))!=NULL)
281  {
282  if (IDLEV(h)==lev)
283  {
284  if ((IDTYP(h) == t)||(t==DEF_CMD))
285  {
286  if (IDTYP(h)==PACKAGE_CMD)
287  {
288  if (strcmp(s,"Top")==0)
289  {
290  goto errlabel;
291  }
292  else return h;
293  }
294  else
295  {
296  if (BVERBOSE(V_REDEFINE))
297  Warn("redefining %s (%s)",s,my_yylinebuf);
298  if (s==IDID(h)) IDID(h)=NULL;
299  killhdl2(h,root,currRing);
300  }
301  }
302  else
303  goto errlabel;
304  }
305  }
306  // is it already defined in currRing->idroot ?
307  else if (search && (currRing!=NULL)&&((*root) != currRing->idroot))
308  {
309  if ((h=currRing->idroot->get(s,lev))!=NULL)
310  {
311  if (IDLEV(h)==lev)
312  {
313  if ((IDTYP(h) == t)||(t==DEF_CMD))
314  {
315  if (BVERBOSE(V_REDEFINE))
316  Warn("redefining %s (%s)",s,my_yylinebuf);
317  if (s==IDID(h)) IDID(h)=NULL;
318  killhdl2(h,&currRing->idroot,currRing);
319  }
320  else
321  goto errlabel;
322  }
323  }
324  }
325  // is it already defined in idroot ?
326  else if (search && (*root != IDROOT))
327  {
328  if ((h=IDROOT->get(s,lev))!=NULL)
329  {
330  if (IDLEV(h)==lev)
331  {
332  if ((IDTYP(h) == t)||(t==DEF_CMD))
333  {
334  if (BVERBOSE(V_REDEFINE))
335  Warn("redefining %s (%s)",s,my_yylinebuf);
336  if (s==IDID(h)) IDID(h)=NULL;
337  killhdl2(h,&IDROOT,NULL);
338  }
339  else
340  goto errlabel;
341  }
342  }
343  }
344  *root = (*root)->set(s, lev, t, init);
345 #ifndef SING_NDEBUG
346  checkall();
347 #endif
348  return *root;
349 
350  errlabel:
351  //Werror("identifier `%s` in use(lev h=%d,typ=%d,t=%d, curr=%d)",s,IDLEV(h),IDTYP(h),t,lev);
352  Werror("identifier `%s` in use",s);
353  //listall();
354  omFree((ADDRESS)s);
355  return NULL;
356 }
void * ADDRESS
Definition: auxiliary.h:135
Definition: idrec.h:35
idhdl set(const char *s, int lev, int t, BOOLEAN init=TRUE)
Definition: ipid.cc:223
#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
VAR char my_yylinebuf[80]
Definition: febase.cc:43
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:415
VAR package basePack
Definition: ipid.cc:58
#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_VAR Poly * h
Definition: janet.cc:971
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omFree(addr)
Definition: omAllocDecl.h:261
#define NULL
Definition: omList.c:12
#define BVERBOSE(a)
Definition: options.h:34
#define V_REDEFINE
Definition: options.h:44
VAR 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 521 of file ipid.cc.

522 {
523  idhdl h = IDROOT->get(n,myynest);
524  if ((h!=NULL)&&(IDLEV(h)==myynest)) return h;
525  if (currRing!=NULL)
526  {
527  idhdl h2 = currRing->idroot->get(n,myynest);
528  if (h2!=NULL) return h2;
529  }
530  if (h!=NULL) return h;
531  if (basePack!=currPack)
532  return basePack->idroot->get(n,myynest);
533  return NULL;
534 }
VAR int myynest
Definition: febase.cc:41
VAR package currPack
Definition: ipid.cc:57

◆ idrecDataInit()

void* idrecDataInit ( int  t)

Definition at line 125 of file ipid.cc.

126 {
127  switch (t)
128  {
129  //the type with init routines:
130 #ifdef SINGULAR_4_2
131  case CNUMBER_CMD:
132  return (void*)n2Init(0,NULL);
133  case CPOLY_CMD:
134  return (void*)p2Init(0,NULL);
135  case CMATRIX_CMD:
136 #endif
137  case BIGINTMAT_CMD:
138  return (void *)new bigintmat();
139  case BUCKET_CMD:
140  if (currRing!=NULL)
141  return (void*)sBucketCreate(currRing);
142  else
143  {
144  WerrorS("need basering for polyBucket");
145  return NULL;
146  }
147  case INTVEC_CMD:
148  case INTMAT_CMD:
149  return (void *)new intvec();
150  case NUMBER_CMD:
151  {
152  if (currRing!=NULL) return (void *) nInit(0);
153  else return NULL;
154  }
155  case BIGINT_CMD:
156  return (void *) n_Init(0, coeffs_BIGINT);
157  case IDEAL_CMD:
158  case MODUL_CMD:
159  case MATRIX_CMD:
160  case SMATRIX_CMD:
161  return (void*) idInit(1,1);
162  case MAP_CMD:
163  {
164  map m = (map)idInit(1,1);
165  m->preimage = omStrDup(IDID(currRingHdl));
166  return (void *)m;
167  }
168  case STRING_CMD:
169  return (void *)omAlloc0(1);
170  case LIST_CMD:
171  {
173  l->Init();
174  return (void*)l;
175  }
176  //the types with the standard init: set the struct to zero
177  case LINK_CMD:
178  return (void*) omAlloc0Bin(sip_link_bin);
179  case RING_CMD:
180  return NULL;
181  case PACKAGE_CMD:
182  {
183  package pa=(package)omAlloc0Bin(sip_package_bin);
184  pa->language=LANG_NONE;
185  pa->loaded = FALSE;
186  return (void*)pa;
187  }
188  case PROC_CMD:
189  {
191  pi->ref=1;
192  pi->language=LANG_NONE;
193  return (void*)pi;
194  }
195  case RESOLUTION_CMD:
196  return (void *)omAlloc0(sizeof(ssyStrategy));
197  //other types: without init (int,script,poly,def,package)
198  case CRING_CMD:
199  case INT_CMD:
200  case DEF_CMD:
201  case POLY_CMD:
202  case VECTOR_CMD:
203  case QRING_CMD:
204  return (void*)0L;
205  default:
206  {
207  if (t>MAX_TOK)
208  {
209 #ifdef BLACKBOX_DEVEL
210  Print("bb-type %d\n",t);
211 #endif
212  blackbox *bb=getBlackboxStuff(t);
213  if (bb!=NULL)
214  return (void *)bb->blackbox_Init(bb);
215  }
216  else
217  Werror("unknown type in idrecDataInit:%d",t);
218  break;
219  }
220  }
221  return (void *)0L;
222 }
#define FALSE
Definition: auxiliary.h:96
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:51
Definition: intvec.h:23
Definition: lists.h:24
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:538
BOOLEAN pa(leftv res, leftv args)
Definition: cohomo.cc:4346
#define Print
Definition: emacs.cc:80
void WerrorS(const char *s)
Definition: feFopen.cc:24
@ IDEAL_CMD
Definition: grammar.cc:284
@ MATRIX_CMD
Definition: grammar.cc:286
@ BUCKET_CMD
Definition: grammar.cc:283
@ BIGINTMAT_CMD
Definition: grammar.cc:278
@ MAP_CMD
Definition: grammar.cc:285
@ PROC_CMD
Definition: grammar.cc:280
@ INTMAT_CMD
Definition: grammar.cc:279
@ MODUL_CMD
Definition: grammar.cc:287
@ SMATRIX_CMD
Definition: grammar.cc:291
@ VECTOR_CMD
Definition: grammar.cc:292
@ RESOLUTION_CMD
Definition: grammar.cc:290
@ NUMBER_CMD
Definition: grammar.cc:288
@ POLY_CMD
Definition: grammar.cc:289
@ RING_CMD
Definition: grammar.cc:281
VAR idhdl currRingHdl
Definition: ipid.cc:59
VAR coeffs coeffs_BIGINT
Definition: ipid.cc:50
#define pi
Definition: libparse.cc:1145
VAR omBin slists_bin
Definition: lists.cc:23
slists * lists
Definition: mpr_numeric.h:146
#define nInit(i)
Definition: numbers.h:24
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define omAlloc0(size)
Definition: omAllocDecl.h:211
sBucket_pt sBucketCreate(const ring r)
Definition: sbuckets.cc:96
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
procinfo * procinfov
Definition: structs.h:65
VAR omBin procinfo_bin
Definition: subexpr.cc:42
@ 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:184
@ CPOLY_CMD
Definition: tok.h:48
@ INT_CMD
Definition: tok.h:96
@ MAX_TOK
Definition: tok.h:217

◆ iiAlias()

BOOLEAN iiAlias ( leftv  p)

Definition at line 763 of file ipid.cc.

764 {
765  if (iiCurrArgs==NULL)
766  {
767  Werror("not enough arguments for proc %s",VoiceName());
768  p->CleanUp();
769  return TRUE;
770  }
772  iiCurrArgs=h->next;
773  h->next=NULL;
774  if (h->rtyp!=IDHDL)
775  {
777  h->CleanUp();
779  return res;
780  }
781  if ((h->Typ()!=p->Typ()) &&(p->Typ()!=DEF_CMD))
782  {
783  WerrorS("type mismatch");
784  return TRUE;
785  }
786  idhdl pp=(idhdl)p->data;
787  switch(pp->typ)
788  {
789  case CRING_CMD:
790  nKillChar((coeffs)pp);
791  break;
792  case DEF_CMD:
793  case INT_CMD:
794  break;
795  case INTVEC_CMD:
796  case INTMAT_CMD:
797  delete IDINTVEC(pp);
798  break;
799  case NUMBER_CMD:
800  nDelete(&IDNUMBER(pp));
801  break;
802  case BIGINT_CMD:
804  break;
805  case MAP_CMD:
806  {
807  map im = IDMAP(pp);
808  omFree((ADDRESS)im->preimage);
809  }
810  // continue as ideal:
811  case IDEAL_CMD:
812  case MODUL_CMD:
813  case MATRIX_CMD:
814  idDelete(&IDIDEAL(pp));
815  break;
816  case PROC_CMD:
817  case RESOLUTION_CMD:
818  case STRING_CMD:
820  break;
821  case LIST_CMD:
822  IDLIST(pp)->Clean();
823  break;
824  case LINK_CMD:
826  break;
827  // case ring: cannot happen
828  default:
829  Werror("unknown type %d",p->Typ());
830  return TRUE;
831  }
832  pp->typ=ALIAS_CMD;
833  IDDATA(pp)=(char*)h->data;
834  int eff_typ=h->Typ();
835  if ((RingDependend(eff_typ))
836  || ((eff_typ==LIST_CMD) && (lRingDependend((lists)h->Data()))))
837  {
838  ipSwapId(pp,IDROOT,currRing->idroot);
839  }
840  h->CleanUp();
842  return FALSE;
843 }
int BOOLEAN
Definition: auxiliary.h:87
#define TRUE
Definition: auxiliary.h:100
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
int p
Definition: cfModGcd.cc:4019
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:510
CanonicalForm res
Definition: facAbsFact.cc:64
const char * VoiceName()
Definition: fevoices.cc:56
int RingDependend(int t)
Definition: gentable.cc:28
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1830
static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
Definition: ipid.cc:596
#define IDMAP(a)
Definition: ipid.h:130
#define IDSTRING(a)
Definition: ipid.h:131
EXTERN_VAR omBin sleftv_bin
Definition: ipid.h:140
#define IDDATA(a)
Definition: ipid.h:121
#define IDINTVEC(a)
Definition: ipid.h:123
#define IDLINK(a)
Definition: ipid.h:133
#define IDIDEAL(a)
Definition: ipid.h:128
#define IDNUMBER(a)
Definition: ipid.h:127
#define IDLIST(a)
Definition: ipid.h:132
VAR leftv iiCurrArgs
Definition: ipshell.cc:76
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
The main handler for Singular numbers which are suitable for Singular polynomials.
#define nDelete(n)
Definition: numbers.h:16
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
idrec * idhdl
Definition: ring.h:21
#define IDHDL
Definition: tok.h:31
@ ALIAS_CMD
Definition: tok.h:34

◆ iiS2I()

int iiS2I ( const char *  s)

Definition at line 65 of file ipid.cc.

66 {
67  int i;
68  i=s[0];
69  if (s[1]!='\0')
70  {
71  i=(i<<8)+s[1];
72  if (s[2]!='\0')
73  {
74  i=(i<<8)+s[2];
75  if (s[3]!='\0')
76  {
77  i=(i<<8)+s[3];
78  }
79  }
80  }
81  return i;
82 }
int i
Definition: cfEzgcd.cc:125

◆ ipListFlag()

void ipListFlag ( idhdl  h)

Definition at line 536 of file ipid.cc.

537 {
538  if (hasFlag(h,FLAG_STD)) PrintS(" (SB)");
539 #ifdef HAVE_PLURAL
540  if (hasFlag(h,FLAG_TWOSTD)) PrintS(" (2SB)");
541 #endif
542 }
#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  tomove)

Definition at line 621 of file ipid.cc.

622 {
623  if ((currRing!=NULL)&&(tomove!=NULL))
624  {
625  if (RingDependend(IDTYP(tomove))
626  || ((IDTYP(tomove)==LIST_CMD) && (lRingDependend(IDLIST(tomove)))))
627  {
628  /*move 'tomove' to ring id's*/
629  if (ipSwapId(tomove,IDROOT,currRing->idroot))
630  ipSwapId(tomove,basePack->idroot,currRing->idroot);
631  }
632  else
633  {
634  /*move 'tomove' to global id's*/
635  ipSwapId(tomove,currRing->idroot,IDROOT);
636  }
637  }
638 }

◆ ipNameList()

lists ipNameList ( idhdl  root)

Definition at line 544 of file ipid.cc.

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

◆ ipNameListLev()

lists ipNameListLev ( idhdl  root,
int  lev 
)

Definition at line 567 of file ipid.cc.

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

◆ ipSwapId()

static int ipSwapId ( idhdl  tomove,
idhdl root1,
idhdl root2 
)
static

Definition at line 596 of file ipid.cc.

597 {
598  idhdl h;
599  /* search 'tomove' in root2 : if found -> do nothing */
600  h=root2;
601  while ((h!=NULL) && (h!=tomove)) h=IDNEXT(h);
602  if (h!=NULL) return FALSE; /*okay */
603  /* search predecessor of h in root1, remove 'tomove' */
604  h=root1;
605  if (tomove==h)
606  {
607  root1=IDNEXT(h);
608  }
609  else
610  {
611  while ((h!=NULL) && (IDNEXT(h)!=tomove)) h=IDNEXT(h);
612  if (h==NULL) return TRUE; /* not in the list root1 -> do nothing */
613  IDNEXT(h)=IDNEXT(tomove);
614  }
615  /* add to root2 list */
616  IDNEXT(tomove)=root2;
617  root2=tomove;
618  return FALSE;
619 }

◆ killhdl()

void killhdl ( idhdl  h,
package  proot 
)

Definition at line 384 of file ipid.cc.

385 {
386  int t=IDTYP(h);
387  if (((BEGIN_RING<t) && (t<END_RING))
388  || ((t==LIST_CMD) && (lRingDependend((lists)IDDATA(h)))))
389  killhdl2(h,&currRing->idroot,currRing);
390  else
391  {
392  if(t==PACKAGE_CMD)
393  {
394  killhdl2(h,&(basePack->idroot),NULL);
395  }
396  else
397  {
398  idhdl s=proot->idroot;
399  while ((s!=h) && (s!=NULL)) s=s->next;
400  if (s!=NULL)
401  killhdl2(h,&(proot->idroot),NULL);
402  else if (basePack!=proot)
403  {
404  idhdl s=basePack->idroot;
405  while ((s!=h) && (s!=NULL)) s=s->next;
406  if (s!=NULL)
407  killhdl2(h,&(basePack->idroot),currRing);
408  else
409  killhdl2(h,&(currRing->idroot),currRing);
410  }
411  }
412  }
413 }
@ END_RING
Definition: grammar.cc:310
@ BEGIN_RING
Definition: grammar.cc:282

◆ killhdl2()

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

Definition at line 415 of file ipid.cc.

416 {
417  //printf("kill %s, id %x, typ %d lev: %d\n",IDID(h),(int)IDID(h),IDTYP(h),IDLEV(h));
418  idhdl hh;
419 
420  if (TEST_V_ALLWARN
421  && (IDLEV(h)!=myynest)
422  &&(IDLEV(h)==0))
423  {
424  if (((*ih)==basePack->idroot)
425  || ((currRing!=NULL)&&((*ih)==currRing->idroot)))
426  Warn("kill global `%s` at line >>%s<<\n",IDID(h),my_yylinebuf);
427  }
428  if (h->attribute!=NULL)
429  {
430  if ((IDTYP(h)==RING_CMD)&&(IDRING(h)!=r))
431  h->attribute->killAll(IDRING(h));
432  else
433  h->attribute->killAll(r);
434  h->attribute=NULL;
435  }
436  if (IDTYP(h) == PACKAGE_CMD)
437  {
438  if (((IDPACKAGE(h)->language==LANG_C)&&(IDPACKAGE(h)->idroot!=NULL))
439  || (strcmp(IDID(h),"Top")==0))
440  {
441  Warn("cannot kill `%s`",IDID(h));
442  return;
443  }
444  // any objects defined for this package ?
445  if ((IDPACKAGE(h)->ref<=0) && (IDPACKAGE(h)->idroot!=NULL))
446  {
447  if (currPack==IDPACKAGE(h))
448  {
451  }
452  idhdl * hd = &IDRING(h)->idroot;
453  idhdl hdh = IDNEXT(*hd);
454  idhdl temp;
455  while (hdh!=NULL)
456  {
457  temp = IDNEXT(hdh);
458  killhdl2(hdh,&(IDPACKAGE(h)->idroot),NULL);
459  hdh = temp;
460  }
461  killhdl2(*hd,hd,NULL);
462  if (IDPACKAGE(h)->libname!=NULL) omFree((ADDRESS)(IDPACKAGE(h)->libname));
463  }
464  paKill(IDPACKAGE(h));
467  }
468  else if (IDTYP(h)==RING_CMD)
469  rKill(h);
470  else if (IDDATA(h)!=NULL)
472  // general -------------------------------------------------------------
473  // now dechain it and delete idrec
474  if (IDID(h)!=NULL) // OB: ?????
475  omFree((ADDRESS)IDID(h));
476  IDID(h)=NULL;
477  IDDATA(h)=NULL;
478  if (h == (*ih))
479  {
480  // h is at the beginning of the list
481  *ih = IDNEXT(h) /* ==*ih */;
482  }
483  else if (ih!=NULL)
484  {
485  // h is somethere in the list:
486  hh = *ih;
487  loop
488  {
489  if (hh==NULL)
490  {
491  PrintS(">>?<< not found for kill\n");
492  return;
493  }
494  idhdl hhh = IDNEXT(hh);
495  if (hhh == h)
496  {
497  IDNEXT(hh) = IDNEXT(hhh);
498  break;
499  }
500  hh = hhh;
501  }
502  }
504 }
VAR omBin idrec_bin
Definition: ipid.cc:48
VAR idhdl currPackHdl
Definition: ipid.cc:55
idhdl packFindHdl(package r)
Definition: ipid.cc:750
#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:1539
void rKill(ring r)
Definition: ipshell.cc:6124
#define TEST_V_ALLWARN
Definition: options.h:139
#define loop
Definition: structs.h:80
void s_internalDelete(const int t, void *d, const ring r)
Definition: subexpr.cc:514
@ LANG_C
Definition: subexpr.h:22

◆ killid()

void killid ( const char *  id,
idhdl ih 
)

Definition at line 357 of file ipid.cc.

358 {
359  if (id!=NULL)
360  {
361  idhdl h = (*ih)->get(id,myynest);
362 
363  // id not found in global list, is it defined in current ring ?
364  if (h==NULL)
365  {
366  if ((currRing!=NULL) && (*ih != (currRing->idroot)))
367  {
368  h = currRing->idroot->get(id,myynest);
369  if (h!=NULL)
370  {
371  killhdl2(h,&(currRing->idroot),currRing);
372  return;
373  }
374  }
375  Werror("`%s` is not defined",id);
376  return;
377  }
378  killhdl2(h,ih,currRing);
379  }
380  else
381  WerrorS("kill what ?");
382 }

◆ packFindHdl()

idhdl packFindHdl ( package  r)

Definition at line 750 of file ipid.cc.

751 {
752  idhdl h=basePack->idroot;
753  while (h!=NULL)
754  {
755  if ((IDTYP(h)==PACKAGE_CMD)
756  && (IDPACKAGE(h)==r))
757  return h;
758  h=IDNEXT(h);
759  }
760  return NULL;
761 }

◆ paCleanUp()

void paCleanUp ( package  pack)

Definition at line 702 of file ipid.cc.

703 {
704  (pack->ref)--;
705  if (pack->ref < 0)
706  {
707 #ifndef HAVE_STATIC
708  if( pack->language == LANG_C)
709  {
710  Print("//dlclose(%s)\n",pack->libname);
711 #ifdef HAVE_DYNAMIC_LOADING
712  dynl_close (pack->handle);
713 #endif /* HAVE_DYNAMIC_LOADING */
714  }
715 #endif /* HAVE_STATIC */
716  omFree((ADDRESS)pack->libname);
717  memset((void *) pack, 0, sizeof(sip_package));
718  pack->language=LANG_NONE;
719  }
720 }
int dynl_close(void *handle)
Definition: mod_raw.cc:173

◆ piKill()

BOOLEAN piKill ( procinfov  pi)

Definition at line 664 of file ipid.cc.

665 {
666  (pi->ref)--;
667  if (pi->ref == 0)
668  {
669  if (pi->language==LANG_SINGULAR)
670  {
672  while (p!=NULL)
673  {
674  if (p->pi==pi && pi->ref <= 1)
675  {
676  Warn("`%s` in use, can not be killed",pi->procname);
677  return TRUE;
678  }
679  p=p->next;
680  }
681  }
682  if (pi->libname != NULL) // OB: ????
683  omFree((ADDRESS)pi->libname);
684  if (pi->procname != NULL) // OB: ????
685  omFree((ADDRESS)pi->procname);
686 
687  if( pi->language == LANG_SINGULAR)
688  {
689  if (pi->data.s.body != NULL) // OB: ????
690  omFree((ADDRESS)pi->data.s.body);
691  }
692  if( pi->language == LANG_C)
693  {
694  }
695  memset((void *) pi, 0, sizeof(procinfo));
696  //pi->language=LANG_NONE;
698  }
699  return FALSE;
700 }
Definition: fevoices.h:59
VAR Voice * currentVoice
Definition: fevoices.cc:47
@ LANG_SINGULAR
Definition: subexpr.h:22

◆ piProcinfo()

const char* piProcinfo ( procinfov  pi,
const char *  request 
)

Definition at line 640 of file ipid.cc.

641 {
642  if((pi == NULL)||(pi->language==LANG_NONE)) return "empty proc";
643  else if (strcmp(request, "libname") == 0) return pi->libname;
644  else if (strcmp(request, "procname") == 0) return pi->procname;
645  else if (strcmp(request, "type") == 0)
646  {
647  switch (pi->language)
648  {
649  case LANG_SINGULAR: return "singular"; break;
650  case LANG_C: return "object"; break;
651  case LANG_NONE: return "none"; break;
652  default: return "unknown language";
653  }
654  }
655  else if (strcmp(request, "ref") == 0)
656  {
657  char p[8];
658  sprintf(p, "%d", pi->ref);
659  return omStrDup(p); // MEMORY-LEAK
660  }
661  return "??";
662 }

Variable Documentation

◆ basePack

VAR package basePack = NULL

Definition at line 58 of file ipid.cc.

◆ basePackHdl

VAR idhdl basePackHdl = NULL

Definition at line 56 of file ipid.cc.

◆ coeffs_BIGINT

VAR coeffs coeffs_BIGINT

Definition at line 50 of file ipid.cc.

◆ currPack

VAR package currPack = NULL

Definition at line 57 of file ipid.cc.

◆ currPackHdl

VAR idhdl currPackHdl = NULL

Definition at line 55 of file ipid.cc.

◆ currRingHdl

VAR idhdl currRingHdl = NULL

Definition at line 59 of file ipid.cc.

◆ idrec_bin

VAR omBin idrec_bin = omGetSpecBin(sizeof(idrec))

Definition at line 48 of file ipid.cc.

◆ procstack

VAR proclevel* procstack =NULL

Definition at line 52 of file ipid.cc.

◆ sip_command_bin

VAR omBin sip_command_bin = omGetSpecBin(sizeof(sip_command))

Definition at line 45 of file ipid.cc.

◆ sip_package_bin

VAR omBin sip_package_bin = omGetSpecBin(sizeof(sip_package))

Definition at line 46 of file ipid.cc.