My Project  UNKNOWN_GIT_VERSION
Data Structures | Macros | Typedefs | Functions | Variables
ipid.h File Reference
#include "Singular/idrec.h"
#include "Singular/subexpr.h"
#include "Singular/lists.h"

Go to the source code of this file.

Data Structures

struct  ip_command
 
struct  ip_package
 
class  proclevel
 
struct  SModulFunctions
 
struct  soptionStruct
 

Macros

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

Typedefs

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

Functions

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

Variables

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

Data Structure Documentation

◆ sip_command

struct sip_command

Definition at line 24 of file ipid.h.

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

◆ sip_package

struct sip_package

Definition at line 33 of file ipid.h.

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

◆ soptionStruct

struct soptionStruct

Definition at line 145 of file ipid.h.

Data Fields
const char * name
unsigned resetval
unsigned setval

Macro Definition Documentation

◆ FLAG_QRING

#define FLAG_QRING   4

Definition at line 106 of file ipid.h.

◆ FLAG_STD

#define FLAG_STD   0

Definition at line 104 of file ipid.h.

◆ FLAG_TWOSTD

#define FLAG_TWOSTD   3

Definition at line 105 of file ipid.h.

◆ hasFlag

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

Definition at line 107 of file ipid.h.

◆ IDATTR

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

Definition at line 118 of file ipid.h.

◆ IDBIGINT

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

Definition at line 126 of file ipid.h.

◆ IDBIMAT

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

Definition at line 124 of file ipid.h.

◆ IDDATA

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

Definition at line 121 of file ipid.h.

◆ IDFLAG

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

Definition at line 115 of file ipid.h.

◆ IDID

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

Definition at line 117 of file ipid.h.

◆ IDIDEAL

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

Definition at line 128 of file ipid.h.

◆ IDINT

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

Definition at line 120 of file ipid.h.

◆ IDINTVEC

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

Definition at line 123 of file ipid.h.

◆ IDLEV

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

Definition at line 116 of file ipid.h.

◆ IDLINK

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

Definition at line 133 of file ipid.h.

◆ IDLIST

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

Definition at line 132 of file ipid.h.

◆ IDMAP

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

Definition at line 130 of file ipid.h.

◆ IDMATRIX

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

Definition at line 129 of file ipid.h.

◆ IDNEXT

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

Definition at line 113 of file ipid.h.

◆ IDNUMBER

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

Definition at line 127 of file ipid.h.

◆ IDPACKAGE

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

Definition at line 134 of file ipid.h.

◆ IDPOLY

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

Definition at line 125 of file ipid.h.

◆ IDPROC

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

Definition at line 135 of file ipid.h.

◆ IDRING

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

Definition at line 122 of file ipid.h.

◆ IDROOT

#define IDROOT   (currPack->idroot)

Definition at line 18 of file ipid.h.

◆ IDSTRING

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

Definition at line 131 of file ipid.h.

◆ IDTYP

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

Definition at line 114 of file ipid.h.

◆ resetFlag

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

Definition at line 109 of file ipid.h.

◆ setFlag

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

Definition at line 108 of file ipid.h.

Typedef Documentation

◆ command

typedef ip_command* command

Definition at line 22 of file ipid.h.

◆ SModulFunc_t

typedef int(* SModulFunc_t) (SModulFunctions *)

Definition at line 80 of file ipid.h.

Function Documentation

◆ checkPackage()

BOOLEAN checkPackage ( package  pack)

◆ enterid()

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

Definition at line 267 of file ipid.cc.

268 {
269  if (s==NULL) return NULL;
270  if (root==NULL) return NULL;
271  idhdl h;
272  s=omStrDup(s);
273  // idhdl *save_root=root;
274  if (t==PACKAGE_CMD)
275  {
276  if (root!=&(basePack->idroot))
277  {
278  root=&(basePack->idroot);
279  }
280  }
281  // is it already defined in root ?
282  if ((h=(*root)->get(s,lev))!=NULL)
283  {
284  if (IDLEV(h)==lev)
285  {
286  if ((IDTYP(h) == t)||(t==DEF_CMD))
287  {
288  if (IDTYP(h)==PACKAGE_CMD)
289  {
290  if (strcmp(s,"Top")==0)
291  {
292  goto errlabel;
293  }
294  else return h;
295  }
296  else
297  {
298  if (BVERBOSE(V_REDEFINE))
299  Warn("redefining %s (%s)",s,my_yylinebuf);
300  if (s==IDID(h)) IDID(h)=NULL;
301  killhdl2(h,root,currRing);
302  }
303  }
304  else
305  goto errlabel;
306  }
307  }
308  // is it already defined in currRing->idroot ?
309  else if (search && (currRing!=NULL)&&((*root) != currRing->idroot))
310  {
311  if ((h=currRing->idroot->get(s,lev))!=NULL)
312  {
313  if (IDLEV(h)==lev)
314  {
315  if ((IDTYP(h) == t)||(t==DEF_CMD))
316  {
317  if (BVERBOSE(V_REDEFINE))
318  Warn("redefining %s (%s)",s,my_yylinebuf);
319  if (s==IDID(h)) IDID(h)=NULL;
320  killhdl2(h,&currRing->idroot,currRing);
321  }
322  else
323  goto errlabel;
324  }
325  }
326  }
327  // is it already defined in idroot ?
328  else if (search && (*root != IDROOT))
329  {
330  if ((h=IDROOT->get(s,lev))!=NULL)
331  {
332  if (IDLEV(h)==lev)
333  {
334  if ((IDTYP(h) == t)||(t==DEF_CMD))
335  {
336  if (BVERBOSE(V_REDEFINE))
337  Warn("redefining %s (%s)",s,my_yylinebuf);
338  if (s==IDID(h)) IDID(h)=NULL;
339  killhdl2(h,&IDROOT,NULL);
340  }
341  else
342  goto errlabel;
343  }
344  }
345  }
346  *root = (*root)->set(s, lev, t, init);
347 #ifndef SING_NDEBUG
348  checkall();
349 #endif
350  return *root;
351 
352  errlabel:
353  //Werror("identifier `%s` in use(lev h=%d,typ=%d,t=%d, curr=%d)",s,IDLEV(h),IDTYP(h),t,lev);
354  Werror("identifier `%s` in use",s);
355  //listall();
356  omFree((ADDRESS)s);
357  return NULL;
358 }

◆ ggetid()

idhdl ggetid ( const char *  n)

Definition at line 523 of file ipid.cc.

524 {
525  idhdl h = IDROOT->get(n,myynest);
526  if ((h!=NULL)&&(IDLEV(h)==myynest)) return h;
527  if (currRing!=NULL)
528  {
529  idhdl h2 = currRing->idroot->get(n,myynest);
530  if (h2!=NULL) return h2;
531  }
532  if (h!=NULL) return h;
533  if (basePack!=currPack)
534  return basePack->idroot->get(n,myynest);
535  return NULL;
536 }

◆ idrecDataInit()

void* idrecDataInit ( int  t)

Definition at line 127 of file ipid.cc.

128 {
129  switch (t)
130  {
131  //the type with init routines:
132 #ifdef SINGULAR_4_2
133  case CNUMBER_CMD:
134  return (void*)n2Init(0,NULL);
135  case CPOLY_CMD:
136  return (void*)p2Init(0,NULL);
137  case CMATRIX_CMD:
138 #endif
139  case BIGINTMAT_CMD:
140  return (void *)new bigintmat();
141  case BUCKET_CMD:
142  if (currRing!=NULL)
143  return (void*)sBucketCreate(currRing);
144  else
145  {
146  WerrorS("need basering for polyBucket");
147  return NULL;
148  }
149  case INTVEC_CMD:
150  case INTMAT_CMD:
151  return (void *)new intvec();
152  case NUMBER_CMD:
153  {
154  if (currRing!=NULL) return (void *) nInit(0);
155  else return NULL;
156  }
157  case BIGINT_CMD:
158  return (void *) n_Init(0, coeffs_BIGINT);
159  case IDEAL_CMD:
160  case MODUL_CMD:
161  case MATRIX_CMD:
162  case SMATRIX_CMD:
163  return (void*) idInit(1,1);
164  case MAP_CMD:
165  {
166  map m = (map)idInit(1,1);
167  m->preimage = omStrDup(IDID(currRingHdl));
168  return (void *)m;
169  }
170  case STRING_CMD:
171  return (void *)omAlloc0(1);
172  case LIST_CMD:
173  {
175  l->Init();
176  return (void*)l;
177  }
178  //the types with the standard init: set the struct to zero
179  case LINK_CMD:
180  return (void*) omAlloc0Bin(sip_link_bin);
181  case RING_CMD:
182  return NULL;
183  case PACKAGE_CMD:
184  {
185  package pa=(package)omAlloc0Bin(sip_package_bin);
186  pa->language=LANG_NONE;
187  pa->loaded = FALSE;
188  return (void*)pa;
189  }
190  case PROC_CMD:
191  {
193  pi->ref=1;
194  pi->language=LANG_NONE;
195  return (void*)pi;
196  }
197  case RESOLUTION_CMD:
198  return (void *)omAlloc0(sizeof(ssyStrategy));
199  //other types: without init (int,script,poly,def,package)
200  case CRING_CMD:
201  case INT_CMD:
202  case DEF_CMD:
203  case POLY_CMD:
204  case VECTOR_CMD:
205  case QRING_CMD:
206  return (void*)0L;
207  default:
208  {
209  if (t>MAX_TOK)
210  {
211 #ifdef BLACKBOX_DEVEL
212  Print("bb-type %d\n",t);
213 #endif
214  blackbox *bb=getBlackboxStuff(t);
215  if (bb!=NULL)
216  return (void *)bb->blackbox_Init(bb);
217  }
218  else
219  Werror("unknown type in idrecDataInit:%d",t);
220  break;
221  }
222  }
223  return (void *)0L;
224 }

◆ ipListFlag()

void ipListFlag ( idhdl  h)

Definition at line 538 of file ipid.cc.

539 {
540  if (hasFlag(h,FLAG_STD)) PrintS(" (SB)");
541 #ifdef HAVE_PLURAL
542  if (hasFlag(h,FLAG_TWOSTD)) PrintS(" (2SB)");
543 #endif
544 }

◆ ipMoveId()

void ipMoveId ( idhdl  h)

Definition at line 623 of file ipid.cc.

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

◆ ipNameList()

lists ipNameList ( idhdl  root)

Definition at line 546 of file ipid.cc.

547 {
548  idhdl h=root;
549  /* compute the length */
550  int l=0;
551  while (h!=NULL) { l++; h=IDNEXT(h); }
552  /* allocate list */
554  L->Init(l);
555  /* copy names */
556  h=root;
557  l=0;
558  while (h!=NULL)
559  {
560  /* list is initialized with 0 => no need to clear anything */
561  L->m[l].rtyp=STRING_CMD;
562  L->m[l].data=omStrDup(IDID(h));
563  l++;
564  h=IDNEXT(h);
565  }
566  return L;
567 }

◆ ipNameListLev()

lists ipNameListLev ( idhdl  root,
int  lev 
)

Definition at line 569 of file ipid.cc.

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

◆ jjNormalizeQRingId()

void jjNormalizeQRingId ( leftv  I)

Definition at line 2167 of file ipassign.cc.

2168 {
2169  if ((currRing->qideal!=NULL) && (!hasFlag(I,FLAG_QRING)))
2170  {
2171  if (I->e==NULL)
2172  {
2173  ideal I0=(ideal)I->Data();
2174  switch (I->Typ())
2175  {
2176  case IDEAL_CMD:
2177  case MODUL_CMD:
2178  {
2179  ideal F=idInit(1,1);
2180  ideal II=kNF(F,currRing->qideal,I0);
2181  idDelete(&F);
2182  if (I->rtyp!=IDHDL)
2183  {
2184  idDelete((ideal*)&(I0));
2185  I->data=II;
2186  }
2187  else
2188  {
2189  idhdl h=(idhdl)I->data;
2190  idDelete((ideal*)&IDIDEAL(h));
2191  IDIDEAL(h)=II;
2192  setFlag(h,FLAG_QRING);
2193  }
2194  break;
2195  }
2196  default: break;
2197  }
2198  setFlag(I,FLAG_QRING);
2199  }
2200  }
2201 }

◆ jjNormalizeQRingP()

void jjNormalizeQRingP ( poly &  p)

Definition at line 2202 of file ipassign.cc.

2203 {
2204  if((p!=NULL) && (currRing->qideal!=NULL))
2205  {
2206  ideal F=idInit(1,1);
2207  poly p2=kNF(F,currRing->qideal,p);
2208  pNormalize(p2);
2209  idDelete(&F);
2210  pDelete(&p);
2211  p=p2;
2212  }
2213 }

◆ killhdl()

void killhdl ( idhdl  h,
package  prooti = currPack 
)

Definition at line 386 of file ipid.cc.

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

◆ killhdl2()

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

Definition at line 417 of file ipid.cc.

418 {
419  //printf("kill %s, id %x, typ %d lev: %d\n",IDID(h),(int)IDID(h),IDTYP(h),IDLEV(h));
420  idhdl hh;
421 
422  if (TEST_V_ALLWARN
423  && (IDLEV(h)!=myynest)
424  &&(IDLEV(h)==0))
425  {
426  if (((*ih)==basePack->idroot)
427  || ((currRing!=NULL)&&((*ih)==currRing->idroot)))
428  Warn("kill global `%s` at line >>%s<<\n",IDID(h),my_yylinebuf);
429  }
430  if (h->attribute!=NULL)
431  {
432  if ((IDTYP(h)==RING_CMD)&&(IDRING(h)!=r))
433  h->attribute->killAll(IDRING(h));
434  else
435  h->attribute->killAll(r);
436  h->attribute=NULL;
437  }
438  if (IDTYP(h) == PACKAGE_CMD)
439  {
440  if (((IDPACKAGE(h)->language==LANG_C)&&(IDPACKAGE(h)->idroot!=NULL))
441  || (strcmp(IDID(h),"Top")==0))
442  {
443  Warn("cannot kill `%s`",IDID(h));
444  return;
445  }
446  // any objects defined for this package ?
447  if ((IDPACKAGE(h)->ref<=0) && (IDPACKAGE(h)->idroot!=NULL))
448  {
449  if (currPack==IDPACKAGE(h))
450  {
453  }
454  idhdl * hd = &IDRING(h)->idroot;
455  idhdl hdh = IDNEXT(*hd);
456  idhdl temp;
457  while (hdh!=NULL)
458  {
459  temp = IDNEXT(hdh);
460  killhdl2(hdh,&(IDPACKAGE(h)->idroot),NULL);
461  hdh = temp;
462  }
463  killhdl2(*hd,hd,NULL);
464  if (IDPACKAGE(h)->libname!=NULL) omFree((ADDRESS)(IDPACKAGE(h)->libname));
465  }
466  paKill(IDPACKAGE(h));
469  }
470  else if (IDTYP(h)==RING_CMD)
471  rKill(h);
472  else if (IDDATA(h)!=NULL)
474  // general -------------------------------------------------------------
475  // now dechain it and delete idrec
476  if (IDID(h)!=NULL) // OB: ?????
477  omFree((ADDRESS)IDID(h));
478  IDID(h)=NULL;
479  IDDATA(h)=NULL;
480  if (h == (*ih))
481  {
482  // h is at the beginning of the list
483  *ih = IDNEXT(h) /* ==*ih */;
484  }
485  else if (ih!=NULL)
486  {
487  // h is somethere in the list:
488  hh = *ih;
489  loop
490  {
491  if (hh==NULL)
492  {
493  PrintS(">>?<< not found for kill\n");
494  return;
495  }
496  idhdl hhh = IDNEXT(hh);
497  if (hhh == h)
498  {
499  IDNEXT(hh) = IDNEXT(hhh);
500  break;
501  }
502  hh = hhh;
503  }
504  }
506 }

◆ killid()

void killid ( const char *  a,
idhdl i 
)

Definition at line 359 of file ipid.cc.

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

◆ load_builtin()

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

Definition at line 1197 of file iplib.cc.

1198 {
1199  int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic,
1200  BOOLEAN(*func)(leftv res, leftv v));
1201 /*
1202  typedef int (*fktn_t)(int(*iiAddCproc)(const char *libname, const char *procname,
1203  BOOLEAN pstatic,
1204  BOOLEAN(*func)(leftv res, leftv v)));
1205 */
1206  // SModulFunc_t fktn;
1207  idhdl pl;
1208  char *plib = iiConvName(newlib);
1209  // BOOLEAN RET=TRUE;
1210  // int token;
1211 
1212  pl = basePack->idroot->get(plib,0); // search PACKAGE only in Top
1213  if ((pl!=NULL)
1214  &&(IDTYP(pl)==PACKAGE_CMD))
1215  {
1216  if(IDPACKAGE(pl)->language==LANG_C)
1217  {
1218  if (BVERBOSE(V_LOAD_LIB)) Warn( "(builtin) %s already loaded", newlib);
1219  omFree(plib);
1220  return FALSE;
1221  }
1222  }
1223  else
1224  {
1225  pl = enterid( plib,0, PACKAGE_CMD, &IDROOT, TRUE );
1226  IDPACKAGE(pl)->libname=omStrDup(newlib);
1227  }
1228  IDPACKAGE(pl)->language = LANG_C;
1229 
1230  IDPACKAGE(pl)->handle=(void *)NULL;
1231  SModulFunctions sModulFunctions;
1232 
1233  package s=currPack;
1234  currPack=IDPACKAGE(pl);
1235  if( init!= NULL)
1236  {
1237  sModulFunctions.iiArithAddCmd = iiArithAddCmd;
1238  if (autoexport) sModulFunctions.iiAddCproc = iiAddCprocTop;
1239  else sModulFunctions.iiAddCproc = iiAddCproc;
1240  (*init)(&sModulFunctions);
1241  }
1242  if (BVERBOSE(V_LOAD_LIB)) Print( "// ** loaded (builtin) %s \n", newlib);
1243  currPack->loaded=1;
1244  currPack=s;
1245 
1246  return FALSE;
1247 }

◆ module_help_main()

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

Definition at line 1249 of file iplib.cc.

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

◆ module_help_proc()

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

Definition at line 1264 of file iplib.cc.

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

◆ packFindHdl()

idhdl packFindHdl ( package  r)

Definition at line 752 of file ipid.cc.

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

◆ paCopy()

package paCopy ( package  pack)
inline

Definition at line 43 of file ipid.h.

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

◆ paKill()

void paKill ( package  pack)
inline

Definition at line 49 of file ipid.h.

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

Variable Documentation

◆ basePack

package basePack

Definition at line 60 of file ipid.cc.

◆ basePackHdl

idhdl basePackHdl

Definition at line 58 of file ipid.cc.

◆ coeffs_BIGINT

coeffs coeffs_BIGINT

Definition at line 52 of file ipid.cc.

◆ currPack

package currPack

Definition at line 59 of file ipid.cc.

◆ currPackHdl

idhdl currPackHdl

Definition at line 57 of file ipid.cc.

◆ currRingHdl

idhdl currRingHdl

Definition at line 61 of file ipid.cc.

◆ idrec_bin

omBin idrec_bin

Definition at line 50 of file ipid.cc.

◆ optionStruct

const struct soptionStruct optionStruct[]

Definition at line 526 of file misc_ip.cc.

◆ procstack

proclevel* procstack

Definition at line 54 of file ipid.cc.

◆ sip_command_bin

omBin sip_command_bin

Definition at line 47 of file ipid.cc.

◆ sip_package_bin

omBin sip_package_bin

Definition at line 48 of file ipid.cc.

◆ sleftv_bin

omBin sleftv_bin

Definition at line 47 of file subexpr.cc.

◆ verboseStruct

const struct soptionStruct verboseStruct[]

Definition at line 556 of file misc_ip.cc.

FALSE
#define FALSE
Definition: auxiliary.h:94
sleftv::Data
void * Data()
Definition: subexpr.cc:1182
iiCheckPack
void iiCheckPack(package &p)
Definition: ipshell.cc:1541
SModulFunctions::iiArithAddCmd
int(* iiArithAddCmd)(const char *szName, short nAlias, short nTokval, short nToktype, short nPos)
Definition: ipid.h:71
FLAG_TWOSTD
#define FLAG_TWOSTD
Definition: ipid.h:105
omFree
#define omFree(addr)
Definition: omAllocDecl.h:261
idDelete
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
CRING_CMD
@ CRING_CMD
Definition: tok.h:56
NUMBER_CMD
@ NUMBER_CMD
Definition: grammar.cc:288
procinfov
procinfo * procinfov
Definition: structs.h:63
bigintmat
Definition: bigintmat.h:51
BIGINT_CMD
@ BIGINT_CMD
Definition: tok.h:38
LIST_CMD
@ LIST_CMD
Definition: tok.h:118
ADDRESS
void * ADDRESS
Definition: auxiliary.h:133
enterid
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:267
MODUL_CMD
@ MODUL_CMD
Definition: grammar.cc:287
STRING_CMD
@ STRING_CMD
Definition: tok.h:183
CNUMBER_CMD
@ CNUMBER_CMD
Definition: tok.h:47
map
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
search
int search(const CFArray &A, const CanonicalForm &F, int i, int j)
search for F in A between index i and j
Definition: facSparseHensel.h:566
MAX_TOK
@ MAX_TOK
Definition: tok.h:216
IDDATA
#define IDDATA(a)
Definition: ipid.h:121
rKill
void rKill(ring r)
Definition: ipshell.cc:6119
procinfo
Definition: subexpr.h:53
omStrDup
#define omStrDup(s)
Definition: omAllocDecl.h:263
DEF_CMD
@ DEF_CMD
Definition: tok.h:58
V_LOAD_LIB
#define V_LOAD_LIB
Definition: options.h:47
omAllocBin
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
BIGINTMAT_CMD
@ BIGINTMAT_CMD
Definition: grammar.cc:278
omAlloc0Bin
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
pDelete
#define pDelete(p_ptr)
Definition: polys.h:181
currPack
package currPack
Definition: ipid.cc:59
idrec_bin
omBin idrec_bin
Definition: ipid.cc:50
loop
#define loop
Definition: structs.h:78
sleftv
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
idhdl
idrec * idhdl
Definition: ring.h:22
RING_CMD
@ RING_CMD
Definition: grammar.cc:281
currRingHdl
idhdl currRingHdl
Definition: ipid.cc:61
slists_bin
omBin slists_bin
Definition: lists.cc:23
RingDependend
int RingDependend(int t)
Definition: gentable.cc:28
MATRIX_CMD
@ MATRIX_CMD
Definition: grammar.cc:286
IDLIST
#define IDLIST(a)
Definition: ipid.h:132
IDLEV
#define IDLEV(a)
Definition: ipid.h:116
iiAddCproc
int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: iplib.cc:1005
pi
#define pi
Definition: libparse.cc:1143
packFindHdl
idhdl packFindHdl(package r)
Definition: ipid.cc:752
currRing
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
BEGIN_RING
@ BEGIN_RING
Definition: grammar.cc:282
TRUE
#define TRUE
Definition: auxiliary.h:98
hasFlag
#define hasFlag(A, F)
Definition: ipid.h:107
res
CanonicalForm res
Definition: facAbsFact.cc:64
INT_CMD
@ INT_CMD
Definition: tok.h:96
CPOLY_CMD
@ CPOLY_CMD
Definition: tok.h:48
PrintS
void PrintS(const char *s)
Definition: reporter.cc:284
BOOLEAN
int BOOLEAN
Definition: auxiliary.h:85
killhdl2
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:417
PROC_CMD
@ PROC_CMD
Definition: grammar.cc:280
procinfo_bin
omBin procinfo_bin
Definition: subexpr.cc:48
iiConvName
char * iiConvName(const char *libname)
Definition: iplib.cc:1331
IDROOT
#define IDROOT
Definition: ipid.h:18
sBucketCreate
sBucket_pt sBucketCreate(const ring r)
Definition: sbuckets.cc:98
IDEAL_CMD
@ IDEAL_CMD
Definition: grammar.cc:284
h
static Poly * h
Definition: janet.cc:972
lRingDependend
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
paKill
void paKill(package pack)
Definition: ipid.h:49
intvec
Definition: intvec.h:17
sleftv::data
void * data
Definition: subexpr.h:88
LANG_C
@ LANG_C
Definition: subexpr.h:24
iiArithAddCmd
int iiArithAddCmd(const char *szName, short nAlias, short nTokval, short nToktype, short nPos)
Definition: iparith.cc:9205
n_Init
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
END_RING
@ END_RING
Definition: grammar.cc:310
VECTOR_CMD
@ VECTOR_CMD
Definition: grammar.cc:292
myynest
int myynest
Definition: febase.cc:41
IDTYP
#define IDTYP(a)
Definition: ipid.h:114
iiAddCprocTop
int iiAddCprocTop(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: iplib.cc:1078
ipSwapId
static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
Definition: ipid.cc:598
slists::m
sleftv * m
Definition: lists.h:45
my_yylinebuf
char my_yylinebuf[80]
Definition: febase.cc:43
LANG_NONE
@ LANG_NONE
Definition: subexpr.h:24
sleftv::e
Subexpr e
Definition: subexpr.h:105
kNF
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2822
help
#define help
Definition: libparse.cc:1228
IDRING
#define IDRING(a)
Definition: ipid.h:122
slists
Definition: lists.h:22
INTVEC_CMD
@ INTVEC_CMD
Definition: tok.h:101
INTMAT_CMD
@ INTMAT_CMD
Definition: grammar.cc:279
coeffs_BIGINT
coeffs coeffs_BIGINT
Definition: ipid.cc:52
idrec
Definition: idrec.h:34
IDPACKAGE
#define IDPACKAGE(a)
Definition: ipid.h:134
BUCKET_CMD
@ BUCKET_CMD
Definition: grammar.cc:283
BVERBOSE
#define BVERBOSE(a)
Definition: options.h:35
Print
#define Print
Definition: emacs.cc:80
QRING_CMD
@ QRING_CMD
Definition: tok.h:158
FLAG_QRING
#define FLAG_QRING
Definition: ipid.h:106
Werror
void Werror(const char *fmt,...)
Definition: reporter.cc:189
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
PACKAGE_CMD
@ PACKAGE_CMD
Definition: tok.h:149
IDHDL
#define IDHDL
Definition: tok.h:31
WerrorS
void WerrorS(const char *s)
Definition: feFopen.cc:24
sleftv::Typ
int Typ()
Definition: subexpr.cc:1039
m
int m
Definition: cfEzgcd.cc:121
SModulFunctions
Definition: ipid.h:67
sleftv::rtyp
int rtyp
Definition: subexpr.h:91
basePack
package basePack
Definition: ipid.cc:60
NULL
#define NULL
Definition: omList.c:10
MAP_CMD
@ MAP_CMD
Definition: grammar.cc:285
lists
slists * lists
Definition: mpr_numeric.h:146
currPackHdl
idhdl currPackHdl
Definition: ipid.cc:57
l
int l
Definition: cfEzgcd.cc:93
IDSTRING
#define IDSTRING(a)
Definition: ipid.h:131
IDNEXT
#define IDNEXT(a)
Definition: ipid.h:113
s_internalDelete
void s_internalDelete(const int t, void *d, const ring r)
Definition: subexpr.cc:520
Warn
#define Warn
Definition: emacs.cc:77
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
slists::Init
INLINE_THIS void Init(int l=0)
p
int p
Definition: cfModGcd.cc:4019
setFlag
#define setFlag(A, F)
Definition: ipid.h:108
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
RESOLUTION_CMD
@ RESOLUTION_CMD
Definition: grammar.cc:290
nInit
#define nInit(i)
Definition: numbers.h:25
POLY_CMD
@ POLY_CMD
Definition: grammar.cc:289
SModulFunctions::iiAddCproc
int(* iiAddCproc)(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: ipid.h:69
IDID
#define IDID(a)
Definition: ipid.h:117
pNormalize
#define pNormalize(p)
Definition: polys.h:311
FLAG_STD
#define FLAG_STD
Definition: ipid.h:104
V_REDEFINE
#define V_REDEFINE
Definition: options.h:45
idrec::set
idhdl set(const char *s, int lev, int t, BOOLEAN init=TRUE)
Definition: ipid.cc:225
omFreeBin
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
TEST_V_ALLWARN
#define TEST_V_ALLWARN
Definition: options.h:140
getBlackboxStuff
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:16
LINK_CMD
@ LINK_CMD
Definition: tok.h:117
CMATRIX_CMD
@ CMATRIX_CMD
Definition: tok.h:46
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:211
IDIDEAL
#define IDIDEAL(a)
Definition: ipid.h:128
ssyStrategy
Definition: syz.h:37
SMATRIX_CMD
@ SMATRIX_CMD
Definition: grammar.cc:291