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)
 
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 258 of file ipid.cc.

259{
260 if (s==NULL) return NULL;
261 if (root==NULL) return NULL;
262 idhdl h;
263 s=omStrDup(s);
264 // idhdl *save_root=root;
265 if (t==PACKAGE_CMD)
266 {
267 if (root!=&(basePack->idroot))
268 {
269 root=&(basePack->idroot);
270 }
271 }
272 // is it already defined in root ?
273 if ((h=(*root)->get_level(s,lev))!=NULL)
274 {
275 if ((IDTYP(h) == t)||(t==DEF_CMD))
276 {
277 if (IDTYP(h)==PACKAGE_CMD)
278 {
279 if (strcmp(s,"Top")==0)
280 {
281 goto errlabel;
282 }
283 else return h;
284 }
285 else
286 {
287 if (BVERBOSE(V_REDEFINE))
288 {
289 const char *f=VoiceName();
290 if (strcmp(f,"STDIN")==0)
291 Warn("redefining %s (%s)",s,my_yylinebuf);
292 else
293 Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno);
294 }
295 if (s==IDID(h)) IDID(h)=NULL;
296 if((t!=PROC_CMD)||(IDPROC(h)->language!=LANG_C))
297 {
298 killhdl2(h,root,currRing);
299 }
300 }
301 }
302 else
303 goto errlabel;
304 }
305 // is it already defined in currRing->idroot ?
306 else if (search && (currRing!=NULL)&&((*root) != currRing->idroot))
307 {
308 if ((h=currRing->idroot->get_level(s,lev))!=NULL)
309 {
310 if ((IDTYP(h) == t)||(t==DEF_CMD))
311 {
312 if (BVERBOSE(V_REDEFINE))
313 {
314 const char *f=VoiceName();
315 if (strcmp(f,"STDIN")==0)
316 Warn("redefining %s (%s)",s,my_yylinebuf);
317 else
318 Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno);
319 }
320 if (s==IDID(h)) IDID(h)=NULL;
321 // proc is not ring-dep, no need to check for type "proc":
322 killhdl2(h,&currRing->idroot,currRing);
323 }
324 else
325 goto errlabel;
326 }
327 }
328 // is it already defined in idroot ?
329 else if (search && (*root != IDROOT))
330 {
331 if ((h=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 if((t!=PROC_CMD)||(IDPROC(h)->language!=LANG_C))
345 {
347 }
348 }
349 else
350 goto errlabel;
351 }
352 }
353 *root = (*root)->set(s, lev, t, init);
354#ifndef SING_NDEBUG
355 checkall();
356#endif
357 return *root;
358
359 errlabel:
360 //Werror("identifier `%s` in use(lev h=%d,typ=%d,t=%d, curr=%d)",s,IDLEV(h),IDTYP(h),t,lev);
361 Werror("identifier `%s` in use",s);
362 //listall();
364 return NULL;
365}
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:217
#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:424
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 560 of file ipid.cc.

561{
562 if (currRing!=NULL)
563 {
564 idhdl h2 = currRing->idroot->get(n,myynest);
565 if ((h2!=NULL)&&(IDLEV(h2)==myynest)) return h2;
566 idhdl h = IDROOT->get(n,myynest);
567 if (h!=NULL) return h;
568 if (h2!=NULL) return h2;
569 }
570 else
571 {
572 idhdl h = IDROOT->get(n,myynest);
573 if (h!=NULL) return h;
574 }
575 if (basePack!=currPack)
576 return basePack->idroot->get(n,myynest);
577 return NULL;
578}
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 118 of file ipid.cc.

119{
120 switch (t)
121 {
122 //the type with init routines:
123#ifdef SINGULAR_4_2
124 case CNUMBER_CMD:
125 return (void*)n2Init(0,NULL);
126 case CPOLY_CMD:
127 return (void*)p2Init(0,NULL);
128 case CMATRIX_CMD:
129#endif
130 case BIGINTMAT_CMD:
131 return (void *)new bigintmat();
132 case BIGINTVEC_CMD:
133 return (void *)new bigintmat(1,0,coeffs_BIGINT);
134 case BUCKET_CMD:
135 if (currRing!=NULL)
136 return (void*)sBucketCreate(currRing);
137 else
138 {
139 WerrorS("need basering for polyBucket");
140 return NULL;
141 }
142 case INTVEC_CMD:
143 case INTMAT_CMD:
144 return (void *)new intvec();
145 case NUMBER_CMD:
146 {
147 if (currRing!=NULL) return (void *) nInit(0);
148 else return NULL;
149 }
150 case BIGINT_CMD:
151 return (void *) n_Init(0, coeffs_BIGINT);
152 case IDEAL_CMD:
153 case MODUL_CMD:
154 case MATRIX_CMD:
155 case SMATRIX_CMD:
156 return (void*) idInit(1,1);
157 case MAP_CMD:
158 {
159 map m = (map)idInit(1,1);
160 m->preimage = omStrDup(IDID(currRingHdl));
161 return (void *)m;
162 }
163 case STRING_CMD:
164 return (void *)omAlloc0(1);
165 case LIST_CMD:
166 {
168 l->Init();
169 return (void*)l;
170 }
171 //the types with the standard init: set the struct to zero
172 case LINK_CMD:
173 return (void*) omAlloc0Bin(sip_link_bin);
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 alloc. (int,script,poly,def,package,..)
191 case INT_CMD:
192 case DEF_CMD:
193 case POLY_CMD:
194 case VECTOR_CMD:
195 case RING_CMD:
196 case CRING_CMD:
197 case QRING_CMD:
198 return NULL;
199 default:
200 {
201 if (t>MAX_TOK)
202 {
203#ifdef BLACKBOX_DEVEL
204 Print("bb-type %d\n",t);
205#endif
207 if (bb!=NULL)
208 return (void *)bb->blackbox_Init(bb);
209 }
210 else
211 Werror("unknown type in idrecDataInit:%d",t);
212 break;
213 }
214 }
215 return (void *)0L;
216}
#define FALSE
Definition auxiliary.h:96
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:542
static BOOLEAN pa(leftv res, leftv args)
Definition cohomo.cc:3722
#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:60
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 823 of file ipid.cc.

824{
825 if (iiCurrArgs==NULL)
826 {
827 Werror("not enough arguments for proc %s",VoiceName());
828 p->CleanUp();
829 return TRUE;
830 }
832 iiCurrArgs=h->next;
833 h->next=NULL;
834 if (h->rtyp!=IDHDL)
835 {
837 h->CleanUp();
839 return res;
840 }
841 if ((h->Typ()!=p->Typ()) &&(p->Typ()!=DEF_CMD))
842 {
843 WerrorS("type mismatch");
844 return TRUE;
845 }
846 idhdl pp=(idhdl)p->data;
847 switch(pp->typ)
848 {
849 case CRING_CMD:
851 break;
852 case DEF_CMD:
853 case INT_CMD:
854 break;
855 case INTVEC_CMD:
856 case INTMAT_CMD:
857 delete IDINTVEC(pp);
858 break;
859 case NUMBER_CMD:
861 break;
862 case BIGINT_CMD:
864 break;
865 case MAP_CMD:
866 {
867 map im = IDMAP(pp);
868 omFreeBinAddr((ADDRESS)im->preimage);
869 im->preimage=NULL;// and continue
870 }
871 // continue as ideal:
872 case IDEAL_CMD:
873 case MODUL_CMD:
874 case MATRIX_CMD:
876 break;
877 case PROC_CMD:
878 case RESOLUTION_CMD:
879 case STRING_CMD:
881 break;
882 case LIST_CMD:
883 IDLIST(pp)->Clean();
884 break;
885 case LINK_CMD:
887 break;
888 // case ring: cannot happen
889 default:
890 Werror("unknown type %d",p->Typ());
891 return TRUE;
892 }
893 pp->typ=ALIAS_CMD;
894 IDDATA(pp)=(char*)h->data;
895 int eff_typ=h->Typ();
897 || ((eff_typ==LIST_CMD) && (lRingDependend((lists)h->Data()))))
898 {
899 ipSwapId(pp,IDROOT,currRing->idroot);
900 }
901 h->CleanUp();
903 return FALSE;
904}
int BOOLEAN
Definition auxiliary.h:87
#define TRUE
Definition auxiliary.h:100
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:574
CanonicalForm res
Definition facAbsFact.cc:60
static 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:2034
static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
Definition ipid.cc:658
#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

◆ ipListFlag()

void ipListFlag ( idhdl h)

Definition at line 598 of file ipid.cc.

599{
600 if (hasFlag(h,FLAG_STD)) PrintS(" (SB)");
601#ifdef HAVE_PLURAL
602 if (hasFlag(h,FLAG_TWOSTD)) PrintS(" (2SB)");
603#endif
604}
#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 683 of file ipid.cc.

684{
685 if ((currRing!=NULL)&&(tomove!=NULL))
686 {
689 {
690 /*move 'tomove' to ring id's*/
691 if (ipSwapId(tomove,IDROOT,currRing->idroot))
692 ipSwapId(tomove,basePack->idroot,currRing->idroot);
693 }
694 else
695 {
696 /*move 'tomove' to global id's*/
698 }
699 }
700}

◆ ipNameList()

lists ipNameList ( idhdl root)

Definition at line 606 of file ipid.cc.

607{
608 idhdl h=root;
609 /* compute the length */
610 int l=0;
611 while (h!=NULL) { l++; h=IDNEXT(h); }
612 /* allocate list */
614 L->Init(l);
615 /* copy names */
616 h=root;
617 l=0;
618 while (h!=NULL)
619 {
620 /* list is initialized with 0 => no need to clear anything */
621 L->m[l].rtyp=STRING_CMD;
622 L->m[l].data=omStrDup(IDID(h));
623 l++;
624 h=IDNEXT(h);
625 }
626 return L;
627}
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 629 of file ipid.cc.

630{
631 idhdl h=root;
632 /* compute the length */
633 int l=0;
634 while (h!=NULL) { if (IDLEV(h)==lev) 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 if (IDLEV(h)==lev)
644 {
645 /* list is initialized with 0 => no need to clear anything */
646 L->m[l].rtyp=STRING_CMD;
647 L->m[l].data=omStrDup(IDID(h));
648 l++;
649 }
650 h=IDNEXT(h);
651 }
652 return L;
653}

◆ ipSwapId()

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

Definition at line 658 of file ipid.cc.

659{
660 idhdl h;
661 /* search 'tomove' in root2 : if found -> do nothing */
662 h=root2;
663 while ((h!=NULL) && (h!=tomove)) h=IDNEXT(h);
664 if (h!=NULL) return FALSE; /*okay */
665 /* search predecessor of h in root1, remove 'tomove' */
666 h=root1;
667 if (tomove==h)
668 {
669 root1=IDNEXT(h);
670 }
671 else
672 {
673 while ((h!=NULL) && (IDNEXT(h)!=tomove)) h=IDNEXT(h);
674 if (h==NULL) return TRUE; /* not in the list root1 -> do nothing */
676 }
677 /* add to root2 list */
680 return FALSE;
681}

◆ killhdl()

void killhdl ( idhdl h,
package proot )

Definition at line 393 of file ipid.cc.

394{
395 int t=IDTYP(h);
396 if (((BEGIN_RING<t) && (t<END_RING))
397 || ((t==LIST_CMD) && (lRingDependend((lists)IDDATA(h)))))
398 killhdl2(h,&currRing->idroot,currRing);
399 else
400 {
401 if(t==PACKAGE_CMD)
402 {
403 killhdl2(h,&(basePack->idroot),NULL);
404 }
405 else
406 {
407 idhdl s=proot->idroot;
408 while ((s!=h) && (s!=NULL)) s=s->next;
409 if (s!=NULL)
410 killhdl2(h,&(proot->idroot),NULL);
411 else if (basePack!=proot)
412 {
413 idhdl s=basePack->idroot;
414 while ((s!=h) && (s!=NULL)) s=s->next;
415 if (s!=NULL)
416 killhdl2(h,&(basePack->idroot),currRing);
417 else
418 killhdl2(h,&(currRing->idroot),currRing);
419 }
420 }
421 }
422}
@ END_RING
Definition grammar.cc:311
@ BEGIN_RING
Definition grammar.cc:283

◆ killhdl2()

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

Definition at line 424 of file ipid.cc.

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

◆ killid()

void killid ( const char * id,
idhdl * ih )

Definition at line 366 of file ipid.cc.

367{
368 if (id!=NULL)
369 {
370 idhdl h = (*ih)->get(id,myynest);
371
372 // id not found in global list, is it defined in current ring ?
373 if (h==NULL)
374 {
375 if ((currRing!=NULL) && (*ih != (currRing->idroot)))
376 {
377 h = currRing->idroot->get(id,myynest);
378 if (h!=NULL)
379 {
380 killhdl2(h,&(currRing->idroot),currRing);
381 return;
382 }
383 }
384 Werror("`%s` is not defined",id);
385 return;
386 }
388 }
389 else
390 WerrorS("kill what ?");
391}

◆ packFindHdl()

idhdl packFindHdl ( package r)

Definition at line 810 of file ipid.cc.

811{
812 idhdl h=basePack->idroot;
813 while (h!=NULL)
814 {
815 if ((IDTYP(h)==PACKAGE_CMD)
816 && (IDPACKAGE(h)==r))
817 return h;
818 h=IDNEXT(h);
819 }
820 return NULL;
821}

◆ paCleanUp()

void paCleanUp ( package pack)

Definition at line 764 of file ipid.cc.

765{
766 (pack->ref)--;
767 if (pack->ref < 0)
768 {
769 if( pack->language == LANG_C)
770 {
771 Print("//dlclose(%s)\n",pack->libname);
772#ifdef HAVE_DYNAMIC_LOADING
773 dynl_close (pack->handle);
774#endif /* HAVE_DYNAMIC_LOADING */
775 }
776 omFreeBinAddr((ADDRESS)pack->libname);
777 memset((void *) pack, 0, sizeof(sip_package));
778 pack->language=LANG_NONE;
779 }
780}
int dynl_close(void *handle)
Definition mod_raw.cc:170

◆ piKill()

BOOLEAN piKill ( procinfov pi)

Definition at line 726 of file ipid.cc.

727{
728 (pi->ref)--;
729 if (pi->ref == 0)
730 {
731 if (pi->language==LANG_SINGULAR)
732 {
734 while (p!=NULL)
735 {
736 if (p->pi==pi && pi->ref <= 1)
737 {
738 Warn("`%s` in use, can not be killed",pi->procname);
739 return TRUE;
740 }
741 p=p->next;
742 }
743 }
744 if (pi->libname != NULL) // OB: ????
745 omFreeBinAddr((ADDRESS)pi->libname);
746 if (pi->procname != NULL) // OB: ????
747 omFreeBinAddr((ADDRESS)pi->procname);
748
749 if( pi->language == LANG_SINGULAR)
750 {
751 if (pi->data.s.body != NULL) // OB: ????
752 omFree((ADDRESS)pi->data.s.body);
753 }
754 if( pi->language == LANG_C)
755 {
756 }
757 memset((void *) pi, 0, sizeof(procinfo));
758 //pi->language=LANG_NONE;
760 }
761 return FALSE;
762}
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 702 of file ipid.cc.

703{
704 if((pi == NULL)||(pi->language==LANG_NONE)) return "empty proc";
705 else if (strcmp(request, "libname") == 0) return pi->libname;
706 else if (strcmp(request, "procname") == 0) return pi->procname;
707 else if (strcmp(request, "type") == 0)
708 {
709 switch (pi->language)
710 {
711 case LANG_SINGULAR: return "singular"; break;
712 case LANG_C: return "object"; break;
713 case LANG_NONE: return "none"; break;
714 default: return "unknown language";
715 }
716 }
717 else if (strcmp(request, "ref") == 0)
718 {
719 char p[8];
720 snprintf(p,8, "%d", pi->ref);
721 return omStrDup(p); // MEMORY-LEAK
722 }
723 return "??";
724}

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.