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

Go to the source code of this file.

Data Structures

struct  ip_command
 
struct  ip_package
 
class  proclevel
 
struct  SModulFunctions
 
struct  soptionStruct
 

Macros

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

Typedefs

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

Functions

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

Variables

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

Data Structure Documentation

◆ sip_command

struct sip_command

Definition at line 24 of file ipid.h.

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

◆ sip_package

struct sip_package

Definition at line 33 of file ipid.h.

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

◆ soptionStruct

struct soptionStruct

Definition at line 145 of file ipid.h.

Data Fields
const char * name
unsigned resetval
unsigned setval

Macro Definition Documentation

◆ FLAG_QRING

#define FLAG_QRING   4

Definition at line 106 of file ipid.h.

◆ FLAG_STD

#define FLAG_STD   0

Definition at line 104 of file ipid.h.

◆ FLAG_TWOSTD

#define FLAG_TWOSTD   3

Definition at line 105 of file ipid.h.

◆ hasFlag

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

Definition at line 107 of file ipid.h.

◆ IDATTR

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

Definition at line 118 of file ipid.h.

◆ IDBIGINT

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

Definition at line 126 of file ipid.h.

◆ IDBIMAT

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

Definition at line 124 of file ipid.h.

◆ IDDATA

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

Definition at line 121 of file ipid.h.

◆ IDFLAG

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

Definition at line 115 of file ipid.h.

◆ IDID

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

Definition at line 117 of file ipid.h.

◆ IDIDEAL

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

Definition at line 128 of file ipid.h.

◆ IDINT

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

Definition at line 120 of file ipid.h.

◆ IDINTVEC

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

Definition at line 123 of file ipid.h.

◆ IDLEV

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

Definition at line 116 of file ipid.h.

◆ IDLINK

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

Definition at line 133 of file ipid.h.

◆ IDLIST

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

Definition at line 132 of file ipid.h.

◆ IDMAP

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

Definition at line 130 of file ipid.h.

◆ IDMATRIX

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

Definition at line 129 of file ipid.h.

◆ IDNEXT

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

Definition at line 113 of file ipid.h.

◆ IDNUMBER

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

Definition at line 127 of file ipid.h.

◆ IDPACKAGE

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

Definition at line 134 of file ipid.h.

◆ IDPOLY

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

Definition at line 125 of file ipid.h.

◆ IDPROC

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

Definition at line 135 of file ipid.h.

◆ IDRING

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

Definition at line 122 of file ipid.h.

◆ IDROOT

#define IDROOT   (currPack->idroot)

Definition at line 18 of file ipid.h.

◆ IDSTRING

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

Definition at line 131 of file ipid.h.

◆ IDTYP

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

Definition at line 114 of file ipid.h.

◆ resetFlag

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

Definition at line 109 of file ipid.h.

◆ setFlag

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

Definition at line 108 of file ipid.h.

Typedef Documentation

◆ command

typedef ip_command* command

Definition at line 22 of file ipid.h.

◆ SModulFunc_t

typedef int(* SModulFunc_t) (SModulFunctions *)

Definition at line 80 of file ipid.h.

Function Documentation

◆ checkPackage()

BOOLEAN checkPackage ( package  pack)

◆ enterid()

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

Definition at line 265 of file ipid.cc.

266 {
267  if (s==NULL) return NULL;
268  if (root==NULL) return NULL;
269  idhdl h;
270  s=omStrDup(s);
271  // idhdl *save_root=root;
272  if (t==PACKAGE_CMD)
273  {
274  if (root!=&(basePack->idroot))
275  {
276  root=&(basePack->idroot);
277  }
278  }
279  // is it already defined in root ?
280  if ((h=(*root)->get(s,lev))!=NULL)
281  {
282  if (IDLEV(h)==lev)
283  {
284  if ((IDTYP(h) == t)||(t==DEF_CMD))
285  {
286  if (IDTYP(h)==PACKAGE_CMD)
287  {
288  if (strcmp(s,"Top")==0)
289  {
290  goto errlabel;
291  }
292  else return h;
293  }
294  else
295  {
296  if (BVERBOSE(V_REDEFINE))
297  Warn("redefining %s (%s)",s,my_yylinebuf);
298  if (s==IDID(h)) IDID(h)=NULL;
299  killhdl2(h,root,currRing);
300  }
301  }
302  else
303  goto errlabel;
304  }
305  }
306  // is it already defined in currRing->idroot ?
307  else if (search && (currRing!=NULL)&&((*root) != currRing->idroot))
308  {
309  if ((h=currRing->idroot->get(s,lev))!=NULL)
310  {
311  if (IDLEV(h)==lev)
312  {
313  if ((IDTYP(h) == t)||(t==DEF_CMD))
314  {
315  if (BVERBOSE(V_REDEFINE))
316  Warn("redefining %s (%s)",s,my_yylinebuf);
317  if (s==IDID(h)) IDID(h)=NULL;
318  killhdl2(h,&currRing->idroot,currRing);
319  }
320  else
321  goto errlabel;
322  }
323  }
324  }
325  // is it already defined in idroot ?
326  else if (search && (*root != IDROOT))
327  {
328  if ((h=IDROOT->get(s,lev))!=NULL)
329  {
330  if (IDLEV(h)==lev)
331  {
332  if ((IDTYP(h) == t)||(t==DEF_CMD))
333  {
334  if (BVERBOSE(V_REDEFINE))
335  Warn("redefining %s (%s)",s,my_yylinebuf);
336  if (s==IDID(h)) IDID(h)=NULL;
337  killhdl2(h,&IDROOT,NULL);
338  }
339  else
340  goto errlabel;
341  }
342  }
343  }
344  *root = (*root)->set(s, lev, t, init);
345 #ifndef SING_NDEBUG
346  checkall();
347 #endif
348  return *root;
349 
350  errlabel:
351  //Werror("identifier `%s` in use(lev h=%d,typ=%d,t=%d, curr=%d)",s,IDLEV(h),IDTYP(h),t,lev);
352  Werror("identifier `%s` in use",s);
353  //listall();
354  omFree((ADDRESS)s);
355  return NULL;
356 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define IDID(a)
Definition: ipid.h:117
#define IDROOT
Definition: ipid.h:18
void * ADDRESS
Definition: auxiliary.h:133
Definition: idrec.h:34
idhdl get(const char *s, int lev)
Definition: ipid.cc:84
#define IDTYP(a)
Definition: ipid.h:114
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:415
char my_yylinebuf[80]
Definition: febase.cc:43
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:116
#define BVERBOSE(a)
Definition: options.h:35
#define NULL
Definition: omList.c:12
package basePack
Definition: ipid.cc:58
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static Poly * h
Definition: janet.cc:971
#define V_REDEFINE
Definition: options.h:45
void Werror(const char *fmt,...)
Definition: reporter.cc:189
idhdl set(const char *s, int lev, int t, BOOLEAN init=TRUE)
Definition: ipid.cc:223
#define Warn
Definition: emacs.cc:77
#define omStrDup(s)
Definition: omAllocDecl.h:263

◆ ggetid()

idhdl ggetid ( const char *  n)

Definition at line 521 of file ipid.cc.

522 {
523  idhdl h = IDROOT->get(n,myynest);
524  if ((h!=NULL)&&(IDLEV(h)==myynest)) return h;
525  if (currRing!=NULL)
526  {
527  idhdl h2 = currRing->idroot->get(n,myynest);
528  if (h2!=NULL) return h2;
529  }
530  if (h!=NULL) return h;
531  if (basePack!=currPack)
532  return basePack->idroot->get(n,myynest);
533  return NULL;
534 }
#define IDROOT
Definition: ipid.h:18
Definition: idrec.h:34
int myynest
Definition: febase.cc:41
#define IDLEV(a)
Definition: ipid.h:116
#define NULL
Definition: omList.c:12
package basePack
Definition: ipid.cc:58
package currPack
Definition: ipid.cc:57
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static Poly * h
Definition: janet.cc:971

◆ idrecDataInit()

void* idrecDataInit ( int  t)

Definition at line 125 of file ipid.cc.

126 {
127  switch (t)
128  {
129  //the type with init routines:
130 #ifdef SINGULAR_4_2
131  case CNUMBER_CMD:
132  return (void*)n2Init(0,NULL);
133  case CPOLY_CMD:
134  return (void*)p2Init(0,NULL);
135  case CMATRIX_CMD:
136 #endif
137  case BIGINTMAT_CMD:
138  return (void *)new bigintmat();
139  case BUCKET_CMD:
140  if (currRing!=NULL)
141  return (void*)sBucketCreate(currRing);
142  else
143  {
144  WerrorS("need basering for polyBucket");
145  return NULL;
146  }
147  case INTVEC_CMD:
148  case INTMAT_CMD:
149  return (void *)new intvec();
150  case NUMBER_CMD:
151  {
152  if (currRing!=NULL) return (void *) nInit(0);
153  else return NULL;
154  }
155  case BIGINT_CMD:
156  return (void *) n_Init(0, coeffs_BIGINT);
157  case IDEAL_CMD:
158  case MODUL_CMD:
159  case MATRIX_CMD:
160  case SMATRIX_CMD:
161  return (void*) idInit(1,1);
162  case MAP_CMD:
163  {
164  map m = (map)idInit(1,1);
165  m->preimage = omStrDup(IDID(currRingHdl));
166  return (void *)m;
167  }
168  case STRING_CMD:
169  return (void *)omAlloc0(1);
170  case LIST_CMD:
171  {
173  l->Init();
174  return (void*)l;
175  }
176  //the types with the standard init: set the struct to zero
177  case LINK_CMD:
178  return (void*) omAlloc0Bin(sip_link_bin);
179  case RING_CMD:
180  return NULL;
181  case PACKAGE_CMD:
182  {
183  package pa=(package)omAlloc0Bin(sip_package_bin);
184  pa->language=LANG_NONE;
185  pa->loaded = FALSE;
186  return (void*)pa;
187  }
188  case PROC_CMD:
189  {
191  pi->ref=1;
192  pi->language=LANG_NONE;
193  return (void*)pi;
194  }
195  case RESOLUTION_CMD:
196  return (void *)omAlloc0(sizeof(ssyStrategy));
197  //other types: without init (int,script,poly,def,package)
198  case CRING_CMD:
199  case INT_CMD:
200  case DEF_CMD:
201  case POLY_CMD:
202  case VECTOR_CMD:
203  case QRING_CMD:
204  return (void*)0L;
205  default:
206  {
207  if (t>MAX_TOK)
208  {
209 #ifdef BLACKBOX_DEVEL
210  Print("bb-type %d\n",t);
211 #endif
212  blackbox *bb=getBlackboxStuff(t);
213  if (bb!=NULL)
214  return (void *)bb->blackbox_Init(bb);
215  }
216  else
217  Werror("unknown type in idrecDataInit:%d",t);
218  break;
219  }
220  }
221  return (void *)0L;
222 }
#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:80
Definition: tok.h:96
Definition: lists.h:23
#define IDID(a)
Definition: ipid.h:117
#define FALSE
Definition: auxiliary.h:94
Definition: tok.h:38
Matrices of numbers.
Definition: bigintmat.h:50
Definition: tok.h:216
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
language_defs language
Definition: subexpr.h:59
short ref
Definition: subexpr.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:24
coeffs coeffs_BIGINT
Definition: ipid.cc:50
omBin procinfo_bin
Definition: subexpr.cc:42
Definition: tok.h:56
Definition: intvec.h:19
Definition: tok.h:58
sBucket_pt sBucketCreate(const ring r)
Definition: sbuckets.cc:96
idhdl currRingHdl
Definition: ipid.cc:59
int m
Definition: cfEzgcd.cc:121
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:35
Definition: tok.h:117
#define NULL
Definition: omList.c:12
slists * lists
Definition: mpr_numeric.h:146
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: tok.h:118
omBin slists_bin
Definition: lists.cc:23
Definition: tok.h:158
BOOLEAN pa(leftv res, leftv args)
Definition: cohomo.cc:4346
#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:93
procinfo * procinfov
Definition: structs.h:65
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 536 of file ipid.cc.

537 {
538  if (hasFlag(h,FLAG_STD)) PrintS(" (SB)");
539 #ifdef HAVE_PLURAL
540  if (hasFlag(h,FLAG_TWOSTD)) PrintS(" (2SB)");
541 #endif
542 }
#define FLAG_TWOSTD
Definition: ipid.h:105
void PrintS(const char *s)
Definition: reporter.cc:284
#define FLAG_STD
Definition: ipid.h:104
#define hasFlag(A, F)
Definition: ipid.h:107

◆ ipMoveId()

void ipMoveId ( idhdl  h)

Definition at line 621 of file ipid.cc.

622 {
623  if ((currRing!=NULL)&&(tomove!=NULL))
624  {
625  if (RingDependend(IDTYP(tomove))
626  || ((IDTYP(tomove)==LIST_CMD) && (lRingDependend(IDLIST(tomove)))))
627  {
628  /*move 'tomove' to ring id's*/
629  if (ipSwapId(tomove,IDROOT,currRing->idroot))
630  ipSwapId(tomove,basePack->idroot,currRing->idroot);
631  }
632  else
633  {
634  /*move 'tomove' to global id's*/
635  ipSwapId(tomove,currRing->idroot,IDROOT);
636  }
637  }
638 }
#define IDLIST(a)
Definition: ipid.h:132
#define IDROOT
Definition: ipid.h:18
#define IDTYP(a)
Definition: ipid.h:114
int RingDependend(int t)
Definition: gentable.cc:28
#define NULL
Definition: omList.c:12
package basePack
Definition: ipid.cc:58
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: tok.h:118
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
Definition: ipid.cc:596

◆ ipNameList()

lists ipNameList ( idhdl  root)

Definition at line 544 of file ipid.cc.

545 {
546  idhdl h=root;
547  /* compute the length */
548  int l=0;
549  while (h!=NULL) { l++; h=IDNEXT(h); }
550  /* allocate list */
552  L->Init(l);
553  /* copy names */
554  h=root;
555  l=0;
556  while (h!=NULL)
557  {
558  /* list is initialized with 0 => no need to clear anything */
559  L->m[l].rtyp=STRING_CMD;
560  L->m[l].data=omStrDup(IDID(h));
561  l++;
562  h=IDNEXT(h);
563  }
564  return L;
565 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
sleftv * m
Definition: lists.h:46
Definition: lists.h:23
#define IDID(a)
Definition: ipid.h:117
#define IDNEXT(a)
Definition: ipid.h:113
Definition: idrec.h:34
void * data
Definition: subexpr.h:88
INLINE_THIS void Init(int l=0)
#define NULL
Definition: omList.c:12
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:91
omBin slists_bin
Definition: lists.cc:23
static Poly * h
Definition: janet.cc:971
int l
Definition: cfEzgcd.cc:93
#define omStrDup(s)
Definition: omAllocDecl.h:263

◆ ipNameListLev()

lists ipNameListLev ( idhdl  root,
int  lev 
)

Definition at line 567 of file ipid.cc.

568 {
569  idhdl h=root;
570  /* compute the length */
571  int l=0;
572  while (h!=NULL) { if (IDLEV(h)==lev) l++; h=IDNEXT(h); }
573  /* allocate list */
575  L->Init(l);
576  /* copy names */
577  h=root;
578  l=0;
579  while (h!=NULL)
580  {
581  if (IDLEV(h)==lev)
582  {
583  /* list is initialized with 0 => no need to clear anything */
584  L->m[l].rtyp=STRING_CMD;
585  L->m[l].data=omStrDup(IDID(h));
586  l++;
587  }
588  h=IDNEXT(h);
589  }
590  return L;
591 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
sleftv * m
Definition: lists.h:46
Definition: lists.h:23
#define IDID(a)
Definition: ipid.h:117
#define IDNEXT(a)
Definition: ipid.h:113
Definition: idrec.h:34
void * data
Definition: subexpr.h:88
#define IDLEV(a)
Definition: ipid.h:116
INLINE_THIS void Init(int l=0)
#define NULL
Definition: omList.c:12
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:91
omBin slists_bin
Definition: lists.cc:23
static Poly * h
Definition: janet.cc:971
int l
Definition: cfEzgcd.cc:93
#define omStrDup(s)
Definition: omAllocDecl.h:263

◆ jjNormalizeQRingId()

void jjNormalizeQRingId ( leftv  I)

Definition at line 2187 of file ipassign.cc.

2188 {
2189  if ((currRing->qideal!=NULL) && (!hasFlag(I,FLAG_QRING)))
2190  {
2191  if (I->e==NULL)
2192  {
2193  ideal I0=(ideal)I->Data();
2194  switch (I->Typ())
2195  {
2196  case IDEAL_CMD:
2197  case MODUL_CMD:
2198  {
2199  ideal F=idInit(1,1);
2200  ideal II=kNF(F,currRing->qideal,I0);
2201  idDelete(&F);
2202  if (I->rtyp!=IDHDL)
2203  {
2204  idDelete((ideal*)&(I0));
2205  I->data=II;
2206  }
2207  else
2208  {
2209  idhdl h=(idhdl)I->data;
2210  idDelete((ideal*)&IDIDEAL(h));
2211  IDIDEAL(h)=II;
2212  setFlag(h,FLAG_QRING);
2213  }
2214  break;
2215  }
2216  default: break;
2217  }
2218  setFlag(I,FLAG_QRING);
2219  }
2220  }
2221 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2822
Subexpr e
Definition: subexpr.h:105
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define IDIDEAL(a)
Definition: ipid.h:128
int Typ()
Definition: subexpr.cc:1033
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:88
#define setFlag(A, F)
Definition: ipid.h:108
idrec * idhdl
Definition: ring.h:21
#define FLAG_QRING
Definition: ipid.h:106
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
#define NULL
Definition: omList.c:12
#define hasFlag(A, F)
Definition: ipid.h:107
int rtyp
Definition: subexpr.h:91
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void * Data()
Definition: subexpr.cc:1176
static Poly * h
Definition: janet.cc:971

◆ jjNormalizeQRingP()

void jjNormalizeQRingP ( poly &  p)

Definition at line 2222 of file ipassign.cc.

2223 {
2224  if((p!=NULL) && (currRing->qideal!=NULL))
2225  {
2226  ideal F=idInit(1,1);
2227  poly p2=kNF(F,currRing->qideal,p);
2228  pNormalize(p2);
2229  idDelete(&F);
2230  pDelete(&p);
2231  p=p2;
2232  }
2233 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2822
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
#define NULL
Definition: omList.c:12
#define pDelete(p_ptr)
Definition: polys.h:181
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int p
Definition: cfModGcd.cc:4019
#define pNormalize(p)
Definition: polys.h:312

◆ killhdl()

void killhdl ( idhdl  h,
package  prooti = currPack 
)

Definition at line 384 of file ipid.cc.

385 {
386  int t=IDTYP(h);
387  if (((BEGIN_RING<t) && (t<END_RING))
388  || ((t==LIST_CMD) && (lRingDependend((lists)IDDATA(h)))))
389  killhdl2(h,&currRing->idroot,currRing);
390  else
391  {
392  if(t==PACKAGE_CMD)
393  {
394  killhdl2(h,&(basePack->idroot),NULL);
395  }
396  else
397  {
398  idhdl s=proot->idroot;
399  while ((s!=h) && (s!=NULL)) s=s->next;
400  if (s!=NULL)
401  killhdl2(h,&(proot->idroot),NULL);
402  else if (basePack!=proot)
403  {
404  idhdl s=basePack->idroot;
405  while ((s!=h) && (s!=NULL)) s=s->next;
406  if (s!=NULL)
407  killhdl2(h,&(basePack->idroot),currRing);
408  else
409  killhdl2(h,&(currRing->idroot),currRing);
410  }
411  }
412  }
413 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
Definition: lists.h:23
Definition: idrec.h:34
#define IDTYP(a)
Definition: ipid.h:114
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:415
idhdl next
Definition: idrec.h:38
#define NULL
Definition: omList.c:12
package basePack
Definition: ipid.cc:58
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: tok.h:118
#define IDDATA(a)
Definition: ipid.h:121
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199

◆ killhdl2()

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

Definition at line 415 of file ipid.cc.

416 {
417  //printf("kill %s, id %x, typ %d lev: %d\n",IDID(h),(int)IDID(h),IDTYP(h),IDLEV(h));
418  idhdl hh;
419 
420  if (TEST_V_ALLWARN
421  && (IDLEV(h)!=myynest)
422  &&(IDLEV(h)==0))
423  {
424  if (((*ih)==basePack->idroot)
425  || ((currRing!=NULL)&&((*ih)==currRing->idroot)))
426  Warn("kill global `%s` at line >>%s<<\n",IDID(h),my_yylinebuf);
427  }
428  if (h->attribute!=NULL)
429  {
430  if ((IDTYP(h)==RING_CMD)&&(IDRING(h)!=r))
431  h->attribute->killAll(IDRING(h));
432  else
433  h->attribute->killAll(r);
434  h->attribute=NULL;
435  }
436  if (IDTYP(h) == PACKAGE_CMD)
437  {
438  if (((IDPACKAGE(h)->language==LANG_C)&&(IDPACKAGE(h)->idroot!=NULL))
439  || (strcmp(IDID(h),"Top")==0))
440  {
441  Warn("cannot kill `%s`",IDID(h));
442  return;
443  }
444  // any objects defined for this package ?
445  if ((IDPACKAGE(h)->ref<=0) && (IDPACKAGE(h)->idroot!=NULL))
446  {
447  if (currPack==IDPACKAGE(h))
448  {
451  }
452  idhdl * hd = &IDRING(h)->idroot;
453  idhdl hdh = IDNEXT(*hd);
454  idhdl temp;
455  while (hdh!=NULL)
456  {
457  temp = IDNEXT(hdh);
458  killhdl2(hdh,&(IDPACKAGE(h)->idroot),NULL);
459  hdh = temp;
460  }
461  killhdl2(*hd,hd,NULL);
462  if (IDPACKAGE(h)->libname!=NULL) omFree((ADDRESS)(IDPACKAGE(h)->libname));
463  }
464  paKill(IDPACKAGE(h));
467  }
468  else if (IDTYP(h)==RING_CMD)
469  rKill(h);
470  else if (IDDATA(h)!=NULL)
471  s_internalDelete(IDTYP(h),IDDATA(h),r);
472  // general -------------------------------------------------------------
473  // now dechain it and delete idrec
474  if (IDID(h)!=NULL) // OB: ?????
475  omFree((ADDRESS)IDID(h));
476  IDID(h)=NULL;
477  IDDATA(h)=NULL;
478  if (h == (*ih))
479  {
480  // h is at the beginning of the list
481  *ih = IDNEXT(h) /* ==*ih */;
482  }
483  else if (ih!=NULL)
484  {
485  // h is somethere in the list:
486  hh = *ih;
487  loop
488  {
489  if (hh==NULL)
490  {
491  PrintS(">>?<< not found for kill\n");
492  return;
493  }
494  idhdl hhh = IDNEXT(hh);
495  if (hhh == h)
496  {
497  IDNEXT(hh) = IDNEXT(hhh);
498  break;
499  }
500  hh = hhh;
501  }
502  }
504 }
void killAll(const ring r)
Definition: attrib.cc:186
idhdl currPackHdl
Definition: ipid.cc:55
#define IDID(a)
Definition: ipid.h:117
#define IDNEXT(a)
Definition: ipid.h:113
void * ADDRESS
Definition: auxiliary.h:133
#define loop
Definition: structs.h:80
void paKill(package pack)
Definition: ipid.h:49
Definition: idrec.h:34
Definition: subexpr.h:22
#define IDPACKAGE(a)
Definition: ipid.h:134
int myynest
Definition: febase.cc:41
#define IDTYP(a)
Definition: ipid.h:114
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:415
char my_yylinebuf[80]
Definition: febase.cc:43
void rKill(ring r)
Definition: ipshell.cc:6124
omBin idrec_bin
Definition: ipid.cc:48
#define omFree(addr)
Definition: omAllocDecl.h:261
void s_internalDelete(const int t, void *d, const ring r)
Definition: subexpr.cc:514
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDLEV(a)
Definition: ipid.h:116
#define NULL
Definition: omList.c:12
attr attribute
Definition: idrec.h:41
package basePack
Definition: ipid.cc:58
#define IDRING(a)
Definition: ipid.h:122
package currPack
Definition: ipid.cc:57
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
idhdl packFindHdl(package r)
Definition: ipid.cc:750
void iiCheckPack(package &p)
Definition: ipshell.cc:1539
#define IDDATA(a)
Definition: ipid.h:121
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
#define TEST_V_ALLWARN
Definition: options.h:140
#define Warn
Definition: emacs.cc:77

◆ killid()

void killid ( const char *  a,
idhdl i 
)

Definition at line 357 of file ipid.cc.

358 {
359  if (id!=NULL)
360  {
361  idhdl h = (*ih)->get(id,myynest);
362 
363  // id not found in global list, is it defined in current ring ?
364  if (h==NULL)
365  {
366  if ((currRing!=NULL) && (*ih != (currRing->idroot)))
367  {
368  h = currRing->idroot->get(id,myynest);
369  if (h!=NULL)
370  {
371  killhdl2(h,&(currRing->idroot),currRing);
372  return;
373  }
374  }
375  Werror("`%s` is not defined",id);
376  return;
377  }
378  killhdl2(h,ih,currRing);
379  }
380  else
381  WerrorS("kill what ?");
382 }
void WerrorS(const char *s)
Definition: feFopen.cc:24
Definition: idrec.h:34
int myynest
Definition: febase.cc:41
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:415
#define NULL
Definition: omList.c:12
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static Poly * h
Definition: janet.cc:971
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 1197 of file iplib.cc.

1198 {
1199  int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic,
1200  BOOLEAN(*func)(leftv res, leftv v));
1201 /*
1202  typedef int (*fktn_t)(int(*iiAddCproc)(const char *libname, const char *procname,
1203  BOOLEAN pstatic,
1204  BOOLEAN(*func)(leftv res, leftv v)));
1205 */
1206  // SModulFunc_t fktn;
1207  idhdl pl;
1208  char *plib = iiConvName(newlib);
1209  // BOOLEAN RET=TRUE;
1210  // int token;
1211 
1212  pl = basePack->idroot->get(plib,0); // search PACKAGE only in Top
1213  if ((pl!=NULL)
1214  &&(IDTYP(pl)==PACKAGE_CMD))
1215  {
1216  if(IDPACKAGE(pl)->language==LANG_C)
1217  {
1218  if (BVERBOSE(V_LOAD_LIB)) Warn( "(builtin) %s already loaded", newlib);
1219  omFree(plib);
1220  return FALSE;
1221  }
1222  }
1223  else
1224  {
1225  pl = enterid( plib,0, PACKAGE_CMD, &IDROOT, TRUE );
1226  IDPACKAGE(pl)->libname=omStrDup(newlib);
1227  }
1228  IDPACKAGE(pl)->language = LANG_C;
1229 
1230  IDPACKAGE(pl)->handle=(void *)NULL;
1231  SModulFunctions sModulFunctions;
1232 
1233  package s=currPack;
1234  currPack=IDPACKAGE(pl);
1235  if( init!= NULL)
1236  {
1237  sModulFunctions.iiArithAddCmd = iiArithAddCmd;
1238  if (autoexport) sModulFunctions.iiAddCproc = iiAddCprocTop;
1239  else sModulFunctions.iiAddCproc = iiAddCproc;
1240  (*init)(&sModulFunctions);
1241  }
1242  if (BVERBOSE(V_LOAD_LIB)) Print( "// ** loaded (builtin) %s \n", newlib);
1243  currPack->loaded=1;
1244  currPack=s;
1245 
1246  return FALSE;
1247 }
int iiAddCprocTop(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: iplib.cc:1077
const CanonicalForm int s
Definition: facAbsFact.cc:55
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
#define Print
Definition: emacs.cc:80
#define FALSE
Definition: auxiliary.h:94
#define V_LOAD_LIB
Definition: options.h:47
#define IDROOT
Definition: ipid.h:18
#define TRUE
Definition: auxiliary.h:98
Definition: idrec.h:34
Definition: subexpr.h:22
#define IDPACKAGE(a)
Definition: ipid.h:134
#define IDTYP(a)
Definition: ipid.h:114
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:265
CanonicalForm res
Definition: facAbsFact.cc:64
#define omFree(addr)
Definition: omAllocDecl.h:261
#define BVERBOSE(a)
Definition: options.h:35
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:12
package basePack
Definition: ipid.cc:58
package currPack
Definition: ipid.cc:57
int(* iiAddCproc)(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: ipid.h:69
int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: iplib.cc:1004
char * iiConvName(const char *libname)
Definition: iplib.cc:1331
int BOOLEAN
Definition: auxiliary.h:85
int(* iiArithAddCmd)(const char *szName, short nAlias, short nTokval, short nToktype, short nPos)
Definition: ipid.h:71
#define Warn
Definition: emacs.cc:77
#define omStrDup(s)
Definition: omAllocDecl.h:263
int iiArithAddCmd(const char *szName, short nAlias, short nTokval, short nToktype, short nPos)
Definition: iparith.cc:9242

◆ module_help_main()

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

Definition at line 1249 of file iplib.cc.

1250 {
1251  char *plib = iiConvName(newlib);
1252  idhdl pl = basePack->idroot->get(plib,0);
1253  if ((pl==NULL)||(IDTYP(pl)!=PACKAGE_CMD))
1254  Werror(">>%s<< is not a package (trying to add package help)",plib);
1255  else
1256  {
1257  package s=currPack;
1258  currPack=IDPACKAGE(pl);
1259  idhdl h=enterid("info",0,STRING_CMD,&IDROOT,FALSE);
1260  IDSTRING(h)=omStrDup(help);
1261  currPack=s;
1262  }
1263 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:94
#define IDROOT
Definition: ipid.h:18
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:134
#define IDTYP(a)
Definition: ipid.h:114
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:265
#define IDSTRING(a)
Definition: ipid.h:131
#define help
Definition: libparse.cc:1228
#define NULL
Definition: omList.c:12
package basePack
Definition: ipid.cc:58
package currPack
Definition: ipid.cc:57
char * iiConvName(const char *libname)
Definition: iplib.cc:1331
static Poly * h
Definition: janet.cc:971
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 1264 of file iplib.cc.

1265 {
1266  char *plib = iiConvName(newlib);
1267  idhdl pl = basePack->idroot->get(plib,0);
1268  if ((pl==NULL)||(IDTYP(pl)!=PACKAGE_CMD))
1269  Werror(">>%s<< is not a package(trying to add help for %s)",plib,p);
1270  else
1271  {
1272  package s=currPack;
1273  currPack=IDPACKAGE(pl);
1274  char buff[256];
1275  buff[255]='\0';
1276  strncpy(buff,p,255);
1277  strncat(buff,"_help",255-strlen(p));
1278  idhdl h=enterid(buff,0,STRING_CMD,&IDROOT,FALSE);
1279  IDSTRING(h)=omStrDup(help);
1280  currPack=s;
1281  }
1282 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:94
#define IDROOT
Definition: ipid.h:18
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:134
#define IDTYP(a)
Definition: ipid.h:114
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:265
#define IDSTRING(a)
Definition: ipid.h:131
#define help
Definition: libparse.cc:1228
#define NULL
Definition: omList.c:12
package basePack
Definition: ipid.cc:58
package currPack
Definition: ipid.cc:57
int p
Definition: cfModGcd.cc:4019
char * iiConvName(const char *libname)
Definition: iplib.cc:1331
static Poly * h
Definition: janet.cc:971
void Werror(const char *fmt,...)
Definition: reporter.cc:189
#define omStrDup(s)
Definition: omAllocDecl.h:263

◆ packFindHdl()

idhdl packFindHdl ( package  r)

Definition at line 750 of file ipid.cc.

751 {
752  idhdl h=basePack->idroot;
753  while (h!=NULL)
754  {
755  if ((IDTYP(h)==PACKAGE_CMD)
756  && (IDPACKAGE(h)==r))
757  return h;
758  h=IDNEXT(h);
759  }
760  return NULL;
761 }
#define IDNEXT(a)
Definition: ipid.h:113
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:134
#define IDTYP(a)
Definition: ipid.h:114
#define NULL
Definition: omList.c:12
package basePack
Definition: ipid.cc:58
static Poly * h
Definition: janet.cc:971

◆ paCopy()

package paCopy ( package  pack)
inline

Definition at line 43 of file ipid.h.

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

◆ paKill()

void paKill ( package  pack)
inline

Definition at line 49 of file ipid.h.

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

Variable Documentation

◆ basePack

package basePack

Definition at line 58 of file ipid.cc.

◆ basePackHdl

idhdl basePackHdl

Definition at line 56 of file ipid.cc.

◆ coeffs_BIGINT

coeffs coeffs_BIGINT

Definition at line 50 of file ipid.cc.

◆ currPack

package currPack

Definition at line 57 of file ipid.cc.

◆ currPackHdl

idhdl currPackHdl

Definition at line 55 of file ipid.cc.

◆ currRingHdl

idhdl currRingHdl

Definition at line 59 of file ipid.cc.

◆ idrec_bin

omBin idrec_bin

Definition at line 48 of file ipid.cc.

◆ optionStruct

const struct soptionStruct optionStruct[]

Definition at line 521 of file misc_ip.cc.

◆ procstack

proclevel* procstack

Definition at line 52 of file ipid.cc.

◆ sip_command_bin

omBin sip_command_bin

Definition at line 45 of file ipid.cc.

◆ sip_package_bin

omBin sip_package_bin

Definition at line 46 of file ipid.cc.

◆ sleftv_bin

omBin sleftv_bin

Definition at line 41 of file subexpr.cc.

◆ verboseStruct

const struct soptionStruct verboseStruct[]

Definition at line 551 of file misc_ip.cc.