My Project
Data Structures | Macros | Typedefs | Functions | Variables
ipid.h File Reference
#include "misc/options.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 jjNormalizeQRingP(p)   jj_NormalizeQRingP(p,currRing)
 
#define FLAG_STD   0
 
#define FLAG_TWOSTD   3
 
#define FLAG_QRING   4
 
#define FLAG_QRING_DEF   5
 
#define FLAG_OTHER_RING   6
 
#define FLAG_RING   7
 
#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 search=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)
 
poly jj_NormalizeQRingP (poly p, const ring r)
 
void jjNormalizeQRingId (leftv I)
 
void * idrecDataInit (int t)
 
void ipListFlag (idhdl h)
 

Variables

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

Data Structure Documentation

◆ sip_command

struct sip_command

Definition at line 25 of file ipid.h.

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

◆ sip_package

struct sip_package

Definition at line 34 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 150 of file ipid.h.

Data Fields
const char * name
unsigned resetval
unsigned setval

Macro Definition Documentation

◆ FLAG_OTHER_RING

#define FLAG_OTHER_RING   6

Definition at line 110 of file ipid.h.

◆ FLAG_QRING

#define FLAG_QRING   4

Definition at line 108 of file ipid.h.

◆ FLAG_QRING_DEF

#define FLAG_QRING_DEF   5

Definition at line 109 of file ipid.h.

◆ FLAG_RING

#define FLAG_RING   7

Definition at line 111 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 112 of file ipid.h.

◆ IDATTR

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

Definition at line 123 of file ipid.h.

◆ IDBIGINT

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

Definition at line 131 of file ipid.h.

◆ IDBIMAT

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

Definition at line 129 of file ipid.h.

◆ IDDATA

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

Definition at line 126 of file ipid.h.

◆ IDFLAG

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

Definition at line 120 of file ipid.h.

◆ IDID

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

Definition at line 122 of file ipid.h.

◆ IDIDEAL

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

Definition at line 133 of file ipid.h.

◆ IDINT

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

Definition at line 125 of file ipid.h.

◆ IDINTVEC

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

Definition at line 128 of file ipid.h.

◆ IDLEV

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

Definition at line 121 of file ipid.h.

◆ IDLINK

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

Definition at line 138 of file ipid.h.

◆ IDLIST

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

Definition at line 137 of file ipid.h.

◆ IDMAP

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

Definition at line 135 of file ipid.h.

◆ IDMATRIX

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

Definition at line 134 of file ipid.h.

◆ IDNEXT

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

Definition at line 118 of file ipid.h.

◆ IDNUMBER

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

Definition at line 132 of file ipid.h.

◆ IDPACKAGE

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

Definition at line 139 of file ipid.h.

◆ IDPOLY

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

Definition at line 130 of file ipid.h.

◆ IDPROC

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

Definition at line 140 of file ipid.h.

◆ IDRING

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

Definition at line 127 of file ipid.h.

◆ IDROOT

#define IDROOT   (currPack->idroot)

Definition at line 19 of file ipid.h.

◆ IDSTRING

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

Definition at line 136 of file ipid.h.

◆ IDTYP

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

Definition at line 119 of file ipid.h.

◆ jjNormalizeQRingP

#define jjNormalizeQRingP (   p)    jj_NormalizeQRingP(p,currRing)

Definition at line 103 of file ipid.h.

◆ resetFlag

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

Definition at line 114 of file ipid.h.

◆ setFlag

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

Definition at line 113 of file ipid.h.

Typedef Documentation

◆ command

typedef ip_command* command

Definition at line 23 of file ipid.h.

◆ SModulFunc_t

typedef int(* SModulFunc_t) (SModulFunctions *)

Definition at line 81 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  search = TRUE 
)

Definition at line 279 of file ipid.cc.

280 {
281  if (s==NULL) return NULL;
282  if (root==NULL) return NULL;
283  idhdl h;
284  s=omStrDup(s);
285  // idhdl *save_root=root;
286  if (t==PACKAGE_CMD)
287  {
288  if (root!=&(basePack->idroot))
289  {
290  root=&(basePack->idroot);
291  }
292  }
293  // is it already defined in root ?
294  if ((h=(*root)->get_level(s,lev))!=NULL)
295  {
296  if ((IDTYP(h) == t)||(t==DEF_CMD))
297  {
298  if (IDTYP(h)==PACKAGE_CMD)
299  {
300  if (strcmp(s,"Top")==0)
301  {
302  goto errlabel;
303  }
304  else return h;
305  }
306  else
307  {
308  if (BVERBOSE(V_REDEFINE))
309  {
310  const char *f=VoiceName();
311  if (strcmp(f,"STDIN")==0)
312  Warn("redefining %s (%s)",s,my_yylinebuf);
313  else
314  Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno);
315  }
316  if (s==IDID(h)) IDID(h)=NULL;
317  if((t!=PROC_CMD)||(IDPROC(h)->language!=LANG_C))
318  {
319  killhdl2(h,root,currRing);
320  }
321  }
322  }
323  else
324  goto errlabel;
325  }
326  // is it already defined in currRing->idroot ?
327  else if (search && (currRing!=NULL)&&((*root) != currRing->idroot))
328  {
329  if ((h=currRing->idroot->get_level(s,lev))!=NULL)
330  {
331  if ((IDTYP(h) == t)||(t==DEF_CMD))
332  {
333  if (BVERBOSE(V_REDEFINE))
334  {
335  const char *f=VoiceName();
336  if (strcmp(f,"STDIN")==0)
337  Warn("redefining %s (%s)",s,my_yylinebuf);
338  else
339  Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno);
340  }
341  if (s==IDID(h)) IDID(h)=NULL;
342  // proc is not ring-dep, no need to check for type "proc":
343  killhdl2(h,&currRing->idroot,currRing);
344  }
345  else
346  goto errlabel;
347  }
348  }
349  // is it already defined in idroot ?
350  else if (search && (*root != IDROOT))
351  {
352  if ((h=IDROOT->get_level(s,lev))!=NULL)
353  {
354  if ((IDTYP(h) == t)||(t==DEF_CMD))
355  {
356  if (BVERBOSE(V_REDEFINE))
357  {
358  const char *f=VoiceName();
359  if (strcmp(f,"STDIN")==0)
360  Warn("redefining %s (%s)",s,my_yylinebuf);
361  else
362  Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno);
363  }
364  if (s==IDID(h)) IDID(h)=NULL;
365  if((t!=PROC_CMD)||(IDPROC(h)->language!=LANG_C))
366  {
367  killhdl2(h,&IDROOT,NULL);
368  }
369  }
370  else
371  goto errlabel;
372  }
373  }
374  *root = (*root)->set(s, lev, t, init);
375 #ifndef SING_NDEBUG
376  checkall();
377 #endif
378  return *root;
379 
380  errlabel:
381  //Werror("identifier `%s` in use(lev h=%d,typ=%d,t=%d, curr=%d)",s,IDLEV(h),IDTYP(h),t,lev);
382  Werror("identifier `%s` in use",s);
383  //listall();
385  return NULL;
386 }
void * ADDRESS
Definition: auxiliary.h:119
FILE * f
Definition: checklibs.c:9
Definition: idrec.h:35
idhdl set(const char *s, int lev, int t, BOOLEAN init=TRUE)
Definition: ipid.cc:237
#define Warn
Definition: emacs.cc:77
const CanonicalForm int s
Definition: facAbsFact.cc:51
int search(const CFArray &A, const CanonicalForm &F, int i, int j)
search for F in A between index i and j
VAR int yylineno
Definition: febase.cc:40
VAR char my_yylinebuf[80]
Definition: febase.cc:44
const char * VoiceName()
Definition: fevoices.cc:58
@ PROC_CMD
Definition: grammar.cc:280
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:445
VAR package basePack
Definition: ipid.cc:58
#define IDPROC(a)
Definition: ipid.h:140
#define IDID(a)
Definition: ipid.h:122
#define IDROOT
Definition: ipid.h:19
#define IDTYP(a)
Definition: ipid.h:119
STATIC_VAR Poly * h
Definition: janet.cc:971
void init()
Definition: lintree.cc:864
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
#define NULL
Definition: omList.c:12
#define BVERBOSE(a)
Definition: options.h:34
#define V_REDEFINE
Definition: options.h:44
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void Werror(const char *fmt,...)
Definition: reporter.cc:189
@ LANG_C
Definition: subexpr.h:22
@ PACKAGE_CMD
Definition: tok.h:149
@ DEF_CMD
Definition: tok.h:58

◆ ggetid()

idhdl ggetid ( const char *  n)

Definition at line 581 of file ipid.cc.

582 {
583  if (currRing!=NULL)
584  {
585  idhdl h2 = currRing->idroot->get(n,myynest);
586  if ((h2!=NULL)&&(IDLEV(h2)==myynest)) return h2;
587  idhdl h = IDROOT->get(n,myynest);
588  if (h!=NULL) return h;
589  if (h2!=NULL) return h2;
590  }
591  else
592  {
593  idhdl h = IDROOT->get(n,myynest);
594  if (h!=NULL) return h;
595  }
596  if (basePack!=currPack)
597  return basePack->idroot->get(n,myynest);
598  return NULL;
599 }
VAR int myynest
Definition: febase.cc:41
VAR package currPack
Definition: ipid.cc:57
#define IDLEV(a)
Definition: ipid.h:121

◆ idrecDataInit()

void* idrecDataInit ( int  t)

Definition at line 140 of file ipid.cc.

141 {
142  switch (t)
143  {
144  //the type with init routines:
145 #ifdef SINGULAR_4_2
146  case CNUMBER_CMD:
147  return (void*)n2Init(0,NULL);
148  case CPOLY_CMD:
149  return (void*)p2Init(0,NULL);
150  case CMATRIX_CMD:
151 #endif
152  case BIGINTMAT_CMD:
153  return (void *)new bigintmat();
154  case BUCKET_CMD:
155  if (currRing!=NULL)
156  return (void*)sBucketCreate(currRing);
157  else
158  {
159  WerrorS("need basering for polyBucket");
160  return NULL;
161  }
162  case INTVEC_CMD:
163  case INTMAT_CMD:
164  return (void *)new intvec();
165  case NUMBER_CMD:
166  {
167  if (currRing!=NULL) return (void *) nInit(0);
168  else return NULL;
169  }
170  case BIGINT_CMD:
171  return (void *) n_Init(0, coeffs_BIGINT);
172  case IDEAL_CMD:
173  case MODUL_CMD:
174  case MATRIX_CMD:
175  case SMATRIX_CMD:
176  return (void*) idInit(1,1);
177  case MAP_CMD:
178  {
179  map m = (map)idInit(1,1);
180  m->preimage = omStrDup(IDID(currRingHdl));
181  return (void *)m;
182  }
183  case STRING_CMD:
184  return (void *)omAlloc0(1);
185  case LIST_CMD:
186  {
188  l->Init();
189  return (void*)l;
190  }
191  //the types with the standard init: set the struct to zero
192  case LINK_CMD:
193  return (void*) omAlloc0Bin(sip_link_bin);
194  case PACKAGE_CMD:
195  {
196  package pa=(package)omAlloc0Bin(sip_package_bin);
197  pa->language=LANG_NONE;
198  pa->loaded = FALSE;
199  return (void*)pa;
200  }
201  case PROC_CMD:
202  {
204  pi->ref=1;
205  pi->language=LANG_NONE;
206  return (void*)pi;
207  }
208  case RESOLUTION_CMD:
209  return (void *)omAlloc0(sizeof(ssyStrategy));
210  //other types: without alloc. (int,script,poly,def,package,..)
211  case INT_CMD:
212  case DEF_CMD:
213  case POLY_CMD:
214  case VECTOR_CMD:
215  case RING_CMD:
216  case CRING_CMD:
217  case QRING_CMD:
218  return NULL;
219  default:
220  {
221  if (t>MAX_TOK)
222  {
223 #ifdef BLACKBOX_DEVEL
224  Print("bb-type %d\n",t);
225 #endif
226  blackbox *bb=getBlackboxStuff(t);
227  if (bb!=NULL)
228  return (void *)bb->blackbox_Init(bb);
229  }
230  else
231  Werror("unknown type in idrecDataInit:%d",t);
232  break;
233  }
234  }
235  return (void *)0L;
236 }
#define FALSE
Definition: auxiliary.h:96
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:17
int l
Definition: cfEzgcd.cc:100
int m
Definition: cfEzgcd.cc:128
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:504
Matrices of numbers.
Definition: bigintmat.h:51
Definition: intvec.h:23
Definition: lists.h:24
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
BOOLEAN pa(leftv res, leftv args)
Definition: cohomo.cc:4323
#define Print
Definition: emacs.cc:80
void WerrorS(const char *s)
Definition: feFopen.cc:24
@ IDEAL_CMD
Definition: grammar.cc:284
@ MATRIX_CMD
Definition: grammar.cc:286
@ BUCKET_CMD
Definition: grammar.cc:283
@ BIGINTMAT_CMD
Definition: grammar.cc:278
@ MAP_CMD
Definition: grammar.cc:285
@ INTMAT_CMD
Definition: grammar.cc:279
@ MODUL_CMD
Definition: grammar.cc:287
@ SMATRIX_CMD
Definition: grammar.cc:291
@ VECTOR_CMD
Definition: grammar.cc:292
@ RESOLUTION_CMD
Definition: grammar.cc:290
@ NUMBER_CMD
Definition: grammar.cc:288
@ POLY_CMD
Definition: grammar.cc:289
@ RING_CMD
Definition: grammar.cc:281
VAR idhdl currRingHdl
Definition: ipid.cc:59
VAR coeffs coeffs_BIGINT
Definition: ipid.cc:50
#define pi
Definition: libparse.cc:1145
VAR omBin slists_bin
Definition: lists.cc:23
slists * lists
Definition: mpr_numeric.h:146
#define nInit(i)
Definition: numbers.h:24
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define omAlloc0(size)
Definition: omAllocDecl.h:211
sBucket_pt sBucketCreate(const ring r)
Definition: sbuckets.cc:96
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
procinfo * procinfov
Definition: structs.h:60
VAR omBin procinfo_bin
Definition: subexpr.cc:42
@ LANG_NONE
Definition: subexpr.h:22
@ BIGINT_CMD
Definition: tok.h:38
@ CRING_CMD
Definition: tok.h:56
@ LIST_CMD
Definition: tok.h:118
@ INTVEC_CMD
Definition: tok.h:101
@ CMATRIX_CMD
Definition: tok.h:46
@ CNUMBER_CMD
Definition: tok.h:47
@ LINK_CMD
Definition: tok.h:117
@ QRING_CMD
Definition: tok.h:158
@ STRING_CMD
Definition: tok.h:185
@ CPOLY_CMD
Definition: tok.h:48
@ INT_CMD
Definition: tok.h:96
@ MAX_TOK
Definition: tok.h:218

◆ ipListFlag()

void ipListFlag ( idhdl  h)

Definition at line 619 of file ipid.cc.

620 {
621  if (hasFlag(h,FLAG_STD)) PrintS(" (SB)");
622 #ifdef HAVE_PLURAL
623  if (hasFlag(h,FLAG_TWOSTD)) PrintS(" (2SB)");
624 #endif
625 }
#define hasFlag(A, F)
Definition: ipid.h:112
#define FLAG_TWOSTD
Definition: ipid.h:107
#define FLAG_STD
Definition: ipid.h:106
void PrintS(const char *s)
Definition: reporter.cc:284

◆ ipMoveId()

void ipMoveId ( idhdl  h)

Definition at line 704 of file ipid.cc.

705 {
706  if ((currRing!=NULL)&&(tomove!=NULL))
707  {
708  if (RingDependend(IDTYP(tomove))
709  || ((IDTYP(tomove)==LIST_CMD) && (lRingDependend(IDLIST(tomove)))))
710  {
711  /*move 'tomove' to ring id's*/
712  if (ipSwapId(tomove,IDROOT,currRing->idroot))
713  ipSwapId(tomove,basePack->idroot,currRing->idroot);
714  }
715  else
716  {
717  /*move 'tomove' to global id's*/
718  ipSwapId(tomove,currRing->idroot,IDROOT);
719  }
720  }
721 }
static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
Definition: ipid.cc:679
#define IDLIST(a)
Definition: ipid.h:137
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
BOOLEAN RingDependend(int t)
Definition: subexpr.h:142

◆ ipNameList()

lists ipNameList ( idhdl  root)

Definition at line 627 of file ipid.cc.

628 {
629  idhdl h=root;
630  /* compute the length */
631  int l=0;
632  while (h!=NULL) { l++; h=IDNEXT(h); }
633  /* allocate list */
635  L->Init(l);
636  /* copy names */
637  h=root;
638  l=0;
639  while (h!=NULL)
640  {
641  /* list is initialized with 0 => no need to clear anything */
642  L->m[l].rtyp=STRING_CMD;
643  L->m[l].data=omStrDup(IDID(h));
644  l++;
645  h=IDNEXT(h);
646  }
647  return L;
648 }
int rtyp
Definition: subexpr.h:91
void * data
Definition: subexpr.h:88
sleftv * m
Definition: lists.h:46
INLINE_THIS void Init(int l=0)
#define IDNEXT(a)
Definition: ipid.h:118

◆ ipNameListLev()

lists ipNameListLev ( idhdl  root,
int  lev 
)

Definition at line 650 of file ipid.cc.

651 {
652  idhdl h=root;
653  /* compute the length */
654  int l=0;
655  while (h!=NULL) { if (IDLEV(h)==lev) l++; h=IDNEXT(h); }
656  /* allocate list */
658  L->Init(l);
659  /* copy names */
660  h=root;
661  l=0;
662  while (h!=NULL)
663  {
664  if (IDLEV(h)==lev)
665  {
666  /* list is initialized with 0 => no need to clear anything */
667  L->m[l].rtyp=STRING_CMD;
668  L->m[l].data=omStrDup(IDID(h));
669  l++;
670  }
671  h=IDNEXT(h);
672  }
673  return L;
674 }

◆ jj_NormalizeQRingP()

poly jj_NormalizeQRingP ( poly  p,
const ring  r 
)

Definition at line 2353 of file ipassign.cc.

2354 {
2355  if((p!=NULL) && (r->qideal!=NULL))
2356  {
2357  ring save=currRing;
2358  if (r!=currRing) rChangeCurrRing(r);
2359  ideal F=idInit(1,1);
2360  poly p2=kNF(F,r->qideal,p);
2361  p_Normalize(p2,r);
2362  id_Delete(&F,r);
2363  p_Delete(&p,r);
2364  p=p2;
2365  if (r!=save) rChangeCurrRing(save);
2366  }
2367  return p;
2368 }
int p
Definition: cfModGcd.cc:4078
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:3167
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3929
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:903
void rChangeCurrRing(ring r)
Definition: polys.cc:15
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix

◆ jjNormalizeQRingId()

void jjNormalizeQRingId ( leftv  I)

Definition at line 2318 of file ipassign.cc.

2319 {
2320  assume ((currRing->qideal!=NULL) && (!hasFlag(I,FLAG_QRING)));
2321  {
2322  if (I->e==NULL)
2323  {
2324  ideal I0=(ideal)I->Data();
2325  switch (I->Typ())
2326  {
2327  case IDEAL_CMD:
2328  case MODUL_CMD:
2329  {
2330  ideal F=idInit(1,1);
2331  ideal II=kNF(F,currRing->qideal,I0);
2332  idDelete(&F);
2333  if (I->rtyp!=IDHDL)
2334  {
2335  idDelete((ideal*)&(I0));
2336  I->data=II;
2337  }
2338  else
2339  {
2340  idhdl h=(idhdl)I->data;
2341  idDelete((ideal*)&IDIDEAL(h));
2342  IDIDEAL(h)=II;
2343  setFlag(h,FLAG_QRING);
2344  }
2345  break;
2346  }
2347  default: break;
2348  }
2349  setFlag(I,FLAG_QRING);
2350  }
2351  }
2352 }
int Typ()
Definition: subexpr.cc:1011
void * Data()
Definition: subexpr.cc:1154
Subexpr e
Definition: subexpr.h:105
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define setFlag(A, F)
Definition: ipid.h:113
#define IDIDEAL(a)
Definition: ipid.h:133
#define FLAG_QRING
Definition: ipid.h:108
#define assume(x)
Definition: mod2.h:389
idrec * idhdl
Definition: ring.h:21
#define IDHDL
Definition: tok.h:31

◆ killhdl()

void killhdl ( idhdl  h,
package  prooti = currPack 
)

Definition at line 414 of file ipid.cc.

415 {
416  int t=IDTYP(h);
417  if (((BEGIN_RING<t) && (t<END_RING))
418  || ((t==LIST_CMD) && (lRingDependend((lists)IDDATA(h)))))
419  killhdl2(h,&currRing->idroot,currRing);
420  else
421  {
422  if(t==PACKAGE_CMD)
423  {
424  killhdl2(h,&(basePack->idroot),NULL);
425  }
426  else
427  {
428  idhdl s=proot->idroot;
429  while ((s!=h) && (s!=NULL)) s=s->next;
430  if (s!=NULL)
431  killhdl2(h,&(proot->idroot),NULL);
432  else if (basePack!=proot)
433  {
434  idhdl s=basePack->idroot;
435  while ((s!=h) && (s!=NULL)) s=s->next;
436  if (s!=NULL)
437  killhdl2(h,&(basePack->idroot),currRing);
438  else
439  killhdl2(h,&(currRing->idroot),currRing);
440  }
441  }
442  }
443 }
@ END_RING
Definition: grammar.cc:310
@ BEGIN_RING
Definition: grammar.cc:282
#define IDDATA(a)
Definition: ipid.h:126

◆ killhdl2()

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

Definition at line 445 of file ipid.cc.

446 {
447  //printf("kill %s, id %x, typ %d lev: %d\n",IDID(h),(int)IDID(h),IDTYP(h),IDLEV(h));
448  idhdl hh;
449 
450  if (TEST_V_ALLWARN
451  && (IDLEV(h)!=myynest)
452  &&(IDLEV(h)==0))
453  {
454  if (((*ih)==basePack->idroot)
455  || ((currRing!=NULL)&&((*ih)==currRing->idroot)))
456  Warn("kill global `%s` at line >>%s<<\n",IDID(h),my_yylinebuf);
457  }
458  if (h->attribute!=NULL)
459  {
460  if ((IDTYP(h)==RING_CMD)&&(IDRING(h)!=r))
461  h->attribute->killAll(IDRING(h));
462  else
463  h->attribute->killAll(r);
464  h->attribute=NULL;
465  }
466  if (IDTYP(h) == PACKAGE_CMD)
467  {
468  if ((((IDPACKAGE(h)->language==LANG_C) ||(IDPACKAGE(h)->language==LANG_MIX))
469  &&(IDPACKAGE(h)->idroot!=NULL))
470  || (strcmp(IDID(h),"Top")==0))
471  {
472  Warn("cannot kill `%s`",IDID(h));
473  return;
474  }
475  // any objects defined for this package ?
476  if ((IDPACKAGE(h)->ref<=0) && (IDPACKAGE(h)->idroot!=NULL))
477  {
478  if (currPack==IDPACKAGE(h))
479  {
482  }
483  idhdl * hd = &IDRING(h)->idroot;
484  idhdl hdh = IDNEXT(*hd);
485  idhdl temp;
486  while (hdh!=NULL)
487  {
488  temp = IDNEXT(hdh);
489  killhdl2(hdh,&(IDPACKAGE(h)->idroot),NULL);
490  hdh = temp;
491  }
492  killhdl2(*hd,hd,NULL);
493  if (IDPACKAGE(h)->libname!=NULL) omFreeBinAddr((ADDRESS)(IDPACKAGE(h)->libname));
494  }
495  paKill(IDPACKAGE(h));
498  }
499  else if (IDTYP(h)==RING_CMD)
500  rKill(h);
501  else if (IDDATA(h)!=NULL)
503  IDDATA(h)=NULL;
504  // general -------------------------------------------------------------
505  // now dechain it and delete idrec
506  if (IDID(h)!=NULL) // OB: ?????
508  IDID(h)=NULL;
509  IDDATA(h)=NULL;
510  if (h == (*ih))
511  {
512  // h is at the beginning of the list
513  *ih = IDNEXT(h) /* ==*ih */;
514  }
515  else if (ih!=NULL)
516  {
517  // h is somethere in the list:
518  hh = *ih;
519  loop
520  {
521  if (hh==NULL)
522  {
523  PrintS(">>?<< not found for kill\n");
524  return;
525  }
526  idhdl hhh = IDNEXT(hh);
527  if (hhh == h)
528  {
529  IDNEXT(hh) = IDNEXT(hhh);
530  break;
531  }
532  hh = hhh;
533  }
534  }
536 }
VAR omBin idrec_bin
Definition: ipid.cc:48
VAR idhdl currPackHdl
Definition: ipid.cc:55
idhdl packFindHdl(package r)
Definition: ipid.cc:831
#define IDPACKAGE(a)
Definition: ipid.h:139
void paKill(package pack)
Definition: ipid.h:50
#define IDRING(a)
Definition: ipid.h:127
void iiCheckPack(package &p)
Definition: ipshell.cc:1630
void rKill(ring r)
Definition: ipshell.cc:6170
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
#define TEST_V_ALLWARN
Definition: options.h:143
#define loop
Definition: structs.h:75
void s_internalDelete(const int t, void *d, const ring r)
Definition: subexpr.cc:514
@ LANG_MIX
Definition: subexpr.h:22

◆ killid()

void killid ( const char *  a,
idhdl i 
)

Definition at line 387 of file ipid.cc.

388 {
389  if (id!=NULL)
390  {
391  idhdl h = (*ih)->get(id,myynest);
392 
393  // id not found in global list, is it defined in current ring ?
394  if (h==NULL)
395  {
396  if ((currRing!=NULL) && (*ih != (currRing->idroot)))
397  {
398  h = currRing->idroot->get(id,myynest);
399  if (h!=NULL)
400  {
401  killhdl2(h,&(currRing->idroot),currRing);
402  return;
403  }
404  }
405  Werror("`%s` is not defined",id);
406  return;
407  }
408  killhdl2(h,ih,currRing);
409  }
410  else
411  WerrorS("kill what ?");
412 }

◆ load_builtin()

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

Definition at line 1294 of file iplib.cc.

1295 {
1296  int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic,
1297  BOOLEAN(*func)(leftv res, leftv v));
1298 /*
1299  typedef int (*fktn_t)(int(*iiAddCproc)(const char *libname, const char *procname,
1300  BOOLEAN pstatic,
1301  BOOLEAN(*func)(leftv res, leftv v)));
1302 */
1303  // SModulFunc_t fktn;
1304  idhdl pl;
1305  char *plib = iiConvName(newlib);
1306  // BOOLEAN RET=TRUE;
1307  // int token;
1308 
1309  pl = basePack->idroot->get(plib,0); // search PACKAGE only in Top
1310  if ((pl!=NULL)
1311  &&(IDTYP(pl)==PACKAGE_CMD))
1312  {
1313  if(IDPACKAGE(pl)->language==LANG_C)
1314  {
1315  if (BVERBOSE(V_LOAD_LIB)) Warn( "(builtin) %s already loaded", newlib);
1316  omFreeBinAddr(plib);
1317  return FALSE;
1318  }
1319  }
1320  else
1321  {
1322  pl = enterid( plib,0, PACKAGE_CMD, &IDROOT, TRUE );
1323  IDPACKAGE(pl)->libname=omStrDup(newlib);
1324  }
1325  omFreeBinAddr(plib);
1326  IDPACKAGE(pl)->language = LANG_C;
1327 
1328  IDPACKAGE(pl)->handle=(void *)NULL;
1329  SModulFunctions sModulFunctions;
1330 
1331  package s=currPack;
1332  currPack=IDPACKAGE(pl);
1333  if( init!= NULL)
1334  {
1335  sModulFunctions.iiArithAddCmd = iiArithAddCmd;
1336  if (autoexport) sModulFunctions.iiAddCproc = iiAddCprocTop;
1337  else sModulFunctions.iiAddCproc = iiAddCproc;
1338  (*init)(&sModulFunctions);
1339  }
1340  if (BVERBOSE(V_LOAD_LIB)) Print( "// ** loaded (builtin) %s \n", newlib);
1341  currPack->loaded=1;
1342  currPack=s;
1343 
1344  return FALSE;
1345 }
int BOOLEAN
Definition: auxiliary.h:87
#define TRUE
Definition: auxiliary.h:100
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
CanonicalForm res
Definition: facAbsFact.cc:60
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:279
int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: iplib.cc:1063
char * iiConvName(const char *libname)
Definition: iplib.cc:1429
int iiAddCprocTop(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: iplib.cc:1138
int iiArithAddCmd(const char *szName, short nAlias, short nTokval, short nToktype, short nPos)
Definition: iparith.cc:9846
#define V_LOAD_LIB
Definition: options.h:46
int(* iiArithAddCmd)(const char *szName, short nAlias, short nTokval, short nToktype, short nPos)
Definition: ipid.h:72
int(* iiAddCproc)(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: ipid.h:70

◆ module_help_main()

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

Definition at line 1347 of file iplib.cc.

1348 {
1349  char *plib = iiConvName(newlib);
1350  idhdl pl = basePack->idroot->get(plib,0);
1351  if ((pl==NULL)||(IDTYP(pl)!=PACKAGE_CMD))
1352  Werror(">>%s<< is not a package (trying to add package help)",plib);
1353  else
1354  {
1355  package s=currPack;
1356  currPack=IDPACKAGE(pl);
1357  idhdl h=enterid("info",0,STRING_CMD,&IDROOT,FALSE);
1358  IDSTRING(h)=omStrDup(help);
1359  currPack=s;
1360  }
1361 }
#define IDSTRING(a)
Definition: ipid.h:136
#define help
Definition: libparse.cc:1230

◆ module_help_proc()

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

Definition at line 1362 of file iplib.cc.

1363 {
1364  char *plib = iiConvName(newlib);
1365  idhdl pl = basePack->idroot->get(plib,0);
1366  if ((pl==NULL)||(IDTYP(pl)!=PACKAGE_CMD))
1367  Werror(">>%s<< is not a package(trying to add help for %s)",plib,p);
1368  else
1369  {
1370  package s=currPack;
1371  currPack=IDPACKAGE(pl);
1372  char buff[SINGULAR_PATH_LENGTH];
1373  buff[SINGULAR_PATH_LENGTH-1]='\0';
1374  strncpy(buff,p,SINGULAR_PATH_LENGTH-1);
1375  strncat(buff,"_help",SINGULAR_PATH_LENGTH-1-strlen(p));
1376  idhdl h=enterid(buff,0,STRING_CMD,&IDROOT,FALSE);
1377  IDSTRING(h)=omStrDup(help);
1378  currPack=s;
1379  }
1380 }
#define SINGULAR_PATH_LENGTH
Definition: iplib.cc:21

◆ packFindHdl()

idhdl packFindHdl ( package  r)

Definition at line 831 of file ipid.cc.

832 {
833  idhdl h=basePack->idroot;
834  while (h!=NULL)
835  {
836  if ((IDTYP(h)==PACKAGE_CMD)
837  && (IDPACKAGE(h)==r))
838  return h;
839  h=IDNEXT(h);
840  }
841  return NULL;
842 }

◆ paCopy()

package paCopy ( package  pack)
inline

Definition at line 44 of file ipid.h.

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

◆ paKill()

void paKill ( package  pack)
inline

Definition at line 50 of file ipid.h.

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

Variable Documentation

◆ basePack

EXTERN_VAR package basePack

Definition at line 18 of file ipid.h.

◆ basePackHdl

EXTERN_VAR idhdl basePackHdl

Definition at line 16 of file ipid.h.

◆ coeffs_BIGINT

EXTERN_VAR coeffs coeffs_BIGINT

Definition at line 147 of file ipid.h.

◆ currPack

EXTERN_VAR package currPack

Definition at line 17 of file ipid.h.

◆ currPackHdl

EXTERN_VAR idhdl currPackHdl

Definition at line 15 of file ipid.h.

◆ currRingHdl

EXTERN_VAR idhdl currRingHdl

Definition at line 78 of file ipid.h.

◆ idrec_bin

EXTERN_VAR omBin idrec_bin

Definition at line 144 of file ipid.h.

◆ optionStruct

const struct soptionStruct optionStruct[]
extern

Definition at line 430 of file misc_ip.cc.

◆ procstack

EXTERN_VAR proclevel* procstack

Definition at line 66 of file ipid.h.

◆ sip_command_bin

EXTERN_VAR omBin sip_command_bin

Definition at line 142 of file ipid.h.

◆ sip_package_bin

EXTERN_VAR omBin sip_package_bin

Definition at line 143 of file ipid.h.

◆ sleftv_bin

EXTERN_VAR omBin sleftv_bin

Definition at line 145 of file ipid.h.

◆ verboseStruct

const struct soptionStruct verboseStruct[]
extern

Definition at line 430 of file misc_ip.cc.