Data Structures | Typedefs | Functions | Variables
ipshell.h File Reference
#include <stdio.h>
#include <kernel/ideals.h>
#include <Singular/lists.h>
#include <Singular/fevoices.h>

Go to the source code of this file.

Data Structures

struct  sValCmd1
 
struct  sValCmd2
 
struct  sValCmd3
 
struct  sValCmdM
 
struct  sValAssign_sys
 
struct  sValAssign
 

Typedefs

typedef BOOLEAN(* proc1) (leftv, leftv)
 
typedef char *(* Proc1) (char *)
 
typedef BOOLEAN(* proc2) (leftv, leftv, leftv)
 
typedef BOOLEAN(* proc3) (leftv, leftv, leftv, leftv)
 
typedef BOOLEAN(* proci) (leftv, leftv, Subexpr)
 

Functions

BOOLEAN spectrumProc (leftv, leftv)
 
BOOLEAN spectrumfProc (leftv, leftv)
 
BOOLEAN spaddProc (leftv, leftv, leftv)
 
BOOLEAN spmulProc (leftv, leftv, leftv)
 
BOOLEAN semicProc (leftv, leftv, leftv)
 
BOOLEAN semicProc3 (leftv, leftv, leftv, leftv)
 
BOOLEAN iiAssignCR (leftv, leftv)
 
BOOLEAN iiARROW (leftv, char *, char *)
 
int IsCmd (const char *n, int &tok)
 
BOOLEAN iiPStart (idhdl pn, sleftv *sl)
 
BOOLEAN iiEStart (char *example, procinfo *pi)
 
BOOLEAN iiAllStart (procinfov pi, char *p, feBufferTypes t, int l)
 
void type_cmd (leftv v)
 
void test_cmd (int i)
 
void list_cmd (int typ, const char *what, const char *prefix, BOOLEAN iterate, BOOLEAN fullname=FALSE)
 
void killlocals (int v)
 
int exprlist_length (leftv v)
 
const char * Tok2Cmdname (int i)
 
const char * iiTwoOps (int t)
 
int iiOpsTwoChar (const char *s)
 
int IsPrime (int i)
 
BOOLEAN iiWRITE (leftv res, leftv exprlist)
 
BOOLEAN iiExport (leftv v, int toLev)
 
BOOLEAN iiExport (leftv v, int toLev, package pack)
 
BOOLEAN iiInternalExport (leftv v, int toLev, package pack)
 
char * iiGetLibName (procinfov v)
 
char * iiGetLibProcBuffer (procinfov pi, int part=1)
 
char * iiProcName (char *buf, char &ct, char *&e)
 
char * iiProcArgs (char *e, BOOLEAN withParenth)
 
BOOLEAN iiLibCmd (char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force)
 
BOOLEAN jjLOAD (const char *s, BOOLEAN autoexport=FALSE)
 load lib/module given in v More...
 
BOOLEAN iiLocateLib (const char *lib, char *where)
 
leftv iiMap (map theMap, const char *what)
 
void iiMakeResolv (resolvente r, int length, int rlen, char *name, int typ0, intvec **weights=NULL)
 
BOOLEAN jjMINRES (leftv res, leftv v)
 
BOOLEAN jjBETTI (leftv res, leftv v)
 
BOOLEAN jjBETTI2 (leftv res, leftv u, leftv v)
 
BOOLEAN jjBETTI2_ID (leftv res, leftv u, leftv v)
 
BOOLEAN jjIMPORTFROM (leftv res, leftv u, leftv v)
 
BOOLEAN jjLIST_PL (leftv res, leftv v)
 
BOOLEAN jjVARIABLES_P (leftv res, leftv u)
 
BOOLEAN jjVARIABLES_ID (leftv res, leftv u)
 
int iiRegularity (lists L)
 
leftv singular_system (sleftv h)
 
BOOLEAN jjSYSTEM (leftv res, leftv v)
 
void iiDebug ()
 
BOOLEAN iiCheckRing (int i)
 
poly iiHighCorner (ideal i, int ak)
 
char * iiConvName (const char *libname)
 
BOOLEAN iiLoadLIB (FILE *fp, const char *libnamebuf, const char *newlib, idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror)
 
lists syConvRes (syStrategy syzstr, BOOLEAN toDel=FALSE, int add_row_shift=0)
 
syStrategy syForceMin (lists li)
 
syStrategy syConvList (lists li, BOOLEAN toDel)
 
BOOLEAN syBetti1 (leftv res, leftv u)
 
BOOLEAN syBetti2 (leftv res, leftv u, leftv w)
 
BOOLEAN iiExprArith1 (leftv res, sleftv *a, int op)
 
BOOLEAN iiExprArith2 (leftv res, sleftv *a, int op, sleftv *b, BOOLEAN proccall=FALSE)
 
BOOLEAN iiExprArith3 (leftv res, int op, leftv a, leftv b, leftv c)
 
BOOLEAN iiExprArithM (leftv res, sleftv *a, int op)
 
BOOLEAN iiApply (leftv res, leftv a, int op, leftv proc)
 
BOOLEAN iiAssign (leftv left, leftv right, BOOLEAN toplevel=TRUE)
 
BOOLEAN iiParameter (leftv p)
 
BOOLEAN iiAlias (leftv p)
 
int iiTokType (int op)
 
int iiDeclCommand (leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring=FALSE, BOOLEAN init_b=TRUE)
 
BOOLEAN iiMake_proc (idhdl pn, package pack, sleftv *sl)
 
char * showOption ()
 
BOOLEAN setOption (leftv res, leftv v)
 
char * versionString ()
 
void singular_example (char *str)
 
BOOLEAN iiTryLoadLib (leftv v, const char *id)
 
int iiAddCproc (const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
 
void iiCheckPack (package &p)
 
void checkall ()
 
void rSetHdl (idhdl h)
 
ring rInit (sleftv *pn, sleftv *rv, sleftv *ord)
 
idhdl rDefault (const char *s)
 
idhdl rSimpleFindHdl (ring r, idhdl root, idhdl n=NULL)
 
idhdl rFindHdl (ring r, idhdl n)
 
void rKill (idhdl h)
 
void rKill (ring r)
 
lists scIndIndset (ideal S, BOOLEAN all, ideal Q)
 
BOOLEAN mpKoszul (leftv res, leftv c, leftv b, leftv id)
 
BOOLEAN mpJacobi (leftv res, leftv a)
 
BOOLEAN jjRESULTANT (leftv res, leftv u, leftv v, leftv w)
 
BOOLEAN kQHWeight (leftv res, leftv v)
 
BOOLEAN kWeight (leftv res, leftv id)
 
BOOLEAN loSimplex (leftv res, leftv args)
 Implementation of the Simplex Algorithm. More...
 
BOOLEAN loNewtonP (leftv res, leftv arg1)
 compute Newton Polytopes of input polynomials More...
 
BOOLEAN nuMPResMat (leftv res, leftv arg1, leftv arg2)
 returns module representing the multipolynomial resultant matrix Arguments 2: ideal i, int k k=0: use sparse resultant matrix of Gelfand, Kapranov and Zelevinsky k=1: use resultant matrix of Macaulay (k=0 is default) More...
 
BOOLEAN nuLagSolve (leftv res, leftv arg1, leftv arg2, leftv arg3)
 find the (complex) roots an univariate polynomial Determines the roots of an univariate polynomial using Laguerres' root-solver. More...
 
BOOLEAN nuVanderSys (leftv res, leftv arg1, leftv arg2, leftv arg3)
 COMPUTE: polynomial p with values given by v at points p1,..,pN derived from p; more precisely: consider p as point in K^n and v as N elements in K, let p1,..,pN be the points in K^n obtained by evaluating all monomials of degree 0,1,...,N at p in lexicographical order, then the procedure computes the polynomial f satisfying f(pi) = v[i] RETURN: polynomial f of degree d. More...
 
BOOLEAN nuUResSolve (leftv res, leftv args)
 solve a multipolynomial system using the u-resultant Input ideal must be 0-dimensional and (currRing->N) == IDELEMS(ideal). More...
 
BOOLEAN jjCHARSERIES (leftv res, leftv u)
 
void paPrint (const char *n, package p)
 
BOOLEAN iiTestAssume (leftv a, leftv b)
 
BOOLEAN iiExprArith1Tab (leftv res, leftv a, int op, struct sValCmd1 *dA1, int at, struct sConvertTypes *dConvertTypes)
 apply an operation 'op' to an argument a return TRUE on failure More...
 
BOOLEAN iiExprArith2Tab (leftv res, leftv a, int op, struct sValCmd2 *dA2, int at, struct sConvertTypes *dConvertTypes)
 apply an operation 'op' to arguments a and a->next return TRUE on failure More...
 
BOOLEAN iiExprArith3Tab (leftv res, leftv a, int op, struct sValCmd3 *dA3, int at, struct sConvertTypes *dConvertTypes)
 apply an operation 'op' to arguments a, a->next and a->next->next return TRUE on failure More...
 
BOOLEAN iiCheckTypes (leftv args, const short *type_list, int report=0)
 check a list of arguemys against a given field of types return TRUE if the types match return FALSE (and, if report) report an error via Werror otherwise More...
 
BOOLEAN iiBranchTo (leftv r, leftv args)
 

Variables

leftv iiCurrArgs
 
idhdl iiCurrProc
 
int iiOp
 
const char * currid
 
int iiRETURNEXPR_len
 
sleftv iiRETURNEXPR
 
ring * iiLocalRing
 
const char * lastreserved
 
const char * singular_date
 
int myynest
 
int printlevel
 
int si_echo
 
BOOLEAN yyInRingConstruction
 
struct sValCmd2 dArith2 []
 
struct sValCmd1 dArith1 []
 
struct sValCmd3 dArith3 []
 
struct sValCmdM dArithM []
 

Data Structure Documentation

struct sValCmd1

Definition at line 66 of file gentable.cc.

Data Fields
short arg
short cmd
int p
proc1 p
short res
short valid_for
struct sValCmd2

Definition at line 57 of file gentable.cc.

Data Fields
short arg1
short arg2
short cmd
int p
proc2 p
short res
short valid_for
struct sValCmd3

Definition at line 74 of file gentable.cc.

Data Fields
short arg1
short arg2
short arg3
short cmd
int p
proc3 p
short res
short valid_for
struct sValCmdM

Definition at line 84 of file gentable.cc.

Data Fields
short cmd
short number_of_args
int p
proc1 p
short res
short valid_for
struct sValAssign_sys

Definition at line 92 of file gentable.cc.

Data Fields
short arg
int p
proc1 p
short res
struct sValAssign

Definition at line 99 of file gentable.cc.

Data Fields
short arg
int p
proci p
short res

Typedef Documentation

typedef BOOLEAN(* proc1) (leftv, leftv)

Definition at line 124 of file ipshell.h.

typedef char*(* Proc1) (char *)

Definition at line 127 of file ipshell.h.

typedef BOOLEAN(* proc2) (leftv, leftv, leftv)

Definition at line 137 of file ipshell.h.

typedef BOOLEAN(* proc3) (leftv, leftv, leftv, leftv)

Definition at line 148 of file ipshell.h.

typedef BOOLEAN(* proci) (leftv, leftv, Subexpr)

Definition at line 177 of file ipshell.h.

Function Documentation

void checkall ( )

Definition at line 1016 of file misc_ip.cc.

1017 {
1018  idhdl hh=basePack->idroot;
1019  while (hh!=NULL)
1020  {
1021  omCheckAddr(hh);
1022  omCheckAddr((ADDRESS)IDID(hh));
1023  if (RingDependend(IDTYP(hh)))
1024  {
1025  Print("%s typ %d in Top (should be in ring)\n",IDID(hh),IDTYP(hh));
1026  }
1027  hh=IDNEXT(hh);
1028  }
1029  hh=basePack->idroot;
1030  while (hh!=NULL)
1031  {
1032  if (IDTYP(hh)==PACKAGE_CMD)
1033  {
1034  idhdl h2=IDPACKAGE(hh)->idroot;
1035  if (IDPACKAGE(hh)!=basePack)
1036  {
1037  while (h2!=NULL)
1038  {
1039  omCheckAddr(h2);
1040  omCheckAddr((ADDRESS)IDID(h2));
1041  if (RingDependend(IDTYP(h2)))
1042  {
1043  Print("%s typ %d in %s (should be in ring)\n",IDID(h2),IDTYP(h2),IDID(hh));
1044  }
1045  h2=IDNEXT(h2);
1046  }
1047  }
1048  }
1049  hh=IDNEXT(hh);
1050  }
1051 }
#define Print
Definition: emacs.cc:83
#define IDID(a)
Definition: ipid.h:121
#define IDNEXT(a)
Definition: ipid.h:117
void * ADDRESS
Definition: auxiliary.h:161
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:138
#define IDTYP(a)
Definition: ipid.h:118
int RingDependend(int t)
Definition: gentable.cc:23
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
int exprlist_length ( leftv  v)

Definition at line 549 of file ipshell.cc.

550 {
551  int rc = 0;
552  while (v!=NULL)
553  {
554  switch (v->Typ())
555  {
556  case INT_CMD:
557  case POLY_CMD:
558  case VECTOR_CMD:
559  case NUMBER_CMD:
560  rc++;
561  break;
562  case INTVEC_CMD:
563  case INTMAT_CMD:
564  rc += ((intvec *)(v->Data()))->length();
565  break;
566  case MATRIX_CMD:
567  case IDEAL_CMD:
568  case MODUL_CMD:
569  {
570  matrix mm = (matrix)(v->Data());
571  rc += mm->rows() * mm->cols();
572  }
573  break;
574  case LIST_CMD:
575  rc+=((lists)v->Data())->nr+1;
576  break;
577  default:
578  rc++;
579  }
580  v = v->next;
581  }
582  return rc;
583 }
int & rows()
Definition: matpol.h:24
Definition: tok.h:85
int Typ()
Definition: subexpr.cc:949
Definition: intvec.h:16
ip_smatrix * matrix
Definition: tok.h:88
leftv next
Definition: subexpr.h:87
int & cols()
Definition: matpol.h:25
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
void * Data()
Definition: subexpr.cc:1091
Definition: tok.h:96
int iiAddCproc ( const char *  libname,
const char *  procname,
BOOLEAN  pstatic,
BOOLEAN(*)(leftv res, leftv v func 
)

Definition at line 991 of file iplib.cc.

993 {
994  procinfov pi;
995  idhdl h;
996 
997  #ifndef SING_NDEBUG
998  int dummy;
999  if (IsCmd(procname,dummy))
1000  {
1001  Werror(">>%s< is a reserved name",procname);
1002  return 0;
1003  }
1004  #endif
1005 
1006  h = enterid(procname,0, PROC_CMD, &IDROOT, TRUE);
1007  if ( h!= NULL )
1008  {
1009  pi = IDPROC(h);
1010  pi->libname = omStrDup(libname);
1011  pi->procname = omStrDup(procname);
1012  pi->language = LANG_C;
1013  pi->ref = 1;
1014  pi->is_static = pstatic;
1015  pi->data.o.function = func;
1016  return(1);
1017  }
1018  else
1019  {
1020  PrintS("iiAddCproc: failed.\n");
1021  }
1022  return(0);
1023 }
language_defs language
Definition: subexpr.h:58
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:144
short ref
Definition: subexpr.h:59
Definition: idrec.h:34
char * procname
Definition: subexpr.h:56
Definition: subexpr.h:20
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:256
char * libname
Definition: subexpr.h:55
procinfodata data
Definition: subexpr.h:62
void PrintS(const char *s)
Definition: reporter.cc:294
char is_static
Definition: subexpr.h:60
#define IDPROC(a)
Definition: ipid.h:139
#define pi
Definition: libparse.cc:1143
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978
void Werror(const char *fmt,...)
Definition: reporter.cc:199
int IsCmd(const char *n, int &tok)
Definition: iparith.cc:8688
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN iiAlias ( leftv  p)

Definition at line 1320 of file ipshell.cc.

1321 {
1322  if (iiCurrArgs==NULL)
1323  {
1324  Werror("not enough arguments for proc %s",VoiceName());
1325  p->CleanUp();
1326  return TRUE;
1327  }
1328  leftv h=iiCurrArgs;
1329  iiCurrArgs=h->next;
1330  h->next=NULL;
1331  if (h->rtyp!=IDHDL)
1332  {
1333  BOOLEAN res=iiAssign(p,h);
1334  h->CleanUp();
1336  return res;
1337  }
1338  if (h->Typ()!=p->Typ())
1339  {
1340  WerrorS("type mismatch");
1341  return TRUE;
1342  }
1343  idhdl pp=(idhdl)p->data;
1344  switch(pp->typ)
1345  {
1346 #ifdef SINGULAR_4_1
1347  case CRING_CMD:
1348  nKillChar((coeffs)pp);
1349  break;
1350 #endif
1351  case INT_CMD:
1352  break;
1353  case INTVEC_CMD:
1354  case INTMAT_CMD:
1355  delete IDINTVEC(pp);
1356  break;
1357  case NUMBER_CMD:
1358  nDelete(&IDNUMBER(pp));
1359  break;
1360  case BIGINT_CMD:
1362  break;
1363  case MAP_CMD:
1364  {
1365  map im = IDMAP(pp);
1366  omFree((ADDRESS)im->preimage);
1367  }
1368  // continue as ideal:
1369  case IDEAL_CMD:
1370  case MODUL_CMD:
1371  case MATRIX_CMD:
1372  idDelete(&IDIDEAL(pp));
1373  break;
1374  case PROC_CMD:
1375  case RESOLUTION_CMD:
1376  case STRING_CMD:
1377  omFree((ADDRESS)IDSTRING(pp));
1378  break;
1379  case LIST_CMD:
1380  IDLIST(pp)->Clean();
1381  break;
1382  case LINK_CMD:
1384  break;
1385  // case ring: cannot happen
1386  default:
1387  Werror("unknown type %d",p->Typ());
1388  return TRUE;
1389  }
1390  pp->typ=ALIAS_CMD;
1391  IDDATA(pp)=(char*)h->data;
1392  h->CleanUp();
1394  return FALSE;
1395 }
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:400
#define IDLIST(a)
Definition: ipid.h:136
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
#define IDLINK(a)
Definition: ipid.h:137
#define IDINTVEC(a)
Definition: ipid.h:127
#define FALSE
Definition: auxiliary.h:140
Definition: tok.h:42
#define TRUE
Definition: auxiliary.h:144
#define IDIDEAL(a)
Definition: ipid.h:132
void * ADDRESS
Definition: auxiliary.h:161
void WerrorS(const char *s)
Definition: feFopen.cc:23
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:949
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
poly pp
Definition: myNF.cc:296
void * data
Definition: subexpr.h:89
poly res
Definition: myNF.cc:322
Definition: tok.h:56
#define omFree(addr)
Definition: omAllocDecl.h:261
The main handler for Singular numbers which are suitable for Singular polynomials.
#define IDSTRING(a)
Definition: ipid.h:135
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
idrec * idhdl
Definition: ring.h:18
omBin sleftv_bin
Definition: subexpr.cc:50
Definition: tok.h:88
const char * VoiceName()
Definition: fevoices.cc:64
#define nDelete(n)
Definition: numbers.h:16
#define IDMAP(a)
Definition: ipid.h:134
leftv next
Definition: subexpr.h:87
#define IDNUMBER(a)
Definition: ipid.h:131
Definition: tok.h:38
Definition: tok.h:95
#define NULL
Definition: omList.c:10
leftv iiCurrArgs
Definition: ipshell.cc:82
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
int typ
Definition: idrec.h:43
Definition: tok.h:96
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
#define IDDATA(a)
Definition: ipid.h:125
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:477
void Werror(const char *fmt,...)
Definition: reporter.cc:199
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1659
BOOLEAN iiAllStart ( procinfov  pi,
char *  p,
feBufferTypes  t,
int  l 
)

Definition at line 312 of file iplib.cc.

313 {
314  // see below:
315  BITSET save1=si_opt_1;
316  BITSET save2=si_opt_2;
317  newBuffer( omStrDup(p /*pi->data.s.body*/), t /*BT_proc*/,
318  pi, l );
319  BOOLEAN err=yyparse();
320  if (sLastPrinted.rtyp!=0)
321  {
323  }
324  // the access to optionStruct and verboseStruct do not work
325  // on x86_64-Linux for pic-code
326  if ((TEST_V_ALLWARN) &&
327  (t==BT_proc) &&
328  ((save1!=si_opt_1)||(save2!=si_opt_2)) &&
329  (pi->libname!=NULL) && (pi->libname[0]!='\0'))
330  {
331  if ((pi->libname!=NULL) && (pi->libname[0]!='\0'))
332  Warn("option changed in proc %s from %s",pi->procname,pi->libname);
333  else
334  Warn("option changed in proc %s",pi->procname);
335  int i;
336  for (i=0; optionStruct[i].setval!=0; i++)
337  {
338  if ((optionStruct[i].setval & si_opt_1)
339  && (!(optionStruct[i].setval & save1)))
340  {
341  Print(" +%s",optionStruct[i].name);
342  }
343  if (!(optionStruct[i].setval & si_opt_1)
344  && ((optionStruct[i].setval & save1)))
345  {
346  Print(" -%s",optionStruct[i].name);
347  }
348  }
349  for (i=0; verboseStruct[i].setval!=0; i++)
350  {
351  if ((verboseStruct[i].setval & si_opt_2)
352  && (!(verboseStruct[i].setval & save2)))
353  {
354  Print(" +%s",verboseStruct[i].name);
355  }
356  if (!(verboseStruct[i].setval & si_opt_2)
357  && ((verboseStruct[i].setval & save2)))
358  {
359  Print(" -%s",verboseStruct[i].name);
360  }
361  }
362  PrintLn();
363  }
364  return err;
365 }
unsigned si_opt_1
Definition: options.c:5
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
return P p
Definition: myNF.cc:203
struct soptionStruct optionStruct[]
Definition: misc_ip.cc:519
#define BITSET
Definition: structs.h:17
char * procname
Definition: subexpr.h:56
unsigned setval
Definition: iplib.cc:305
struct soptionStruct verboseStruct[]
Definition: misc_ip.cc:549
char * libname
Definition: subexpr.h:55
int i
Definition: cfEzgcd.cc:123
int yyparse(void)
Definition: grammar.cc:2168
char name(const Variable &v)
Definition: variable.h:95
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
Definition: fevoices.cc:169
unsigned si_opt_2
Definition: options.c:6
int BOOLEAN
Definition: auxiliary.h:131
#define TEST_V_ALLWARN
Definition: options.h:135
int l
Definition: cfEzgcd.cc:94
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN iiApply ( leftv  res,
leftv  a,
int  op,
leftv  proc 
)

Definition at line 6109 of file ipshell.cc.

6110 {
6111  memset(res,0,sizeof(sleftv));
6112  res->rtyp=a->Typ();
6113  switch (res->rtyp /*a->Typ()*/)
6114  {
6115  case INTVEC_CMD:
6116  case INTMAT_CMD:
6117  return iiApplyINTVEC(res,a,op,proc);
6118  case BIGINTMAT_CMD:
6119  return iiApplyBIGINTMAT(res,a,op,proc);
6120  case IDEAL_CMD:
6121  case MODUL_CMD:
6122  case MATRIX_CMD:
6123  return iiApplyIDEAL(res,a,op,proc);
6124  case LIST_CMD:
6125  return iiApplyLIST(res,a,op,proc);
6126  }
6127  WerrorS("first argument to `apply` must allow an index");
6128  return TRUE;
6129 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
BOOLEAN iiApplyBIGINTMAT(leftv res, leftv a, int op, leftv proc)
Definition: ipshell.cc:6067
BOOLEAN iiApplyIDEAL(leftv res, leftv a, int op, leftv proc)
Definition: ipshell.cc:6072
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:949
BOOLEAN iiApplyLIST(leftv res, leftv a, int op, leftv proc)
Definition: ipshell.cc:6077
Definition: tok.h:88
int rtyp
Definition: subexpr.h:92
Definition: tok.h:96
BOOLEAN iiApplyINTVEC(leftv res, leftv a, int op, leftv proc)
Definition: ipshell.cc:6035
BOOLEAN iiARROW ( leftv  ,
char *  ,
char *   
)

Definition at line 6158 of file ipshell.cc.

6159 {
6160  char *ss=(char*)omAlloc(strlen(a)+strlen(s)+30); /* max. 27 currently */
6161  // find end of s:
6162  int end_s=strlen(s);
6163  while ((end_s>0) && ((s[end_s]<=' ')||(s[end_s]==';'))) end_s--;
6164  s[end_s+1]='\0';
6165  char *name=(char *)omAlloc(strlen(a)+strlen(s)+30);
6166  sprintf(name,"%s->%s",a,s);
6167  // find start of last expression
6168  int start_s=end_s-1;
6169  while ((start_s>=0) && (s[start_s]!=';')) start_s--;
6170  if (start_s<0) // ';' not found
6171  {
6172  sprintf(ss,"parameter def %s;return(%s);\n",a,s);
6173  }
6174  else // s[start_s] is ';'
6175  {
6176  s[start_s]='\0';
6177  sprintf(ss,"parameter def %s;%s;return(%s);\n",a,s,s+start_s+1);
6178  }
6179  memset(r,0,sizeof(*r));
6180  // now produce procinfo for PROC_CMD:
6181  r->data = (void *)omAlloc0Bin(procinfo_bin);
6182  ((procinfo *)(r->data))->language=LANG_NONE;
6183  iiInitSingularProcinfo((procinfo *)r->data,"",name,0,0);
6184  ((procinfo *)r->data)->data.s.body=ss;
6185  omFree(name);
6186  r->rtyp=PROC_CMD;
6187  //r->rtyp=STRING_CMD;
6188  //r->data=ss;
6189  return FALSE;
6190 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
const poly a
Definition: syzextra.cc:212
procinfo * iiInitSingularProcinfo(procinfov pi, const char *libname, const char *procname, int line, long pos, BOOLEAN pstatic)
Definition: iplib.cc:966
#define FALSE
Definition: auxiliary.h:140
#define omAlloc(size)
Definition: omAllocDecl.h:210
omBin procinfo_bin
Definition: subexpr.cc:51
const ring r
Definition: syzextra.cc:208
#define omFree(addr)
Definition: omAllocDecl.h:261
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
char name(const Variable &v)
Definition: variable.h:95
BOOLEAN iiAssign ( leftv  left,
leftv  right,
BOOLEAN  toplevel = TRUE 
)

Definition at line 1659 of file ipassign.cc.

1660 {
1661  if (errorreported) return TRUE;
1662  int ll=l->listLength();
1663  int rl;
1664  int lt=l->Typ();
1665  int rt=NONE;
1666  BOOLEAN b;
1667  if (l->rtyp==ALIAS_CMD)
1668  {
1669  Werror("`%s` is read-only",l->Name());
1670  }
1671 
1672  if (l->rtyp==IDHDL)
1673  {
1674  atKillAll((idhdl)l->data);
1675  IDFLAG((idhdl)l->data)=0;
1676  l->attribute=NULL;
1677  toplevel=FALSE;
1678  }
1679  else if (l->attribute!=NULL)
1680  atKillAll((idhdl)l);
1681  l->flag=0;
1682  if (ll==1)
1683  {
1684  /* l[..] = ... */
1685  if(l->e!=NULL)
1686  {
1687  BOOLEAN like_lists=0;
1688  blackbox *bb=NULL;
1689  int bt;
1690  if (((bt=l->rtyp)>MAX_TOK)
1691  || ((l->rtyp==IDHDL) && ((bt=IDTYP((idhdl)l->data))>MAX_TOK)))
1692  {
1693  bb=getBlackboxStuff(bt);
1694  like_lists=BB_LIKE_LIST(bb); // bb like a list
1695  }
1696  else if (((l->rtyp==IDHDL) && (IDTYP((idhdl)l->data)==LIST_CMD))
1697  || (l->rtyp==LIST_CMD))
1698  {
1699  like_lists=2; // bb in a list
1700  }
1701  if(like_lists)
1702  {
1703  if (traceit&TRACE_ASSIGN) PrintS("assign list[..]=...or similar\n");
1704  if (like_lists==1)
1705  {
1706  // check blackbox/newtype type:
1707  if(bb->blackbox_CheckAssign(bb,l,r)) return TRUE;
1708  }
1709  b=jiAssign_list(l,r);
1710  if((!b) && (like_lists==2))
1711  {
1712  //Print("jjA_L_LIST: - 2 \n");
1713  if((l->rtyp==IDHDL) && (l->data!=NULL))
1714  {
1715  ipMoveId((idhdl)l->data);
1716  l->attribute=IDATTR((idhdl)l->data);
1717  l->flag=IDFLAG((idhdl)l->data);
1718  }
1719  }
1720  r->CleanUp();
1721  Subexpr h;
1722  while (l->e!=NULL)
1723  {
1724  h=l->e->next;
1726  l->e=h;
1727  }
1728  return b;
1729  }
1730  }
1731  if (lt>MAX_TOK)
1732  {
1733  blackbox *bb=getBlackboxStuff(lt);
1734 #ifdef BLACKBOX_DEVEL
1735  Print("bb-assign: bb=%lx\n",bb);
1736 #endif
1737  return (bb==NULL) || bb->blackbox_Assign(l,r);
1738  }
1739  // end of handling elems of list and similar
1740  rl=r->listLength();
1741  if (rl==1)
1742  {
1743  /* system variables = ... */
1744  if(((l->rtyp>=VECHO)&&(l->rtyp<=VPRINTLEVEL))
1745  ||((l->rtyp>=VALTVARS)&&(l->rtyp<=VMINPOLY)))
1746  {
1747  b=iiAssign_sys(l,r);
1748  r->CleanUp();
1749  //l->CleanUp();
1750  return b;
1751  }
1752  rt=r->Typ();
1753  /* a = ... */
1754  if ((lt!=MATRIX_CMD)
1755  &&(lt!=BIGINTMAT_CMD)
1756  &&(lt!=CMATRIX_CMD)
1757  &&(lt!=INTMAT_CMD)
1758  &&((lt==rt)||(lt!=LIST_CMD)))
1759  {
1760  b=jiAssign_1(l,r,toplevel);
1761  if (l->rtyp==IDHDL)
1762  {
1763  if ((lt==DEF_CMD)||(lt==LIST_CMD))
1764  {
1765  ipMoveId((idhdl)l->data);
1766  }
1767  l->attribute=IDATTR((idhdl)l->data);
1768  l->flag=IDFLAG((idhdl)l->data);
1769  l->CleanUp();
1770  }
1771  r->CleanUp();
1772  return b;
1773  }
1774  if (((lt!=LIST_CMD)
1775  &&((rt==MATRIX_CMD)
1776  ||(rt==BIGINTMAT_CMD)
1777  ||(rt==CMATRIX_CMD)
1778  ||(rt==INTMAT_CMD)
1779  ||(rt==INTVEC_CMD)
1780  ||(rt==MODUL_CMD)))
1781  ||((lt==LIST_CMD)
1782  &&(rt==RESOLUTION_CMD))
1783  )
1784  {
1785  b=jiAssign_1(l,r,toplevel);
1786  if((l->rtyp==IDHDL)&&(l->data!=NULL))
1787  {
1788  if ((lt==DEF_CMD) || (lt==LIST_CMD))
1789  {
1790  //Print("ipAssign - 3.0\n");
1791  ipMoveId((idhdl)l->data);
1792  }
1793  l->attribute=IDATTR((idhdl)l->data);
1794  l->flag=IDFLAG((idhdl)l->data);
1795  }
1796  r->CleanUp();
1797  Subexpr h;
1798  while (l->e!=NULL)
1799  {
1800  h=l->e->next;
1802  l->e=h;
1803  }
1804  return b;
1805  }
1806  }
1807  if (rt==NONE) rt=r->Typ();
1808  }
1809  else if (ll==(rl=r->listLength()))
1810  {
1811  b=jiAssign_rec(l,r);
1812  return b;
1813  }
1814  else
1815  {
1816  if (rt==NONE) rt=r->Typ();
1817  if (rt==INTVEC_CMD)
1818  return jiA_INTVEC_L(l,r);
1819  else if (rt==VECTOR_CMD)
1820  return jiA_VECTOR_L(l,r);
1821  else if ((rt==IDEAL_CMD)||(rt==MATRIX_CMD))
1822  return jiA_MATRIX_L(l,r);
1823  else if ((rt==STRING_CMD)&&(rl==1))
1824  return jiA_STRING_L(l,r);
1825  Werror("length of lists in assignment does not match (l:%d,r:%d)",
1826  ll,rl);
1827  return TRUE;
1828  }
1829 
1830  leftv hh=r;
1831  BOOLEAN nok=FALSE;
1832  BOOLEAN map_assign=FALSE;
1833  switch (lt)
1834  {
1835  case INTVEC_CMD:
1836  nok=jjA_L_INTVEC(l,r,new intvec(exprlist_length(r)));
1837  break;
1838  case INTMAT_CMD:
1839  {
1840  nok=jjA_L_INTVEC(l,r,new intvec(IDINTVEC((idhdl)l->data)));
1841  break;
1842  }
1843  case BIGINTMAT_CMD:
1844  {
1845  nok=jjA_L_BIGINTMAT(l, r, new bigintmat(IDBIMAT((idhdl)l->data)));
1846  break;
1847  }
1848  case MAP_CMD:
1849  {
1850  // first element in the list sl (r) must be a ring
1851  if (((rt == RING_CMD)||(rt == QRING_CMD))&&(r->e==NULL))
1852  {
1853  omFree((ADDRESS)IDMAP((idhdl)l->data)->preimage);
1854  IDMAP((idhdl)l->data)->preimage = omStrDup (r->Fullname());
1855  /* advance the expressionlist to get the next element after the ring */
1856  hh = r->next;
1857  //r=hh;
1858  }
1859  else
1860  {
1861  WerrorS("expected ring-name");
1862  nok=TRUE;
1863  break;
1864  }
1865  if (hh==NULL) /* map-assign: map f=r; */
1866  {
1867  WerrorS("expected image ideal");
1868  nok=TRUE;
1869  break;
1870  }
1871  if ((hh->next==NULL)&&(hh->Typ()==IDEAL_CMD))
1872  return jiAssign_1(l,hh,toplevel); /* map-assign: map f=r,i; */
1873  //no break, handle the rest like an ideal:
1874  map_assign=TRUE;
1875  }
1876  case MATRIX_CMD:
1877  case IDEAL_CMD:
1878  case MODUL_CMD:
1879  {
1880  sleftv t;
1881  matrix olm = (matrix)l->Data();
1882  int rk=olm->rank;
1883  char *pr=((map)olm)->preimage;
1884  BOOLEAN module_assign=(/*l->Typ()*/ lt==MODUL_CMD);
1885  matrix lm ;
1886  int num;
1887  int j,k;
1888  int i=0;
1889  int mtyp=MATRIX_CMD; /*Type of left side object*/
1890  int etyp=POLY_CMD; /*Type of elements of left side object*/
1891 
1892  if (lt /*l->Typ()*/==MATRIX_CMD)
1893  {
1894  num=olm->cols()*olm->rows();
1895  lm=mpNew(olm->rows(),olm->cols());
1896  int el;
1897  if ((traceit&TRACE_ASSIGN) && (num!=(el=exprlist_length(hh))))
1898  {
1899  Warn("expression list length(%d) does not match matrix size(%d)",el,num);
1900  }
1901  }
1902  else /* IDEAL_CMD or MODUL_CMD */
1903  {
1904  num=exprlist_length(hh);
1905  lm=(matrix)idInit(num,1);
1906  rk=1;
1907  if (module_assign)
1908  {
1909  mtyp=MODUL_CMD;
1910  etyp=VECTOR_CMD;
1911  }
1912  }
1913 
1914  int ht;
1915  loop
1916  {
1917  if (hh==NULL)
1918  break;
1919  else
1920  {
1921  matrix rm;
1922  ht=hh->Typ();
1923  if ((j=iiTestConvert(ht,etyp))!=0)
1924  {
1925  nok=iiConvert(ht,etyp,j,hh,&t);
1926  hh->next=t.next;
1927  if (nok) break;
1928  lm->m[i]=(poly)t.CopyD(etyp);
1929  pNormalize(lm->m[i]);
1930  if (module_assign) rk=si_max(rk,(int)pMaxComp(lm->m[i]));
1931  i++;
1932  }
1933  else
1934  if ((j=iiTestConvert(ht,mtyp))!=0)
1935  {
1936  nok=iiConvert(ht,mtyp,j,hh,&t);
1937  hh->next=t.next;
1938  if (nok) break;
1939  rm = (matrix)t.CopyD(mtyp);
1940  if (module_assign)
1941  {
1942  j = si_min(num,rm->cols());
1943  rk=si_max(rk,(int)rm->rank);
1944  }
1945  else
1946  j = si_min(num-i,rm->rows() * rm->cols());
1947  for(k=0;k<j;k++,i++)
1948  {
1949  lm->m[i]=rm->m[k];
1950  pNormalize(lm->m[i]);
1951  rm->m[k]=NULL;
1952  }
1953  idDelete((ideal *)&rm);
1954  }
1955  else
1956  {
1957  nok=TRUE;
1958  break;
1959  }
1960  t.next=NULL;t.CleanUp();
1961  if (i==num) break;
1962  hh=hh->next;
1963  }
1964  }
1965  if (nok)
1966  idDelete((ideal *)&lm);
1967  else
1968  {
1969  idDelete((ideal *)&olm);
1970  if (module_assign) lm->rank=rk;
1971  else if (map_assign) ((map)lm)->preimage=pr;
1972  l=l->LData();
1973  if (l->rtyp==IDHDL)
1974  IDMATRIX((idhdl)l->data)=lm;
1975  else
1976  l->data=(char *)lm;
1977  }
1978  break;
1979  }
1980  case STRING_CMD:
1981  nok=jjA_L_STRING(l,r);
1982  break;
1983  //case DEF_CMD:
1984  case LIST_CMD:
1985  nok=jjA_L_LIST(l,r);
1986  break;
1987  case NONE:
1988  case 0:
1989  Werror("cannot assign to %s",l->Fullname());
1990  nok=TRUE;
1991  break;
1992  default:
1993  WerrorS("assign not impl.");
1994  nok=TRUE;
1995  break;
1996  } /* end switch: typ */
1997  if (nok && (!errorreported)) WerrorS("incompatible type in list assignment");
1998  r->CleanUp();
1999  return nok;
2000 }
int & rows()
Definition: matpol.h:24
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:400
static BOOLEAN jiA_INTVEC_L(leftv l, leftv r)
Definition: ipassign.cc:1190
void ipMoveId(idhdl tomove)
Definition: ipid.cc:601
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:290
Definition: tok.h:157
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define TRACE_ASSIGN
Definition: reporter.h:33
static BOOLEAN jjA_L_INTVEC(leftv l, leftv r, intvec *iv)
Definition: ipassign.cc:1322
#define Print
Definition: emacs.cc:83
CanonicalForm num(const CanonicalForm &f)
#define IDINTVEC(a)
Definition: ipid.h:127
#define pMaxComp(p)
Definition: polys.h:270
loop
Definition: myNF.cc:98
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
#define FALSE
Definition: auxiliary.h:140
int exprlist_length(leftv v)
Definition: ipshell.cc:549
Matrices of numbers.
Definition: bigintmat.h:32
static BOOLEAN jiAssign_list(leftv l, leftv r)
Definition: ipassign.cc:1566
Definition: tok.h:167
static BOOLEAN jiAssign_1(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:952
const ideal
Definition: gb_hack.h:42
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
#define IDBIMAT(a)
Definition: ipid.h:128
void WerrorS(const char *s)
Definition: feFopen.cc:23
int k
Definition: cfEzgcd.cc:93
int traceit
Definition: febase.cc:47
int Typ()
Definition: subexpr.cc:949
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
static BOOLEAN jjA_L_BIGINTMAT(leftv l, leftv r, bigintmat *bim)
Definition: ipassign.cc:1371
static BOOLEAN iiAssign_sys(leftv l, leftv r)
Definition: ipassign.cc:1116
#define IDTYP(a)
Definition: ipid.h:118
poly * m
Definition: matpol.h:19
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
int j
Definition: myNF.cc:70
Definition: tok.h:58
#define omFree(addr)
Definition: omAllocDecl.h:261
polyrec * poly
Definition: hilb.h:10
pNormalize(P.p)
static BOOLEAN jiA_VECTOR_L(leftv l, leftv r)
Definition: ipassign.cc:1216
omBin sSubexpr_bin
Definition: subexpr.cc:49
ip_smatrix * matrix
static BOOLEAN jjA_L_STRING(leftv l, leftv r)
Definition: ipassign.cc:1420
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
Definition: tok.h:88
#define IDMAP(a)
Definition: ipid.h:134
short errorreported
Definition: feFopen.cc:22
leftv next
Definition: subexpr.h:87
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
Definition: tok.h:38
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
#define atKillAll(H)
Definition: attrib.h:41
static BOOLEAN jiA_STRING_L(leftv l, leftv r)
Definition: ipassign.cc:1530
int & cols()
Definition: matpol.h:25
#define NULL
Definition: omList.c:10
static BOOLEAN jiAssign_rec(leftv l, leftv r)
Definition: ipassign.cc:1636
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:295
static BOOLEAN jiA_MATRIX_L(leftv l, leftv r)
Definition: ipassign.cc:1454
static BOOLEAN jjA_L_LIST(leftv l, leftv r)
Definition: ipassign.cc:1257
#define IDFLAG(a)
Definition: ipid.h:119
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
#define IDATTR(a)
Definition: ipid.h:122
Definition: tok.h:96
Definition: tok.h:126
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
#define NONE
Definition: tok.h:170
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void * CopyD(int t)
Definition: subexpr.cc:656
int l
Definition: cfEzgcd.cc:94
long rank
Definition: matpol.h:20
#define IDMATRIX(a)
Definition: ipid.h:133
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:20
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN iiAssignCR ( leftv  ,
leftv   
)

Definition at line 6192 of file ipshell.cc.

6193 {
6194  int t=arg->Typ();
6195  char* ring_name=(char*)r->Name();
6196  ring_name=omStrDup(ring_name);
6197  if ((t==RING_CMD) ||(t==QRING_CMD))
6198  {
6199  sleftv tmp;
6200  memset(&tmp,0,sizeof(tmp));
6201  tmp.rtyp=IDHDL;
6202  tmp.data=(char*)rDefault(ring_name);
6203  if (tmp.data!=NULL)
6204  {
6205  BOOLEAN b=iiAssign(&tmp,arg);
6206  if (b) return TRUE;
6207  rSetHdl(ggetid(ring_name));
6208  omFree(ring_name);
6209  return FALSE;
6210  }
6211  else
6212  return TRUE;
6213  }
6214  else if (t==CRING_CMD)
6215  {
6216  sleftv tmp;
6217  sleftv n;
6218  memset(&n,0,sizeof(n));
6219  n.name=ring_name;
6220  if (iiDeclCommand(&tmp,&n,myynest,CRING_CMD,&IDROOT)) return TRUE;
6221  if (iiAssign(&tmp,arg)) return TRUE;
6222  //Print("create %s\n",r->Name());
6223  //Print("from %s(%d)\n",Tok2Cmdname(arg->Typ()),arg->Typ());
6224  return FALSE;
6225  }
6226  return TRUE;// not handled -> error for now
6227 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:144
#define IDHDL
Definition: tok.h:35
idhdl rDefault(const char *s)
Definition: ipshell.cc:1645
void * data
Definition: subexpr.h:89
int myynest
Definition: febase.cc:46
Definition: tok.h:56
const ring r
Definition: syzextra.cc:208
const char * name
Definition: subexpr.h:88
#define omFree(addr)
Definition: omAllocDecl.h:261
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition: ipshell.cc:1160
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
Definition: tok.h:126
void rSetHdl(idhdl h)
Definition: ipshell.cc:4821
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)
Definition: ipid.cc:487
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1659
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN iiBranchTo ( leftv  r,
leftv  args 
)

Definition at line 1215 of file ipshell.cc.

1216 {
1217  // <string1...stringN>,<proc>
1218  // known: args!=NULL, l>=1
1219  int l=args->listLength();
1220  int ll=0;
1221  if (iiCurrArgs!=NULL) ll=iiCurrArgs->listLength();
1222  if (ll!=(l-1)) return FALSE;
1223  leftv h=args;
1224  short *t=(short*)omAlloc(l*sizeof(short));
1225  t[0]=l-1;
1226  int b;
1227  int i;
1228  for(i=1;i<l;i++,h=h->next)
1229  {
1230  if (h->Typ()!=STRING_CMD)
1231  {
1232  omFree(t);
1233  Werror("arg %d is not a string",i);
1234  return TRUE;
1235  }
1236  int tt;
1237  b=IsCmd((char *)h->Data(),tt);
1238  if(b) t[i]=tt;
1239  else
1240  {
1241  omFree(t);
1242  Werror("arg %d is not a type name",i);
1243  return TRUE;
1244  }
1245  }
1246  if (h->Typ()!=PROC_CMD)
1247  {
1248  omFree(t);
1249  Werror("last arg (%d) is not a proc",i);
1250  return TRUE;
1251  }
1252  b=iiCheckTypes(iiCurrArgs,t,0);
1253  omFree(t);
1254  if (b && (h->rtyp==IDHDL) && (h->e==NULL))
1255  {
1256  BOOLEAN err;
1257  //Print("branchTo: %s\n",h->Name());
1258  iiCurrProc=(idhdl)h->data;
1260  if( pi->data.s.body==NULL )
1261  {
1263  if (pi->data.s.body==NULL) return TRUE;
1264  }
1265  if ((pi->pack!=NULL)&&(currPack!=pi->pack))
1266  {
1267  currPack=pi->pack;
1270  //Print("set pack=%s\n",IDID(currPackHdl));
1271  }
1272  err=iiAllStart(pi,pi->data.s.body,BT_proc,pi->data.s.body_lineno-(iiCurrArgs==NULL));
1274  if (iiCurrArgs!=NULL)
1275  {
1276  if (!err) Warn("too many arguments for %s",IDID(iiCurrProc));
1277  iiCurrArgs->CleanUp();
1279  iiCurrArgs=NULL;
1280  }
1281  return 2-err;
1282  }
1283  return FALSE;
1284 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
idhdl currPackHdl
Definition: ipid.cc:60
#define IDID(a)
Definition: ipid.h:121
#define FALSE
Definition: auxiliary.h:140
int listLength()
Definition: subexpr.cc:61
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
#define omAlloc(size)
Definition: omAllocDecl.h:210
BOOLEAN exitBuffer(feBufferTypes typ)
Definition: fevoices.cc:231
#define IDHDL
Definition: tok.h:35
idhdl iiCurrProc
Definition: ipshell.cc:83
#define omFree(addr)
Definition: omAllocDecl.h:261
idrec * idhdl
Definition: ring.h:18
omBin sleftv_bin
Definition: subexpr.cc:50
int i
Definition: cfEzgcd.cc:123
leftv next
Definition: subexpr.h:87
BOOLEAN iiAllStart(procinfov pi, char *p, feBufferTypes t, int l)
Definition: iplib.cc:312
#define IDPROC(a)
Definition: ipid.h:139
#define pi
Definition: libparse.cc:1143
#define NULL
Definition: omList.c:10
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
Definition: ipshell.cc:6247
package currPack
Definition: ipid.cc:62
leftv iiCurrArgs
Definition: ipshell.cc:82
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
idhdl packFindHdl(package r)
Definition: ipid.cc:729
void iiCheckPack(package &p)
Definition: ipshell.cc:1629
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
char * iiGetLibProcBuffer(procinfo *pi, int part)
Definition: iplib.cc:200
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
void Werror(const char *fmt,...)
Definition: reporter.cc:199
int l
Definition: cfEzgcd.cc:94
utypes data
Definition: idrec.h:40
int IsCmd(const char *n, int &tok)
Definition: iparith.cc:8688
#define Warn
Definition: emacs.cc:80
void iiCheckPack ( package p)

Definition at line 1629 of file ipshell.cc.

1630 {
1631  if (p==basePack) return;
1632 
1633  idhdl t=basePack->idroot;
1634 
1635  while ((t!=NULL) && (IDTYP(t)!=PACKAGE_CMD) && (IDPACKAGE(t)!=p)) t=t->next;
1636 
1637  if (t==NULL)
1638  {
1639  WarnS("package not found\n");
1640  p=basePack;
1641  }
1642  return;
1643 }
return P p
Definition: myNF.cc:203
#define WarnS
Definition: emacs.cc:81
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:138
#define IDTYP(a)
Definition: ipid.h:118
idhdl next
Definition: idrec.h:38
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
BOOLEAN iiCheckRing ( int  i)

Definition at line 1585 of file ipshell.cc.

1586 {
1587  if (currRing==NULL)
1588  {
1589  #ifdef SIQ
1590  if (siq<=0)
1591  {
1592  #endif
1593  if (RingDependend(i))
1594  {
1595  WerrorS("no ring active");
1596  return TRUE;
1597  }
1598  #ifdef SIQ
1599  }
1600  #endif
1601  }
1602  return FALSE;
1603 }
#define FALSE
Definition: auxiliary.h:140
BOOLEAN siq
Definition: subexpr.cc:58
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int RingDependend(int t)
Definition: gentable.cc:23
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
BOOLEAN iiCheckTypes ( leftv  args,
const short *  type_list,
int  report = 0 
)

check a list of arguemys against a given field of types return TRUE if the types match return FALSE (and, if report) report an error via Werror otherwise

Parameters
type_list< [in] argument list (may be NULL) [in] field of types len, t1,t2,...
report;in] report error?

Definition at line 6247 of file ipshell.cc.

6248 {
6249  if (args==NULL)
6250  {
6251  if (type_list[0]==0) return TRUE;
6252  else
6253  {
6254  if (report) WerrorS("no arguments expected");
6255  return FALSE;
6256  }
6257  }
6258  int l=args->listLength();
6259  if (l!=(int)type_list[0])
6260  {
6261  if (report) iiReportTypes(0,l,type_list);
6262  return FALSE;
6263  }
6264  for(int i=1;i<=l;i++,args=args->next)
6265  {
6266  short t=type_list[i];
6267  if (t!=ANY_TYPE)
6268  {
6269  if (((t==IDHDL)&&(args->rtyp!=IDHDL))
6270  || (t!=args->Typ()))
6271  {
6272  if (report) iiReportTypes(i,args->Typ(),type_list);
6273  return FALSE;
6274  }
6275  }
6276  }
6277  return TRUE;
6278 }
#define ANY_TYPE
Definition: tok.h:34
#define FALSE
Definition: auxiliary.h:140
int listLength()
Definition: subexpr.cc:61
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
#define IDHDL
Definition: tok.h:35
static void iiReportTypes(int nr, int t, const short *T)
Definition: ipshell.cc:6229
int i
Definition: cfEzgcd.cc:123
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
int l
Definition: cfEzgcd.cc:94
char* iiConvName ( const char *  libname)

Definition at line 1262 of file iplib.cc.

1263 {
1264  char *tmpname = omStrDup(libname);
1265  char *p = strrchr(tmpname, DIR_SEP);
1266  char *r;
1267  if(p==NULL) p = tmpname;
1268  else p++;
1269  r = (char *)strchr(p, '.');
1270  if( r!= NULL) *r = '\0';
1271  r = omStrDup(p);
1272  *r = mytoupper(*r);
1273  // printf("iiConvName: '%s' '%s' => '%s'\n", libname, tmpname, r);
1274  omFree((ADDRESS)tmpname);
1275 
1276  return(r);
1277 }
char mytoupper(char c)
Definition: iplib.cc:1243
return P p
Definition: myNF.cc:203
void * ADDRESS
Definition: auxiliary.h:161
#define DIR_SEP
Definition: feResource.h:6
const ring r
Definition: syzextra.cc:208
#define omFree(addr)
Definition: omAllocDecl.h:261
#define NULL
Definition: omList.c:10
#define omStrDup(s)
Definition: omAllocDecl.h:263
void iiDebug ( )

Definition at line 1025 of file ipshell.cc.

1026 {
1027  Print("\n-- break point in %s --\n",VoiceName());
1029  char * s;
1031  s = (char *)omAlloc(BREAK_LINE_LENGTH+4);
1032  loop
1033  {
1034  memset(s,0,80);
1036  if (s[BREAK_LINE_LENGTH-1]!='\0')
1037  {
1038  Print("line too long, max is %d chars\n",BREAK_LINE_LENGTH);
1039  }
1040  else
1041  break;
1042  }
1043  if (*s=='\n')
1044  {
1046  }
1047 #if MDEBUG
1048  else if(strncmp(s,"cont;",5)==0)
1049  {
1051  }
1052 #endif /* MDEBUG */
1053  else
1054  {
1055  strcat( s, "\n;~\n");
1056  newBuffer(s,BT_execute);
1057  }
1058 }
void VoiceBackTrack()
Definition: fevoices.cc:75
const CanonicalForm int s
Definition: facAbsFact.cc:55
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
Definition: feread.cc:33
#define Print
Definition: emacs.cc:83
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
#define omAlloc(size)
Definition: omAllocDecl.h:210
BOOLEAN iiDebugMarker
Definition: ipshell.cc:1023
const char * VoiceName()
Definition: fevoices.cc:64
#define BREAK_LINE_LENGTH
Definition: ipshell.cc:1024
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
Definition: fevoices.cc:169
int iiDeclCommand ( leftv  sy,
leftv  name,
int  lev,
int  t,
idhdl root,
BOOLEAN  isring = FALSE,
BOOLEAN  init_b = TRUE 
)

Definition at line 1160 of file ipshell.cc.

1161 {
1162  BOOLEAN res=FALSE;
1163  const char *id = name->name;
1164 
1165  memset(sy,0,sizeof(sleftv));
1166  if ((name->name==NULL)||(isdigit(name->name[0])))
1167  {
1168  WerrorS("object to declare is not a name");
1169  res=TRUE;
1170  }
1171  else
1172  {
1173  if (TEST_V_ALLWARN
1174  && (name->rtyp!=0)
1175  && (name->rtyp!=IDHDL)
1176  && (currRingHdl!=NULL) && (IDLEV(currRingHdl)==myynest))
1177  {
1178  Warn("`%s` is %s in %s:%d:%s",name->name,Tok2Cmdname(name->rtyp),
1180  }
1181  {
1182  sy->data = (char *)enterid(id,lev,t,root,init_b);
1183  }
1184  if (sy->data!=NULL)
1185  {
1186  sy->rtyp=IDHDL;
1187  currid=sy->name=IDID((idhdl)sy->data);
1188  // name->name=NULL; /* used in enterid */
1189  //sy->e = NULL;
1190  if (name->next!=NULL)
1191  {
1193  res=iiDeclCommand(sy->next,name->next,lev,t,root, isring);
1194  }
1195  }
1196  else res=TRUE;
1197  }
1198  name->CleanUp();
1199  return res;
1200 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int yylineno
Definition: febase.cc:45
#define IDID(a)
Definition: ipid.h:121
#define FALSE
Definition: auxiliary.h:140
char * filename
Definition: fevoices.h:62
#define TRUE
Definition: auxiliary.h:144
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:23
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
const char * currid
Definition: grammar.cc:172
void * data
Definition: subexpr.h:89
poly res
Definition: myNF.cc:322
int myynest
Definition: febase.cc:46
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:256
char my_yylinebuf[80]
Definition: febase.cc:48
const char * name
Definition: subexpr.h:88
idhdl currRingHdl
Definition: ipid.cc:64
omBin sleftv_bin
Definition: subexpr.cc:50
#define IDLEV(a)
Definition: ipid.h:120
leftv next
Definition: subexpr.h:87
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition: ipshell.cc:1160
#define NULL
Definition: omList.c:10
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
Voice * currentVoice
Definition: fevoices.cc:55
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
int BOOLEAN
Definition: auxiliary.h:131
#define TEST_V_ALLWARN
Definition: options.h:135
#define Warn
Definition: emacs.cc:80
BOOLEAN iiEStart ( char *  example,
procinfo pi 
)

Definition at line 655 of file iplib.cc.

656 {
657  BOOLEAN err;
658  int old_echo=si_echo;
659 
660  iiCheckNest();
661  procstack->push(example);
662 #ifdef USE_IILOCALRING
664 #endif
666  {
667  if (traceit&TRACE_SHOW_LINENO) printf("\n");
668  printf("entering example (level %d)\n",myynest);
669  }
670  myynest++;
671 
672  err=iiAllStart(pi,example,BT_example,(pi != NULL ? pi->data.s.example_lineno: 0));
673 
675  myynest--;
676  si_echo=old_echo;
677  if (traceit&TRACE_SHOW_PROC)
678  {
679  if (traceit&TRACE_SHOW_LINENO) printf("\n");
680  printf("leaving -example- (level %d)\n",myynest);
681  }
682 #ifdef USE_IILOCALRING
683  if (iiLocalRing[myynest] != currRing)
684  {
685  if (iiLocalRing[myynest]!=NULL)
686  {
689  }
690  else
691  {
693  currRing=NULL;
694  }
695  }
696 #else /* USE_IILOCALRING */
697 #endif /* USE_IILOCALRING */
698  if (NS_LRING != currRing)
699  {
700  if (NS_LRING!=NULL)
701  {
703  if ((rh==NULL)||(IDRING(rh)!=NS_LRING))
704  rh=rFindHdl(NS_LRING,NULL);
705  rSetHdl(rh);
706  }
707  else
708  {
710  currRing=NULL;
711  }
712  }
713 //#endif /* USE_IILOCALRING */
714  procstack->pop();
715  return err;
716 }
#define TRACE_SHOW_LINENO
Definition: reporter.h:26
proclevel * procstack
Definition: ipid.cc:57
int traceit
Definition: febase.cc:47
idhdl cRingHdl
Definition: ipid.h:60
static void iiCheckNest()
Definition: iplib.cc:550
Definition: idrec.h:34
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void killlocals(int v)
Definition: ipshell.cc:382
procinfodata data
Definition: subexpr.h:62
idhdl currRingHdl
Definition: ipid.cc:64
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1690
BOOLEAN iiAllStart(procinfov pi, char *p, feBufferTypes t, int l)
Definition: iplib.cc:312
ring * iiLocalRing
Definition: iplib.cc:515
#define NULL
Definition: omList.c:10
#define IDRING(a)
Definition: ipid.h:126
#define TRACE_SHOW_PROC
Definition: reporter.h:25
void rSetHdl(idhdl h)
Definition: ipshell.cc:4821
void push(char *)
Definition: ipid.cc:699
void pop()
Definition: ipid.cc:711
int BOOLEAN
Definition: auxiliary.h:131
#define NS_LRING
Definition: iplib.cc:60
int si_echo
Definition: febase.cc:41
BOOLEAN iiExport ( leftv  v,
int  toLev 
)

Definition at line 1505 of file ipshell.cc.

1506 {
1507  BOOLEAN nok=FALSE;
1508  leftv r=v;
1509  while (v!=NULL)
1510  {
1511  if ((v->name==NULL)||(v->rtyp==0)||(v->e!=NULL))
1512  {
1513  Werror("cannot export:%s of internal type %d",v->name,v->rtyp);
1514  nok=TRUE;
1515  }
1516  else
1517  {
1518  if(iiInternalExport(v, toLev))
1519  {
1520  r->CleanUp();
1521  return TRUE;
1522  }
1523  }
1524  v=v->next;
1525  }
1526  r->CleanUp();
1527  return nok;
1528 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Subexpr e
Definition: subexpr.h:106
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
const ring r
Definition: syzextra.cc:208
const char * name
Definition: subexpr.h:88
leftv next
Definition: subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
static BOOLEAN iiInternalExport(leftv v, int toLev)
Definition: ipshell.cc:1397
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
int BOOLEAN
Definition: auxiliary.h:131
void Werror(const char *fmt,...)
Definition: reporter.cc:199
BOOLEAN iiExport ( leftv  v,
int  toLev,
package  pack 
)

Definition at line 1531 of file ipshell.cc.

1532 {
1533 #ifdef SINGULAR_4_1
1534  if ((pack==basePack)&&(pack!=currPack))
1535  { Warn("'exportto' to Top is depreciated in >>%s<<",my_yylinebuf);}
1536 #endif
1537  BOOLEAN nok=FALSE;
1538  leftv rv=v;
1539  while (v!=NULL)
1540  {
1541  if ((v->name==NULL)||(v->rtyp==0)||(v->e!=NULL)
1542  )
1543  {
1544  Werror("cannot export:%s of internal type %d",v->name,v->rtyp);
1545  nok=TRUE;
1546  }
1547  else
1548  {
1549  idhdl old=pack->idroot->get( v->name,toLev);
1550  if (old!=NULL)
1551  {
1552  if ((pack==currPack) && (old==(idhdl)v->data))
1553  {
1554  if (BVERBOSE(V_REDEFINE)) Warn("`%s` is already global",IDID(old));
1555  break;
1556  }
1557  else if (IDTYP(old)==v->Typ())
1558  {
1559  if (BVERBOSE(V_REDEFINE))
1560  {
1561  Warn("redefining %s",IDID(old));
1562  }
1563  v->name=omStrDup(v->name);
1564  killhdl2(old,&(pack->idroot),currRing);
1565  }
1566  else
1567  {
1568  rv->CleanUp();
1569  return TRUE;
1570  }
1571  }
1572  //Print("iiExport: pack=%s\n",IDID(root));
1573  if(iiInternalExport(v, toLev, pack))
1574  {
1575  rv->CleanUp();
1576  return TRUE;
1577  }
1578  }
1579  v=v->next;
1580  }
1581  rv->CleanUp();
1582  return nok;
1583 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Subexpr e
Definition: subexpr.h:106
#define IDID(a)
Definition: ipid.h:121
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int Typ()
Definition: subexpr.cc:949
Definition: idrec.h:34
idhdl get(const char *s, int lev)
Definition: ipid.cc:90
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define IDTYP(a)
Definition: ipid.h:118
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:400
char my_yylinebuf[80]
Definition: febase.cc:48
const char * name
Definition: subexpr.h:88
leftv next
Definition: subexpr.h:87
#define BVERBOSE(a)
Definition: options.h:33
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
static BOOLEAN iiInternalExport(leftv v, int toLev)
Definition: ipshell.cc:1397
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
package currPack
Definition: ipid.cc:62
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
int BOOLEAN
Definition: auxiliary.h:131
#define V_REDEFINE
Definition: options.h:43
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN iiExprArith1 ( leftv  res,
sleftv a,
int  op 
)
BOOLEAN iiExprArith1Tab ( leftv  res,
leftv  a,
int  op,
struct sValCmd1 dA1,
int  at,
struct sConvertTypes dConvertTypes 
)

apply an operation 'op' to an argument a return TRUE on failure

Parameters
[out]respre-allocated result
[in]aargument
[in]opoperation
[in]dA1table of possible proc assumes dArith1[0].cmd==op
[in]ata->Typ()
[in]dConvertTypestable of type conversions

Definition at line 8161 of file iparith.cc.

8162 {
8163  memset(res,0,sizeof(sleftv));
8164  BOOLEAN call_failed=FALSE;
8165 
8166  if (!errorreported)
8167  {
8168  BOOLEAN failed=FALSE;
8169  iiOp=op;
8170  int i = 0;
8171  while (dA1[i].cmd==op)
8172  {
8173  if (at==dA1[i].arg)
8174  {
8175  if (currRing!=NULL)
8176  {
8177  if (check_valid(dA1[i].valid_for,op)) break;
8178  }
8179  else
8180  {
8181  if (RingDependend(dA1[i].res))
8182  {
8183  WerrorS("no ring active");
8184  break;
8185  }
8186  }
8187  if (traceit&TRACE_CALL)
8188  Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(at));
8189  res->rtyp=dA1[i].res;
8190  if ((call_failed=dA1[i].p(res,a)))
8191  {
8192  break;// leave loop, goto error handling
8193  }
8194  if (a->Next()!=NULL)
8195  {
8197  failed=iiExprArith1(res->next,a->next,op);
8198  }
8199  a->CleanUp();
8200  return failed;
8201  }
8202  i++;
8203  }
8204  // implicite type conversion --------------------------------------------
8205  if (dA1[i].cmd!=op)
8206  {
8208  i=0;
8209  //Print("fuer %c , typ: %s\n",op,Tok2Cmdname(at));
8210  while (dA1[i].cmd==op)
8211  {
8212  int ai;
8213  //Print("test %s\n",Tok2Cmdname(dA1[i].arg));
8214  if ((ai=iiTestConvert(at,dA1[i].arg,dConvertTypes))!=0)
8215  {
8216  if (currRing!=NULL)
8217  {
8218  if (check_valid(dA1[i].valid_for,op)) break;
8219  }
8220  else
8221  {
8222  if (RingDependend(dA1[i].res))
8223  {
8224  WerrorS("no ring active");
8225  break;
8226  }
8227  }
8228  if (traceit&TRACE_CALL)
8229  Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(dA1[i].arg));
8230  res->rtyp=dA1[i].res;
8231  failed= ((iiConvert(at,dA1[i].arg,ai,a,an,dConvertTypes))
8232  || (call_failed=dA1[i].p(res,an)));
8233  // everything done, clean up temp. variables
8234  if (failed)
8235  {
8236  // leave loop, goto error handling
8237  break;
8238  }
8239  else
8240  {
8241  if (an->Next() != NULL)
8242  {
8243  res->next = (leftv)omAllocBin(sleftv_bin);
8244  failed=iiExprArith1(res->next,an->next,op);
8245  }
8246  // everything ok, clean up and return
8247  an->CleanUp();
8249  a->CleanUp();
8250  return failed;
8251  }
8252  }
8253  i++;
8254  }
8255  an->CleanUp();
8257  }
8258  // error handling
8259  if (!errorreported)
8260  {
8261  if ((at==0) && (a->Fullname()!=sNoName))
8262  {
8263  Werror("`%s` is not defined",a->Fullname());
8264  }
8265  else
8266  {
8267  i=0;
8268  const char *s = iiTwoOps(op);
8269  Werror("%s(`%s`) failed"
8270  ,s,Tok2Cmdname(at));
8271  if ((!call_failed) && BVERBOSE(V_SHOW_USE))
8272  {
8273  while (dA1[i].cmd==op)
8274  {
8275  if ((dA1[i].res!=0)
8276  && (dA1[i].p!=jjWRONG))
8277  Werror("expected %s(`%s`)"
8278  ,s,Tok2Cmdname(dA1[i].arg));
8279  i++;
8280  }
8281  }
8282  }
8283  }
8284  res->rtyp = UNKNOWN;
8285  }
8286  a->CleanUp();
8287  return TRUE;
8288 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
const CanonicalForm int s
Definition: facAbsFact.cc:55
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:290
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define Print
Definition: emacs.cc:83
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition: iparith.cc:8289
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
const char sNoName[]
Definition: subexpr.cc:56
#define TRUE
Definition: auxiliary.h:144
#define UNKNOWN
Definition: tok.h:171
void * ADDRESS
Definition: auxiliary.h:161
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:23
int traceit
Definition: febase.cc:47
short res
Definition: gentable.cc:70
const char * Fullname()
Definition: subexpr.h:126
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define V_SHOW_USE
Definition: options.h:50
static BOOLEAN check_valid(const int p, const int op)
Definition: iparith.cc:9087
const char * Tok2Cmdname(int tok)
Definition: iparith.cc:8810
int RingDependend(int t)
Definition: gentable.cc:23
const char * iiTwoOps(int t)
Definition: gentable.cc:250
static BOOLEAN jjWRONG(leftv, leftv)
Definition: iparith.cc:3662
leftv Next()
Definition: subexpr.h:137
omBin sleftv_bin
Definition: subexpr.cc:50
int i
Definition: cfEzgcd.cc:123
#define TRACE_CALL
Definition: reporter.h:32
short errorreported
Definition: feFopen.cc:22
leftv next
Definition: subexpr.h:87
#define BVERBOSE(a)
Definition: options.h:33
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define NULL
Definition: omList.c:10
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:295
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
int iiOp
Definition: iparith.cc:238
int BOOLEAN
Definition: auxiliary.h:131
void Werror(const char *fmt,...)
Definition: reporter.cc:199
BOOLEAN iiExprArith2 ( leftv  res,
sleftv a,
int  op,
sleftv b,
BOOLEAN  proccall = FALSE 
)
BOOLEAN iiExprArith2Tab ( leftv  res,
leftv  a,
int  op,
struct sValCmd2 dA2,
int  at,
struct sConvertTypes dConvertTypes 
)

apply an operation 'op' to arguments a and a->next return TRUE on failure

Parameters
[out]respre-allocated result
[in]a2 arguments
[in]opoperation
[in]dA2table of possible proc assumes dA2[0].cmd==op
[in]ata->Typ()
[in]dConvertTypestable of type conversions

Definition at line 8088 of file iparith.cc.

8092 {
8093  leftv b=a->next;
8094  a->next=NULL;
8095  int bt=b->Typ();
8096  BOOLEAN bo=iiExprArith2TabIntern(res,a,op,b,TRUE,dA2,at,bt,dConvertTypes);
8097  a->next=b;
8098  a->CleanUp();
8099  return bo;
8100 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define TRUE
Definition: auxiliary.h:144
int Typ()
Definition: subexpr.cc:949
leftv next
Definition: subexpr.h:87
static BOOLEAN iiExprArith2TabIntern(leftv res, leftv a, int op, leftv b, BOOLEAN proccall, struct sValCmd2 *dA2, int at, int bt, struct sConvertTypes *dConvertTypes)
Definition: iparith.cc:7929
#define NULL
Definition: omList.c:10
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
BOOLEAN iiExprArith3 ( leftv  res,
int  op,
leftv  a,
leftv  b,
leftv  c 
)

Definition at line 8491 of file iparith.cc.

8492 {
8493  memset(res,0,sizeof(sleftv));
8494 
8495  if (!errorreported)
8496  {
8497 #ifdef SIQ
8498  if (siq>0)
8499  {
8500  //Print("siq:%d\n",siq);
8502  memcpy(&d->arg1,a,sizeof(sleftv));
8503  //a->Init();
8504  memcpy(&d->arg2,b,sizeof(sleftv));
8505  //b->Init();
8506  memcpy(&d->arg3,c,sizeof(sleftv));
8507  //c->Init();
8508  d->op=op;
8509  d->argc=3;
8510  res->data=(char *)d;
8511  res->rtyp=COMMAND;
8512  return FALSE;
8513  }
8514 #endif
8515  int at=a->Typ();
8516  // handling bb-objects ----------------------------------------------
8517  if (at>MAX_TOK)
8518  {
8519  blackbox *bb=getBlackboxStuff(at);
8520  if (bb!=NULL)
8521  {
8522  if(!bb->blackbox_Op3(op,res,a,b,c)) return FALSE;
8523  if (errorreported) return TRUE;
8524  // else: no op defined
8525  }
8526  else return TRUE;
8527  if (errorreported) return TRUE;
8528  }
8529  int bt=b->Typ();
8530  int ct=c->Typ();
8531 
8532  iiOp=op;
8533  int i=0;
8534  while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
8535  return iiExprArith3TabIntern(res,op,a,b,c,dArith3+i,at,bt,ct,dConvertTypes);
8536  }
8537  a->CleanUp();
8538  b->CleanUp();
8539  c->CleanUp();
8540  //Print("op: %d,result typ:%d\n",op,res->rtyp);
8541  return TRUE;
8542 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
ip_command * command
Definition: ipid.h:24
#define FALSE
Definition: auxiliary.h:140
Definition: tok.h:167
BOOLEAN siq
Definition: subexpr.cc:58
#define TRUE
Definition: auxiliary.h:144
int Typ()
Definition: subexpr.cc:949
void * data
Definition: subexpr.h:89
struct sValCmd3 dArith3[]
Definition: table.h:656
int i
Definition: cfEzgcd.cc:123
short errorreported
Definition: feFopen.cc:22
struct sConvertTypes dConvertTypes[]
Definition: table.h:1110
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
static BOOLEAN iiExprArith3TabIntern(leftv res, int op, leftv a, leftv b, leftv c, struct sValCmd3 *dA3, int at, int bt, int ct, struct sConvertTypes *dConvertTypes)
Definition: iparith.cc:8337
#define NULL
Definition: omList.c:10
omBin sip_command_bin
Definition: ipid.cc:48
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
int iiOp
Definition: iparith.cc:238
#define COMMAND
Definition: tok.h:33
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:20
BOOLEAN iiExprArith3Tab ( leftv  res,
leftv  a,
int  op,
struct sValCmd3 dA3,
int  at,
struct sConvertTypes dConvertTypes 
)

apply an operation 'op' to arguments a, a->next and a->next->next return TRUE on failure

Parameters
[out]respre-allocated result
[in]a3 arguments
[in]opoperation
[in]dA3table of possible proc assumes dA3[0].cmd==op
[in]ata->Typ()
[in]dConvertTypestable of type conversions

Definition at line 8543 of file iparith.cc.

8547 {
8548  leftv b=a->next;
8549  a->next=NULL;
8550  int bt=b->Typ();
8551  leftv c=b->next;
8552  b->next=NULL;
8553  int ct=c->Typ();
8554  BOOLEAN bo=iiExprArith3TabIntern(res,op,a,b,c,dA3,at,bt,ct,dConvertTypes);
8555  b->next=c;
8556  a->next=b;
8557  a->CleanUp();
8558  return bo;
8559 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int Typ()
Definition: subexpr.cc:949
leftv next
Definition: subexpr.h:87
static BOOLEAN iiExprArith3TabIntern(leftv res, int op, leftv a, leftv b, leftv c, struct sValCmd3 *dA3, int at, int bt, int ct, struct sConvertTypes *dConvertTypes)
Definition: iparith.cc:8337
#define NULL
Definition: omList.c:10
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
BOOLEAN iiExprArithM ( leftv  res,
sleftv a,
int  op 
)
char* iiGetLibName ( procinfov  v)

Definition at line 101 of file iplib.cc.

102 {
103  return pi->libname;
104 }
#define pi
Definition: libparse.cc:1143
char* iiGetLibProcBuffer ( procinfov  pi,
int  part = 1 
)
poly iiHighCorner ( ideal  i,
int  ak 
)

Definition at line 1605 of file ipshell.cc.

1606 {
1607  int i;
1608  if(!idIsZeroDim(I)) return NULL; // not zero-dim.
1609  poly po=NULL;
1611  {
1612  scComputeHC(I,currRing->qideal,ak,po);
1613  if (po!=NULL)
1614  {
1615  pGetCoeff(po)=nInit(1);
1616  for (i=rVar(currRing); i>0; i--)
1617  {
1618  if (pGetExp(po, i) > 0) pDecrExp(po,i);
1619  }
1620  pSetComp(po,ak);
1621  pSetm(po);
1622  }
1623  }
1624  else
1625  po=pOne();
1626  return po;
1627 }
#define pSetm(p)
Definition: polys.h:241
BOOLEAN idIsZeroDim(ideal i, const ring R=currRing)
Definition: ideals.h:179
#define pDecrExp(p, i)
Definition: polys.h:44
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
Definition: hdegree.cc:999
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
polyrec * poly
Definition: hilb.h:10
#define pSetComp(p, v)
Definition: polys.h:38
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:286
#define rHasLocalOrMixedOrdering_currRing()
Definition: ring.h:748
#define NULL
Definition: omList.c:10
strat ak
Definition: myNF.cc:321
#define nInit(i)
Definition: numbers.h:24
BOOLEAN iiInternalExport ( leftv  v,
int  toLev,
package  pack 
)

Definition at line 1459 of file ipshell.cc.

1460 {
1461  idhdl h=(idhdl)v->data;
1462  if(h==NULL)
1463  {
1464  Warn("'%s': no such identifier\n", v->name);
1465  return FALSE;
1466  }
1467  package frompack=v->req_packhdl;
1468  if (frompack==NULL) frompack=currPack;
1469  if ((RingDependend(IDTYP(h)))
1470  || ((IDTYP(h)==LIST_CMD)
1471  && (lRingDependend(IDLIST(h)))
1472  )
1473  )
1474  {
1475  //Print("// ==> Ringdependent set nesting to 0\n");
1476  return (iiInternalExport(v, toLev));
1477  }
1478  else
1479  {
1480  IDLEV(h)=toLev;
1481  v->req_packhdl=rootpack;
1482  if (h==frompack->idroot)
1483  {
1484  frompack->idroot=h->next;
1485  }
1486  else
1487  {
1488  idhdl hh=frompack->idroot;
1489  while ((hh!=NULL) && (hh->next!=h))
1490  hh=hh->next;
1491  if ((hh!=NULL) && (hh->next==h))
1492  hh->next=h->next;
1493  else
1494  {
1495  Werror("`%s` not found",v->Name());
1496  return TRUE;
1497  }
1498  }
1499  h->next=rootpack->idroot;
1500  rootpack->idroot=h;
1501  }
1502  return FALSE;
1503 }
#define IDLIST(a)
Definition: ipid.h:136
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
const char * Name()
Definition: subexpr.h:121
Definition: idrec.h:34
void * data
Definition: subexpr.h:89
#define IDTYP(a)
Definition: ipid.h:118
int RingDependend(int t)
Definition: gentable.cc:23
const char * name
Definition: subexpr.h:88
idrec * idhdl
Definition: ring.h:18
idhdl next
Definition: idrec.h:38
#define IDLEV(a)
Definition: ipid.h:120
static BOOLEAN iiInternalExport(leftv v, int toLev)
Definition: ipshell.cc:1397
#define NULL
Definition: omList.c:10
package req_packhdl
Definition: subexpr.h:107
package currPack
Definition: ipid.cc:62
Definition: tok.h:96
static Poly * h
Definition: janet.cc:978
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define Warn
Definition: emacs.cc:80
BOOLEAN iiLibCmd ( char *  newlib,
BOOLEAN  autoexport,
BOOLEAN  tellerror,
BOOLEAN  force 
)

Definition at line 801 of file iplib.cc.

802 {
803  char libnamebuf[128];
804  // procinfov pi;
805  // idhdl h;
806  idhdl pl;
807  // idhdl hl;
808  // long pos = 0L;
809  char *plib = iiConvName(newlib);
810  FILE * fp = feFopen( newlib, "r", libnamebuf, tellerror );
811  // int lines = 1;
812  BOOLEAN LoadResult = TRUE;
813 
814  if (fp==NULL)
815  {
816  return TRUE;
817  }
818  pl = basePack->idroot->get(plib,0);
819  if (pl==NULL)
820  {
821  pl = enterid( plib,0, PACKAGE_CMD,
822  &(basePack->idroot), TRUE );
823  IDPACKAGE(pl)->language = LANG_SINGULAR;
824  IDPACKAGE(pl)->libname=omStrDup(newlib);
825  }
826  else
827  {
828  if(IDTYP(pl)!=PACKAGE_CMD)
829  {
830  WarnS("not of type package.");
831  fclose(fp);
832  return TRUE;
833  }
834  if (!force) return FALSE;
835  }
836  LoadResult = iiLoadLIB(fp, libnamebuf, newlib, pl, autoexport, tellerror);
837  omFree((ADDRESS)newlib);
838 
839  if(!LoadResult) IDPACKAGE(pl)->loaded = TRUE;
840  omFree((ADDRESS)plib);
841 
842  return LoadResult;
843 }
CanonicalForm fp
Definition: cfModGcd.cc:4043
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
#define WarnS
Definition: emacs.cc:81
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:138
#define IDTYP(a)
Definition: ipid.h:118
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:256
#define omFree(addr)
Definition: omAllocDecl.h:261
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
Definition: feFopen.cc:46
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
char libnamebuf[128]
Definition: libparse.cc:1096
BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib, idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror)
Definition: iplib.cc:890
char * iiConvName(const char *libname)
Definition: iplib.cc:1262
int BOOLEAN
Definition: auxiliary.h:131
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN iiLoadLIB ( FILE *  fp,
const char *  libnamebuf,
const char *  newlib,
idhdl  pl,
BOOLEAN  autoexport,
BOOLEAN  tellerror 
)

Definition at line 890 of file iplib.cc.

892 {
893  extern FILE *yylpin;
894  libstackv ls_start = library_stack;
895  lib_style_types lib_style;
896 
897  yylpin = fp;
898  #if YYLPDEBUG > 1
899  print_init();
900  #endif
901  extern int lpverbose;
902  if (BVERBOSE(V_DEBUG_LIB)) lpverbose=1;
903  else lpverbose=0;
904  // yylplex sets also text_buffer
905  if (text_buffer!=NULL) *text_buffer='\0';
906  yylplex(newlib, libnamebuf, &lib_style, pl, autoexport);
907  if(yylp_errno)
908  {
909  Werror("Library %s: ERROR occured: in line %d, %d.", newlib, yylplineno,
910  current_pos(0));
912  {
916  }
917  else
919  Werror("Cannot load library,... aborting.");
920  reinit_yylp();
921  fclose( yylpin );
923  return TRUE;
924  }
925  if (BVERBOSE(V_LOAD_LIB))
926  Print( "// ** loaded %s %s\n", libnamebuf, text_buffer);
927  if( (lib_style == OLD_LIBSTYLE) && (BVERBOSE(V_LOAD_LIB)))
928  {
929  Warn( "library %s has old format. This format is still accepted,", newlib);
930  Warn( "but for functionality you may wish to change to the new");
931  Warn( "format. Please refer to the manual for further information.");
932  }
933  reinit_yylp();
934  fclose( yylpin );
935  fp = NULL;
936  iiRunInit(IDPACKAGE(pl));
937 
938  {
939  libstackv ls;
940  for(ls = library_stack; (ls != NULL) && (ls != ls_start); )
941  {
942  if(ls->to_be_done)
943  {
944  ls->to_be_done=FALSE;
945  iiLibCmd(ls->get(),autoexport,tellerror,FALSE);
946  ls = ls->pop(newlib);
947  }
948  }
949 #if 0
950  PrintS("--------------------\n");
951  for(ls = library_stack; ls != NULL; ls = ls->next)
952  {
953  Print("%s: LIB-stack:(%d), %s %s\n", newlib, ls->cnt, ls->get(),
954  ls->to_be_done ? "not loaded" : "loaded");
955  }
956  PrintS("--------------------\n");
957 #endif
958  }
959 
960  if(fp != NULL) fclose(fp);
961  return FALSE;
962 }
int cnt
Definition: subexpr.h:167
#define Print
Definition: emacs.cc:83
CanonicalForm fp
Definition: cfModGcd.cc:4043
int yylplex(const char *libname, const char *libfile, lib_style_types *lib_style, idhdl pl, BOOLEAN autoexport=FALSE, lp_modes=LOAD_LIB)
libstackv next
Definition: subexpr.h:164
#define FALSE
Definition: auxiliary.h:140
static void iiRunInit(package p)
Definition: iplib.cc:874
#define V_LOAD_LIB
Definition: options.h:45
#define IDROOT
Definition: ipid.h:20
BOOLEAN to_be_done
Definition: subexpr.h:166
#define TRUE
Definition: auxiliary.h:144
void print_init()
Definition: libparse.cc:3483
void * ADDRESS
Definition: auxiliary.h:161
char * get()
Definition: subexpr.h:170
#define V_DEBUG_LIB
Definition: options.h:46
libstackv pop(const char *p)
Definition: iplib.cc:1351
BOOLEAN iiLibCmd(char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force)
Definition: iplib.cc:801
#define IDPACKAGE(a)
Definition: ipid.h:138
#define YYLP_BAD_CHAR
Definition: libparse.h:93
int lpverbose
Definition: libparse.cc:1104
int yylp_errno
Definition: libparse.cc:1128
#define omFree(addr)
Definition: omAllocDecl.h:261
char * yylp_errlist[]
Definition: libparse.cc:1112
void PrintS(const char *s)
Definition: reporter.cc:294
#define BVERBOSE(a)
Definition: options.h:33
#define NULL
Definition: omList.c:10
char * text_buffer
Definition: libparse.cc:1097
int current_pos(int i=0)
Definition: libparse.cc:3347
lib_style_types
Definition: libparse.h:9
char libnamebuf[128]
Definition: libparse.cc:1096
static void iiCleanProcs(idhdl &root)
Definition: iplib.cc:845
void Werror(const char *fmt,...)
Definition: reporter.cc:199
libstackv library_stack
Definition: iplib.cc:74
int yylplineno
Definition: libparse.cc:1102
#define Warn
Definition: emacs.cc:80
void reinit_yylp()
Definition: libparse.cc:3377
BOOLEAN iiLocateLib ( const char *  lib,
char *  where 
)

Definition at line 787 of file iplib.cc.

788 {
789  char *plib = iiConvName(lib);
790  idhdl pl = basePack->idroot->get(plib,0);
791  if( (pl!=NULL) && (IDTYP(pl)==PACKAGE_CMD) &&
792  (IDPACKAGE(pl)->language == LANG_SINGULAR))
793  {
794  strncpy(where,IDPACKAGE(pl)->libname,127);
795  return TRUE;
796  }
797  else
798  return FALSE;;
799 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:138
#define IDTYP(a)
Definition: ipid.h:118
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
char * iiConvName(const char *libname)
Definition: iplib.cc:1262
BOOLEAN iiMake_proc ( idhdl  pn,
package  pack,
sleftv sl 
)

Definition at line 563 of file iplib.cc.

564 {
565  int err;
566  procinfov pi = IDPROC(pn);
567  if(pi->is_static && myynest==0)
568  {
569  Werror("'%s::%s()' is a local procedure and cannot be accessed by an user.",
570  pi->libname, pi->procname);
571  return TRUE;
572  }
573  iiCheckNest();
574 #ifdef USE_IILOCALRING
576  //Print("currRing(%d):%s(%x) in %s\n",myynest,IDID(currRingHdl),currRing,IDID(pn));
577 #endif
578  iiRETURNEXPR.Init();
579  procstack->push(pi->procname);
581  || (pi->trace_flag&TRACE_SHOW_PROC))
582  {
584  Print("entering%-*.*s %s (level %d)\n",myynest*2,myynest*2," ",IDID(pn),myynest);
585  }
586 #ifdef RDEBUG
588 #endif
589  switch (pi->language)
590  {
591  default:
592  case LANG_NONE:
593  WerrorS("undefined proc");
594  err=TRUE;
595  break;
596 
597  case LANG_SINGULAR:
598  if ((pi->pack!=NULL)&&(currPack!=pi->pack))
599  {
600  currPack=pi->pack;
603  //Print("set pack=%s\n",IDID(currPackHdl));
604  }
605  else if ((pack!=NULL)&&(currPack!=pack))
606  {
607  currPack=pack;
610  //Print("set pack=%s\n",IDID(currPackHdl));
611  }
612  err=iiPStart(pn,sl);
613  break;
614  case LANG_C:
616  err = (pi->data.o.function)(res, sl);
617  memcpy(&iiRETURNEXPR,res,sizeof(iiRETURNEXPR));
619  break;
620  }
621  if ((traceit&TRACE_SHOW_PROC)
622  || (pi->trace_flag&TRACE_SHOW_PROC))
623  {
624  if (traceit&TRACE_SHOW_LINENO) PrintLn();
625  Print("leaving %-*.*s %s (level %d)\n",myynest*2,myynest*2," ",IDID(pn),myynest);
626  }
627  //const char *n="NULL";
628  //if (currRingHdl!=NULL) n=IDID(currRingHdl);
629  //Print("currRing(%d):%s(%x) after %s\n",myynest,n,currRing,IDID(pn));
630 #ifdef RDEBUG
631  if (traceit&TRACE_SHOW_RINGS) iiShowLevRings();
632 #endif
633  if (err)
634  {
636  //iiRETURNEXPR.Init(); //done by CleanUp
637  }
638  if (iiCurrArgs!=NULL)
639  {
640  if (!err) Warn("too many arguments for %s",IDID(pn));
641  iiCurrArgs->CleanUp();
644  }
645  procstack->pop();
646  if (err)
647  return TRUE;
648  return FALSE;
649 }
#define TRACE_SHOW_LINENO
Definition: reporter.h:26
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define TRACE_SHOW_RINGS
Definition: reporter.h:28
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
package pack
Definition: subexpr.h:57
idhdl currPackHdl
Definition: ipid.cc:60
#define IDID(a)
Definition: ipid.h:121
#define FALSE
Definition: auxiliary.h:140
sleftv iiRETURNEXPR
Definition: iplib.cc:517
language_defs language
Definition: subexpr.h:58
proclevel * procstack
Definition: ipid.cc:57
static void iiShowLevRings()
Definition: iplib.cc:521
#define TRUE
Definition: auxiliary.h:144
void Init()
Definition: subexpr.h:108
void * ADDRESS
Definition: auxiliary.h:161
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:23
int traceit
Definition: febase.cc:47
static void iiCheckNest()
Definition: iplib.cc:550
char * procname
Definition: subexpr.h:56
poly res
Definition: myNF.cc:322
Definition: subexpr.h:20
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char * libname
Definition: subexpr.h:55
procinfodata data
Definition: subexpr.h:62
omBin sleftv_bin
Definition: subexpr.cc:50
char is_static
Definition: subexpr.h:60
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define IDPROC(a)
Definition: ipid.h:139
#define pi
Definition: libparse.cc:1143
ring * iiLocalRing
Definition: iplib.cc:515
#define NULL
Definition: omList.c:10
BOOLEAN iiPStart(idhdl pn, sleftv *v)
Definition: iplib.cc:372
package currPack
Definition: ipid.cc:62
leftv iiCurrArgs
Definition: ipshell.cc:82
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
#define TRACE_SHOW_PROC
Definition: reporter.h:25
idhdl packFindHdl(package r)
Definition: ipid.cc:729
void iiCheckPack(package &p)
Definition: ipshell.cc:1629
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
void push(char *)
Definition: ipid.cc:699
void pop()
Definition: ipid.cc:711
char trace_flag
Definition: subexpr.h:61
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define Warn
Definition: emacs.cc:80
void iiMakeResolv ( resolvente  r,
int  length,
int  rlen,
char *  name,
int  typ0,
intvec **  weights = NULL 
)

Definition at line 816 of file ipshell.cc.

818 {
819  lists L=liMakeResolv(r,length,rlen,typ0,weights);
820  int i=0;
821  idhdl h;
822  char * s=(char *)omAlloc(strlen(name)+5);
823 
824  while (i<=L->nr)
825  {
826  sprintf(s,"%s(%d)",name,i+1);
827  if (i==0)
828  h=enterid(s,myynest,typ0,&(currRing->idroot), FALSE);
829  else
830  h=enterid(s,myynest,MODUL_CMD,&(currRing->idroot), FALSE);
831  if (h!=NULL)
832  {
833  h->data.uideal=(ideal)L->m[i].data;
834  h->attribute=L->m[i].attribute;
836  Print("//defining: %s as %d-th syzygy module\n",s,i+1);
837  }
838  else
839  {
840  idDelete((ideal *)&(L->m[i].data));
841  Warn("cannot define %s",s);
842  }
843  //L->m[i].data=NULL;
844  //L->m[i].rtyp=0;
845  //L->m[i].attribute=NULL;
846  i++;
847  }
848  omFreeSize((ADDRESS)L->m,(L->nr+1)*sizeof(sleftv));
850  omFreeSize((ADDRESS)s,strlen(name)+5);
851 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define Print
Definition: emacs.cc:83
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
#define V_DEF_RES
Definition: options.h:48
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
void * ADDRESS
Definition: auxiliary.h:161
#define omAlloc(size)
Definition: omAllocDecl.h:210
int int kStrategy strat if(h==NULL) return NULL
Definition: idrec.h:34
void * data
Definition: subexpr.h:89
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:256
const ring r
Definition: syzextra.cc:208
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
int i
Definition: cfEzgcd.cc:123
#define BVERBOSE(a)
Definition: options.h:33
int nr
Definition: lists.h:43
char name(const Variable &v)
Definition: variable.h:95
#define NULL
Definition: omList.c:10
attr attribute
Definition: idrec.h:41
lists liMakeResolv(resolvente r, int length, int reallen, int typ0, intvec **weights, int add_row_shift)
Definition: lists.cc:216
attr attribute
Definition: subexpr.h:90
omBin slists_bin
Definition: lists.cc:23
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
static Poly * h
Definition: janet.cc:978
utypes data
Definition: idrec.h:40
#define Warn
Definition: emacs.cc:80
leftv iiMap ( map  theMap,
const char *  what 
)

Definition at line 670 of file ipshell.cc.

671 {
672  idhdl w,r;
673  leftv v;
674  int i;
675  nMapFunc nMap;
676 
677  r=IDROOT->get(theMap->preimage,myynest);
678  if ((currPack!=basePack)
679  &&((r==NULL) || ((r->typ != RING_CMD) && (r->typ != QRING_CMD))))
680  r=basePack->idroot->get(theMap->preimage,myynest);
681  if ((r==NULL) && (currRingHdl!=NULL)
682  && (strcmp(theMap->preimage,IDID(currRingHdl))==0))
683  {
684  r=currRingHdl;
685  }
686  if ((r!=NULL) && ((r->typ == RING_CMD) || (r->typ== QRING_CMD)))
687  {
688  ring src_ring=IDRING(r);
689  if ((nMap=n_SetMap(src_ring->cf, currRing->cf))==NULL)
690  {
691  Werror("can not map from ground field of %s to current ground field",
692  theMap->preimage);
693  return NULL;
694  }
695  if (IDELEMS(theMap)<src_ring->N)
696  {
697  theMap->m=(polyset)omReallocSize((ADDRESS)theMap->m,
698  IDELEMS(theMap)*sizeof(poly),
699  (src_ring->N)*sizeof(poly));
700  for(i=IDELEMS(theMap);i<src_ring->N;i++)
701  theMap->m[i]=NULL;
702  IDELEMS(theMap)=src_ring->N;
703  }
704  if (what==NULL)
705  {
706  WerrorS("argument of a map must have a name");
707  }
708  else if ((w=src_ring->idroot->get(what,myynest))!=NULL)
709  {
710  char *save_r=NULL;
712  sleftv tmpW;
713  memset(&tmpW,0,sizeof(sleftv));
714  tmpW.rtyp=IDTYP(w);
715  if (tmpW.rtyp==MAP_CMD)
716  {
717  tmpW.rtyp=IDEAL_CMD;
718  save_r=IDMAP(w)->preimage;
719  IDMAP(w)->preimage=0;
720  }
721  tmpW.data=IDDATA(w);
722  // check overflow
723  BOOLEAN overflow=FALSE;
724  if ((tmpW.rtyp==IDEAL_CMD)
725  || (tmpW.rtyp==MODUL_CMD)
726  || (tmpW.rtyp==MAP_CMD))
727  {
728  ideal id=(ideal)tmpW.data;
729  for(int j=IDELEMS(theMap)-1;j>=0 && !overflow;j--)
730  {
731  if (theMap->m[j]!=NULL)
732  {
733  long deg_monexp=pTotaldegree(theMap->m[j]);
734  for(int i=IDELEMS(id)-1;i>=0;i--)
735  {
736  poly p=id->m[i];
737  if ((p!=NULL) && (p_Totaldegree(p,src_ring)!=0) &&
738  ((unsigned long)deg_monexp > (currRing->bitmask / (unsigned long)p_Totaldegree(p,src_ring)/2)))
739  {
740  overflow=TRUE;
741  break;
742  }
743  }
744  }
745  }
746  }
747  else if (tmpW.rtyp==POLY_CMD)
748  {
749  for(int j=IDELEMS(theMap)-1;j>=0 && !overflow;j--)
750  {
751  if (theMap->m[j]!=NULL)
752  {
753  long deg_monexp=pTotaldegree(theMap->m[j]);
754  poly p=(poly)tmpW.data;
755  if ((p!=NULL) && (p_Totaldegree(p,src_ring)!=0) &&
756  ((unsigned long)deg_monexp > (currRing->bitmask / (unsigned long)p_Totaldegree(p,src_ring)/2)))
757  {
758  overflow=TRUE;
759  break;
760  }
761  }
762  }
763  }
764  if (overflow)
765  Warn("possible OVERFLOW in map, max exponent is %ld",currRing->bitmask/2);
766 #if 0
767  if (((tmpW.rtyp==IDEAL_CMD)||(tmpW.rtyp==MODUL_CMD)) && idIs0(IDIDEAL(w)))
768  {
769  v->rtyp=tmpW.rtyp;
770  v->data=idInit(IDELEMS(IDIDEAL(w)),IDIDEAL(w)->rank);
771  }
772  else
773 #endif
774  {
775 #ifdef FAST_MAP
776  if ((tmpW.rtyp==IDEAL_CMD) && (nMap == ndCopyMap)
777 #ifdef HAVE_PLURAL
778  && (!rIsPluralRing(currRing))
779 #endif
780  )
781  {
782  v->rtyp=IDEAL_CMD;
783  v->data=fast_map(IDIDEAL(w), src_ring, (ideal)theMap, currRing);
784  }
785  else
786 #endif
787  if (maApplyFetch(MAP_CMD,theMap,v,&tmpW,src_ring,NULL,NULL,0,nMap))
788  {
789  Werror("cannot map %s(%d)",Tok2Cmdname(w->typ),w->typ);
791  if (save_r!=NULL) IDMAP(w)->preimage=save_r;
792  return NULL;
793  }
794  }
795  if (save_r!=NULL)
796  {
797  IDMAP(w)->preimage=save_r;
798  IDMAP((idhdl)v)->preimage=omStrDup(save_r);
799  v->rtyp=MAP_CMD;
800  }
801  return v;
802  }
803  else
804  {
805  Werror("%s undefined in %s",what,theMap->preimage);
806  }
807  }
808  else
809  {
810  Werror("cannot find preimage %s",theMap->preimage);
811  }
812  return NULL;
813 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define IDID(a)
Definition: ipid.h:121
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
number ndCopyMap(number a, const coeffs aRing, const coeffs r)
Definition: numbers.cc:228
const ideal
Definition: gb_hack.h:42
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:144
BOOLEAN maApplyFetch(int what, map theMap, leftv res, leftv w, ring preimage_r, int *perm, int *par_perm, int P, nMapFunc nMap)
Definition: maps_ip.cc:55
#define IDIDEAL(a)
Definition: ipid.h:132
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1435
void * ADDRESS
Definition: auxiliary.h:161
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:23
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
int int kStrategy strat if(h==NULL) return NULL
Definition: idrec.h:34
idhdl get(const char *s, int lev)
Definition: ipid.cc:90
void * data
Definition: subexpr.h:89
int myynest
Definition: febase.cc:46
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define IDTYP(a)
Definition: ipid.h:118
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
static long pTotaldegree(poly p)
Definition: polys.h:253
polyrec * poly
Definition: hilb.h:10
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:71
idhdl currRingHdl
Definition: ipid.cc:64
omBin sleftv_bin
Definition: subexpr.cc:50
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:19
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:718
#define IDMAP(a)
Definition: ipid.h:134
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
poly * polyset
Definition: hutil.h:17
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
package basePack
Definition: ipid.cc:63
#define IDRING(a)
Definition: ipid.h:126
const CanonicalForm & w
Definition: facAbsFact.cc:55
package currPack
Definition: ipid.cc:62
int rtyp
Definition: subexpr.h:92
ideal fast_map(ideal map_id, ring map_r, ideal image_id, ring image_r)
Definition: fast_maps.cc:354
int typ
Definition: idrec.h:43
Definition: tok.h:126
#define IDDATA(a)
Definition: ipid.h:125
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN idIs0(ideal h)
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263
int iiOpsTwoChar ( const char *  s)

Definition at line 123 of file ipshell.cc.

124 {
125 /* not handling: &&, ||, ** */
126  if (s[1]=='\0') return s[0];
127  else if (s[2]!='\0') return 0;
128  switch(s[0])
129  {
130  case '.': if (s[1]=='.') return DOTDOT;
131  else return 0;
132  case ':': if (s[1]==':') return COLONCOLON;
133  else return 0;
134  case '-': if (s[1]=='-') return COLONCOLON;
135  else return 0;
136  case '+': if (s[1]=='+') return PLUSPLUS;
137  else return 0;
138  case '=': if (s[1]=='=') return EQUAL_EQUAL;
139  else return 0;
140  case '<': if (s[1]=='=') return LE;
141  else if (s[1]=='>') return NOTEQUAL;
142  else return 0;
143  case '>': if (s[1]=='=') return GE;
144  else return 0;
145  case '!': if (s[1]=='=') return NOTEQUAL;
146  else return 0;
147  }
148  return 0;
149 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
Definition: grammar.cc:271
Definition: grammar.cc:270
BOOLEAN iiParameter ( leftv  p)

Definition at line 1285 of file ipshell.cc.

1286 {
1287  if (iiCurrArgs==NULL)
1288  {
1289  if (strcmp(p->name,"#")==0)
1290  return iiDefaultParameter(p);
1291  Werror("not enough arguments for proc %s",VoiceName());
1292  p->CleanUp();
1293  return TRUE;
1294  }
1295  leftv h=iiCurrArgs;
1296  leftv rest=h->next; /*iiCurrArgs is not NULL here*/
1297  BOOLEAN is_default_list=FALSE;
1298  if (strcmp(p->name,"#")==0)
1299  {
1300  is_default_list=TRUE;
1301  rest=NULL;
1302  }
1303  else
1304  {
1305  h->next=NULL;
1306  }
1307  BOOLEAN res=iiAssign(p,h);
1308  if (is_default_list)
1309  {
1310  iiCurrArgs=NULL;
1311  }
1312  else
1313  {
1314  iiCurrArgs=rest;
1315  }
1316  h->CleanUp();
1318  return res;
1319 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
poly res
Definition: myNF.cc:322
const char * name
Definition: subexpr.h:88
omBin sleftv_bin
Definition: subexpr.cc:50
const char * VoiceName()
Definition: fevoices.cc:64
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
BOOLEAN iiDefaultParameter(leftv p)
Definition: ipshell.cc:1202
leftv iiCurrArgs
Definition: ipshell.cc:82
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void Werror(const char *fmt,...)
Definition: reporter.cc:199
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1659
char* iiProcArgs ( char *  e,
BOOLEAN  withParenth 
)

Definition at line 127 of file iplib.cc.

128 {
129  while ((*e==' ') || (*e=='\t') || (*e=='(')) e++;
130  if (*e<' ')
131  {
132  if (withParenth)
133  {
134  // no argument list, allow list #
135  return omStrDup("parameter list #;");
136  }
137  else
138  {
139  // empty list
140  return omStrDup("");
141  }
142  }
143  BOOLEAN in_args;
144  BOOLEAN args_found;
145  char *s;
146  char *argstr=(char *)omAlloc(127); // see ../omalloc/omTables.inc
147  int argstrlen=127;
148  *argstr='\0';
149  int par=0;
150  do
151  {
152  args_found=FALSE;
153  s=e; // set s to the starting point of the arg
154  // and search for the end
155  while(*s==' ') s++; e=s; // skip leading paces
156  while ((*e!=',')
157  &&((par!=0) || (*e!=')'))
158  &&(*e!='\0'))
159  {
160  if (*e=='(') par++;
161  else if (*e==')') par--;
162  args_found=args_found || (*e>' ');
163  e++;
164  }
165  in_args=(*e==',');
166  if (args_found)
167  {
168  *e='\0';
169  // check for space:
170  if ((int)strlen(argstr)+12 /* parameter + ;*/ +(int)strlen(s)>= argstrlen)
171  {
172  argstrlen*=2;
173  char *a=(char *)omAlloc( argstrlen);
174  strcpy(a,argstr);
175  omFree((ADDRESS)argstr);
176  argstr=a;
177  }
178  // copy the result to argstr
179  if(strncmp(s,"alias ",6)!=0)
180  {
181  strcat(argstr,"parameter ");
182  }
183  strcat(argstr,s);
184  strcat(argstr,"; ");
185  e++; // e was pointing to ','
186  }
187  } while (in_args);
188  return argstr;
189 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
const CanonicalForm int s
Definition: facAbsFact.cc:55
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:140
void * ADDRESS
Definition: auxiliary.h:161
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define omFree(addr)
Definition: omAllocDecl.h:261
int BOOLEAN
Definition: auxiliary.h:131
#define omStrDup(s)
Definition: omAllocDecl.h:263
char* iiProcName ( char *  buf,
char &  ct,
char *&  e 
)

Definition at line 113 of file iplib.cc.

114 {
115  char *s=buf+5;
116  while (*s==' ') s++;
117  e=s+1;
118  while ((*e>' ') && (*e!='(')) e++;
119  ct=*e;
120  *e='\0';
121  return s;
122 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
int status int void * buf
Definition: si_signals.h:58
BOOLEAN iiPStart ( idhdl  pn,
sleftv sl 
)

Definition at line 372 of file iplib.cc.

373 {
374  procinfov pi=NULL;
375  int old_echo=si_echo;
376  BOOLEAN err=FALSE;
377  char save_flags=0;
378 
379  /* init febase ======================================== */
380  /* we do not enter this case if filename != NULL !! */
381  if (pn!=NULL)
382  {
383  pi = IDPROC(pn);
384  if(pi!=NULL)
385  {
386  save_flags=pi->trace_flag;
387  if( pi->data.s.body==NULL )
388  {
389  iiGetLibProcBuffer(pi);
390  if (pi->data.s.body==NULL) return TRUE;
391  }
392 // omUpdateInfo();
393 // int m=om_Info.UsedBytes;
394 // Print("proc %s, mem=%d\n",IDID(pn),m);
395  }
396  }
397  else return TRUE;
398  /* generate argument list ======================================*/
399  if (v!=NULL)
400  {
402  memcpy(iiCurrArgs,v,sizeof(sleftv));
403  memset(v,0,sizeof(sleftv));
404  }
405  else
406  {
408  }
409  iiCurrProc=pn;
410  /* start interpreter ======================================*/
411  myynest++;
412  if (myynest > SI_MAX_NEST)
413  {
414  WerrorS("nesting too deep");
415  err=TRUE;
416  }
417  else
418  {
419  err=iiAllStart(pi,pi->data.s.body,BT_proc,pi->data.s.body_lineno-(v!=NULL));
420 
421 #ifdef USE_IILOCALRING
422 #if 0
423  if(procstack->cRing != iiLocalRing[myynest]) Print("iiMake_proc: 1 ring not saved procs:%x, iiLocal:%x\n",procstack->cRing, iiLocalRing[myynest]);
424 #endif
425  if (iiLocalRing[myynest-1] != currRing)
426  {
428  {
429  //idhdl hn;
430  const char *n;
431  const char *o;
432  idhdl nh=NULL, oh=NULL;
433  if (iiLocalRing[myynest-1]!=NULL)
434  oh=rFindHdl(iiLocalRing[myynest-1],NULL);
435  if (oh!=NULL) o=oh->id;
436  else o="none";
437  if (currRing!=NULL)
438  nh=rFindHdl(currRing,NULL);
439  if (nh!=NULL) n=nh->id;
440  else n="none";
441  Werror("ring change during procedure call: %s -> %s (level %d)",o,n,myynest);
443  err=TRUE;
444  }
445  currRing=iiLocalRing[myynest-1];
446  }
447  if ((currRing==NULL)
448  && (currRingHdl!=NULL))
450  else
451  if ((currRing!=NULL) &&
453  ||(IDLEV(currRingHdl)>=myynest-1)))
454  {
456  iiLocalRing[myynest-1]=NULL;
457  }
458 #else /* USE_IILOCALRING */
459  if (procstack->cRing != currRing)
460  {
461  //if (procstack->cRingHdl!=NULL)
462  //Print("procstack:%s,",IDID(procstack->cRingHdl));
463  //if (currRingHdl!=NULL)
464  //Print(" curr:%s\n",IDID(currRingHdl));
465  //Print("pr:%x, curr: %x\n",procstack->cRing,currRing);
467  {
468  //idhdl hn;
469  const char *n;
470  const char *o;
471  if (procstack->cRing!=NULL)
472  {
473  //PrintS("reset ring\n");
475  o=IDID(procstack->cRingHdl);
478  }
479  else o="none";
480  if (currRing!=NULL) n=IDID(currRingHdl);
481  else n="none";
482  if (currRing==NULL)
483  {
484  Werror("ring change during procedure call: %s -> %s (level %d)",o,n,myynest);
486  err=TRUE;
487  }
488  }
489  if (procstack->cRingHdl!=NULL)
490  {
492  }
493  else
495  }
496 #endif /* USE_IILOCALRING */
497  //Print("kill locals for %s (level %d)\n",IDID(pn),myynest);
498  killlocals(myynest);
499 #ifndef SING_NDEBUG
500  checkall();
501 #endif
502  //Print("end kill locals for %s (%d)\n",IDID(pn),myynest);
503  }
504  myynest--;
505  si_echo=old_echo;
506  if (pi!=NULL)
507  pi->trace_flag=save_flags;
508 // omUpdateInfo();
509 // int m=om_Info.UsedBytes;
510 // Print("exit %s, mem=%d\n",IDID(pn),m);
511  return err;
512 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define Print
Definition: emacs.cc:83
#define IDID(a)
Definition: ipid.h:121
#define FALSE
Definition: auxiliary.h:140
sleftv iiRETURNEXPR
Definition: iplib.cc:517
proclevel * procstack
Definition: ipid.cc:57
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define TRUE
Definition: auxiliary.h:144
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:23
idhdl cRingHdl
Definition: ipid.h:60
Definition: idrec.h:34
idhdl iiCurrProc
Definition: ipshell.cc:83
#define SI_MAX_NEST
Definition: iplib.cc:32
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN RingDependend()
Definition: subexpr.cc:369
void checkall()
Definition: misc_ip.cc:1016
void killlocals(int v)
Definition: ipshell.cc:382
procinfodata data
Definition: subexpr.h:62
idhdl currRingHdl
Definition: ipid.cc:64
omBin sleftv_bin
Definition: subexpr.cc:50
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1690
#define IDLEV(a)
Definition: ipid.h:120
BOOLEAN iiAllStart(procinfov pi, char *p, feBufferTypes t, int l)
Definition: iplib.cc:312
#define IDPROC(a)
Definition: ipid.h:139
#define pi
Definition: libparse.cc:1143
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
ring * iiLocalRing
Definition: iplib.cc:515
#define NULL
Definition: omList.c:10
#define IDRING(a)
Definition: ipid.h:126
ring cRing
Definition: ipid.h:61
leftv iiCurrArgs
Definition: ipshell.cc:82
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
const char * id
Definition: idrec.h:39
void rSetHdl(idhdl h)
Definition: ipshell.cc:4821
char * iiGetLibProcBuffer(procinfo *pi, int part)
Definition: iplib.cc:200
int BOOLEAN
Definition: auxiliary.h:131
char trace_flag
Definition: subexpr.h:61
void Werror(const char *fmt,...)
Definition: reporter.cc:199
int si_echo
Definition: febase.cc:41
int iiRegularity ( lists  L)

Definition at line 997 of file ipshell.cc.

998 {
999  int len,reg,typ0;
1000 
1001  resolvente r=liFindRes(L,&len,&typ0);
1002 
1003  if (r==NULL)
1004  return -2;
1005  intvec *weights=NULL;
1006  int add_row_shift=0;
1007  intvec *ww=(intvec *)atGet(&(L->m[0]),"isHomog",INTVEC_CMD);
1008  if (ww!=NULL)
1009  {
1010  weights=ivCopy(ww);
1011  add_row_shift = ww->min_in();
1012  (*weights) -= add_row_shift;
1013  }
1014  //Print("attr:%x\n",weights);
1015 
1016  intvec *dummy=syBetti(r,len,&reg,weights);
1017  if (weights!=NULL) delete weights;
1018  delete dummy;
1019  omFreeSize((ADDRESS)r,len*sizeof(ideal));
1020  return reg+1+add_row_shift;
1021 }
sleftv * m
Definition: lists.h:45
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
Definition: lists.cc:313
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
intvec * ivCopy(const intvec *o)
Definition: intvec.h:132
void * ADDRESS
Definition: auxiliary.h:161
int min_in()
Definition: intvec.h:109
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
Definition: tok.h:88
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:135
#define NULL
Definition: omList.c:10
ideal * resolvente
Definition: ideals.h:20
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
Definition: syz.cc:793
BOOLEAN iiTestAssume ( leftv  a,
leftv  b 
)

Definition at line 6131 of file ipshell.cc.

6132 {
6133  // assume a: level
6134  if ((a->Typ()==INT_CMD)&&((long)a->Data()>=0))
6135  {
6136  if ((TEST_V_ALLWARN) && (myynest==0)) WarnS("ASSUME at top level is of no use: see documentation");
6137  char assume_yylinebuf[80];
6138  strncpy(assume_yylinebuf,my_yylinebuf,79);
6139  int lev=(long)a->Data();
6140  int startlev=0;
6141  idhdl h=ggetid("assumeLevel");
6142  if ((h!=NULL)&&(IDTYP(h)==INT_CMD)) startlev=(long)IDINT(h);
6143  if(lev <=startlev)
6144  {
6145  BOOLEAN bo=b->Eval();
6146  if (bo) { WerrorS("syntax error in ASSUME");return TRUE;}
6147  if (b->Typ()!=INT_CMD) { WerrorS("ASUMME(<level>,<int expr>)");return TRUE; }
6148  if (b->Data()==NULL) { Werror("ASSUME failed:%s",assume_yylinebuf);return TRUE;}
6149  }
6150  }
6151  b->CleanUp();
6152  a->CleanUp();
6153  return FALSE;
6154 }
int Eval()
Definition: subexpr.cc:1715
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
#define WarnS
Definition: emacs.cc:81
int Typ()
Definition: subexpr.cc:949
Definition: idrec.h:34
int myynest
Definition: febase.cc:46
#define IDTYP(a)
Definition: ipid.h:118
char my_yylinebuf[80]
Definition: febase.cc:48
#define NULL
Definition: omList.c:10
#define IDINT(a)
Definition: ipid.h:124
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
void * Data()
Definition: subexpr.cc:1091
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define TEST_V_ALLWARN
Definition: options.h:135
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)
Definition: ipid.cc:487
int iiTokType ( int  op)

Definition at line 253 of file iparith.cc.

254 {
255  for (int i=0;i<sArithBase.nCmdUsed;i++)
256  {
257  if (sArithBase.sCmds[i].tokval==op)
258  return sArithBase.sCmds[i].toktype;
259  }
260  return 0;
261 }
int nCmdUsed
number of commands used
Definition: iparith.cc:207
int i
Definition: cfEzgcd.cc:123
static SArithBase sArithBase
Base entry for arithmetic.
Definition: iparith.cc:217
cmdnames * sCmds
array of existing commands
Definition: iparith.cc:202
BOOLEAN iiTryLoadLib ( leftv  v,
const char *  id 
)

Definition at line 741 of file iplib.cc.

742 {
743  BOOLEAN LoadResult = TRUE;
744  char libnamebuf[128];
745  char *libname = (char *)omAlloc(strlen(id)+5);
746  const char *suffix[] = { "", ".lib", ".so", ".sl", NULL };
747  int i = 0;
748  // FILE *fp;
749  // package pack;
750  // idhdl packhdl;
751  lib_types LT;
752  for(i=0; suffix[i] != NULL; i++)
753  {
754  sprintf(libname, "%s%s", id, suffix[i]);
755  *libname = mytolower(*libname);
756  if((LT = type_of_LIB(libname, libnamebuf)) > LT_NOTFOUND)
757  {
758  char *s=omStrDup(libname);
759  char libnamebuf[256];
760 
761  if (LT==LT_SINGULAR)
762  LoadResult = iiLibCmd(s, FALSE, FALSE,TRUE);
763  #ifdef HAVE_DYNAMIC_LOADING
764  else if ((LT==LT_ELF) || (LT==LT_HPUX))
765  LoadResult = load_modules(s,libnamebuf,FALSE);
766  #endif
767  else if (LT==LT_BUILTIN)
768  {
769  LoadResult=load_builtin(s,FALSE, iiGetBuiltinModInit(s));
770  }
771  if(!LoadResult )
772  {
773  v->name = iiConvName(libname);
774  break;
775  }
776  }
777  }
778  omFree(libname);
779  return LoadResult;
780 }
BOOLEAN load_builtin(const char *newlib, BOOLEAN autoexport, SModulFunc_t init)
Definition: iplib.cc:1130
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:140
Definition: mod_raw.h:16
#define TRUE
Definition: auxiliary.h:144
lib_types type_of_LIB(const char *newlib, char *libnamebuf)
Definition: mod_lib.cc:23
#define omAlloc(size)
Definition: omAllocDecl.h:210
BOOLEAN iiLibCmd(char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force)
Definition: iplib.cc:801
const char * name
Definition: subexpr.h:88
#define omFree(addr)
Definition: omAllocDecl.h:261
int i
Definition: cfEzgcd.cc:123
lib_types
Definition: mod_raw.h:16
char mytolower(char c)
Definition: iplib.cc:1249
#define NULL
Definition: omList.c:10
SModulFunc_t iiGetBuiltinModInit(const char *libname)
Definition: iplib.cc:728
char libnamebuf[128]
Definition: libparse.cc:1096
char * iiConvName(const char *libname)
Definition: iplib.cc:1262
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition: iplib.cc:1038
#define omStrDup(s)
Definition: omAllocDecl.h:263
const char* iiTwoOps ( int  t)

Definition at line 250 of file gentable.cc.

251 {
252  if (t<127)
253  {
254  static char ch[2];
255  switch (t)
256  {
257  case '&':
258  return "and";
259  case '|':
260  return "or";
261  default:
262  ch[0]=t;
263  ch[1]='\0';
264  return ch;
265  }
266  }
267  switch (t)
268  {
269  case COLONCOLON: return "::";
270  case DOTDOT: return "..";
271  //case PLUSEQUAL: return "+=";
272  //case MINUSEQUAL: return "-=";
273  case MINUSMINUS: return "--";
274  case PLUSPLUS: return "++";
275  case EQUAL_EQUAL: return "==";
276  case LE: return "<=";
277  case GE: return ">=";
278  case NOTEQUAL: return "<>";
279  default: return Tok2Cmdname(t);
280  }
281 }
Definition: grammar.cc:271
Definition: grammar.cc:270
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
BOOLEAN iiWRITE ( leftv  res,
leftv  exprlist 
)

Definition at line 643 of file ipshell.cc.

644 {
645  sleftv vf;
646  if (iiConvert(v->Typ(),LINK_CMD,iiTestConvert(v->Typ(),LINK_CMD),v,&vf))
647  {
648  WerrorS("link expected");
649  return TRUE;
650  }
651  si_link l=(si_link)vf.Data();
652  if (vf.next == NULL)
653  {
654  WerrorS("write: need at least two arguments");
655  return TRUE;
656  }
657 
658  BOOLEAN b=slWrite(l,vf.next); /* iiConvert preserves next */
659  if (b)
660  {
661  const char *s;
662  if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
663  else s=sNoName;
664  Werror("cannot write to %s",s);
665  }
666  vf.CleanUp();
667  return b;
668 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:290
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
const char sNoName[]
Definition: subexpr.cc:56
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
leftv next
Definition: subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
Definition: tok.h:95
#define NULL
Definition: omList.c:10
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:295
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
void * Data()
Definition: subexpr.cc:1091
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
void Werror(const char *fmt,...)
Definition: reporter.cc:199
int l
Definition: cfEzgcd.cc:94
int IsCmd ( const char *  n,
int tok 
)

Definition at line 8688 of file iparith.cc.

8689 {
8690  int i;
8691  int an=1;
8692  int en=sArithBase.nLastIdentifier;
8693 
8694  loop
8695  //for(an=0; an<sArithBase.nCmdUsed; )
8696  {
8697  if(an>=en-1)
8698  {
8699  if (strcmp(n, sArithBase.sCmds[an].name) == 0)
8700  {
8701  i=an;
8702  break;
8703  }
8704  else if ((an!=en) && (strcmp(n, sArithBase.sCmds[en].name) == 0))
8705  {
8706  i=en;
8707  break;
8708  }
8709  else
8710  {
8711  // -- blackbox extensions:
8712  // return 0;
8713  return blackboxIsCmd(n,tok);
8714  }
8715  }
8716  i=(an+en)/2;
8717  if (*n < *(sArithBase.sCmds[i].name))
8718  {
8719  en=i-1;
8720  }
8721  else if (*n > *(sArithBase.sCmds[i].name))
8722  {
8723  an=i+1;
8724  }
8725  else
8726  {
8727  int v=strcmp(n,sArithBase.sCmds[i].name);
8728  if(v<0)
8729  {
8730  en=i-1;
8731  }
8732  else if(v>0)
8733  {
8734  an=i+1;
8735  }
8736  else /*v==0*/
8737  {
8738  break;
8739  }
8740  }
8741  }
8743  tok=sArithBase.sCmds[i].tokval;
8744  if(sArithBase.sCmds[i].alias==2)
8745  {
8746  Warn("outdated identifier `%s` used - please change your code",
8747  sArithBase.sCmds[i].name);
8748  sArithBase.sCmds[i].alias=1;
8749  }
8750  #if 0
8751  if (currRingHdl==NULL)
8752  {
8753  #ifdef SIQ
8754  if (siq<=0)
8755  {
8756  #endif
8757  if ((tok>=BEGIN_RING) && (tok<=END_RING))
8758  {
8759  WerrorS("no ring active");
8760  return 0;
8761  }
8762  #ifdef SIQ
8763  }
8764  #endif
8765  }
8766  #endif
8767  if (!expected_parms)
8768  {
8769  switch (tok)
8770  {
8771  case IDEAL_CMD:
8772  case INT_CMD:
8773  case INTVEC_CMD:
8774  case MAP_CMD:
8775  case MATRIX_CMD:
8776  case MODUL_CMD:
8777  case POLY_CMD:
8778  case PROC_CMD:
8779  case RING_CMD:
8780  case STRING_CMD:
8781  cmdtok = tok;
8782  break;
8783  }
8784  }
8785  return sArithBase.sCmds[i].toktype;
8786 }
Definition: tok.h:85
loop
Definition: myNF.cc:98
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
BOOLEAN siq
Definition: subexpr.cc:58
int cmdtok
Definition: grammar.cc:175
void WerrorS(const char *s)
Definition: feFopen.cc:23
BOOLEAN expected_parms
Definition: grammar.cc:174
int nLastIdentifier
valid indentifieres are slot 1..nLastIdentifier
Definition: iparith.cc:209
idhdl currRingHdl
Definition: ipid.cc:64
int i
Definition: cfEzgcd.cc:123
Definition: tok.h:88
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int blackboxIsCmd(const char *n, int &tok)
used by scanner: returns ROOT_DECL for known types (and the type number in tok)
Definition: blackbox.cc:191
static SArithBase sArithBase
Base entry for arithmetic.
Definition: iparith.cc:217
cmdnames * sCmds
array of existing commands
Definition: iparith.cc:202
const char * lastreserved
Definition: ipshell.cc:84
#define Warn
Definition: emacs.cc:80
int IsPrime ( int  i)

Definition at line 633 of file ipshell.cc.

634 {
635  if (p == 0) return 0;
636  else if (p == 1) return 1/*1*/;
637  else if ((p == 2)||(p==3)) return p;
638  else if (p < 0) return 2; //(iiIsPrime0((unsigned)(-p)));
639  else if ((p & 1)==0) return iiIsPrime0((unsigned)(p-1));
640  return iiIsPrime0((unsigned)(p));
641 }
return P p
Definition: myNF.cc:203
int iiIsPrime0(unsigned p)
Definition: ipshell.cc:585
BOOLEAN jjBETTI ( leftv  res,
leftv  v 
)

Definition at line 936 of file ipshell.cc.

937 {
938  sleftv tmp;
939  memset(&tmp,0,sizeof(tmp));
940  tmp.rtyp=INT_CMD;
941  tmp.data=(void *)1;
942  if ((u->Typ()==IDEAL_CMD)
943  || (u->Typ()==MODUL_CMD))
944  return jjBETTI2_ID(res,u,&tmp);
945  else
946  return jjBETTI2(res,u,&tmp);
947 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
BOOLEAN jjBETTI2(leftv res, leftv u, leftv v)
Definition: ipshell.cc:970
void * data
Definition: subexpr.h:89
int rtyp
Definition: subexpr.h:92
BOOLEAN jjBETTI2_ID(leftv res, leftv u, leftv v)
Definition: ipshell.cc:949
BOOLEAN jjBETTI2 ( leftv  res,
leftv  u,
leftv  v 
)

Definition at line 970 of file ipshell.cc.

971 {
972  resolvente r;
973  int len;
974  int reg,typ0;
975  lists l=(lists)u->Data();
976 
977  intvec *weights=NULL;
978  int add_row_shift=0;
979  intvec *ww=(intvec *)atGet(&(l->m[0]),"isHomog",INTVEC_CMD);
980  if (ww!=NULL)
981  {
982  weights=ivCopy(ww);
983  add_row_shift = ww->min_in();
984  (*weights) -= add_row_shift;
985  }
986  //Print("attr:%x\n",weights);
987 
988  r=liFindRes(l,&len,&typ0);
989  if (r==NULL) return TRUE;
990  res->data=(char *)syBetti(r,len,&reg,weights,(int)(long)v->Data());
991  omFreeSize((ADDRESS)r,(len)*sizeof(ideal));
992  atSet(res,omStrDup("rowShift"),(void*)(long)add_row_shift,INT_CMD);
993  if (weights!=NULL) delete weights;
994  return FALSE;
995 }
sleftv * m
Definition: lists.h:45
void atSet(idhdl root, const char *name, void *data, int typ)
Definition: attrib.cc:156
Definition: tok.h:85
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
Definition: lists.cc:313
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
intvec * ivCopy(const intvec *o)
Definition: intvec.h:132
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
int min_in()
Definition: intvec.h:109
void * data
Definition: subexpr.h:89
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
Definition: tok.h:88
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:135
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
void * Data()
Definition: subexpr.cc:1091
ideal * resolvente
Definition: ideals.h:20
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
Definition: syz.cc:793
int l
Definition: cfEzgcd.cc:94
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN jjBETTI2_ID ( leftv  res,
leftv  u,
leftv  v 
)

Definition at line 949 of file ipshell.cc.

950 {
952  l->Init(1);
953  l->m[0].rtyp=u->Typ();
954  l->m[0].data=u->Data();
955  attr *a=u->Attribute();
956  if (a!=NULL)
957  l->m[0].attribute=*a;
958  sleftv tmp2;
959  memset(&tmp2,0,sizeof(tmp2));
960  tmp2.rtyp=LIST_CMD;
961  tmp2.data=(void *)l;
962  BOOLEAN r=jjBETTI2(res,&tmp2,v);
963  l->m[0].data=NULL;
964  l->m[0].attribute=NULL;
965  l->m[0].rtyp=DEF_CMD;
966  l->Clean();
967  return r;
968 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
const poly a
Definition: syzextra.cc:212
Definition: attrib.h:14
Definition: lists.h:22
attr * Attribute()
Definition: subexpr.cc:1346
BOOLEAN jjBETTI2(leftv res, leftv u, leftv v)
Definition: ipshell.cc:970
int Typ()
Definition: subexpr.cc:949
void * data
Definition: subexpr.h:89
const ring r
Definition: syzextra.cc:208
Definition: tok.h:58
CFList tmp2
Definition: facFqBivar.cc:70
INLINE_THIS void Init(int l=0)
Definition: lists.h:66
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:92
void Clean(ring r=currRing)
Definition: lists.h:25
void * Data()
Definition: subexpr.cc:1091
Definition: tok.h:96
attr attribute
Definition: subexpr.h:90
omBin slists_bin
Definition: lists.cc:23
int BOOLEAN
Definition: auxiliary.h:131
int l
Definition: cfEzgcd.cc:94
BOOLEAN jjCHARSERIES ( leftv  res,
leftv  u 
)

Definition at line 3053 of file ipshell.cc.

3054 {
3056  return (res->data==NULL);
3057 }
const ideal
Definition: gb_hack.h:42
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
matrix singclap_irrCharSeries(ideal I, const ring r)
Definition: clapsing.cc:1398
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1091
BOOLEAN jjIMPORTFROM ( leftv  res,
leftv  u,
leftv  v 
)

Definition at line 2067 of file ipassign.cc.

2068 {
2069  //Print("importfrom %s::%s ->.\n",v->Name(),u->Name() );
2070  assume(u->Typ()==PACKAGE_CMD);
2071  char *vn=(char *)v->Name();
2072  idhdl h=((package)(u->Data()))->idroot->get(vn /*v->Name()*/, myynest);
2073  if (h!=NULL)
2074  {
2075  //check for existence
2076  if (((package)(u->Data()))==basePack)
2077  {
2078  WarnS("source and destination packages are identical");
2079  return FALSE;
2080  }
2081  idhdl t=basePack->idroot->get(vn /*v->Name()*/, myynest);
2082  if (t!=NULL)
2083  {
2084  Warn("redefining `%s`",vn);
2085  killhdl(t);
2086  }
2087  sleftv tmp_expr;
2088  if (iiDeclCommand(&tmp_expr,v,myynest,DEF_CMD,&IDROOT)) return TRUE;
2089  sleftv h_expr;
2090  memset(&h_expr,0,sizeof(h_expr));
2091  h_expr.rtyp=IDHDL;
2092  h_expr.data=h;
2093  h_expr.name=vn;
2094  return iiAssign(&tmp_expr,&h_expr);
2095  }
2096  else
2097  {
2098  Werror("`%s` not found in `%s`",v->Name(), u->Name());
2099  return TRUE;
2100  }
2101  return FALSE;
2102 }
ip_package * package
Definition: structs.h:46
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:144
#define WarnS
Definition: emacs.cc:81
int Typ()
Definition: subexpr.cc:949
const char * Name()
Definition: subexpr.h:121
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
int myynest
Definition: febase.cc:46
Definition: tok.h:58
const char * name
Definition: subexpr.h:88
#define assume(x)
Definition: mod2.h:405
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition: ipshell.cc:1160
#define NULL
Definition: omList.c:10
void killhdl(idhdl h, package proot)
Definition: ipid.cc:369
package basePack
Definition: ipid.cc:63
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1091
static Poly * h
Definition: janet.cc:978
void Werror(const char *fmt,...)
Definition: reporter.cc:199
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1659
#define Warn
Definition: emacs.cc:80
BOOLEAN jjLIST_PL ( leftv  res,
leftv  v 
)

Definition at line 7369 of file iparith.cc.

7370 {
7371  int sl=0;
7372  if (v!=NULL) sl = v->listLength();
7373  lists L;
7374  if((sl==1)&&(v->Typ()==RESOLUTION_CMD))
7375  {
7376  int add_row_shift = 0;
7377  intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
7378  if (weights!=NULL) add_row_shift=weights->min_in();
7379  L=syConvRes((syStrategy)v->Data(),FALSE,add_row_shift);
7380  }
7381  else
7382  {
7384  leftv h=NULL;
7385  int i;
7386  int rt;
7387 
7388  L->Init(sl);
7389  for (i=0;i<sl;i++)
7390  {
7391  if (h!=NULL)
7392  { /* e.g. not in the first step:
7393  * h is the pointer to the old sleftv,
7394  * v is the pointer to the next sleftv
7395  * (in this moment) */
7396  h->next=v;
7397  }
7398  h=v;
7399  v=v->next;
7400  h->next=NULL;
7401  rt=h->Typ();
7402  if (rt==0)
7403  {
7404  L->Clean();
7405  Werror("`%s` is undefined",h->Fullname());
7406  return TRUE;
7407  }
7408  if ((rt==RING_CMD)||(rt==QRING_CMD))
7409  {
7410  L->m[i].rtyp=rt; L->m[i].data=h->Data();
7411  ((ring)L->m[i].data)->ref++;
7412  }
7413  else
7414  L->m[i].Copy(h);
7415  }
7416  }
7417  res->data=(char *)L;
7418  return FALSE;
7419 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition: ipshell.cc:2885
int listLength()
Definition: subexpr.cc:61
#define TRUE
Definition: auxiliary.h:144
int min_in()
Definition: intvec.h:109
int Typ()
Definition: subexpr.cc:949
const char * Fullname()
Definition: subexpr.h:126
void * data
Definition: subexpr.h:89
Definition: intvec.h:16
void Copy(leftv e)
Definition: subexpr.cc:637
int i
Definition: cfEzgcd.cc:123
Definition: tok.h:88
leftv next
Definition: subexpr.h:87
INLINE_THIS void Init(int l=0)
Definition: lists.h:66
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:135
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:92
void Clean(ring r=currRing)
Definition: lists.h:25
void * Data()
Definition: subexpr.cc:1091
omBin slists_bin
Definition: lists.cc:23
Definition: tok.h:126
static Poly * h
Definition: janet.cc:978
void Werror(const char *fmt,...)
Definition: reporter.cc:199
BOOLEAN jjLOAD ( const char *  s,
BOOLEAN  autoexport = FALSE 
)

load lib/module given in v

Definition at line 5266 of file iparith.cc.

5267 {
5268  char libnamebuf[256];
5269  lib_types LT = type_of_LIB(s, libnamebuf);
5270 
5271 #ifdef HAVE_DYNAMIC_LOADING
5272  extern BOOLEAN load_modules(const char *newlib, char *fullpath, BOOLEAN autoexport);
5273 #endif /* HAVE_DYNAMIC_LOADING */
5274  switch(LT)
5275  {
5276  default:
5277  case LT_NONE:
5278  Werror("%s: unknown type", s);
5279  break;
5280  case LT_NOTFOUND:
5281  Werror("cannot open %s", s);
5282  break;
5283 
5284  case LT_SINGULAR:
5285  {
5286  char *plib = iiConvName(s);
5287  idhdl pl = IDROOT->get(plib,0);
5288  if (pl==NULL)
5289  {
5290  pl = enterid( plib,0, PACKAGE_CMD, &(basePack->idroot), TRUE );
5291  IDPACKAGE(pl)->language = LANG_SINGULAR;
5292  IDPACKAGE(pl)->libname=omStrDup(plib);
5293  }
5294  else if (IDTYP(pl)!=PACKAGE_CMD)
5295  {
5296  Werror("can not create package `%s`",plib);
5297  omFree(plib);
5298  return TRUE;
5299  }
5300  package savepack=currPack;
5301  currPack=IDPACKAGE(pl);
5302  IDPACKAGE(pl)->loaded=TRUE;
5303  char libnamebuf[256];
5304  FILE * fp = feFopen( s, "r", libnamebuf, TRUE );
5305  BOOLEAN bo=iiLoadLIB(fp, libnamebuf, s, pl, autoexport, TRUE);
5306  currPack=savepack;
5307  IDPACKAGE(pl)->loaded=(!bo);
5308  return bo;
5309  }
5310  case LT_BUILTIN:
5311  SModulFunc_t iiGetBuiltinModInit(const char*);
5312  return load_builtin(s,autoexport, iiGetBuiltinModInit(s));
5313  case LT_MACH_O:
5314  case LT_ELF:
5315  case LT_HPUX:
5316 #ifdef HAVE_DYNAMIC_LOADING
5317  return load_modules(s, libnamebuf, autoexport);
5318 #else /* HAVE_DYNAMIC_LOADING */
5319  WerrorS("Dynamic modules are not supported by this version of Singular");
5320  break;
5321 #endif /* HAVE_DYNAMIC_LOADING */
5322  }
5323  return TRUE;
5324 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
CanonicalForm fp
Definition: cfModGcd.cc:4043
Definition: mod_raw.h:16
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:144
lib_types type_of_LIB(const char *newlib, char *libnamebuf)
Definition: mod_lib.cc:23
void WerrorS(const char *s)
Definition: feFopen.cc:23
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:138
#define IDTYP(a)
Definition: ipid.h:118
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:256
#define omFree(addr)
Definition: omAllocDecl.h:261
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
Definition: feFopen.cc:46
lib_types
Definition: mod_raw.h:16
BOOLEAN load_builtin(const char *newlib, BOOLEAN autoexport, SModulFunc_t init)
Definition: iplib.cc:1130
#define NULL
Definition: omList.c:10
SModulFunc_t iiGetBuiltinModInit(const char *libname)
Definition: iplib.cc:728
package basePack
Definition: ipid.cc:63
package currPack
Definition: ipid.cc:62
int(* SModulFunc_t)(SModulFunctions *)
Definition: ipid.h:84
char libnamebuf[128]
Definition: libparse.cc:1096
BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib, idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror)
Definition: iplib.cc:890
char * iiConvName(const char *libname)
Definition: iplib.cc:1262
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition: iplib.cc:1038
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN jjMINRES ( leftv  res,
leftv  v 
)

Definition at line 915 of file ipshell.cc.

916 {
917  int len=0;
918  int typ0;
919  lists L=(lists)v->Data();
920  intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
921  int add_row_shift = 0;
922  if (weights==NULL)
923  weights=(intvec*)atGet(&(L->m[0]),"isHomog",INTVEC_CMD);
924  if (weights!=NULL) add_row_shift=weights->min_in();
925  resolvente rr=liFindRes(L,&len,&typ0);
926  if (rr==NULL) return TRUE;
927  resolvente r=iiCopyRes(rr,len);
928 
929  syMinimizeResolvente(r,len,0);
930  omFreeSize((ADDRESS)rr,len*sizeof(ideal));
931  len++;
932  res->data=(char *)liMakeResolv(r,len,-1,typ0,NULL,add_row_shift);
933  return FALSE;
934 }
sleftv * m
Definition: lists.h:45
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
Definition: lists.cc:313
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
void syMinimizeResolvente(resolvente res, int length, int first)
Definition: syz.cc:360
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
int min_in()
Definition: intvec.h:109
void * data
Definition: subexpr.h:89
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
static resolvente iiCopyRes(resolvente r, int l)
Definition: ipshell.cc:905
Definition: tok.h:88
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:135
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
lists liMakeResolv(resolvente r, int length, int reallen, int typ0, intvec **weights, int add_row_shift)
Definition: lists.cc:216
void * Data()
Definition: subexpr.cc:1091
ideal * resolvente
Definition: ideals.h:20
BOOLEAN jjRESULTANT ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)

Definition at line 3046 of file ipshell.cc.

3047 {
3048  res->data=singclap_resultant((poly)u->CopyD(),(poly)v->CopyD(),
3049  (poly)w->CopyD(), currRing);
3050  return errorreported;
3051 }
poly singclap_resultant(poly f, poly g, poly x, const ring r)
Definition: clapsing.cc:317
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
polyrec * poly
Definition: hilb.h:10
short errorreported
Definition: feFopen.cc:22
void * CopyD(int t)
Definition: subexpr.cc:656
BOOLEAN jjSYSTEM ( leftv  res,
leftv  v 
)

Definition at line 245 of file extra.cc.

246 {
247  if(args->Typ() == STRING_CMD)
248  {
249  const char *sys_cmd=(char *)(args->Data());
250  leftv h=args->next;
251 // ONLY documented system calls go here
252 // Undocumented system calls go down into jjEXTENDED_SYSTEM (#ifdef HAVE_EXTENDED_SYSTEM)
253 /*==================== nblocks ==================================*/
254  if (strcmp(sys_cmd, "nblocks") == 0)
255  {
256  ring r;
257  if (h == NULL)
258  {
259  if (currRingHdl != NULL)
260  {
261  r = IDRING(currRingHdl);
262  }
263  else
264  {
265  WerrorS("no ring active");
266  return TRUE;
267  }
268  }
269  else
270  {
271  if (h->Typ() != RING_CMD)
272  {
273  WerrorS("ring expected");
274  return TRUE;
275  }
276  r = (ring) h->Data();
277  }
278  res->rtyp = INT_CMD;
279  res->data = (void*) (long)(rBlocks(r) - 1);
280  return FALSE;
281  }
282 /*==================== version ==================================*/
283  if(strcmp(sys_cmd,"version")==0)
284  {
285  res->rtyp=INT_CMD;
286  res->data=(void *)SINGULAR_VERSION;
287  return FALSE;
288  }
289  else
290 /*==================== cpu ==================================*/
291  if(strcmp(sys_cmd,"cpu")==0)
292  {
293  long cpu=1; //feOptValue(FE_OPT_CPUS);
294  #ifdef _SC_NPROCESSORS_ONLN
295  cpu=sysconf(_SC_NPROCESSORS_ONLN);
296  #elif defined(_SC_NPROCESSORS_CONF)
297  cpu=sysconf(_SC_NPROCESSORS_CONF);
298  #endif
299  res->data=(void *)cpu;
300  res->rtyp=INT_CMD;
301  return FALSE;
302  }
303  else
304 
305 /*==================== sh ==================================*/
306  if(strcmp(sys_cmd,"sh")==0)
307  {
308  if (feOptValue(FE_OPT_NO_SHELL))
309  {
310  WerrorS("shell execution is disallowed in restricted mode");
311  return TRUE;
312  }
313  res->rtyp=INT_CMD;
314  if (h==NULL) res->data = (void *)(long) system("sh");
315  else if (h->Typ()==STRING_CMD)
316  res->data = (void*)(long) system((char*)(h->Data()));
317  else
318  WerrorS("string expected");
319  return FALSE;
320  }
321  else
322  #if 0
323  if(strcmp(sys_cmd,"power1")==0)
324  {
325  res->rtyp=POLY_CMD;
326  poly f=(poly)h->CopyD();
327  poly g=pPower(f,2000);
328  res->data=(void *)g;
329  return FALSE;
330  }
331  else
332  if(strcmp(sys_cmd,"power2")==0)
333  {
334  res->rtyp=POLY_CMD;
335  poly f=(poly)h->Data();
336  poly g=pOne();
337  for(int i=0;i<2000;i++)
338  g=pMult(g,pCopy(f));
339  res->data=(void *)g;
340  return FALSE;
341  }
342  if(strcmp(sys_cmd,"power3")==0)
343  {
344  res->rtyp=POLY_CMD;
345  poly f=(poly)h->Data();
346  poly p2=pMult(pCopy(f),pCopy(f));
347  poly p4=pMult(pCopy(p2),pCopy(p2));
348  poly p8=pMult(pCopy(p4),pCopy(p4));
349  poly p16=pMult(pCopy(p8),pCopy(p8));
350  poly p32=pMult(pCopy(p16),pCopy(p16));
351  poly p64=pMult(pCopy(p32),pCopy(p32));
352  poly p128=pMult(pCopy(p64),pCopy(p64));
353  poly p256=pMult(pCopy(p128),pCopy(p128));
354  poly p512=pMult(pCopy(p256),pCopy(p256));
355  poly p1024=pMult(pCopy(p512),pCopy(p512));
356  poly p1536=pMult(p1024,p512);
357  poly p1792=pMult(p1536,p256);
358  poly p1920=pMult(p1792,p128);
359  poly p1984=pMult(p1920,p64);
360  poly p2000=pMult(p1984,p16);
361  res->data=(void *)p2000;
362  pDelete(&p2);
363  pDelete(&p4);
364  pDelete(&p8);
365  //pDelete(&p16);
366  pDelete(&p32);
367  //pDelete(&p64);
368  //pDelete(&p128);
369  //pDelete(&p256);
370  //pDelete(&p512);
371  //pDelete(&p1024);
372  //pDelete(&p1536);
373  //pDelete(&p1792);
374  //pDelete(&p1920);
375  //pDelete(&p1984);
376  return FALSE;
377  }
378  else
379  #endif
380 /*==================== uname ==================================*/
381  if(strcmp(sys_cmd,"uname")==0)
382  {
383  res->rtyp=STRING_CMD;
384  res->data = omStrDup(S_UNAME);
385  return FALSE;
386  }
387  else
388 /*==================== with ==================================*/
389  if(strcmp(sys_cmd,"with")==0)
390  {
391  if (h==NULL)
392  {
393  res->rtyp=STRING_CMD;
394  res->data=(void *)versionString();
395  return FALSE;
396  }
397  else if (h->Typ()==STRING_CMD)
398  {
399  #define TEST_FOR(A) if(strcmp(s,A)==0) res->data=(void *)1; else
400  char *s=(char *)h->Data();
401  res->rtyp=INT_CMD;
402  #ifdef HAVE_DBM
403  TEST_FOR("DBM")
404  #endif
405  #ifdef HAVE_DLD
406  TEST_FOR("DLD")
407  #endif
408  //TEST_FOR("factory")
409  //TEST_FOR("libfac")
410  #ifdef HAVE_READLINE
411  TEST_FOR("readline")
412  #endif
413  #ifdef TEST_MAC_ORDER
414  TEST_FOR("MAC_ORDER")
415  #endif
416  // unconditional since 3-1-0-6
417  TEST_FOR("Namespaces")
418  #ifdef HAVE_DYNAMIC_LOADING
419  TEST_FOR("DynamicLoading")
420  #endif
421  #ifdef HAVE_EIGENVAL
422  TEST_FOR("eigenval")
423  #endif
424  #ifdef HAVE_GMS
425  TEST_FOR("gms")
426  #endif
427  #ifdef OM_NDEBUG
428  TEST_FOR("om_ndebug")
429  #endif
430  #ifdef SING_NDEBUG
431  TEST_FOR("ndebug")
432  #endif
433  {};
434  return FALSE;
435  #undef TEST_FOR
436  }
437  return TRUE;
438  }
439  else
440  /*==================== browsers ==================================*/
441  if (strcmp(sys_cmd,"browsers")==0)
442  {
443  res->rtyp = STRING_CMD;
444  StringSetS("");
446  res->data = StringEndS();
447  return FALSE;
448  }
449  else
450  /*==================== pid ==================================*/
451  if (strcmp(sys_cmd,"pid")==0)
452  {
453  res->rtyp=INT_CMD;
454  res->data=(void *)(long) getpid();
455  return FALSE;
456  }
457  else
458  /*==================== getenv ==================================*/
459  if (strcmp(sys_cmd,"getenv")==0)
460  {
461  if ((h!=NULL) && (h->Typ()==STRING_CMD))
462  {
463  res->rtyp=STRING_CMD;
464  const char *r=getenv((char *)h->Data());
465  if (r==NULL) r="";
466  res->data=(void *)omStrDup(r);
467  return FALSE;
468  }
469  else
470  {
471  WerrorS("string expected");
472  return TRUE;
473  }
474  }
475  else
476  /*==================== setenv ==================================*/
477  if (strcmp(sys_cmd,"setenv")==0)
478  {
479  #ifdef HAVE_SETENV
480  const short t[]={2,STRING_CMD,STRING_CMD};
481  if (iiCheckTypes(h,t,1))
482  {
483  res->rtyp=STRING_CMD;
484  setenv((char *)h->Data(), (char *)h->next->Data(), 1);
485  res->data=(void *)omStrDup((char *)h->next->Data());
487  return FALSE;
488  }
489  else
490  {
491  return TRUE;
492  }
493  #else
494  WerrorS("setenv not supported on this platform");
495  return TRUE;
496  #endif
497  }
498  else
499  /*==================== Singular ==================================*/
500  if (strcmp(sys_cmd, "Singular") == 0)
501  {
502  res->rtyp=STRING_CMD;
503  const char *r=feResource("Singular");
504  if (r == NULL) r="";
505  res->data = (void*) omStrDup( r );
506  return FALSE;
507  }
508  else
509  if (strcmp(sys_cmd, "SingularLib") == 0)
510  {
511  res->rtyp=STRING_CMD;
512  const char *r=feResource("SearchPath");
513  if (r == NULL) r="";
514  res->data = (void*) omStrDup( r );
515  return FALSE;
516  }
517  else
518  /*==================== options ==================================*/
519  if (strstr(sys_cmd, "--") == sys_cmd)
520  {
521  if (strcmp(sys_cmd, "--") == 0)
522  {
524  return FALSE;
525  }
526  feOptIndex opt = feGetOptIndex(&sys_cmd[2]);
527  if (opt == FE_OPT_UNDEF)
528  {
529  Werror("Unknown option %s", sys_cmd);
530  WerrorS("Use 'system(\"--\");' for listing of available options");
531  return TRUE;
532  }
533  // for Untyped Options (help version),
534  // setting it just triggers action
535  if (feOptSpec[opt].type == feOptUntyped)
536  {
537  feSetOptValue(opt,0);
538  return FALSE;
539  }
540  if (h == NULL)
541  {
542  if (feOptSpec[opt].type == feOptString)
543  {
544  res->rtyp = STRING_CMD;
545  const char *r=(const char*)feOptSpec[opt].value;
546  if (r == NULL) r="";
547  res->data = omStrDup(r);
548  }
549  else
550  {
551  res->rtyp = INT_CMD;
552  res->data = feOptSpec[opt].value;
553  }
554  return FALSE;
555  }
556  if (h->Typ() != STRING_CMD &&
557  h->Typ() != INT_CMD)
558  {
559  WerrorS("Need string or int argument to set option value");
560  return TRUE;
561  }
562  const char* errormsg;
563  if (h->Typ() == INT_CMD)
564  {
565  if (feOptSpec[opt].type == feOptString)
566  {
567  Werror("Need string argument to set value of option %s", sys_cmd);
568  return TRUE;
569  }
570  errormsg = feSetOptValue(opt, (int)((long) h->Data()));
571  if (errormsg != NULL)
572  Werror("Option '--%s=%d' %s", sys_cmd, (int) ((long)h->Data()), errormsg);
573  }
574  else
575  {
576  errormsg = feSetOptValue(opt, (char*) h->Data());
577  if (errormsg != NULL)
578  Werror("Option '--%s=%s' %s", sys_cmd, (char*) h->Data(), errormsg);
579  }
580  if (errormsg != NULL) return TRUE;
581  return FALSE;
582  }
583  else
584  /*==================== HC ==================================*/
585  if (strcmp(sys_cmd,"HC")==0)
586  {
587  res->rtyp=INT_CMD;
588  res->data=(void *)(long) HCord;
589  return FALSE;
590  }
591  else
592  /*==================== random ==================================*/
593  if(strcmp(sys_cmd,"random")==0)
594  {
595  const short t[]={1,INT_CMD};
596  if (h!=NULL)
597  {
598  if (iiCheckTypes(h,t,1))
599  {
600  siRandomStart=(int)((long)h->Data());
603  return FALSE;
604  }
605  else
606  {
607  return TRUE;
608  }
609  }
610  res->rtyp=INT_CMD;
611  res->data=(void*)(long) siSeed;
612  return FALSE;
613  }
614  else
615  /*======================= demon_list =====================*/
616  if (strcmp(sys_cmd,"denom_list")==0)
617  {
618  res->rtyp=LIST_CMD;
619  extern lists get_denom_list();
620  res->data=(lists)get_denom_list();
621  return FALSE;
622  }
623  else
624  /*==================== complexNearZero ======================*/
625  if(strcmp(sys_cmd,"complexNearZero")==0)
626  {
627  const short t[]={2,NUMBER_CMD,INT_CMD};
628  if (iiCheckTypes(h,t,1))
629  {
630  if ( !rField_is_long_C(currRing) )
631  {
632  WerrorS( "unsupported ground field!");
633  return TRUE;
634  }
635  else
636  {
637  res->rtyp=INT_CMD;
638  res->data=(void*)complexNearZero((gmp_complex*)h->Data(),
639  (int)((long)(h->next->Data())));
640  return FALSE;
641  }
642  }
643  else
644  {
645  return TRUE;
646  }
647  }
648  else
649  /*==================== getPrecDigits ======================*/
650  if(strcmp(sys_cmd,"getPrecDigits")==0)
651  {
652  if ( (currRing==NULL)
654  {
655  WerrorS( "unsupported ground field!");
656  return TRUE;
657  }
658  res->rtyp=INT_CMD;
659  res->data=(void*)(long)gmp_output_digits;
660  //if (gmp_output_digits!=getGMPFloatDigits())
661  //{ Print("%d, %d\n",getGMPFloatDigits(),gmp_output_digits);}
662  return FALSE;
663  }
664  else
665  /*==================== lduDecomp ======================*/
666  if(strcmp(sys_cmd, "lduDecomp")==0)
667  {
668  const short t[]={1,MATRIX_CMD};
669  if (iiCheckTypes(h,t,1))
670  {
671  matrix aMat = (matrix)h->Data();
672  matrix pMat; matrix lMat; matrix dMat; matrix uMat;
673  poly l; poly u; poly prodLU;
674  lduDecomp(aMat, pMat, lMat, dMat, uMat, l, u, prodLU);
676  L->Init(7);
677  L->m[0].rtyp = MATRIX_CMD; L->m[0].data=(void*)pMat;
678  L->m[1].rtyp = MATRIX_CMD; L->m[1].data=(void*)lMat;
679  L->m[2].rtyp = MATRIX_CMD; L->m[2].data=(void*)dMat;
680  L->m[3].rtyp = MATRIX_CMD; L->m[3].data=(void*)uMat;
681  L->m[4].rtyp = POLY_CMD; L->m[4].data=(void*)l;
682  L->m[5].rtyp = POLY_CMD; L->m[5].data=(void*)u;
683  L->m[6].rtyp = POLY_CMD; L->m[6].data=(void*)prodLU;
684  res->rtyp = LIST_CMD;
685  res->data = (char *)L;
686  return FALSE;
687  }
688  else
689  {
690  return TRUE;
691  }
692  }
693  else
694  /*==================== lduSolve ======================*/
695  if(strcmp(sys_cmd, "lduSolve")==0)
696  {
697  /* for solving a linear equation system A * x = b, via the
698  given LDU-decomposition of the matrix A;
699  There is one valid parametrisation:
700  1) exactly eight arguments P, L, D, U, l, u, lTimesU, b;
701  P, L, D, and U realise the LDU-decomposition of A, that is,
702  P * A = L * D^(-1) * U, and P, L, D, and U satisfy the
703  properties decribed in method 'luSolveViaLDUDecomp' in
704  linearAlgebra.h; see there;
705  l, u, and lTimesU are as described in the same location;
706  b is the right-hand side vector of the linear equation system;
707  The method will return a list of either 1 entry or three entries:
708  1) [0] if there is no solution to the system;
709  2) [1, x, H] if there is at least one solution;
710  x is any solution of the given linear system,
711  H is the matrix with column vectors spanning the homogeneous
712  solution space.
713  The method produces an error if matrix and vector sizes do not
714  fit. */
715  const short t[]={7,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD,POLY_CMD,POLY_CMD,MATRIX_CMD};
716  if (!iiCheckTypes(h,t,1))
717  {
718  return TRUE;
719  }
721  {
722  WerrorS("field required");
723  return TRUE;
724  }
725  matrix pMat = (matrix)h->Data();
726  matrix lMat = (matrix)h->next->Data();
727  matrix dMat = (matrix)h->next->next->Data();
728  matrix uMat = (matrix)h->next->next->next->Data();
729  poly l = (poly) h->next->next->next->next->Data();
730  poly u = (poly) h->next->next->next->next->next->Data();
731  poly lTimesU = (poly) h->next->next->next->next->next->next->Data();
732  matrix bVec = (matrix)h->next->next->next->next->next->next->next->Data();
733  matrix xVec; int solvable; matrix homogSolSpace;
734  if (pMat->rows() != pMat->cols())
735  {
736  Werror("first matrix (%d x %d) is not quadratic",
737  pMat->rows(), pMat->cols());
738  return TRUE;
739  }
740  if (lMat->rows() != lMat->cols())
741  {
742  Werror("second matrix (%d x %d) is not quadratic",
743  lMat->rows(), lMat->cols());
744  return TRUE;
745  }
746  if (dMat->rows() != dMat->cols())
747  {
748  Werror("third matrix (%d x %d) is not quadratic",
749  dMat->rows(), dMat->cols());
750  return TRUE;
751  }
752  if (dMat->cols() != uMat->rows())
753  {
754  Werror("third matrix (%d x %d) and fourth matrix (%d x %d) %s",
755  dMat->rows(), dMat->cols(), uMat->rows(), uMat->cols(),
756  "do not t");
757  return TRUE;
758  }
759  if (uMat->rows() != bVec->rows())
760  {
761  Werror("fourth matrix (%d x %d) and vector (%d x 1) do not fit",
762  uMat->rows(), uMat->cols(), bVec->rows());
763  return TRUE;
764  }
765  solvable = luSolveViaLDUDecomp(pMat, lMat, dMat, uMat, l, u, lTimesU,
766  bVec, xVec, homogSolSpace);
767 
768  /* build the return structure; a list with either one or
769  three entries */
771  if (solvable)
772  {
773  ll->Init(3);
774  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
775  ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)xVec;
776  ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)homogSolSpace;
777  }
778  else
779  {
780  ll->Init(1);
781  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
782  }
783  res->rtyp = LIST_CMD;
784  res->data=(char*)ll;
785  return FALSE;
786  }
787  else
788  /*==== countedref: reference and shared ====*/
789  if (strcmp(sys_cmd, "shared") == 0)
790  {
791  #ifndef SI_COUNTEDREF_AUTOLOAD
792  void countedref_shared_load();
794  #endif
795  res->rtyp = NONE;
796  return FALSE;
797  }
798  else if (strcmp(sys_cmd, "reference") == 0)
799  {
800  #ifndef SI_COUNTEDREF_AUTOLOAD
803  #endif
804  res->rtyp = NONE;
805  return FALSE;
806  }
807  else
808 /*==================== semaphore =================*/
809 #ifdef HAVE_SIMPLEIPC
810  if (strcmp(sys_cmd,"semaphore")==0)
811  {
812  if((h!=NULL) && (h->Typ()==STRING_CMD) && (h->next!=NULL) && (h->next->Typ()==INT_CMD))
813  {
814  int v=1;
815  if ((h->next->next!=NULL)&& (h->next->next->Typ()==INT_CMD))
816  v=(int)(long)h->next->next->Data();
817  res->data=(char *)(long)simpleipc_cmd((char *)h->Data(),(int)(long)h->next->Data(),v);
818  res->rtyp=INT_CMD;
819  return FALSE;
820  }
821  else
822  {
823  WerrorS("Usage: system(\"semaphore\",<cmd>,int)");
824  return TRUE;
825  }
826  }
827  else
828 #endif
829 /*==================== reserved port =================*/
830  if (strcmp(sys_cmd,"reserve")==0)
831  {
832  int ssiReservePort(int clients);
833  const short t[]={1,INT_CMD};
834  if (iiCheckTypes(h,t,1))
835  {
836  res->rtyp=INT_CMD;
837  int p=ssiReservePort((int)(long)h->Data());
838  res->data=(void*)(long)p;
839  return (p==0);
840  }
841  return TRUE;
842  }
843  else
844 /*==================== reserved link =================*/
845  if (strcmp(sys_cmd,"reservedLink")==0)
846  {
847  extern si_link ssiCommandLink();
848  res->rtyp=LINK_CMD;
850  res->data=(void*)p;
851  return (p==NULL);
852  }
853  else
854 /*==================== install newstruct =================*/
855  if (strcmp(sys_cmd,"install")==0)
856  {
857  const short t[]={4,STRING_CMD,STRING_CMD,PROC_CMD,INT_CMD};
858  if (iiCheckTypes(h,t,1))
859  {
860  return newstruct_set_proc((char*)h->Data(),(char*)h->next->Data(),
861  (int)(long)h->next->next->next->Data(),
862  (procinfov)h->next->next->Data());
863  }
864  return TRUE;
865  }
866  else
867 /*==================== newstruct =================*/
868  if (strcmp(sys_cmd,"newstruct")==0)
869  {
870  const short t[]={1,STRING_CMD};
871  if (iiCheckTypes(h,t,1))
872  {
873  int id=0;
874  char *n=(char*)h->Data();
875  blackboxIsCmd(n,id);
876  if (id>0)
877  {
878  blackbox *bb=getBlackboxStuff(id);
879  if (BB_LIKE_LIST(bb))
880  {
881  newstruct_desc desc=(newstruct_desc)bb->data;
882  newstructShow(desc);
883  return FALSE;
884  }
885  else Werror("'%s' is not a newstruct",n);
886  }
887  else Werror("'%s' is not a blackbox object",n);
888  }
889  return TRUE;
890  }
891  else
892 /*==================== blackbox =================*/
893  if (strcmp(sys_cmd,"blackbox")==0)
894  {
896  return FALSE;
897  }
898  else
899  /*================= absBiFact ======================*/
900  #ifdef HAVE_NTL
901  if (strcmp(sys_cmd, "absFact") == 0)
902  {
903  const short t[]={1,POLY_CMD};
904  if (iiCheckTypes(h,t,1)
905  && (currRing!=NULL)
906  && (getCoeffType(currRing->cf)==n_transExt))
907  {
908  res->rtyp=LIST_CMD;
909  intvec *v=NULL;
910  ideal mipos= NULL;
911  int n= 0;
912  ideal f=singclap_absFactorize((poly)(h->Data()), mipos, &v, n, currRing);
913  if (f==NULL) return TRUE;
914  ivTest(v);
916  l->Init(4);
917  l->m[0].rtyp=IDEAL_CMD;
918  l->m[0].data=(void *)f;
919  l->m[1].rtyp=INTVEC_CMD;
920  l->m[1].data=(void *)v;
921  l->m[2].rtyp=IDEAL_CMD;
922  l->m[2].data=(void*) mipos;
923  l->m[3].rtyp=INT_CMD;
924  l->m[3].data=(void*) (long) n;
925  res->data=(void *)l;
926  return FALSE;
927  }
928  else return TRUE;
929  }
930  else
931  #endif
932  /* =================== LLL via NTL ==============================*/
933  #ifdef HAVE_NTL
934  if (strcmp(sys_cmd, "LLL") == 0)
935  {
936  if (h!=NULL)
937  {
938  res->rtyp=h->Typ();
939  if (h->Typ()==MATRIX_CMD)
940  {
941  res->data=(char *)singntl_LLL((matrix)h->Data(), currRing);
942  return FALSE;
943  }
944  else if (h->Typ()==INTMAT_CMD)
945  {
946  res->data=(char *)singntl_LLL((intvec*)h->Data());
947  return FALSE;
948  }
949  else return TRUE;
950  }
951  else return TRUE;
952  }
953  else
954  #endif
955  /* =================== LLL via Flint ==============================*/
956  #ifdef HAVE_FLINT
957  #ifdef FLINT_VER_2_4_5
958  if (strcmp(sys_cmd, "LLL_Flint") == 0)
959  {
960  if (h!=NULL)
961  {
962  if(h->next == NULL)
963  {
964  res->rtyp=h->Typ();
965  if (h->Typ()==BIGINTMAT_CMD)
966  {
967  res->data=(char *)singflint_LLL((bigintmat*)h->Data(), NULL);
968  return FALSE;
969  }
970  else if (h->Typ()==INTMAT_CMD)
971  {
972  res->data=(char *)singflint_LLL((intvec*)h->Data(), NULL);
973  return FALSE;
974  }
975  else return TRUE;
976  }
977  if(h->next->Typ()!= INT_CMD)
978  {
979  WerrorS("matrix,int or bigint,int expected");
980  return TRUE;
981  }
982  if(h->next->Typ()== INT_CMD)
983  {
984  if(((int)((long)(h->next->Data())) != 0) && (int)((long)(h->next->Data()) != 1))
985  {
986  WerrorS("int is different from 0, 1");
987  return TRUE;
988  }
989  res->rtyp=h->Typ();
990  if((long)(h->next->Data()) == 0)
991  {
992  if (h->Typ()==BIGINTMAT_CMD)
993  {
994  res->data=(char *)singflint_LLL((bigintmat*)h->Data(), NULL);
995  return FALSE;
996  }
997  else if (h->Typ()==INTMAT_CMD)
998  {
999  res->data=(char *)singflint_LLL((intvec*)h->Data(), NULL);
1000  return FALSE;
1001  }
1002  else return TRUE;
1003  }
1004  // This will give also the transformation matrix U s.t. res = U * m
1005  if((long)(h->next->Data()) == 1)
1006  {
1007  if (h->Typ()==BIGINTMAT_CMD)
1008  {
1009  bigintmat* m = (bigintmat*)h->Data();
1010  bigintmat* T = new bigintmat(m->rows(),m->rows(),m->basecoeffs());
1011  for(int i = 1; i<=m->rows(); i++)
1012  {
1013  n_Delete(&(BIMATELEM(*T,i,i)),T->basecoeffs());
1014  BIMATELEM(*T,i,i)=n_Init(1, T->basecoeffs());
1015  }
1016  m = singflint_LLL(m,T);
1018  L->Init(2);
1019  L->m[0].rtyp = BIGINTMAT_CMD; L->m[0].data = (void*)m;
1020  L->m[1].rtyp = BIGINTMAT_CMD; L->m[1].data = (void*)T;
1021  res->data=L;
1022  res->rtyp=LIST_CMD;
1023  return FALSE;
1024  }
1025  else if (h->Typ()==INTMAT_CMD)
1026  {
1027  intvec* m = (intvec*)h->Data();
1028  intvec* T = new intvec(m->rows(),m->rows(),(int)0);
1029  for(int i = 1; i<=m->rows(); i++)
1030  IMATELEM(*T,i,i)=1;
1031  m = singflint_LLL(m,T);
1033  L->Init(2);
1034  L->m[0].rtyp = INTMAT_CMD; L->m[0].data = (void*)m;
1035  L->m[1].rtyp = INTMAT_CMD; L->m[1].data = (void*)T;
1036  res->data=L;
1037  res->rtyp=LIST_CMD;
1038  return FALSE;
1039  }
1040  else return TRUE;
1041  }
1042  }
1043 
1044  }
1045  else return TRUE;
1046  }
1047  else
1048  #endif
1049  #endif
1050  /*==================== shift-test for freeGB =================*/
1051  #ifdef HAVE_SHIFTBBA
1052  if (strcmp(sys_cmd, "stest") == 0)
1053  {
1054  const short t[]={4,POLY_CMD,INT_CMD,INT_CMD,INT_CMD};
1055  if (iiCheckTypes(h,t,1))
1056  {
1057  poly p=(poly)h->CopyD();
1058  h=h->next;
1059  int sh=(int)((long)(h->Data()));
1060  h=h->next;
1061  int uptodeg=(int)((long)(h->Data()));
1062  h=h->next;
1063  int lVblock=(int)((long)(h->Data()));
1064  res->data = pLPshift(p,sh,uptodeg,lVblock);
1065  res->rtyp = POLY_CMD;
1066  return FALSE;
1067  }
1068  else return TRUE;
1069  }
1070  else
1071  #endif
1072  /*==================== block-test for freeGB =================*/
1073  #ifdef HAVE_SHIFTBBA
1074  if (strcmp(sys_cmd, "btest") == 0)
1075  {
1076  const short t[]={2,POLY_CMD,INT_CMD};
1077  if (iiCheckTypes(h,t,1))
1078  {
1079  poly p=(poly)h->CopyD();
1080  h=h->next;
1081  int lV=(int)((long)(h->Data()));
1082  res->rtyp = INT_CMD;
1083  res->data = (void*)(long)pLastVblock(p, lV);
1084  return FALSE;
1085  }
1086  else return TRUE;
1087  }
1088  else
1089  #endif
1090  /*==================== shrink-test for freeGB =================*/
1091  #ifdef HAVE_SHIFTBBA
1092  if (strcmp(sys_cmd, "shrinktest") == 0)
1093  {
1094  const short t[]={2,POLY_CMD,INT_CMD};
1095  if (iiCheckTypes(h,t,1))
1096  {
1097  poly p=(poly)h->CopyD();
1098  h=h->next;
1099  int lV=(int)((long)(h->Data()));
1100  res->rtyp = POLY_CMD;
1101  // res->data = p_mShrink(p, lV, currRing);
1102  // kStrategy strat=new skStrategy;
1103  // strat->tailRing = currRing;
1104  res->data = p_Shrink(p, lV, currRing);
1105  return FALSE;
1106  }
1107  else return TRUE;
1108  }
1109  else
1110  #endif
1111  /*==================== pcv ==================================*/
1112  #ifdef HAVE_PCV
1113  if(strcmp(sys_cmd,"pcvLAddL")==0)
1114  {
1115  return pcvLAddL(res,h);
1116  }
1117  else
1118  if(strcmp(sys_cmd,"pcvPMulL")==0)
1119  {
1120  return pcvPMulL(res,h);
1121  }
1122  else
1123  if(strcmp(sys_cmd,"pcvMinDeg")==0)
1124  {
1125  return pcvMinDeg(res,h);
1126  }
1127  else
1128  if(strcmp(sys_cmd,"pcvP2CV")==0)
1129  {
1130  return pcvP2CV(res,h);
1131  }
1132  else
1133  if(strcmp(sys_cmd,"pcvCV2P")==0)
1134  {
1135  return pcvCV2P(res,h);
1136  }
1137  else
1138  if(strcmp(sys_cmd,"pcvDim")==0)
1139  {
1140  return pcvDim(res,h);
1141  }
1142  else
1143  if(strcmp(sys_cmd,"pcvBasis")==0)
1144  {
1145  return pcvBasis(res,h);
1146  }
1147  else
1148  #endif
1149  /*==================== hessenberg/eigenvalues ==================================*/
1150  #ifdef HAVE_EIGENVAL
1151  if(strcmp(sys_cmd,"hessenberg")==0)
1152  {
1153  return evHessenberg(res,h);
1154  }
1155  else
1156  #endif
1157  /*==================== eigenvalues ==================================*/
1158  #ifdef HAVE_EIGENVAL
1159  if(strcmp(sys_cmd,"eigenvals")==0)
1160  {
1161  return evEigenvals(res,h);
1162  }
1163  else
1164  #endif
1165  /*==================== rowelim ==================================*/
1166  #ifdef HAVE_EIGENVAL
1167  if(strcmp(sys_cmd,"rowelim")==0)
1168  {
1169  return evRowElim(res,h);
1170  }
1171  else
1172  #endif
1173  /*==================== rowcolswap ==================================*/
1174  #ifdef HAVE_EIGENVAL
1175  if(strcmp(sys_cmd,"rowcolswap")==0)
1176  {
1177  return evSwap(res,h);
1178  }
1179  else
1180  #endif
1181  /*==================== Gauss-Manin system ==================================*/
1182  #ifdef HAVE_GMS
1183  if(strcmp(sys_cmd,"gmsnf")==0)
1184  {
1185  return gmsNF(res,h);
1186  }
1187  else
1188  #endif
1189  /*==================== contributors =============================*/
1190  if(strcmp(sys_cmd,"contributors") == 0)
1191  {
1192  res->rtyp=STRING_CMD;
1193  res->data=(void *)omStrDup(
1194  "Olaf Bachmann, Michael Brickenstein, Hubert Grassmann, Kai Krueger, Victor Levandovskyy, Wolfgang Neumann, Thomas Nuessler, Wilfred Pohl, Jens Schmidt, Mathias Schulze, Thomas Siebert, Ruediger Stobbe, Moritz Wenk, Tim Wichmann");
1195  return FALSE;
1196  }
1197  else
1198  /*==================== spectrum =============================*/
1199  #ifdef HAVE_SPECTRUM
1200  if(strcmp(sys_cmd,"spectrum") == 0)
1201  {
1202  if ((h==NULL) || (h->Typ()!=POLY_CMD))
1203  {
1204  WerrorS("poly expected");
1205  return TRUE;
1206  }
1207  if (h->next==NULL)
1208  return spectrumProc(res,h);
1209  if (h->next->Typ()!=INT_CMD)
1210  {
1211  WerrorS("poly,int expected");
1212  return TRUE;
1213  }
1214  if(((long)h->next->Data())==1L)
1215  return spectrumfProc(res,h);
1216  return spectrumProc(res,h);
1217  }
1218  else
1219  /*==================== semic =============================*/
1220  if(strcmp(sys_cmd,"semic") == 0)
1221  {
1222  if ((h->next!=NULL)
1223  && (h->Typ()==LIST_CMD)
1224  && (h->next->Typ()==LIST_CMD))
1225  {
1226  if (h->next->next==NULL)
1227  return semicProc(res,h,h->next);
1228  else if (h->next->next->Typ()==INT_CMD)
1229  return semicProc3(res,h,h->next,h->next->next);
1230  }
1231  return TRUE;
1232  }
1233  else
1234  /*==================== spadd =============================*/
1235  if(strcmp(sys_cmd,"spadd") == 0)
1236  {
1237  const short t[]={2,LIST_CMD,LIST_CMD};
1238  if (iiCheckTypes(h,t,1))
1239  {
1240  return spaddProc(res,h,h->next);
1241  }
1242  return TRUE;
1243  }
1244  else
1245  /*==================== spmul =============================*/
1246  if(strcmp(sys_cmd,"spmul") == 0)
1247  {
1248  const short t[]={2,LIST_CMD,INT_CMD};
1249  if (iiCheckTypes(h,t,1))
1250  {
1251  return spmulProc(res,h,h->next);
1252  }
1253  return TRUE;
1254  }
1255  else
1256  #endif
1257 /*==================== tensorModuleMult ========================= */
1258  #define HAVE_SHEAFCOH_TRICKS 1
1259 
1260  #ifdef HAVE_SHEAFCOH_TRICKS
1261  if(strcmp(sys_cmd,"tensorModuleMult")==0)
1262  {
1263  const short t[]={2,INT_CMD,MODUL_CMD};
1264  // WarnS("tensorModuleMult!");
1265  if (iiCheckTypes(h,t,1))
1266  {
1267  int m = (int)( (long)h->Data() );
1268  ideal M = (ideal)h->next->Data();
1269  res->rtyp=MODUL_CMD;
1270  res->data=(void *)id_TensorModuleMult(m, M, currRing);
1271  return FALSE;
1272  }
1273  return TRUE;
1274  }
1275  else
1276  #endif
1277  /*==================== twostd =================*/
1278  #ifdef HAVE_PLURAL
1279  if (strcmp(sys_cmd, "twostd") == 0)
1280  {
1281  ideal I;
1282  if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
1283  {
1284  I=(ideal)h->CopyD();
1285  res->rtyp=IDEAL_CMD;
1286  if (rIsPluralRing(currRing)) res->data=twostd(I);
1287  else res->data=I;
1288  setFlag(res,FLAG_TWOSTD);
1289  setFlag(res,FLAG_STD);
1290  }
1291  else return TRUE;
1292  return FALSE;
1293  }
1294  else
1295  #endif
1296  /*==================== lie bracket =================*/
1297  #ifdef HAVE_PLURAL
1298  if (strcmp(sys_cmd, "bracket") == 0)
1299  {
1300  const short t[]={2,POLY_CMD,POLY_CMD};
1301  if (iiCheckTypes(h,t,1))
1302  {
1303  poly p=(poly)h->CopyD();
1304  h=h->next;
1305  poly q=(poly)h->Data();
1306  res->rtyp=POLY_CMD;
1308  return FALSE;
1309  }
1310  return TRUE;
1311  }
1312  else
1313  #endif
1314  /*==================== env ==================================*/
1315  #ifdef HAVE_PLURAL
1316  if (strcmp(sys_cmd, "env")==0)
1317  {
1318  if ((h!=NULL) && (h->Typ()==RING_CMD))
1319  {
1320  ring r = (ring)h->Data();
1321  res->data = rEnvelope(r);
1322  res->rtyp = RING_CMD;
1323  return FALSE;
1324  }
1325  else
1326  {
1327  WerrorS("`system(\"env\",<ring>)` expected");
1328  return TRUE;
1329  }
1330  }
1331  else
1332  #endif
1333 /* ============ opp ======================== */
1334  #ifdef HAVE_PLURAL
1335  if (strcmp(sys_cmd, "opp")==0)
1336  {
1337  if ((h!=NULL) && (h->Typ()==RING_CMD))
1338  {
1339  ring r=(ring)h->Data();
1340  res->data=rOpposite(r);
1341  res->rtyp=RING_CMD;
1342  return FALSE;
1343  }
1344  else
1345  {
1346  WerrorS("`system(\"opp\",<ring>)` expected");
1347  return TRUE;
1348  }
1349  }
1350  else
1351  #endif
1352  /*==================== oppose ==================================*/
1353  #ifdef HAVE_PLURAL
1354  if (strcmp(sys_cmd, "oppose")==0)
1355  {
1356  if ((h!=NULL) && (h->Typ()==RING_CMD)
1357  && (h->next!= NULL))
1358  {
1359  ring Rop = (ring)h->Data();
1360  h = h->next;
1361  idhdl w;
1362  if ((w=Rop->idroot->get(h->Name(),myynest))!=NULL)
1363  {
1364  poly p = (poly)IDDATA(w);
1365  res->data = pOppose(Rop, p, currRing); // into CurrRing?
1366  res->rtyp = POLY_CMD;
1367  return FALSE;
1368  }
1369  }
1370  else
1371  {
1372  WerrorS("`system(\"oppose\",<ring>,<poly>)` expected");
1373  return TRUE;
1374  }
1375  }
1376  else
1377  #endif
1378  /*==================== freeGB, twosided GB in free algebra =================*/
1379  #ifdef HAVE_PLURAL
1380  #ifdef HAVE_SHIFTBBA
1381  if (strcmp(sys_cmd, "freegb") == 0)
1382  {
1383  const short t[]={3,IDEAL_CMD,INT_CMD,INT_CMD};
1384  if (iiCheckTypes(h,t,1))
1385  {
1386  ideal I=(ideal)h->CopyD();
1387  h=h->next;
1388  int uptodeg=(int)((long)(h->Data()));
1389  h=h->next;
1390  int lVblock=(int)((long)(h->Data()));
1391  res->data = freegb(I,uptodeg,lVblock);
1392  if (res->data == NULL)
1393  {
1394  /* that is there were input errors */
1395  res->data = I;
1396  }
1397  res->rtyp = IDEAL_CMD;
1398  return FALSE;
1399  }
1400  else return TRUE;
1401  }
1402  else
1403  #endif /*SHIFTBBA*/
1404  #endif /*PLURAL*/
1405  /*==================== walk stuff =================*/
1406  /*==================== walkNextWeight =================*/
1407  #ifdef HAVE_WALK
1408  #ifdef OWNW
1409  if (strcmp(sys_cmd, "walkNextWeight") == 0)
1410  {
1411  const short t[]={3,INTVEC_CMD,INTVEC_CMD,IDEAL_CMD};
1412  if (!iiCheckTypes(h,t,1)) return TRUE;
1413  if (((intvec*) h->Data())->length() != currRing->N ||
1414  ((intvec*) h->next->Data())->length() != currRing->N)
1415  {
1416  Werror("system(\"walkNextWeight\" ...) intvecs not of length %d\n",
1417  currRing->N);
1418  return TRUE;
1419  }
1420  res->data = (void*) walkNextWeight(((intvec*) h->Data()),
1421  ((intvec*) h->next->Data()),
1422  (ideal) h->next->next->Data());
1423  if (res->data == NULL || res->data == (void*) 1L)
1424  {
1425  res->rtyp = INT_CMD;
1426  }
1427  else
1428  {
1429  res->rtyp = INTVEC_CMD;
1430  }
1431  return FALSE;
1432  }
1433  else
1434  #endif
1435  #endif
1436  /*==================== walkNextWeight =================*/
1437  #ifdef HAVE_WALK
1438  #ifdef OWNW
1439  if (strcmp(sys_cmd, "walkInitials") == 0)
1440  {
1441  if (h == NULL || h->Typ() != IDEAL_CMD)
1442  {
1443  WerrorS("system(\"walkInitials\", ideal) expected");
1444  return TRUE;
1445  }
1446  res->data = (void*) walkInitials((ideal) h->Data());
1447  res->rtyp = IDEAL_CMD;
1448  return FALSE;
1449  }
1450  else
1451  #endif
1452  #endif
1453  /*==================== walkAddIntVec =================*/
1454  #ifdef HAVE_WALK
1455  #ifdef WAIV
1456  if (strcmp(sys_cmd, "walkAddIntVec") == 0)
1457  {
1458  const short t[]={2,INTVEC_CMD,INTVEC_CMD};
1459  if (!iiCheckTypes(h,t,1)) return TRUE;
1460  intvec* arg1 = (intvec*) h->Data();
1461  intvec* arg2 = (intvec*) h->next->Data();
1462  res->data = (intvec*) walkAddIntVec(arg1, arg2);
1463  res->rtyp = INTVEC_CMD;
1464  return FALSE;
1465  }
1466  else
1467  #endif
1468  #endif
1469  /*==================== MwalkNextWeight =================*/
1470  #ifdef HAVE_WALK
1471  #ifdef MwaklNextWeight
1472  if (strcmp(sys_cmd, "MwalkNextWeight") == 0)
1473  {
1474  const short t[]={3,INTVEC_CMD,INTVEC_CMD,IDEAL_CMD};
1475  if (!iiCheckTypes(h,t,1)) return TRUE;
1476  if (((intvec*) h->Data())->length() != currRing->N ||
1477  ((intvec*) h->next->Data())->length() != currRing->N)
1478  {
1479  Werror("system(\"MwalkNextWeight\" ...) intvecs not of length %d\n",
1480  currRing->N);
1481  return TRUE;
1482  }
1483  intvec* arg1 = (intvec*) h->Data();
1484  intvec* arg2 = (intvec*) h->next->Data();
1485  ideal arg3 = (ideal) h->next->next->Data();
1486  intvec* result = (intvec*) MwalkNextWeight(arg1, arg2, arg3);
1487  res->rtyp = INTVEC_CMD;
1488  res->data = result;
1489  return FALSE;
1490  }
1491  else
1492  #endif //MWalkNextWeight
1493  #endif
1494  /*==================== Mivdp =================*/
1495  #ifdef HAVE_WALK
1496  if(strcmp(sys_cmd, "Mivdp") == 0)
1497  {
1498  if (h == NULL || h->Typ() != INT_CMD)
1499  {
1500  WerrorS("system(\"Mivdp\", int) expected");
1501  return TRUE;
1502  }
1503  if ((int) ((long)(h->Data())) != currRing->N)
1504  {
1505  Werror("system(\"Mivdp\" ...) intvecs not of length %d\n",
1506  currRing->N);
1507  return TRUE;
1508  }
1509  int arg1 = (int) ((long)(h->Data()));
1510  intvec* result = (intvec*) Mivdp(arg1);
1511  res->rtyp = INTVEC_CMD;
1512  res->data = result;
1513  return FALSE;
1514  }
1515  else
1516  #endif
1517  /*==================== Mivlp =================*/
1518  #ifdef HAVE_WALK
1519  if(strcmp(sys_cmd, "Mivlp") == 0)
1520  {
1521  if (h == NULL || h->Typ() != INT_CMD)
1522  {
1523  WerrorS("system(\"Mivlp\", int) expected");
1524  return TRUE;
1525  }
1526  if ((int) ((long)(h->Data())) != currRing->N)
1527  {
1528  Werror("system(\"Mivlp\" ...) intvecs not of length %d\n",
1529  currRing->N);
1530  return TRUE;
1531  }
1532  int arg1 = (int) ((long)(h->Data()));
1533  intvec* result = (intvec*) Mivlp(arg1);
1534  res->rtyp = INTVEC_CMD;
1535  res->data = result;
1536  return FALSE;
1537  }
1538  else
1539  #endif
1540  /*==================== MpDiv =================*/
1541  #ifdef HAVE_WALK
1542  #ifdef MpDiv
1543  if(strcmp(sys_cmd, "MpDiv") == 0)
1544  {
1545  const short t[]={2,POLY_CMD,POLY_CMD};
1546  if (!iiCheckTypes(h,t,1)) return TRUE;
1547  poly arg1 = (poly) h->Data();
1548  poly arg2 = (poly) h->next->Data();
1549  poly result = MpDiv(arg1, arg2);
1550  res->rtyp = POLY_CMD;
1551  res->data = result;
1552  return FALSE;
1553  }
1554  else
1555  #endif
1556  #endif
1557  /*==================== MpMult =================*/
1558  #ifdef HAVE_WALK
1559  #ifdef MpMult
1560  if(strcmp(sys_cmd, "MpMult") == 0)
1561  {
1562  const short t[]={2,POLY_CMD,POLY_CMD};
1563  if (!iiCheckTypes(h,t,1)) return TRUE;
1564  poly arg1 = (poly) h->Data();
1565  poly arg2 = (poly) h->next->Data();
1566  poly result = MpMult(arg1, arg2);
1567  res->rtyp = POLY_CMD;
1568  res->data = result;
1569  return FALSE;
1570  }
1571  else
1572  #endif
1573  #endif
1574  /*==================== MivSame =================*/
1575  #ifdef HAVE_WALK
1576  if (strcmp(sys_cmd, "MivSame") == 0)
1577  {
1578  const short t[]={2,INTVEC_CMD,INTVEC_CMD};
1579  if (!iiCheckTypes(h,t,1)) return TRUE;
1580  /*
1581  if (((intvec*) h->Data())->length() != currRing->N ||
1582  ((intvec*) h->next->Data())->length() != currRing->N)
1583  {
1584  Werror("system(\"MivSame\" ...) intvecs not of length %d\n",
1585  currRing->N);
1586  return TRUE;
1587  }
1588  */
1589  intvec* arg1 = (intvec*) h->Data();
1590  intvec* arg2 = (intvec*) h->next->Data();
1591  /*
1592  poly result = (poly) MivSame(arg1, arg2);
1593  res->rtyp = POLY_CMD;
1594  res->data = (poly) result;
1595  */
1596  res->rtyp = INT_CMD;
1597  res->data = (void*)(long) MivSame(arg1, arg2);
1598  return FALSE;
1599  }
1600  else
1601  #endif
1602  /*==================== M3ivSame =================*/
1603  #ifdef HAVE_WALK
1604  if (strcmp(sys_cmd, "M3ivSame") == 0)
1605  {
1606  const short t[]={3,INTVEC_CMD,INTVEC_CMD,INTVEC_CMD};
1607  if (!iiCheckTypes(h,t,1)) return TRUE;
1608  /*
1609  if (((intvec*) h->Data())->length() != currRing->N ||
1610  ((intvec*) h->next->Data())->length() != currRing->N ||
1611  ((intvec*) h->next->next->Data())->length() != currRing->N )
1612  {
1613  Werror("system(\"M3ivSame\" ...) intvecs not of length %d\n",
1614  currRing->N);
1615  return TRUE;
1616  }
1617  */
1618  intvec* arg1 = (intvec*) h->Data();
1619  intvec* arg2 = (intvec*) h->next->Data();
1620  intvec* arg3 = (intvec*) h->next->next->Data();
1621  /*
1622  poly result = (poly) M3ivSame(arg1, arg2, arg3);
1623  res->rtyp = POLY_CMD;
1624  res->data = (poly) result;
1625  */
1626  res->rtyp = INT_CMD;
1627  res->data = (void*)(long) M3ivSame(arg1, arg2, arg3);
1628  return FALSE;
1629  }
1630  else
1631  #endif
1632  /*==================== MwalkInitialForm =================*/
1633  #ifdef HAVE_WALK
1634  if(strcmp(sys_cmd, "MwalkInitialForm") == 0)
1635  {
1636  const short t[]={2,IDEAL_CMD,INTVEC_CMD};
1637  if (!iiCheckTypes(h,t,1)) return TRUE;
1638  if(((intvec*) h->next->Data())->length() != currRing->N)
1639  {
1640  Werror("system \"MwalkInitialForm\"...) intvec not of length %d\n",
1641  currRing->N);
1642  return TRUE;
1643  }
1644  ideal id = (ideal) h->Data();
1645  intvec* int_w = (intvec*) h->next->Data();
1646  ideal result = (ideal) MwalkInitialForm(id, int_w);
1647  res->rtyp = IDEAL_CMD;
1648  res->data = result;
1649  return FALSE;
1650  }
1651  else
1652  #endif
1653  /*==================== MivMatrixOrder =================*/
1654  #ifdef HAVE_WALK
1655  /************** Perturbation walk **********/
1656  if(strcmp(sys_cmd, "MivMatrixOrder") == 0)
1657  {
1658  if(h==NULL || h->Typ() != INTVEC_CMD)
1659  {
1660  WerrorS("system(\"MivMatrixOrder\",intvec) expected");
1661  return TRUE;
1662  }
1663  intvec* arg1 = (intvec*) h->Data();
1664  intvec* result = MivMatrixOrder(arg1);
1665  res->rtyp = INTVEC_CMD;
1666  res->data = result;
1667  return FALSE;
1668  }
1669  else
1670  #endif
1671  /*==================== MivMatrixOrderdp =================*/
1672  #ifdef HAVE_WALK
1673  if(strcmp(sys_cmd, "MivMatrixOrderdp") == 0)
1674  {
1675  if(h==NULL || h->Typ() != INT_CMD)
1676  {
1677  WerrorS("system(\"MivMatrixOrderdp\",intvec) expected");
1678  return TRUE;
1679  }
1680  int arg1 = (int) ((long)(h->Data()));
1681  intvec* result = (intvec*) MivMatrixOrderdp(arg1);
1682  res->rtyp = INTVEC_CMD;
1683  res->data = result;
1684  return FALSE;
1685  }
1686  else
1687  #endif
1688  /*==================== MPertVectors =================*/
1689  #ifdef HAVE_WALK
1690  if(strcmp(sys_cmd, "MPertVectors") == 0)
1691  {
1692  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INT_CMD};
1693  if (!iiCheckTypes(h,t,1)) return TRUE;
1694  ideal arg1 = (ideal) h->Data();
1695  intvec* arg2 = (intvec*) h->next->Data();
1696  int arg3 = (int) ((long)(h->next->next->Data()));
1697  intvec* result = (intvec*) MPertVectors(arg1, arg2, arg3);
1698  res->rtyp = INTVEC_CMD;
1699  res->data = result;
1700  return FALSE;
1701  }
1702  else
1703  #endif
1704  /*==================== MPertVectorslp =================*/
1705  #ifdef HAVE_WALK
1706  if(strcmp(sys_cmd, "MPertVectorslp") == 0)
1707  {
1708  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INT_CMD};
1709  if (!iiCheckTypes(h,t,1)) return TRUE;
1710  ideal arg1 = (ideal) h->Data();
1711  intvec* arg2 = (intvec*) h->next->Data();
1712  int arg3 = (int) ((long)(h->next->next->Data()));
1713  intvec* result = (intvec*) MPertVectorslp(arg1, arg2, arg3);
1714  res->rtyp = INTVEC_CMD;
1715  res->data = result;
1716  return FALSE;
1717  }
1718  else
1719  #endif
1720  /************** fractal walk **********/
1721  #ifdef HAVE_WALK
1722  if(strcmp(sys_cmd, "Mfpertvector") == 0)
1723  {
1724  const short t[]={2,IDEAL_CMD,INTVEC_CMD};
1725  if (!iiCheckTypes(h,t,1)) return TRUE;
1726  ideal arg1 = (ideal) h->Data();
1727  intvec* arg2 = (intvec*) h->next->Data();
1728  intvec* result = Mfpertvector(arg1, arg2);
1729  res->rtyp = INTVEC_CMD;
1730  res->data = result;
1731  return FALSE;
1732  }
1733  else
1734  #endif
1735  /*==================== MivUnit =================*/
1736  #ifdef HAVE_WALK
1737  if(strcmp(sys_cmd, "MivUnit") == 0)
1738  {
1739  const short t[]={1,INT_CMD};
1740  if (!iiCheckTypes(h,t,1)) return TRUE;
1741  int arg1 = (int) ((long)(h->Data()));
1742  intvec* result = (intvec*) MivUnit(arg1);
1743  res->rtyp = INTVEC_CMD;
1744  res->data = result;
1745  return FALSE;
1746  }
1747  else
1748  #endif
1749  /*==================== MivWeightOrderlp =================*/
1750  #ifdef HAVE_WALK
1751  if(strcmp(sys_cmd, "MivWeightOrderlp") == 0)
1752  {
1753  const short t[]={1,INTVEC_CMD};
1754  if (!iiCheckTypes(h,t,1)) return TRUE;
1755  intvec* arg1 = (intvec*) h->Data();
1756  intvec* result = MivWeightOrderlp(arg1);
1757  res->rtyp = INTVEC_CMD;
1758  res->data = result;
1759  return FALSE;
1760  }
1761  else
1762  #endif
1763  /*==================== MivWeightOrderdp =================*/
1764  #ifdef HAVE_WALK
1765  if(strcmp(sys_cmd, "MivWeightOrderdp") == 0)
1766  {
1767  if(h==NULL || h->Typ() != INTVEC_CMD)
1768  {
1769  WerrorS("system(\"MivWeightOrderdp\",intvec) expected");
1770  return TRUE;
1771  }
1772  intvec* arg1 = (intvec*) h->Data();
1773  //int arg2 = (int) h->next->Data();
1774  intvec* result = MivWeightOrderdp(arg1);
1775  res->rtyp = INTVEC_CMD;
1776  res->data = result;
1777  return FALSE;
1778  }
1779  else
1780  #endif
1781  /*==================== MivMatrixOrderlp =================*/
1782  #ifdef HAVE_WALK
1783  if(strcmp(sys_cmd, "MivMatrixOrderlp") == 0)
1784  {
1785  if(h==NULL || h->Typ() != INT_CMD)
1786  {
1787  WerrorS("system(\"MivMatrixOrderlp\",int) expected");
1788  return TRUE;
1789  }
1790  int arg1 = (int) ((long)(h->Data()));
1791  intvec* result = (intvec*) MivMatrixOrderlp(arg1);
1792  res->rtyp = INTVEC_CMD;
1793  res->data = result;
1794  return FALSE;
1795  }
1796  else
1797  #endif
1798  /*==================== MkInterRedNextWeight =================*/
1799  #ifdef HAVE_WALK
1800  if (strcmp(sys_cmd, "MkInterRedNextWeight") == 0)
1801  {
1802  const short t[]={3,INTVEC_CMD,INTVEC_CMD,IDEAL_CMD};
1803  if (!iiCheckTypes(h,t,1)) return TRUE;
1804  if (((intvec*) h->Data())->length() != currRing->N ||
1805  ((intvec*) h->next->Data())->length() != currRing->N)
1806  {
1807  Werror("system(\"MkInterRedNextWeight\" ...) intvecs not of length %d\n",
1808  currRing->N);
1809  return TRUE;
1810  }
1811  intvec* arg1 = (intvec*) h->Data();
1812  intvec* arg2 = (intvec*) h->next->Data();
1813  ideal arg3 = (ideal) h->next->next->Data();
1814  intvec* result = (intvec*) MkInterRedNextWeight(arg1, arg2, arg3);
1815  res->rtyp = INTVEC_CMD;
1816  res->data = result;
1817  return FALSE;
1818  }
1819  else
1820  #endif
1821  /*==================== MPertNextWeight =================*/
1822  #ifdef HAVE_WALK
1823  #ifdef MPertNextWeight
1824  if (strcmp(sys_cmd, "MPertNextWeight") == 0)
1825  {
1826  const short t[]={3,INTVEC_CMD,IDEAL_CMD,INT_CMD};
1827  if (!iiCheckTypes(h,t,1)) return TRUE;
1828  if (((intvec*) h->Data())->length() != currRing->N)
1829  {
1830  Werror("system(\"MPertNextWeight\" ...) intvecs not of length %d\n",
1831  currRing->N);
1832  return TRUE;
1833  }
1834  intvec* arg1 = (intvec*) h->Data();
1835  ideal arg2 = (ideal) h->next->Data();
1836  int arg3 = (int) h->next->next->Data();
1837  intvec* result = (intvec*) MPertNextWeight(arg1, arg2, arg3);
1838  res->rtyp = INTVEC_CMD;
1839  res->data = result;
1840  return FALSE;
1841  }
1842  else
1843  #endif //MPertNextWeight
1844  #endif
1845  /*==================== Mivperttarget =================*/
1846  #ifdef HAVE_WALK
1847  #ifdef Mivperttarget
1848  if (strcmp(sys_cmd, "Mivperttarget") == 0)
1849  {
1850  const short t[]={2,IDEAL_CMD,INT_CMD};
1851  if (!iiCheckTypes(h,t,1)) return TRUE;
1852  ideal arg1 = (ideal) h->Data();
1853  int arg2 = (int) h->next->Data();
1854  intvec* result = (intvec*) Mivperttarget(arg1, arg2);
1855  res->rtyp = INTVEC_CMD;
1856  res->data = result;
1857  return FALSE;
1858  }
1859  else
1860  #endif //Mivperttarget
1861  #endif
1862  /*==================== Mwalk =================*/
1863  #ifdef HAVE_WALK
1864  if (strcmp(sys_cmd, "Mwalk") == 0)
1865  {
1866  const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,RING_CMD};
1867  if (!iiCheckTypes(h,t,1)) return TRUE;
1868  if (((intvec*) h->next->Data())->length() != currRing->N &&
1869  ((intvec*) h->next->next->Data())->length() != currRing->N )
1870  {
1871  Werror("system(\"Mwalk\" ...) intvecs not of length %d\n",
1872  currRing->N);
1873  return TRUE;
1874  }
1875  ideal arg1 = (ideal) h->Data();
1876  intvec* arg2 = (intvec*) h->next->Data();
1877  intvec* arg3 = (intvec*) h->next->next->Data();
1878  ring arg4 = (ring) h->next->next->next->Data();
1879  ideal result = (ideal) Mwalk(arg1, arg2, arg3,arg4);
1880  res->rtyp = IDEAL_CMD;
1881  res->data = result;
1882  return FALSE;
1883  }
1884  else
1885  #endif
1886  /*==================== Mpwalk =================*/
1887  #ifdef HAVE_WALK
1888  #ifdef MPWALK_ORIG
1889  if (strcmp(sys_cmd, "Mwalk") == 0)
1890  {
1891  const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,RING_CMD};
1892  if (!iiCheckTypes(h,t,1)) return TRUE;
1893  if ((((intvec*) h->next->Data())->length() != currRing->N &&
1894  ((intvec*) h->next->next->Data())->length() != currRing->N ) &&
1895  (((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
1896  ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N)))
1897  {
1898  Werror("system(\"Mwalk\" ...) intvecs not of length %d or %d\n",
1899  currRing->N,(currRing->N)*(currRing->N));
1900  return TRUE;
1901  }
1902  ideal arg1 = (ideal) h->Data();
1903  intvec* arg2 = (intvec*) h->next->Data();
1904  intvec* arg3 = (intvec*) h->next->next->Data();
1905  ring arg4 = (ring) h->next->next->next->Data();
1906  ideal result = (ideal) Mwalk(arg1, arg2, arg3,arg4);
1907  res->rtyp = IDEAL_CMD;
1908  res->data = result;
1909  return FALSE;
1910  }
1911  else
1912  #else
1913  if (strcmp(sys_cmd, "Mpwalk") == 0)
1914  {
1915  const short t[]={6,IDEAL_CMD,INT_CMD,INT_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD};
1916  if (!iiCheckTypes(h,t,1)) return TRUE;
1917  if(((intvec*) h->next->next->next->Data())->length() != currRing->N &&
1918  ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N)
1919  {
1920  Werror("system(\"Mpwalk\" ...) intvecs not of length %d\n",currRing->N);
1921  return TRUE;
1922  }
1923  ideal arg1 = (ideal) h->Data();
1924  int arg2 = (int) (long) h->next->Data();
1925  int arg3 = (int) (long) h->next->next->Data();
1926  intvec* arg4 = (intvec*) h->next->next->next->Data();
1927  intvec* arg5 = (intvec*) h->next->next->next->next->Data();
1928  int arg6 = (int) (long) h->next->next->next->next->next->Data();
1929  ideal result = (ideal) Mpwalk(arg1, arg2, arg3, arg4, arg5,arg6);
1930  res->rtyp = IDEAL_CMD;
1931  res->data = result;
1932  return FALSE;
1933  }
1934  else
1935  #endif
1936  #endif
1937  /*==================== Mrwalk =================*/
1938  #ifdef HAVE_WALK
1939  if (strcmp(sys_cmd, "Mrwalk") == 0)
1940  {
1941  const short t[]={6,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD,RING_CMD};
1942  if (!iiCheckTypes(h,t,1)) return TRUE;
1943  if((((intvec*) h->next->Data())->length() != currRing->N &&
1944  ((intvec*) h->next->next->Data())->length() != currRing->N ) &&
1945  (((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
1946  ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N) ))
1947  {
1948  Werror("system(\"Mrwalk\" ...) intvecs not of length %d or %d\n",
1949  currRing->N,(currRing->N)*(currRing->N));
1950  return TRUE;
1951  }
1952  ideal arg1 = (ideal) h->Data();
1953  intvec* arg2 = (intvec*) h->next->Data();
1954  intvec* arg3 = (intvec*) h->next->next->Data();
1955  int arg4 = (int)(long) h->next->next->next->Data();
1956  int arg5 = (int)(long) h->next->next->next->next->Data();
1957  ring arg6 = (ring) h->next->next->next->next->next->Data();
1958  ideal result = (ideal) Mrwalk(arg1, arg2, arg3, arg4, arg5, arg6);
1959  res->rtyp = IDEAL_CMD;
1960  res->data = result;
1961  return FALSE;
1962  }
1963  else
1964  #endif
1965  /*==================== MAltwalk1 =================*/
1966  #ifdef HAVE_WALK
1967  if (strcmp(sys_cmd, "MAltwalk1") == 0)
1968  {
1969  const short t[]={5,IDEAL_CMD,INT_CMD,INT_CMD,INTVEC_CMD,INTVEC_CMD};
1970  if (!iiCheckTypes(h,t,1)) return TRUE;
1971  if (((intvec*) h->next->next->next->Data())->length() != currRing->N &&
1972  ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N)
1973  {
1974  Werror("system(\"MAltwalk1\" ...) intvecs not of length %d\n",
1975  currRing->N);
1976  return TRUE;
1977  }
1978  ideal arg1 = (ideal) h->Data();
1979  int arg2 = (int) ((long)(h->next->Data()));
1980  int arg3 = (int) ((long)(h->next->next->Data()));
1981  intvec* arg4 = (intvec*) h->next->next->next->Data();
1982  intvec* arg5 = (intvec*) h->next->next->next->next->Data();
1983  ideal result = (ideal) MAltwalk1(arg1, arg2, arg3, arg4, arg5);
1984  res->rtyp = IDEAL_CMD;
1985  res->data = result;
1986  return FALSE;
1987  }
1988  else
1989  #endif
1990  /*==================== MAltwalk1 =================*/
1991  #ifdef HAVE_WALK
1992  #ifdef MFWALK_ALT
1993  if (strcmp(sys_cmd, "Mfwalk_alt") == 0)
1994  {
1995  const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD};
1996  if (!iiCheckTypes(h,t,1)) return TRUE;
1997  if (((intvec*) h->next->Data())->length() != currRing->N &&
1998  ((intvec*) h->next->next->Data())->length() != currRing->N )
1999  {
2000  Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n",
2001  currRing->N);
2002  return TRUE;
2003  }
2004  ideal arg1 = (ideal) h->Data();
2005  intvec* arg2 = (intvec*) h->next->Data();
2006  intvec* arg3 = (intvec*) h->next->next->Data();
2007  int arg4 = (int) h->next->next->next->Data();
2008  ideal result = (ideal) Mfwalk_alt(arg1, arg2, arg3, arg4);
2009  res->rtyp = IDEAL_CMD;
2010  res->data = result;
2011  return FALSE;
2012  }
2013  else
2014  #endif
2015  #endif
2016  /*==================== Mfwalk =================*/
2017  #ifdef HAVE_WALK
2018  if (strcmp(sys_cmd, "Mfwalk") == 0)
2019  {
2020  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD};
2021  if (!iiCheckTypes(h,t,1)) return TRUE;
2022  if (((intvec*) h->next->Data())->length() != currRing->N &&
2023  ((intvec*) h->next->next->Data())->length() != currRing->N )
2024  {
2025  Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n",
2026  currRing->N);
2027  return TRUE;
2028  }
2029  ideal arg1 = (ideal) h->Data();
2030  intvec* arg2 = (intvec*) h->next->Data();
2031  intvec* arg3 = (intvec*) h->next->next->Data();
2032  ideal result = (ideal) Mfwalk(arg1, arg2, arg3);
2033  res->rtyp = IDEAL_CMD;
2034  res->data = result;
2035  return FALSE;
2036  }
2037  else
2038  #endif
2039  /*==================== Mfrwalk =================*/
2040  #ifdef HAVE_WALK
2041  if (strcmp(sys_cmd, "Mfrwalk") == 0)
2042  {
2043  const short t[]={6,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD,RING_CMD};
2044  if (!iiCheckTypes(h,t,1)) return TRUE;
2045  if (((intvec*) h->next->Data())->length() != currRing->N &&
2046  ((intvec*) h->next->next->Data())->length() != currRing->N)
2047  {
2048  Werror("system(\"Mfrwalk\" ...) intvecs not of length %d\n",currRing->N);
2049  return TRUE;
2050  }
2051  ideal arg1 = (ideal) h->Data();
2052  intvec* arg2 = (intvec*) h->next->Data();
2053  intvec* arg3 = (intvec*) h->next->next->Data();
2054  int arg4 = (int)(long) h->next->next->next->Data();
2055  ideal result = (ideal) Mfrwalk(arg1, arg2, arg3, arg4);
2056  res->rtyp = IDEAL_CMD;
2057  res->data = result;
2058  return FALSE;
2059  }
2060  else
2061  /*==================== Mprwalk =================*/
2062  if (strcmp(sys_cmd, "Mprwalk") == 0)
2063  {
2065  if (!iiCheckTypes(h,t,1)) return TRUE;
2066  if (((intvec*) h->next->Data())->length() != currRing->N &&
2067  ((intvec*) h->next->next->Data())->length() != currRing->N )
2068  {
2069  Werror("system(\"Mrwalk\" ...) intvecs not of length %d\n",
2070  currRing->N);
2071  return TRUE;
2072  }
2073  ideal arg1 = (ideal) h->Data();
2074  intvec* arg2 = (intvec*) h->next->Data();
2075  intvec* arg3 = (intvec*) h->next->next->Data();
2076  int arg4 = (int)(long) h->next->next->next->Data();
2077  int arg5 = (int)(long) h->next->next->next->next->Data();
2078  int arg6 = (int)(long) h->next->next->next->next->next->Data();
2079  ring arg7 = (ring) h->next->next->next->next->next->next->Data();
2080  ideal result = (ideal) Mprwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
2081  res->rtyp = IDEAL_CMD;
2082  res->data = result;
2083  return FALSE;
2084  }
2085  else
2086  #endif
2087  /*==================== TranMImprovwalk =================*/
2088  #ifdef HAVE_WALK
2089  #ifdef TRAN_Orig
2090  if (strcmp(sys_cmd, "TranMImprovwalk") == 0)
2091  {
2092  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD};
2093  if (!iiCheckTypes(h,t,1)) return TRUE;
2094  if (((intvec*) h->next->Data())->length() != currRing->N &&
2095  ((intvec*) h->next->next->Data())->length() != currRing->N )
2096  {
2097  Werror("system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
2098  currRing->N);
2099  return TRUE;
2100  }
2101  ideal arg1 = (ideal) h->Data();
2102  intvec* arg2 = (intvec*) h->next->Data();
2103  intvec* arg3 = (intvec*) h->next->next->Data();
2104  ideal result = (ideal) TranMImprovwalk(arg1, arg2, arg3);
2105  res->rtyp = IDEAL_CMD;
2106  res->data = result;
2107  return FALSE;
2108  }
2109  else
2110  #endif
2111  #endif
2112  /*==================== MAltwalk2 =================*/
2113  #ifdef HAVE_WALK
2114  if (strcmp(sys_cmd, "MAltwalk2") == 0)
2115  {
2116  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD};
2117  if (!iiCheckTypes(h,t,1)) return TRUE;
2118  if (((intvec*) h->next->Data())->length() != currRing->N &&
2119  ((intvec*) h->next->next->Data())->length() != currRing->N )
2120  {
2121  Werror("system(\"MAltwalk2\" ...) intvecs not of length %d\n",
2122  currRing->N);
2123  return TRUE;
2124  }
2125  ideal arg1 = (ideal) h->Data();
2126  intvec* arg2 = (intvec*) h->next->Data();
2127  intvec* arg3 = (intvec*) h->next->next->Data();
2128  ideal result = (ideal) MAltwalk2(arg1, arg2, arg3);
2129  res->rtyp = IDEAL_CMD;
2130  res->data = result;
2131  return FALSE;
2132  }
2133  else
2134  #endif
2135  /*==================== MAltwalk2 =================*/
2136  #ifdef HAVE_WALK
2137  if (strcmp(sys_cmd, "TranMImprovwalk") == 0)
2138  {
2139  const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD};
2140  if (!iiCheckTypes(h,t,1)) return TRUE;
2141  if (((intvec*) h->next->Data())->length() != currRing->N &&
2142  ((intvec*) h->next->next->Data())->length() != currRing->N )
2143  {
2144  Werror("system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
2145  currRing->N);
2146  return TRUE;
2147  }
2148  ideal arg1 = (ideal) h->Data();
2149  intvec* arg2 = (intvec*) h->next->Data();
2150  intvec* arg3 = (intvec*) h->next->next->Data();
2151  int arg4 = (int) ((long)(h->next->next->next->Data()));
2152  ideal result = (ideal) TranMImprovwalk(arg1, arg2, arg3, arg4);
2153  res->rtyp = IDEAL_CMD;
2154  res->data = result;
2155  return FALSE;
2156  }
2157  else
2158  #endif
2159  /*==================== TranMrImprovwalk =================*/
2160  #if 0
2161  #ifdef HAVE_WALK
2162  if (strcmp(sys_cmd, "TranMrImprovwalk") == 0)
2163  {
2164  if (h == NULL || h->Typ() != IDEAL_CMD ||
2165  h->next == NULL || h->next->Typ() != INTVEC_CMD ||
2166  h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD ||
2167  h->next->next->next == NULL || h->next->next->next->Typ() != INT_CMD ||
2168  h->next->next->next == NULL || h->next->next->next->next->Typ() != INT_CMD ||
2169  h->next->next->next == NULL || h->next->next->next->next->next->Typ() != INT_CMD)
2170  {
2171  WerrorS("system(\"TranMrImprovwalk\", ideal, intvec, intvec) expected");
2172  return TRUE;
2173  }
2174  if (((intvec*) h->next->Data())->length() != currRing->N &&
2175  ((intvec*) h->next->next->Data())->length() != currRing->N )
2176  {
2177  Werror("system(\"TranMrImprovwalk\" ...) intvecs not of length %d\n", currRing->N);
2178  return TRUE;
2179  }
2180  ideal arg1 = (ideal) h->Data();
2181  intvec* arg2 = (intvec*) h->next->Data();
2182  intvec* arg3 = (intvec*) h->next->next->Data();
2183  int arg4 = (int)(long) h->next->next->next->Data();
2184  int arg5 = (int)(long) h->next->next->next->next->Data();
2185  int arg6 = (int)(long) h->next->next->next->next->next->Data();
2186  ideal result = (ideal) TranMrImprovwalk(arg1, arg2, arg3, arg4, arg5, arg6);
2187  res->rtyp = IDEAL_CMD;
2188  res->data = result;
2189  return FALSE;
2190  }
2191  else
2192  #endif
2193  #endif
2194  /*================= Extended system call ========================*/
2195  {
2196  #ifndef MAKE_DISTRIBUTION
2197  return(jjEXTENDED_SYSTEM(res, args));
2198  #else
2199  Werror( "system(\"%s\",...) %s", sys_cmd, feNotImplemented );
2200  #endif
2201  }
2202  } /* typ==string */
2203  return TRUE;
2204 }
feOptIndex
Definition: feOptGen.h:15
int & rows()
Definition: matpol.h:24
lists get_denom_list()
Definition: denom_list.cc:8
poly pOppose(ring Rop_src, poly p, const ring Rop_dst)
opposes a vector p from Rop to currRing (dst!)
Definition: old.gring.cc:3414
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
ideal Mfwalk(ideal G, intvec *ivstart, intvec *ivtarget)
Definition: walk.cc:6812
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
const CanonicalForm int s
Definition: facAbsFact.cc:55
ring rEnvelope(ring R)
Definition: ring.cc:5485
sleftv * m
Definition: lists.h:45
intvec * MivMatrixOrder(intvec *iv)
Definition: walk.cc:938
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2295
void factoryseed(int s)
random seed initializer
Definition: cf_random.cc:176
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int HCord
Definition: kutil.cc:227
matrix singntl_LLL(matrix m, const ring s)
Definition: clapsing.cc:1707
intvec * Mfpertvector(ideal G, intvec *ivtarget)
Definition: walk.cc:1492
Definition: tok.h:85
static void * feOptValue(feOptIndex opt)
Definition: feOpt.h:40
matrix evRowElim(matrix M, int i, int j, int k)
Definition: eigenval.cc:47
Definition: lists.h:22
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:37
char * versionString()
Definition: misc_ip.cc:783
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
intvec * MivWeightOrderlp(intvec *ivstart)
Definition: walk.cc:1416
BOOLEAN semicProc3(leftv res, leftv u, leftv v, leftv w)
Definition: ipshell.cc:4217
Matrices of numbers.
Definition: bigintmat.h:32
f
Definition: cfModGcd.cc:4022
#define SINGULAR_VERSION
Definition: mod2.h:94
static char * feResource(feResourceConfig config, int warn)
Definition: feResource.cc:252
lists pcvPMulL(poly p, lists l1)
Definition: pcv.cc:56
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:537
const ideal
Definition: gb_hack.h:42
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
ring rOpposite(ring src)
Definition: ring.cc:5157
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
int siRandomStart
Definition: cntrlc.cc:109
ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing)
char * getenv()
BOOLEAN spectrumProc(leftv result, leftv first)
Definition: ipshell.cc:3839
#define TRUE
Definition: auxiliary.h:144
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:868
intvec * MivWeightOrderdp(intvec *ivstart)
Definition: walk.cc:1436
BOOLEAN spmulProc(leftv result, leftv first, leftv second)
Definition: ipshell.cc:4176
void * value
Definition: fegetopt.h:93
const char * feSetOptValue(feOptIndex opt, char *optarg)
Definition: feOpt.cc:153
g
Definition: cfModGcd.cc:4031
void WerrorS(const char *s)
Definition: feFopen.cc:23
gmp_complex numbers based on
Definition: mpr_complex.h:178
char * StringEndS()
Definition: reporter.cc:151
bool complexNearZero(gmp_complex *c, int digits)
Definition: mpr_complex.cc:778
void lduDecomp(const matrix aMat, matrix &pMat, matrix &lMat, matrix &dMat, matrix &uMat, poly &l, poly &u, poly &lTimesU)
LU-decomposition of a given (m x n)-matrix with performing only those divisions that yield zero remai...
int Typ()
Definition: subexpr.cc:949
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
ideal Mfrwalk(ideal G, intvec *ivstart, intvec *ivtarget, int weight_rad)
Definition: walk.cc:6938
const char * Name()
Definition: subexpr.h:121
matrix evSwap(matrix M, int i, int j)
Definition: eigenval.cc:25
Definition: idrec.h:34
#define ivTest(v)
Definition: intvec.h:156
idhdl get(const char *s, int lev)
Definition: ipid.cc:90
intvec * MPertVectorslp(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1279
void * data
Definition: subexpr.h:89
void printBlackboxTypes()
list all defined type (for debugging)
Definition: blackbox.cc:207
void feStringAppendBrowsers(int warn)
Definition: fehelp.cc:352
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:509
int myynest
Definition: febase.cc:46
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static int rBlocks(ring r)
Definition: ring.h:507
const ring r
Definition: syzextra.cc:208
ideal MAltwalk1(ideal Go, int op_deg, int tp_deg, intvec *curr_weight, intvec *target_weight)
Definition: walk.cc:8444
#define FLAG_TWOSTD
Definition: ipid.h:109
Definition: intvec.h:16
int pcvDim(int d0, int d1)
Definition: pcv.cc:361
ideal Mprwalk(ideal Go, intvec *curr_weight, intvec *target_weight, int weight_rad, int op_deg, int tp_deg, ring baseRing)
Definition: walk.cc:8244
void newstructShow(newstruct_desc d)
Definition: newstruct.cc:820
polyrec * poly
Definition: hilb.h:10
void StringSetS(const char *st)
Definition: reporter.cc:128
static BOOLEAN jjEXTENDED_SYSTEM(leftv res, leftv h)
Definition: extra.cc:2218
int M3ivSame(intvec *temp, intvec *u, intvec *v)
Definition: walk.cc:889
ideal Mrwalk(ideal Go, intvec *orig_M, intvec *target_M, int weight_rad, int pert_deg, ring baseRing)
Definition: walk.cc:5339
poly pLPshift(poly p, int sh, int uptodeg, int lV)
Definition: shiftgb.cc:155
const char feNotImplemented[]
Definition: reporter.cc:54
struct fe_option feOptSpec[]
ideal Mpwalk(ideal Go, int op_deg, int tp_deg, intvec *curr_weight, intvec *target_weight, int nP)
Definition: walk.cc:5750
intvec * MwalkNextWeight(intvec *curr_weight, intvec *target_weight, ideal G)
ip_smatrix * matrix
intvec * MPertNextWeight(intvec *iva, ideal G, int deg)
idhdl currRingHdl
Definition: ipid.cc:64
#define setFlag(A, F)
Definition: ipid.h:112
int simpleipc_cmd(char *cmd, int id, int v)
Definition: semaphore.c:122
int m
Definition: cfEzgcd.cc:119
void fePrintOptValues()
Definition: feOpt.cc:317
poly pcvCV2P(poly cv, int d0, int d1)
Definition: pcv.cc:263
int i
Definition: cfEzgcd.cc:123
intvec * Mivperttarget(ideal G, int ndeg)
BOOLEAN spectrumfProc(leftv result, leftv first)
Definition: ipshell.cc:3890
lists pcvLAddL(lists l1, lists l2)
Definition: pcv.cc:31
#define pOne()
Definition: polys.h:286
int pcvBasis(lists b, int i, poly m, int d, int n)
Definition: pcv.cc:391
Definition: tok.h:88
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1061
ideal freegb(ideal I, int uptodeg, int lVblock)
Definition: kstd2.cc:3214
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
#define FLAG_STD
Definition: ipid.h:108
leftv next
Definition: subexpr.h:87
static BOOLEAN rField_is_long_C(const ring r)
Definition: ring.h:485
intvec * Mivdp(int nR)
Definition: walk.cc:980
#define BIMATELEM(M, I, J)
Definition: bigintmat.h:117
INLINE_THIS void Init(int l=0)
Definition: lists.h:66
int pLastVblock(poly p, int lV)
Definition: shiftgb.cc:222
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
matrix evHessenberg(matrix M)
Definition: eigenval.cc:100
int rows() const
Definition: bigintmat.h:129
int & cols()
Definition: matpol.h:25
Definition: tok.h:95
lists evEigenvals(matrix M)
Definition: eigenval_ip.cc:118
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
BOOLEAN semicProc(leftv res, leftv u, leftv v)
Definition: ipshell.cc:4257
int siSeed
Definition: sirandom.c:29
bool luSolveViaLDUDecomp(const matrix pMat, const matrix lMat, const matrix dMat, const matrix uMat, const poly l, const poly u, const poly lTimesU, const matrix bVec, matrix &xVec, matrix &H)
Solves the linear system A * x = b, where A is an (m x n)-matrix which is given by its LDU-decomposit...
ideal TranMImprovwalk(ideal G, intvec *curr_weight, intvec *target_tmp, int nP)
Definition: walk.cc:7069
#define pMult(p, q)
Definition: polys.h:178
int rows() const
Definition: intvec.h:87
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
Definition: ipshell.cc:6247
coeffs basecoeffs() const
Definition: bigintmat.h:130
static BOOLEAN rField_is_long_R(const ring r)
Definition: ring.h:482
#define IDRING(a)
Definition: ipid.h:126
int blackboxIsCmd(const char *n, int &tok)
used by scanner: returns ROOT_DECL for known types (and the type number in tok)
Definition: blackbox.cc:191
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pDelete(p_ptr)
Definition: polys.h:157
intvec * MivMatrixOrderdp(int nV)
Definition: walk.cc:1397
int rtyp
Definition: subexpr.h:92
#define TEST_FOR(A)
void * Data()
Definition: subexpr.cc:1091
ideal MAltwalk2(ideal Go, intvec *curr_weight, intvec *target_weight)
Definition: walk.cc:4075
poly pcvP2CV(poly p, int d0, int d1)
Definition: pcv.cc:246
Definition: tok.h:96
omBin slists_bin
Definition: lists.cc:23
BOOLEAN spaddProc(leftv result, leftv first, leftv second)
Definition: ipshell.cc:4134
intvec * MivUnit(int nV)
Definition: walk.cc:1476
ideal singclap_absFactorize(poly f, ideal &mipos, intvec **exps, int &numFactors, const ring r)
Definition: clapsing.cc:1763
#define pPower(p, q)
Definition: polys.h:175
BOOLEAN newstruct_set_proc(const char *bbname, const char *func, int args, procinfov pr)
Definition: newstruct.cc:840
size_t gmp_output_digits
Definition: mpr_complex.cc:44
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
lists gmsNF(ideal p, ideal g, matrix B, int D, int K)
Definition: gms.cc:22
ideal Mwalk(ideal Go, intvec *orig_M, intvec *target_M, ring baseRing)
Definition: walk.cc:5065
feOptIndex feGetOptIndex(const char *name)
Definition: feOpt.cc:104
void countedref_reference_load()
Initialize blackbox types 'reference' and 'shared', or both.
Definition: countedref.cc:700
static jList * T
Definition: janet.cc:37
#define IDDATA(a)
Definition: ipid.h:125
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
static Poly * h
Definition: janet.cc:978
#define IMATELEM(M, I, J)
Definition: intvec.h:76
#define NONE
Definition: tok.h:170
void feReInitResources()
Definition: feResource.cc:201
void Werror(const char *fmt,...)
Definition: reporter.cc:199
intvec * MivMatrixOrderlp(int nV)
Definition: walk.cc:1381
void * CopyD(int t)
Definition: subexpr.cc:656
int pcvMinDeg(poly p)
Definition: pcv.cc:108
void countedref_shared_load()
Definition: countedref.cc:724
return result
Definition: facAbsBiFact.cc:76
int l
Definition: cfEzgcd.cc:94
intvec * Mivlp(int nR)
Definition: walk.cc:995
procinfo * procinfov
Definition: structs.h:63
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:20
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2248
ideal twostd(ideal I)
Compute two-sided GB:
Definition: nc.cc:22
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN jjVARIABLES_ID ( leftv  res,
leftv  u 
)

Definition at line 6004 of file ipshell.cc.

6005 {
6006  int *e=(int *)omAlloc0((rVar(currRing)+1)*sizeof(int));
6007  ideal I=(ideal)u->Data();
6008  int i;
6009  int n=0;
6010  for(i=I->nrows*I->ncols-1;i>=0;i--)
6011  {
6012  int n0=pGetVariables(I->m[i],e);
6013  if (n0>n) n=n0;
6014  }
6015  jjINT_S_TO_ID(n,e,res);
6016  return FALSE;
6017 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
#define FALSE
Definition: auxiliary.h:140
const ideal
Definition: gb_hack.h:42
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
static void jjINT_S_TO_ID(int n, int *e, leftv res)
Definition: ipshell.cc:5974
#define pGetVariables(p, e)
Definition: polys.h:222
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
void * Data()
Definition: subexpr.cc:1091
#define omAlloc0(size)
Definition: omAllocDecl.h:211
BOOLEAN jjVARIABLES_P ( leftv  res,
leftv  u 
)

Definition at line 5996 of file ipshell.cc.

5997 {
5998  int *e=(int *)omAlloc0((rVar(currRing)+1)*sizeof(int));
5999  int n=pGetVariables((poly)u->Data(),e);
6000  jjINT_S_TO_ID(n,e,res);
6001  return FALSE;
6002 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
#define FALSE
Definition: auxiliary.h:140
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
static void jjINT_S_TO_ID(int n, int *e, leftv res)
Definition: ipshell.cc:5974
#define pGetVariables(p, e)
Definition: polys.h:222
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
polyrec * poly
Definition: hilb.h:10
void * Data()
Definition: subexpr.cc:1091
#define omAlloc0(size)
Definition: omAllocDecl.h:211
void killlocals ( int  v)

Definition at line 382 of file ipshell.cc.

383 {
384  BOOLEAN changed=FALSE;
385  idhdl sh=currRingHdl;
386  ring cr=currRing;
387  if (sh!=NULL) changed=((IDLEV(sh)<v) || (IDRING(sh)->ref>0));
388  //if (changed) Print("currRing=%s(%x), lev=%d,ref=%d\n",IDID(sh),IDRING(sh),IDLEV(sh),IDRING(sh)->ref);
389 
390  killlocals_rec(&(basePack->idroot),v,currRing);
391 
393  {
394  int t=iiRETURNEXPR.Typ();
395  if ((/*iiRETURNEXPR.Typ()*/ t==RING_CMD)
396  || (/*iiRETURNEXPR.Typ()*/ t==QRING_CMD))
397  {
399  if (((ring)h->data)->idroot!=NULL)
400  killlocals0(v,&(((ring)h->data)->idroot),(ring)h->data);
401  }
402  else if (/*iiRETURNEXPR.Typ()*/ t==LIST_CMD)
403  {
404  leftv h=&iiRETURNEXPR;
405  changed |=killlocals_list(v,(lists)h->data);
406  }
407  }
408  if (changed)
409  {
411  if (currRingHdl==NULL)
412  currRing=NULL;
413  else if(cr!=currRing)
414  rChangeCurrRing(cr);
415  }
416 
417  if (myynest<=1) iiNoKeepRing=TRUE;
418  //Print("end killlocals >= %d\n",v);
419  //listall();
420 }
int iiRETURNEXPR_len
Definition: iplib.cc:518
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
sleftv iiRETURNEXPR
Definition: iplib.cc:517
#define TRUE
Definition: auxiliary.h:144
void killlocals_rec(idhdl *root, int v, ring r)
Definition: ipshell.cc:325
int Typ()
Definition: subexpr.cc:949
Definition: idrec.h:34
void * data
Definition: subexpr.h:89
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN killlocals_list(int v, lists L)
Definition: ipshell.cc:362
static BOOLEAN iiNoKeepRing
Definition: ipshell.cc:86
idhdl currRingHdl
Definition: ipid.cc:64
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1690
#define IDLEV(a)
Definition: ipid.h:120
void rChangeCurrRing(ring r)
Definition: polys.cc:14
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
#define IDRING(a)
Definition: ipid.h:126
Definition: tok.h:96
Definition: tok.h:126
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
static void killlocals0(int v, idhdl *localhdl, const ring r)
Definition: ipshell.cc:290
BOOLEAN kQHWeight ( leftv  res,
leftv  v 
)

Definition at line 3029 of file ipshell.cc.

3030 {
3031  res->data=(char *)id_QHomWeight((ideal)v->Data(), currRing);
3032  if (res->data==NULL)
3033  res->data=(char *)new intvec(rVar(currRing));
3034  return FALSE;
3035 }
#define FALSE
Definition: auxiliary.h:140
const ideal
Definition: gb_hack.h:42
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
intvec * id_QHomWeight(ideal id, const ring r)
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1091
BOOLEAN kWeight ( leftv  res,
leftv  id 
)

Definition at line 3007 of file ipshell.cc.

3008 {
3009  ideal F=(ideal)id->Data();
3010  intvec * iv = new intvec(rVar(currRing));
3011  polyset s;
3012  int sl, n, i;
3013  int *x;
3014 
3015  res->data=(char *)iv;
3016  s = F->m;
3017  sl = IDELEMS(F) - 1;
3018  n = rVar(currRing);
3019  double wNsqr = (double)2.0 / (double)n;
3021  x = (int * )omAlloc(2 * (n + 1) * sizeof(int));
3022  wCall(s, sl, x, wNsqr, currRing);
3023  for (i = n; i!=0; i--)
3024  (*iv)[i-1] = x[i + n + 1];
3025  omFreeSize((ADDRESS)x, 2 * (n + 1) * sizeof(int));
3026  return FALSE;
3027 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:140
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
void * ADDRESS
Definition: auxiliary.h:161
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
double(* wFunctional)(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
Definition: weight.cc:28
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:19
poly * polyset
Definition: hutil.h:17
void wCall(poly *s, int sl, int *x, double wNsqr, const ring R)
Definition: weight.cc:116
Variable x
Definition: cfModGcd.cc:4023
void * Data()
Definition: subexpr.cc:1091
double wFunctionalBuch(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
Definition: weight0.c:82
void list_cmd ( int  typ,
const char *  what,
const char *  prefix,
BOOLEAN  iterate,
BOOLEAN  fullname = FALSE 
)

Definition at line 422 of file ipshell.cc.

423 {
424  package savePack=currPack;
425  idhdl h,start;
426  BOOLEAN all = typ<0;
427  BOOLEAN really_all=FALSE;
428 
429  if ( typ==0 )
430  {
431  if (strcmp(what,"all")==0)
432  {
433  if (currPack!=basePack)
434  list_cmd(-1,NULL,prefix,iterate,fullname); // list current package
435  really_all=TRUE;
436  h=basePack->idroot;
437  }
438  else
439  {
440  h = ggetid(what);
441  if (h!=NULL)
442  {
443  if (iterate) list1(prefix,h,TRUE,fullname);
444  if (IDTYP(h)==ALIAS_CMD) PrintS("A");
445  if ((IDTYP(h)==RING_CMD)
446  || (IDTYP(h)==QRING_CMD)
447  //|| (IDTYP(h)==PACKE_CMD)
448  )
449  {
450  h=IDRING(h)->idroot;
451  }
452  else if(IDTYP(h)==PACKAGE_CMD)
453  {
454  currPack=IDPACKAGE(h);
455  //Print("list_cmd:package\n");
456  all=TRUE;typ=PROC_CMD;fullname=TRUE;really_all=TRUE;
457  h=IDPACKAGE(h)->idroot;
458  }
459  else
460  {
461  currPack=savePack;
462  return;
463  }
464  }
465  else
466  {
467  Werror("%s is undefined",what);
468  currPack=savePack;
469  return;
470  }
471  }
472  all=TRUE;
473  }
474  else if (RingDependend(typ))
475  {
476  h = currRing->idroot;
477  }
478  else
479  h = IDROOT;
480  start=h;
481  while (h!=NULL)
482  {
483  if ((all
484  && (IDTYP(h)!=PROC_CMD)
485  &&(IDTYP(h)!=PACKAGE_CMD)
486  && (IDTYP(h)!=CRING_CMD))
487  || (typ == IDTYP(h))
488  || ((typ==RING_CMD) &&(IDTYP(h)==CRING_CMD))
489  || ((IDTYP(h)==QRING_CMD) && (typ==RING_CMD)))
490  {
491  list1(prefix,h,start==currRingHdl, fullname);
492  if (((IDTYP(h)==RING_CMD)||(IDTYP(h)==QRING_CMD))
493  && (really_all || (all && (h==currRingHdl)))
494  && ((IDLEV(h)==0)||(IDLEV(h)==myynest)))
495  {
496  list_cmd(0,IDID(h),"// ",FALSE);
497  }
498  if (IDTYP(h)==PACKAGE_CMD && really_all)
499  {
500  package save_p=currPack;
501  currPack=IDPACKAGE(h);
502  list_cmd(0,IDID(h),"// ",FALSE);
503  currPack=save_p;
504  }
505  }
506  h = IDNEXT(h);
507  }
508  currPack=savePack;
509 }
#define IDID(a)
Definition: ipid.h:121
#define FALSE
Definition: auxiliary.h:140
#define IDNEXT(a)
Definition: ipid.h:117
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:144
static void list1(const char *s, idhdl h, BOOLEAN c, BOOLEAN fullname)
Definition: ipshell.cc:151
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:138
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define IDTYP(a)
Definition: ipid.h:118
Definition: tok.h:56
int RingDependend(int t)
Definition: gentable.cc:23
void list_cmd(int typ, const char *what, const char *prefix, BOOLEAN iterate, BOOLEAN fullname)
Definition: ipshell.cc:422
idhdl currRingHdl
Definition: ipid.cc:64
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDLEV(a)
Definition: ipid.h:120
Definition: tok.h:38
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
#define IDRING(a)
Definition: ipid.h:126
package currPack
Definition: ipid.cc:62
Definition: tok.h:126
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void Werror(const char *fmt,...)
Definition: reporter.cc:199
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)
Definition: ipid.cc:487
BOOLEAN loNewtonP ( leftv  res,
leftv  arg1 
)

compute Newton Polytopes of input polynomials

Definition at line 4269 of file ipshell.cc.

4270 {
4271  res->data= (void*)loNewtonPolytope( (ideal)arg1->Data() );
4272  return FALSE;
4273 }
#define FALSE
Definition: auxiliary.h:140
const ideal
Definition: gb_hack.h:42
ideal loNewtonPolytope(const ideal id)
Definition: mpr_base.cc:3192
void * data
Definition: subexpr.h:89
void * Data()
Definition: subexpr.cc:1091
BOOLEAN loSimplex ( leftv  res,
leftv  args 
)

Implementation of the Simplex Algorithm.

For args, see class simplex.

Definition at line 4275 of file ipshell.cc.

4276 {
4277  if ( !(rField_is_long_R(currRing)) )
4278  {
4279  WerrorS("Ground field not implemented!");
4280  return TRUE;
4281  }
4282 
4283  simplex * LP;
4284  matrix m;
4285 
4286  leftv v= args;
4287  if ( v->Typ() != MATRIX_CMD ) // 1: matrix
4288  return TRUE;
4289  else
4290  m= (matrix)(v->CopyD());
4291 
4292  LP = new simplex(MATROWS(m),MATCOLS(m));
4293  LP->mapFromMatrix(m);
4294 
4295  v= v->next;
4296  if ( v->Typ() != INT_CMD ) // 2: m = number of constraints
4297  return TRUE;
4298  else
4299  LP->m= (int)(long)(v->Data());
4300 
4301  v= v->next;
4302  if ( v->Typ() != INT_CMD ) // 3: n = number of variables
4303  return TRUE;
4304  else
4305  LP->n= (int)(long)(v->Data());
4306 
4307  v= v->next;
4308  if ( v->Typ() != INT_CMD ) // 4: m1 = number of <= constraints
4309  return TRUE;
4310  else
4311  LP->m1= (int)(long)(v->Data());
4312 
4313  v= v->next;
4314  if ( v->Typ() != INT_CMD ) // 5: m2 = number of >= constraints
4315  return TRUE;
4316  else
4317  LP->m2= (int)(long)(v->Data());
4318 
4319  v= v->next;
4320  if ( v->Typ() != INT_CMD ) // 6: m3 = number of == constraints
4321  return TRUE;
4322  else
4323  LP->m3= (int)(long)(v->Data());
4324 
4325 #ifdef mprDEBUG_PROT
4326  Print("m (constraints) %d\n",LP->m);
4327  Print("n (columns) %d\n",LP->n);
4328  Print("m1 (<=) %d\n",LP->m1);
4329  Print("m2 (>=) %d\n",LP->m2);
4330  Print("m3 (==) %d\n",LP->m3);
4331 #endif
4332 
4333  LP->compute();
4334 
4335  lists lres= (lists)omAlloc( sizeof(slists) );
4336  lres->Init( 6 );
4337 
4338  lres->m[0].rtyp= MATRIX_CMD; // output matrix
4339  lres->m[0].data=(void*)LP->mapToMatrix(m);
4340 
4341  lres->m[1].rtyp= INT_CMD; // found a solution?
4342  lres->m[1].data=(void*)(long)LP->icase;
4343 
4344  lres->m[2].rtyp= INTVEC_CMD;
4345  lres->m[2].data=(void*)LP->posvToIV();
4346 
4347  lres->m[3].rtyp= INTVEC_CMD;
4348  lres->m[3].data=(void*)LP->zrovToIV();
4349 
4350  lres->m[4].rtyp= INT_CMD;
4351  lres->m[4].data=(void*)(long)LP->m;
4352 
4353  lres->m[5].rtyp= INT_CMD;
4354  lres->m[5].data=(void*)(long)LP->n;
4355 
4356  res->data= (void*)lres;
4357 
4358  return FALSE;
4359 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
matrix mapToMatrix(matrix m)
void compute()
#define Print
Definition: emacs.cc:83
Definition: tok.h:85
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
Linear Programming / Linear Optimization using Simplex - Algorithm.
Definition: mpr_numeric.h:194
#define TRUE
Definition: auxiliary.h:144
intvec * zrovToIV()
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:949
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
intvec * posvToIV()
BOOLEAN mapFromMatrix(matrix m)
ip_smatrix * matrix
int m
Definition: cfEzgcd.cc:119
Definition: tok.h:88
leftv next
Definition: subexpr.h:87
INLINE_THIS void Init(int l=0)
Definition: lists.h:66
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define MATCOLS(i)
Definition: matpol.h:28
slists * lists
Definition: mpr_numeric.h:146
static BOOLEAN rField_is_long_R(const ring r)
Definition: ring.h:482
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1091
#define MATROWS(i)
Definition: matpol.h:27
int icase
Definition: mpr_numeric.h:201
void * CopyD(int t)
Definition: subexpr.cc:656
BOOLEAN mpJacobi ( leftv  res,
leftv  a 
)

Definition at line 2773 of file ipshell.cc.

2774 {
2775  int i,j;
2776  matrix result;
2777  ideal id=(ideal)a->Data();
2778 
2779  result =mpNew(IDELEMS(id),rVar(currRing));
2780  for (i=1; i<=IDELEMS(id); i++)
2781  {
2782  for (j=1; j<=rVar(currRing); j++)
2783  {
2784  MATELEM(result,i,j) = pDiff(id->m[i-1],j);
2785  }
2786  }
2787  res->data=(char *)result;
2788  return FALSE;
2789 }
#define FALSE
Definition: auxiliary.h:140
const ideal
Definition: gb_hack.h:42
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:19
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
void * Data()
Definition: subexpr.cc:1091
#define pDiff(a, b)
Definition: polys.h:267
return result
Definition: facAbsBiFact.cc:76
#define MATELEM(mat, i, j)
Definition: matpol.h:29
BOOLEAN mpKoszul ( leftv  res,
leftv  c,
leftv  b,
leftv  id 
)

Definition at line 2795 of file ipshell.cc.

2796 {
2797  int n=(int)(long)b->Data();
2798  int d=(int)(long)c->Data();
2799  int k,l,sign,row,col;
2800  matrix result;
2801  ideal temp;
2802  BOOLEAN bo;
2803  poly p;
2804 
2805  if ((d>n) || (d<1) || (n<1))
2806  {
2807  res->data=(char *)mpNew(1,1);
2808  return FALSE;
2809  }
2810  int *choise = (int*)omAlloc(d*sizeof(int));
2811  if (id==NULL)
2812  temp=idMaxIdeal(1);
2813  else
2814  temp=(ideal)id->Data();
2815 
2816  k = binom(n,d);
2817  l = k*d;
2818  l /= n-d+1;
2819  result =mpNew(l,k);
2820  col = 1;
2821  idInitChoise(d,1,n,&bo,choise);
2822  while (!bo)
2823  {
2824  sign = 1;
2825  for (l=1;l<=d;l++)
2826  {
2827  if (choise[l-1]<=IDELEMS(temp))
2828  {
2829  p = pCopy(temp->m[choise[l-1]-1]);
2830  if (sign == -1) p = pNeg(p);
2831  sign *= -1;
2832  row = idGetNumberOfChoise(l-1,d,1,n,choise);
2833  MATELEM(result,row,col) = p;
2834  }
2835  }
2836  col++;
2837  idGetNextChoise(d,n,&bo,choise);
2838  }
2839  if (id==NULL) idDelete(&temp);
2840 
2841  res->data=(char *)result;
2842  return FALSE;
2843 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
Definition: ideals.h:38
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
const ideal
Definition: gb_hack.h:42
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define pNeg(p)
Definition: polys.h:169
int k
Definition: cfEzgcd.cc:93
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
polyrec * poly
Definition: hilb.h:10
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
#define IDELEMS(i)
Definition: simpleideals.h:19
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
#define NULL
Definition: omList.c:10
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)
void * Data()
Definition: subexpr.cc:1091
int idGetNumberOfChoise(int t, int d, int begin, int end, int *choise)
int BOOLEAN
Definition: auxiliary.h:131
int binom(int n, int r)
return result
Definition: facAbsBiFact.cc:76
int l
Definition: cfEzgcd.cc:94
int sign(const CanonicalForm &a)
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
#define MATELEM(mat, i, j)
Definition: matpol.h:29
BOOLEAN nuLagSolve ( leftv  res,
leftv  arg1,
leftv  arg2,
leftv  arg3 
)

find the (complex) roots an univariate polynomial Determines the roots of an univariate polynomial using Laguerres' root-solver.

Good for polynomials with low and middle degree (<40). Arguments 3: poly arg1 , int arg2 , int arg3 arg2>0: defines precision of fractional part if ground field is Q arg3: number of iterations for approximation of roots (default=2) Returns a list of all (complex) roots of the polynomial arg1

Definition at line 4384 of file ipshell.cc.

4385 {
4386 
4387  poly gls;
4388  gls= (poly)(arg1->Data());
4389  int howclean= (int)(long)arg3->Data();
4390 
4391  if ( !(rField_is_R(currRing) ||
4392  rField_is_Q(currRing) ||
4395  {
4396  WerrorS("Ground field not implemented!");
4397  return TRUE;
4398  }
4399 
4402  {
4403  unsigned long int ii = (unsigned long int)arg2->Data();
4404  setGMPFloatDigits( ii, ii );
4405  }
4406 
4407  if ( gls == NULL || pIsConstant( gls ) )
4408  {
4409  WerrorS("Input polynomial is constant!");
4410  return TRUE;
4411  }
4412 
4413  int ldummy;
4414  int deg= currRing->pLDeg( gls, &ldummy, currRing );
4415  // int deg= pDeg( gls );
4416  // int len= pLength( gls );
4417  int i,vpos=0;
4418  poly piter;
4419  lists elist;
4420  lists rlist;
4421 
4422  elist= (lists)omAlloc( sizeof(slists) );
4423  elist->Init( 0 );
4424 
4425  if ( rVar(currRing) > 1 )
4426  {
4427  piter= gls;
4428  for ( i= 1; i <= rVar(currRing); i++ )
4429  if ( pGetExp( piter, i ) )
4430  {
4431  vpos= i;
4432  break;
4433  }
4434  while ( piter )
4435  {
4436  for ( i= 1; i <= rVar(currRing); i++ )
4437  if ( (vpos != i) && (pGetExp( piter, i ) != 0) )
4438  {
4439  WerrorS("The input polynomial must be univariate!");
4440  return TRUE;
4441  }
4442  pIter( piter );
4443  }
4444  }
4445 
4446  rootContainer * roots= new rootContainer();
4447  number * pcoeffs= (number *)omAlloc( (deg+1) * sizeof( number ) );
4448  piter= gls;
4449  for ( i= deg; i >= 0; i-- )
4450  {
4451  //if ( piter ) Print("deg %d, pDeg(piter) %d\n",i,pTotaldegree(piter));
4452  if ( piter && pTotaldegree(piter) == i )
4453  {
4454  pcoeffs[i]= nCopy( pGetCoeff( piter ) );
4455  //nPrint( pcoeffs[i] );PrintS(" ");
4456  pIter( piter );
4457  }
4458  else
4459  {
4460  pcoeffs[i]= nInit(0);
4461  }
4462  }
4463 
4464 #ifdef mprDEBUG_PROT
4465  for (i=deg; i >= 0; i--)
4466  {
4467  nPrint( pcoeffs[i] );PrintS(" ");
4468  }
4469  PrintLn();
4470 #endif
4471 
4472  roots->fillContainer( pcoeffs, NULL, 1, deg, rootContainer::onepoly, 1 );
4473  roots->solver( howclean );
4474 
4475  int elem= roots->getAnzRoots();
4476  char *dummy;
4477  int j;
4478 
4479  rlist= (lists)omAlloc( sizeof(slists) );
4480  rlist->Init( elem );
4481 
4483  {
4484  for ( j= 0; j < elem; j++ )
4485  {
4486  rlist->m[j].rtyp=NUMBER_CMD;
4487  rlist->m[j].data=(void *)nCopy((number)(roots->getRoot(j)));
4488  //rlist->m[j].data=(void *)(number)(roots->getRoot(j));
4489  }
4490  }
4491  else
4492  {
4493  for ( j= 0; j < elem; j++ )
4494  {
4495  dummy = complexToStr( (*roots)[j], gmp_output_digits, currRing->cf );
4496  rlist->m[j].rtyp=STRING_CMD;
4497  rlist->m[j].data=(void *)dummy;
4498  }
4499  }
4500 
4501  elist->Clean();
4502  //omFreeSize( (ADDRESS) elist, sizeof(slists) );
4503 
4504  // this is (via fillContainer) the same data as in root
4505  //for ( i= deg; i >= 0; i-- ) nDelete( &pcoeffs[i] );
4506  //omFreeSize( (ADDRESS) pcoeffs, (deg+1) * sizeof( number ) );
4507 
4508  delete roots;
4509 
4510  res->rtyp= LIST_CMD;
4511  res->data= (void*)rlist;
4512 
4513  return FALSE;
4514 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
complex root finder for univariate polynomials based on laguers algorithm
Definition: mpr_numeric.h:65
sleftv * m
Definition: lists.h:45
void PrintLn()
Definition: reporter.cc:322
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
static BOOLEAN rField_is_R(const ring r)
Definition: ring.h:458
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
#define TRUE
Definition: auxiliary.h:144
bool solver(const int polishmode=PM_NONE)
Definition: mpr_numeric.cc:450
void WerrorS(const char *s)
Definition: feFopen.cc:23
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define nPrint(a)
only for debug, over any initalized currRing
Definition: numbers.h:46
void * data
Definition: subexpr.h:89
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
int j
Definition: myNF.cc:70
static long pTotaldegree(poly p)
Definition: polys.h:253
polyrec * poly
Definition: hilb.h:10
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:209
void fillContainer(number *_coeffs, number *_ievpoint, const int _var, const int _tdg, const rootType _rt, const int _anz)
Definition: mpr_numeric.cc:313
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:452
gmp_complex * getRoot(const int i)
Definition: mpr_numeric.h:88
static BOOLEAN rField_is_long_C(const ring r)
Definition: ring.h:485
INLINE_THIS void Init(int l=0)
Definition: lists.h:66
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int getAnzRoots()
Definition: mpr_numeric.h:97
static BOOLEAN rField_is_long_R(const ring r)
Definition: ring.h:482
int rtyp
Definition: subexpr.h:92
#define nCopy(n)
Definition: numbers.h:15
void Clean(ring r=currRing)
Definition: lists.h:25
void * Data()
Definition: subexpr.cc:1091
Definition: tok.h:96
char * complexToStr(gmp_complex &c, const unsigned int oprec, const coeffs src)
Definition: mpr_complex.cc:717
size_t gmp_output_digits
Definition: mpr_complex.cc:44
void setGMPFloatDigits(size_t digits, size_t rest)
Set size of mantissa digits - the number of output digits (basis 10) the size of mantissa consists of...
Definition: mpr_complex.cc:62
#define nInit(i)
Definition: numbers.h:24
BOOLEAN nuMPResMat ( leftv  res,
leftv  arg1,
leftv  arg2 
)

returns module representing the multipolynomial resultant matrix Arguments 2: ideal i, int k k=0: use sparse resultant matrix of Gelfand, Kapranov and Zelevinsky k=1: use resultant matrix of Macaulay (k=0 is default)

Definition at line 4361 of file ipshell.cc.

4362 {
4363  ideal gls = (ideal)(arg1->Data());
4364  int imtype= (int)(long)arg2->Data();
4365 
4366  uResultant::resMatType mtype= determineMType( imtype );
4367 
4368  // check input ideal ( = polynomial system )
4369  if ( mprIdealCheck( gls, arg1->Name(), mtype, true ) != mprOk )
4370  {
4371  return TRUE;
4372  }
4373 
4374  uResultant *resMat= new uResultant( gls, mtype, false );
4375  if (resMat!=NULL)
4376  {
4377  res->rtyp = MODUL_CMD;
4378  res->data= (void*)resMat->accessResMat()->getMatrix();
4379  if (!errorreported) delete resMat;
4380  }
4381  return errorreported;
4382 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
Base class for solving 0-dim poly systems using u-resultant.
Definition: mpr_base.h:62
resMatrixBase * accessResMat()
Definition: mpr_base.h:78
const ideal
Definition: gb_hack.h:42
#define TRUE
Definition: auxiliary.h:144
uResultant::resMatType determineMType(int imtype)
Definition: mpr_inout.cc:135
const char * Name()
Definition: subexpr.h:121
Definition: mpr_base.h:98
void * data
Definition: subexpr.h:89
virtual ideal getMatrix()
Definition: mpr_base.h:31
mprState mprIdealCheck(const ideal theIdeal, const char *name, uResultant::resMatType mtype, BOOLEAN rmatrix=false)
Definition: mpr_inout.cc:94
short errorreported
Definition: feFopen.cc:22
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1091
BOOLEAN nuUResSolve ( leftv  res,
leftv  args 
)

solve a multipolynomial system using the u-resultant Input ideal must be 0-dimensional and (currRing->N) == IDELEMS(ideal).

Resultant method can be MPR_DENSE, which uses Macaulay Resultant (good for dense homogeneous polynoms) or MPR_SPARSE, which uses Sparse Resultant (Gelfand, Kapranov, Zelevinsky). Arguments 4: ideal i, int k, int l, int m k=0: use sparse resultant matrix of Gelfand, Kapranov and Zelevinsky k=1: use resultant matrix of Macaulay (k=0 is default) l>0: defines precision of fractional part if ground field is Q m=0,1,2: number of iterations for approximation of roots (default=2) Returns a list containing the roots of the system.

Definition at line 4617 of file ipshell.cc.

4618 {
4619  leftv v= args;
4620 
4621  ideal gls;
4622  int imtype;
4623  int howclean;
4624 
4625  // get ideal
4626  if ( v->Typ() != IDEAL_CMD )
4627  return TRUE;
4628  else gls= (ideal)(v->Data());
4629  v= v->next;
4630 
4631  // get resultant matrix type to use (0,1)
4632  if ( v->Typ() != INT_CMD )
4633  return TRUE;
4634  else imtype= (int)(long)v->Data();
4635  v= v->next;
4636 
4637  if (imtype==0)
4638  {
4639  ideal test_id=idInit(1,1);
4640  int j;
4641  for(j=IDELEMS(gls)-1;j>=0;j--)
4642  {
4643  if (gls->m[j]!=NULL)
4644  {
4645  test_id->m[0]=gls->m[j];
4646  intvec *dummy_w=id_QHomWeight(test_id, currRing);
4647  if (dummy_w!=NULL)
4648  {
4649  WerrorS("Newton polytope not of expected dimension");
4650  delete dummy_w;
4651  return TRUE;
4652  }
4653  }
4654  }
4655  }
4656 
4657  // get and set precision in digits ( > 0 )
4658  if ( v->Typ() != INT_CMD )
4659  return TRUE;
4660  else if ( !(rField_is_R(currRing) || rField_is_long_R(currRing) || \
4662  {
4663  unsigned long int ii=(unsigned long int)v->Data();
4664  setGMPFloatDigits( ii, ii );
4665  }
4666  v= v->next;
4667 
4668  // get interpolation steps (0,1,2)
4669  if ( v->Typ() != INT_CMD )
4670  return TRUE;
4671  else howclean= (int)(long)v->Data();
4672 
4673  uResultant::resMatType mtype= determineMType( imtype );
4674  int i,count;
4675  lists listofroots= NULL;
4676  number smv= NULL;
4677  BOOLEAN interpolate_det= (mtype==uResultant::denseResMat)?TRUE:FALSE;
4678 
4679  //emptylist= (lists)omAlloc( sizeof(slists) );
4680  //emptylist->Init( 0 );
4681 
4682  //res->rtyp = LIST_CMD;
4683  //res->data= (void *)emptylist;
4684 
4685  // check input ideal ( = polynomial system )
4686  if ( mprIdealCheck( gls, args->Name(), mtype ) != mprOk )
4687  {
4688  return TRUE;
4689  }
4690 
4691  uResultant * ures;
4692  rootContainer ** iproots;
4693  rootContainer ** muiproots;
4694  rootArranger * arranger;
4695 
4696  // main task 1: setup of resultant matrix
4697  ures= new uResultant( gls, mtype );
4698  if ( ures->accessResMat()->initState() != resMatrixBase::ready )
4699  {
4700  WerrorS("Error occurred during matrix setup!");
4701  return TRUE;
4702  }
4703 
4704  // if dense resultant, check if minor nonsingular
4705  if ( mtype == uResultant::denseResMat )
4706  {
4707  smv= ures->accessResMat()->getSubDet();
4708 #ifdef mprDEBUG_PROT
4709  PrintS("// Determinant of submatrix: ");nPrint(smv);PrintLn();
4710 #endif
4711  if ( nIsZero(smv) )
4712  {
4713  WerrorS("Unsuitable input ideal: Minor of resultant matrix is singular!");
4714  return TRUE;
4715  }
4716  }
4717 
4718  // main task 2: Interpolate specialized resultant polynomials
4719  if ( interpolate_det )
4720  iproots= ures->interpolateDenseSP( false, smv );
4721  else
4722  iproots= ures->specializeInU( false, smv );
4723 
4724  // main task 3: Interpolate specialized resultant polynomials
4725  if ( interpolate_det )
4726  muiproots= ures->interpolateDenseSP( true, smv );
4727  else
4728  muiproots= ures->specializeInU( true, smv );
4729 
4730 #ifdef mprDEBUG_PROT
4731  int c= iproots[0]->getAnzElems();
4732  for (i=0; i < c; i++) pWrite(iproots[i]->getPoly());
4733  c= muiproots[0]->getAnzElems();
4734  for (i=0; i < c; i++) pWrite(muiproots[i]->getPoly());
4735 #endif
4736 
4737  // main task 4: Compute roots of specialized polys and match them up
4738  arranger= new rootArranger( iproots, muiproots, howclean );
4739  arranger->solve_all();
4740 
4741  // get list of roots
4742  if ( arranger->success() )
4743  {
4744  arranger->arrange();
4745  listofroots= listOfRoots(arranger, gmp_output_digits );
4746  }
4747  else
4748  {
4749  WerrorS("Solver was unable to find any roots!");
4750  return TRUE;
4751  }
4752 
4753  // free everything
4754  count= iproots[0]->getAnzElems();
4755  for (i=0; i < count; i++) delete iproots[i];
4756  omFreeSize( (ADDRESS) iproots, count * sizeof(rootContainer*) );
4757  count= muiproots[0]->getAnzElems();
4758  for (i=0; i < count; i++) delete muiproots[i];
4759  omFreeSize( (ADDRESS) muiproots, count * sizeof(rootContainer*) );
4760 
4761  delete ures;
4762  delete arranger;
4763  nDelete( &smv );
4764 
4765  res->data= (void *)listofroots;
4766 
4767  //emptylist->Clean();
4768  // omFreeSize( (ADDRESS) emptylist, sizeof(slists) );
4769 
4770  return FALSE;
4771 }
int status int void size_t count
Definition: si_signals.h:58
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
complex root finder for univariate polynomials based on laguers algorithm
Definition: mpr_numeric.h:65
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
void PrintLn()
Definition: reporter.cc:322
Base class for solving 0-dim poly systems using u-resultant.
Definition: mpr_base.h:62
Definition: tok.h:85
Definition: lists.h:22
virtual IStateType initState() const
Definition: mpr_base.h:41
#define FALSE
Definition: auxiliary.h:140
static BOOLEAN rField_is_R(const ring r)
Definition: ring.h:458
resMatrixBase * accessResMat()
Definition: mpr_base.h:78
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
intvec * id_QHomWeight(ideal id, const ring r)
#define TRUE
Definition: auxiliary.h:144
uResultant::resMatType determineMType(int imtype)
Definition: mpr_inout.cc:135
void * ADDRESS
Definition: auxiliary.h:161
void pWrite(poly p)
Definition: polys.h:279
void WerrorS(const char *s)
Definition: feFopen.cc:23
int getAnzElems()
Definition: mpr_numeric.h:95
rootContainer ** specializeInU(BOOLEAN matchUp=false, const number subDetVal=NULL)
Definition: mpr_base.cc:3060
int Typ()
Definition: subexpr.cc:949
const char * Name()
Definition: subexpr.h:121
Definition: mpr_base.h:98
#define nPrint(a)
only for debug, over any initalized currRing
Definition: numbers.h:46
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
int j
Definition: myNF.cc:70
bool success()
Definition: mpr_numeric.h:162
void arrange()
Definition: mpr_numeric.cc:896
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
void solve_all()
Definition: mpr_numeric.cc:871
#define IDELEMS(i)
Definition: simpleideals.h:19
mprState mprIdealCheck(const ideal theIdeal, const char *name, uResultant::resMatType mtype, BOOLEAN rmatrix=false)
Definition: mpr_inout.cc:94
rootContainer ** interpolateDenseSP(BOOLEAN matchUp=false, const number subDetVal=NULL)
Definition: mpr_base.cc:2922
#define nDelete(n)
Definition: numbers.h:16
leftv next
Definition: subexpr.h:87
static BOOLEAN rField_is_long_C(const ring r)
Definition: ring.h:485
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
static BOOLEAN rField_is_long_R(const ring r)
Definition: ring.h:482
void * Data()
Definition: subexpr.cc:1091
size_t gmp_output_digits
Definition: mpr_complex.cc:44
void setGMPFloatDigits(size_t digits, size_t rest)
Set size of mantissa digits - the number of output digits (basis 10) the size of mantissa consists of...
Definition: mpr_complex.cc:62
int BOOLEAN
Definition: auxiliary.h:131
lists listOfRoots(rootArranger *self, const unsigned int oprec)
Definition: ipshell.cc:4774
virtual number getSubDet()
Definition: mpr_base.h:37
BOOLEAN nuVanderSys ( leftv  res,
leftv  arg1,
leftv  arg2,
leftv  arg3 
)

COMPUTE: polynomial p with values given by v at points p1,..,pN derived from p; more precisely: consider p as point in K^n and v as N elements in K, let p1,..,pN be the points in K^n obtained by evaluating all monomials of degree 0,1,...,N at p in lexicographical order, then the procedure computes the polynomial f satisfying f(pi) = v[i] RETURN: polynomial f of degree d.

Definition at line 4516 of file ipshell.cc.

4517 {
4518  int i;
4519  ideal p,w;
4520  p= (ideal)arg1->Data();
4521  w= (ideal)arg2->Data();
4522 
4523  // w[0] = f(p^0)
4524  // w[1] = f(p^1)
4525  // ...
4526  // p can be a vector of numbers (multivariate polynom)
4527  // or one number (univariate polynom)
4528  // tdg = deg(f)
4529 
4530  int n= IDELEMS( p );
4531  int m= IDELEMS( w );
4532  int tdg= (int)(long)arg3->Data();
4533 
4534  res->data= (void*)NULL;
4535 
4536  // check the input
4537  if ( tdg < 1 )
4538  {
4539  WerrorS("Last input parameter must be > 0!");
4540  return TRUE;
4541  }
4542  if ( n != rVar(currRing) )
4543  {
4544  Werror("Size of first input ideal must be equal to %d!",rVar(currRing));
4545  return TRUE;
4546  }
4547  if ( m != (int)pow((double)tdg+1,(double)n) )
4548  {
4549  Werror("Size of second input ideal must be equal to %d!",
4550  (int)pow((double)tdg+1,(double)n));
4551  return TRUE;
4552  }
4553  if ( !(rField_is_Q(currRing) /* ||
4554  rField_is_R() || rField_is_long_R() ||
4555  rField_is_long_C()*/ ) )
4556  {
4557  WerrorS("Ground field not implemented!");
4558  return TRUE;
4559  }
4560 
4561  number tmp;
4562  number *pevpoint= (number *)omAlloc( n * sizeof( number ) );
4563  for ( i= 0; i < n; i++ )
4564  {
4565  pevpoint[i]=nInit(0);
4566  if ( (p->m)[i] )
4567  {
4568  tmp = pGetCoeff( (p->m)[i] );
4569  if ( nIsZero(tmp) || nIsOne(tmp) || nIsMOne(tmp) )
4570  {
4571  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4572  WerrorS("Elements of first input ideal must not be equal to -1, 0, 1!");
4573  return TRUE;
4574  }
4575  } else tmp= NULL;
4576  if ( !nIsZero(tmp) )
4577  {
4578  if ( !pIsConstant((p->m)[i]))
4579  {
4580  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4581  WerrorS("Elements of first input ideal must be numbers!");
4582  return TRUE;
4583  }
4584  pevpoint[i]= nCopy( tmp );
4585  }
4586  }
4587 
4588  number *wresults= (number *)omAlloc( m * sizeof( number ) );
4589  for ( i= 0; i < m; i++ )
4590  {
4591  wresults[i]= nInit(0);
4592  if ( (w->m)[i] && !nIsZero(pGetCoeff((w->m)[i])) )
4593  {
4594  if ( !pIsConstant((w->m)[i]))
4595  {
4596  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4597  omFreeSize( (ADDRESS)wresults, m * sizeof( number ) );
4598  WerrorS("Elements of second input ideal must be numbers!");
4599  return TRUE;
4600  }
4601  wresults[i]= nCopy(pGetCoeff((w->m)[i]));
4602  }
4603  }
4604 
4605  vandermonde vm( m, n, tdg, pevpoint, FALSE );
4606  number *ncpoly= vm.interpolateDense( wresults );
4607  // do not free ncpoly[]!!
4608  poly rpoly= vm.numvec2poly( ncpoly );
4609 
4610  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4611  omFreeSize( (ADDRESS)wresults, m * sizeof( number ) );
4612 
4613  res->data= (void*)rpoly;
4614  return FALSE;
4615 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
vandermonde system solver for interpolating polynomials from their values
Definition: mpr_numeric.h:28
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
void * ADDRESS
Definition: auxiliary.h:161
void WerrorS(const char *s)
Definition: feFopen.cc:23
#define nIsMOne(n)
Definition: numbers.h:26
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
polyrec * poly
Definition: hilb.h:10
int m
Definition: cfEzgcd.cc:119
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:209
int i
Definition: cfEzgcd.cc:123
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:452
#define IDELEMS(i)
Definition: simpleideals.h:19
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define nCopy(n)
Definition: numbers.h:15
void * Data()
Definition: subexpr.cc:1091
#define nInit(i)
Definition: numbers.h:24
Rational pow(const Rational &a, int e)
Definition: GMPrat.cc:418
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void paPrint ( const char *  n,
package  p 
)

Definition at line 6019 of file ipshell.cc.

6020 {
6021  Print(" %s (",n);
6022  switch (p->language)
6023  {
6024  case LANG_SINGULAR: PrintS("S"); break;
6025  case LANG_C: PrintS("C"); break;
6026  case LANG_TOP: PrintS("T"); break;
6027  case LANG_NONE: PrintS("N"); break;
6028  default: PrintS("U");
6029  }
6030  if(p->libname!=NULL)
6031  Print(",%s", p->libname);
6032  PrintS(")");
6033 }
#define Print
Definition: emacs.cc:83
return P p
Definition: myNF.cc:203
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
Definition: subexpr.h:20
void PrintS(const char *s)
Definition: reporter.cc:294
#define NULL
Definition: omList.c:10
idhdl rDefault ( const char *  s)

Definition at line 1645 of file ipshell.cc.

1646 {
1647  idhdl tmp=NULL;
1648 
1649  if (s!=NULL) tmp = enterid(s, myynest, RING_CMD, &IDROOT);
1650  if (tmp==NULL) return NULL;
1651 
1652 // if ((currRing->ppNoether)!=NULL) pDelete(&(currRing->ppNoether));
1654  {
1656  memset(&sLastPrinted,0,sizeof(sleftv));
1657  }
1658 
1659  ring r = IDRING(tmp);
1660 
1661  r->cf = nInitChar(n_Zp, (void*)32003); // r->cf->ch = 32003;
1662  r->N = 3;
1663  /*r->P = 0; Alloc0 in idhdl::set, ipid.cc*/
1664  /*names*/
1665  r->names = (char **) omAlloc0(3 * sizeof(char_ptr));
1666  r->names[0] = omStrDup("x");
1667  r->names[1] = omStrDup("y");
1668  r->names[2] = omStrDup("z");
1669  /*weights: entries for 3 blocks: NULL*/
1670  r->wvhdl = (int **)omAlloc0(3 * sizeof(int_ptr));
1671  /*order: dp,C,0*/
1672  r->order = (int *) omAlloc(3 * sizeof(int *));
1673  r->block0 = (int *)omAlloc0(3 * sizeof(int *));
1674  r->block1 = (int *)omAlloc0(3 * sizeof(int *));
1675  /* ringorder dp for the first block: var 1..3 */
1676  r->order[0] = ringorder_dp;
1677  r->block0[0] = 1;
1678  r->block1[0] = 3;
1679  /* ringorder C for the second block: no vars */
1680  r->order[1] = ringorder_C;
1681  /* the last block: everything is 0 */
1682  r->order[2] = 0;
1683 
1684  /* complete ring intializations */
1685  rComplete(r);
1686  rSetHdl(tmp);
1687  return currRingHdl;
1688 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
{p < 2^31}
Definition: coeffs.h:29
#define IDROOT
Definition: ipid.h:20
#define omAlloc(size)
Definition: omAllocDecl.h:210
Definition: idrec.h:34
int myynest
Definition: febase.cc:46
char * char_ptr
Definition: structs.h:56
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:256
const ring r
Definition: syzextra.cc:208
BOOLEAN RingDependend()
Definition: subexpr.cc:369
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3371
idhdl currRingHdl
Definition: ipid.cc:64
#define NULL
Definition: omList.c:10
#define IDRING(a)
Definition: ipid.h:126
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
void rSetHdl(idhdl h)
Definition: ipshell.cc:4821
int * int_ptr
Definition: structs.h:57
#define omAlloc0(size)
Definition: omAllocDecl.h:211
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:316
#define omStrDup(s)
Definition: omAllocDecl.h:263
idhdl rFindHdl ( ring  r,
idhdl  n 
)

Definition at line 1690 of file ipshell.cc.

1691 {
1693  if (h!=NULL) return h;
1694  if (IDROOT!=basePack->idroot) h=rSimpleFindHdl(r,basePack->idroot,n);
1695  if (h!=NULL) return h;
1697  while(p!=NULL)
1698  {
1699  if ((p->cPack!=basePack)
1700  && (p->cPack!=currPack))
1701  h=rSimpleFindHdl(r,p->cPack->idroot,n);
1702  if (h!=NULL) return h;
1703  p=p->next;
1704  }
1705  idhdl tmp=basePack->idroot;
1706  while (tmp!=NULL)
1707  {
1708  if (IDTYP(tmp)==PACKAGE_CMD)
1709  h=rSimpleFindHdl(r,IDPACKAGE(tmp)->idroot,n);
1710  if (h!=NULL) return h;
1711  tmp=IDNEXT(tmp);
1712  }
1713  return NULL;
1714 }
idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n)
Definition: ipshell.cc:5903
return P p
Definition: myNF.cc:203
#define IDNEXT(a)
Definition: ipid.h:117
proclevel * procstack
Definition: ipid.cc:57
#define IDROOT
Definition: ipid.h:20
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:138
#define IDTYP(a)
Definition: ipid.h:118
const ring r
Definition: syzextra.cc:208
Definition: ipid.h:56
proclevel * next
Definition: ipid.h:59
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
package currPack
Definition: ipid.cc:62
static Poly * h
Definition: janet.cc:978
package cPack
Definition: ipid.h:63
ring rInit ( sleftv pn,
sleftv rv,
sleftv ord 
)

Definition at line 5304 of file ipshell.cc.

5305 {
5306 #ifdef HAVE_RINGS
5307  //unsigned int ringtype = 0;
5308  mpz_ptr modBase = NULL;
5309  unsigned int modExponent = 1;
5310 #endif
5311  int float_len=0;
5312  int float_len2=0;
5313  ring R = NULL;
5314  //BOOLEAN ffChar=FALSE;
5315 
5316  /* ch -------------------------------------------------------*/
5317  // get ch of ground field
5318 
5319  // allocated ring
5320  R = (ring) omAlloc0Bin(sip_sring_bin);
5321 
5322  coeffs cf = NULL;
5323 
5324  assume( pn != NULL );
5325  const int P = pn->listLength();
5326 
5327  if ((pn->Typ()==CRING_CMD)&&(P==1))
5328  {
5329  cf=(coeffs)pn->CopyD();
5330  assume( cf != NULL );
5331  }
5332  else if (pn->Typ()==INT_CMD)
5333  {
5334  int ch = (int)(long)pn->Data();
5335 
5336  /* parameter? -------------------------------------------------------*/
5337  pn = pn->next;
5338 
5339  if (pn == NULL) // no params!?
5340  {
5341  if (ch!=0)
5342  {
5343  int ch2=IsPrime(ch);
5344  if ((ch<2)||(ch!=ch2))
5345  {
5346  Warn("%d is invalid as characteristic of the ground field. 32003 is used.", ch);
5347  ch=32003;
5348  }
5349  cf = nInitChar(n_Zp, (void*)(long)ch);
5350  }
5351  else
5352  cf = nInitChar(n_Q, (void*)(long)ch);
5353  }
5354  else
5355  {
5356  const int pars = pn->listLength();
5357 
5358  assume( pars > 0 );
5359 
5360  // predefined finite field: (p^k, a)
5361  if ((ch!=0) && (ch!=IsPrime(ch)) && (pars == 1))
5362  {
5363  GFInfo param;
5364 
5365  param.GFChar = ch;
5366  param.GFDegree = 1;
5367  param.GFPar_name = pn->name;
5368 
5369  cf = nInitChar(n_GF, &param);
5370  }
5371  else // (0/p, a, b, ..., z)
5372  {
5373  if ((ch!=0) && (ch!=IsPrime(ch)))
5374  {
5375  WerrorS("too many parameters");
5376  goto rInitError;
5377  }
5378 
5379  char ** names = (char**)omAlloc0(pars * sizeof(char_ptr));
5380 
5381  if (rSleftvList2StringArray(pn, names))
5382  {
5383  WerrorS("parameter expected");
5384  goto rInitError;
5385  }
5386 
5387  TransExtInfo extParam;
5388 
5389  extParam.r = rDefault( ch, pars, names); // Q/Zp [ p_1, ... p_pars ]
5390  for(int i=pars-1; i>=0;i--)
5391  {
5392  omFree(names[i]);
5393  }
5394  omFree(names);
5395 
5396  cf = nInitChar(n_transExt, &extParam);
5397  }
5398  }
5399 
5400 // if (cf==NULL) goto rInitError;
5401  assume( cf != NULL );
5402  }
5403  else if ((pn->name != NULL)
5404  && ((strcmp(pn->name,"real")==0) || (strcmp(pn->name,"complex")==0)))
5405  {
5406  BOOLEAN complex_flag=(strcmp(pn->name,"complex")==0);
5407  if ((pn->next!=NULL) && (pn->next->Typ()==INT_CMD))
5408  {
5409  float_len=(int)(long)pn->next->Data();
5410  float_len2=float_len;
5411  pn=pn->next;
5412  if ((pn->next!=NULL) && (pn->next->Typ()==INT_CMD))
5413  {
5414  float_len2=(int)(long)pn->next->Data();
5415  pn=pn->next;
5416  }
5417  }
5418 
5419  if (!complex_flag)
5420  complex_flag= pn->next != NULL;
5421  if( !complex_flag && (float_len2 <= (short)SHORT_REAL_LENGTH))
5422  cf=nInitChar(n_R, NULL);
5423  else // longR or longC?
5424  {
5425  LongComplexInfo param;
5426 
5427  param.float_len = si_min (float_len, 32767);
5428  param.float_len2 = si_min (float_len2, 32767);
5429 
5430  // set the parameter name
5431  if (complex_flag)
5432  {
5433  if (param.float_len < SHORT_REAL_LENGTH)
5434  {
5437  }
5438  if (pn->next == NULL)
5439  param.par_name=(const char*)"i"; //default to i
5440  else
5441  param.par_name = (const char*)pn->next->name;
5442  }
5443 
5444  cf = nInitChar(complex_flag ? n_long_C: n_long_R, (void*)&param);
5445  }
5446  assume( cf != NULL );
5447  }
5448 #ifdef HAVE_RINGS
5449  else if ((pn->name != NULL) && (strcmp(pn->name, "integer") == 0))
5450  {
5451  // TODO: change to use coeffs_BIGINT!?
5452  modBase = (mpz_ptr) omAlloc(sizeof(mpz_t));
5453  mpz_init_set_si(modBase, 0);
5454  if (pn->next!=NULL)
5455  {
5456  if (pn->next->Typ()==INT_CMD)
5457  {
5458  mpz_set_ui(modBase, (int)(long) pn->next->Data());
5459  pn=pn->next;
5460  if ((pn->next!=NULL) && (pn->next->Typ()==INT_CMD))
5461  {
5462  modExponent = (long) pn->next->Data();
5463  pn=pn->next;
5464  }
5465  while ((pn->next!=NULL) && (pn->next->Typ()==INT_CMD))
5466  {
5467  mpz_mul_ui(modBase, modBase, (int)(long) pn->next->Data());
5468  pn=pn->next;
5469  }
5470  }
5471  else if (pn->next->Typ()==BIGINT_CMD)
5472  {
5473  number p=(number)pn->next->CopyD(); // FIXME: why CopyD() here if nlGMP should not overtake p!?
5474  nlGMP(p,(number)modBase,coeffs_BIGINT); // TODO? // extern void nlGMP(number &i, number n, const coeffs r); // FIXME: n_MPZ( modBase, p, coeffs_BIGINT); ?
5475  n_Delete(&p,coeffs_BIGINT);
5476  }
5477  }
5478  else
5479  cf=nInitChar(n_Z,NULL);
5480 
5481  if ((mpz_cmp_ui(modBase, 1) == 0) && (mpz_cmp_ui(modBase, 0) < 0))
5482  {
5483  Werror("Wrong ground ring specification (module is 1)");
5484  goto rInitError;
5485  }
5486  if (modExponent < 1)
5487  {
5488  Werror("Wrong ground ring specification (exponent smaller than 1");
5489  goto rInitError;
5490  }
5491  // module is 0 ---> integers ringtype = 4;
5492  // we have an exponent
5493  if (modExponent > 1 && cf == NULL)
5494  {
5495  if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*sizeof(unsigned long)))
5496  {
5497  /* this branch should be active for modExponent = 2..32 resp. 2..64,
5498  depending on the size of a long on the respective platform */
5499  //ringtype = 1; // Use Z/2^ch
5500  cf=nInitChar(n_Z2m,(void*)(long)modExponent);
5501  mpz_clear(modBase);
5502  omFreeSize (modBase, sizeof (mpz_t));
5503  }
5504  else
5505  {
5506  if (mpz_cmp_ui(modBase,0)==0)
5507  {
5508  WerrorS("modulus must not be 0 or parameter not allowed");
5509  goto rInitError;
5510  }
5511  //ringtype = 3;
5512  ZnmInfo info;
5513  info.base= modBase;
5514  info.exp= modExponent;
5515  cf=nInitChar(n_Znm,(void*) &info); //exponent is missing
5516  }
5517  }
5518  // just a module m > 1
5519  else if (cf == NULL)
5520  {
5521  if (mpz_cmp_ui(modBase,0)==0)
5522  {
5523  WerrorS("modulus must not be 0 or parameter not allowed");
5524  goto rInitError;
5525  }
5526  //ringtype = 2;
5527  ZnmInfo info;
5528  info.base= modBase;
5529  info.exp= modExponent;
5530  cf=nInitChar(n_Zn,(void*) &info);
5531  }
5532  assume( cf != NULL );
5533  }
5534 #endif
5535  // ring NEW = OLD, (), (); where OLD is a polynomial ring...
5536  else if ((pn->Typ()==RING_CMD) && (P == 1))
5537  {
5538  TransExtInfo extParam;
5539  extParam.r = (ring)pn->Data();
5540  cf = nInitChar(n_transExt, &extParam);
5541  }
5542  else if ((pn->Typ()==QRING_CMD) && (P == 1)) // same for qrings - which should be fields!?
5543  {
5544  AlgExtInfo extParam;
5545  extParam.r = (ring)pn->Data();
5546 
5547  cf = nInitChar(n_algExt, &extParam); // Q[a]/<minideal>
5548  }
5549  else
5550  {
5551  Werror("Wrong or unknown ground field specification");
5552 #ifndef SING_NDEBUG
5553  sleftv* p = pn;
5554  while (p != NULL)
5555  {
5556  Print( "pn[%p]: type: %d [%s]: %p, name: %s", (void*)p, p->Typ(), Tok2Cmdname(p->Typ()), p->Data(), (p->name == NULL? "NULL" : p->name) );
5557  PrintLn();
5558  p = p->next;
5559  }
5560 #endif
5561  goto rInitError;
5562  }
5563 // pn=pn->next;
5564 
5565  /*every entry in the new ring is initialized to 0*/
5566 
5567  /* characteristic -----------------------------------------------*/
5568  /* input: 0 ch=0 : Q parameter=NULL ffChar=FALSE float_len
5569  * 0 1 : Q(a,...) *names FALSE
5570  * 0 -1 : R NULL FALSE 0
5571  * 0 -1 : R NULL FALSE prec. >6
5572  * 0 -1 : C *names FALSE prec. 0..?
5573  * p p : Fp NULL FALSE
5574  * p -p : Fp(a) *names FALSE
5575  * q q : GF(q=p^n) *names TRUE
5576  */
5577  if (cf==NULL)
5578  {
5579  Werror("Invalid ground field specification");
5580  goto rInitError;
5581 // const int ch=32003;
5582 // cf=nInitChar(n_Zp, (void*)(long)ch);
5583  }
5584 
5585  assume( R != NULL );
5586 
5587  R->cf = cf;
5588 
5589  /* names and number of variables-------------------------------------*/
5590  {
5591  int l=rv->listLength();
5592 
5593  if (l>MAX_SHORT)
5594  {
5595  Werror("too many ring variables(%d), max is %d",l,MAX_SHORT);
5596  goto rInitError;
5597  }
5598  R->N = l; /*rv->listLength();*/
5599  }
5600  R->names = (char **)omAlloc0(R->N * sizeof(char_ptr));
5601  if (rSleftvList2StringArray(rv, R->names))
5602  {
5603  WerrorS("name of ring variable expected");
5604  goto rInitError;
5605  }
5606 
5607  /* check names and parameters for conflicts ------------------------- */
5608  rRenameVars(R); // conflicting variables will be renamed
5609  /* ordering -------------------------------------------------------------*/
5610  if (rSleftvOrdering2Ordering(ord, R))
5611  goto rInitError;
5612 
5613  // Complete the initialization
5614  if (rComplete(R,1))
5615  goto rInitError;
5616 
5617 /*#ifdef HAVE_RINGS
5618 // currently, coefficients which are ring elements require a global ordering:
5619  if (rField_is_Ring(R) && (R->OrdSgn==-1))
5620  {
5621  WerrorS("global ordering required for these coefficients");
5622  goto rInitError;
5623  }
5624 #endif*/
5625 
5626  rTest(R);
5627 
5628  // try to enter the ring into the name list
5629  // need to clean up sleftv here, before this ring can be set to
5630  // new currRing or currRing can be killed beacuse new ring has
5631  // same name
5632  if (pn != NULL) pn->CleanUp();
5633  if (rv != NULL) rv->CleanUp();
5634  if (ord != NULL) ord->CleanUp();
5635  //if ((tmp = enterid(s, myynest, RING_CMD, &IDROOT))==NULL)
5636  // goto rInitError;
5637 
5638  //memcpy(IDRING(tmp),R,sizeof(*R));
5639  // set current ring
5640  //omFreeBin(R, ip_sring_bin);
5641  //return tmp;
5642  return R;
5643 
5644  // error case:
5645  rInitError:
5646  if ((R != NULL)&&(R->cf!=NULL)) rDelete(R);
5647  if (pn != NULL) pn->CleanUp();
5648  if (rv != NULL) rv->CleanUp();
5649  if (ord != NULL) ord->CleanUp();
5650  return NULL;
5651 }
mpz_ptr base
Definition: rmodulon.h:18
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
only used if HAVE_RINGS is defined: ?
Definition: coeffs.h:42
Definition: tok.h:85
ring r
Definition: algext.h:40
#define SHORT_REAL_LENGTH
Definition: numbers.h:54
const short MAX_SHORT
Definition: ipshell.cc:5291
only used if HAVE_RINGS is defined: ?
Definition: coeffs.h:44
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:37
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
BOOLEAN rSleftvOrdering2Ordering(sleftv *ord, ring R)
Definition: ipshell.cc:4987
Definition: tok.h:42
return P p
Definition: myNF.cc:203
rational (GMP) numbers
Definition: coeffs.h:30
const char * GFPar_name
Definition: coeffs.h:94
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
{p < 2^31}
Definition: coeffs.h:29
int listLength()
Definition: subexpr.cc:61
void WerrorS(const char *s)
Definition: feFopen.cc:23
void nlGMP(number &i, number n, const coeffs r)
Definition: longrat.cc:1397
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:949
#define omAlloc(size)
Definition: omAllocDecl.h:210
Creation data needed for finite fields.
Definition: coeffs.h:90
idhdl rDefault(const char *s)
Definition: ipshell.cc:1645
real floating point (GMP) numbers
Definition: coeffs.h:33
short float_len2
additional char-flags, rInit
Definition: coeffs.h:100
char * char_ptr
Definition: structs.h:56
single prescision (6,6) real numbers
Definition: coeffs.h:31
Definition: tok.h:56
short float_len
additional char-flags, rInit
Definition: coeffs.h:99
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3371
only used if HAVE_RINGS is defined: ?
Definition: coeffs.h:43
const char * name
Definition: subexpr.h:88
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:405
The main handler for Singular numbers which are suitable for Singular polynomials.
int GFDegree
Definition: coeffs.h:93
complex floating point (GMP) numbers
Definition: coeffs.h:40
#define rTest(r)
Definition: ring.h:769
omBin sip_sring_bin
Definition: ring.cc:54
only used if HAVE_RINGS is defined: ?
Definition: coeffs.h:41
struct for passing initialization parameters to naInitChar
Definition: transext.h:92
unsigned long exp
Definition: rmodulon.h:18
#define info
Definition: libparse.cc:1254
int IsPrime(int p)
Definition: ipshell.cc:633
int i
Definition: cfEzgcd.cc:123
static void rRenameVars(ring R)
Definition: ipshell.cc:2214
leftv next
Definition: subexpr.h:87
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
int GFChar
Definition: coeffs.h:92
CanonicalForm cf
Definition: cfModGcd.cc:4024
#define NULL
Definition: omList.c:10
{p^n < 2^16}
Definition: coeffs.h:32
struct for passing initialization parameters to naInitChar
Definition: algext.h:40
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic ...
Definition: coeffs.h:34
#define R
Definition: sirandom.c:26
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
void * Data()
Definition: subexpr.cc:1091
const char * par_name
parameter name
Definition: coeffs.h:101
Definition: tok.h:126
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
kBucketDestroy & P
Definition: myNF.cc:191
BOOLEAN rSleftvList2StringArray(sleftv *sl, char **p)
Definition: ipshell.cc:5260
int BOOLEAN
Definition: auxiliary.h:131
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void * CopyD(int t)
Definition: subexpr.cc:656
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:316
#define Warn
Definition: emacs.cc:80
void rKill ( idhdl  h)

Definition at line 5884 of file ipshell.cc.

5885 {
5886  ring r = IDRING(h);
5887  int ref=0;
5888  if (r!=NULL)
5889  {
5890  ref=r->ref;
5891  rKill(r);
5892  }
5893  if (h==currRingHdl)
5894  {
5895  if (ref<=0) { currRing=NULL; currRingHdl=NULL;}
5896  else
5897  {
5899  }
5900  }
5901 }
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
const ring r
Definition: syzextra.cc:208
void rKill(ring r)
Definition: ipshell.cc:5815
idhdl currRingHdl
Definition: ipid.cc:64
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1690
#define NULL
Definition: omList.c:10
#define IDRING(a)
Definition: ipid.h:126
void rKill ( ring  r)

Definition at line 5815 of file ipshell.cc.

5816 {
5817  if ((r->ref<=0)&&(r->order!=NULL))
5818  {
5819 #ifdef RDEBUG
5820  if (traceit &TRACE_SHOW_RINGS) Print("kill ring %lx\n",(long)r);
5821 #endif
5822  if (r->qideal!=NULL)
5823  {
5824  id_Delete(&r->qideal, r);
5825  r->qideal = NULL;
5826  }
5827  int j;
5828 #ifdef USE_IILOCALRING
5829  for (j=0;j<myynest;j++)
5830  {
5831  if (iiLocalRing[j]==r)
5832  {
5833  if (j+1==myynest) Warn("killing the basering for level %d",j);
5834  iiLocalRing[j]=NULL;
5835  }
5836  }
5837 #else /* USE_IILOCALRING */
5838 //#endif /* USE_IILOCALRING */
5839  {
5840  proclevel * nshdl = procstack;
5841  int lev=myynest-1;
5842 
5843  for(; nshdl != NULL; nshdl = nshdl->next)
5844  {
5845  if (nshdl->cRing==r)
5846  {
5847  Warn("killing the basering for level %d",lev);
5848  nshdl->cRing=NULL;
5849  nshdl->cRingHdl=NULL;
5850  }
5851  }
5852  }
5853 #endif /* USE_IILOCALRING */
5854 // any variables depending on r ?
5855  while (r->idroot!=NULL)
5856  {
5857  r->idroot->lev=myynest; // avoid warning about kill global objects
5858  killhdl2(r->idroot,&(r->idroot),r);
5859  }
5860  if (r==currRing)
5861  {
5862  // all dependend stuff is done, clean global vars:
5863  if ((currRing->ppNoether)!=NULL) pDelete(&(currRing->ppNoether));
5865  {
5867  }
5868  //if ((myynest>0) && (iiRETURNEXPR.RingDependend()))
5869  //{
5870  // WerrorS("return value depends on local ring variable (export missing ?)");
5871  // iiRETURNEXPR.CleanUp();
5872  //}
5873  currRing=NULL;
5874  currRingHdl=NULL;
5875  }
5876 
5877  /* nKillChar(r); will be called from inside of rDelete */
5878  rDelete(r);
5879  return;
5880  }
5881  r->ref--;
5882 }
#define TRACE_SHOW_RINGS
Definition: reporter.h:28
#define Print
Definition: emacs.cc:83
proclevel * procstack
Definition: ipid.cc:57
void id_Delete(ideal *h, ring r)
int traceit
Definition: febase.cc:47
idhdl cRingHdl
Definition: ipid.h:60
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:400
const ring r
Definition: syzextra.cc:208
BOOLEAN RingDependend()
Definition: subexpr.cc:369
int j
Definition: myNF.cc:70
Definition: ipid.h:56
idhdl currRingHdl
Definition: ipid.cc:64
proclevel * next
Definition: ipid.h:59
ring * iiLocalRing
Definition: iplib.cc:515
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
#define pDelete(p_ptr)
Definition: polys.h:157
ring cRing
Definition: ipid.h:61
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
#define Warn
Definition: emacs.cc:80
void rSetHdl ( idhdl  h)

Definition at line 4821 of file ipshell.cc.

4822 {
4823  ring rg = NULL;
4824  if (h!=NULL)
4825  {
4826 // Print(" new ring:%s (l:%d)\n",IDID(h),IDLEV(h));
4827  rg = IDRING(h);
4828  if (rg==NULL) return; //id <>NULL, ring==NULL
4829  omCheckAddrSize((ADDRESS)h,sizeof(idrec));
4830  if (IDID(h)) // OB: ????
4831  omCheckAddr((ADDRESS)IDID(h));
4832  rTest(rg);
4833  }
4834 
4835  // clean up history
4837  {
4839  memset(&sLastPrinted,0,sizeof(sleftv));
4840  }
4841 
4842  if ((rg!=currRing)&&(currRing!=NULL))
4843  {
4845  if (DENOMINATOR_LIST!=NULL)
4846  {
4847  if (TEST_V_ALLWARN)
4848  Warn("deleting denom_list for ring change to %s",IDID(h));
4849  do
4850  {
4851  n_Delete(&(dd->n),currRing->cf);
4852  dd=dd->next;
4854  DENOMINATOR_LIST=dd;
4855  } while(DENOMINATOR_LIST!=NULL);
4856  }
4857  }
4858 
4859  // test for valid "currRing":
4860  if ((rg!=NULL) && (rg->idroot==NULL))
4861  {
4862  ring old=rg;
4863  rg=rAssure_HasComp(rg);
4864  if (old!=rg)
4865  {
4866  rKill(old);
4867  IDRING(h)=rg;
4868  }
4869  }
4870  /*------------ change the global ring -----------------------*/
4871  rChangeCurrRing(rg);
4872  currRingHdl = h;
4873 }
#define omCheckAddrSize(addr, size)
Definition: omAllocDecl.h:327
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define IDID(a)
Definition: ipid.h:121
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:81
void * ADDRESS
Definition: auxiliary.h:161
ring rAssure_HasComp(const ring r)
Definition: ring.cc:4532
Definition: idrec.h:34
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN RingDependend()
Definition: subexpr.cc:369
void rKill(ring r)
Definition: ipshell.cc:5815
#define omFree(addr)
Definition: omAllocDecl.h:261
#define rTest(r)
Definition: ring.h:769
idhdl currRingHdl
Definition: ipid.cc:64
void rChangeCurrRing(ring r)
Definition: polys.cc:14
#define NULL
Definition: omList.c:10
denominator_list next
Definition: kutil.h:65
#define IDRING(a)
Definition: ipid.h:126
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:301
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static Poly * h
Definition: janet.cc:978
#define TEST_V_ALLWARN
Definition: options.h:135
#define Warn
Definition: emacs.cc:80
idhdl rSimpleFindHdl ( ring  r,
idhdl  root,
idhdl  n = NULL 
)

Definition at line 5903 of file ipshell.cc.

5904 {
5905  //idhdl next_best=NULL;
5906  idhdl h=root;
5907  while (h!=NULL)
5908  {
5909  if (((IDTYP(h)==RING_CMD)||(IDTYP(h)==QRING_CMD))
5910  && (h!=n)
5911  && (IDRING(h)==r)
5912  )
5913  {
5914  // if (IDLEV(h)==myynest)
5915  // return h;
5916  // if ((IDLEV(h)==0) || (next_best==NULL))
5917  // next_best=h;
5918  // else if (IDLEV(next_best)<IDLEV(h))
5919  // next_best=h;
5920  return h;
5921  }
5922  h=IDNEXT(h);
5923  }
5924  //return next_best;
5925  return NULL;
5926 }
#define IDNEXT(a)
Definition: ipid.h:117
Definition: idrec.h:34
#define IDTYP(a)
Definition: ipid.h:118
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
#define IDRING(a)
Definition: ipid.h:126
Definition: tok.h:126
static Poly * h
Definition: janet.cc:978
lists scIndIndset ( ideal  S,
BOOLEAN  all,
ideal  Q 
)

Definition at line 1060 of file ipshell.cc.

1061 {
1062  int i;
1063  indset save;
1065 
1066  hexist = hInit(S, Q, &hNexist, currRing);
1067  if (hNexist == 0)
1068  {
1069  intvec *iv=new intvec(rVar(currRing));
1070  for(i=0; i<rVar(currRing); i++) (*iv)[i]=1;
1071  res->Init(1);
1072  res->m[0].rtyp=INTVEC_CMD;
1073  res->m[0].data=(intvec*)iv;
1074  return res;
1075  }
1076  else if (hisModule!=0)
1077  {
1078  res->Init(0);
1079  return res;
1080  }
1081  save = ISet = (indset)omAlloc0Bin(indlist_bin);
1082  hMu = 0;
1083  hwork = (scfmon)omAlloc(hNexist * sizeof(scmon));
1084  hvar = (varset)omAlloc((rVar(currRing) + 1) * sizeof(int));
1085  hpure = (scmon)omAlloc((1 + (rVar(currRing) * rVar(currRing))) * sizeof(long));
1086  hrad = hexist;
1087  hNrad = hNexist;
1088  radmem = hCreate(rVar(currRing) - 1);
1089  hCo = rVar(currRing) + 1;
1090  hNvar = rVar(currRing);
1091  hRadical(hrad, &hNrad, hNvar);
1092  hSupp(hrad, hNrad, hvar, &hNvar);
1093  if (hNvar)
1094  {
1095  hCo = hNvar;
1096  memset(hpure, 0, (rVar(currRing) + 1) * sizeof(long));
1097  hPure(hrad, 0, &hNrad, hvar, hNvar, hpure, &hNpure);
1098  hLexR(hrad, hNrad, hvar, hNvar);
1100  }
1101  if (hCo && (hCo < rVar(currRing)))
1102  {
1104  }
1105  if (hMu!=0)
1106  {
1107  ISet = save;
1108  hMu2 = 0;
1109  if (all && (hCo+1 < rVar(currRing)))
1110  {
1113  i=hMu+hMu2;
1114  res->Init(i);
1115  if (hMu2 == 0)
1116  {
1118  }
1119  }
1120  else
1121  {
1122  res->Init(hMu);
1123  }
1124  for (i=0;i<hMu;i++)
1125  {
1126  res->m[i].data = (void *)save->set;
1127  res->m[i].rtyp = INTVEC_CMD;
1128  ISet = save;
1129  save = save->nx;
1131  }
1132  omFreeBin((ADDRESS)save, indlist_bin);
1133  if (hMu2 != 0)
1134  {
1135  save = JSet;
1136  for (i=hMu;i<hMu+hMu2;i++)
1137  {
1138  res->m[i].data = (void *)save->set;
1139  res->m[i].rtyp = INTVEC_CMD;
1140  JSet = save;
1141  save = save->nx;
1143  }
1144  omFreeBin((ADDRESS)save, indlist_bin);
1145  }
1146  }
1147  else
1148  {
1149  res->Init(0);
1151  }
1152  hKill(radmem, rVar(currRing) - 1);
1153  omFreeSize((ADDRESS)hpure, (1 + (rVar(currRing) * rVar(currRing))) * sizeof(long));
1154  omFreeSize((ADDRESS)hvar, (rVar(currRing) + 1) * sizeof(int));
1155  omFreeSize((ADDRESS)hwork, hNexist * sizeof(scmon));
1157  return res;
1158 }
int hMu2
Definition: hdegree.cc:22
sleftv * m
Definition: lists.h:45
void hDimSolve(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:29
scfmon hwork
Definition: hutil.cc:19
void hIndAllMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:494
int hNexist
Definition: hutil.cc:22
int * varset
Definition: hutil.h:23
int hCo
Definition: hdegree.cc:22
Definition: lists.h:22
scmon * scfmon
Definition: hutil.h:22
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
scfmon hexist
Definition: hutil.cc:19
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
monf hCreate(int Nvar)
Definition: hutil.cc:1002
int hNvar
Definition: hutil.cc:22
void * ADDRESS
Definition: auxiliary.h:161
int hNrad
Definition: hutil.cc:22
int hNpure
Definition: hutil.cc:22
scmon hpure
Definition: hutil.cc:20
#define Q
Definition: sirandom.c:25
void hRadical(scfmon rad, int *Nrad, int Nvar)
Definition: hutil.cc:417
#define omAlloc(size)
Definition: omAllocDecl.h:210
scfmon hrad
Definition: hutil.cc:19
void * data
Definition: subexpr.h:89
void hDelete(scfmon ev, int ev_length)
Definition: hutil.cc:146
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
indset ISet
Definition: hdegree.cc:277
Definition: intvec.h:16
void hKill(monf xmem, int Nvar)
Definition: hutil.cc:1016
varset hvar
Definition: hutil.cc:21
void hIndMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:311
indlist * indset
Definition: hutil.h:35
void hPure(scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
Definition: hutil.cc:627
omBin indlist_bin
Definition: hdegree.cc:23
indset JSet
Definition: hdegree.cc:277
int * scmon
Definition: hutil.h:21
int i
Definition: cfEzgcd.cc:123
Definition: tok.h:88
void hLexR(scfmon rad, int Nrad, varset var, int Nvar)
Definition: hutil.cc:571
INLINE_THIS void Init(int l=0)
Definition: lists.h:66
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
slists * lists
Definition: mpr_numeric.h:146
monf radmem
Definition: hutil.cc:24
int rtyp
Definition: subexpr.h:92
omBin slists_bin
Definition: lists.cc:23
int hisModule
Definition: hutil.cc:23
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
scfmon hInit(ideal S, ideal Q, int *Nexist, ring tailRing)
Definition: hutil.cc:34
int hMu
Definition: hdegree.cc:22
void hSupp(scfmon stc, int Nstc, varset var, int *Nvar)
Definition: hutil.cc:180
BOOLEAN semicProc ( leftv  ,
leftv  ,
leftv   
)

Definition at line 4257 of file ipshell.cc.

4258 {
4259  sleftv tmp;
4260  memset(&tmp,0,sizeof(tmp));
4261  tmp.rtyp=INT_CMD;
4262  /* tmp.data = (void *)0; -- done by memset */
4263 
4264  return semicProc3(res,u,v,&tmp);
4265 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
BOOLEAN semicProc3(leftv res, leftv u, leftv v, leftv w)
Definition: ipshell.cc:4217
poly res
Definition: myNF.cc:322
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
int rtyp
Definition: subexpr.h:92
BOOLEAN semicProc3 ( leftv  ,
leftv  ,
leftv  ,
leftv   
)

Definition at line 4217 of file ipshell.cc.

4218 {
4219  semicState state;
4220  BOOLEAN qh=(((int)(long)w->Data())==1);
4221 
4222  // -----------------
4223  // check arguments
4224  // -----------------
4225 
4226  lists l1 = (lists)u->Data( );
4227  lists l2 = (lists)v->Data( );
4228 
4229  if( (state=list_is_spectrum( l1 ))!=semicOK )
4230  {
4231  WerrorS( "first argument is not a spectrum" );
4232  list_error( state );
4233  }
4234  else if( (state=list_is_spectrum( l2 ))!=semicOK )
4235  {
4236  WerrorS( "second argument is not a spectrum" );
4237  list_error( state );
4238  }
4239  else
4240  {
4241  spectrum s1= spectrumFromList( l1 );
4242  spectrum s2= spectrumFromList( l2 );
4243 
4244  res->rtyp = INT_CMD;
4245  if (qh)
4246  res->data = (void*)(long)(s1.mult_spectrumh( s2 ));
4247  else
4248  res->data = (void*)(long)(s1.mult_spectrum( s2 ));
4249  }
4250 
4251  // -----------------
4252  // check status
4253  // -----------------
4254 
4255  return (state!=semicOK);
4256 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
Definition: tok.h:85
Definition: lists.h:22
spectrum spectrumFromList(lists l)
Definition: ipshell.cc:3090
void list_error(semicState state)
Definition: ipshell.cc:3174
void WerrorS(const char *s)
Definition: feFopen.cc:23
Definition: semic.h:63
poly res
Definition: myNF.cc:322
semicState list_is_spectrum(lists l)
Definition: ipshell.cc:3959
int mult_spectrumh(spectrum &)
Definition: semic.cc:425
semicState
Definition: ipshell.cc:3140
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
slists * lists
Definition: mpr_numeric.h:146
const CanonicalForm & w
Definition: facAbsFact.cc:55
int BOOLEAN
Definition: auxiliary.h:131
int mult_spectrum(spectrum &)
Definition: semic.cc:396
BOOLEAN setOption ( leftv  res,
leftv  v 
)

Definition at line 578 of file misc_ip.cc.

579 {
580  const char *n;
581  do
582  {
583  if (v->Typ()==STRING_CMD)
584  {
585  n=(const char *)v->CopyD(STRING_CMD);
586  }
587  else
588  {
589  if (v->name==NULL)
590  return TRUE;
591  if (v->rtyp==0)
592  {
593  n=v->name;
594  v->name=NULL;
595  }
596  else
597  {
598  n=omStrDup(v->name);
599  }
600  }
601 
602  int i;
603 
604  if(strcmp(n,"get")==0)
605  {
606  intvec *w=new intvec(2);
607  (*w)[0]=si_opt_1;
608  (*w)[1]=si_opt_2;
609  res->rtyp=INTVEC_CMD;
610  res->data=(void *)w;
611  goto okay;
612  }
613  if(strcmp(n,"set")==0)
614  {
615  if((v->next!=NULL)
616  &&(v->next->Typ()==INTVEC_CMD))
617  {
618  v=v->next;
619  intvec *w=(intvec*)v->Data();
620  si_opt_1=(*w)[0];
621  si_opt_2=(*w)[1];
622 #if 0
625 #ifdef HAVE_RINGS
627 #endif
628  ) {
630  }
631 #endif
632  goto okay;
633  }
634  }
635  if(strcmp(n,"none")==0)
636  {
637  si_opt_1=0;
638  si_opt_2=0;
639  goto okay;
640  }
641  for (i=0; (i==0) || (optionStruct[i-1].setval!=0); i++)
642  {
643  if (strcmp(n,optionStruct[i].name)==0)
644  {
645  if (optionStruct[i].setval & validOpts)
646  {
648  // optOldStd disables redthrough
649  if (optionStruct[i].setval == Sy_bit(OPT_OLDSTD))
651  }
652  else
653  Warn("cannot set option");
654 #if 0
657 #ifdef HAVE_RINGS
659 #endif
660  ) {
662  }
663 #endif
664  goto okay;
665  }
666  else if ((strncmp(n,"no",2)==0)
667  && (strcmp(n+2,optionStruct[i].name)==0))
668  {
669  if (optionStruct[i].setval & validOpts)
670  {
672  }
673  else
674  Warn("cannot clear option");
675  goto okay;
676  }
677  }
678  for (i=0; (i==0) || (verboseStruct[i-1].setval!=0); i++)
679  {
680  if (strcmp(n,verboseStruct[i].name)==0)
681  {
683  #ifdef YYDEBUG
684  #if YYDEBUG
685  /*debugging the bison grammar --> grammar.cc*/
686  extern int yydebug;
687  if (BVERBOSE(V_YACC)) yydebug=1;
688  else yydebug=0;
689  #endif
690  #endif
691  goto okay;
692  }
693  else if ((strncmp(n,"no",2)==0)
694  && (strcmp(n+2,verboseStruct[i].name)==0))
695  {
697  #ifdef YYDEBUG
698  #if YYDEBUG
699  /*debugging the bison grammar --> grammar.cc*/
700  extern int yydebug;
701  if (BVERBOSE(V_YACC)) yydebug=1;
702  else yydebug=0;
703  #endif
704  #endif
705  goto okay;
706  }
707  }
708  Werror("unknown option `%s`",n);
709  okay:
710  if (currRing != NULL)
711  currRing->options = si_opt_1 & TEST_RINGDEP_OPTS;
712  omFree((ADDRESS)n);
713  v=v->next;
714  } while (v!=NULL);
715 
716 #ifdef OM_SINGULAR_CONFIG_H
717  // set global variable to show memory usage
718  extern int om_sing_opt_show_mem;
719  if (BVERBOSE(V_SHOW_MEM)) om_sing_opt_show_mem = 1;
720  else om_sing_opt_show_mem = 0;
721 #endif
722 
723  return FALSE;
724 }
unsigned si_opt_1
Definition: options.c:5
#define FALSE
Definition: auxiliary.h:140
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define OPT_OLDSTD
Definition: options.h:81
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
int Typ()
Definition: subexpr.cc:949
#define Sy_bit(x)
Definition: options.h:30
BITSET validOpts
Definition: kstd1.cc:70
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:488
void * data
Definition: subexpr.h:89
unsigned setval
Definition: iplib.cc:305
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define V_SHOW_MEM
Definition: options.h:41
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
Definition: intvec.h:16
unsigned resetval
Definition: iplib.cc:306
const char * name
Definition: subexpr.h:88
#define omFree(addr)
Definition: omAllocDecl.h:261
struct soptionStruct verboseStruct[]
Definition: misc_ip.cc:549
struct soptionStruct optionStruct[]
Definition: misc_ip.cc:519
int i
Definition: cfEzgcd.cc:123
Definition: tok.h:88
leftv next
Definition: subexpr.h:87
#define OPT_INTSTRATEGY
Definition: options.h:87
#define BVERBOSE(a)
Definition: options.h:33
CanonicalForm test
Definition: cfModGcd.cc:4037
char name(const Variable &v)
Definition: variable.h:95
#define V_YACC
Definition: options.h:42
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
int yydebug
Definition: grammar.cc:1862
const CanonicalForm & w
Definition: facAbsFact.cc:55
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1091
#define OPT_REDTHROUGH
Definition: options.h:77
#define TEST_RINGDEP_OPTS
Definition: options.h:95
unsigned si_opt_2
Definition: options.c:6
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void * CopyD(int t)
Definition: subexpr.cc:656
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263
char* showOption ( )

Definition at line 726 of file misc_ip.cc.

727 {
728  int i;
729  BITSET tmp;
730 
731  StringSetS("//options:");
732  if ((si_opt_1!=0)||(si_opt_2!=0))
733  {
734  tmp=si_opt_1;
735  if(tmp)
736  {
737  for (i=0; optionStruct[i].setval!=0; i++)
738  {
739  if (optionStruct[i].setval & tmp)
740  {
741  StringAppend(" %s",optionStruct[i].name);
742  tmp &=optionStruct[i].resetval;
743  }
744  }
745  for (i=0; i<32; i++)
746  {
747  if (tmp & Sy_bit(i)) StringAppend(" %d",i);
748  }
749  }
750  tmp=si_opt_2;
751  if (tmp)
752  {
753  for (i=0; verboseStruct[i].setval!=0; i++)
754  {
755  if (verboseStruct[i].setval & tmp)
756  {
757  StringAppend(" %s",verboseStruct[i].name);
758  tmp &=verboseStruct[i].resetval;
759  }
760  }
761  for (i=1; i<32; i++)
762  {
763  if (tmp & Sy_bit(i)) StringAppend(" %d",i+32);
764  }
765  }
766  return StringEndS();
767  }
768  StringAppendS(" none");
769  return StringEndS();
770 }
unsigned si_opt_1
Definition: options.c:5
char * StringEndS()
Definition: reporter.cc:151
#define BITSET
Definition: structs.h:17
#define Sy_bit(x)
Definition: options.h:30
unsigned setval
Definition: iplib.cc:305
unsigned resetval
Definition: iplib.cc:306
struct soptionStruct verboseStruct[]
Definition: misc_ip.cc:549
void StringSetS(const char *st)
Definition: reporter.cc:128
struct soptionStruct optionStruct[]
Definition: misc_ip.cc:519
void StringAppendS(const char *st)
Definition: reporter.cc:107
#define StringAppend
Definition: emacs.cc:82
int i
Definition: cfEzgcd.cc:123
char name(const Variable &v)
Definition: variable.h:95
unsigned si_opt_2
Definition: options.c:6
void singular_example ( char *  str)

Definition at line 435 of file misc_ip.cc.

436 {
437  assume(str!=NULL);
438  char *s=str;
439  while (*s==' ') s++;
440  char *ss=s;
441  while (*ss!='\0') ss++;
442  while (*ss<=' ')
443  {
444  *ss='\0';
445  ss--;
446  }
447  idhdl h=IDROOT->get(s,myynest);
448  if ((h!=NULL) && (IDTYP(h)==PROC_CMD))
449  {
450  char *lib=iiGetLibName(IDPROC(h));
451  if((lib!=NULL)&&(*lib!='\0'))
452  {
453  Print("// proc %s from lib %s\n",s,lib);
454  s=iiGetLibProcBuffer(IDPROC(h), 2);
455  if (s!=NULL)
456  {
457  if (strlen(s)>5)
458  {
459  iiEStart(s,IDPROC(h));
460  omFree((ADDRESS)s);
461  return;
462  }
463  else omFree((ADDRESS)s);
464  }
465  }
466  }
467  else
468  {
469  char sing_file[MAXPATHLEN];
470  FILE *fd=NULL;
471  char *res_m=feResource('m', 0);
472  if (res_m!=NULL)
473  {
474  sprintf(sing_file, "%s/%s.sing", res_m, s);
475  fd = feFopen(sing_file, "r");
476  }
477  if (fd != NULL)
478  {
479 
480  int old_echo = si_echo;
481  int length, got;
482  char* s;
483 
484  fseek(fd, 0, SEEK_END);
485  length = ftell(fd);
486  fseek(fd, 0, SEEK_SET);
487  s = (char*) omAlloc((length+20)*sizeof(char));
488  got = fread(s, sizeof(char), length, fd);
489  fclose(fd);
490  if (got != length)
491  {
492  Werror("Error while reading file %s", sing_file);
493  }
494  else
495  {
496  s[length] = '\0';
497  strcat(s, "\n;return();\n\n");
498  si_echo = 2;
499  iiEStart(s, NULL);
500  si_echo = old_echo;
501  }
502  omFree(s);
503  }
504  else
505  {
506  Werror("no example for %s", str);
507  }
508  }
509 }
int status int fd
Definition: si_signals.h:58
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define MAXPATHLEN
Definition: omRet2Info.c:22
#define Print
Definition: emacs.cc:83
static char * feResource(feResourceConfig config, int warn)
Definition: feResource.cc:252
#define IDROOT
Definition: ipid.h:20
void * ADDRESS
Definition: auxiliary.h:161
#define omAlloc(size)
Definition: omAllocDecl.h:210
Definition: idrec.h:34
int myynest
Definition: febase.cc:46
#define IDTYP(a)
Definition: ipid.h:118
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:405
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
Definition: feFopen.cc:46
BOOLEAN iiEStart(char *example, procinfo *pi)
Definition: iplib.cc:655
#define IDPROC(a)
Definition: ipid.h:139
#define SEEK_END
Definition: mod2.h:121
#define NULL
Definition: omList.c:10
char * iiGetLibName(procinfov pi)
Definition: iplib.cc:101
#define SEEK_SET
Definition: mod2.h:125
char * iiGetLibProcBuffer(procinfo *pi, int part)
Definition: iplib.cc:200
static Poly * h
Definition: janet.cc:978
void Werror(const char *fmt,...)
Definition: reporter.cc:199
int si_echo
Definition: febase.cc:41
leftv singular_system ( sleftv  h)
BOOLEAN spaddProc ( leftv  ,
leftv  ,
leftv   
)

Definition at line 4134 of file ipshell.cc.

4135 {
4136  semicState state;
4137 
4138  // -----------------
4139  // check arguments
4140  // -----------------
4141 
4142  lists l1 = (lists)first->Data( );
4143  lists l2 = (lists)second->Data( );
4144 
4145  if( (state=list_is_spectrum( l1 )) != semicOK )
4146  {
4147  WerrorS( "first argument is not a spectrum:" );
4148  list_error( state );
4149  }
4150  else if( (state=list_is_spectrum( l2 )) != semicOK )
4151  {
4152  WerrorS( "second argument is not a spectrum:" );
4153  list_error( state );
4154  }
4155  else
4156  {
4157  spectrum s1= spectrumFromList ( l1 );
4158  spectrum s2= spectrumFromList ( l2 );
4159  spectrum sum( s1+s2 );
4160 
4161  result->rtyp = LIST_CMD;
4162  result->data = (char*)(getList(sum));
4163  }
4164 
4165  return (state!=semicOK);
4166 }
Definition: lists.h:22
spectrum spectrumFromList(lists l)
Definition: ipshell.cc:3090
void list_error(semicState state)
Definition: ipshell.cc:3174
void WerrorS(const char *s)
Definition: feFopen.cc:23
Definition: semic.h:63
lists getList(spectrum &spec)
Definition: ipshell.cc:3102
semicState list_is_spectrum(lists l)
Definition: ipshell.cc:3959
semicState
Definition: ipshell.cc:3140
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:96
return result
Definition: facAbsBiFact.cc:76
BOOLEAN spectrumfProc ( leftv  ,
leftv   
)

Definition at line 3890 of file ipshell.cc.

3891 {
3892  spectrumState state = spectrumOK;
3893 
3894  // -------------------
3895  // check consistency
3896  // -------------------
3897 
3898  // check for a local polynomial ring
3899 
3900  if( currRing->OrdSgn != -1 )
3901  // ?? HS: the test above is also true for k[x][[y]], k[[x]][y]
3902  // or should we use:
3903  //if( !ringIsLocal( ) )
3904  {
3905  WerrorS( "only works for local orderings" );
3906  state = spectrumWrongRing;
3907  }
3908  else if( currRing->qideal != NULL )
3909  {
3910  WerrorS( "does not work in quotient rings" );
3911  state = spectrumWrongRing;
3912  }
3913  else
3914  {
3915  lists L = (lists)NULL;
3916  int flag = 2; // symmetric optimization
3917 
3918  state = spectrumCompute( (poly)first->Data( ),&L,flag );
3919 
3920  if( state==spectrumOK )
3921  {
3922  result->rtyp = LIST_CMD;
3923  result->data = (char*)L;
3924  }
3925  else
3926  {
3927  spectrumPrintError(state);
3928  }
3929  }
3930 
3931  return (state!=spectrumOK);
3932 }
spectrumState
Definition: ipshell.cc:3256
Definition: lists.h:22
void WerrorS(const char *s)
Definition: feFopen.cc:23
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
polyrec * poly
Definition: hilb.h:10
void spectrumPrintError(spectrumState state)
Definition: ipshell.cc:3808
spectrumState spectrumCompute(poly h, lists *L, int fast)
Definition: ipshell.cc:3516
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:96
return result
Definition: facAbsBiFact.cc:76
BOOLEAN spectrumProc ( leftv  ,
leftv   
)

Definition at line 3839 of file ipshell.cc.

3840 {
3841  spectrumState state = spectrumOK;
3842 
3843  // -------------------
3844  // check consistency
3845  // -------------------
3846 
3847  // check for a local ring
3848 
3849  if( !ringIsLocal(currRing ) )
3850  {
3851  WerrorS( "only works for local orderings" );
3852  state = spectrumWrongRing;
3853  }
3854 
3855  // no quotient rings are allowed
3856 
3857  else if( currRing->qideal != NULL )
3858  {
3859  WerrorS( "does not work in quotient rings" );
3860  state = spectrumWrongRing;
3861  }
3862  else
3863  {
3864  lists L = (lists)NULL;
3865  int flag = 1; // weight corner optimization is safe
3866 
3867  state = spectrumCompute( (poly)first->Data( ),&L,flag );
3868 
3869  if( state==spectrumOK )
3870  {
3871  result->rtyp = LIST_CMD;
3872  result->data = (char*)L;
3873  }
3874  else
3875  {
3876  spectrumPrintError(state);
3877  }
3878  }
3879 
3880  return (state!=spectrumOK);
3881 }
spectrumState
Definition: ipshell.cc:3256
Definition: lists.h:22
void WerrorS(const char *s)
Definition: feFopen.cc:23
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
polyrec * poly
Definition: hilb.h:10
void spectrumPrintError(spectrumState state)
Definition: ipshell.cc:3808
spectrumState spectrumCompute(poly h, lists *L, int fast)
Definition: ipshell.cc:3516
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:96
BOOLEAN ringIsLocal(const ring r)
Definition: spectrum.cc:461
return result
Definition: facAbsBiFact.cc:76
BOOLEAN spmulProc ( leftv  ,
leftv  ,
leftv   
)

Definition at line 4176 of file ipshell.cc.

4177 {
4178  semicState state;
4179 
4180  // -----------------
4181  // check arguments
4182  // -----------------
4183 
4184  lists l = (lists)first->Data( );
4185  int k = (int)(long)second->Data( );
4186 
4187  if( (state=list_is_spectrum( l ))!=semicOK )
4188  {
4189  WerrorS( "first argument is not a spectrum" );
4190  list_error( state );
4191  }
4192  else if( k < 0 )
4193  {
4194  WerrorS( "second argument should be positive" );
4195  state = semicMulNegative;
4196  }
4197  else
4198  {
4199  spectrum s= spectrumFromList( l );
4200  spectrum product( k*s );
4201 
4202  result->rtyp = LIST_CMD;
4203  result->data = (char*)getList(product);
4204  }
4205 
4206  return (state!=semicOK);
4207 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
const CanonicalForm int s
Definition: facAbsFact.cc:55
Definition: lists.h:22
spectrum spectrumFromList(lists l)
Definition: ipshell.cc:3090
void list_error(semicState state)
Definition: ipshell.cc:3174
void WerrorS(const char *s)
Definition: feFopen.cc:23
int k
Definition: cfEzgcd.cc:93
Definition: semic.h:63
lists getList(spectrum &spec)
Definition: ipshell.cc:3102
semicState list_is_spectrum(lists l)
Definition: ipshell.cc:3959
semicState
Definition: ipshell.cc:3140
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:96
return result
Definition: facAbsBiFact.cc:76
int l
Definition: cfEzgcd.cc:94
BOOLEAN syBetti1 ( leftv  res,
leftv  u 
)

Definition at line 2873 of file ipshell.cc.

2874 {
2875  sleftv tmp;
2876  memset(&tmp,0,sizeof(tmp));
2877  tmp.rtyp=INT_CMD;
2878  tmp.data=(void *)1;
2879  return syBetti2(res,u,&tmp);
2880 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
void * data
Definition: subexpr.h:89
BOOLEAN syBetti2(leftv res, leftv u, leftv w)
Definition: ipshell.cc:2850
int rtyp
Definition: subexpr.h:92
BOOLEAN syBetti2 ( leftv  res,
leftv  u,
leftv  w 
)

Definition at line 2850 of file ipshell.cc.

2851 {
2852  syStrategy syzstr=(syStrategy)u->Data();
2853 
2854  BOOLEAN minim=(int)(long)w->Data();
2855  int row_shift=0;
2856  int add_row_shift=0;
2857  intvec *weights=NULL;
2858  intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
2859  if (ww!=NULL)
2860  {
2861  weights=ivCopy(ww);
2862  add_row_shift = ww->min_in();
2863  (*weights) -= add_row_shift;
2864  }
2865 
2866  res->data=(void *)syBettiOfComputation(syzstr,minim,&row_shift,weights);
2867  //row_shift += add_row_shift;
2868  //Print("row_shift=%d, add_row_shift=%d\n",row_shift,add_row_shift);
2869  atSet(res,omStrDup("rowShift"),(void*)(long)add_row_shift,INT_CMD);
2870 
2871  return FALSE;
2872 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
void atSet(idhdl root, const char *name, void *data, int typ)
Definition: attrib.cc:156
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
intvec * ivCopy(const intvec *o)
Definition: intvec.h:132
int min_in()
Definition: intvec.h:109
void * data
Definition: subexpr.h:89
Definition: intvec.h:16
Definition: tok.h:88
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:135
#define NULL
Definition: omList.c:10
intvec * syBettiOfComputation(syStrategy syzstr, BOOLEAN minim=TRUE, int *row_shift=NULL, intvec *weights=NULL)
Definition: syz1.cc:1767
void * Data()
Definition: subexpr.cc:1091
int BOOLEAN
Definition: auxiliary.h:131
ssyStrategy * syStrategy
Definition: syz.h:35
#define omStrDup(s)
Definition: omAllocDecl.h:263
syStrategy syConvList ( lists  li,
BOOLEAN  toDel 
)

Definition at line 2961 of file ipshell.cc.

2962 {
2963  int typ0;
2965 
2966  resolvente fr = liFindRes(li,&(result->length),&typ0,&(result->weights));
2967  if (fr != NULL)
2968  {
2969 
2970  result->fullres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
2971  for (int i=result->length-1;i>=0;i--)
2972  {
2973  if (fr[i]!=NULL)
2974  result->fullres[i] = idCopy(fr[i]);
2975  }
2976  result->list_length=result->length;
2977  omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
2978  }
2979  else
2980  {
2981  omFreeSize(result, sizeof(ssyStrategy));
2982  result = NULL;
2983  }
2984  if (toDel) li->Clean();
2985  return result;
2986 }
int length
Definition: syz.h:60
intvec ** weights
Definition: syz.h:45
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
Definition: lists.cc:313
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
void * ADDRESS
Definition: auxiliary.h:161
int i
Definition: cfEzgcd.cc:123
resolvente fullres
Definition: syz.h:57
#define NULL
Definition: omList.c:10
void Clean(ring r=currRing)
Definition: lists.h:25
short list_length
Definition: syz.h:62
ideal * resolvente
Definition: ideals.h:20
ideal idCopy(ideal A, const ring R=currRing)
Definition: ideals.h:76
#define omAlloc0(size)
Definition: omAllocDecl.h:211
return result
Definition: facAbsBiFact.cc:76
ssyStrategy * syStrategy
Definition: syz.h:35
lists syConvRes ( syStrategy  syzstr,
BOOLEAN  toDel = FALSE,
int  add_row_shift = 0 
)

Definition at line 2885 of file ipshell.cc.

2886 {
2887  resolvente fullres = syzstr->fullres;
2888  resolvente minres = syzstr->minres;
2889 
2890  const int length = syzstr->length;
2891 
2892  if ((fullres==NULL) && (minres==NULL))
2893  {
2894  if (syzstr->hilb_coeffs==NULL)
2895  { // La Scala
2896  fullres = syReorder(syzstr->res, length, syzstr);
2897  }
2898  else
2899  { // HRES
2900  minres = syReorder(syzstr->orderedRes, length, syzstr);
2901  syKillEmptyEntres(minres, length);
2902  }
2903  }
2904 
2905  resolvente tr;
2906  int typ0=IDEAL_CMD;
2907 
2908  if (minres!=NULL)
2909  tr = minres;
2910  else
2911  tr = fullres;
2912 
2913  resolvente trueres=NULL; intvec ** w=NULL;
2914 
2915  if (length>0)
2916  {
2917  trueres = (resolvente)omAlloc0((length)*sizeof(ideal));
2918  for (int i=(length)-1;i>=0;i--)
2919  {
2920  if (tr[i]!=NULL)
2921  {
2922  trueres[i] = idCopy(tr[i]);
2923  }
2924  }
2925  if ( id_RankFreeModule(trueres[0], currRing) > 0)
2926  typ0 = MODUL_CMD;
2927  if (syzstr->weights!=NULL)
2928  {
2929  w = (intvec**)omAlloc0(length*sizeof(intvec*));
2930  for (int i=length-1;i>=0;i--)
2931  {
2932  if (syzstr->weights[i]!=NULL) w[i] = ivCopy(syzstr->weights[i]);
2933  }
2934  }
2935  }
2936 
2937  lists li = liMakeResolv(trueres, length, syzstr->list_length,typ0,
2938  w, add_row_shift);
2939 
2940  if (w != NULL) omFreeSize(w, length*sizeof(intvec*));
2941 
2942  if (toDel)
2943  syKillComputation(syzstr);
2944  else
2945  {
2946  if( fullres != NULL && syzstr->fullres == NULL )
2947  syzstr->fullres = fullres;
2948 
2949  if( minres != NULL && syzstr->minres == NULL )
2950  syzstr->minres = minres;
2951  }
2952 
2953  return li;
2954 
2955 
2956 }
int length
Definition: syz.h:60
intvec ** weights
Definition: syz.h:45
resolvente syReorder(resolvente res, int length, syStrategy syzstr, BOOLEAN toCopy=TRUE, resolvente totake=NULL)
Definition: syz1.cc:1653
Definition: lists.h:22
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
intvec * ivCopy(const intvec *o)
Definition: intvec.h:132
resolvente res
Definition: syz.h:47
intvec ** hilb_coeffs
Definition: syz.h:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
resolvente orderedRes
Definition: syz.h:48
Definition: intvec.h:16
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
int i
Definition: cfEzgcd.cc:123
resolvente fullres
Definition: syz.h:57
resolvente minres
Definition: syz.h:58
#define NULL
Definition: omList.c:10
lists liMakeResolv(resolvente r, int length, int reallen, int typ0, intvec **weights, int add_row_shift)
Definition: lists.cc:216
const CanonicalForm & w
Definition: facAbsFact.cc:55
short list_length
Definition: syz.h:62
ideal * resolvente
Definition: ideals.h:20
ideal idCopy(ideal A, const ring R=currRing)
Definition: ideals.h:76
void syKillEmptyEntres(resolvente res, int length)
Definition: syz1.cc:2209
void syKillComputation(syStrategy syzstr, ring r=currRing)
Definition: syz1.cc:1497
#define omAlloc0(size)
Definition: omAllocDecl.h:211
syStrategy syForceMin ( lists  li)

Definition at line 2991 of file ipshell.cc.

2992 {
2993  int typ0;
2995 
2996  resolvente fr = liFindRes(li,&(result->length),&typ0);
2997  result->minres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
2998  for (int i=result->length-1;i>=0;i--)
2999  {
3000  if (fr[i]!=NULL)
3001  result->minres[i] = idCopy(fr[i]);
3002  }
3003  omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
3004  return result;
3005 }
int length
Definition: syz.h:60
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
Definition: lists.cc:313
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
void * ADDRESS
Definition: auxiliary.h:161
int i
Definition: cfEzgcd.cc:123
resolvente minres
Definition: syz.h:58
#define NULL
Definition: omList.c:10
ideal * resolvente
Definition: ideals.h:20
ideal idCopy(ideal A, const ring R=currRing)
Definition: ideals.h:76
#define omAlloc0(size)
Definition: omAllocDecl.h:211
return result
Definition: facAbsBiFact.cc:76
ssyStrategy * syStrategy
Definition: syz.h:35
void test_cmd ( int  i)

Definition at line 511 of file ipshell.cc.

512 {
513  int ii;
514 
515  if (i<0)
516  {
517  ii= -i;
518  if (ii < 32)
519  {
520  si_opt_1 &= ~Sy_bit(ii);
521  }
522  else if (ii < 64)
523  {
524  si_opt_2 &= ~Sy_bit(ii-32);
525  }
526  else
527  WerrorS("out of bounds\n");
528  }
529  else if (i<32)
530  {
531  ii=i;
532  if (Sy_bit(ii) & kOptions)
533  {
534  Warn("Gerhard, use the option command");
535  si_opt_1 |= Sy_bit(ii);
536  }
537  else if (Sy_bit(ii) & validOpts)
538  si_opt_1 |= Sy_bit(ii);
539  }
540  else if (i<64)
541  {
542  ii=i-32;
543  si_opt_2 |= Sy_bit(ii);
544  }
545  else
546  WerrorS("out of bounds\n");
547 }
unsigned si_opt_1
Definition: options.c:5
void WerrorS(const char *s)
Definition: feFopen.cc:23
#define Sy_bit(x)
Definition: options.h:30
BITSET validOpts
Definition: kstd1.cc:70
int i
Definition: cfEzgcd.cc:123
BITSET kOptions
Definition: kstd1.cc:55
unsigned si_opt_2
Definition: options.c:6
#define Warn
Definition: emacs.cc:80
const char* Tok2Cmdname ( int  i)

Definition at line 128 of file gentable.cc.

129 {
130  if (tok < 0)
131  {
132  return cmds[0].name;
133  }
134  if (tok==COMMAND) return "command";
135  if (tok==ANY_TYPE) return "any_type";
136  if (tok==NONE) return "nothing";
137  //if (tok==IFBREAK) return "if_break";
138  //if (tok==VECTOR_FROM_POLYS) return "vector_from_polys";
139  //if (tok==ORDER_VECTOR) return "ordering";
140  //if (tok==REF_VAR) return "ref";
141  //if (tok==OBJECT) return "object";
142  //if (tok==PRINT_EXPR) return "print_expr";
143  if (tok==IDHDL) return "identifier";
144  if (tok==CRING_CMD) return "(c)ring";
145  // we do not blackbox objects during table generation:
146  //if (tok>MAX_TOK) return getBlackboxName(tok);
147  int i = 0;
148  while (cmds[i].tokval!=0)
149  {
150  if ((cmds[i].tokval == tok)&&(cmds[i].alias==0))
151  {
152  return cmds[i].name;
153  }
154  i++;
155  }
156  i=0;// try again for old/alias names:
157  while (cmds[i].tokval!=0)
158  {
159  if (cmds[i].tokval == tok)
160  {
161  return cmds[i].name;
162  }
163  i++;
164  }
165  #if 0
166  char *s=(char*)malloc(10);
167  sprintf(s,"(%d)",tok);
168  return s;
169  #else
170  return cmds[0].name;
171  #endif
172 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define ANY_TYPE
Definition: tok.h:34
#define IDHDL
Definition: tok.h:35
Definition: tok.h:56
void * malloc(size_t size)
Definition: omalloc.c:98
int i
Definition: cfEzgcd.cc:123
cmdnames cmds[]
Definition: table.h:832
#define NONE
Definition: tok.h:170
#define COMMAND
Definition: tok.h:33
void type_cmd ( leftv  v)

Definition at line 248 of file ipshell.cc.

249 {
250  BOOLEAN oldShortOut = FALSE;
251 
252  if (currRing != NULL)
253  {
254  oldShortOut = currRing->ShortOut;
255  currRing->ShortOut = 1;
256  }
257  int t=v->Typ();
258  Print("// %s %s ",v->Name(),Tok2Cmdname(t));
259  switch (t)
260  {
261  case MAP_CMD:Print(" from %s\n",((map)(v->Data()))->preimage); break;
262  case INTMAT_CMD: Print(" %d x %d\n",((intvec*)(v->Data()))->rows(),
263  ((intvec*)(v->Data()))->cols()); break;
264  case MATRIX_CMD:Print(" %u x %u\n" ,
265  MATROWS((matrix)(v->Data())),
266  MATCOLS((matrix)(v->Data())));break;
267  case MODUL_CMD: Print(", rk %d\n", (int)(((ideal)(v->Data()))->rank));break;
268  case LIST_CMD: Print(", size %d\n",((lists)(v->Data()))->nr+1); break;
269 
270  case PROC_CMD:
271  case RING_CMD:
272  case IDEAL_CMD:
273  case QRING_CMD: PrintLn(); break;
274 
275  //case INT_CMD:
276  //case STRING_CMD:
277  //case INTVEC_CMD:
278  //case POLY_CMD:
279  //case VECTOR_CMD:
280  //case PACKAGE_CMD:
281 
282  default:
283  break;
284  }
285  v->Print();
286  if (currRing != NULL)
287  currRing->ShortOut = oldShortOut;
288 }
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:400
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
const ideal
Definition: gb_hack.h:42
int Typ()
Definition: subexpr.cc:949
const char * Name()
Definition: subexpr.h:121
void Print(leftv store=NULL, int spaces=0)
Called by type_cmd (e.g. "r;") or as default in jPRINT.
Definition: subexpr.cc:73
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
void * Data()
Definition: subexpr.cc:1091
Definition: tok.h:96
Definition: tok.h:126
#define MATROWS(i)
Definition: matpol.h:27
int BOOLEAN
Definition: auxiliary.h:131
char* versionString ( )

Definition at line 783 of file misc_ip.cc.

784 {
785  StringSetS("");
786  StringAppend("Singular for %s version %s (%d, %d bit) %s #%s",
787  S_UNAME, VERSION, // SINGULAR_VERSION,
788  SINGULAR_VERSION, SIZEOF_VOIDP*8, singular_date, GIT_VERSION);
789  StringAppendS("\nwith\n\t");
790 
791 #if defined(mpir_version)
792  StringAppend("MPIR(%s)~GMP(%s),", mpir_version, gmp_version);
793 #elif defined(gmp_version)
794  // #if defined (__GNU_MP_VERSION) && defined (__GNU_MP_VERSION_MINOR)
795  // StringAppend("GMP(%d.%d),",__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR);
796  StringAppend("GMP(%s),", gmp_version);
797 #endif
798 #ifdef HAVE_NTL
799 #include <NTL/version.h>
800  StringAppend("NTL(%s),",NTL_VERSION);
801 #endif
802 
803 #ifdef HAVE_FLINT
804  StringAppend("FLINT(%s),",version);
805 #endif
806  StringAppend("factory(%s),\n\t", factoryVersion);
807 #if defined(HAVE_DYN_RL)
809  StringAppendS("no input,");
810  else if (fe_fgets_stdin==fe_fgets)
811  StringAppendS("fgets,");
813  StringAppendS("dynamic readline,");
814  #ifdef HAVE_FEREAD
816  StringAppendS("emulated readline,");
817  #endif
818  else
819  StringAppendS("unknown fgets method,");
820 #else
821  #if defined(HAVE_READLINE) && !defined(FEREAD)
822  StringAppendS("static readline,");
823  #else
824  #ifdef HAVE_FEREAD
825  StringAppendS("emulated readline,");
826  #else
827  StringAppendS("fgets,");
828  #endif
829  #endif
830 #endif
831 #ifdef HAVE_PLURAL
832  StringAppendS("Plural,");
833 #endif
834 #ifdef HAVE_DBM
835  StringAppendS("DBM,\n\t");
836 #else
837  StringAppendS("\n\t");
838 #endif
839 #ifdef HAVE_DYNAMIC_LOADING
840  StringAppendS("dynamic modules,");
841 #endif
842  if (p_procs_dynamic) StringAppendS("dynamic p_Procs,");
843 #if YYDEBUG
844  StringAppendS("YYDEBUG=1,");
845 #endif
846 #ifdef HAVE_ASSUME
847  StringAppendS("ASSUME,");
848 #endif
849 #ifdef MDEBUG
850  StringAppend("MDEBUG=%d,",MDEBUG);
851 #endif
852 #ifdef OM_CHECK
853  StringAppend("OM_CHECK=%d,",OM_CHECK);
854 #endif
855 #ifdef OM_TRACK
856  StringAppend("OM_TRACK=%d,",OM_TRACK);
857 #endif
858 #ifdef OM_NDEBUG
859  StringAppendS("OM_NDEBUG,");
860 #endif
861 #ifdef SING_NDEBUG
862  StringAppendS("SING_NDEBUG,");
863 #endif
864 #ifdef PDEBUG
865  StringAppendS("PDEBUG,");
866 #endif
867 #ifdef KDEBUG
868  StringAppendS("KDEBUG,");
869 #endif
870 #ifdef __OPTIMIZE__
871  StringAppendS("CC:OPTIMIZE,");
872 #endif
873 #ifdef __OPTIMIZE_SIZE__
874  StringAppendS("CC:OPTIMIZE_SIZE,");
875 #endif
876 #ifdef __NO_INLINE__
877  StringAppendS("CC:NO_INLINE,");
878 #endif
879 #ifdef HAVE_EIGENVAL
880  StringAppendS("eigenvalues,");
881 #endif
882 #ifdef HAVE_GMS
883  StringAppendS("Gauss-Manin system,");
884 #endif
885 #ifdef HAVE_RATGRING
886  StringAppendS("ratGB,");
887 #endif
888  StringAppend("random=%d\n",siRandomStart);
889 
890 #define SI_SHOW_BUILTIN_MODULE(name) StringAppend(" %s", #name);
891  StringAppendS("built-in modules: {");
893  StringAppendS("}\n");
894 #undef SI_SHOW_BUILTIN_MODULE
895 
896  StringAppend("AC_CONFIGURE_ARGS = %s,\n"
897  "CC = %s,FLAGS : %s,\n"
898  "CXX = %s,FLAGS : %s,\n"
899  "DEFS : %s,CPPFLAGS : %s,\n"
900  "LDFLAGS : %s,LIBS : %s "
901 #ifdef __GNUC__
902  "(ver: " __VERSION__ ")"
903 #endif
904  "\n",AC_CONFIGURE_ARGS, CC,CFLAGS, CXX,CXXFLAGS, DEFS,CPPFLAGS, LDFLAGS,LIBS);
907  StringAppendS("\n");
908  return StringEndS();
909 }
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
Definition: feread.cc:33
void feStringAppendResources(int warn)
Definition: reporter.cc:410
const BOOLEAN p_procs_dynamic
#define OM_CHECK
Definition: omtTest.c:4
#define SINGULAR_VERSION
Definition: mod2.h:94
char * fe_fgets(const char *pr, char *s, int size)
Definition: feread.cc:310
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
char * fe_fgets_dummy(const char *, char *, int)
Definition: feread.cc:418
int siRandomStart
Definition: cntrlc.cc:109
SI_FOREACH_BUILTIN(SI_GET_BUILTIN_MOD_INIT0)}
char * StringEndS()
Definition: reporter.cc:151
#define OM_TRACK
Definition: mod2.h:290
void feStringAppendBrowsers(int warn)
Definition: fehelp.cc:352
#define MDEBUG
Definition: mod2.h:196
char * fe_fgets_stdin_emu(const char *pr, char *s, int size)
Definition: feread.cc:254
void StringSetS(const char *st)
Definition: reporter.cc:128
void StringAppendS(const char *st)
Definition: reporter.cc:107
#define StringAppend
Definition: emacs.cc:82
#define version
Definition: libparse.cc:1260
#define VERSION
Definition: mod2.h:21
const char * singular_date
Definition: misc_ip.cc:1160
#define SI_SHOW_BUILTIN_MODULE(name)
const char factoryVersion[]
extern const char factoryVersion[];
char * fe_fgets_stdin_drl(const char *pr, char *s, int size)
Definition: feread.cc:270

Variable Documentation

const char* currid

Definition at line 172 of file grammar.cc.

struct sValCmd1 dArith1[]

Definition at line 19 of file table.h.

struct sValCmd2 dArith2[]

Definition at line 271 of file table.h.

struct sValCmd3 dArith3[]

Definition at line 656 of file table.h.

struct sValCmdM dArithM[]

Definition at line 763 of file table.h.

leftv iiCurrArgs

Definition at line 82 of file ipshell.cc.

idhdl iiCurrProc

Definition at line 83 of file ipshell.cc.

ring* iiLocalRing

Definition at line 515 of file iplib.cc.

int iiOp

Definition at line 238 of file iparith.cc.

sleftv iiRETURNEXPR

Definition at line 517 of file iplib.cc.

int iiRETURNEXPR_len

Definition at line 518 of file iplib.cc.

const char* lastreserved

Definition at line 84 of file ipshell.cc.

int myynest

Definition at line 46 of file febase.cc.

int printlevel

Definition at line 42 of file febase.cc.

int si_echo

Definition at line 41 of file febase.cc.

const char* singular_date

Definition at line 1160 of file misc_ip.cc.

BOOLEAN yyInRingConstruction

Definition at line 173 of file grammar.cc.