My Project
Loading...
Searching...
No Matches
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)
 
#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)
 
#define setFlag(A, F)
 
#define resetFlag(A, F)
 
#define IDNEXT(a)
 
#define IDTYP(a)
 
#define IDFLAG(a)
 
#define IDLEV(a)
 
#define IDID(a)
 
#define IDATTR(a)
 
#define IDINT(a)
 
#define IDDATA(a)
 
#define IDRING(a)
 
#define IDINTVEC(a)
 
#define IDBIMAT(a)
 
#define IDPOLY(a)
 
#define IDBIGINT(a)
 
#define IDNUMBER(a)
 
#define IDIDEAL(a)
 
#define IDMATRIX(a)
 
#define IDMAP(a)
 
#define IDSTRING(a)
 
#define IDLIST(a)
 
#define IDLINK(a)
 
#define IDPACKAGE(a)
 
#define IDPROC(a)
 

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
 
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

◆ SModulFunctions

struct SModulFunctions

Definition at line 68 of file ipid.h.

Data Fields
int(*)(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v)) iiAddCproc
int(*)(const char *szName, short nAlias, short nTokval, short nToktype, short nPos) iiArithAddCmd

◆ soptionStruct

struct soptionStruct

Definition at line 148 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,
F )
Value:
Sy_inset((F),(A)->flag)
#define Sy_inset(x, s)
Definition options.h:33
#define A
Definition sirandom.c:24

Definition at line 112 of file ipid.h.

◆ IDATTR

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

Definition at line 123 of file ipid.h.

◆ IDBIGINT

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

Definition at line 131 of file ipid.h.

◆ IDBIMAT

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

Definition at line 129 of file ipid.h.

◆ IDDATA

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

Definition at line 126 of file ipid.h.

◆ IDFLAG

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

Definition at line 120 of file ipid.h.

◆ IDID

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

Definition at line 122 of file ipid.h.

◆ IDIDEAL

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

Definition at line 133 of file ipid.h.

◆ IDINT

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

Definition at line 125 of file ipid.h.

◆ IDINTVEC

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

Definition at line 128 of file ipid.h.

◆ IDLEV

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

Definition at line 121 of file ipid.h.

◆ IDLINK

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

Definition at line 138 of file ipid.h.

◆ IDLIST

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

Definition at line 137 of file ipid.h.

◆ IDMAP

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

Definition at line 135 of file ipid.h.

◆ IDMATRIX

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

Definition at line 134 of file ipid.h.

◆ IDNEXT

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

Definition at line 118 of file ipid.h.

◆ IDNUMBER

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

Definition at line 132 of file ipid.h.

◆ IDPACKAGE

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

Definition at line 139 of file ipid.h.

◆ IDPOLY

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

Definition at line 130 of file ipid.h.

◆ IDPROC

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

Definition at line 140 of file ipid.h.

◆ IDRING

#define IDRING ( a)
Value:
((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)
Value:
((a)->data.ustring)

Definition at line 136 of file ipid.h.

◆ IDTYP

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

Definition at line 119 of file ipid.h.

◆ jjNormalizeQRingP

#define jjNormalizeQRingP ( p)
Value:
int p
Definition cfModGcd.cc:4086
poly jj_NormalizeQRingP(poly p, const ring r)
Definition ipassign.cc:2494
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13

Definition at line 103 of file ipid.h.

◆ resetFlag

#define resetFlag ( A,
F )
Value:
(A)->flag&=~Sy_bit(F)
#define Sy_bit(x)
Definition options.h:31

Definition at line 114 of file ipid.h.

◆ setFlag

#define setFlag ( A,
F )
Value:
(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 256 of file ipid.cc.

257{
258 if (s==NULL) return NULL;
259 if (root==NULL) return NULL;
260 idhdl h;
261 s=omStrDup(s);
262 // idhdl *save_root=root;
263 if (t==PACKAGE_CMD)
264 {
265 if (root!=&(basePack->idroot))
266 {
267 root=&(basePack->idroot);
268 }
269 }
270 // is it already defined in root ?
271 if ((h=(*root)->get_level(s,lev))!=NULL)
272 {
273 if ((IDTYP(h) == t)||(t==DEF_CMD))
274 {
275 if (IDTYP(h)==PACKAGE_CMD)
276 {
277 if (strcmp(s,"Top")==0)
278 {
279 goto errlabel;
280 }
281 else return h;
282 }
283 else
284 {
285 if (BVERBOSE(V_REDEFINE))
286 {
287 const char *f=VoiceName();
288 if (strcmp(f,"STDIN")==0)
289 Warn("redefining %s (%s)",s,my_yylinebuf);
290 else
291 Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno);
292 }
293 if (s==IDID(h)) IDID(h)=NULL;
294 if((t!=PROC_CMD)||(IDPROC(h)->language!=LANG_C))
295 {
296 killhdl2(h,root,currRing);
297 }
298 }
299 }
300 else
301 goto errlabel;
302 }
303 // is it already defined in currRing->idroot ?
304 else if (search && (currRing!=NULL)&&((*root) != currRing->idroot))
305 {
306 if ((h=currRing->idroot->get_level(s,lev))!=NULL)
307 {
308 if ((IDTYP(h) == t)||(t==DEF_CMD))
309 {
310 if (BVERBOSE(V_REDEFINE))
311 {
312 const char *f=VoiceName();
313 if (strcmp(f,"STDIN")==0)
314 Warn("redefining %s (%s)",s,my_yylinebuf);
315 else
316 Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno);
317 }
318 if (s==IDID(h)) IDID(h)=NULL;
319 // proc is not ring-dep, no need to check for type "proc":
320 killhdl2(h,&currRing->idroot,currRing);
321 }
322 else
323 goto errlabel;
324 }
325 }
326 // is it already defined in idroot ?
327 else if (search && (*root != IDROOT))
328 {
329 if ((h=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 if((t!=PROC_CMD)||(IDPROC(h)->language!=LANG_C))
343 {
345 }
346 }
347 else
348 goto errlabel;
349 }
350 }
351 *root = (*root)->set(s, lev, t, init);
352#ifndef SING_NDEBUG
353 checkall();
354#endif
355 return *root;
356
357 errlabel:
358 //Werror("identifier `%s` in use(lev h=%d,typ=%d,t=%d, curr=%d)",s,IDLEV(h),IDTYP(h),t,lev);
359 Werror("identifier `%s` in use",s);
360 //listall();
362 return NULL;
363}
void * ADDRESS
Definition auxiliary.h:120
FILE * f
Definition checklibs.c:9
idhdl set(const char *s, int lev, int t, BOOLEAN init=TRUE)
Definition ipid.cc:215
#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:281
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition ipid.cc:422
VAR package basePack
Definition ipid.cc:56
#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
#define omStrDup(s)
#define omFreeBinAddr(addr)
#define NULL
Definition omList.c:12
#define BVERBOSE(a)
Definition options.h:35
#define V_REDEFINE
Definition options.h:45
void Werror(const char *fmt,...)
Definition reporter.cc:189
idrec * idhdl
Definition ring.h:22
@ LANG_C
Definition subexpr.h:22
@ PACKAGE_CMD
Definition tok.h:150
@ DEF_CMD
Definition tok.h:58

◆ ggetid()

idhdl ggetid ( const char * n)

Definition at line 558 of file ipid.cc.

559{
560 if (currRing!=NULL)
561 {
562 idhdl h2 = currRing->idroot->get(n,myynest);
563 if ((h2!=NULL)&&(IDLEV(h2)==myynest)) return h2;
564 idhdl h = IDROOT->get(n,myynest);
565 if (h!=NULL) return h;
566 if (h2!=NULL) return h2;
567 }
568 else
569 {
570 idhdl h = IDROOT->get(n,myynest);
571 if (h!=NULL) return h;
572 }
573 if (basePack!=currPack)
574 return basePack->idroot->get(n,myynest);
575 return NULL;
576}
VAR int myynest
Definition febase.cc:41
VAR package currPack
Definition ipid.cc:55
#define IDLEV(a)
Definition ipid.h:121

◆ idrecDataInit()

void * idrecDataInit ( int t)

Definition at line 116 of file ipid.cc.

117{
118 switch (t)
119 {
120 //the type with init routines:
121#ifdef SINGULAR_4_2
122 case CNUMBER_CMD:
123 return (void*)n2Init(0,NULL);
124 case CPOLY_CMD:
125 return (void*)p2Init(0,NULL);
126 case CMATRIX_CMD:
127#endif
128 case BIGINTMAT_CMD:
129 return (void *)new bigintmat();
130 case BIGINTVEC_CMD:
131 return (void *)new bigintmat(1,0,coeffs_BIGINT);
132 case BUCKET_CMD:
133 if (currRing!=NULL)
134 return (void*)sBucketCreate(currRing);
135 else
136 {
137 WerrorS("need basering for polyBucket");
138 return NULL;
139 }
140 case INTVEC_CMD:
141 case INTMAT_CMD:
142 return (void *)new intvec();
143 case NUMBER_CMD:
144 {
145 if (currRing!=NULL) return (void *) nInit(0);
146 else return NULL;
147 }
148 case BIGINT_CMD:
149 return (void *) n_Init(0, coeffs_BIGINT);
150 case IDEAL_CMD:
151 case MODUL_CMD:
152 case MATRIX_CMD:
153 case SMATRIX_CMD:
154 return (void*) idInit(1,1);
155 case MAP_CMD:
156 {
157 map m = (map)idInit(1,1);
158 m->preimage = omStrDup(IDID(currRingHdl));
159 return (void *)m;
160 }
161 case STRING_CMD:
162 return (void *)omAlloc0(1);
163 case LIST_CMD:
164 {
166 l->Init();
167 return (void*)l;
168 }
169 //the types with the standard init: set the struct to zero
170 case LINK_CMD:
171 return (void*) omAlloc0Bin(sip_link_bin);
172 case PACKAGE_CMD:
173 {
174 package pa=(package)omAlloc0Bin(sip_package_bin);
175 pa->language=LANG_NONE;
176 pa->loaded = FALSE;
177 return (void*)pa;
178 }
179 case PROC_CMD:
180 {
182 pi->ref=1;
183 pi->language=LANG_NONE;
184 return (void*)pi;
185 }
186 case RESOLUTION_CMD:
187 return (void *)omAlloc0(sizeof(ssyStrategy));
188 //other types: without alloc. (int,script,poly,def,package,..)
189 case INT_CMD:
190 case DEF_CMD:
191 case POLY_CMD:
192 case VECTOR_CMD:
193 case RING_CMD:
194 case CRING_CMD:
195 case QRING_CMD:
196 return NULL;
197 default:
198 {
199 if (t>MAX_TOK)
200 {
201#ifdef BLACKBOX_DEVEL
202 Print("bb-type %d\n",t);
203#endif
204 blackbox *bb=getBlackboxStuff(t);
205 if (bb!=NULL)
206 return (void *)bb->blackbox_Init(bb);
207 }
208 else
209 Werror("unknown type in idrecDataInit:%d",t);
210 break;
211 }
212 }
213 return (void *)0L;
214}
#define FALSE
Definition auxiliary.h:97
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
Matrices of numbers.
Definition bigintmat.h:51
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
static BOOLEAN pa(leftv res, leftv args)
Definition cohomo.cc:3770
#define Print
Definition emacs.cc:80
void WerrorS(const char *s)
Definition feFopen.cc:24
@ IDEAL_CMD
Definition grammar.cc:285
@ MATRIX_CMD
Definition grammar.cc:287
@ BUCKET_CMD
Definition grammar.cc:284
@ BIGINTMAT_CMD
Definition grammar.cc:278
@ MAP_CMD
Definition grammar.cc:286
@ INTMAT_CMD
Definition grammar.cc:280
@ MODUL_CMD
Definition grammar.cc:288
@ SMATRIX_CMD
Definition grammar.cc:292
@ VECTOR_CMD
Definition grammar.cc:293
@ RESOLUTION_CMD
Definition grammar.cc:291
@ BIGINTVEC_CMD
Definition grammar.cc:279
@ NUMBER_CMD
Definition grammar.cc:289
@ POLY_CMD
Definition grammar.cc:290
@ RING_CMD
Definition grammar.cc:282
VAR idhdl currRingHdl
Definition ipid.cc:57
#define pi
Definition libparse.cc:1145
VAR omBin slists_bin
Definition lists.cc:23
slists * lists
#define nInit(i)
Definition numbers.h:24
#define omAllocBin(bin)
#define omAlloc0Bin(bin)
#define omAlloc0(size)
VAR coeffs coeffs_BIGINT
Definition polys.cc:14
sBucket_pt sBucketCreate(const ring r)
Definition sbuckets.cc:96
ideal idInit(int idsize, int rank)
initialise an ideal / module
procinfo * procinfov
Definition structs.h:56
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:160
@ STRING_CMD
Definition tok.h:187
@ CPOLY_CMD
Definition tok.h:48
@ INT_CMD
Definition tok.h:96
@ MAX_TOK
Definition tok.h:220

◆ ipListFlag()

void ipListFlag ( idhdl h)

Definition at line 596 of file ipid.cc.

597{
598 if (hasFlag(h,FLAG_STD)) PrintS(" (SB)");
599#ifdef HAVE_PLURAL
600 if (hasFlag(h,FLAG_TWOSTD)) PrintS(" (2SB)");
601#endif
602}
#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 681 of file ipid.cc.

682{
683 if ((currRing!=NULL)&&(tomove!=NULL))
684 {
685 if (RingDependend(IDTYP(tomove))
686 || ((IDTYP(tomove)==LIST_CMD) && (lRingDependend(IDLIST(tomove)))))
687 {
688 /*move 'tomove' to ring id's*/
689 if (ipSwapId(tomove,IDROOT,currRing->idroot))
690 ipSwapId(tomove,basePack->idroot,currRing->idroot);
691 }
692 else
693 {
694 /*move 'tomove' to global id's*/
695 ipSwapId(tomove,currRing->idroot,IDROOT);
696 }
697 }
698}
static int RingDependend(int t)
Definition gentable.cc:23
static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
Definition ipid.cc:656
#define IDLIST(a)
Definition ipid.h:137
BOOLEAN lRingDependend(lists L)
Definition lists.cc:222

◆ ipNameList()

lists ipNameList ( idhdl root)

Definition at line 604 of file ipid.cc.

605{
606 idhdl h=root;
607 /* compute the length */
608 int l=0;
609 while (h!=NULL) { l++; h=IDNEXT(h); }
610 /* allocate list */
612 L->Init(l);
613 /* copy names */
614 h=root;
615 l=0;
616 while (h!=NULL)
617 {
618 /* list is initialized with 0 => no need to clear anything */
619 L->m[l].rtyp=STRING_CMD;
620 L->m[l].data=omStrDup(IDID(h));
621 l++;
622 h=IDNEXT(h);
623 }
624 return L;
625}
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 627 of file ipid.cc.

628{
629 idhdl h=root;
630 /* compute the length */
631 int l=0;
632 while (h!=NULL) { if (IDLEV(h)==lev) 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 if (IDLEV(h)==lev)
642 {
643 /* list is initialized with 0 => no need to clear anything */
644 L->m[l].rtyp=STRING_CMD;
645 L->m[l].data=omStrDup(IDID(h));
646 l++;
647 }
648 h=IDNEXT(h);
649 }
650 return L;
651}

◆ jj_NormalizeQRingP()

poly jj_NormalizeQRingP ( poly p,
const ring r )

Definition at line 2494 of file ipassign.cc.

2495{
2496 if((p!=NULL) && (r->qideal!=NULL))
2497 {
2498 ring save=currRing;
2499 if (r!=currRing) rChangeCurrRing(r);
2500 ideal F=idInit(1,1);
2501 poly p2=kNF(F,r->qideal,p);
2502 p_Normalize(p2,r);
2503 id_Delete(&F,r);
2504 p_Delete(&p,r);
2505 p=p2;
2506 if (r!=save) rChangeCurrRing(save);
2507 }
2508 return p;
2509}
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition kstd1.cc:3224
void p_Normalize(poly p, const ring r)
Definition p_polys.cc:3894
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903
void rChangeCurrRing(ring r)
Definition polys.cc:16
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix

◆ jjNormalizeQRingId()

void jjNormalizeQRingId ( leftv I)

Definition at line 2459 of file ipassign.cc.

2460{
2461 assume ((currRing->qideal!=NULL) && (!hasFlag(I,FLAG_QRING)));
2462 {
2463 if (I->e==NULL)
2464 {
2465 ideal I0=(ideal)I->Data();
2466 switch (I->Typ())
2467 {
2468 case IDEAL_CMD:
2469 case MODUL_CMD:
2470 {
2471 ideal F=idInit(1,1);
2472 ideal II=kNF(F,currRing->qideal,I0);
2473 idDelete(&F);
2474 if (I->rtyp!=IDHDL)
2475 {
2476 idDelete((ideal*)&(I0));
2477 I->data=II;
2478 }
2479 else
2480 {
2481 idhdl h=(idhdl)I->data;
2482 idDelete((ideal*)&IDIDEAL(h));
2483 IDIDEAL(h)=II;
2485 }
2486 break;
2487 }
2488 default: break;
2489 }
2491 }
2492 }
2493}
int Typ()
Definition subexpr.cc:1048
void * Data()
Definition subexpr.cc:1192
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
#define IDHDL
Definition tok.h:31

◆ killhdl()

void killhdl ( idhdl h,
package prooti = currPack )

Definition at line 391 of file ipid.cc.

392{
393 int t=IDTYP(h);
394 if (((BEGIN_RING<t) && (t<END_RING))
395 || ((t==LIST_CMD) && (lRingDependend((lists)IDDATA(h)))))
396 killhdl2(h,&currRing->idroot,currRing);
397 else
398 {
399 if(t==PACKAGE_CMD)
400 {
401 killhdl2(h,&(basePack->idroot),NULL);
402 }
403 else
404 {
405 idhdl s=proot->idroot;
406 while ((s!=h) && (s!=NULL)) s=s->next;
407 if (s!=NULL)
408 killhdl2(h,&(proot->idroot),NULL);
409 else if (basePack!=proot)
410 {
411 idhdl s=basePack->idroot;
412 while ((s!=h) && (s!=NULL)) s=s->next;
413 if (s!=NULL)
414 killhdl2(h,&(basePack->idroot),currRing);
415 else
416 killhdl2(h,&(currRing->idroot),currRing);
417 }
418 }
419 }
420}
@ END_RING
Definition grammar.cc:311
@ BEGIN_RING
Definition grammar.cc:283
#define IDDATA(a)
Definition ipid.h:126

◆ killhdl2()

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

Definition at line 422 of file ipid.cc.

423{
424 //printf("kill %s, id %x, typ %d lev: %d\n",IDID(h),(int)IDID(h),IDTYP(h),IDLEV(h));
425 idhdl hh;
426
428 && (IDLEV(h)!=myynest)
429 &&(IDLEV(h)==0))
430 {
431 if (((*ih)==basePack->idroot)
432 || ((currRing!=NULL)&&((*ih)==currRing->idroot)))
433 Warn("kill global `%s` at line >>%s<<\n",IDID(h),my_yylinebuf);
434 }
435 if (h->attribute!=NULL)
436 {
437 if ((IDTYP(h)==RING_CMD)&&(IDRING(h)!=r))
438 h->attribute->killAll(IDRING(h));
439 else
440 h->attribute->killAll(r);
441 h->attribute=NULL;
442 }
443 if (IDTYP(h) == PACKAGE_CMD)
444 {
445 if ((((IDPACKAGE(h)->language==LANG_C) ||(IDPACKAGE(h)->language==LANG_MIX))
446 &&(IDPACKAGE(h)->idroot!=NULL))
447 || (strcmp(IDID(h),"Top")==0))
448 {
449 Warn("cannot kill `%s`",IDID(h));
450 return;
451 }
452 // any objects defined for this package ?
453 if ((IDPACKAGE(h)->ref<=0) && (IDPACKAGE(h)->idroot!=NULL))
454 {
455 if (currPack==IDPACKAGE(h))
456 {
459 }
460 idhdl * hd = &IDRING(h)->idroot;
461 idhdl hdh = IDNEXT(*hd);
462 idhdl temp;
463 while (hdh!=NULL)
464 {
465 temp = IDNEXT(hdh);
466 killhdl2(hdh,&(IDPACKAGE(h)->idroot),NULL);
467 hdh = temp;
468 }
469 killhdl2(*hd,hd,NULL);
470 if (IDPACKAGE(h)->libname!=NULL) omFreeBinAddr((ADDRESS)(IDPACKAGE(h)->libname));
471 }
475 }
476 else if (IDTYP(h)==RING_CMD)
477 rKill(h);
478 else if (IDDATA(h)!=NULL)
480 IDDATA(h)=NULL;
481 // general -------------------------------------------------------------
482 // now dechain it and delete idrec
483 if (IDID(h)!=NULL) // OB: ?????
485 IDID(h)=NULL;
486 IDDATA(h)=NULL;
487 if (h == (*ih))
488 {
489 // h is at the beginning of the list
490 *ih = IDNEXT(h) /* ==*ih */;
491 }
492 else if (ih!=NULL)
493 {
494 // h is somethere in the list:
495 hh = *ih;
496 loop
497 {
498 if (hh==NULL)
499 {
500 PrintS(">>?<< not found for kill\n");
501 return;
502 }
503 idhdl hhh = IDNEXT(hh);
504 if (hhh == h)
505 {
506 IDNEXT(hh) = IDNEXT(hhh);
507 break;
508 }
509 hh = hhh;
510 }
511 }
513}
VAR omBin idrec_bin
Definition ipid.cc:48
VAR idhdl currPackHdl
Definition ipid.cc:53
idhdl packFindHdl(package r)
Definition ipid.cc:808
#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:1625
void rKill(ring r)
Definition ipshell.cc:6174
#define omFreeBin(addr, bin)
#define TEST_V_ALLWARN
Definition options.h:145
#define loop
Definition structs.h:71
void s_internalDelete(const int t, void *d, const ring r)
Definition subexpr.cc:518
@ LANG_MIX
Definition subexpr.h:22

◆ killid()

void killid ( const char * a,
idhdl * i )

Definition at line 364 of file ipid.cc.

365{
366 if (id!=NULL)
367 {
368 idhdl h = (*ih)->get(id,myynest);
369
370 // id not found in global list, is it defined in current ring ?
371 if (h==NULL)
372 {
373 if ((currRing!=NULL) && (*ih != (currRing->idroot)))
374 {
375 h = currRing->idroot->get(id,myynest);
376 if (h!=NULL)
377 {
378 killhdl2(h,&(currRing->idroot),currRing);
379 return;
380 }
381 }
382 Werror("`%s` is not defined",id);
383 return;
384 }
385 killhdl2(h,ih,currRing);
386 }
387 else
388 WerrorS("kill what ?");
389}

◆ load_builtin()

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

Definition at line 1304 of file iplib.cc.

1305{
1306 int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic,
1307 BOOLEAN(*func)(leftv res, leftv v));
1308/*
1309 typedef int (*fktn_t)(int(*iiAddCproc)(const char *libname, const char *procname,
1310 BOOLEAN pstatic,
1311 BOOLEAN(*func)(leftv res, leftv v)));
1312*/
1313 // SModulFunc_t fktn;
1314 idhdl pl;
1315 char *plib = iiConvName(newlib);
1316 // BOOLEAN RET=TRUE;
1317 // int token;
1318
1319 pl = basePack->idroot->get(plib,0); // search PACKAGE only in Top
1320 if ((pl!=NULL)
1321 &&(IDTYP(pl)==PACKAGE_CMD))
1322 {
1323 if(IDPACKAGE(pl)->language==LANG_C)
1324 {
1325 if (BVERBOSE(V_LOAD_LIB)) Warn( "(builtin) %s already loaded", newlib);
1326 omFreeBinAddr(plib);
1327 return FALSE;
1328 }
1329 }
1330 else
1331 {
1332 pl = enterid( plib,0, PACKAGE_CMD, &IDROOT, TRUE );
1333 IDPACKAGE(pl)->libname=omStrDup(newlib);
1334 }
1335 omFreeBinAddr(plib);
1336 IDPACKAGE(pl)->language = LANG_C;
1337
1338 IDPACKAGE(pl)->handle=(void *)NULL;
1339 SModulFunctions sModulFunctions;
1340
1341 package s=currPack;
1342 currPack=IDPACKAGE(pl);
1343 if( init!= NULL)
1344 {
1345 sModulFunctions.iiArithAddCmd = iiArithAddCmd;
1346 if (autoexport) sModulFunctions.iiAddCproc = iiAddCprocTop;
1347 else sModulFunctions.iiAddCproc = iiAddCproc;
1348 (*init)(&sModulFunctions);
1349 }
1350 if (BVERBOSE(V_LOAD_LIB)) Print( "// ** loaded (builtin) %s \n", newlib);
1351 currPack->loaded=1;
1352 currPack=s;
1353
1354 return FALSE;
1355}
int BOOLEAN
Definition auxiliary.h:88
#define TRUE
Definition auxiliary.h:101
CanonicalForm res
Definition facAbsFact.cc:60
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
int iiArithAddCmd(const char *szName, short nAlias, short nTokval, short nToktype, short nPos=-1)
Definition iparith.cc:10083
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition ipid.cc:256
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
int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition iplib.cc:1073
char * iiConvName(const char *libname)
Definition iplib.cc:1439
int iiAddCprocTop(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition iplib.cc:1148
#define V_LOAD_LIB
Definition options.h:47
sleftv * leftv
Definition structs.h:53

◆ module_help_main()

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

Definition at line 1357 of file iplib.cc.

1358{
1359 char *plib = iiConvName(newlib);
1360 idhdl pl = basePack->idroot->get(plib,0);
1361 if ((pl==NULL)||(IDTYP(pl)!=PACKAGE_CMD))
1362 Werror(">>%s<< is not a package (trying to add package help)",plib);
1363 else
1364 {
1365 package s=currPack;
1366 currPack=IDPACKAGE(pl);
1367 idhdl h=enterid("info",0,STRING_CMD,&IDROOT,FALSE);
1369 currPack=s;
1370 }
1371}
#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 1372 of file iplib.cc.

1373{
1374 char *plib = iiConvName(newlib);
1375 idhdl pl = basePack->idroot->get(plib,0);
1376 if ((pl==NULL)||(IDTYP(pl)!=PACKAGE_CMD))
1377 Werror(">>%s<< is not a package(trying to add help for %s)",plib,p);
1378 else
1379 {
1380 package s=currPack;
1381 currPack=IDPACKAGE(pl);
1382 char buff[SINGULAR_PATH_LENGTH];
1383 buff[SINGULAR_PATH_LENGTH-1]='\0';
1384 strncpy(buff,p,SINGULAR_PATH_LENGTH-1);
1385 strncat(buff,"_help",SINGULAR_PATH_LENGTH-1-strlen(p));
1388 currPack=s;
1389 }
1390}
#define SINGULAR_PATH_LENGTH
Definition iplib.cc:21

◆ packFindHdl()

idhdl packFindHdl ( package r)

Definition at line 808 of file ipid.cc.

809{
810 idhdl h=basePack->idroot;
811 while (h!=NULL)
812 {
813 if ((IDTYP(h)==PACKAGE_CMD)
814 && (IDPACKAGE(h)==r))
815 return h;
816 h=IDNEXT(h);
817 }
818 return NULL;
819}

◆ 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.

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

509{
510 {"prot", Sy_bit(OPT_PROT), ~Sy_bit(OPT_PROT) },
511 {"redSB", Sy_bit(OPT_REDSB), ~Sy_bit(OPT_REDSB) },
512 {"notBuckets", Sy_bit(OPT_NOT_BUCKETS), ~Sy_bit(OPT_NOT_BUCKETS) },
513 {"notSugar", Sy_bit(OPT_NOT_SUGAR), ~Sy_bit(OPT_NOT_SUGAR) },
514 {"interrupt", Sy_bit(OPT_INTERRUPT), ~Sy_bit(OPT_INTERRUPT) },
515 {"sugarCrit", Sy_bit(OPT_SUGARCRIT), ~Sy_bit(OPT_SUGARCRIT) },
516 {"teach", Sy_bit(OPT_DEBUG), ~Sy_bit(OPT_DEBUG) },
517 {"notSyzMinim", Sy_bit(OPT_NO_SYZ_MINIM), ~Sy_bit(OPT_NO_SYZ_MINIM) },
518 /* 9 return SB in syz, quotient, intersect, modulo */
519 {"returnSB", Sy_bit(OPT_RETURN_SB), ~Sy_bit(OPT_RETURN_SB) },
520 {"fastHC", Sy_bit(OPT_FASTHC), ~Sy_bit(OPT_FASTHC) },
521 /* 11-19 sort in L/T */
523 {"multBound", Sy_bit(OPT_MULTBOUND), ~Sy_bit(OPT_MULTBOUND) },
524 {"degBound", Sy_bit(OPT_DEGBOUND), ~Sy_bit(OPT_DEGBOUND) },
525 {"redTailSyz", Sy_bit(OPT_REDTAIL_SYZ), ~Sy_bit(OPT_REDTAIL_SYZ) },
526 /* 25 no redTail(p)/redTail(s) */
527 {"redTail", Sy_bit(OPT_REDTAIL), ~Sy_bit(OPT_REDTAIL) },
528 {"redThrough", Sy_bit(OPT_REDTHROUGH), ~Sy_bit(OPT_REDTHROUGH) },
529 {"lazy", Sy_bit(OPT_OLDSTD), ~Sy_bit(OPT_OLDSTD) },
530 {"intStrategy", Sy_bit(OPT_INTSTRATEGY), ~Sy_bit(OPT_INTSTRATEGY) },
531 {"infRedTail", Sy_bit(OPT_INFREDTAIL), ~Sy_bit(OPT_INFREDTAIL) },
532 /* 30: use not regularity for syz */
534 {"weightM", Sy_bit(OPT_WEIGHTM), ~Sy_bit(OPT_WEIGHTM) },
535/*special for "none" and also end marker for showOption:*/
536 {"ne", 0, 0 }
537};
#define OPT_SUGARCRIT
Definition options.h:81
#define OPT_PROT
Definition options.h:76
#define OPT_INFREDTAIL
Definition options.h:95
#define OPT_INTSTRATEGY
Definition options.h:93
#define OPT_WEIGHTM
Definition options.h:98
#define OPT_REDTAIL_SYZ
Definition options.h:88
#define OPT_REDTAIL
Definition options.h:92
#define OPT_RETURN_SB
Definition options.h:85
#define OPT_NOT_SUGAR
Definition options.h:79
#define OPT_REDTHROUGH
Definition options.h:83
#define OPT_REDSB
Definition options.h:77
#define OPT_NOTREGULARITY
Definition options.h:97
#define OPT_DEBUG
Definition options.h:82
#define OPT_MULTBOUND
Definition options.h:90
#define OPT_STAIRCASEBOUND
Definition options.h:89
#define OPT_INTERRUPT
Definition options.h:80
#define OPT_DEGBOUND
Definition options.h:91
#define OPT_NOT_BUCKETS
Definition options.h:78
#define OPT_FASTHC
Definition options.h:86
#define OPT_OLDSTD
Definition options.h:87
#define OPT_NO_SYZ_MINIM
Definition options.h:84

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

540{
541 {"assign_none",Sy_bit(V_ASSIGN_NONE),~Sy_bit(V_ASSIGN_NONE)},
542 {"mem", Sy_bit(V_SHOW_MEM), ~Sy_bit(V_SHOW_MEM) },
543 {"yacc", Sy_bit(V_YACC), ~Sy_bit(V_YACC) },
544 {"redefine", Sy_bit(V_REDEFINE), ~Sy_bit(V_REDEFINE) },
545 {"reading", Sy_bit(V_READING), ~Sy_bit(V_READING) },
546 {"loadLib", Sy_bit(V_LOAD_LIB), ~Sy_bit(V_LOAD_LIB) },
547 {"debugLib", Sy_bit(V_DEBUG_LIB), ~Sy_bit(V_DEBUG_LIB) },
548 {"loadProc", Sy_bit(V_LOAD_PROC), ~Sy_bit(V_LOAD_PROC) },
549 {"defRes", Sy_bit(V_DEF_RES), ~Sy_bit(V_DEF_RES) },
550 {"usage", Sy_bit(V_SHOW_USE), ~Sy_bit(V_SHOW_USE) },
551 {"Imap", Sy_bit(V_IMAP), ~Sy_bit(V_IMAP) },
552 {"prompt", Sy_bit(V_PROMPT), ~Sy_bit(V_PROMPT) },
553 {"length", Sy_bit(V_LENGTH), ~Sy_bit(V_LENGTH) },
554 {"notWarnSB",Sy_bit(V_NSB), ~Sy_bit(V_NSB) },
555 {"contentSB",Sy_bit(V_CONTENTSB), ~Sy_bit(V_CONTENTSB) },
556 {"cancelunit",Sy_bit(V_CANCELUNIT),~Sy_bit(V_CANCELUNIT)},
557 {"modpsolve",Sy_bit(V_MODPSOLVSB),~Sy_bit(V_MODPSOLVSB)},
558 {"geometricSB",Sy_bit(V_UPTORADICAL),~Sy_bit(V_UPTORADICAL)},
559 {"findMonomials",Sy_bit(V_FINDMONOM),~Sy_bit(V_FINDMONOM)},
560 {"coefStrat",Sy_bit(V_COEFSTRAT), ~Sy_bit(V_COEFSTRAT)},
561 {"qringNF", Sy_bit(V_QRING), ~Sy_bit(V_QRING)},
562 {"warn", Sy_bit(V_ALLWARN), ~Sy_bit(V_ALLWARN)},
563 {"intersectSyz",Sy_bit(V_INTERSECT_SYZ), ~Sy_bit(V_INTERSECT_SYZ)},
564 {"intersectElim",Sy_bit(V_INTERSECT_ELIM), ~Sy_bit(V_INTERSECT_ELIM)},
565 {"pure_gb",Sy_bit(V_PURE_GB), ~Sy_bit(V_PURE_GB)},
566/*special for "none" and also end marker for showOption:*/
567 {"ne", 0, 0 }
568};
#define V_QRING
Definition options.h:42
#define V_DEF_RES
Definition options.h:50
#define V_INTERSECT_SYZ
Definition options.h:69
#define V_SHOW_MEM
Definition options.h:43
#define V_ALLWARN
Definition options.h:67
#define V_READING
Definition options.h:46
#define V_COEFSTRAT
Definition options.h:61
#define V_ASSIGN_NONE
Definition options.h:70
#define V_CONTENTSB
Definition options.h:56
#define V_DEBUG_LIB
Definition options.h:48
#define V_MODPSOLVSB
Definition options.h:58
#define V_LOAD_PROC
Definition options.h:49
#define V_UPTORADICAL
Definition options.h:59
#define V_YACC
Definition options.h:44
#define V_FINDMONOM
Definition options.h:60
#define V_CANCELUNIT
Definition options.h:57
#define V_INTERSECT_ELIM
Definition options.h:68
#define V_PURE_GB
Definition options.h:71
#define V_NSB
Definition options.h:55
#define V_LENGTH
Definition options.h:64
#define V_IMAP
Definition options.h:53
#define V_PROMPT
Definition options.h:54
#define V_SHOW_USE
Definition options.h:52