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
 

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 jjNormalizeQRingId (leftv I)
 
void jjNormalizeQRingP (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
 

Data Structure Documentation

struct sip_command

Definition at line 26 of file ipid.h.

Data Fields
sleftv arg1
sleftv arg2
sleftv arg3
short argc
short op
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

Macro Definition Documentation

#define FLAG_QRING   4

Definition at line 110 of file ipid.h.

#define FLAG_STD   0

Definition at line 108 of file ipid.h.

#define FLAG_TWOSTD   3

Definition at line 109 of file ipid.h.

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

Definition at line 111 of file ipid.h.

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

Definition at line 122 of file ipid.h.

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

Definition at line 130 of file ipid.h.

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

Definition at line 128 of file ipid.h.

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

Definition at line 125 of file ipid.h.

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

Definition at line 119 of file ipid.h.

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

Definition at line 121 of file ipid.h.

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

Definition at line 132 of file ipid.h.

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

Definition at line 124 of file ipid.h.

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

Definition at line 127 of file ipid.h.

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

Definition at line 120 of file ipid.h.

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

Definition at line 137 of file ipid.h.

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

Definition at line 136 of file ipid.h.

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

Definition at line 134 of file ipid.h.

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

Definition at line 133 of file ipid.h.

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

Definition at line 117 of file ipid.h.

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

Definition at line 131 of file ipid.h.

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

Definition at line 138 of file ipid.h.

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

Definition at line 129 of file ipid.h.

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

Definition at line 139 of file ipid.h.

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

Definition at line 126 of file ipid.h.

#define IDROOT   (currPack->idroot)

Definition at line 20 of file ipid.h.

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

Definition at line 135 of file ipid.h.

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

Definition at line 118 of file ipid.h.

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

Definition at line 113 of file ipid.h.

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

Definition at line 112 of file ipid.h.

Typedef Documentation

typedef ip_command* command

Definition at line 24 of file ipid.h.

typedef int(* SModulFunc_t) (SModulFunctions *)

Definition at line 84 of file ipid.h.

Function Documentation

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

Definition at line 256 of file ipid.cc.

257 {
258  if (s==NULL) return NULL;
259  if (root==NULL) return NULL;
260  idhdl h;
261  s=omStrDup(s);
262  // idhdl *save_root=root;
263  if (t==PACKAGE_CMD)
264  {
265  if (root!=&(basePack->idroot))
266  {
267  root=&(basePack->idroot);
268  }
269  }
270  // is it already defined in root ?
271  if ((h=(*root)->get(s,lev))!=NULL)
272  {
273  if (IDLEV(h)==lev)
274  {
275  if ((IDTYP(h) == t)||(t==DEF_CMD))
276  {
277  if ((IDTYP(h)==PACKAGE_CMD)
278  && (strcmp(s,"Top")==0))
279  {
280  goto errlabel;
281  }
282  if (BVERBOSE(V_REDEFINE))
283  Warn("redefining %s **",s);
284  if (s==IDID(h)) IDID(h)=NULL;
285  killhdl2(h,root,currRing);
286  }
287  else
288  goto errlabel;
289  }
290  }
291  // is it already defined in currRing->idroot ?
292  else if (search && (currRing!=NULL)&&((*root) != currRing->idroot))
293  {
294  if ((h=currRing->idroot->get(s,lev))!=NULL)
295  {
296  if (IDLEV(h)==lev)
297  {
298  if ((IDTYP(h) == t)||(t==DEF_CMD))
299  {
300  if (BVERBOSE(V_REDEFINE))
301  Warn("redefining %s **",s);
302  if (s==IDID(h)) IDID(h)=NULL;
303  killhdl2(h,&currRing->idroot,currRing);
304  }
305  else
306  goto errlabel;
307  }
308  }
309  }
310  // is it already defined in idroot ?
311  else if (search && (*root != IDROOT))
312  {
313  if ((h=IDROOT->get(s,lev))!=NULL)
314  {
315  if (IDLEV(h)==lev)
316  {
317  if ((IDTYP(h) == t)||(t==DEF_CMD))
318  {
319  if (BVERBOSE(V_REDEFINE))
320  Warn("redefining `%s` **",s);
321  if (s==IDID(h)) IDID(h)=NULL;
322  killhdl2(h,&IDROOT,NULL);
323  }
324  else
325  goto errlabel;
326  }
327  }
328  }
329  *root = (*root)->set(s, lev, t, init);
330 #ifndef SING_NDEBUG
331  checkall();
332 #endif
333  return *root;
334 
335  errlabel:
336  //Werror("identifier `%s` in use(lev h=%d,typ=%d,t=%d, curr=%d)",s,IDLEV(h),IDTYP(h),t,lev);
337  Werror("identifier `%s` in use",s);
338  //listall();
339  omFree((ADDRESS)s);
340  return NULL;
341 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define IDID(a)
Definition: ipid.h:121
#define IDROOT
Definition: ipid.h:20
void * ADDRESS
Definition: auxiliary.h:161
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:12
#define IDTYP(a)
Definition: ipid.h:118
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:400
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
void checkall()
Definition: misc_ip.cc:1016
#define IDLEV(a)
Definition: ipid.h:120
#define BVERBOSE(a)
Definition: options.h:33
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
static Poly * h
Definition: janet.cc:978
#define V_REDEFINE
Definition: options.h:43
void Werror(const char *fmt,...)
Definition: reporter.cc:199
idhdl set(const char *s, int lev, int t, BOOLEAN init=TRUE)
Definition: ipid.cc:215
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263
idhdl ggetid ( const char *  n)

Definition at line 500 of file ipid.cc.

501 {
502  idhdl h = IDROOT->get(n,myynest);
503  if ((h!=NULL)&&(IDLEV(h)==myynest)) return h;
504  idhdl h2=NULL;
505  if (currRing!=NULL)
506  {
507  h2 = currRing->idroot->get(n,myynest);
508  }
509  if (h2!=NULL) return h2;
510  if (h!=NULL) return h;
511  if (basePack!=currPack)
512  return basePack->idroot->get(n,myynest);
513  return NULL;
514 }
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#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:12
#define IDLEV(a)
Definition: ipid.h:120
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
package currPack
Definition: ipid.cc:62
static Poly * h
Definition: janet.cc:978
idhdl ggetid ( const char *  n,
BOOLEAN  local,
idhdl packhdl 
)

Definition at line 487 of file ipid.cc.

488 {
489  idhdl h = IDROOT->get(n,myynest);
490  idhdl h2=NULL;
491  *packhdl = NULL;
492  if ((currRing!=NULL) && ((h==NULL)||(IDLEV(h)!=myynest)))
493  {
494  h2 = currRing->idroot->get(n,myynest);
495  }
496  if (h2==NULL) return h;
497  return h2;
498 }
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#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:12
#define IDLEV(a)
Definition: ipid.h:120
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978
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_1
137  case CNUMBER_CMD:
138  return (void*)n2Init(0,NULL);
139  case CMATRIX_CMD:
140 #endif
141  case BIGINTMAT_CMD:
142  return (void *)new bigintmat();
143  case INTVEC_CMD:
144  case INTMAT_CMD:
145  return (void *)new intvec();
146  case NUMBER_CMD:
147  return (void *) nInit(0);
148  case BIGINT_CMD:
149  return (void *) n_Init(0, coeffs_BIGINT);
150  case IDEAL_CMD:
151  case MODUL_CMD:
152  case MATRIX_CMD:
153  return (void*) idInit(1,1);
154  case MAP_CMD:
155  {
156  map m = (map)idInit(1,1);
157  m->preimage = omStrDup(IDID(currRingHdl));
158  return (void *)m;
159  }
160  case STRING_CMD:
161  return (void *)omAlloc0(1);
162  case LIST_CMD:
163  {
165  l->Init();
166  return (void*)l;
167  }
168  //the types with the standard init: set the struct to zero
169  case LINK_CMD:
170  return (void*) omAlloc0Bin(sip_link_bin);
171  case RING_CMD:
172  return (void*) omAlloc0Bin(sip_sring_bin);
173  case PACKAGE_CMD:
174  {
175  package pa=(package)omAlloc0Bin(sip_package_bin);
176  pa->language=LANG_NONE;
177  pa->loaded = FALSE;
178  return (void*)pa;
179  }
180  case PROC_CMD:
181  {
183  pi->ref=1;
184  pi->language=LANG_NONE;
185  return (void*)pi;
186  }
187  case RESOLUTION_CMD:
188  return (void *)omAlloc0(sizeof(ssyStrategy));
189  //other types: without init (int,script,poly,def,package)
190  case CRING_CMD:
191  case INT_CMD:
192  case DEF_CMD:
193  case POLY_CMD:
194  case VECTOR_CMD:
195  case QRING_CMD:
196  return (void*)0L;
197  default:
198  {
199  if (t>MAX_TOK)
200  {
201 #ifdef BLACKBOX_DEVEL
202  Print("bb-type %d\n",t);
203 #endif
204  blackbox *bb=getBlackboxStuff(t);
205  if (bb!=NULL)
206  return (void *)bb->blackbox_Init(bb);
207  }
208  else
209  Werror("unknown type %d",t);
210  break;
211  }
212  }
213  return (void *)0L;
214 }
#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:85
Definition: lists.h:22
#define IDID(a)
Definition: ipid.h:121
#define FALSE
Definition: auxiliary.h:140
Definition: tok.h:42
Matrices of numbers.
Definition: bigintmat.h:32
Definition: tok.h:167
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:539
language_defs language
Definition: subexpr.h:58
short ref
Definition: subexpr.h:59
coeffs coeffs_BIGINT
Definition: ipid.cc:53
omBin procinfo_bin
Definition: subexpr.cc:51
Definition: tok.h:56
static number2 n2Init(long i, coeffs c)
Definition: number2.h:17
Definition: intvec.h:16
Definition: tok.h:58
idhdl currRingHdl
Definition: ipid.cc:64
omBin sip_sring_bin
Definition: ring.cc:54
int m
Definition: cfEzgcd.cc:119
Definition: tok.h:88
INLINE_THIS void Init(int l=0)
Definition: lists.h:66
#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:95
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:96
omBin slists_bin
Definition: lists.cc:23
Definition: tok.h:126
#define nInit(i)
Definition: numbers.h:24
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
procinfo * procinfov
Definition: structs.h:63
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:20
#define omStrDup(s)
Definition: omAllocDecl.h:263
void ipListFlag ( idhdl  h)

Definition at line 516 of file ipid.cc.

517 {
518  if (hasFlag(h,FLAG_STD)) PrintS(" (SB)");
519 #ifdef HAVE_PLURAL
520  if (hasFlag(h,FLAG_TWOSTD)) PrintS(" (2SB)");
521 #endif
522 }
#define FLAG_TWOSTD
Definition: ipid.h:109
void PrintS(const char *s)
Definition: reporter.cc:294
#define FLAG_STD
Definition: ipid.h:108
#define hasFlag(A, F)
Definition: ipid.h:111
void ipMoveId ( idhdl  h)

Definition at line 601 of file ipid.cc.

602 {
603  if ((currRing!=NULL)&&(tomove!=NULL))
604  {
605  if (((QRING_CMD!=IDTYP(tomove)) && RingDependend(IDTYP(tomove)))
606  || ((IDTYP(tomove)==LIST_CMD) && (lRingDependend(IDLIST(tomove)))))
607  {
608  /*move 'tomove' to ring id's*/
609  if (ipSwapId(tomove,IDROOT,currRing->idroot))
610  ipSwapId(tomove,basePack->idroot,currRing->idroot);
611  }
612  else
613  {
614  /*move 'tomove' to global id's*/
615  ipSwapId(tomove,currRing->idroot,IDROOT);
616  }
617  }
618 }
#define IDLIST(a)
Definition: ipid.h:136
#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:12
#define IDTYP(a)
Definition: ipid.h:118
int RingDependend(int t)
Definition: gentable.cc:23
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
Definition: tok.h:96
Definition: tok.h:126
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
Definition: ipid.cc:576
lists ipNameList ( idhdl  root)

Definition at line 524 of file ipid.cc.

525 {
526  idhdl h=root;
527  /* compute the length */
528  int l=0;
529  while (h!=NULL) { l++; h=IDNEXT(h); }
530  /* allocate list */
532  L->Init(l);
533  /* copy names */
534  h=root;
535  l=0;
536  while (h!=NULL)
537  {
538  /* list is initialized with 0 => no need to clear anything */
539  L->m[l].rtyp=STRING_CMD;
540  L->m[l].data=omStrDup(IDID(h));
541  l++;
542  h=IDNEXT(h);
543  }
544  return L;
545 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
sleftv * m
Definition: lists.h:45
Definition: lists.h:22
#define IDID(a)
Definition: ipid.h:121
#define IDNEXT(a)
Definition: ipid.h:117
Definition: idrec.h:34
void * data
Definition: subexpr.h:89
INLINE_THIS void Init(int l=0)
Definition: lists.h:66
#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
lists ipNameListLev ( idhdl  root,
int  lev 
)

Definition at line 547 of file ipid.cc.

548 {
549  idhdl h=root;
550  /* compute the length */
551  int l=0;
552  while (h!=NULL) { if (IDLEV(h)==lev) l++; h=IDNEXT(h); }
553  /* allocate list */
555  L->Init(l);
556  /* copy names */
557  h=root;
558  l=0;
559  while (h!=NULL)
560  {
561  if (IDLEV(h)==lev)
562  {
563  /* list is initialized with 0 => no need to clear anything */
564  L->m[l].rtyp=STRING_CMD;
565  L->m[l].data=omStrDup(IDID(h));
566  l++;
567  }
568  h=IDNEXT(h);
569  }
570  return L;
571 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
sleftv * m
Definition: lists.h:45
Definition: lists.h:22
#define IDID(a)
Definition: ipid.h:121
#define IDNEXT(a)
Definition: ipid.h:117
Definition: idrec.h:34
void * data
Definition: subexpr.h:89
#define IDLEV(a)
Definition: ipid.h:120
INLINE_THIS void Init(int l=0)
Definition: lists.h:66
#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
void jjNormalizeQRingId ( leftv  I)

Definition at line 2117 of file ipassign.cc.

2118 {
2119  if ((currRing->qideal!=NULL) && (!hasFlag(I,FLAG_QRING)))
2120  {
2121  if (I->e==NULL)
2122  {
2123  ideal I0=(ideal)I->Data();
2124  switch (I->Typ())
2125  {
2126  case IDEAL_CMD:
2127  case MODUL_CMD:
2128  {
2129  ideal F=idInit(1,1);
2130  ideal II=kNF(F,currRing->qideal,I0);
2131  idDelete(&F);
2132  if (I->rtyp!=IDHDL)
2133  {
2134  idDelete((ideal*)&(I0));
2135  I->data=II;
2136  }
2137  else
2138  {
2139  idhdl h=(idhdl)I->data;
2140  idDelete((ideal*)&IDIDEAL(h));
2141  IDIDEAL(h)=II;
2142  setFlag(h,FLAG_QRING);
2143  }
2144  break;
2145  }
2146  default: break;
2147  }
2148  setFlag(I,FLAG_QRING);
2149  }
2150  }
2151 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2815
Subexpr e
Definition: subexpr.h:106
#define IDIDEAL(a)
Definition: ipid.h:132
int Typ()
Definition: subexpr.cc:955
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
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:12
#define setFlag(A, F)
Definition: ipid.h:112
idrec * idhdl
Definition: ring.h:18
#define FLAG_QRING
Definition: ipid.h:110
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:111
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
static Poly * h
Definition: janet.cc:978
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
void jjNormalizeQRingP ( leftv  I)

Definition at line 2152 of file ipassign.cc.

2153 {
2154  if ((currRing->qideal!=NULL) && (!hasFlag(I,FLAG_QRING)))
2155  {
2156  poly p=(poly)I->Data();
2157  if ((I->e==NULL) && (p!=NULL))
2158  {
2159  ideal F=idInit(1,1);
2160  poly II=kNF(F,currRing->qideal,p);
2161  idDelete(&F);
2162  if ((I->rtyp==POLY_CMD)
2163  || (I->rtyp==VECTOR_CMD))
2164  {
2165  pDelete(&p);
2166  I->data=II;
2167  }
2168  else if (I->rtyp==IDHDL)
2169  {
2170  pDelete(&p);
2171  idhdl h=(idhdl)I->data;
2172  IDPOLY(h)=II;
2173  setFlag(h,FLAG_QRING);
2174  }
2175  else
2176  {
2177  pDelete(&II);
2178  }
2179  }
2180  setFlag(I,FLAG_QRING);
2181  }
2182 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2815
Subexpr e
Definition: subexpr.h:106
return P p
Definition: myNF.cc:203
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
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:12
#define setFlag(A, F)
Definition: ipid.h:112
idrec * idhdl
Definition: ring.h:18
#define FLAG_QRING
Definition: ipid.h:110
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
#define IDPOLY(a)
Definition: ipid.h:129
#define hasFlag(A, F)
Definition: ipid.h:111
#define pDelete(p_ptr)
Definition: polys.h:157
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
void killhdl ( idhdl  h,
package  prooti = currPack 
)

Definition at line 369 of file ipid.cc.

370 {
371  int t=IDTYP(h);
372  if (((BEGIN_RING<t) && (t<END_RING) && (t!=QRING_CMD))
373  || ((t==LIST_CMD) && (lRingDependend((lists)IDDATA(h)))))
374  killhdl2(h,&currRing->idroot,currRing);
375  else
376  {
377  if(t==PACKAGE_CMD)
378  {
379  killhdl2(h,&(basePack->idroot),NULL);
380  }
381  else
382  {
383  idhdl s=proot->idroot;
384  while ((s!=h) && (s!=NULL)) s=s->next;
385  if (s!=NULL)
386  killhdl2(h,&(proot->idroot),NULL);
387  else if (basePack!=proot)
388  {
389  idhdl s=basePack->idroot;
390  while ((s!=h) && (s!=NULL)) s=s->next;
391  if (s!=NULL)
392  killhdl2(h,&(basePack->idroot),currRing);
393  else
394  killhdl2(h,&(currRing->idroot),currRing);
395  }
396  }
397  }
398 }
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:12
#define IDTYP(a)
Definition: ipid.h:118
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:400
idhdl next
Definition: idrec.h:38
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
Definition: tok.h:96
Definition: tok.h:126
#define IDDATA(a)
Definition: ipid.h:125
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
void killhdl2 ( idhdl  h,
idhdl ih,
ring  r 
)

Definition at line 400 of file ipid.cc.

401 {
402  //printf("kill %s, id %x, typ %d lev: %d\n",IDID(h),(int)IDID(h),IDTYP(h),IDLEV(h));
403  idhdl hh;
404 
405  if (TEST_V_ALLWARN
406  && (IDLEV(h)!=myynest)
407  &&(IDLEV(h)==0))
408  {
409  if (((*ih)==basePack->idroot)
410  || ((currRing!=NULL)&&((*ih)==currRing->idroot)))
411  Warn("kill global `%s` at line >>%s<<\n",IDID(h),my_yylinebuf);
412  }
413  if (h->attribute!=NULL)
414  {
415  //h->attribute->killAll(r); MEMORY LEAK!
416  h->attribute=NULL;
417  }
418  if (IDTYP(h) == PACKAGE_CMD)
419  {
420  if (strcmp(IDID(h),"Top")==0)
421  {
422  WarnS("can not kill `Top`");
423  return;
424  }
425  // any objects defined for this package ?
426  if ((IDPACKAGE(h)->ref<=0) && (IDPACKAGE(h)->idroot!=NULL))
427  {
428  if (currPack==IDPACKAGE(h))
429  {
432  }
433  idhdl * hd = &IDRING(h)->idroot;
434  idhdl hdh = IDNEXT(*hd);
435  idhdl temp;
436  while (hdh!=NULL)
437  {
438  temp = IDNEXT(hdh);
439  killhdl2(hdh,&(IDPACKAGE(h)->idroot),NULL);
440  hdh = temp;
441  }
442  killhdl2(*hd,hd,NULL);
443  if (IDPACKAGE(h)->libname!=NULL) omFree((ADDRESS)(IDPACKAGE(h)->libname));
444  }
445  paKill(IDPACKAGE(h));
448  }
449  else if ((IDTYP(h)==RING_CMD)||(IDTYP(h)==QRING_CMD))
450  rKill(h);
451  else if (IDDATA(h)!=NULL)
453  // general -------------------------------------------------------------
454  // now dechain it and delete idrec
455  if (IDID(h)!=NULL) // OB: ?????
456  omFree((ADDRESS)IDID(h));
457  IDID(h)=NULL;
458  IDDATA(h)=NULL;
459  if (h == (*ih))
460  {
461  // h is at the beginning of the list
462  *ih = IDNEXT(h) /* ==*ih */;
463  }
464  else if (ih!=NULL)
465  {
466  // h is somethere in the list:
467  hh = *ih;
468  loop
469  {
470  if (hh==NULL)
471  {
472  PrintS(">>?<< not found for kill\n");
473  return;
474  }
475  idhdl hhh = IDNEXT(hh);
476  if (hhh == h)
477  {
478  IDNEXT(hh) = IDNEXT(hhh);
479  break;
480  }
481  hh = hhh;
482  }
483  }
485 }
idhdl currPackHdl
Definition: ipid.cc:60
loop
Definition: myNF.cc:98
#define IDID(a)
Definition: ipid.h:121
#define IDNEXT(a)
Definition: ipid.h:117
void * ADDRESS
Definition: auxiliary.h:161
#define WarnS
Definition: emacs.cc:81
void paKill(package pack)
Definition: ipid.h:51
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:138
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define IDTYP(a)
Definition: ipid.h:118
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:400
char my_yylinebuf[80]
Definition: febase.cc:48
const ring r
Definition: syzextra.cc:208
void rKill(ring r)
Definition: ipshell.cc:5690
omBin idrec_bin
Definition: ipid.cc:51
#define omFree(addr)
Definition: omAllocDecl.h:261
void s_internalDelete(const int t, void *d, const ring r)
Definition: subexpr.cc:464
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDLEV(a)
Definition: ipid.h:120
#define NULL
Definition: omList.c:10
attr attribute
Definition: idrec.h:41
package basePack
Definition: ipid.cc:63
#define IDRING(a)
Definition: ipid.h:126
package currPack
Definition: ipid.cc:62
Definition: tok.h:126
idhdl packFindHdl(package r)
Definition: ipid.cc:729
void iiCheckPack(package &p)
Definition: ipshell.cc:1504
#define IDDATA(a)
Definition: ipid.h:125
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
#define TEST_V_ALLWARN
Definition: options.h:135
#define Warn
Definition: emacs.cc:80
void killid ( const char *  a,
idhdl i 
)

Definition at line 342 of file ipid.cc.

343 {
344  if (id!=NULL)
345  {
346  idhdl h = (*ih)->get(id,myynest);
347 
348  // id not found in global list, is it defined in current ring ?
349  if (h==NULL)
350  {
351  if ((currRing!=NULL) && (*ih != (currRing->idroot)))
352  {
353  h = currRing->idroot->get(id,myynest);
354  if (h!=NULL)
355  {
356  killhdl2(h,&(currRing->idroot),currRing);
357  return;
358  }
359  }
360  Werror("`%s` is not defined",id);
361  return;
362  }
363  killhdl2(h,ih,currRing);
364  }
365  else
366  Werror("kill what ?");
367 }
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:12
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:400
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978
void Werror(const char *fmt,...)
Definition: reporter.cc:199
BOOLEAN load_builtin ( const char *  newlib,
BOOLEAN  autoexport,
SModulFunc_t  init 
)

Definition at line 1145 of file iplib.cc.

1146 {
1147  int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic,
1148  BOOLEAN(*func)(leftv res, leftv v));
1149 /*
1150  typedef int (*fktn_t)(int(*iiAddCproc)(const char *libname, const char *procname,
1151  BOOLEAN pstatic,
1152  BOOLEAN(*func)(leftv res, leftv v)));
1153 */
1154  // SModulFunc_t fktn;
1155  idhdl pl;
1156  char *plib = iiConvName(newlib);
1157  // BOOLEAN RET=TRUE;
1158  // int token;
1159 
1160  pl = IDROOT->get(plib,0);
1161  if (pl!=NULL)
1162  {
1163  if (BVERBOSE(V_LOAD_LIB)) Warn( "(builtin) %s already loaded", newlib);
1164  omFree(plib);
1165  return FALSE;
1166  }
1167 
1168  pl = enterid( plib,0, PACKAGE_CMD, &IDROOT,
1169  TRUE );
1170  IDPACKAGE(pl)->language = LANG_C;
1171  IDPACKAGE(pl)->libname=omStrDup(newlib);
1172 
1173  IDPACKAGE(pl)->handle=(void *)NULL;
1174  SModulFunctions sModulFunctions;
1175 
1176  package s=currPack;
1177  currPack=IDPACKAGE(pl);
1178  if( init!= NULL)
1179  {
1180  sModulFunctions.iiArithAddCmd = iiArithAddCmd;
1181  if (autoexport) sModulFunctions.iiAddCproc = iiAddCprocTop;
1182  else sModulFunctions.iiAddCproc = iiAddCproc;
1183  (*init)(&sModulFunctions);
1184  }
1185  if (BVERBOSE(V_LOAD_LIB)) Print( "// ** loaded (builtin) %s \n", newlib);
1186  currPack->loaded=1;
1187  currPack=s;
1188 
1189  return FALSE;
1190 }
int iiAddCprocTop(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: iplib.cc:1035
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:140
#define V_LOAD_LIB
Definition: options.h:45
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:144
Definition: idrec.h:34
poly res
Definition: myNF.cc:322
Definition: subexpr.h:20
#define IDPACKAGE(a)
Definition: ipid.h:138
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:256
#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:62
int(* iiAddCproc)(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: ipid.h:73
int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: iplib.cc:1001
char * iiConvName(const char *libname)
Definition: iplib.cc:1277
int BOOLEAN
Definition: auxiliary.h:131
int(* iiArithAddCmd)(const char *szName, short nAlias, short nTokval, short nToktype, short nPos)
Definition: ipid.h:75
#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:9062
void module_help_main ( const char *  newlib,
const char *  help 
)

Definition at line 1192 of file iplib.cc.

1193 {
1194  char *plib = iiConvName(newlib);
1195  idhdl pl = basePack->idroot->get(plib,0);
1196  if ((pl==NULL)||(IDTYP(pl)!=PACKAGE_CMD))
1197  Werror(">>%s<< is not a package (trying to add package help)",plib);
1198  else
1199  {
1200  package s=currPack;
1201  currPack=IDPACKAGE(pl);
1203  IDSTRING(h)=omStrDup(help);
1204  currPack=s;
1205  }
1206 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:140
#define IDROOT
Definition: ipid.h:20
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:138
#define IDTYP(a)
Definition: ipid.h:118
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:256
#define IDSTRING(a)
Definition: ipid.h:135
#define help
Definition: libparse.cc:1228
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
package currPack
Definition: ipid.cc:62
char * iiConvName(const char *libname)
Definition: iplib.cc:1277
static Poly * h
Definition: janet.cc:978
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define omStrDup(s)
Definition: omAllocDecl.h:263
void module_help_proc ( const char *  newlib,
const char *  p,
const char *  help 
)

Definition at line 1207 of file iplib.cc.

1208 {
1209  char *plib = iiConvName(newlib);
1210  idhdl pl = basePack->idroot->get(plib,0);
1211  if ((pl==NULL)||(IDTYP(pl)!=PACKAGE_CMD))
1212  Werror(">>%s<< is not a package(trying to add help for %s)",plib,p);
1213  else
1214  {
1215  package s=currPack;
1216  currPack=IDPACKAGE(pl);
1217  char buff[256];
1218  buff[255]='\0';
1219  strncpy(buff,p,255);
1220  strncat(buff,"_help",255-strlen(p));
1222  IDSTRING(h)=omStrDup(help);
1223  currPack=s;
1224  }
1225 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define IDROOT
Definition: ipid.h:20
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:138
#define IDTYP(a)
Definition: ipid.h:118
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:256
#define IDSTRING(a)
Definition: ipid.h:135
#define help
Definition: libparse.cc:1228
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
package currPack
Definition: ipid.cc:62
char * iiConvName(const char *libname)
Definition: iplib.cc:1277
static Poly * h
Definition: janet.cc:978
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define omStrDup(s)
Definition: omAllocDecl.h:263
idhdl packFindHdl ( package  r)

Definition at line 729 of file ipid.cc.

730 {
731  idhdl h=basePack->idroot;
732  while (h!=NULL)
733  {
734  if ((IDTYP(h)==PACKAGE_CMD)
735  && (IDPACKAGE(h)==r))
736  return h;
737  h=IDNEXT(h);
738  }
739  return NULL;
740 }
#define IDNEXT(a)
Definition: ipid.h:117
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:138
#define IDTYP(a)
Definition: ipid.h:118
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
static Poly * h
Definition: janet.cc:978
package paCopy ( package  pack)
inline

Definition at line 45 of file ipid.h.

46 {
47  pack->ref++;
48  return pack;
49 }
void paKill ( package  pack)
inline

Definition at line 51 of file ipid.h.

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

Variable Documentation

package basePack

Definition at line 63 of file ipid.cc.

idhdl basePackHdl

Definition at line 61 of file ipid.cc.

coeffs coeffs_BIGINT

Definition at line 53 of file ipid.cc.

package currPack

Definition at line 62 of file ipid.cc.

idhdl currPackHdl

Definition at line 60 of file ipid.cc.

idhdl currRingHdl

Definition at line 64 of file ipid.cc.

FILE* feFilePending

Definition at line 55 of file ipid.cc.

omBin idrec_bin

Definition at line 51 of file ipid.cc.

proclevel* procstack

Definition at line 57 of file ipid.cc.

omBin sip_command_bin

Definition at line 48 of file ipid.cc.

omBin sip_package_bin

Definition at line 49 of file ipid.cc.

omBin sleftv_bin

Definition at line 50 of file subexpr.cc.