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

279 {
280  if (s==NULL) return NULL;
281  if (root==NULL) return NULL;
282  idhdl h;
283  s=omStrDup(s);
284  // idhdl *save_root=root;
285  if (t==PACKAGE_CMD)
286  {
287  if (root!=&(basePack->idroot))
288  {
289  root=&(basePack->idroot);
290  }
291  }
292  // is it already defined in root ?
293  if ((h=(*root)->get_level(s,lev))!=NULL)
294  {
295  if ((IDTYP(h) == t)||(t==DEF_CMD))
296  {
297  if (IDTYP(h)==PACKAGE_CMD)
298  {
299  if (strcmp(s,"Top")==0)
300  {
301  goto errlabel;
302  }
303  else return h;
304  }
305  else
306  {
307  if (BVERBOSE(V_REDEFINE))
308  {
309  const char *f=VoiceName();
310  if (strcmp(f,"STDIN")==0)
311  Warn("redefining %s (%s)",s,my_yylinebuf);
312  else
313  Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno);
314  }
315  if (s==IDID(h)) IDID(h)=NULL;
316  killhdl2(h,root,currRing);
317  }
318  }
319  else
320  goto errlabel;
321  }
322  // is it already defined in currRing->idroot ?
323  else if (search && (currRing!=NULL)&&((*root) != currRing->idroot))
324  {
325  if ((h=currRing->idroot->get_level(s,lev))!=NULL)
326  {
327  if ((IDTYP(h) == t)||(t==DEF_CMD))
328  {
329  if (BVERBOSE(V_REDEFINE))
330  {
331  const char *f=VoiceName();
332  if (strcmp(f,"STDIN")==0)
333  Warn("redefining %s (%s)",s,my_yylinebuf);
334  else
335  Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno);
336  }
337  if (s==IDID(h)) IDID(h)=NULL;
338  killhdl2(h,&currRing->idroot,currRing);
339  }
340  else
341  goto errlabel;
342  }
343  }
344  // is it already defined in idroot ?
345  else if (search && (*root != IDROOT))
346  {
347  if ((h=IDROOT->get_level(s,lev))!=NULL)
348  {
349  if ((IDTYP(h) == t)||(t==DEF_CMD))
350  {
351  if (BVERBOSE(V_REDEFINE))
352  {
353  const char *f=VoiceName();
354  if (strcmp(f,"STDIN")==0)
355  Warn("redefining %s (%s)",s,my_yylinebuf);
356  else
357  Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno);
358  }
359  if (s==IDID(h)) IDID(h)=NULL;
360  killhdl2(h,&IDROOT,NULL);
361  }
362  else
363  goto errlabel;
364  }
365  }
366  *root = (*root)->set(s, lev, t, init);
367 #ifndef SING_NDEBUG
368  checkall();
369 #endif
370  return *root;
371 
372  errlabel:
373  //Werror("identifier `%s` in use(lev h=%d,typ=%d,t=%d, curr=%d)",s,IDLEV(h),IDTYP(h),t,lev);
374  Werror("identifier `%s` in use",s);
375  //listall();
376  omFree((ADDRESS)s);
377  return NULL;
378 }
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:236
#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:56
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:437
VAR package basePack
Definition: ipid.cc:58
#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 omFree(addr)
Definition: omAllocDecl.h:261
#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
@ PACKAGE_CMD
Definition: tok.h:149
@ DEF_CMD
Definition: tok.h:58

◆ ggetid()

idhdl ggetid ( const char *  n)

Definition at line 571 of file ipid.cc.

572 {
573  if (currRing!=NULL)
574  {
575  idhdl h2 = currRing->idroot->get(n,myynest);
576  if ((h2!=NULL)&&(IDLEV(h2)==myynest)) return h2;
577  idhdl h = IDROOT->get(n,myynest);
578  if (h!=NULL) return h;
579  if (h2!=NULL) return h2;
580  }
581  else
582  {
583  idhdl h = IDROOT->get(n,myynest);
584  if (h!=NULL) return h;
585  }
586  if (basePack!=currPack)
587  return basePack->idroot->get(n,myynest);
588  return NULL;
589 }
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 139 of file ipid.cc.

140 {
141  switch (t)
142  {
143  //the type with init routines:
144 #ifdef SINGULAR_4_2
145  case CNUMBER_CMD:
146  return (void*)n2Init(0,NULL);
147  case CPOLY_CMD:
148  return (void*)p2Init(0,NULL);
149  case CMATRIX_CMD:
150 #endif
151  case BIGINTMAT_CMD:
152  return (void *)new bigintmat();
153  case BUCKET_CMD:
154  if (currRing!=NULL)
155  return (void*)sBucketCreate(currRing);
156  else
157  {
158  WerrorS("need basering for polyBucket");
159  return NULL;
160  }
161  case INTVEC_CMD:
162  case INTMAT_CMD:
163  return (void *)new intvec();
164  case NUMBER_CMD:
165  {
166  if (currRing!=NULL) return (void *) nInit(0);
167  else return NULL;
168  }
169  case BIGINT_CMD:
170  return (void *) n_Init(0, coeffs_BIGINT);
171  case IDEAL_CMD:
172  case MODUL_CMD:
173  case MATRIX_CMD:
174  case SMATRIX_CMD:
175  return (void*) idInit(1,1);
176  case MAP_CMD:
177  {
178  map m = (map)idInit(1,1);
179  m->preimage = omStrDup(IDID(currRingHdl));
180  return (void *)m;
181  }
182  case STRING_CMD:
183  return (void *)omAlloc0(1);
184  case LIST_CMD:
185  {
187  l->Init();
188  return (void*)l;
189  }
190  //the types with the standard init: set the struct to zero
191  case LINK_CMD:
192  return (void*) omAlloc0Bin(sip_link_bin);
193  case PACKAGE_CMD:
194  {
195  package pa=(package)omAlloc0Bin(sip_package_bin);
196  pa->language=LANG_NONE;
197  pa->loaded = FALSE;
198  return (void*)pa;
199  }
200  case PROC_CMD:
201  {
203  pi->ref=1;
204  pi->language=LANG_NONE;
205  return (void*)pi;
206  }
207  case RESOLUTION_CMD:
208  return (void *)omAlloc0(sizeof(ssyStrategy));
209  //other types: without alloc. (int,script,poly,def,package,..)
210  case INT_CMD:
211  case DEF_CMD:
212  case POLY_CMD:
213  case VECTOR_CMD:
214  case RING_CMD:
215  case CRING_CMD:
216  case QRING_CMD:
217  return NULL;
218  default:
219  {
220  if (t>MAX_TOK)
221  {
222 #ifdef BLACKBOX_DEVEL
223  Print("bb-type %d\n",t);
224 #endif
225  blackbox *bb=getBlackboxStuff(t);
226  if (bb!=NULL)
227  return (void *)bb->blackbox_Init(bb);
228  }
229  else
230  Werror("unknown type in idrecDataInit:%d",t);
231  break;
232  }
233  }
234  return (void *)0L;
235 }
#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:539
BOOLEAN pa(leftv res, leftv args)
Definition: cohomo.cc:4344
#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
@ PROC_CMD
Definition: grammar.cc:280
@ 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:65
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 609 of file ipid.cc.

610 {
611  if (hasFlag(h,FLAG_STD)) PrintS(" (SB)");
612 #ifdef HAVE_PLURAL
613  if (hasFlag(h,FLAG_TWOSTD)) PrintS(" (2SB)");
614 #endif
615 }
#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 694 of file ipid.cc.

695 {
696  if ((currRing!=NULL)&&(tomove!=NULL))
697  {
698  if (RingDependend(IDTYP(tomove))
699  || ((IDTYP(tomove)==LIST_CMD) && (lRingDependend(IDLIST(tomove)))))
700  {
701  /*move 'tomove' to ring id's*/
702  if (ipSwapId(tomove,IDROOT,currRing->idroot))
703  ipSwapId(tomove,basePack->idroot,currRing->idroot);
704  }
705  else
706  {
707  /*move 'tomove' to global id's*/
708  ipSwapId(tomove,currRing->idroot,IDROOT);
709  }
710  }
711 }
static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
Definition: ipid.cc:669
#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 617 of file ipid.cc.

618 {
619  idhdl h=root;
620  /* compute the length */
621  int l=0;
622  while (h!=NULL) { l++; h=IDNEXT(h); }
623  /* allocate list */
625  L->Init(l);
626  /* copy names */
627  h=root;
628  l=0;
629  while (h!=NULL)
630  {
631  /* list is initialized with 0 => no need to clear anything */
632  L->m[l].rtyp=STRING_CMD;
633  L->m[l].data=omStrDup(IDID(h));
634  l++;
635  h=IDNEXT(h);
636  }
637  return L;
638 }
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 640 of file ipid.cc.

641 {
642  idhdl h=root;
643  /* compute the length */
644  int l=0;
645  while (h!=NULL) { if (IDLEV(h)==lev) l++; h=IDNEXT(h); }
646  /* allocate list */
648  L->Init(l);
649  /* copy names */
650  h=root;
651  l=0;
652  while (h!=NULL)
653  {
654  if (IDLEV(h)==lev)
655  {
656  /* list is initialized with 0 => no need to clear anything */
657  L->m[l].rtyp=STRING_CMD;
658  L->m[l].data=omStrDup(IDID(h));
659  l++;
660  }
661  h=IDNEXT(h);
662  }
663  return L;
664 }

◆ jj_NormalizeQRingP()

poly jj_NormalizeQRingP ( poly  p,
const ring  r 
)

Definition at line 2354 of file ipassign.cc.

2355 {
2356  if((p!=NULL) && (r->qideal!=NULL))
2357  {
2358  ring save=currRing;
2359  if (r!=currRing) rChangeCurrRing(r);
2360  ideal F=idInit(1,1);
2361  poly p2=kNF(F,r->qideal,p);
2362  p_Normalize(p2,r);
2363  id_Delete(&F,r);
2364  p_Delete(&p,r);
2365  p=p2;
2366  if (r!=save) rChangeCurrRing(save);
2367  }
2368  return p;
2369 }
int p
Definition: cfModGcd.cc:4080
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:3158
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3842
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:861
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 2319 of file ipassign.cc.

2320 {
2321  assume ((currRing->qideal!=NULL) && (!hasFlag(I,FLAG_QRING)));
2322  {
2323  if (I->e==NULL)
2324  {
2325  ideal I0=(ideal)I->Data();
2326  switch (I->Typ())
2327  {
2328  case IDEAL_CMD:
2329  case MODUL_CMD:
2330  {
2331  ideal F=idInit(1,1);
2332  ideal II=kNF(F,currRing->qideal,I0);
2333  idDelete(&F);
2334  if (I->rtyp!=IDHDL)
2335  {
2336  idDelete((ideal*)&(I0));
2337  I->data=II;
2338  }
2339  else
2340  {
2341  idhdl h=(idhdl)I->data;
2342  idDelete((ideal*)&IDIDEAL(h));
2343  IDIDEAL(h)=II;
2344  setFlag(h,FLAG_QRING);
2345  }
2346  break;
2347  }
2348  default: break;
2349  }
2350  setFlag(I,FLAG_QRING);
2351  }
2352  }
2353 }
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:387
idrec * idhdl
Definition: ring.h:21
#define IDHDL
Definition: tok.h:31

◆ killhdl()

void killhdl ( idhdl  h,
package  prooti = currPack 
)

Definition at line 406 of file ipid.cc.

407 {
408  int t=IDTYP(h);
409  if (((BEGIN_RING<t) && (t<END_RING))
410  || ((t==LIST_CMD) && (lRingDependend((lists)IDDATA(h)))))
411  killhdl2(h,&currRing->idroot,currRing);
412  else
413  {
414  if(t==PACKAGE_CMD)
415  {
416  killhdl2(h,&(basePack->idroot),NULL);
417  }
418  else
419  {
420  idhdl s=proot->idroot;
421  while ((s!=h) && (s!=NULL)) s=s->next;
422  if (s!=NULL)
423  killhdl2(h,&(proot->idroot),NULL);
424  else if (basePack!=proot)
425  {
426  idhdl s=basePack->idroot;
427  while ((s!=h) && (s!=NULL)) s=s->next;
428  if (s!=NULL)
429  killhdl2(h,&(basePack->idroot),currRing);
430  else
431  killhdl2(h,&(currRing->idroot),currRing);
432  }
433  }
434  }
435 }
@ 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 437 of file ipid.cc.

438 {
439  //printf("kill %s, id %x, typ %d lev: %d\n",IDID(h),(int)IDID(h),IDTYP(h),IDLEV(h));
440  idhdl hh;
441 
442  if (TEST_V_ALLWARN
443  && (IDLEV(h)!=myynest)
444  &&(IDLEV(h)==0))
445  {
446  if (((*ih)==basePack->idroot)
447  || ((currRing!=NULL)&&((*ih)==currRing->idroot)))
448  Warn("kill global `%s` at line >>%s<<\n",IDID(h),my_yylinebuf);
449  }
450  if (h->attribute!=NULL)
451  {
452  if ((IDTYP(h)==RING_CMD)&&(IDRING(h)!=r))
453  h->attribute->killAll(IDRING(h));
454  else
455  h->attribute->killAll(r);
456  h->attribute=NULL;
457  }
458  if (IDTYP(h) == PACKAGE_CMD)
459  {
460  if (((IDPACKAGE(h)->language==LANG_C)&&(IDPACKAGE(h)->idroot!=NULL))
461  || (strcmp(IDID(h),"Top")==0))
462  {
463  Warn("cannot kill `%s`",IDID(h));
464  return;
465  }
466  // any objects defined for this package ?
467  if ((IDPACKAGE(h)->ref<=0) && (IDPACKAGE(h)->idroot!=NULL))
468  {
469  if (currPack==IDPACKAGE(h))
470  {
473  }
474  idhdl * hd = &IDRING(h)->idroot;
475  idhdl hdh = IDNEXT(*hd);
476  idhdl temp;
477  while (hdh!=NULL)
478  {
479  temp = IDNEXT(hdh);
480  killhdl2(hdh,&(IDPACKAGE(h)->idroot),NULL);
481  hdh = temp;
482  }
483  killhdl2(*hd,hd,NULL);
484  if (IDPACKAGE(h)->libname!=NULL) omFree((ADDRESS)(IDPACKAGE(h)->libname));
485  }
486  paKill(IDPACKAGE(h));
489  }
490  else if (IDTYP(h)==RING_CMD)
491  rKill(h);
492  else if (IDDATA(h)!=NULL)
494  // general -------------------------------------------------------------
495  // now dechain it and delete idrec
496  if (IDID(h)!=NULL) // OB: ?????
497  omFree((ADDRESS)IDID(h));
498  IDID(h)=NULL;
499  IDDATA(h)=NULL;
500  if (h == (*ih))
501  {
502  // h is at the beginning of the list
503  *ih = IDNEXT(h) /* ==*ih */;
504  }
505  else if (ih!=NULL)
506  {
507  // h is somethere in the list:
508  hh = *ih;
509  loop
510  {
511  if (hh==NULL)
512  {
513  PrintS(">>?<< not found for kill\n");
514  return;
515  }
516  idhdl hhh = IDNEXT(hh);
517  if (hhh == h)
518  {
519  IDNEXT(hh) = IDNEXT(hhh);
520  break;
521  }
522  hh = hhh;
523  }
524  }
526 }
VAR omBin idrec_bin
Definition: ipid.cc:48
VAR idhdl currPackHdl
Definition: ipid.cc:55
idhdl packFindHdl(package r)
Definition: ipid.cc:823
#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:1561
void rKill(ring r)
Definition: ipshell.cc:6179
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
#define TEST_V_ALLWARN
Definition: options.h:141
#define loop
Definition: structs.h:80
void s_internalDelete(const int t, void *d, const ring r)
Definition: subexpr.cc:514
@ LANG_C
Definition: subexpr.h:22

◆ killid()

void killid ( const char *  a,
idhdl i 
)

Definition at line 379 of file ipid.cc.

380 {
381  if (id!=NULL)
382  {
383  idhdl h = (*ih)->get(id,myynest);
384 
385  // id not found in global list, is it defined in current ring ?
386  if (h==NULL)
387  {
388  if ((currRing!=NULL) && (*ih != (currRing->idroot)))
389  {
390  h = currRing->idroot->get(id,myynest);
391  if (h!=NULL)
392  {
393  killhdl2(h,&(currRing->idroot),currRing);
394  return;
395  }
396  }
397  Werror("`%s` is not defined",id);
398  return;
399  }
400  killhdl2(h,ih,currRing);
401  }
402  else
403  WerrorS("kill what ?");
404 }

◆ 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  omFree(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  omFree(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:278
int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: iplib.cc:1059
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:1134
int iiArithAddCmd(const char *szName, short nAlias, short nTokval, short nToktype, short nPos)
Definition: iparith.cc:9792
#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[256];
1373  buff[255]='\0';
1374  strncpy(buff,p,255);
1375  strncat(buff,"_help",255-strlen(p));
1376  idhdl h=enterid(buff,0,STRING_CMD,&IDROOT,FALSE);
1377  IDSTRING(h)=omStrDup(help);
1378  currPack=s;
1379  }
1380 }

◆ packFindHdl()

idhdl packFindHdl ( package  r)

Definition at line 823 of file ipid.cc.

824 {
825  idhdl h=basePack->idroot;
826  while (h!=NULL)
827  {
828  if ((IDTYP(h)==PACKAGE_CMD)
829  && (IDPACKAGE(h)==r))
830  return h;
831  h=IDNEXT(h);
832  }
833  return NULL;
834 }

◆ 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 442 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 442 of file misc_ip.cc.