ipid.cc
Go to the documentation of this file.
1 /****************************************
2 * Computer Algebra System SINGULAR *
3 ****************************************/
4 
5 /*
6 * ABSTRACT: identfier handling
7 */
8 
9 
10 
11 
12 
13 #include <kernel/mod2.h>
14 
15 #include <omalloc/omalloc.h>
16 
17 #include <misc/options.h>
18 #include <misc/intvec.h>
19 
20 #include <coeffs/numbers.h>
21 #include <coeffs/bigintmat.h>
22 
23 #include <polys/matpol.h>
24 #include <polys/monomials/ring.h>
25 
26 #include <kernel/polys.h>
27 #include <kernel/ideals.h>
28 #include <kernel/GBEngine/syz.h>
29 
30 #include <Singular/tok.h>
31 #include <Singular/ipshell.h>
32 #include <Singular/fevoices.h>
33 #include <Singular/lists.h>
34 #include <Singular/attrib.h>
35 #include <Singular/links/silink.h>
36 #include <Singular/ipid.h>
37 #include <Singular/blackbox.h>
38 
39 #ifdef SINGULAR_4_1
40 #include <Singular/number2.h>
41 #endif
42 #ifdef HAVE_DYNAMIC_LOADING
43 #include <polys/mod_raw.h>
44 #endif /* HAVE_DYNAMIC_LOADING */
45 
46 #include <string.h>
47 
50 //omBin ip_package_bin = omGetSpecBin(sizeof(ip_package));
52 
54 
55 FILE *feFilePending; /*temp. storage for grammar.y */
56 
58 //idhdl idroot = NULL;
59 
62 package currPack =NULL;
63 package basePack =NULL;
65 const char* iiNoName="_";
66 
67 void paCleanUp(package pack);
68 
69 /*0 implementation*/
70 
71 int iiS2I(const char *s)
72 {
73  int i;
74  i=s[0];
75  if (s[1]!='\0')
76  {
77  i=(i<<8)+s[1];
78  if (s[2]!='\0')
79  {
80  i=(i<<8)+s[2];
81  if (s[3]!='\0')
82  {
83  i=(i<<8)+s[3];
84  }
85  }
86  }
87  return i;
88 }
89 
90 idhdl idrec::get(const char * s, int level)
91 {
92  assume(s!=NULL);
93  assume((level>=0) && (level<=1000)); //not really, but if it isnt in that bounds..
94  idhdl h = this;
96  int l;
97  const char *id_;
98  int i=iiS2I(s);
99  int less4=(i < (1<<24));
100  while (h!=NULL)
101  {
102  omCheckAddr((ADDRESS)IDID(h));
103  l=IDLEV(h);
104  if ((l==0)||(l==level))
105  {
106  if (i==h->id_i)
107  {
108  id_=IDID(h);
109  if (less4 || (0 == strcmp(s+4,id_+4)))
110  {
111  if (l==level) return h;
112  found=h;
113  }
114  }
115  }
116  h = IDNEXT(h);
117  }
118  return found;
119 }
120 
121 //idrec::~idrec()
122 //{
123 // if (id!=NULL)
124 // {
125 // omFree((ADDRESS)id);
126 // id=NULL;
127 // }
128 // /* much more !! */
129 //}
130 
131 void *idrecDataInit(int t)
132 {
133  switch (t)
134  {
135  //the type with init routines:
136 #ifdef SINGULAR_4_1
137  case CNUMBER_CMD:
138  return (void*)n2Init(0,NULL);
139  case CMATRIX_CMD:
140 #endif
141  case BIGINTMAT_CMD:
142  return (void *)new bigintmat();
143  case INTVEC_CMD:
144  case INTMAT_CMD:
145  return (void *)new intvec();
146  case NUMBER_CMD:
147  return (void *) nInit(0);
148  case BIGINT_CMD:
149  return (void *) n_Init(0, coeffs_BIGINT);
150  case IDEAL_CMD:
151  case MODUL_CMD:
152  case MATRIX_CMD:
153  return (void*) idInit(1,1);
154  case MAP_CMD:
155  {
156  map m = (map)idInit(1,1);
157  m->preimage = omStrDup(IDID(currRingHdl));
158  return (void *)m;
159  }
160  case STRING_CMD:
161  return (void *)omAlloc0(1);
162  case LIST_CMD:
163  {
165  l->Init();
166  return (void*)l;
167  }
168  //the types with the standard init: set the struct to zero
169  case LINK_CMD:
170  return (void*) omAlloc0Bin(sip_link_bin);
171  case RING_CMD:
172  return (void*) omAlloc0Bin(sip_sring_bin);
173  case PACKAGE_CMD:
174  {
175  package pa=(package)omAlloc0Bin(sip_package_bin);
176  pa->language=LANG_NONE;
177  pa->loaded = FALSE;
178  return (void*)pa;
179  }
180  case PROC_CMD:
181  {
183  pi->ref=1;
184  pi->language=LANG_NONE;
185  return (void*)pi;
186  }
187  case RESOLUTION_CMD:
188  return (void *)omAlloc0(sizeof(ssyStrategy));
189  //other types: without init (int,script,poly,def,package)
190  case CRING_CMD:
191  case INT_CMD:
192  case DEF_CMD:
193  case POLY_CMD:
194  case VECTOR_CMD:
195  case QRING_CMD:
196  return (void*)0L;
197  default:
198  {
199  if (t>MAX_TOK)
200  {
201 #ifdef BLACKBOX_DEVEL
202  Print("bb-type %d\n",t);
203 #endif
204  blackbox *bb=getBlackboxStuff(t);
205  if (bb!=NULL)
206  return (void *)bb->blackbox_Init(bb);
207  }
208  else
209  Werror("unknown type %d",t);
210  break;
211  }
212  }
213  return (void *)0L;
214 }
215 idhdl idrec::set(const char * s, int level, int t, BOOLEAN init)
216 {
217  //printf("define %s, %x, level: %d, typ: %d\n", s,s,level,t);
218  idhdl h = (idrec *)omAlloc0Bin(idrec_bin);
219  IDID(h) = s;
220  IDTYP(h) = t;
221  IDLEV(h) = level;
222  IDNEXT(h) = this;
223  BOOLEAN at_start=(this==IDROOT);
224  h->id_i=iiS2I(s);
225  if (init)
226  {
227  if ((t==IDEAL_CMD)||(t==MODUL_CMD))
228  IDFLAG(h) = Sy_bit(FLAG_STD);
229  IDSTRING(h)=(char *)idrecDataInit(t);
230  // additional settings:--------------------------------------
231 #if 0
232  // this leads to a memory leak
233  if (t == QRING_CMD)
234  {
235  // IDRING(h)=rCopy(currRing);
236  /* QRING_CMD is ring dep => currRing !=NULL */
237  }
238 #endif
239  }
240  // --------------------------------------------------------
241  if (at_start)
242  IDNEXT(h) = IDROOT;
243  return h;
244 }
245 
246 char * idrec::String(BOOLEAN typed)
247 {
248  sleftv tmp;
249  memset(&tmp,0,sizeof(sleftv));
250  tmp.rtyp=IDTYP(this);
251  tmp.data=IDDATA(this);
252  tmp.name=IDID(this);
253  return tmp.String(NULL, typed);
254 }
255 
256 idhdl enterid(const char * s, int lev, int t, idhdl* root, BOOLEAN init, BOOLEAN search)
257 {
258  if (s==NULL) return NULL;
259  if (root==NULL) return NULL;
260  idhdl h;
261  s=omStrDup(s);
262  // idhdl *save_root=root;
263  if (t==PACKAGE_CMD)
264  {
265  if (root!=&(basePack->idroot))
266  {
267  root=&(basePack->idroot);
268  }
269  }
270  // is it already defined in root ?
271  if ((h=(*root)->get(s,lev))!=NULL)
272  {
273  if (IDLEV(h)==lev)
274  {
275  if ((IDTYP(h) == t)||(t==DEF_CMD))
276  {
277  if ((IDTYP(h)==PACKAGE_CMD)
278  && (strcmp(s,"Top")==0))
279  {
280  goto errlabel;
281  }
282  if (BVERBOSE(V_REDEFINE))
283  Warn("redefining %s **",s);
284  if (s==IDID(h)) IDID(h)=NULL;
285  killhdl2(h,root,currRing);
286  }
287  else
288  goto errlabel;
289  }
290  }
291  // is it already defined in currRing->idroot ?
292  else if (search && (currRing!=NULL)&&((*root) != currRing->idroot))
293  {
294  if ((h=currRing->idroot->get(s,lev))!=NULL)
295  {
296  if (IDLEV(h)==lev)
297  {
298  if ((IDTYP(h) == t)||(t==DEF_CMD))
299  {
300  if (BVERBOSE(V_REDEFINE))
301  Warn("redefining %s **",s);
302  if (s==IDID(h)) IDID(h)=NULL;
303  killhdl2(h,&currRing->idroot,currRing);
304  }
305  else
306  goto errlabel;
307  }
308  }
309  }
310  // is it already defined in idroot ?
311  else if (search && (*root != IDROOT))
312  {
313  if ((h=IDROOT->get(s,lev))!=NULL)
314  {
315  if (IDLEV(h)==lev)
316  {
317  if ((IDTYP(h) == t)||(t==DEF_CMD))
318  {
319  if (BVERBOSE(V_REDEFINE))
320  Warn("redefining `%s` **",s);
321  if (s==IDID(h)) IDID(h)=NULL;
322  killhdl2(h,&IDROOT,NULL);
323  }
324  else
325  goto errlabel;
326  }
327  }
328  }
329  *root = (*root)->set(s, lev, t, init);
330 #ifndef SING_NDEBUG
331  checkall();
332 #endif
333  return *root;
334 
335  errlabel:
336  //Werror("identifier `%s` in use(lev h=%d,typ=%d,t=%d, curr=%d)",s,IDLEV(h),IDTYP(h),t,lev);
337  Werror("identifier `%s` in use",s);
338  //listall();
339  omFree((ADDRESS)s);
340  return NULL;
341 }
342 void killid(const char * id, idhdl * ih)
343 {
344  if (id!=NULL)
345  {
346  idhdl h = (*ih)->get(id,myynest);
347 
348  // id not found in global list, is it defined in current ring ?
349  if (h==NULL)
350  {
351  if ((currRing!=NULL) && (*ih != (currRing->idroot)))
352  {
353  h = currRing->idroot->get(id,myynest);
354  if (h!=NULL)
355  {
356  killhdl2(h,&(currRing->idroot),currRing);
357  return;
358  }
359  }
360  Werror("`%s` is not defined",id);
361  return;
362  }
363  killhdl2(h,ih,currRing);
364  }
365  else
366  Werror("kill what ?");
367 }
368 
369 void killhdl(idhdl h, package proot)
370 {
371  int t=IDTYP(h);
372  if (((BEGIN_RING<t) && (t<END_RING) && (t!=QRING_CMD))
373  || ((t==LIST_CMD) && (lRingDependend((lists)IDDATA(h)))))
374  killhdl2(h,&currRing->idroot,currRing);
375  else
376  {
377  if(t==PACKAGE_CMD)
378  {
379  killhdl2(h,&(basePack->idroot),NULL);
380  }
381  else
382  {
383  idhdl s=proot->idroot;
384  while ((s!=h) && (s!=NULL)) s=s->next;
385  if (s!=NULL)
386  killhdl2(h,&(proot->idroot),NULL);
387  else if (basePack!=proot)
388  {
389  idhdl s=basePack->idroot;
390  while ((s!=h) && (s!=NULL)) s=s->next;
391  if (s!=NULL)
392  killhdl2(h,&(basePack->idroot),currRing);
393  else
394  killhdl2(h,&(currRing->idroot),currRing);
395  }
396  }
397  }
398 }
399 
400 void killhdl2(idhdl h, idhdl * ih, ring r)
401 {
402  //printf("kill %s, id %x, typ %d lev: %d\n",IDID(h),(int)IDID(h),IDTYP(h),IDLEV(h));
403  idhdl hh;
404 
405  if (TEST_V_ALLWARN
406  && (IDLEV(h)!=myynest)
407  &&(IDLEV(h)==0))
408  {
409  if (((*ih)==basePack->idroot)
410  || ((currRing!=NULL)&&((*ih)==currRing->idroot)))
411  Warn("kill global `%s` at line >>%s<<\n",IDID(h),my_yylinebuf);
412  }
413  if (h->attribute!=NULL)
414  {
415  //h->attribute->killAll(r); MEMORY LEAK!
416  h->attribute=NULL;
417  }
418  if (IDTYP(h) == PACKAGE_CMD)
419  {
420  if (strcmp(IDID(h),"Top")==0)
421  {
422  WarnS("can not kill `Top`");
423  return;
424  }
425  // any objects defined for this package ?
426  if ((IDPACKAGE(h)->ref<=0) && (IDPACKAGE(h)->idroot!=NULL))
427  {
428  if (currPack==IDPACKAGE(h))
429  {
431  currPackHdl=NULL;
432  }
433  idhdl * hd = &IDRING(h)->idroot;
434  idhdl hdh = IDNEXT(*hd);
435  idhdl temp;
436  while (hdh!=NULL)
437  {
438  temp = IDNEXT(hdh);
439  killhdl2(hdh,&(IDPACKAGE(h)->idroot),NULL);
440  hdh = temp;
441  }
442  killhdl2(*hd,hd,NULL);
443  if (IDPACKAGE(h)->libname!=NULL) omFree((ADDRESS)(IDPACKAGE(h)->libname));
444  }
445  paKill(IDPACKAGE(h));
446  if (currPackHdl==h) currPackHdl=packFindHdl(currPack);
448  }
449  else if ((IDTYP(h)==RING_CMD)||(IDTYP(h)==QRING_CMD))
450  rKill(h);
451  else if (IDDATA(h)!=NULL)
452  s_internalDelete(IDTYP(h),IDDATA(h),r);
453  // general -------------------------------------------------------------
454  // now dechain it and delete idrec
455  if (IDID(h)!=NULL) // OB: ?????
456  omFree((ADDRESS)IDID(h));
457  IDID(h)=NULL;
458  IDDATA(h)=NULL;
459  if (h == (*ih))
460  {
461  // h is at the beginning of the list
462  *ih = IDNEXT(h) /* ==*ih */;
463  }
464  else if (ih!=NULL)
465  {
466  // h is somethere in the list:
467  hh = *ih;
468  loop
469  {
470  if (hh==NULL)
471  {
472  PrintS(">>?<< not found for kill\n");
473  return;
474  }
475  idhdl hhh = IDNEXT(hh);
476  if (hhh == h)
477  {
478  IDNEXT(hh) = IDNEXT(hhh);
479  break;
480  }
481  hh = hhh;
482  }
483  }
484  omFreeBin((ADDRESS)h, idrec_bin);
485 }
486 
487 idhdl ggetid(const char *n, BOOLEAN /*local*/, idhdl *packhdl)
488 {
489  idhdl h = IDROOT->get(n,myynest);
490  idhdl h2=NULL;
491  *packhdl = NULL;
492  if ((currRing!=NULL) && ((h==NULL)||(IDLEV(h)!=myynest)))
493  {
494  h2 = currRing->idroot->get(n,myynest);
495  }
496  if (h2==NULL) return h;
497  return h2;
498 }
499 
500 idhdl ggetid(const char *n)
501 {
502  idhdl h = IDROOT->get(n,myynest);
503  if ((h!=NULL)&&(IDLEV(h)==myynest)) return h;
504  idhdl h2=NULL;
505  if (currRing!=NULL)
506  {
507  h2 = currRing->idroot->get(n,myynest);
508  }
509  if (h2!=NULL) return h2;
510  if (h!=NULL) return h;
511  if (basePack!=currPack)
512  return basePack->idroot->get(n,myynest);
513  return NULL;
514 }
515 
517 {
518  if (hasFlag(h,FLAG_STD)) PrintS(" (SB)");
519 #ifdef HAVE_PLURAL
520  if (hasFlag(h,FLAG_TWOSTD)) PrintS(" (2SB)");
521 #endif
522 }
523 
525 {
526  idhdl h=root;
527  /* compute the length */
528  int l=0;
529  while (h!=NULL) { l++; h=IDNEXT(h); }
530  /* allocate list */
532  L->Init(l);
533  /* copy names */
534  h=root;
535  l=0;
536  while (h!=NULL)
537  {
538  /* list is initialized with 0 => no need to clear anything */
539  L->m[l].rtyp=STRING_CMD;
540  L->m[l].data=omStrDup(IDID(h));
541  l++;
542  h=IDNEXT(h);
543  }
544  return L;
545 }
546 
547 lists ipNameListLev(idhdl root, int lev)
548 {
549  idhdl h=root;
550  /* compute the length */
551  int l=0;
552  while (h!=NULL) { if (IDLEV(h)==lev) l++; h=IDNEXT(h); }
553  /* allocate list */
555  L->Init(l);
556  /* copy names */
557  h=root;
558  l=0;
559  while (h!=NULL)
560  {
561  if (IDLEV(h)==lev)
562  {
563  /* list is initialized with 0 => no need to clear anything */
564  L->m[l].rtyp=STRING_CMD;
565  L->m[l].data=omStrDup(IDID(h));
566  l++;
567  }
568  h=IDNEXT(h);
569  }
570  return L;
571 }
572 
573 /*
574 * move 'tomove' from root1 list to root2 list
575 */
576 static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
577 {
578  idhdl h;
579  /* search 'tomove' in root2 : if found -> do nothing */
580  h=root2;
581  while ((h!=NULL) && (h!=tomove)) h=IDNEXT(h);
582  if (h!=NULL) return FALSE; /*okay */
583  /* search predecessor of h in root1, remove 'tomove' */
584  h=root1;
585  if (tomove==h)
586  {
587  root1=IDNEXT(h);
588  }
589  else
590  {
591  while ((h!=NULL) && (IDNEXT(h)!=tomove)) h=IDNEXT(h);
592  if (h==NULL) return TRUE; /* not in the list root1 -> do nothing */
593  IDNEXT(h)=IDNEXT(tomove);
594  }
595  /* add to root2 list */
596  IDNEXT(tomove)=root2;
597  root2=tomove;
598  return FALSE;
599 }
600 
601 void ipMoveId(idhdl tomove)
602 {
603  if ((currRing!=NULL)&&(tomove!=NULL))
604  {
605  if (((QRING_CMD!=IDTYP(tomove)) && RingDependend(IDTYP(tomove)))
606  || ((IDTYP(tomove)==LIST_CMD) && (lRingDependend(IDLIST(tomove)))))
607  {
608  /*move 'tomove' to ring id's*/
609  if (ipSwapId(tomove,IDROOT,currRing->idroot))
610  ipSwapId(tomove,basePack->idroot,currRing->idroot);
611  }
612  else
613  {
614  /*move 'tomove' to global id's*/
615  ipSwapId(tomove,currRing->idroot,IDROOT);
616  }
617  }
618 }
619 
620 const char * piProcinfo(procinfov pi, const char *request)
621 {
622  if((pi == NULL)||(pi->language==LANG_NONE)) return "empty proc";
623  else if (strcmp(request, "libname") == 0) return pi->libname;
624  else if (strcmp(request, "procname") == 0) return pi->procname;
625  else if (strcmp(request, "type") == 0)
626  {
627  switch (pi->language)
628  {
629  case LANG_SINGULAR: return "singular"; break;
630  case LANG_C: return "object"; break;
631  case LANG_NONE: return "none"; break;
632  default: return "unknow language";
633  }
634  }
635  else if (strcmp(request, "ref") == 0)
636  {
637  char p[8];
638  sprintf(p, "%d", pi->ref);
639  return omStrDup(p); // MEMORY-LEAK
640  }
641  return "??";
642 }
643 
645 {
647  while (p!=NULL)
648  {
649  if (p->pi==pi && pi->ref <= 1)
650  {
651  Warn("`%s` in use, can not be killed",pi->procname);
652  return TRUE;
653  }
654  p=p->next;
655  }
656  (pi->ref)--;
657  if (pi->ref <= 0)
658  {
659  if (pi->libname != NULL) // OB: ????
660  omFree((ADDRESS)pi->libname);
661  if (pi->procname != NULL) // OB: ????
662  omFree((ADDRESS)pi->procname);
663 
664  if( pi->language == LANG_SINGULAR)
665  {
666  if (pi->data.s.body != NULL) // OB: ????
667  omFree((ADDRESS)pi->data.s.body);
668  }
669  if( pi->language == LANG_C)
670  {
671  }
672  memset((void *) pi, 0, sizeof(procinfo));
673  pi->language=LANG_NONE;
675  }
676  return FALSE;
677 }
678 
679 void paCleanUp(package pack)
680 {
681  (pack->ref)--;
682  if (pack->ref < 0)
683  {
684 #ifndef HAVE_STATIC
685  if( pack->language == LANG_C)
686  {
687  Print("//dlclose(%s)\n",pack->libname);
688 #ifdef HAVE_DYNAMIC_LOADING
689  dynl_close (pack->handle);
690 #endif /* HAVE_DYNAMIC_LOADING */
691  }
692 #endif /* HAVE_STATIC */
693  omFree((ADDRESS)pack->libname);
694  memset((void *) pack, 0, sizeof(sip_package));
695  pack->language=LANG_NONE;
696  }
697 }
698 
699 void proclevel::push(char *n)
700 {
701  //Print("push %s\n",n);
702  proclevel *p=(proclevel*)omAlloc0(sizeof(proclevel));
703  p->cRing=currRing;
705  p->name=n;
707  p->cPack=currPack;
708  p->next=this;
709  procstack=p;
710 }
712 {
713  //Print("pop %s\n",name);
714  //if (currRing!=::currRing) PrintS("currRing wrong\n");;
715  //::currRing=this->currRing;
716  //if (r==NULL) Print("set ring to NULL at lev %d(%s)\n",myynest,name);
717  //::currRingHdl=this->currRingHdl;
718  //if((::currRingHdl==NULL)||(IDRING(::currRingHdl)!=(::currRing)))
719  // ::currRingHdl=rFindHdl(::currRing,NULL,NULL);
720  //Print("restore pack=%s,1.obj=%s\n",IDID(currPackHdl),IDID(currPack->idroot));
721  currPackHdl=this->cPackHdl;
722  currPack=this->cPack;
724  proclevel *p=this;
725  procstack=next;
726  omFreeSize(p,sizeof(proclevel));
727 }
728 
730 {
731  idhdl h=basePack->idroot;
732  while (h!=NULL)
733  {
734  if ((IDTYP(h)==PACKAGE_CMD)
735  && (IDPACKAGE(h)==r))
736  return h;
737  h=IDNEXT(h);
738  }
739  return NULL;
740 }
741 
743 {
744  if (iiCurrArgs==NULL)
745  {
746  Werror("not enough arguments for proc %s",VoiceName());
747  p->CleanUp();
748  return TRUE;
749  }
751  iiCurrArgs=h->next;
752  h->next=NULL;
753  if (h->rtyp!=IDHDL)
754  {
755  BOOLEAN res=iiAssign(p,h);
756  h->CleanUp();
758  return res;
759  }
760  if ((h->Typ()!=p->Typ()) &&(p->Typ()!=DEF_CMD))
761  {
762  WerrorS("type mismatch");
763  return TRUE;
764  }
765  idhdl pp=(idhdl)p->data;
766  switch(pp->typ)
767  {
768 #ifdef SINGULAR_4_1
769  case CRING_CMD:
770  nKillChar((coeffs)pp);
771  break;
772 #endif
773  case DEF_CMD:
774  case INT_CMD:
775  break;
776  case INTVEC_CMD:
777  case INTMAT_CMD:
778  delete IDINTVEC(pp);
779  break;
780  case NUMBER_CMD:
781  nDelete(&IDNUMBER(pp));
782  break;
783  case BIGINT_CMD:
784  n_Delete(&IDNUMBER(pp),coeffs_BIGINT);
785  break;
786  case MAP_CMD:
787  {
788  map im = IDMAP(pp);
789  omFree((ADDRESS)im->preimage);
790  }
791  // continue as ideal:
792  case IDEAL_CMD:
793  case MODUL_CMD:
794  case MATRIX_CMD:
795  idDelete(&IDIDEAL(pp));
796  break;
797  case PROC_CMD:
798  case RESOLUTION_CMD:
799  case STRING_CMD:
800  omFree((ADDRESS)IDSTRING(pp));
801  break;
802  case LIST_CMD:
803  IDLIST(pp)->Clean();
804  break;
805  case LINK_CMD:
807  break;
808  // case ring: cannot happen
809  default:
810  Werror("unknown type %d",p->Typ());
811  return TRUE;
812  }
813  pp->typ=ALIAS_CMD;
814  IDDATA(pp)=(char*)h->data;
815  int eff_typ=h->Typ();
816  if ((RingDependend(eff_typ))
817  || ((eff_typ==LIST_CMD) && (lRingDependend((lists)h->Data()))))
818  {
819  ipSwapId(pp,IDROOT,currRing->idroot);
820  }
821  h->CleanUp();
823  return FALSE;
824 }
825 
void * idrecDataInit(int t)
Definition: ipid.cc:131
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
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
#define IDLIST(a)
Definition: ipid.h:136
ip_package * package
Definition: structs.h:46
void ipMoveId(idhdl tomove)
Definition: ipid.cc:601
const CanonicalForm int s
Definition: facAbsFact.cc:55
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
omBin sip_package_bin
Definition: ipid.cc:49
int level(const CanonicalForm &f)
omBin_t * omBin
Definition: omStructs.h:12
#define Print
Definition: emacs.cc:83
Definition: tok.h:85
#define IDLINK(a)
Definition: ipid.h:137
idhdl currPackHdl
Definition: ipid.cc:60
Definition: lists.h:22
#define IDINTVEC(a)
Definition: ipid.h:127
loop
Definition: myNF.cc:98
#define IDID(a)
Definition: ipid.h:121
#define FALSE
Definition: auxiliary.h:140
Compatiblity layer for legacy polynomial operations (over currRing)
void paCleanUp(package pack)
Definition: ipid.cc:679
Definition: tok.h:42
return P p
Definition: myNF.cc:203
Matrices of numbers.
Definition: bigintmat.h:32
void killid(const char *id, idhdl *ih)
Definition: ipid.cc:342
Definition: tok.h:167
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 omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define IDNEXT(a)
Definition: ipid.h:117
language_defs language
Definition: subexpr.h:58
proclevel * procstack
Definition: ipid.cc:57
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define IDROOT
Definition: ipid.h:20
int id_i
Definition: idrec.h:47
#define TRUE
Definition: auxiliary.h:144
#define IDIDEAL(a)
Definition: ipid.h:132
void * ADDRESS
Definition: auxiliary.h:161
short ref
Definition: subexpr.h:59
Definition: fevoices.h:57
void WerrorS(const char *s)
Definition: feFopen.cc:23
idhdl basePackHdl
Definition: ipid.cc:61
#define WarnS
Definition: emacs.cc:81
char * name
Definition: ipid.h:64
Voice * next
Definition: fevoices.h:60
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:955
idhdl cRingHdl
Definition: ipid.h:60
BOOLEAN piKill(procinfov pi)
Definition: ipid.cc:644
#define Sy_bit(x)
Definition: options.h:30
char * String(BOOLEAN typed=FALSE)
Definition: ipid.cc:246
void paKill(package pack)
Definition: ipid.h:51
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
poly pp
Definition: myNF.cc:296
idhdl get(const char *s, int lev)
Definition: ipid.cc:90
bool found
Definition: facFactorize.cc:56
omBin procinfo_bin
Definition: subexpr.cc:51
char * String(void *d=NULL, BOOLEAN typed=FALSE, int dim=1)
Called for conversion to string (used by string(..), write(..),..)
Definition: subexpr.cc:706
void ipListFlag(idhdl h)
Definition: ipid.cc:516
void * data
Definition: subexpr.h:89
char * procname
Definition: subexpr.h:56
poly res
Definition: myNF.cc:322
Definition: subexpr.h:20
#define IDPACKAGE(a)
Definition: ipid.h:138
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define IDTYP(a)
Definition: ipid.h:118
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:400
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:256
int RingDependend(int t)
Definition: gentable.cc:23
Definition: tok.h:56
static number2 n2Init(long i, coeffs c)
Definition: number2.h:17
char my_yylinebuf[80]
Definition: febase.cc:48
const ring r
Definition: syzextra.cc:208
#define FLAG_TWOSTD
Definition: ipid.h:109
Definition: intvec.h:16
char * libname
Definition: subexpr.h:55
idhdl cPackHdl
Definition: ipid.h:62
void rKill(ring r)
Definition: ipshell.cc:5690
const char * piProcinfo(procinfov pi, const char *request)
Definition: ipid.cc:620
omBin idrec_bin
Definition: ipid.cc:51
lists ipNameListLev(idhdl root, int lev)
Definition: ipid.cc:547
Definition: tok.h:58
Definition: ipid.h:56
procinfo * pi
Definition: fevoices.h:63
const char * name
Definition: subexpr.h:88
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:405
int search(const CFArray &A, const CanonicalForm &F, int i, int j)
search for F in A between index i and j
The main handler for Singular numbers which are suitable for Singular polynomials.
void checkall()
Definition: misc_ip.cc:1016
procinfodata data
Definition: subexpr.h:62
int iiS2I(const char *s)
Definition: ipid.cc:71
#define IDSTRING(a)
Definition: ipid.h:135
void s_internalDelete(const int t, void *d, const ring r)
Definition: subexpr.cc:464
idhdl currRingHdl
Definition: ipid.cc:64
omBin sip_sring_bin
Definition: ring.cc:54
int m
Definition: cfEzgcd.cc:119
proclevel * next
Definition: ipid.h:59
idrec * idhdl
Definition: ring.h:18
omBin sleftv_bin
Definition: subexpr.cc:50
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
lists ipNameList(idhdl root)
Definition: ipid.cc:524
idhdl next
Definition: idrec.h:38
Definition: tok.h:88
#define IDLEV(a)
Definition: ipid.h:120
const char * VoiceName()
Definition: fevoices.cc:66
#define nDelete(n)
Definition: numbers.h:16
#define IDMAP(a)
Definition: ipid.h:134
#define FLAG_STD
Definition: ipid.h:108
leftv next
Definition: subexpr.h:87
#define IDNUMBER(a)
Definition: ipid.h:131
FILE * feFilePending
Definition: ipid.cc:55
#define BVERBOSE(a)
Definition: options.h:33
INLINE_THIS void Init(int l=0)
Definition: lists.h:66
Definition: tok.h:38
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define omGetSpecBin(size)
Definition: omBin.h:11
#define pi
Definition: libparse.cc:1143
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
int dynl_close(void *handle)
Definition: mod_raw.cc:182
const char * iiNoName
Definition: ipid.cc:65
Definition: tok.h:95
#define NULL
Definition: omList.c:10
attr attribute
Definition: idrec.h:41
slists * lists
Definition: mpr_numeric.h:146
omBin sip_command_bin
Definition: ipid.cc:48
Voice * currentVoice
Definition: fevoices.cc:57
void killhdl(idhdl h, package proot)
Definition: ipid.cc:369
package basePack
Definition: ipid.cc:63
#define hasFlag(A, F)
Definition: ipid.h:111
BOOLEAN iiAlias(leftv p)
Definition: ipid.cc:742
#define IDRING(a)
Definition: ipid.h:126
package currPack
Definition: ipid.cc:62
ring cRing
Definition: ipid.h:61
leftv iiCurrArgs
Definition: ipshell.cc:84
int rtyp
Definition: subexpr.h:92
#define IDFLAG(a)
Definition: ipid.h:119
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
void * Data()
Definition: subexpr.cc:1097
int typ
Definition: idrec.h:43
Definition: tok.h:96
omBin slists_bin
Definition: lists.cc:23
Definition: tok.h:126
idhdl packFindHdl(package r)
Definition: ipid.cc:729
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:456
void iiCheckPack(package &p)
Definition: ipshell.cc:1504
#define IDDATA(a)
Definition: ipid.h:125
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
void push(char *)
Definition: ipid.cc:699
void pop()
Definition: ipid.cc:711
#define nInit(i)
Definition: numbers.h:24
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
package cPack
Definition: ipid.h:63
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
Definition: ipid.cc:576
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:488
#define V_REDEFINE
Definition: options.h:43
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
#define TEST_V_ALLWARN
Definition: options.h:135
idhdl set(const char *s, int lev, int t, BOOLEAN init=TRUE)
Definition: ipid.cc:215
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)
Definition: ipid.cc:487
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
procinfo * procinfov
Definition: structs.h:63
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:20
ListNode * next
Definition: janet.h:31
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1772
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263