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

260 {
261  if (s==NULL) return NULL;
262  if (root==NULL) return NULL;
263  idhdl h;
264  s=omStrDup(s);
265  // idhdl *save_root=root;
266  if (t==PACKAGE_CMD)
267  {
268  if (root!=&(basePack->idroot))
269  {
270  root=&(basePack->idroot);
271  }
272  }
273  // is it already defined in root ?
274  if ((h=(*root)->get(s,lev))!=NULL)
275  {
276  if (IDLEV(h)==lev)
277  {
278  if ((IDTYP(h) == t)||(t==DEF_CMD))
279  {
280  if ((IDTYP(h)==PACKAGE_CMD)
281  && (strcmp(s,"Top")==0))
282  {
283  goto errlabel;
284  }
285  if (BVERBOSE(V_REDEFINE))
286  Warn("redefining %s (%s)",s,my_yylinebuf);
287  if (s==IDID(h)) IDID(h)=NULL;
288  killhdl2(h,root,currRing);
289  }
290  else
291  goto errlabel;
292  }
293  }
294  // is it already defined in currRing->idroot ?
295  else if (search && (currRing!=NULL)&&((*root) != currRing->idroot))
296  {
297  if ((h=currRing->idroot->get(s,lev))!=NULL)
298  {
299  if (IDLEV(h)==lev)
300  {
301  if ((IDTYP(h) == t)||(t==DEF_CMD))
302  {
303  if (BVERBOSE(V_REDEFINE))
304  Warn("redefining %s (%s)",s,my_yylinebuf);
305  if (s==IDID(h)) IDID(h)=NULL;
306  killhdl2(h,&currRing->idroot,currRing);
307  }
308  else
309  goto errlabel;
310  }
311  }
312  }
313  // is it already defined in idroot ?
314  else if (search && (*root != IDROOT))
315  {
316  if ((h=IDROOT->get(s,lev))!=NULL)
317  {
318  if (IDLEV(h)==lev)
319  {
320  if ((IDTYP(h) == t)||(t==DEF_CMD))
321  {
322  if (BVERBOSE(V_REDEFINE))
323  Warn("redefining %s (%s)",s,my_yylinebuf);
324  if (s==IDID(h)) IDID(h)=NULL;
325  killhdl2(h,&IDROOT,NULL);
326  }
327  else
328  goto errlabel;
329  }
330  }
331  }
332  *root = (*root)->set(s, lev, t, init);
333 #ifndef SING_NDEBUG
334  checkall();
335 #endif
336  return *root;
337 
338  errlabel:
339  //Werror("identifier `%s` in use(lev h=%d,typ=%d,t=%d, curr=%d)",s,IDLEV(h),IDTYP(h),t,lev);
340  Werror("identifier `%s` in use",s);
341  //listall();
342  omFree((ADDRESS)s);
343  return NULL;
344 }
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:118
Definition: idrec.h:34
idhdl get(const char *s, int lev)
Definition: ipid.cc:91
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:403
char my_yylinebuf[80]
Definition: febase.cc:48
Definition: tok.h:57
#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:218
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ ggetid() [1/2]

idhdl ggetid ( const char *  n)

Definition at line 503 of file ipid.cc.

504 {
505  idhdl h = IDROOT->get(n,myynest);
506  if ((h!=NULL)&&(IDLEV(h)==myynest)) return h;
507  idhdl h2=NULL;
508  if (currRing!=NULL)
509  {
510  h2 = currRing->idroot->get(n,myynest);
511  }
512  if (h2!=NULL) return h2;
513  if (h!=NULL) return h;
514  if (basePack!=currPack)
515  return basePack->idroot->get(n,myynest);
516  return NULL;
517 }
#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 490 of file ipid.cc.

491 {
492  idhdl h = IDROOT->get(n,myynest);
493  idhdl h2=NULL;
494  *packhdl = NULL;
495  if ((currRing!=NULL) && ((h==NULL)||(IDLEV(h)!=myynest)))
496  {
497  h2 = currRing->idroot->get(n,myynest);
498  }
499  if (h2==NULL) return h;
500  return h2;
501 }
#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 132 of file ipid.cc.

133 {
134  switch (t)
135  {
136  //the type with init routines:
137 #ifdef SINGULAR_4_1
138  case CNUMBER_CMD:
139  return (void*)n2Init(0,NULL);
140  case CMATRIX_CMD:
141 #endif
142  case BIGINTMAT_CMD:
143  return (void *)new bigintmat();
144  case INTVEC_CMD:
145  case INTMAT_CMD:
146  return (void *)new intvec();
147  case NUMBER_CMD:
148  return (void *) nInit(0);
149  case BIGINT_CMD:
150  return (void *) n_Init(0, coeffs_BIGINT);
151  case IDEAL_CMD:
152  case MODUL_CMD:
153  case MATRIX_CMD:
154  return (void*) idInit(1,1);
155  case MAP_CMD:
156  {
157  map m = (map)idInit(1,1);
158  m->preimage = omStrDup(IDID(currRingHdl));
159  return (void *)m;
160  }
161  case STRING_CMD:
162  return (void *)omAlloc0(1);
163  case LIST_CMD:
164  {
166  l->Init();
167  return (void*)l;
168  }
169  //the types with the standard init: set the struct to zero
170  case LINK_CMD:
171  return (void*) omAlloc0Bin(sip_link_bin);
172  case RING_CMD:
173  return NULL;
174  case PACKAGE_CMD:
175  {
176  package pa=(package)omAlloc0Bin(sip_package_bin);
177  pa->language=LANG_NONE;
178  pa->loaded = FALSE;
179  return (void*)pa;
180  }
181  case PROC_CMD:
182  {
184  pi->ref=1;
185  pi->language=LANG_NONE;
186  return (void*)pi;
187  }
188  case RESOLUTION_CMD:
189  return (void *)omAlloc0(sizeof(ssyStrategy));
190  //other types: without init (int,script,poly,def,package)
191  #ifdef SINGULAR_4_1
192  case CRING_CMD:
193  #endif
194  case INT_CMD:
195  case DEF_CMD:
196  case POLY_CMD:
197  case VECTOR_CMD:
198  case QRING_CMD:
199  return (void*)0L;
200  default:
201  {
202  if (t>MAX_TOK)
203  {
204 #ifdef BLACKBOX_DEVEL
205  Print("bb-type %d\n",t);
206 #endif
207  blackbox *bb=getBlackboxStuff(t);
208  if (bb!=NULL)
209  return (void *)bb->blackbox_Init(bb);
210  }
211  else
212  Werror("unknown type in idrecDataInit:%d",t);
213  break;
214  }
215  }
216  return (void *)0L;
217 }
#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 Print
Definition: emacs.cc:83
Definition: tok.h:94
Definition: lists.h:22
#define IDID(a)
Definition: ipid.h:119
#define FALSE
Definition: auxiliary.h:97
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:55
static number2 n2Init(long i, coeffs c)
Definition: number2.h:17
Definition: intvec.h:14
Definition: tok.h:57
idhdl currRingHdl
Definition: ipid.cc:65
int m
Definition: cfEzgcd.cc:119
Definition: tok.h:99
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:115
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:116
omBin slists_bin
Definition: lists.cc:23
Definition: tok.h:155
#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 519 of file ipid.cc.

520 {
521  if (hasFlag(h,FLAG_STD)) PrintS(" (SB)");
522 #ifdef HAVE_PLURAL
523  if (hasFlag(h,FLAG_TWOSTD)) PrintS(" (2SB)");
524 #endif
525 }
#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 604 of file ipid.cc.

605 {
606  if ((currRing!=NULL)&&(tomove!=NULL))
607  {
608  if (RingDependend(IDTYP(tomove))
609  || ((IDTYP(tomove)==LIST_CMD) && (lRingDependend(IDLIST(tomove)))))
610  {
611  /*move 'tomove' to ring id's*/
612  if (ipSwapId(tomove,IDROOT,currRing->idroot))
613  ipSwapId(tomove,basePack->idroot,currRing->idroot);
614  }
615  else
616  {
617  /*move 'tomove' to global id's*/
618  ipSwapId(tomove,currRing->idroot,IDROOT);
619  }
620  }
621 }
#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:116
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
Definition: ipid.cc:579

§ ipNameList()

lists ipNameList ( idhdl  root)

Definition at line 527 of file ipid.cc.

528 {
529  idhdl h=root;
530  /* compute the length */
531  int l=0;
532  while (h!=NULL) { l++; h=IDNEXT(h); }
533  /* allocate list */
535  L->Init(l);
536  /* copy names */
537  h=root;
538  l=0;
539  while (h!=NULL)
540  {
541  /* list is initialized with 0 => no need to clear anything */
542  L->m[l].rtyp=STRING_CMD;
543  L->m[l].data=omStrDup(IDID(h));
544  l++;
545  h=IDNEXT(h);
546  }
547  return L;
548 }
#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:90
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:93
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 550 of file ipid.cc.

551 {
552  idhdl h=root;
553  /* compute the length */
554  int l=0;
555  while (h!=NULL) { if (IDLEV(h)==lev) l++; h=IDNEXT(h); }
556  /* allocate list */
558  L->Init(l);
559  /* copy names */
560  h=root;
561  l=0;
562  while (h!=NULL)
563  {
564  if (IDLEV(h)==lev)
565  {
566  /* list is initialized with 0 => no need to clear anything */
567  L->m[l].rtyp=STRING_CMD;
568  L->m[l].data=omStrDup(IDID(h));
569  l++;
570  }
571  h=IDNEXT(h);
572  }
573  return L;
574 }
#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:90
#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:93
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 2125 of file ipassign.cc.

2126 {
2127  if ((currRing->qideal!=NULL) && (!hasFlag(I,FLAG_QRING)))
2128  {
2129  if (I->e==NULL)
2130  {
2131  ideal I0=(ideal)I->Data();
2132  switch (I->Typ())
2133  {
2134  case IDEAL_CMD:
2135  case MODUL_CMD:
2136  {
2137  ideal F=idInit(1,1);
2138  ideal II=kNF(F,currRing->qideal,I0);
2139  idDelete(&F);
2140  if (I->rtyp!=IDHDL)
2141  {
2142  idDelete((ideal*)&(I0));
2143  I->data=II;
2144  }
2145  else
2146  {
2147  idhdl h=(idhdl)I->data;
2148  idDelete((ideal*)&IDIDEAL(h));
2149  IDIDEAL(h)=II;
2150  setFlag(h,FLAG_QRING);
2151  }
2152  break;
2153  }
2154  default: break;
2155  }
2156  setFlag(I,FLAG_QRING);
2157  }
2158  }
2159 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2971
Subexpr e
Definition: subexpr.h:107
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
#define IDIDEAL(a)
Definition: ipid.h:130
int Typ()
Definition: subexpr.cc:979
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:90
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:93
void * Data()
Definition: subexpr.cc:1121
static Poly * h
Definition: janet.cc:978

§ jjNormalizeQRingP()

void jjNormalizeQRingP ( poly p)

Definition at line 2160 of file ipassign.cc.

2161 {
2162  if((p!=NULL) && (currRing->qideal!=NULL))
2163  {
2164  ideal F=idInit(1,1);
2165  poly p2=kNF(F,currRing->qideal,p);
2166  pNormalize(p2);
2167  idDelete(&F);
2168  pDelete(&p);
2169  p=p2;
2170  }
2171 }
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:31
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 372 of file ipid.cc.

373 {
374  int t=IDTYP(h);
375  if (((BEGIN_RING<t) && (t<END_RING))
376  || ((t==LIST_CMD) && (lRingDependend((lists)IDDATA(h)))))
377  killhdl2(h,&currRing->idroot,currRing);
378  else
379  {
380  if(t==PACKAGE_CMD)
381  {
382  killhdl2(h,&(basePack->idroot),NULL);
383  }
384  else
385  {
386  idhdl s=proot->idroot;
387  while ((s!=h) && (s!=NULL)) s=s->next;
388  if (s!=NULL)
389  killhdl2(h,&(proot->idroot),NULL);
390  else if (basePack!=proot)
391  {
392  idhdl s=basePack->idroot;
393  while ((s!=h) && (s!=NULL)) s=s->next;
394  if (s!=NULL)
395  killhdl2(h,&(basePack->idroot),currRing);
396  else
397  killhdl2(h,&(currRing->idroot),currRing);
398  }
399  }
400  }
401 }
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:403
idhdl next
Definition: idrec.h:38
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:64
Definition: tok.h:116
#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 403 of file ipid.cc.

404 {
405  //printf("kill %s, id %x, typ %d lev: %d\n",IDID(h),(int)IDID(h),IDTYP(h),IDLEV(h));
406  idhdl hh;
407 
408  if (TEST_V_ALLWARN
409  && (IDLEV(h)!=myynest)
410  &&(IDLEV(h)==0))
411  {
412  if (((*ih)==basePack->idroot)
413  || ((currRing!=NULL)&&((*ih)==currRing->idroot)))
414  Warn("kill global `%s` at line >>%s<<\n",IDID(h),my_yylinebuf);
415  }
416  if (h->attribute!=NULL)
417  {
418  //h->attribute->killAll(r); MEMORY LEAK!
419  h->attribute=NULL;
420  }
421  if (IDTYP(h) == PACKAGE_CMD)
422  {
423  if (strcmp(IDID(h),"Top")==0)
424  {
425  WarnS("can not kill `Top`");
426  return;
427  }
428  // any objects defined for this package ?
429  if ((IDPACKAGE(h)->ref<=0) && (IDPACKAGE(h)->idroot!=NULL))
430  {
431  if (currPack==IDPACKAGE(h))
432  {
435  }
436  idhdl * hd = &IDRING(h)->idroot;
437  idhdl hdh = IDNEXT(*hd);
438  idhdl temp;
439  while (hdh!=NULL)
440  {
441  temp = IDNEXT(hdh);
442  killhdl2(hdh,&(IDPACKAGE(h)->idroot),NULL);
443  hdh = temp;
444  }
445  killhdl2(*hd,hd,NULL);
446  if (IDPACKAGE(h)->libname!=NULL) omFree((ADDRESS)(IDPACKAGE(h)->libname));
447  }
448  paKill(IDPACKAGE(h));
451  }
452  else if (IDTYP(h)==RING_CMD)
453  rKill(h);
454  else if (IDDATA(h)!=NULL)
456  // general -------------------------------------------------------------
457  // now dechain it and delete idrec
458  if (IDID(h)!=NULL) // OB: ?????
459  omFree((ADDRESS)IDID(h));
460  IDID(h)=NULL;
461  IDDATA(h)=NULL;
462  if (h == (*ih))
463  {
464  // h is at the beginning of the list
465  *ih = IDNEXT(h) /* ==*ih */;
466  }
467  else if (ih!=NULL)
468  {
469  // h is somethere in the list:
470  hh = *ih;
471  loop
472  {
473  if (hh==NULL)
474  {
475  PrintS(">>?<< not found for kill\n");
476  return;
477  }
478  idhdl hhh = IDNEXT(hh);
479  if (hhh == h)
480  {
481  IDNEXT(hh) = IDNEXT(hhh);
482  break;
483  }
484  hh = hhh;
485  }
486  }
488 }
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:118
#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:403
char my_yylinebuf[80]
Definition: febase.cc:48
const ring r
Definition: syzextra.cc:208
void rKill(ring r)
Definition: ipshell.cc:6044
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:482
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:730
void iiCheckPack(package &p)
Definition: ipshell.cc:1509
#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 345 of file ipid.cc.

346 {
347  if (id!=NULL)
348  {
349  idhdl h = (*ih)->get(id,myynest);
350 
351  // id not found in global list, is it defined in current ring ?
352  if (h==NULL)
353  {
354  if ((currRing!=NULL) && (*ih != (currRing->idroot)))
355  {
356  h = currRing->idroot->get(id,myynest);
357  if (h!=NULL)
358  {
359  killhdl2(h,&(currRing->idroot),currRing);
360  return;
361  }
362  }
363  Werror("`%s` is not defined",id);
364  return;
365  }
366  killhdl2(h,ih,currRing);
367  }
368  else
369  WerrorS("kill what ?");
370 }
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:403
#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 1052 of file iplib.cc.

1053 {
1054  int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic,
1055  BOOLEAN(*func)(leftv res, leftv v));
1056 /*
1057  typedef int (*fktn_t)(int(*iiAddCproc)(const char *libname, const char *procname,
1058  BOOLEAN pstatic,
1059  BOOLEAN(*func)(leftv res, leftv v)));
1060 */
1061  // SModulFunc_t fktn;
1062  idhdl pl;
1063  char *plib = iiConvName(newlib);
1064  // BOOLEAN RET=TRUE;
1065  // int token;
1066 
1067  pl = IDROOT->get(plib,0);
1068  if (pl!=NULL)
1069  {
1070  if (BVERBOSE(V_LOAD_LIB)) Warn( "(builtin) %s already loaded", newlib);
1071  omFree(plib);
1072  return FALSE;
1073  }
1074 
1075  pl = enterid( plib,0, PACKAGE_CMD, &IDROOT,
1076  TRUE );
1077  IDPACKAGE(pl)->language = LANG_C;
1078  IDPACKAGE(pl)->libname=omStrDup(newlib);
1079 
1080  IDPACKAGE(pl)->handle=(void *)NULL;
1081  SModulFunctions sModulFunctions;
1082 
1083  package s=currPack;
1084  currPack=IDPACKAGE(pl);
1085  if( init!= NULL)
1086  {
1087  sModulFunctions.iiArithAddCmd = iiArithAddCmd;
1088  if (autoexport) sModulFunctions.iiAddCproc = iiAddCprocTop;
1089  else sModulFunctions.iiAddCproc = iiAddCproc;
1090  (*init)(&sModulFunctions);
1091  }
1092  if (BVERBOSE(V_LOAD_LIB)) Print( "// ** loaded (builtin) %s \n", newlib);
1093  currPack->loaded=1;
1094  currPack=s;
1095 
1096  return FALSE;
1097 }
int iiAddCprocTop(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: iplib.cc:942
const CanonicalForm int s
Definition: facAbsFact.cc:55
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:97
#define V_LOAD_LIB
Definition: options.h:45
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:101
Definition: idrec.h:34
poly res
Definition: myNF.cc:322
Definition: subexpr.h:21
#define IDPACKAGE(a)
Definition: ipid.h:136
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:259
#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 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:908
char * iiConvName(const char *libname)
Definition: iplib.cc:1184
int BOOLEAN
Definition: auxiliary.h:88
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:9171

§ module_help_main()

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

Definition at line 1099 of file iplib.cc.

1100 {
1101  char *plib = iiConvName(newlib);
1102  idhdl pl = basePack->idroot->get(plib,0);
1103  if ((pl==NULL)||(IDTYP(pl)!=PACKAGE_CMD))
1104  Werror(">>%s<< is not a package (trying to add package help)",plib);
1105  else
1106  {
1107  package s=currPack;
1108  currPack=IDPACKAGE(pl);
1110  IDSTRING(h)=omStrDup(help);
1111  currPack=s;
1112  }
1113 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:97
#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:259
#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:1184
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 1114 of file iplib.cc.

1115 {
1116  char *plib = iiConvName(newlib);
1117  idhdl pl = basePack->idroot->get(plib,0);
1118  if ((pl==NULL)||(IDTYP(pl)!=PACKAGE_CMD))
1119  Werror(">>%s<< is not a package(trying to add help for %s)",plib,p);
1120  else
1121  {
1122  package s=currPack;
1123  currPack=IDPACKAGE(pl);
1124  char buff[256];
1125  buff[255]='\0';
1126  strncpy(buff,p,255);
1127  strncat(buff,"_help",255-strlen(p));
1129  IDSTRING(h)=omStrDup(help);
1130  currPack=s;
1131  }
1132 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:97
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:259
#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:1184
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 730 of file ipid.cc.

731 {
732  idhdl h=basePack->idroot;
733  while (h!=NULL)
734  {
735  if ((IDTYP(h)==PACKAGE_CMD)
736  && (IDPACKAGE(h)==r))
737  return h;
738  h=IDNEXT(h);
739  }
740  return NULL;
741 }
#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.