My Project
Loading...
Searching...
No Matches
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)
 
static long iiS2I (const char *s)
 
voididrecDataInit (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 charpiProcinfo (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 281 of file ipid.cc.

282{
283 if (s==NULL) return NULL;
284 if (root==NULL) return NULL;
285 idhdl h;
286 s=omStrDup(s);
287 // idhdl *save_root=root;
288 if (t==PACKAGE_CMD)
289 {
290 if (root!=&(basePack->idroot))
291 {
292 root=&(basePack->idroot);
293 }
294 }
295 // is it already defined in root ?
296 if ((h=(*root)->get_level(s,lev))!=NULL)
297 {
298 if ((IDTYP(h) == t)||(t==DEF_CMD))
299 {
300 if (IDTYP(h)==PACKAGE_CMD)
301 {
302 if (strcmp(s,"Top")==0)
303 {
304 goto errlabel;
305 }
306 else return h;
307 }
308 else
309 {
310 if (BVERBOSE(V_REDEFINE))
311 {
312 const char *f=VoiceName();
313 if (strcmp(f,"STDIN")==0)
314 Warn("redefining %s (%s)",s,my_yylinebuf);
315 else
316 Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno);
317 }
318 if (s==IDID(h)) IDID(h)=NULL;
319 if((t!=PROC_CMD)||(IDPROC(h)->language!=LANG_C))
320 {
321 killhdl2(h,root,currRing);
322 }
323 }
324 }
325 else
326 goto errlabel;
327 }
328 // is it already defined in currRing->idroot ?
329 else if (search && (currRing!=NULL)&&((*root) != currRing->idroot))
330 {
331 if ((h=currRing->idroot->get_level(s,lev))!=NULL)
332 {
333 if ((IDTYP(h) == t)||(t==DEF_CMD))
334 {
335 if (BVERBOSE(V_REDEFINE))
336 {
337 const char *f=VoiceName();
338 if (strcmp(f,"STDIN")==0)
339 Warn("redefining %s (%s)",s,my_yylinebuf);
340 else
341 Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno);
342 }
343 if (s==IDID(h)) IDID(h)=NULL;
344 // proc is not ring-dep, no need to check for type "proc":
345 killhdl2(h,&currRing->idroot,currRing);
346 }
347 else
348 goto errlabel;
349 }
350 }
351 // is it already defined in idroot ?
352 else if (search && (*root != IDROOT))
353 {
354 if ((h=IDROOT->get_level(s,lev))!=NULL)
355 {
356 if ((IDTYP(h) == t)||(t==DEF_CMD))
357 {
358 if (BVERBOSE(V_REDEFINE))
359 {
360 const char *f=VoiceName();
361 if (strcmp(f,"STDIN")==0)
362 Warn("redefining %s (%s)",s,my_yylinebuf);
363 else
364 Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno);
365 }
366 if (s==IDID(h)) IDID(h)=NULL;
367 if((t!=PROC_CMD)||(IDPROC(h)->language!=LANG_C))
368 {
370 }
371 }
372 else
373 goto errlabel;
374 }
375 }
376 *root = (*root)->set(s, lev, t, init);
377#ifndef SING_NDEBUG
378 checkall();
379#endif
380 return *root;
381
382 errlabel:
383 //Werror("identifier `%s` in use(lev h=%d,typ=%d,t=%d, curr=%d)",s,IDLEV(h),IDTYP(h),t,lev);
384 Werror("identifier `%s` in use",s);
385 //listall();
387 return NULL;
388}
FILE * f
Definition checklibs.c:9
Definition idrec.h:35
idhdl set(const char *s, int lev, int t, BOOLEAN init=TRUE)
Definition ipid.cc:239
#define Warn
Definition emacs.cc:77
const CanonicalForm int s
Definition facAbsFact.cc:51
int search(const CFArray &A, const CanonicalForm &F, int i, int j)
search for F in A between index i and j
VAR int yylineno
Definition febase.cc:40
VAR char my_yylinebuf[80]
Definition febase.cc:44
const char * VoiceName()
Definition fevoices.cc:58
@ PROC_CMD
Definition grammar.cc:281
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition ipid.cc:447
VAR package basePack
Definition ipid.cc:58
#define IDPROC(a)
Definition ipid.h:140
#define IDID(a)
Definition ipid.h:122
#define IDROOT
Definition ipid.h:19
#define IDTYP(a)
Definition ipid.h:119
STATIC_VAR Poly * h
Definition janet.cc:971
#define omStrDup(s)
#define omFreeBinAddr(addr)
#define NULL
Definition omList.c:12
#define BVERBOSE(a)
Definition options.h:35
#define V_REDEFINE
Definition options.h:45
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
@ LANG_C
Definition subexpr.h:22
@ PACKAGE_CMD
Definition tok.h:150
@ DEF_CMD
Definition tok.h:58

◆ ggetid()

idhdl ggetid ( const char n)

Definition at line 583 of file ipid.cc.

584{
585 if (currRing!=NULL)
586 {
587 idhdl h2 = currRing->idroot->get(n,myynest);
588 if ((h2!=NULL)&&(IDLEV(h2)==myynest)) return h2;
589 idhdl h = IDROOT->get(n,myynest);
590 if (h!=NULL) return h;
591 if (h2!=NULL) return h2;
592 }
593 else
594 {
595 idhdl h = IDROOT->get(n,myynest);
596 if (h!=NULL) return h;
597 }
598 if (basePack!=currPack)
599 return basePack->idroot->get(n,myynest);
600 return NULL;
601}
VAR int myynest
Definition febase.cc:41
VAR package currPack
Definition ipid.cc:57
#define IDLEV(a)
Definition ipid.h:121

◆ idrecDataInit()

void * idrecDataInit ( int  t)

Definition at line 140 of file ipid.cc.

141{
142 switch (t)
143 {
144 //the type with init routines:
145#ifdef SINGULAR_4_2
146 case CNUMBER_CMD:
147 return (void*)n2Init(0,NULL);
148 case CPOLY_CMD:
149 return (void*)p2Init(0,NULL);
150 case CMATRIX_CMD:
151#endif
152 case BIGINTMAT_CMD:
153 return (void *)new bigintmat();
154 case BIGINTVEC_CMD:
155 return (void *)new bigintmat(1,0,coeffs_BIGINT);
156 case BUCKET_CMD:
157 if (currRing!=NULL)
158 return (void*)sBucketCreate(currRing);
159 else
160 {
161 WerrorS("need basering for polyBucket");
162 return NULL;
163 }
164 case INTVEC_CMD:
165 case INTMAT_CMD:
166 return (void *)new intvec();
167 case NUMBER_CMD:
168 {
169 if (currRing!=NULL) return (void *) nInit(0);
170 else return NULL;
171 }
172 case BIGINT_CMD:
173 return (void *) n_Init(0, coeffs_BIGINT);
174 case IDEAL_CMD:
175 case MODUL_CMD:
176 case MATRIX_CMD:
177 case SMATRIX_CMD:
178 return (void*) idInit(1,1);
179 case MAP_CMD:
180 {
181 map m = (map)idInit(1,1);
182 m->preimage = omStrDup(IDID(currRingHdl));
183 return (void *)m;
184 }
185 case STRING_CMD:
186 return (void *)omAlloc0(1);
187 case LIST_CMD:
188 {
190 l->Init();
191 return (void*)l;
192 }
193 //the types with the standard init: set the struct to zero
194 case LINK_CMD:
195 return (void*) omAlloc0Bin(sip_link_bin);
196 case PACKAGE_CMD:
197 {
198 package pa=(package)omAlloc0Bin(sip_package_bin);
199 pa->language=LANG_NONE;
200 pa->loaded = FALSE;
201 return (void*)pa;
202 }
203 case PROC_CMD:
204 {
206 pi->ref=1;
207 pi->language=LANG_NONE;
208 return (void*)pi;
209 }
210 case RESOLUTION_CMD:
211 return (void *)omAlloc0(sizeof(ssyStrategy));
212 //other types: without alloc. (int,script,poly,def,package,..)
213 case INT_CMD:
214 case DEF_CMD:
215 case POLY_CMD:
216 case VECTOR_CMD:
217 case RING_CMD:
218 case CRING_CMD:
219 case QRING_CMD:
220 return NULL;
221 default:
222 {
223 if (t>MAX_TOK)
224 {
225#ifdef BLACKBOX_DEVEL
226 Print("bb-type %d\n",t);
227#endif
229 if (bb!=NULL)
230 return (void *)bb->blackbox_Init(bb);
231 }
232 else
233 Werror("unknown type in idrecDataInit:%d",t);
234 break;
235 }
236 }
237 return (void *)0L;
238}
#define FALSE
Definition auxiliary.h:97
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition blackbox.cc:17
int l
Definition cfEzgcd.cc:100
int m
Definition cfEzgcd.cc:128
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Matrices of numbers.
Definition bigintmat.h:51
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:539
static BOOLEAN pa(leftv res, leftv args)
Definition cohomo.cc:3770
#define Print
Definition emacs.cc:80
void WerrorS(const char *s)
Definition feFopen.cc:24
@ IDEAL_CMD
Definition grammar.cc:285
@ MATRIX_CMD
Definition grammar.cc:287
@ BUCKET_CMD
Definition grammar.cc:284
@ BIGINTMAT_CMD
Definition grammar.cc:278
@ MAP_CMD
Definition grammar.cc:286
@ INTMAT_CMD
Definition grammar.cc:280
@ MODUL_CMD
Definition grammar.cc:288
@ SMATRIX_CMD
Definition grammar.cc:292
@ VECTOR_CMD
Definition grammar.cc:293
@ RESOLUTION_CMD
Definition grammar.cc:291
@ BIGINTVEC_CMD
Definition grammar.cc:279
@ NUMBER_CMD
Definition grammar.cc:289
@ POLY_CMD
Definition grammar.cc:290
@ RING_CMD
Definition grammar.cc:282
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
#define nInit(i)
Definition numbers.h:24
#define omAllocBin(bin)
#define omAlloc0Bin(bin)
#define omAlloc0(size)
sBucket_pt sBucketCreate(const ring r)
Definition sbuckets.cc:96
ideal idInit(int idsize, int rank)
initialise an ideal / module
procinfo * procinfov
Definition structs.h:56
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:160
@ STRING_CMD
Definition tok.h:187
@ CPOLY_CMD
Definition tok.h:48
@ INT_CMD
Definition tok.h:96
@ MAX_TOK
Definition tok.h:220

◆ iiAlias()

BOOLEAN iiAlias ( leftv  p)

Definition at line 846 of file ipid.cc.

847{
848 if (iiCurrArgs==NULL)
849 {
850 Werror("not enough arguments for proc %s",VoiceName());
851 p->CleanUp();
852 return TRUE;
853 }
855 iiCurrArgs=h->next;
856 h->next=NULL;
857 if (h->rtyp!=IDHDL)
858 {
860 h->CleanUp();
862 return res;
863 }
864 if ((h->Typ()!=p->Typ()) &&(p->Typ()!=DEF_CMD))
865 {
866 WerrorS("type mismatch");
867 return TRUE;
868 }
869 idhdl pp=(idhdl)p->data;
870 switch(pp->typ)
871 {
872 case CRING_CMD:
874 break;
875 case DEF_CMD:
876 case INT_CMD:
877 break;
878 case INTVEC_CMD:
879 case INTMAT_CMD:
880 delete IDINTVEC(pp);
881 break;
882 case NUMBER_CMD:
884 break;
885 case BIGINT_CMD:
887 break;
888 case MAP_CMD:
889 {
890 map im = IDMAP(pp);
891 omFreeBinAddr((ADDRESS)im->preimage);
892 im->preimage=NULL;// and continue
893 }
894 // continue as ideal:
895 case IDEAL_CMD:
896 case MODUL_CMD:
897 case MATRIX_CMD:
899 break;
900 case PROC_CMD:
901 case RESOLUTION_CMD:
902 case STRING_CMD:
904 break;
905 case LIST_CMD:
906 IDLIST(pp)->Clean();
907 break;
908 case LINK_CMD:
910 break;
911 // case ring: cannot happen
912 default:
913 {
914 int t=p->Typ();
915 if (t<MAX_TOK)
916 {
917 Werror("unknown type %d(%s)",t,Tok2Cmdname(t));
918 return TRUE;
919 }
920 /*else: blackbox type, not yet set*/
921 break;
922 }
923 }
924 pp->typ=ALIAS_CMD;
925 IDDATA(pp)=(char*)h->data;
926 int eff_typ=h->Typ();
928 || ((eff_typ==LIST_CMD) && (lRingDependend((lists)h->Data()))))
929 {
930 ipSwapId(pp,IDROOT,currRing->idroot);
931 }
932 h->CleanUp();
934 return FALSE;
935}
int BOOLEAN
Definition auxiliary.h:88
#define TRUE
Definition auxiliary.h:101
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition cf_gcd.cc:676
int p
Definition cfModGcd.cc:4086
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:459
void nKillChar(coeffs r)
undo all initialisations
Definition numbers.cc:556
CanonicalForm res
Definition facAbsFact.cc:60
const char * Tok2Cmdname(int tok)
Definition gentable.cc:137
static int RingDependend(int t)
Definition gentable.cc:23
#define idDelete(H)
delete an ideal
Definition ideals.h:29
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition ipassign.cc:2097
static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
Definition ipid.cc:681
#define IDMAP(a)
Definition ipid.h:135
#define IDSTRING(a)
Definition ipid.h:136
EXTERN_VAR omBin sleftv_bin
Definition ipid.h:145
#define IDDATA(a)
Definition ipid.h:126
#define IDINTVEC(a)
Definition ipid.h:128
#define IDLINK(a)
Definition ipid.h:138
#define IDIDEAL(a)
Definition ipid.h:133
#define IDNUMBER(a)
Definition ipid.h:132
#define IDLIST(a)
Definition ipid.h:137
VAR leftv iiCurrArgs
Definition ipshell.cc:80
BOOLEAN lRingDependend(lists L)
Definition lists.cc:222
The main handler for Singular numbers which are suitable for Singular polynomials.
#define nDelete(n)
Definition numbers.h:16
#define omFree(addr)
#define omFreeBin(addr, bin)
idrec * idhdl
Definition ring.h:21
#define IDHDL
Definition tok.h:31
@ ALIAS_CMD
Definition tok.h:34

◆ iiS2I()

static long iiS2I ( const char s)
inlinestatic

Definition at line 65 of file ipid.cc.

66{
67 long l;
68 strncpy((char*)&l,s,SIZEOF_LONG);
69 return l;
70}

◆ ipListFlag()

void ipListFlag ( idhdl  h)

Definition at line 621 of file ipid.cc.

622{
623 if (hasFlag(h,FLAG_STD)) PrintS(" (SB)");
624#ifdef HAVE_PLURAL
625 if (hasFlag(h,FLAG_TWOSTD)) PrintS(" (2SB)");
626#endif
627}
#define hasFlag(A, F)
Definition ipid.h:112
#define FLAG_TWOSTD
Definition ipid.h:107
#define FLAG_STD
Definition ipid.h:106
void PrintS(const char *s)
Definition reporter.cc:284

◆ ipMoveId()

void ipMoveId ( idhdl  tomove)

Definition at line 706 of file ipid.cc.

707{
708 if ((currRing!=NULL)&&(tomove!=NULL))
709 {
712 {
713 /*move 'tomove' to ring id's*/
714 if (ipSwapId(tomove,IDROOT,currRing->idroot))
715 ipSwapId(tomove,basePack->idroot,currRing->idroot);
716 }
717 else
718 {
719 /*move 'tomove' to global id's*/
721 }
722 }
723}

◆ ipNameList()

lists ipNameList ( idhdl  root)

Definition at line 629 of file ipid.cc.

630{
631 idhdl h=root;
632 /* compute the length */
633 int l=0;
634 while (h!=NULL) { l++; h=IDNEXT(h); }
635 /* allocate list */
637 L->Init(l);
638 /* copy names */
639 h=root;
640 l=0;
641 while (h!=NULL)
642 {
643 /* list is initialized with 0 => no need to clear anything */
644 L->m[l].rtyp=STRING_CMD;
645 L->m[l].data=omStrDup(IDID(h));
646 l++;
647 h=IDNEXT(h);
648 }
649 return L;
650}
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:118

◆ ipNameListLev()

lists ipNameListLev ( idhdl  root,
int  lev 
)

Definition at line 652 of file ipid.cc.

653{
654 idhdl h=root;
655 /* compute the length */
656 int l=0;
657 while (h!=NULL) { if (IDLEV(h)==lev) l++; h=IDNEXT(h); }
658 /* allocate list */
660 L->Init(l);
661 /* copy names */
662 h=root;
663 l=0;
664 while (h!=NULL)
665 {
666 if (IDLEV(h)==lev)
667 {
668 /* list is initialized with 0 => no need to clear anything */
669 L->m[l].rtyp=STRING_CMD;
670 L->m[l].data=omStrDup(IDID(h));
671 l++;
672 }
673 h=IDNEXT(h);
674 }
675 return L;
676}

◆ ipSwapId()

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

Definition at line 681 of file ipid.cc.

682{
683 idhdl h;
684 /* search 'tomove' in root2 : if found -> do nothing */
685 h=root2;
686 while ((h!=NULL) && (h!=tomove)) h=IDNEXT(h);
687 if (h!=NULL) return FALSE; /*okay */
688 /* search predecessor of h in root1, remove 'tomove' */
689 h=root1;
690 if (tomove==h)
691 {
692 root1=IDNEXT(h);
693 }
694 else
695 {
696 while ((h!=NULL) && (IDNEXT(h)!=tomove)) h=IDNEXT(h);
697 if (h==NULL) return TRUE; /* not in the list root1 -> do nothing */
699 }
700 /* add to root2 list */
703 return FALSE;
704}

◆ killhdl()

void killhdl ( idhdl  h,
package  proot 
)

Definition at line 416 of file ipid.cc.

417{
418 int t=IDTYP(h);
419 if (((BEGIN_RING<t) && (t<END_RING))
420 || ((t==LIST_CMD) && (lRingDependend((lists)IDDATA(h)))))
421 killhdl2(h,&currRing->idroot,currRing);
422 else
423 {
424 if(t==PACKAGE_CMD)
425 {
426 killhdl2(h,&(basePack->idroot),NULL);
427 }
428 else
429 {
430 idhdl s=proot->idroot;
431 while ((s!=h) && (s!=NULL)) s=s->next;
432 if (s!=NULL)
433 killhdl2(h,&(proot->idroot),NULL);
434 else if (basePack!=proot)
435 {
436 idhdl s=basePack->idroot;
437 while ((s!=h) && (s!=NULL)) s=s->next;
438 if (s!=NULL)
439 killhdl2(h,&(basePack->idroot),currRing);
440 else
441 killhdl2(h,&(currRing->idroot),currRing);
442 }
443 }
444 }
445}
@ END_RING
Definition grammar.cc:311
@ BEGIN_RING
Definition grammar.cc:283

◆ killhdl2()

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

Definition at line 447 of file ipid.cc.

448{
449 //printf("kill %s, id %x, typ %d lev: %d\n",IDID(h),(int)IDID(h),IDTYP(h),IDLEV(h));
450 idhdl hh;
451
453 && (IDLEV(h)!=myynest)
454 &&(IDLEV(h)==0))
455 {
456 if (((*ih)==basePack->idroot)
457 || ((currRing!=NULL)&&((*ih)==currRing->idroot)))
458 Warn("kill global `%s` at line >>%s<<\n",IDID(h),my_yylinebuf);
459 }
460 if (h->attribute!=NULL)
461 {
462 if ((IDTYP(h)==RING_CMD)&&(IDRING(h)!=r))
463 h->attribute->killAll(IDRING(h));
464 else
465 h->attribute->killAll(r);
466 h->attribute=NULL;
467 }
468 if (IDTYP(h) == PACKAGE_CMD)
469 {
470 if ((((IDPACKAGE(h)->language==LANG_C) ||(IDPACKAGE(h)->language==LANG_MIX))
471 &&(IDPACKAGE(h)->idroot!=NULL))
472 || (strcmp(IDID(h),"Top")==0))
473 {
474 Warn("cannot kill `%s`",IDID(h));
475 return;
476 }
477 // any objects defined for this package ?
478 if ((IDPACKAGE(h)->ref<=0) && (IDPACKAGE(h)->idroot!=NULL))
479 {
480 if (currPack==IDPACKAGE(h))
481 {
484 }
485 idhdl * hd = &IDRING(h)->idroot;
486 idhdl hdh = IDNEXT(*hd);
487 idhdl temp;
488 while (hdh!=NULL)
489 {
490 temp = IDNEXT(hdh);
491 killhdl2(hdh,&(IDPACKAGE(h)->idroot),NULL);
492 hdh = temp;
493 }
494 killhdl2(*hd,hd,NULL);
495 if (IDPACKAGE(h)->libname!=NULL) omFreeBinAddr((ADDRESS)(IDPACKAGE(h)->libname));
496 }
500 }
501 else if (IDTYP(h)==RING_CMD)
502 rKill(h);
503 else if (IDDATA(h)!=NULL)
505 IDDATA(h)=NULL;
506 // general -------------------------------------------------------------
507 // now dechain it and delete idrec
508 if (IDID(h)!=NULL) // OB: ?????
510 IDID(h)=NULL;
511 IDDATA(h)=NULL;
512 if (h == (*ih))
513 {
514 // h is at the beginning of the list
515 *ih = IDNEXT(h) /* ==*ih */;
516 }
517 else if (ih!=NULL)
518 {
519 // h is somethere in the list:
520 hh = *ih;
521 loop
522 {
523 if (hh==NULL)
524 {
525 PrintS(">>?<< not found for kill\n");
526 return;
527 }
528 idhdl hhh = IDNEXT(hh);
529 if (hhh == h)
530 {
531 IDNEXT(hh) = IDNEXT(hhh);
532 break;
533 }
534 hh = hhh;
535 }
536 }
538}
VAR omBin idrec_bin
Definition ipid.cc:48
VAR idhdl currPackHdl
Definition ipid.cc:55
idhdl packFindHdl(package r)
Definition ipid.cc:833
#define IDPACKAGE(a)
Definition ipid.h:139
void paKill(package pack)
Definition ipid.h:50
#define IDRING(a)
Definition ipid.h:127
void iiCheckPack(package &p)
Definition ipshell.cc:1621
void rKill(ring r)
Definition ipshell.cc:6164
#define TEST_V_ALLWARN
Definition options.h:145
#define loop
Definition structs.h:71
void s_internalDelete(const int t, void *d, const ring r)
Definition subexpr.cc:518
@ LANG_MIX
Definition subexpr.h:22

◆ killid()

void killid ( const char id,
idhdl ih 
)

Definition at line 389 of file ipid.cc.

390{
391 if (id!=NULL)
392 {
393 idhdl h = (*ih)->get(id,myynest);
394
395 // id not found in global list, is it defined in current ring ?
396 if (h==NULL)
397 {
398 if ((currRing!=NULL) && (*ih != (currRing->idroot)))
399 {
400 h = currRing->idroot->get(id,myynest);
401 if (h!=NULL)
402 {
403 killhdl2(h,&(currRing->idroot),currRing);
404 return;
405 }
406 }
407 Werror("`%s` is not defined",id);
408 return;
409 }
411 }
412 else
413 WerrorS("kill what ?");
414}

◆ packFindHdl()

idhdl packFindHdl ( package  r)

Definition at line 833 of file ipid.cc.

834{
835 idhdl h=basePack->idroot;
836 while (h!=NULL)
837 {
838 if ((IDTYP(h)==PACKAGE_CMD)
839 && (IDPACKAGE(h)==r))
840 return h;
841 h=IDNEXT(h);
842 }
843 return NULL;
844}

◆ paCleanUp()

void paCleanUp ( package  pack)

Definition at line 787 of file ipid.cc.

788{
789 (pack->ref)--;
790 if (pack->ref < 0)
791 {
792 if( pack->language == LANG_C)
793 {
794 Print("//dlclose(%s)\n",pack->libname);
795#ifdef HAVE_DYNAMIC_LOADING
796 dynl_close (pack->handle);
797#endif /* HAVE_DYNAMIC_LOADING */
798 }
799 omFreeBinAddr((ADDRESS)pack->libname);
800 memset((void *) pack, 0, sizeof(sip_package));
801 pack->language=LANG_NONE;
802 }
803}
int dynl_close(void *handle)
Definition mod_raw.cc:170

◆ piKill()

BOOLEAN piKill ( procinfov  pi)

Definition at line 749 of file ipid.cc.

750{
751 (pi->ref)--;
752 if (pi->ref == 0)
753 {
754 if (pi->language==LANG_SINGULAR)
755 {
757 while (p!=NULL)
758 {
759 if (p->pi==pi && pi->ref <= 1)
760 {
761 Warn("`%s` in use, can not be killed",pi->procname);
762 return TRUE;
763 }
764 p=p->next;
765 }
766 }
767 if (pi->libname != NULL) // OB: ????
768 omFreeBinAddr((ADDRESS)pi->libname);
769 if (pi->procname != NULL) // OB: ????
770 omFreeBinAddr((ADDRESS)pi->procname);
771
772 if( pi->language == LANG_SINGULAR)
773 {
774 if (pi->data.s.body != NULL) // OB: ????
775 omFree((ADDRESS)pi->data.s.body);
776 }
777 if( pi->language == LANG_C)
778 {
779 }
780 memset((void *) pi, 0, sizeof(procinfo));
781 //pi->language=LANG_NONE;
783 }
784 return FALSE;
785}
VAR Voice * currentVoice
Definition fevoices.cc:49
@ LANG_SINGULAR
Definition subexpr.h:22

◆ piProcinfo()

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

Definition at line 725 of file ipid.cc.

726{
727 if((pi == NULL)||(pi->language==LANG_NONE)) return "empty proc";
728 else if (strcmp(request, "libname") == 0) return pi->libname;
729 else if (strcmp(request, "procname") == 0) return pi->procname;
730 else if (strcmp(request, "type") == 0)
731 {
732 switch (pi->language)
733 {
734 case LANG_SINGULAR: return "singular"; break;
735 case LANG_C: return "object"; break;
736 case LANG_NONE: return "none"; break;
737 default: return "unknown language";
738 }
739 }
740 else if (strcmp(request, "ref") == 0)
741 {
742 char p[8];
743 snprintf(p,8, "%d", pi->ref);
744 return omStrDup(p); // MEMORY-LEAK
745 }
746 return "??";
747}

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

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.