Data Structures | Macros | Typedefs | Functions | Variables
ipid.h File Reference
#include <string.h>
#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)
 
idhdl ggetid (const char *n, BOOLEAN local, idhdl *packhdl)
 
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
 
FILE * feFilePending
 
const struct soptionStruct optionStruct []
 
const struct soptionStruct verboseStruct []
 

Data Structure Documentation

◆ sip_command

struct sip_command

Definition at line 26 of file ipid.h.

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

◆ sip_package

struct sip_package

Definition at line 35 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 149 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 108 of file ipid.h.

◆ FLAG_STD

#define FLAG_STD   0

Definition at line 106 of file ipid.h.

◆ FLAG_TWOSTD

#define FLAG_TWOSTD   3

Definition at line 107 of file ipid.h.

◆ hasFlag

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

Definition at line 109 of file ipid.h.

◆ IDATTR

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

Definition at line 120 of file ipid.h.

◆ IDBIGINT

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

Definition at line 128 of file ipid.h.

◆ IDBIMAT

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

Definition at line 126 of file ipid.h.

◆ IDDATA

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

Definition at line 123 of file ipid.h.

◆ IDFLAG

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

Definition at line 117 of file ipid.h.

◆ IDID

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

Definition at line 119 of file ipid.h.

◆ IDIDEAL

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

Definition at line 130 of file ipid.h.

◆ IDINT

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

Definition at line 122 of file ipid.h.

◆ IDINTVEC

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

Definition at line 125 of file ipid.h.

◆ IDLEV

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

Definition at line 118 of file ipid.h.

◆ IDLINK

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

Definition at line 135 of file ipid.h.

◆ IDLIST

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

Definition at line 134 of file ipid.h.

◆ IDMAP

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

Definition at line 132 of file ipid.h.

◆ IDMATRIX

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

Definition at line 131 of file ipid.h.

◆ IDNEXT

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

Definition at line 115 of file ipid.h.

◆ IDNUMBER

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

Definition at line 129 of file ipid.h.

◆ IDPACKAGE

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

Definition at line 136 of file ipid.h.

◆ IDPOLY

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

Definition at line 127 of file ipid.h.

◆ IDPROC

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

Definition at line 137 of file ipid.h.

◆ IDRING

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

Definition at line 124 of file ipid.h.

◆ IDROOT

#define IDROOT   (currPack->idroot)

Definition at line 20 of file ipid.h.

◆ IDSTRING

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

Definition at line 133 of file ipid.h.

◆ IDTYP

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

Definition at line 116 of file ipid.h.

◆ resetFlag

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

Definition at line 111 of file ipid.h.

◆ setFlag

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

Definition at line 110 of file ipid.h.

Typedef Documentation

◆ command

typedef ip_command* command

Definition at line 24 of file ipid.h.

◆ SModulFunc_t

typedef int(* SModulFunc_t) (SModulFunctions *)

Definition at line 82 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 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(s,lev))!=NULL)
274  {
275  if (IDLEV(h)==lev)
276  {
277  if ((IDTYP(h) == t)||(t==DEF_CMD))
278  {
279  if (IDTYP(h)==PACKAGE_CMD)
280  {
281  if (strcmp(s,"Top")==0)
282  {
283  goto errlabel;
284  }
285  else return *root;
286  }
287  else
288  {
289  if (BVERBOSE(V_REDEFINE))
290  Warn("redefining %s (%s)",s,my_yylinebuf);
291  if (s==IDID(h)) IDID(h)=NULL;
292  killhdl2(h,root,currRing);
293  }
294  }
295  else
296  goto errlabel;
297  }
298  }
299  // is it already defined in currRing->idroot ?
300  else if (search && (currRing!=NULL)&&((*root) != currRing->idroot))
301  {
302  if ((h=currRing->idroot->get(s,lev))!=NULL)
303  {
304  if (IDLEV(h)==lev)
305  {
306  if ((IDTYP(h) == t)||(t==DEF_CMD))
307  {
308  if (BVERBOSE(V_REDEFINE))
309  Warn("redefining %s (%s)",s,my_yylinebuf);
310  if (s==IDID(h)) IDID(h)=NULL;
311  killhdl2(h,&currRing->idroot,currRing);
312  }
313  else
314  goto errlabel;
315  }
316  }
317  }
318  // is it already defined in idroot ?
319  else if (search && (*root != IDROOT))
320  {
321  if ((h=IDROOT->get(s,lev))!=NULL)
322  {
323  if (IDLEV(h)==lev)
324  {
325  if ((IDTYP(h) == t)||(t==DEF_CMD))
326  {
327  if (BVERBOSE(V_REDEFINE))
328  Warn("redefining %s (%s)",s,my_yylinebuf);
329  if (s==IDID(h)) IDID(h)=NULL;
330  killhdl2(h,&IDROOT,NULL);
331  }
332  else
333  goto errlabel;
334  }
335  }
336  }
337  *root = (*root)->set(s, lev, t, init);
338 #ifndef SING_NDEBUG
339  checkall();
340 #endif
341  return *root;
342 
343  errlabel:
344  //Werror("identifier `%s` in use(lev h=%d,typ=%d,t=%d, curr=%d)",s,IDLEV(h),IDTYP(h),t,lev);
345  Werror("identifier `%s` in use",s);
346  //listall();
347  omFree((ADDRESS)s);
348  return NULL;
349 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define IDID(a)
Definition: ipid.h:119
#define IDROOT
Definition: ipid.h:20
void * ADDRESS
Definition: auxiliary.h:115
Definition: idrec.h:34
idhdl get(const char *s, int lev)
Definition: ipid.cc:90
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define IDTYP(a)
Definition: ipid.h:116
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:408
char my_yylinebuf[80]
Definition: febase.cc:48
Definition: tok.h:58
#define omFree(addr)
Definition: omAllocDecl.h:261
int search(const CFArray &A, const CanonicalForm &F, int i, int j)
search for F in A between index i and j
#define IDLEV(a)
Definition: ipid.h:118
#define BVERBOSE(a)
Definition: options.h:33
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:64
static Poly * h
Definition: janet.cc:978
#define V_REDEFINE
Definition: options.h:43
void Werror(const char *fmt,...)
Definition: reporter.cc:189
idhdl set(const char *s, int lev, int t, BOOLEAN init=TRUE)
Definition: ipid.cc:217
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263

◆ ggetid() [1/2]

idhdl ggetid ( const char *  n)

Definition at line 508 of file ipid.cc.

509 {
510  idhdl h = IDROOT->get(n,myynest);
511  if ((h!=NULL)&&(IDLEV(h)==myynest)) return h;
512  idhdl h2=NULL;
513  if (currRing!=NULL)
514  {
515  h2 = currRing->idroot->get(n,myynest);
516  }
517  if (h2!=NULL) return h2;
518  if (h!=NULL) return h;
519  if (basePack!=currPack)
520  return basePack->idroot->get(n,myynest);
521  return NULL;
522 }
#define IDROOT
Definition: ipid.h:20
Definition: idrec.h:34
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:10
#define IDLEV(a)
Definition: ipid.h:118
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:64
package currPack
Definition: ipid.cc:63
static Poly * h
Definition: janet.cc:978

◆ ggetid() [2/2]

idhdl ggetid ( const char *  n,
BOOLEAN  local,
idhdl packhdl 
)

Definition at line 495 of file ipid.cc.

496 {
497  idhdl h = IDROOT->get(n,myynest);
498  idhdl h2=NULL;
499  *packhdl = NULL;
500  if ((currRing!=NULL) && ((h==NULL)||(IDLEV(h)!=myynest)))
501  {
502  h2 = currRing->idroot->get(n,myynest);
503  }
504  if (h2==NULL) return h;
505  return h2;
506 }
#define IDROOT
Definition: ipid.h:20
Definition: idrec.h:34
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:10
#define IDLEV(a)
Definition: ipid.h:118
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978

◆ idrecDataInit()

void* idrecDataInit ( int  t)

Definition at line 131 of file ipid.cc.

132 {
133  switch (t)
134  {
135  //the type with init routines:
136 #ifdef SINGULAR_4_2
137  case CNUMBER_CMD:
138  return (void*)n2Init(0,NULL);
139  case CPOLY_CMD:
140  return (void*)p2Init(0,NULL);
141  case CMATRIX_CMD:
142 #endif
143  case BIGINTMAT_CMD:
144  return (void *)new bigintmat();
145  case INTVEC_CMD:
146  case INTMAT_CMD:
147  return (void *)new intvec();
148  case NUMBER_CMD:
149  return (void *) nInit(0);
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  return (void*) idInit(1,1);
156  case MAP_CMD:
157  {
158  map m = (map)idInit(1,1);
159  m->preimage = omStrDup(IDID(currRingHdl));
160  return (void *)m;
161  }
162  case STRING_CMD:
163  return (void *)omAlloc0(1);
164  case LIST_CMD:
165  {
167  l->Init();
168  return (void*)l;
169  }
170  //the types with the standard init: set the struct to zero
171  case LINK_CMD:
172  return (void*) omAlloc0Bin(sip_link_bin);
173  case RING_CMD:
174  return NULL;
175  case PACKAGE_CMD:
176  {
177  package pa=(package)omAlloc0Bin(sip_package_bin);
178  pa->language=LANG_NONE;
179  pa->loaded = FALSE;
180  return (void*)pa;
181  }
182  case PROC_CMD:
183  {
185  pi->ref=1;
186  pi->language=LANG_NONE;
187  return (void*)pi;
188  }
189  case RESOLUTION_CMD:
190  return (void *)omAlloc0(sizeof(ssyStrategy));
191  //other types: without init (int,script,poly,def,package)
192  case CRING_CMD:
193  case INT_CMD:
194  case DEF_CMD:
195  case POLY_CMD:
196  case VECTOR_CMD:
197  case QRING_CMD:
198  return (void*)0L;
199  default:
200  {
201  if (t>MAX_TOK)
202  {
203 #ifdef BLACKBOX_DEVEL
204  Print("bb-type %d\n",t);
205 #endif
206  blackbox *bb=getBlackboxStuff(t);
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 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
Definition: tok.h:48
#define Print
Definition: emacs.cc:83
Definition: tok.h:95
Definition: lists.h:22
#define IDID(a)
Definition: ipid.h:119
#define FALSE
Definition: auxiliary.h:94
Definition: tok.h:38
Matrices of numbers.
Definition: bigintmat.h:51
Definition: tok.h:213
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
language_defs language
Definition: subexpr.h:59
short ref
Definition: subexpr.h:60
coeffs coeffs_BIGINT
Definition: ipid.cc:54
omBin procinfo_bin
Definition: subexpr.cc:51
Definition: tok.h:56
Definition: intvec.h:14
Definition: tok.h:58
idhdl currRingHdl
Definition: ipid.cc:65
int m
Definition: cfEzgcd.cc:119
INLINE_THIS void Init(int l=0)
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define pi
Definition: libparse.cc:1143
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
Definition: tok.h:116
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:117
omBin slists_bin
Definition: lists.cc:23
Definition: tok.h:157
#define nInit(i)
Definition: numbers.h:24
void Werror(const char *fmt,...)
Definition: reporter.cc:189
#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:16
#define omStrDup(s)
Definition: omAllocDecl.h:263

◆ ipListFlag()

void ipListFlag ( idhdl  h)

Definition at line 524 of file ipid.cc.

525 {
526  if (hasFlag(h,FLAG_STD)) PrintS(" (SB)");
527 #ifdef HAVE_PLURAL
528  if (hasFlag(h,FLAG_TWOSTD)) PrintS(" (2SB)");
529 #endif
530 }
#define FLAG_TWOSTD
Definition: ipid.h:107
void PrintS(const char *s)
Definition: reporter.cc:284
#define FLAG_STD
Definition: ipid.h:106
#define hasFlag(A, F)
Definition: ipid.h:109

◆ ipMoveId()

void ipMoveId ( idhdl  h)

Definition at line 609 of file ipid.cc.

610 {
611  if ((currRing!=NULL)&&(tomove!=NULL))
612  {
613  if (RingDependend(IDTYP(tomove))
614  || ((IDTYP(tomove)==LIST_CMD) && (lRingDependend(IDLIST(tomove)))))
615  {
616  /*move 'tomove' to ring id's*/
617  if (ipSwapId(tomove,IDROOT,currRing->idroot))
618  ipSwapId(tomove,basePack->idroot,currRing->idroot);
619  }
620  else
621  {
622  /*move 'tomove' to global id's*/
623  ipSwapId(tomove,currRing->idroot,IDROOT);
624  }
625  }
626 }
#define IDLIST(a)
Definition: ipid.h:134
#define IDROOT
Definition: ipid.h:20
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define IDTYP(a)
Definition: ipid.h:116
int RingDependend(int t)
Definition: gentable.cc:23
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:64
Definition: tok.h:117
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
Definition: ipid.cc:584

◆ ipNameList()

lists ipNameList ( idhdl  root)

Definition at line 532 of file ipid.cc.

533 {
534  idhdl h=root;
535  /* compute the length */
536  int l=0;
537  while (h!=NULL) { l++; h=IDNEXT(h); }
538  /* allocate list */
540  L->Init(l);
541  /* copy names */
542  h=root;
543  l=0;
544  while (h!=NULL)
545  {
546  /* list is initialized with 0 => no need to clear anything */
547  L->m[l].rtyp=STRING_CMD;
548  L->m[l].data=omStrDup(IDID(h));
549  l++;
550  h=IDNEXT(h);
551  }
552  return L;
553 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
sleftv * m
Definition: lists.h:45
Definition: lists.h:22
#define IDID(a)
Definition: ipid.h:119
#define IDNEXT(a)
Definition: ipid.h:115
Definition: idrec.h:34
void * data
Definition: subexpr.h:89
INLINE_THIS void Init(int l=0)
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:92
omBin slists_bin
Definition: lists.cc:23
static Poly * h
Definition: janet.cc:978
int l
Definition: cfEzgcd.cc:94
#define omStrDup(s)
Definition: omAllocDecl.h:263

◆ ipNameListLev()

lists ipNameListLev ( idhdl  root,
int  lev 
)

Definition at line 555 of file ipid.cc.

556 {
557  idhdl h=root;
558  /* compute the length */
559  int l=0;
560  while (h!=NULL) { if (IDLEV(h)==lev) l++; h=IDNEXT(h); }
561  /* allocate list */
563  L->Init(l);
564  /* copy names */
565  h=root;
566  l=0;
567  while (h!=NULL)
568  {
569  if (IDLEV(h)==lev)
570  {
571  /* list is initialized with 0 => no need to clear anything */
572  L->m[l].rtyp=STRING_CMD;
573  L->m[l].data=omStrDup(IDID(h));
574  l++;
575  }
576  h=IDNEXT(h);
577  }
578  return L;
579 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
sleftv * m
Definition: lists.h:45
Definition: lists.h:22
#define IDID(a)
Definition: ipid.h:119
#define IDNEXT(a)
Definition: ipid.h:115
Definition: idrec.h:34
void * data
Definition: subexpr.h:89
#define IDLEV(a)
Definition: ipid.h:118
INLINE_THIS void Init(int l=0)
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:92
omBin slists_bin
Definition: lists.cc:23
static Poly * h
Definition: janet.cc:978
int l
Definition: cfEzgcd.cc:94
#define omStrDup(s)
Definition: omAllocDecl.h:263

◆ jjNormalizeQRingId()

void jjNormalizeQRingId ( leftv  I)

Definition at line 2138 of file ipassign.cc.

2139 {
2140  if ((currRing->qideal!=NULL) && (!hasFlag(I,FLAG_QRING)))
2141  {
2142  if (I->e==NULL)
2143  {
2144  ideal I0=(ideal)I->Data();
2145  switch (I->Typ())
2146  {
2147  case IDEAL_CMD:
2148  case MODUL_CMD:
2149  {
2150  ideal F=idInit(1,1);
2151  ideal II=kNF(F,currRing->qideal,I0);
2152  idDelete(&F);
2153  if (I->rtyp!=IDHDL)
2154  {
2155  idDelete((ideal*)&(I0));
2156  I->data=II;
2157  }
2158  else
2159  {
2160  idhdl h=(idhdl)I->data;
2161  idDelete((ideal*)&IDIDEAL(h));
2162  IDIDEAL(h)=II;
2163  setFlag(h,FLAG_QRING);
2164  }
2165  break;
2166  }
2167  default: break;
2168  }
2169  setFlag(I,FLAG_QRING);
2170  }
2171  }
2172 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2971
Subexpr e
Definition: subexpr.h:106
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define IDIDEAL(a)
Definition: ipid.h:130
int Typ()
Definition: subexpr.cc:995
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define setFlag(A, F)
Definition: ipid.h:110
idrec * idhdl
Definition: ring.h:18
#define FLAG_QRING
Definition: ipid.h:108
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
#define hasFlag(A, F)
Definition: ipid.h:109
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1137
static Poly * h
Definition: janet.cc:978

◆ jjNormalizeQRingP()

void jjNormalizeQRingP ( poly p)

Definition at line 2173 of file ipassign.cc.

2174 {
2175  if((p!=NULL) && (currRing->qideal!=NULL))
2176  {
2177  ideal F=idInit(1,1);
2178  poly p2=kNF(F,currRing->qideal,p);
2179  pNormalize(p2);
2180  idDelete(&F);
2181  pDelete(&p);
2182  p=p2;
2183  }
2184 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2971
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
pNormalize(P.p)
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:169
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
polyrec * poly
Definition: hilb.h:10

◆ killhdl()

void killhdl ( idhdl  h,
package  prooti = currPack 
)

Definition at line 377 of file ipid.cc.

378 {
379  int t=IDTYP(h);
380  if (((BEGIN_RING<t) && (t<END_RING))
381  || ((t==LIST_CMD) && (lRingDependend((lists)IDDATA(h)))))
382  killhdl2(h,&currRing->idroot,currRing);
383  else
384  {
385  if(t==PACKAGE_CMD)
386  {
387  killhdl2(h,&(basePack->idroot),NULL);
388  }
389  else
390  {
391  idhdl s=proot->idroot;
392  while ((s!=h) && (s!=NULL)) s=s->next;
393  if (s!=NULL)
394  killhdl2(h,&(proot->idroot),NULL);
395  else if (basePack!=proot)
396  {
397  idhdl s=basePack->idroot;
398  while ((s!=h) && (s!=NULL)) s=s->next;
399  if (s!=NULL)
400  killhdl2(h,&(basePack->idroot),currRing);
401  else
402  killhdl2(h,&(currRing->idroot),currRing);
403  }
404  }
405  }
406 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
Definition: lists.h:22
Definition: idrec.h:34
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define IDTYP(a)
Definition: ipid.h:116
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:408
idhdl next
Definition: idrec.h:38
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:64
Definition: tok.h:117
#define IDDATA(a)
Definition: ipid.h:123
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199

◆ killhdl2()

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

Definition at line 408 of file ipid.cc.

409 {
410  //printf("kill %s, id %x, typ %d lev: %d\n",IDID(h),(int)IDID(h),IDTYP(h),IDLEV(h));
411  idhdl hh;
412 
413  if (TEST_V_ALLWARN
414  && (IDLEV(h)!=myynest)
415  &&(IDLEV(h)==0))
416  {
417  if (((*ih)==basePack->idroot)
418  || ((currRing!=NULL)&&((*ih)==currRing->idroot)))
419  Warn("kill global `%s` at line >>%s<<\n",IDID(h),my_yylinebuf);
420  }
421  if (h->attribute!=NULL)
422  {
423  //h->attribute->killAll(r); MEMORY LEAK!
424  h->attribute=NULL;
425  }
426  if (IDTYP(h) == PACKAGE_CMD)
427  {
428  if (strcmp(IDID(h),"Top")==0)
429  {
430  WarnS("can not kill `Top`");
431  return;
432  }
433  // any objects defined for this package ?
434  if ((IDPACKAGE(h)->ref<=0) && (IDPACKAGE(h)->idroot!=NULL))
435  {
436  if (currPack==IDPACKAGE(h))
437  {
440  }
441  idhdl * hd = &IDRING(h)->idroot;
442  idhdl hdh = IDNEXT(*hd);
443  idhdl temp;
444  while (hdh!=NULL)
445  {
446  temp = IDNEXT(hdh);
447  killhdl2(hdh,&(IDPACKAGE(h)->idroot),NULL);
448  hdh = temp;
449  }
450  killhdl2(*hd,hd,NULL);
451  if (IDPACKAGE(h)->libname!=NULL) omFree((ADDRESS)(IDPACKAGE(h)->libname));
452  }
453  paKill(IDPACKAGE(h));
456  }
457  else if (IDTYP(h)==RING_CMD)
458  rKill(h);
459  else if (IDDATA(h)!=NULL)
461  // general -------------------------------------------------------------
462  // now dechain it and delete idrec
463  if (IDID(h)!=NULL) // OB: ?????
464  omFree((ADDRESS)IDID(h));
465  IDID(h)=NULL;
466  IDDATA(h)=NULL;
467  if (h == (*ih))
468  {
469  // h is at the beginning of the list
470  *ih = IDNEXT(h) /* ==*ih */;
471  }
472  else if (ih!=NULL)
473  {
474  // h is somethere in the list:
475  hh = *ih;
476  loop
477  {
478  if (hh==NULL)
479  {
480  PrintS(">>?<< not found for kill\n");
481  return;
482  }
483  idhdl hhh = IDNEXT(hh);
484  if (hhh == h)
485  {
486  IDNEXT(hh) = IDNEXT(hhh);
487  break;
488  }
489  hh = hhh;
490  }
491  }
493 }
idhdl currPackHdl
Definition: ipid.cc:61
loop
Definition: myNF.cc:98
#define IDID(a)
Definition: ipid.h:119
#define IDNEXT(a)
Definition: ipid.h:115
void * ADDRESS
Definition: auxiliary.h:115
#define WarnS
Definition: emacs.cc:81
void paKill(package pack)
Definition: ipid.h:51
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:136
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:10
#define IDTYP(a)
Definition: ipid.h:116
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:408
char my_yylinebuf[80]
Definition: febase.cc:48
const ring r
Definition: syzextra.cc:208
void rKill(ring r)
Definition: ipshell.cc:6056
omBin idrec_bin
Definition: ipid.cc:52
#define omFree(addr)
Definition: omAllocDecl.h:261
void s_internalDelete(const int t, void *d, const ring r)
Definition: subexpr.cc:495
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDLEV(a)
Definition: ipid.h:118
#define NULL
Definition: omList.c:10
attr attribute
Definition: idrec.h:41
package basePack
Definition: ipid.cc:64
#define IDRING(a)
Definition: ipid.h:124
package currPack
Definition: ipid.cc:63
idhdl packFindHdl(package r)
Definition: ipid.cc:738
void iiCheckPack(package &p)
Definition: ipshell.cc:1535
#define IDDATA(a)
Definition: ipid.h:123
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
#define TEST_V_ALLWARN
Definition: options.h:135
#define Warn
Definition: emacs.cc:80

◆ killid()

void killid ( const char *  a,
idhdl i 
)

Definition at line 350 of file ipid.cc.

351 {
352  if (id!=NULL)
353  {
354  idhdl h = (*ih)->get(id,myynest);
355 
356  // id not found in global list, is it defined in current ring ?
357  if (h==NULL)
358  {
359  if ((currRing!=NULL) && (*ih != (currRing->idroot)))
360  {
361  h = currRing->idroot->get(id,myynest);
362  if (h!=NULL)
363  {
364  killhdl2(h,&(currRing->idroot),currRing);
365  return;
366  }
367  }
368  Werror("`%s` is not defined",id);
369  return;
370  }
371  killhdl2(h,ih,currRing);
372  }
373  else
374  WerrorS("kill what ?");
375 }
void WerrorS(const char *s)
Definition: feFopen.cc:24
Definition: idrec.h:34
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:10
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:408
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978
void Werror(const char *fmt,...)
Definition: reporter.cc:189

◆ load_builtin()

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

Definition at line 1080 of file iplib.cc.

1081 {
1082  int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic,
1083  BOOLEAN(*func)(leftv res, leftv v));
1084 /*
1085  typedef int (*fktn_t)(int(*iiAddCproc)(const char *libname, const char *procname,
1086  BOOLEAN pstatic,
1087  BOOLEAN(*func)(leftv res, leftv v)));
1088 */
1089  // SModulFunc_t fktn;
1090  idhdl pl;
1091  char *plib = iiConvName(newlib);
1092  // BOOLEAN RET=TRUE;
1093  // int token;
1094 
1095  pl = basePack->idroot->get(plib,0); // search PACKAGE only in Top
1096  if ((pl!=NULL)
1097  &&(IDTYP(pl)==PACKAGE_CMD))
1098  {
1099  if(IDPACKAGE(pl)->language==LANG_C)
1100  {
1101  if (BVERBOSE(V_LOAD_LIB)) Warn( "(builtin) %s already loaded", newlib);
1102  omFree(plib);
1103  return FALSE;
1104  }
1105  }
1106  else
1107  {
1108  pl = enterid( plib,0, PACKAGE_CMD, &IDROOT, TRUE );
1109  IDPACKAGE(pl)->libname=omStrDup(newlib);
1110  }
1111  IDPACKAGE(pl)->language = LANG_C;
1112 
1113  IDPACKAGE(pl)->handle=(void *)NULL;
1114  SModulFunctions sModulFunctions;
1115 
1116  package s=currPack;
1117  currPack=IDPACKAGE(pl);
1118  if( init!= NULL)
1119  {
1120  sModulFunctions.iiArithAddCmd = iiArithAddCmd;
1121  if (autoexport) sModulFunctions.iiAddCproc = iiAddCprocTop;
1122  else sModulFunctions.iiAddCproc = iiAddCproc;
1123  (*init)(&sModulFunctions);
1124  }
1125  if (BVERBOSE(V_LOAD_LIB)) Print( "// ** loaded (builtin) %s \n", newlib);
1126  currPack->loaded=1;
1127  currPack=s;
1128 
1129  return FALSE;
1130 }
int iiAddCprocTop(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: iplib.cc:969
const CanonicalForm int s
Definition: facAbsFact.cc:55
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:94
#define V_LOAD_LIB
Definition: options.h:45
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:98
Definition: idrec.h:34
poly res
Definition: myNF.cc:322
Definition: subexpr.h:22
#define IDPACKAGE(a)
Definition: ipid.h:136
#define IDTYP(a)
Definition: ipid.h:116
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:258
#define omFree(addr)
Definition: omAllocDecl.h:261
#define BVERBOSE(a)
Definition: options.h:33
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:64
package currPack
Definition: ipid.cc:63
int(* iiAddCproc)(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: ipid.h:71
int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: iplib.cc:897
char * iiConvName(const char *libname)
Definition: iplib.cc:1214
int BOOLEAN
Definition: auxiliary.h:85
int(* iiArithAddCmd)(const char *szName, short nAlias, short nTokval, short nToktype, short nPos)
Definition: ipid.h:73
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263
int iiArithAddCmd(const char *szName, short nAlias, short nTokval, short nToktype, short nPos)
Definition: iparith.cc:8966

◆ module_help_main()

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

Definition at line 1132 of file iplib.cc.

1133 {
1134  char *plib = iiConvName(newlib);
1135  idhdl pl = basePack->idroot->get(plib,0);
1136  if ((pl==NULL)||(IDTYP(pl)!=PACKAGE_CMD))
1137  Werror(">>%s<< is not a package (trying to add package help)",plib);
1138  else
1139  {
1140  package s=currPack;
1141  currPack=IDPACKAGE(pl);
1143  IDSTRING(h)=omStrDup(help);
1144  currPack=s;
1145  }
1146 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:94
#define IDROOT
Definition: ipid.h:20
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:136
#define IDTYP(a)
Definition: ipid.h:116
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:258
#define IDSTRING(a)
Definition: ipid.h:133
#define help
Definition: libparse.cc:1228
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:64
package currPack
Definition: ipid.cc:63
char * iiConvName(const char *libname)
Definition: iplib.cc:1214
static Poly * h
Definition: janet.cc:978
void Werror(const char *fmt,...)
Definition: reporter.cc:189
#define omStrDup(s)
Definition: omAllocDecl.h:263

◆ module_help_proc()

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

Definition at line 1147 of file iplib.cc.

1148 {
1149  char *plib = iiConvName(newlib);
1150  idhdl pl = basePack->idroot->get(plib,0);
1151  if ((pl==NULL)||(IDTYP(pl)!=PACKAGE_CMD))
1152  Werror(">>%s<< is not a package(trying to add help for %s)",plib,p);
1153  else
1154  {
1155  package s=currPack;
1156  currPack=IDPACKAGE(pl);
1157  char buff[256];
1158  buff[255]='\0';
1159  strncpy(buff,p,255);
1160  strncat(buff,"_help",255-strlen(p));
1162  IDSTRING(h)=omStrDup(help);
1163  currPack=s;
1164  }
1165 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define IDROOT
Definition: ipid.h:20
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:136
#define IDTYP(a)
Definition: ipid.h:116
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:258
#define IDSTRING(a)
Definition: ipid.h:133
#define help
Definition: libparse.cc:1228
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:64
package currPack
Definition: ipid.cc:63
char * iiConvName(const char *libname)
Definition: iplib.cc:1214
static Poly * h
Definition: janet.cc:978
void Werror(const char *fmt,...)
Definition: reporter.cc:189
#define omStrDup(s)
Definition: omAllocDecl.h:263

◆ packFindHdl()

idhdl packFindHdl ( package  r)

Definition at line 738 of file ipid.cc.

739 {
740  idhdl h=basePack->idroot;
741  while (h!=NULL)
742  {
743  if ((IDTYP(h)==PACKAGE_CMD)
744  && (IDPACKAGE(h)==r))
745  return h;
746  h=IDNEXT(h);
747  }
748  return NULL;
749 }
#define IDNEXT(a)
Definition: ipid.h:115
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:136
#define IDTYP(a)
Definition: ipid.h:116
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:64
static Poly * h
Definition: janet.cc:978

◆ paCopy()

package paCopy ( package  pack)
inline

Definition at line 45 of file ipid.h.

46 {
47  pack->ref++;
48  return pack;
49 }

◆ paKill()

void paKill ( package  pack)
inline

Definition at line 51 of file ipid.h.

52 {
53  pack->ref--;
54 }

Variable Documentation

◆ basePack

package basePack

Definition at line 64 of file ipid.cc.

◆ basePackHdl

idhdl basePackHdl

Definition at line 62 of file ipid.cc.

◆ coeffs_BIGINT

coeffs coeffs_BIGINT

Definition at line 54 of file ipid.cc.

◆ currPack

package currPack

Definition at line 63 of file ipid.cc.

◆ currPackHdl

idhdl currPackHdl

Definition at line 61 of file ipid.cc.

◆ currRingHdl

idhdl currRingHdl

Definition at line 65 of file ipid.cc.

◆ feFilePending

FILE* feFilePending

Definition at line 56 of file ipid.cc.

◆ idrec_bin

omBin idrec_bin

Definition at line 52 of file ipid.cc.

◆ optionStruct

const struct soptionStruct optionStruct[]

Definition at line 516 of file misc_ip.cc.

◆ procstack

proclevel* procstack

Definition at line 58 of file ipid.cc.

◆ sip_command_bin

omBin sip_command_bin

Definition at line 49 of file ipid.cc.

◆ sip_package_bin

omBin sip_package_bin

Definition at line 50 of file ipid.cc.

◆ sleftv_bin

omBin sleftv_bin

Definition at line 50 of file subexpr.cc.

◆ verboseStruct

const struct soptionStruct verboseStruct[]

Definition at line 546 of file misc_ip.cc.