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 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)
 
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 jjLOAD_TRY (const char *s)
 
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 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 rSetHdl (idhdl h)
 
ring rInit (leftv pn, leftv rv, leftv 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, const struct sValCmd1 *dA1, int at, const struct sConvertTypes *dConvertTypes)
 apply an operation 'op' to an argument a return TRUE on failure More...
 
BOOLEAN iiExprArith2Tab (leftv res, leftv a, int op, const struct sValCmd2 *dA2, int at, const 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, const struct sValCmd3 *dA3, int at, const 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)
 
lists rDecompose (const ring r)
 
lists rDecompose_list_cf (const ring r)
 
BOOLEAN rDecompose_CF (leftv res, const coeffs C)
 

Variables

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

Data Structure Documentation

§ sValCmd1

struct sValCmd1

Definition at line 70 of file gentable.cc.

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

§ sValCmd2

struct sValCmd2

Definition at line 61 of file gentable.cc.

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

§ sValCmd3

struct sValCmd3

Definition at line 78 of file gentable.cc.

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

§ sValCmdM

struct sValCmdM

Definition at line 88 of file gentable.cc.

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

§ sValAssign_sys

struct sValAssign_sys

Definition at line 96 of file gentable.cc.

Data Fields
short arg
int p
proc1 p
short res

§ sValAssign

struct sValAssign

Definition at line 103 of file gentable.cc.

Data Fields
short arg
int p
proci p
short res

Typedef Documentation

§ proc1

typedef BOOLEAN(* proc1) (leftv, leftv)

Definition at line 120 of file ipshell.h.

§ proc2

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

Definition at line 132 of file ipshell.h.

§ proc3

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

Definition at line 143 of file ipshell.h.

§ proci

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

Definition at line 172 of file ipshell.h.

Function Documentation

§ exprlist_length()

int exprlist_length ( leftv  v)

Definition at line 544 of file ipshell.cc.

545 {
546  int rc = 0;
547  while (v!=NULL)
548  {
549  switch (v->Typ())
550  {
551  case INT_CMD:
552  case POLY_CMD:
553  case VECTOR_CMD:
554  case NUMBER_CMD:
555  rc++;
556  break;
557  case INTVEC_CMD:
558  case INTMAT_CMD:
559  rc += ((intvec *)(v->Data()))->length();
560  break;
561  case MATRIX_CMD:
562  case IDEAL_CMD:
563  case MODUL_CMD:
564  {
565  matrix mm = (matrix)(v->Data());
566  rc += mm->rows() * mm->cols();
567  }
568  break;
569  case LIST_CMD:
570  rc+=((lists)v->Data())->nr+1;
571  break;
572  default:
573  rc++;
574  }
575  v = v->next;
576  }
577  return rc;
578 }
int & rows()
Definition: matpol.h:24
Definition: tok.h:95
int Typ()
Definition: subexpr.cc:996
Definition: intvec.h:14
ip_smatrix * matrix
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:1138
Definition: tok.h:117

§ iiAddCproc()

int iiAddCproc ( const char *  libname,
const char *  procname,
BOOLEAN  pstatic,
BOOLEAN(*)(leftv res, leftv v func 
)

Definition at line 897 of file iplib.cc.

899 {
900  procinfov pi;
901  idhdl h;
902 
903  #ifndef SING_NDEBUG
904  int dummy;
905  if (IsCmd(procname,dummy))
906  {
907  Werror(">>%s< is a reserved name",procname);
908  return 0;
909  }
910  #endif
911 
912  h=IDROOT->get(procname,0);
913  if ((h!=NULL)
914  && (IDTYP(h)==PROC_CMD))
915  {
916  pi = IDPROC(h);
917  if ((pi->language == LANG_SINGULAR)
918  &&(BVERBOSE(V_REDEFINE)))
919  Warn("extend `%s`",procname);
920  }
921  else
922  {
923  h = enterid(procname,0, PROC_CMD, &IDROOT, TRUE);
924  }
925  if ( h!= NULL )
926  {
927  pi = IDPROC(h);
928  if((pi->language == LANG_SINGULAR)
929  ||(pi->language == LANG_NONE))
930  {
931  omfree(pi->libname);
932  pi->libname = omStrDup(libname);
933  omfree(pi->procname);
934  pi->procname = omStrDup(procname);
935  pi->language = LANG_C;
936  pi->ref = 1;
937  pi->is_static = pstatic;
938  pi->data.o.function = func;
939  }
940  else if(pi->language == LANG_C)
941  {
942  if(pi->data.o.function == func)
943  {
944  pi->ref++;
945  }
946  else
947  {
948  omfree(pi->libname);
949  pi->libname = omStrDup(libname);
950  omfree(pi->procname);
951  pi->procname = omStrDup(procname);
952  pi->language = LANG_C;
953  pi->ref = 1;
954  pi->is_static = pstatic;
955  pi->data.o.function = func;
956  }
957  }
958  else
959  Warn("internal error: unknown procedure type %d",pi->language);
960  return(1);
961  }
962  else
963  {
964  WarnS("iiAddCproc: failed.");
965  }
966  return(0);
967 }
language_defs language
Definition: subexpr.h:58
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:98
short ref
Definition: subexpr.h:59
#define WarnS
Definition: emacs.cc:81
Definition: idrec.h:34
char * procname
Definition: subexpr.h:56
Definition: subexpr.h:21
#define IDTYP(a)
Definition: ipid.h:116
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:259
char * libname
Definition: subexpr.h:55
#define omfree(addr)
Definition: omAllocDecl.h:237
procinfodata data
Definition: subexpr.h:62
#define BVERBOSE(a)
Definition: options.h:33
char is_static
Definition: subexpr.h:60
#define IDPROC(a)
Definition: ipid.h:137
#define pi
Definition: libparse.cc:1143
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978
#define V_REDEFINE
Definition: options.h:43
void Werror(const char *fmt,...)
Definition: reporter.cc:189
int IsCmd(const char *n, int &tok)
Definition: iparith.cc:8746
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ iiAlias()

BOOLEAN iiAlias ( leftv  p)

Definition at line 752 of file ipid.cc.

753 {
754  if (iiCurrArgs==NULL)
755  {
756  Werror("not enough arguments for proc %s",VoiceName());
757  p->CleanUp();
758  return TRUE;
759  }
761  iiCurrArgs=h->next;
762  h->next=NULL;
763  if (h->rtyp!=IDHDL)
764  {
765  BOOLEAN res=iiAssign(p,h);
766  h->CleanUp();
768  return res;
769  }
770  if ((h->Typ()!=p->Typ()) &&(p->Typ()!=DEF_CMD))
771  {
772  WerrorS("type mismatch");
773  return TRUE;
774  }
775  idhdl pp=(idhdl)p->data;
776  switch(pp->typ)
777  {
778  case CRING_CMD:
779  nKillChar((coeffs)pp);
780  break;
781  case DEF_CMD:
782  case INT_CMD:
783  break;
784  case INTVEC_CMD:
785  case INTMAT_CMD:
786  delete IDINTVEC(pp);
787  break;
788  case NUMBER_CMD:
789  nDelete(&IDNUMBER(pp));
790  break;
791  case BIGINT_CMD:
793  break;
794  case MAP_CMD:
795  {
796  map im = IDMAP(pp);
797  omFree((ADDRESS)im->preimage);
798  }
799  // continue as ideal:
800  case IDEAL_CMD:
801  case MODUL_CMD:
802  case MATRIX_CMD:
803  idDelete(&IDIDEAL(pp));
804  break;
805  case PROC_CMD:
806  case RESOLUTION_CMD:
807  case STRING_CMD:
808  omFree((ADDRESS)IDSTRING(pp));
809  break;
810  case LIST_CMD:
811  IDLIST(pp)->Clean();
812  break;
813  case LINK_CMD:
815  break;
816  // case ring: cannot happen
817  default:
818  Werror("unknown type %d",p->Typ());
819  return TRUE;
820  }
821  pp->typ=ALIAS_CMD;
822  IDDATA(pp)=(char*)h->data;
823  int eff_typ=h->Typ();
824  if ((RingDependend(eff_typ))
825  || ((eff_typ==LIST_CMD) && (lRingDependend((lists)h->Data()))))
826  {
827  ipSwapId(pp,IDROOT,currRing->idroot);
828  }
829  h->CleanUp();
831  return FALSE;
832 }
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:134
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:95
#define IDLINK(a)
Definition: ipid.h:135
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
Definition: lists.h:22
#define IDINTVEC(a)
Definition: ipid.h:125
#define FALSE
Definition: auxiliary.h:94
Definition: tok.h:38
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:98
#define IDIDEAL(a)
Definition: ipid.h:130
void * ADDRESS
Definition: auxiliary.h:115
void WerrorS(const char *s)
Definition: feFopen.cc:24
coeffs coeffs_BIGINT
Definition: ipid.cc:54
int Typ()
Definition: subexpr.cc:996
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
poly pp
Definition: myNF.cc:296
void * data
Definition: subexpr.h:89
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:10
int RingDependend(int t)
Definition: gentable.cc:23
Definition: tok.h:56
Definition: tok.h:58
#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:133
idrec * idhdl
Definition: ring.h:18
omBin sleftv_bin
Definition: subexpr.cc:50
const char * VoiceName()
Definition: fevoices.cc:66
#define nDelete(n)
Definition: numbers.h:16
#define IDMAP(a)
Definition: ipid.h:132
leftv next
Definition: subexpr.h:87
#define IDNUMBER(a)
Definition: ipid.h:129
Definition: tok.h:34
Definition: tok.h:116
#define NULL
Definition: omList.c:10
leftv iiCurrArgs
Definition: ipshell.cc:78
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
void * Data()
Definition: subexpr.cc:1138
int typ
Definition: idrec.h:43
Definition: tok.h:117
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
#define IDDATA(a)
Definition: ipid.h:123
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
Definition: ipid.cc:585
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:496
void Werror(const char *fmt,...)
Definition: reporter.cc:189
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1793

§ iiAllStart()

BOOLEAN iiAllStart ( procinfov  pi,
char *  p,
feBufferTypes  t,
int  l 
)

Definition at line 311 of file iplib.cc.

312 {
313  // see below:
314  BITSET save1=si_opt_1;
315  BITSET save2=si_opt_2;
316  newBuffer( omStrDup(p /*pi->data.s.body*/), t /*BT_proc*/,
317  pi, l );
318  BOOLEAN err=yyparse();
319  if (sLastPrinted.rtyp!=0)
320  {
322  }
323  // the access to optionStruct and verboseStruct do not work
324  // on x86_64-Linux for pic-code
325  if ((TEST_V_ALLWARN) &&
326  (t==BT_proc) &&
327  ((save1!=si_opt_1)||(save2!=si_opt_2)) &&
328  (pi->libname!=NULL) && (pi->libname[0]!='\0'))
329  {
330  if ((pi->libname!=NULL) && (pi->libname[0]!='\0'))
331  Warn("option changed in proc %s from %s",pi->procname,pi->libname);
332  else
333  Warn("option changed in proc %s",pi->procname);
334  int i;
335  for (i=0; optionStruct[i].setval!=0; i++)
336  {
337  if ((optionStruct[i].setval & si_opt_1)
338  && (!(optionStruct[i].setval & save1)))
339  {
340  Print(" +%s",optionStruct[i].name);
341  }
342  if (!(optionStruct[i].setval & si_opt_1)
343  && ((optionStruct[i].setval & save1)))
344  {
345  Print(" -%s",optionStruct[i].name);
346  }
347  }
348  for (i=0; verboseStruct[i].setval!=0; i++)
349  {
350  if ((verboseStruct[i].setval & si_opt_2)
351  && (!(verboseStruct[i].setval & save2)))
352  {
353  Print(" +%s",verboseStruct[i].name);
354  }
355  if (!(verboseStruct[i].setval & si_opt_2)
356  && ((verboseStruct[i].setval & save2)))
357  {
358  Print(" -%s",verboseStruct[i].name);
359  }
360  }
361  PrintLn();
362  }
363  return err;
364 }
const struct soptionStruct optionStruct[]
Definition: misc_ip.cc:516
unsigned si_opt_1
Definition: options.c:5
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
return P p
Definition: myNF.cc:203
unsigned setval
Definition: ipid.h:152
#define BITSET
Definition: structs.h:18
char * procname
Definition: subexpr.h:56
char * libname
Definition: subexpr.h:55
int i
Definition: cfEzgcd.cc:123
char name(const Variable &v)
Definition: factory.h:178
int yyparse(void)
Definition: grammar.cc:2101
#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:333
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
Definition: fevoices.cc:171
const struct soptionStruct verboseStruct[]
Definition: misc_ip.cc:546
unsigned si_opt_2
Definition: options.c:6
int BOOLEAN
Definition: auxiliary.h:85
#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

§ iiApply()

BOOLEAN iiApply ( leftv  res,
leftv  a,
int  op,
leftv  proc 
)

Definition at line 6301 of file ipshell.cc.

6302 {
6303  memset(res,0,sizeof(sleftv));
6304  res->rtyp=a->Typ();
6305  switch (res->rtyp /*a->Typ()*/)
6306  {
6307  case INTVEC_CMD:
6308  case INTMAT_CMD:
6309  return iiApplyINTVEC(res,a,op,proc);
6310  case BIGINTMAT_CMD:
6311  return iiApplyBIGINTMAT(res,a,op,proc);
6312  case IDEAL_CMD:
6313  case MODUL_CMD:
6314  case MATRIX_CMD:
6315  return iiApplyIDEAL(res,a,op,proc);
6316  case LIST_CMD:
6317  return iiApplyLIST(res,a,op,proc);
6318  }
6319  WerrorS("first argument to `apply` must allow an index");
6320  return TRUE;
6321 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
int Typ()
Definition: subexpr.cc:996
BOOLEAN iiApplyBIGINTMAT(leftv, leftv, int, leftv)
Definition: ipshell.cc:6259
BOOLEAN iiApplyLIST(leftv res, leftv a, int op, leftv proc)
Definition: ipshell.cc:6269
BOOLEAN iiApplyIDEAL(leftv, leftv, int, leftv)
Definition: ipshell.cc:6264
int rtyp
Definition: subexpr.h:92
Definition: tok.h:117
BOOLEAN iiApplyINTVEC(leftv res, leftv a, int op, leftv proc)
Definition: ipshell.cc:6227

§ iiARROW()

BOOLEAN iiARROW ( leftv  ,
char *  ,
char *   
)

Definition at line 6350 of file ipshell.cc.

6351 {
6352  char *ss=(char*)omAlloc(strlen(a)+strlen(s)+30); /* max. 27 currently */
6353  // find end of s:
6354  int end_s=strlen(s);
6355  while ((end_s>0) && ((s[end_s]<=' ')||(s[end_s]==';'))) end_s--;
6356  s[end_s+1]='\0';
6357  char *name=(char *)omAlloc(strlen(a)+strlen(s)+30);
6358  sprintf(name,"%s->%s",a,s);
6359  // find start of last expression
6360  int start_s=end_s-1;
6361  while ((start_s>=0) && (s[start_s]!=';')) start_s--;
6362  if (start_s<0) // ';' not found
6363  {
6364  sprintf(ss,"parameter def %s;return(%s);\n",a,s);
6365  }
6366  else // s[start_s] is ';'
6367  {
6368  s[start_s]='\0';
6369  sprintf(ss,"parameter def %s;%s;return(%s);\n",a,s,s+start_s+1);
6370  }
6371  memset(r,0,sizeof(*r));
6372  // now produce procinfo for PROC_CMD:
6373  r->data = (void *)omAlloc0Bin(procinfo_bin);
6374  ((procinfo *)(r->data))->language=LANG_NONE;
6375  iiInitSingularProcinfo((procinfo *)r->data,"",name,0,0);
6376  ((procinfo *)r->data)->data.s.body=ss;
6377  omFree(name);
6378  r->rtyp=PROC_CMD;
6379  //r->rtyp=STRING_CMD;
6380  //r->data=ss;
6381  return FALSE;
6382 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:94
procinfo * iiInitSingularProcinfo(procinfov pi, const char *libname, const char *procname, int, long pos, BOOLEAN pstatic)
Definition: iplib.cc:883
#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
char name(const Variable &v)
Definition: factory.h:178
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206

§ iiAssign()

BOOLEAN iiAssign ( leftv  left,
leftv  right,
BOOLEAN  toplevel = TRUE 
)

Definition at line 1793 of file ipassign.cc.

1794 {
1795  if (errorreported) return TRUE;
1796  int ll=l->listLength();
1797  int rl;
1798  int lt=l->Typ();
1799  int rt=NONE;
1800  BOOLEAN b;
1801  if (l->rtyp==ALIAS_CMD)
1802  {
1803  Werror("`%s` is read-only",l->Name());
1804  }
1805 
1806  if (l->rtyp==IDHDL)
1807  {
1808  atKillAll((idhdl)l->data);
1809  IDFLAG((idhdl)l->data)=0;
1810  l->attribute=NULL;
1811  toplevel=FALSE;
1812  }
1813  else if (l->attribute!=NULL)
1814  atKillAll((idhdl)l);
1815  l->flag=0;
1816  if (ll==1)
1817  {
1818  /* l[..] = ... */
1819  if(l->e!=NULL)
1820  {
1821  BOOLEAN like_lists=0;
1822  blackbox *bb=NULL;
1823  int bt;
1824  if (((bt=l->rtyp)>MAX_TOK)
1825  || ((l->rtyp==IDHDL) && ((bt=IDTYP((idhdl)l->data))>MAX_TOK)))
1826  {
1827  bb=getBlackboxStuff(bt);
1828  like_lists=BB_LIKE_LIST(bb); // bb like a list
1829  }
1830  else if (((l->rtyp==IDHDL) && (IDTYP((idhdl)l->data)==LIST_CMD))
1831  || (l->rtyp==LIST_CMD))
1832  {
1833  like_lists=2; // bb in a list
1834  }
1835  if(like_lists)
1836  {
1837  if (traceit&TRACE_ASSIGN) PrintS("assign list[..]=...or similar\n");
1838  if (like_lists==1)
1839  {
1840  // check blackbox/newtype type:
1841  if(bb->blackbox_CheckAssign(bb,l,r)) return TRUE;
1842  }
1843  b=jiAssign_list(l,r);
1844  if((!b) && (like_lists==2))
1845  {
1846  //Print("jjA_L_LIST: - 2 \n");
1847  if((l->rtyp==IDHDL) && (l->data!=NULL))
1848  {
1849  ipMoveId((idhdl)l->data);
1850  l->attribute=IDATTR((idhdl)l->data);
1851  l->flag=IDFLAG((idhdl)l->data);
1852  }
1853  }
1854  r->CleanUp();
1855  Subexpr h;
1856  while (l->e!=NULL)
1857  {
1858  h=l->e->next;
1860  l->e=h;
1861  }
1862  return b;
1863  }
1864  }
1865  if (lt>MAX_TOK)
1866  {
1867  blackbox *bb=getBlackboxStuff(lt);
1868 #ifdef BLACKBOX_DEVEL
1869  Print("bb-assign: bb=%lx\n",bb);
1870 #endif
1871  return (bb==NULL) || bb->blackbox_Assign(l,r);
1872  }
1873  // end of handling elems of list and similar
1874  rl=r->listLength();
1875  if (rl==1)
1876  {
1877  /* system variables = ... */
1878  if(((l->rtyp>=VECHO)&&(l->rtyp<=VPRINTLEVEL))
1879  ||((l->rtyp>=VALTVARS)&&(l->rtyp<=VMINPOLY)))
1880  {
1881  b=iiAssign_sys(l,r);
1882  r->CleanUp();
1883  //l->CleanUp();
1884  return b;
1885  }
1886  rt=r->Typ();
1887  /* a = ... */
1888  if ((lt!=MATRIX_CMD)
1889  &&(lt!=BIGINTMAT_CMD)
1890  &&(lt!=CMATRIX_CMD)
1891  &&(lt!=INTMAT_CMD)
1892  &&((lt==rt)||(lt!=LIST_CMD)))
1893  {
1894  b=jiAssign_1(l,r,toplevel);
1895  if (l->rtyp==IDHDL)
1896  {
1897  if ((lt==DEF_CMD)||(lt==LIST_CMD))
1898  {
1899  ipMoveId((idhdl)l->data);
1900  }
1901  l->attribute=IDATTR((idhdl)l->data);
1902  l->flag=IDFLAG((idhdl)l->data);
1903  l->CleanUp();
1904  }
1905  r->CleanUp();
1906  return b;
1907  }
1908  if (((lt!=LIST_CMD)
1909  &&((rt==MATRIX_CMD)
1910  ||(rt==BIGINTMAT_CMD)
1911  ||(rt==CMATRIX_CMD)
1912  ||(rt==INTMAT_CMD)
1913  ||(rt==INTVEC_CMD)
1914  ||(rt==MODUL_CMD)))
1915  ||((lt==LIST_CMD)
1916  &&(rt==RESOLUTION_CMD))
1917  )
1918  {
1919  b=jiAssign_1(l,r,toplevel);
1920  if((l->rtyp==IDHDL)&&(l->data!=NULL))
1921  {
1922  if ((lt==DEF_CMD) || (lt==LIST_CMD))
1923  {
1924  //Print("ipAssign - 3.0\n");
1925  ipMoveId((idhdl)l->data);
1926  }
1927  l->attribute=IDATTR((idhdl)l->data);
1928  l->flag=IDFLAG((idhdl)l->data);
1929  }
1930  r->CleanUp();
1931  Subexpr h;
1932  while (l->e!=NULL)
1933  {
1934  h=l->e->next;
1936  l->e=h;
1937  }
1938  return b;
1939  }
1940  }
1941  if (rt==NONE) rt=r->Typ();
1942  }
1943  else if (ll==(rl=r->listLength()))
1944  {
1945  b=jiAssign_rec(l,r);
1946  return b;
1947  }
1948  else
1949  {
1950  if (rt==NONE) rt=r->Typ();
1951  if (rt==INTVEC_CMD)
1952  return jiA_INTVEC_L(l,r);
1953  else if (rt==VECTOR_CMD)
1954  return jiA_VECTOR_L(l,r);
1955  else if ((rt==IDEAL_CMD)||(rt==MATRIX_CMD))
1956  return jiA_MATRIX_L(l,r);
1957  else if ((rt==STRING_CMD)&&(rl==1))
1958  return jiA_STRING_L(l,r);
1959  Werror("length of lists in assignment does not match (l:%d,r:%d)",
1960  ll,rl);
1961  return TRUE;
1962  }
1963 
1964  leftv hh=r;
1965  BOOLEAN nok=FALSE;
1966  BOOLEAN map_assign=FALSE;
1967  switch (lt)
1968  {
1969  case INTVEC_CMD:
1970  nok=jjA_L_INTVEC(l,r,new intvec(exprlist_length(r)));
1971  break;
1972  case INTMAT_CMD:
1973  {
1974  nok=jjA_L_INTVEC(l,r,new intvec(IDINTVEC((idhdl)l->data)));
1975  break;
1976  }
1977  case BIGINTMAT_CMD:
1978  {
1979  nok=jjA_L_BIGINTMAT(l, r, new bigintmat(IDBIMAT((idhdl)l->data)));
1980  break;
1981  }
1982  case MAP_CMD:
1983  {
1984  // first element in the list sl (r) must be a ring
1985  if ((rt == RING_CMD)&&(r->e==NULL))
1986  {
1987  omFree((ADDRESS)IDMAP((idhdl)l->data)->preimage);
1988  IDMAP((idhdl)l->data)->preimage = omStrDup (r->Fullname());
1989  /* advance the expressionlist to get the next element after the ring */
1990  hh = r->next;
1991  //r=hh;
1992  }
1993  else
1994  {
1995  WerrorS("expected ring-name");
1996  nok=TRUE;
1997  break;
1998  }
1999  if (hh==NULL) /* map-assign: map f=r; */
2000  {
2001  WerrorS("expected image ideal");
2002  nok=TRUE;
2003  break;
2004  }
2005  if ((hh->next==NULL)&&(hh->Typ()==IDEAL_CMD))
2006  return jiAssign_1(l,hh,toplevel); /* map-assign: map f=r,i; */
2007  //no break, handle the rest like an ideal:
2008  map_assign=TRUE;
2009  }
2010  case MATRIX_CMD:
2011  case IDEAL_CMD:
2012  case MODUL_CMD:
2013  {
2014  sleftv t;
2015  matrix olm = (matrix)l->Data();
2016  int rk;
2017  char *pr=((map)olm)->preimage;
2018  BOOLEAN module_assign=(/*l->Typ()*/ lt==MODUL_CMD);
2019  matrix lm ;
2020  int num;
2021  int j,k;
2022  int i=0;
2023  int mtyp=MATRIX_CMD; /*Type of left side object*/
2024  int etyp=POLY_CMD; /*Type of elements of left side object*/
2025 
2026  if (lt /*l->Typ()*/==MATRIX_CMD)
2027  {
2028  rk=olm->rows();
2029  num=olm->cols()*rk /*olm->rows()*/;
2030  lm=mpNew(olm->rows(),olm->cols());
2031  int el;
2032  if ((traceit&TRACE_ASSIGN) && (num!=(el=exprlist_length(hh))))
2033  {
2034  Warn("expression list length(%d) does not match matrix size(%d)",el,num);
2035  }
2036  }
2037  else /* IDEAL_CMD or MODUL_CMD */
2038  {
2039  num=exprlist_length(hh);
2040  lm=(matrix)idInit(num,1);
2041  if (module_assign)
2042  {
2043  rk=0;
2044  mtyp=MODUL_CMD;
2045  etyp=VECTOR_CMD;
2046  }
2047  else
2048  rk=1;
2049  }
2050 
2051  int ht;
2052  loop
2053  {
2054  if (hh==NULL)
2055  break;
2056  else
2057  {
2058  matrix rm;
2059  ht=hh->Typ();
2060  if ((j=iiTestConvert(ht,etyp))!=0)
2061  {
2062  nok=iiConvert(ht,etyp,j,hh,&t);
2063  hh->next=t.next;
2064  if (nok) break;
2065  lm->m[i]=(poly)t.CopyD(etyp);
2066  pNormalize(lm->m[i]);
2067  if (module_assign) rk=si_max(rk,(int)pMaxComp(lm->m[i]));
2068  i++;
2069  }
2070  else
2071  if ((j=iiTestConvert(ht,mtyp))!=0)
2072  {
2073  nok=iiConvert(ht,mtyp,j,hh,&t);
2074  hh->next=t.next;
2075  if (nok) break;
2076  rm = (matrix)t.CopyD(mtyp);
2077  if (module_assign)
2078  {
2079  j = si_min(num,rm->cols());
2080  rk=si_max(rk,(int)rm->rank);
2081  }
2082  else
2083  j = si_min(num-i,rm->rows() * rm->cols());
2084  for(k=0;k<j;k++,i++)
2085  {
2086  lm->m[i]=rm->m[k];
2087  pNormalize(lm->m[i]);
2088  rm->m[k]=NULL;
2089  }
2090  idDelete((ideal *)&rm);
2091  }
2092  else
2093  {
2094  nok=TRUE;
2095  break;
2096  }
2097  t.next=NULL;t.CleanUp();
2098  if (i==num) break;
2099  hh=hh->next;
2100  }
2101  }
2102  if (nok)
2103  idDelete((ideal *)&lm);
2104  else
2105  {
2106  idDelete((ideal *)&olm);
2107  if (module_assign) lm->rank=rk;
2108  else if (map_assign) ((map)lm)->preimage=pr;
2109  l=l->LData();
2110  if (l->rtyp==IDHDL)
2111  IDMATRIX((idhdl)l->data)=lm;
2112  else
2113  l->data=(char *)lm;
2114  }
2115  break;
2116  }
2117  case STRING_CMD:
2118  nok=jjA_L_STRING(l,r);
2119  break;
2120  //case DEF_CMD:
2121  case LIST_CMD:
2122  nok=jjA_L_LIST(l,r);
2123  break;
2124  case NONE:
2125  case 0:
2126  Werror("cannot assign to %s",l->Fullname());
2127  nok=TRUE;
2128  break;
2129  default:
2130  WerrorS("assign not impl.");
2131  nok=TRUE;
2132  break;
2133  } /* end switch: typ */
2134  if (nok && (!errorreported)) WerrorS("incompatible type in list assignment");
2135  r->CleanUp();
2136  return nok;
2137 }
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:1324
void ipMoveId(idhdl tomove)
Definition: ipid.cc:610
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:293
Definition: tok.h:203
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define TRACE_ASSIGN
Definition: reporter.h:45
static BOOLEAN jjA_L_INTVEC(leftv l, leftv r, intvec *iv)
Definition: ipassign.cc:1456
#define Print
Definition: emacs.cc:83
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
CanonicalForm num(const CanonicalForm &f)
#define IDINTVEC(a)
Definition: ipid.h:125
#define pMaxComp(p)
Definition: polys.h:281
loop
Definition: myNF.cc:98
static int si_min(const int a, const int b)
Definition: auxiliary.h:121
#define FALSE
Definition: auxiliary.h:94
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:401
int exprlist_length(leftv v)
Definition: ipshell.cc:544
Matrices of numbers.
Definition: bigintmat.h:51
static BOOLEAN jiAssign_list(leftv l, leftv r)
Definition: ipassign.cc:1700
Definition: tok.h:213
static BOOLEAN jiAssign_1(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1086
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
#define TRUE
Definition: auxiliary.h:98
void * ADDRESS
Definition: auxiliary.h:115
#define IDBIMAT(a)
Definition: ipid.h:126
void WerrorS(const char *s)
Definition: feFopen.cc:24
int k
Definition: cfEzgcd.cc:93
int traceit
Definition: febase.cc:47
int Typ()
Definition: subexpr.cc:996
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
static BOOLEAN jjA_L_BIGINTMAT(leftv l, leftv r, bigintmat *bim)
Definition: ipassign.cc:1505
static BOOLEAN iiAssign_sys(leftv l, leftv r)
Definition: ipassign.cc:1250
#define IDTYP(a)
Definition: ipid.h:116
poly * m
Definition: matpol.h:19
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
int j
Definition: myNF.cc:70
Definition: tok.h:58
#define omFree(addr)
Definition: omAllocDecl.h:261
pNormalize(P.p)
static BOOLEAN jiA_VECTOR_L(leftv l, leftv r)
Definition: ipassign.cc:1350
omBin sSubexpr_bin
Definition: subexpr.cc:49
ip_smatrix * matrix
static BOOLEAN jjA_L_STRING(leftv l, leftv r)
Definition: ipassign.cc:1554
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDMAP(a)
Definition: ipid.h:132
short errorreported
Definition: feFopen.cc:23
leftv next
Definition: subexpr.h:87
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47
Definition: tok.h:34
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define atKillAll(H)
Definition: attrib.h:42
static BOOLEAN jiA_STRING_L(leftv l, leftv r)
Definition: ipassign.cc:1664
int & cols()
Definition: matpol.h:25
#define NULL
Definition: omList.c:10
static BOOLEAN jiAssign_rec(leftv l, leftv r)
Definition: ipassign.cc:1770
static BOOLEAN jiA_MATRIX_L(leftv l, leftv r)
Definition: ipassign.cc:1588
static BOOLEAN jjA_L_LIST(leftv l, leftv r)
Definition: ipassign.cc:1391
#define IDFLAG(a)
Definition: ipid.h:117
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
#define IDATTR(a)
Definition: ipid.h:120
Definition: tok.h:117
polyrec * poly
Definition: hilb.h:10
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
const poly b
Definition: syzextra.cc:213
#define NONE
Definition: tok.h:216
void Werror(const char *fmt,...)
Definition: reporter.cc:189
void * CopyD(int t)
Definition: subexpr.cc:708
int l
Definition: cfEzgcd.cc:94
long rank
Definition: matpol.h:20
#define IDMATRIX(a)
Definition: ipid.h:131
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:16
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ iiAssignCR()

BOOLEAN iiAssignCR ( leftv  ,
leftv   
)

Definition at line 6384 of file ipshell.cc.

6385 {
6386  char* ring_name=omStrDup((char*)r->Name());
6387  int t=arg->Typ();
6388  if (t==RING_CMD)
6389  {
6390  sleftv tmp;
6391  memset(&tmp,0,sizeof(tmp));
6392  tmp.rtyp=IDHDL;
6393  tmp.data=(char*)rDefault(ring_name);
6394  if (tmp.data!=NULL)
6395  {
6396  BOOLEAN b=iiAssign(&tmp,arg);
6397  if (b) return TRUE;
6398  rSetHdl(ggetid(ring_name));
6399  omFree(ring_name);
6400  return FALSE;
6401  }
6402  else
6403  return TRUE;
6404  }
6405  else if (t==CRING_CMD)
6406  {
6407  sleftv tmp;
6408  sleftv n;
6409  memset(&n,0,sizeof(n));
6410  n.name=ring_name;
6411  if (iiDeclCommand(&tmp,&n,myynest,CRING_CMD,&IDROOT)) return TRUE;
6412  if (iiAssign(&tmp,arg)) return TRUE;
6413  //Print("create %s\n",r->Name());
6414  //Print("from %s(%d)\n",Tok2Cmdname(arg->Typ()),arg->Typ());
6415  return FALSE;
6416  }
6417  //Print("create %s\n",r->Name());
6418  //Print("from %s(%d)\n",Tok2Cmdname(arg->Typ()),arg->Typ());
6419  return TRUE;// not handled -> error for now
6420 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:94
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:98
#define IDHDL
Definition: tok.h:31
idhdl rDefault(const char *s)
Definition: ipshell.cc:1519
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:1122
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void rSetHdl(idhdl h)
Definition: ipshell.cc:5002
int BOOLEAN
Definition: auxiliary.h:85
const poly b
Definition: syzextra.cc:213
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)
Definition: ipid.cc:496
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1793
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ iiBranchTo()

BOOLEAN iiBranchTo ( leftv  r,
leftv  args 
)

Definition at line 1179 of file ipshell.cc.

1180 {
1181  // <string1...stringN>,<proc>
1182  // known: args!=NULL, l>=1
1183  int l=args->listLength();
1184  int ll=0;
1185  if (iiCurrArgs!=NULL) ll=iiCurrArgs->listLength();
1186  if (ll!=(l-1)) return FALSE;
1187  leftv h=args;
1188  short *t=(short*)omAlloc(l*sizeof(short));
1189  t[0]=l-1;
1190  int b;
1191  int i;
1192  for(i=1;i<l;i++,h=h->next)
1193  {
1194  if (h->Typ()!=STRING_CMD)
1195  {
1196  omFree(t);
1197  Werror("arg %d is not a string",i);
1198  return TRUE;
1199  }
1200  int tt;
1201  b=IsCmd((char *)h->Data(),tt);
1202  if(b) t[i]=tt;
1203  else
1204  {
1205  omFree(t);
1206  Werror("arg %d is not a type name",i);
1207  return TRUE;
1208  }
1209  }
1210  if (h->Typ()!=PROC_CMD)
1211  {
1212  omFree(t);
1213  Werror("last arg (%d) is not a proc",i);
1214  return TRUE;
1215  }
1216  b=iiCheckTypes(iiCurrArgs,t,0);
1217  omFree(t);
1218  if (b && (h->rtyp==IDHDL) && (h->e==NULL))
1219  {
1220  BOOLEAN err;
1221  //Print("branchTo: %s\n",h->Name());
1222  iiCurrProc=(idhdl)h->data;
1224  if( pi->data.s.body==NULL )
1225  {
1227  if (pi->data.s.body==NULL) return TRUE;
1228  }
1229  if ((pi->pack!=NULL)&&(currPack!=pi->pack))
1230  {
1231  currPack=pi->pack;
1234  //Print("set pack=%s\n",IDID(currPackHdl));
1235  }
1236  err=iiAllStart(pi,pi->data.s.body,BT_proc,pi->data.s.body_lineno-(iiCurrArgs==NULL));
1238  if (iiCurrArgs!=NULL)
1239  {
1240  if (!err) Warn("too many arguments for %s",IDID(iiCurrProc));
1241  iiCurrArgs->CleanUp();
1243  iiCurrArgs=NULL;
1244  }
1245  return 2-err;
1246  }
1247  return FALSE;
1248 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
idhdl currPackHdl
Definition: ipid.cc:61
#define IDID(a)
Definition: ipid.h:119
#define FALSE
Definition: auxiliary.h:94
int listLength()
Definition: subexpr.cc:61
#define TRUE
Definition: auxiliary.h:98
void * ADDRESS
Definition: auxiliary.h:115
#define omAlloc(size)
Definition: omAllocDecl.h:210
BOOLEAN exitBuffer(feBufferTypes typ)
Definition: fevoices.cc:241
#define IDHDL
Definition: tok.h:31
idhdl iiCurrProc
Definition: ipshell.cc:79
#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:311
#define IDPROC(a)
Definition: ipid.h:137
#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:6440
package currPack
Definition: ipid.cc:63
leftv iiCurrArgs
Definition: ipshell.cc:78
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
idhdl packFindHdl(package r)
Definition: ipid.cc:739
void iiCheckPack(package &p)
Definition: ipshell.cc:1505
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
char * iiGetLibProcBuffer(procinfo *pi, int part)
Definition: iplib.cc:210
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
const poly b
Definition: syzextra.cc:213
void Werror(const char *fmt,...)
Definition: reporter.cc:189
int l
Definition: cfEzgcd.cc:94
utypes data
Definition: idrec.h:40
int IsCmd(const char *n, int &tok)
Definition: iparith.cc:8746
#define Warn
Definition: emacs.cc:80

§ iiCheckPack()

void iiCheckPack ( package p)

Definition at line 1505 of file ipshell.cc.

1506 {
1507  if (p!=basePack)
1508  {
1509  idhdl t=basePack->idroot;
1510  while ((t!=NULL) && (IDTYP(t)!=PACKAGE_CMD) && (IDPACKAGE(t)!=p)) t=t->next;
1511  if (t==NULL)
1512  {
1513  WarnS("package not found\n");
1514  p=basePack;
1515  }
1516  }
1517 }
return P p
Definition: myNF.cc:203
#define WarnS
Definition: emacs.cc:81
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:136
#define IDTYP(a)
Definition: ipid.h:116
idhdl next
Definition: idrec.h:38
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:64

§ iiCheckRing()

BOOLEAN iiCheckRing ( int  i)

Definition at line 1461 of file ipshell.cc.

1462 {
1463  if (currRing==NULL)
1464  {
1465  #ifdef SIQ
1466  if (siq<=0)
1467  {
1468  #endif
1469  if (RingDependend(i))
1470  {
1471  WerrorS("no ring active");
1472  return TRUE;
1473  }
1474  #ifdef SIQ
1475  }
1476  #endif
1477  }
1478  return FALSE;
1479 }
#define FALSE
Definition: auxiliary.h:94
BOOLEAN siq
Definition: subexpr.cc:58
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int RingDependend(int t)
Definition: gentable.cc:23
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10

§ iiCheckTypes()

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 6440 of file ipshell.cc.

6441 {
6442  if (args==NULL)
6443  {
6444  if (type_list[0]==0) return TRUE;
6445  else
6446  {
6447  if (report) WerrorS("no arguments expected");
6448  return FALSE;
6449  }
6450  }
6451  int l=args->listLength();
6452  if (l!=(int)type_list[0])
6453  {
6454  if (report) iiReportTypes(0,l,type_list);
6455  return FALSE;
6456  }
6457  for(int i=1;i<=l;i++,args=args->next)
6458  {
6459  short t=type_list[i];
6460  if (t!=ANY_TYPE)
6461  {
6462  if (((t==IDHDL)&&(args->rtyp!=IDHDL))
6463  || (t!=args->Typ()))
6464  {
6465  if (report) iiReportTypes(i,args->Typ(),type_list);
6466  return FALSE;
6467  }
6468  }
6469  }
6470  return TRUE;
6471 }
#define ANY_TYPE
Definition: tok.h:30
#define FALSE
Definition: auxiliary.h:94
int listLength()
Definition: subexpr.cc:61
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define IDHDL
Definition: tok.h:31
static void iiReportTypes(int nr, int t, const short *T)
Definition: ipshell.cc:6422
int i
Definition: cfEzgcd.cc:123
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
int l
Definition: cfEzgcd.cc:94

§ iiConvName()

char* iiConvName ( const char *  libname)

Definition at line 1214 of file iplib.cc.

1215 {
1216  char *tmpname = omStrDup(libname);
1217  char *p = strrchr(tmpname, DIR_SEP);
1218  char *r;
1219  if(p==NULL) p = tmpname;
1220  else p++;
1221  r = (char *)strchr(p, '.');
1222  if( r!= NULL) *r = '\0';
1223  r = omStrDup(p);
1224  *r = mytoupper(*r);
1225  // printf("iiConvName: '%s' '%s' => '%s'\n", libname, tmpname, r);
1226  omFree((ADDRESS)tmpname);
1227 
1228  return(r);
1229 }
char mytoupper(char c)
Definition: iplib.cc:1195
return P p
Definition: myNF.cc:203
void * ADDRESS
Definition: auxiliary.h:115
#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

§ iiDebug()

void iiDebug ( )

Definition at line 984 of file ipshell.cc.

985 {
986 #ifdef HAVE_SDB
987  sdb_flags=1;
988 #endif
989  Print("\n-- break point in %s --\n",VoiceName());
991  char * s;
993  s = (char *)omAlloc(BREAK_LINE_LENGTH+4);
994  loop
995  {
996  memset(s,0,80);
998  if (s[BREAK_LINE_LENGTH-1]!='\0')
999  {
1000  Print("line too long, max is %d chars\n",BREAK_LINE_LENGTH);
1001  }
1002  else
1003  break;
1004  }
1005  if (*s=='\n')
1006  {
1008  }
1009 #if MDEBUG
1010  else if(strncmp(s,"cont;",5)==0)
1011  {
1013  }
1014 #endif /* MDEBUG */
1015  else
1016  {
1017  strcat( s, "\n;~\n");
1018  newBuffer(s,BT_execute);
1019  }
1020 }
void VoiceBackTrack()
Definition: fevoices.cc:77
const CanonicalForm int s
Definition: facAbsFact.cc:55
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
Definition: feread.cc:33
int sdb_flags
Definition: sdb.cc:32
#define Print
Definition: emacs.cc:83
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
#define omAlloc(size)
Definition: omAllocDecl.h:210
BOOLEAN iiDebugMarker
Definition: ipshell.cc:982
const char * VoiceName()
Definition: fevoices.cc:66
#define BREAK_LINE_LENGTH
Definition: ipshell.cc:983
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
Definition: fevoices.cc:171

§ iiDeclCommand()

int iiDeclCommand ( leftv  sy,
leftv  name,
int  lev,
int  t,
idhdl root,
BOOLEAN  isring = FALSE,
BOOLEAN  init_b = TRUE 
)

Definition at line 1122 of file ipshell.cc.

1123 {
1124  BOOLEAN res=FALSE;
1125  const char *id = name->name;
1126 
1127  memset(sy,0,sizeof(sleftv));
1128  if ((name->name==NULL)||(isdigit(name->name[0])))
1129  {
1130  WerrorS("object to declare is not a name");
1131  res=TRUE;
1132  }
1133  else
1134  {
1135  if (t==QRING_CMD) t=RING_CMD; // qring is always RING_CMD
1136 
1137  if (TEST_V_ALLWARN
1138  && (name->rtyp!=0)
1139  && (name->rtyp!=IDHDL)
1140  && (currRingHdl!=NULL) && (IDLEV(currRingHdl)==myynest))
1141  {
1142  Warn("`%s` is %s in %s:%d:%s",name->name,Tok2Cmdname(name->rtyp),
1144  }
1145  {
1146  sy->data = (char *)enterid(id,lev,t,root,init_b);
1147  }
1148  if (sy->data!=NULL)
1149  {
1150  sy->rtyp=IDHDL;
1151  currid=sy->name=IDID((idhdl)sy->data);
1152  // name->name=NULL; /* used in enterid */
1153  //sy->e = NULL;
1154  if (name->next!=NULL)
1155  {
1157  res=iiDeclCommand(sy->next,name->next,lev,t,root, isring);
1158  }
1159  }
1160  else res=TRUE;
1161  }
1162  name->CleanUp();
1163  return res;
1164 }
#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:119
#define FALSE
Definition: auxiliary.h:94
char * filename
Definition: fevoices.h:62
#define TRUE
Definition: auxiliary.h:98
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:24
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
const char * currid
Definition: grammar.cc:171
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:259
char my_yylinebuf[80]
Definition: febase.cc:48
const char * name
Definition: subexpr.h:88
idhdl currRingHdl
Definition: ipid.cc:65
omBin sleftv_bin
Definition: subexpr.cc:50
#define IDLEV(a)
Definition: ipid.h:118
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:1122
#define NULL
Definition: omList.c:10
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:132
Voice * currentVoice
Definition: fevoices.cc:57
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
Definition: tok.h:157
int BOOLEAN
Definition: auxiliary.h:85
#define TEST_V_ALLWARN
Definition: options.h:135
#define Warn
Definition: emacs.cc:80

§ iiEStart()

BOOLEAN iiEStart ( char *  example,
procinfo pi 
)

Definition at line 591 of file iplib.cc.

592 {
593  BOOLEAN err;
594  int old_echo=si_echo;
595 
596  iiCheckNest();
597  procstack->push(example);
600  {
601  if (traceit&TRACE_SHOW_LINENO) printf("\n");
602  printf("entering example (level %d)\n",myynest);
603  }
604  myynest++;
605 
606  err=iiAllStart(pi,example,BT_example,(pi != NULL ? pi->data.s.example_lineno: 0));
607 
609  myynest--;
610  si_echo=old_echo;
611  if (traceit&TRACE_SHOW_PROC)
612  {
613  if (traceit&TRACE_SHOW_LINENO) printf("\n");
614  printf("leaving -example- (level %d)\n",myynest);
615  }
616  if (iiLocalRing[myynest] != currRing)
617  {
618  if (iiLocalRing[myynest]!=NULL)
619  {
622  }
623  else
624  {
626  currRing=NULL;
627  }
628  }
629  procstack->pop();
630  return err;
631 }
#define TRACE_SHOW_LINENO
Definition: reporter.h:30
proclevel * procstack
Definition: ipid.cc:58
int traceit
Definition: febase.cc:47
static void iiCheckNest()
Definition: iplib.cc:490
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:10
void killlocals(int v)
Definition: ipshell.cc:378
procinfodata data
Definition: subexpr.h:62
idhdl currRingHdl
Definition: ipid.cc:65
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1564
BOOLEAN iiAllStart(procinfov pi, char *p, feBufferTypes t, int l)
Definition: iplib.cc:311
ring * iiLocalRing
Definition: iplib.cc:470
#define NULL
Definition: omList.c:10
#define TRACE_SHOW_PROC
Definition: reporter.h:28
void rSetHdl(idhdl h)
Definition: ipshell.cc:5002
void push(char *)
Definition: ipid.cc:711
void pop()
Definition: ipid.cc:721
int BOOLEAN
Definition: auxiliary.h:85
int si_echo
Definition: febase.cc:41

§ iiExport() [1/2]

BOOLEAN iiExport ( leftv  v,
int  toLev 
)

Definition at line 1383 of file ipshell.cc.

1384 {
1385  BOOLEAN nok=FALSE;
1386  leftv r=v;
1387  while (v!=NULL)
1388  {
1389  if ((v->name==NULL)||(v->rtyp==0)||(v->e!=NULL))
1390  {
1391  Werror("cannot export:%s of internal type %d",v->name,v->rtyp);
1392  nok=TRUE;
1393  }
1394  else
1395  {
1396  if(iiInternalExport(v, toLev))
1397  {
1398  r->CleanUp();
1399  return TRUE;
1400  }
1401  }
1402  v=v->next;
1403  }
1404  r->CleanUp();
1405  return nok;
1406 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Subexpr e
Definition: subexpr.h:106
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
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:1285
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
int BOOLEAN
Definition: auxiliary.h:85
void Werror(const char *fmt,...)
Definition: reporter.cc:189

§ iiExport() [2/2]

BOOLEAN iiExport ( leftv  v,
int  toLev,
package  pack 
)

Definition at line 1409 of file ipshell.cc.

1410 {
1411 // if ((pack==basePack)&&(pack!=currPack))
1412 // { Warn("'exportto' to Top is depreciated in >>%s<<",my_yylinebuf);}
1413  BOOLEAN nok=FALSE;
1414  leftv rv=v;
1415  while (v!=NULL)
1416  {
1417  if ((v->name==NULL)||(v->rtyp==0)||(v->e!=NULL)
1418  )
1419  {
1420  Werror("cannot export:%s of internal type %d",v->name,v->rtyp);
1421  nok=TRUE;
1422  }
1423  else
1424  {
1425  idhdl old=pack->idroot->get( v->name,toLev);
1426  if (old!=NULL)
1427  {
1428  if ((pack==currPack) && (old==(idhdl)v->data))
1429  {
1430  if (BVERBOSE(V_REDEFINE)) Warn("`%s` is already global",IDID(old));
1431  break;
1432  }
1433  else if (IDTYP(old)==v->Typ())
1434  {
1435  if (BVERBOSE(V_REDEFINE))
1436  {
1437  Warn("redefining %s (%s)",IDID(old),my_yylinebuf);
1438  }
1439  v->name=omStrDup(v->name);
1440  killhdl2(old,&(pack->idroot),currRing);
1441  }
1442  else
1443  {
1444  rv->CleanUp();
1445  return TRUE;
1446  }
1447  }
1448  //Print("iiExport: pack=%s\n",IDID(root));
1449  if(iiInternalExport(v, toLev, pack))
1450  {
1451  rv->CleanUp();
1452  return TRUE;
1453  }
1454  }
1455  v=v->next;
1456  }
1457  rv->CleanUp();
1458  return nok;
1459 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Subexpr e
Definition: subexpr.h:106
#define IDID(a)
Definition: ipid.h:119
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int Typ()
Definition: subexpr.cc:996
Definition: idrec.h:34
idhdl get(const char *s, int lev)
Definition: ipid.cc:91
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:10
#define IDTYP(a)
Definition: ipid.h:116
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:409
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:1285
#define NULL
Definition: omList.c:10
package currPack
Definition: ipid.cc:63
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
int BOOLEAN
Definition: auxiliary.h:85
#define V_REDEFINE
Definition: options.h:43
void Werror(const char *fmt,...)
Definition: reporter.cc:189
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ iiExprArith1()

BOOLEAN iiExprArith1 ( leftv  res,
sleftv a,
int  op 
)

§ iiExprArith1Tab()

BOOLEAN iiExprArith1Tab ( leftv  res,
leftv  a,
int  op,
const struct sValCmd1 dA1,
int  at,
const 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 8202 of file iparith.cc.

8203 {
8204  memset(res,0,sizeof(sleftv));
8205  BOOLEAN call_failed=FALSE;
8206 
8207  if (!errorreported)
8208  {
8209  BOOLEAN failed=FALSE;
8210  iiOp=op;
8211  int i = 0;
8212  while (dA1[i].cmd==op)
8213  {
8214  if (at==dA1[i].arg)
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(at));
8230  res->rtyp=dA1[i].res;
8231  if ((call_failed=dA1[i].p(res,a)))
8232  {
8233  break;// leave loop, goto error handling
8234  }
8235  if (a->Next()!=NULL)
8236  {
8238  failed=iiExprArith1(res->next,a->next,op);
8239  }
8240  a->CleanUp();
8241  return failed;
8242  }
8243  i++;
8244  }
8245  // implicite type conversion --------------------------------------------
8246  if (dA1[i].cmd!=op)
8247  {
8249  i=0;
8250  //Print("fuer %c , typ: %s\n",op,Tok2Cmdname(at));
8251  while (dA1[i].cmd==op)
8252  {
8253  int ai;
8254  //Print("test %s\n",Tok2Cmdname(dA1[i].arg));
8255  if ((dA1[i].valid_for & NO_CONVERSION)==0)
8256  {
8257  if ((ai=iiTestConvert(at,dA1[i].arg,dConvertTypes))!=0)
8258  {
8259  if (currRing!=NULL)
8260  {
8261  if (check_valid(dA1[i].valid_for,op)) break;
8262  }
8263  else
8264  {
8265  if (RingDependend(dA1[i].res))
8266  {
8267  WerrorS("no ring active");
8268  break;
8269  }
8270  }
8271  if (traceit&TRACE_CALL)
8272  Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(dA1[i].arg));
8273  res->rtyp=dA1[i].res;
8274  failed= ((iiConvert(at,dA1[i].arg,ai,a,an,dConvertTypes))
8275  || (call_failed=dA1[i].p(res,an)));
8276  // everything done, clean up temp. variables
8277  if (failed)
8278  {
8279  // leave loop, goto error handling
8280  break;
8281  }
8282  else
8283  {
8284  if (an->Next() != NULL)
8285  {
8286  res->next = (leftv)omAllocBin(sleftv_bin);
8287  failed=iiExprArith1(res->next,an->next,op);
8288  }
8289  // everything ok, clean up and return
8290  an->CleanUp();
8292  a->CleanUp();
8293  return failed;
8294  }
8295  }
8296  }
8297  i++;
8298  }
8299  an->CleanUp();
8301  }
8302  // error handling
8303  if (!errorreported)
8304  {
8305  if ((at==0) && (a->Fullname()!=sNoName))
8306  {
8307  Werror("`%s` is not defined",a->Fullname());
8308  }
8309  else
8310  {
8311  i=0;
8312  const char *s = iiTwoOps(op);
8313  Werror("%s(`%s`) failed"
8314  ,s,Tok2Cmdname(at));
8315  if ((!call_failed) && BVERBOSE(V_SHOW_USE))
8316  {
8317  while (dA1[i].cmd==op)
8318  {
8319  if ((dA1[i].res!=0)
8320  && (dA1[i].p!=jjWRONG))
8321  Werror("expected %s(`%s`)"
8322  ,s,Tok2Cmdname(dA1[i].arg));
8323  i++;
8324  }
8325  }
8326  }
8327  }
8328  res->rtyp = UNKNOWN;
8329  }
8330  a->CleanUp();
8331  return TRUE;
8332 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
const CanonicalForm int s
Definition: facAbsFact.cc:55
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:293
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:8333
#define FALSE
Definition: auxiliary.h:94
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:401
return P p
Definition: myNF.cc:203
const char sNoName[]
Definition: subexpr.cc:56
#define TRUE
Definition: auxiliary.h:98
#define UNKNOWN
Definition: tok.h:217
void * ADDRESS
Definition: auxiliary.h:115
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:24
int traceit
Definition: febase.cc:47
short res
Definition: gentable.cc:74
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:10
#define V_SHOW_USE
Definition: options.h:50
static BOOLEAN check_valid(const int p, const int op)
Definition: iparith.cc:9143
const char * Tok2Cmdname(int tok)
Definition: iparith.cc:8868
int RingDependend(int t)
Definition: gentable.cc:23
const char * iiTwoOps(int t)
Definition: gentable.cc:253
static BOOLEAN jjWRONG(leftv, leftv)
Definition: iparith.cc:3520
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:43
short errorreported
Definition: feFopen.cc:23
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
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
#define NO_CONVERSION
Definition: iparith.cc:125
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
int iiOp
Definition: iparith.cc:225
int BOOLEAN
Definition: auxiliary.h:85
void Werror(const char *fmt,...)
Definition: reporter.cc:189

§ iiExprArith2()

BOOLEAN iiExprArith2 ( leftv  res,
sleftv a,
int  op,
sleftv b,
BOOLEAN  proccall = FALSE 
)

§ iiExprArith2Tab()

BOOLEAN iiExprArith2Tab ( leftv  res,
leftv  a,
int  op,
const struct sValCmd2 dA2,
int  at,
const 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 8130 of file iparith.cc.

8134 {
8135  leftv b=a->next;
8136  a->next=NULL;
8137  int bt=b->Typ();
8138  BOOLEAN bo=iiExprArith2TabIntern(res,a,op,b,TRUE,dA2,at,bt,dConvertTypes);
8139  a->next=b;
8140  a->CleanUp(); // to clean up the chain, content already done in iiExprArith2TabIntern
8141  return bo;
8142 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define TRUE
Definition: auxiliary.h:98
int Typ()
Definition: subexpr.cc:996
static BOOLEAN iiExprArith2TabIntern(leftv res, leftv a, int op, leftv b, BOOLEAN proccall, const struct sValCmd2 *dA2, int at, int bt, const struct sConvertTypes *dConvertTypes)
Definition: iparith.cc:7970
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
int BOOLEAN
Definition: auxiliary.h:85
const poly b
Definition: syzextra.cc:213

§ iiExprArith3()

BOOLEAN iiExprArith3 ( leftv  res,
int  op,
leftv  a,
leftv  b,
leftv  c 
)

Definition at line 8548 of file iparith.cc.

8549 {
8550  memset(res,0,sizeof(sleftv));
8551 
8552  if (!errorreported)
8553  {
8554 #ifdef SIQ
8555  if (siq>0)
8556  {
8557  //Print("siq:%d\n",siq);
8559  memcpy(&d->arg1,a,sizeof(sleftv));
8560  a->Init();
8561  memcpy(&d->arg2,b,sizeof(sleftv));
8562  b->Init();
8563  memcpy(&d->arg3,c,sizeof(sleftv));
8564  c->Init();
8565  d->op=op;
8566  d->argc=3;
8567  res->data=(char *)d;
8568  res->rtyp=COMMAND;
8569  return FALSE;
8570  }
8571 #endif
8572  int at=a->Typ();
8573  // handling bb-objects ----------------------------------------------
8574  if (at>MAX_TOK)
8575  {
8576  blackbox *bb=getBlackboxStuff(at);
8577  if (bb!=NULL)
8578  {
8579  if(!bb->blackbox_Op3(op,res,a,b,c)) return FALSE;
8580  if (errorreported) return TRUE;
8581  // else: no op defined
8582  }
8583  else return TRUE;
8584  if (errorreported) return TRUE;
8585  }
8586  int bt=b->Typ();
8587  int ct=c->Typ();
8588 
8589  iiOp=op;
8590  int i=0;
8591  while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
8592  return iiExprArith3TabIntern(res,op,a,b,c,dArith3+i,at,bt,ct,dConvertTypes);
8593  }
8594  a->CleanUp();
8595  b->CleanUp();
8596  c->CleanUp();
8597  //Print("op: %d,result typ:%d\n",op,res->rtyp);
8598  return TRUE;
8599 }
static BOOLEAN iiExprArith3TabIntern(leftv res, int op, leftv a, leftv b, leftv c, const struct sValCmd3 *dA3, int at, int bt, int ct, const struct sConvertTypes *dConvertTypes)
Definition: iparith.cc:8391
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
ip_command * command
Definition: ipid.h:24
const struct sConvertTypes dConvertTypes[]
Definition: table.h:1178
#define FALSE
Definition: auxiliary.h:94
Definition: tok.h:213
BOOLEAN siq
Definition: subexpr.cc:58
#define TRUE
Definition: auxiliary.h:98
void Init()
Definition: subexpr.h:108
int Typ()
Definition: subexpr.cc:996
void * data
Definition: subexpr.h:89
struct sValCmd3 dArith3[]
Definition: table.h:715
int i
Definition: cfEzgcd.cc:123
short errorreported
Definition: feFopen.cc:23
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define NULL
Definition: omList.c:10
omBin sip_command_bin
Definition: ipid.cc:49
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
int iiOp
Definition: iparith.cc:225
#define COMMAND
Definition: tok.h:29
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:16

§ iiExprArith3Tab()

BOOLEAN iiExprArith3Tab ( leftv  res,
leftv  a,
int  op,
const struct sValCmd3 dA3,
int  at,
const 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 8600 of file iparith.cc.

8604 {
8605  leftv b=a->next;
8606  a->next=NULL;
8607  int bt=b->Typ();
8608  leftv c=b->next;
8609  b->next=NULL;
8610  int ct=c->Typ();
8611  BOOLEAN bo=iiExprArith3TabIntern(res,op,a,b,c,dA3,at,bt,ct,dConvertTypes);
8612  b->next=c;
8613  a->next=b;
8614  a->CleanUp(); // to cleanup the chain, content already done
8615  return bo;
8616 }
static BOOLEAN iiExprArith3TabIntern(leftv res, int op, leftv a, leftv b, leftv c, const struct sValCmd3 *dA3, int at, int bt, int ct, const struct sConvertTypes *dConvertTypes)
Definition: iparith.cc:8391
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int Typ()
Definition: subexpr.cc:996
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
int BOOLEAN
Definition: auxiliary.h:85
const poly b
Definition: syzextra.cc:213

§ iiExprArithM()

BOOLEAN iiExprArithM ( leftv  res,
sleftv a,
int  op 
)

§ iiGetLibName()

char* iiGetLibName ( procinfov  v)

Definition at line 101 of file iplib.cc.

102 {
103  return pi->libname;
104 }
#define pi
Definition: libparse.cc:1143

§ iiGetLibProcBuffer()

char* iiGetLibProcBuffer ( procinfov  pi,
int  part = 1 
)

§ iiHighCorner()

poly iiHighCorner ( ideal  i,
int  ak 
)

Definition at line 1481 of file ipshell.cc.

1482 {
1483  int i;
1484  if(!idIsZeroDim(I)) return NULL; // not zero-dim.
1485  poly po=NULL;
1487  {
1488  scComputeHC(I,currRing->qideal,ak,po);
1489  if (po!=NULL)
1490  {
1491  pGetCoeff(po)=nInit(1);
1492  for (i=rVar(currRing); i>0; i--)
1493  {
1494  if (pGetExp(po, i) > 0) pDecrExp(po,i);
1495  }
1496  pSetComp(po,ak);
1497  pSetm(po);
1498  }
1499  }
1500  else
1501  po=pOne();
1502  return po;
1503 }
#define pSetm(p)
Definition: polys.h:253
#define pDecrExp(p, i)
Definition: polys.h:44
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
Definition: hdegree.cc:1005
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
static BOOLEAN idIsZeroDim(ideal i)
Definition: ideals.h:161
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
#define pSetComp(p, v)
Definition: polys.h:38
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:297
#define rHasLocalOrMixedOrdering_currRing()
Definition: ring.h:757
#define NULL
Definition: omList.c:10
strat ak
Definition: myNF.cc:321
polyrec * poly
Definition: hilb.h:10
#define nInit(i)
Definition: numbers.h:24

§ iiInternalExport()

BOOLEAN iiInternalExport ( leftv  v,
int  toLev,
package  pack 
)

Definition at line 1337 of file ipshell.cc.

1338 {
1339  idhdl h=(idhdl)v->data;
1340  if(h==NULL)
1341  {
1342  Warn("'%s': no such identifier\n", v->name);
1343  return FALSE;
1344  }
1345  package frompack=v->req_packhdl;
1346  if (frompack==NULL) frompack=currPack;
1347  if ((RingDependend(IDTYP(h)))
1348  || ((IDTYP(h)==LIST_CMD)
1349  && (lRingDependend(IDLIST(h)))
1350  )
1351  )
1352  {
1353  //Print("// ==> Ringdependent set nesting to 0\n");
1354  return (iiInternalExport(v, toLev));
1355  }
1356  else
1357  {
1358  IDLEV(h)=toLev;
1359  v->req_packhdl=rootpack;
1360  if (h==frompack->idroot)
1361  {
1362  frompack->idroot=h->next;
1363  }
1364  else
1365  {
1366  idhdl hh=frompack->idroot;
1367  while ((hh!=NULL) && (hh->next!=h))
1368  hh=hh->next;
1369  if ((hh!=NULL) && (hh->next==h))
1370  hh->next=h->next;
1371  else
1372  {
1373  Werror("`%s` not found",v->Name());
1374  return TRUE;
1375  }
1376  }
1377  h->next=rootpack->idroot;
1378  rootpack->idroot=h;
1379  }
1380  return FALSE;
1381 }
#define IDLIST(a)
Definition: ipid.h:134
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
const char * Name()
Definition: subexpr.h:121
Definition: idrec.h:34
void * data
Definition: subexpr.h:89
#define IDTYP(a)
Definition: ipid.h:116
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:118
static BOOLEAN iiInternalExport(leftv v, int toLev)
Definition: ipshell.cc:1285
#define NULL
Definition: omList.c:10
package req_packhdl
Definition: subexpr.h:107
package currPack
Definition: ipid.cc:63
Definition: tok.h:117
static Poly * h
Definition: janet.cc:978
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
void Werror(const char *fmt,...)
Definition: reporter.cc:189
#define Warn
Definition: emacs.cc:80

§ iiLibCmd()

BOOLEAN iiLibCmd ( char *  newlib,
BOOLEAN  autoexport,
BOOLEAN  tellerror,
BOOLEAN  force 
)

Definition at line 718 of file iplib.cc.

719 {
720  char libnamebuf[128];
721  // procinfov pi;
722  // idhdl h;
723  idhdl pl;
724  // idhdl hl;
725  // long pos = 0L;
726  char *plib = iiConvName(newlib);
727  FILE * fp = feFopen( newlib, "r", libnamebuf, tellerror );
728  // int lines = 1;
729  BOOLEAN LoadResult = TRUE;
730 
731  if (fp==NULL)
732  {
733  return TRUE;
734  }
735  pl = basePack->idroot->get(plib,0);
736  if (pl==NULL)
737  {
738  pl = enterid( plib,0, PACKAGE_CMD,
739  &(basePack->idroot), TRUE );
740  IDPACKAGE(pl)->language = LANG_SINGULAR;
741  IDPACKAGE(pl)->libname=omStrDup(newlib);
742  }
743  else
744  {
745  if(IDTYP(pl)!=PACKAGE_CMD)
746  {
747  WarnS("not of type package.");
748  fclose(fp);
749  return TRUE;
750  }
751  if (!force) return FALSE;
752  }
753  LoadResult = iiLoadLIB(fp, libnamebuf, newlib, pl, autoexport, tellerror);
754  omFree((ADDRESS)newlib);
755 
756  if(!LoadResult) IDPACKAGE(pl)->loaded = TRUE;
757  omFree((ADDRESS)plib);
758 
759  return LoadResult;
760 }
CanonicalForm fp
Definition: cfModGcd.cc:4043
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
void * ADDRESS
Definition: auxiliary.h:115
#define WarnS
Definition: emacs.cc:81
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:136
#define IDTYP(a)
Definition: ipid.h:116
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:259
#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:47
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:64
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:807
char * iiConvName(const char *libname)
Definition: iplib.cc:1214
int BOOLEAN
Definition: auxiliary.h:85
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ iiLoadLIB()

BOOLEAN iiLoadLIB ( FILE *  fp,
const char *  libnamebuf,
const char *  newlib,
idhdl  pl,
BOOLEAN  autoexport,
BOOLEAN  tellerror 
)

Definition at line 807 of file iplib.cc.

809 {
810  extern FILE *yylpin;
811  libstackv ls_start = library_stack;
812  lib_style_types lib_style;
813 
814  yylpin = fp;
815  #if YYLPDEBUG > 1
816  print_init();
817  #endif
818  extern int lpverbose;
819  if (BVERBOSE(V_DEBUG_LIB)) lpverbose=1;
820  else lpverbose=0;
821  // yylplex sets also text_buffer
822  if (text_buffer!=NULL) *text_buffer='\0';
823  yylplex(newlib, libnamebuf, &lib_style, pl, autoexport);
824  if(yylp_errno)
825  {
826  Werror("Library %s: ERROR occurred: in line %d, %d.", newlib, yylplineno,
827  current_pos(0));
829  {
833  }
834  else
836  WerrorS("Cannot load library,... aborting.");
837  reinit_yylp();
838  fclose( yylpin );
840  return TRUE;
841  }
842  if (BVERBOSE(V_LOAD_LIB))
843  Print( "// ** loaded %s %s\n", libnamebuf, text_buffer);
844  if( (lib_style == OLD_LIBSTYLE) && (BVERBOSE(V_LOAD_LIB)))
845  {
846  Warn( "library %s has old format. This format is still accepted,", newlib);
847  Warn( "but for functionality you may wish to change to the new");
848  Warn( "format. Please refer to the manual for further information.");
849  }
850  reinit_yylp();
851  fclose( yylpin );
852  fp = NULL;
853  iiRunInit(IDPACKAGE(pl));
854 
855  {
856  libstackv ls;
857  for(ls = library_stack; (ls != NULL) && (ls != ls_start); )
858  {
859  if(ls->to_be_done)
860  {
861  ls->to_be_done=FALSE;
862  iiLibCmd(ls->get(),autoexport,tellerror,FALSE);
863  ls = ls->pop(newlib);
864  }
865  }
866 #if 0
867  PrintS("--------------------\n");
868  for(ls = library_stack; ls != NULL; ls = ls->next)
869  {
870  Print("%s: LIB-stack:(%d), %s %s\n", newlib, ls->cnt, ls->get(),
871  ls->to_be_done ? "not loaded" : "loaded");
872  }
873  PrintS("--------------------\n");
874 #endif
875  }
876 
877  if(fp != NULL) fclose(fp);
878  return FALSE;
879 }
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:94
static void iiRunInit(package p)
Definition: iplib.cc:791
#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:98
void print_init()
Definition: libparse.cc:3480
void * ADDRESS
Definition: auxiliary.h:115
void WerrorS(const char *s)
Definition: feFopen.cc:24
char * get()
Definition: subexpr.h:170
#define V_DEBUG_LIB
Definition: options.h:46
libstackv pop(const char *p)
Definition: iplib.cc:1303
BOOLEAN iiLibCmd(char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force)
Definition: iplib.cc:718
#define IDPACKAGE(a)
Definition: ipid.h:136
#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:284
#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:3344
lib_style_types
Definition: libparse.h:9
char libnamebuf[128]
Definition: libparse.cc:1096
static void iiCleanProcs(idhdl &root)
Definition: iplib.cc:762
void Werror(const char *fmt,...)
Definition: reporter.cc:189
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:3374

§ iiLocateLib()

BOOLEAN iiLocateLib ( const char *  lib,
char *  where 
)

Definition at line 704 of file iplib.cc.

705 {
706  char *plib = iiConvName(lib);
707  idhdl pl = basePack->idroot->get(plib,0);
708  if( (pl!=NULL) && (IDTYP(pl)==PACKAGE_CMD) &&
709  (IDPACKAGE(pl)->language == LANG_SINGULAR))
710  {
711  strncpy(where,IDPACKAGE(pl)->libname,127);
712  return TRUE;
713  }
714  else
715  return FALSE;;
716 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:136
#define IDTYP(a)
Definition: ipid.h:116
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:64
char * iiConvName(const char *libname)
Definition: iplib.cc:1214

§ iiMake_proc()

BOOLEAN iiMake_proc ( idhdl  pn,
package  pack,
sleftv sl 
)

Definition at line 501 of file iplib.cc.

502 {
503  int err;
504  procinfov pi = IDPROC(pn);
505  if(pi->is_static && myynest==0)
506  {
507  Werror("'%s::%s()' is a local procedure and cannot be accessed by an user.",
508  pi->libname, pi->procname);
509  return TRUE;
510  }
511  iiCheckNest();
513  //Print("currRing(%d):%s(%x) in %s\n",myynest,IDID(currRingHdl),currRing,IDID(pn));
514  iiRETURNEXPR.Init();
515  procstack->push(pi->procname);
517  || (pi->trace_flag&TRACE_SHOW_PROC))
518  {
520  Print("entering%-*.*s %s (level %d)\n",myynest*2,myynest*2," ",IDID(pn),myynest);
521  }
522 #ifdef RDEBUG
524 #endif
525  switch (pi->language)
526  {
527  default:
528  case LANG_NONE:
529  WerrorS("undefined proc");
530  err=TRUE;
531  break;
532 
533  case LANG_SINGULAR:
534  if ((pi->pack!=NULL)&&(currPack!=pi->pack))
535  {
536  currPack=pi->pack;
539  //Print("set pack=%s\n",IDID(currPackHdl));
540  }
541  else if ((pack!=NULL)&&(currPack!=pack))
542  {
543  currPack=pack;
546  //Print("set pack=%s\n",IDID(currPackHdl));
547  }
548  err=iiPStart(pn,sl);
549  break;
550  case LANG_C:
552  err = (pi->data.o.function)(res, sl);
553  memcpy(&iiRETURNEXPR,res,sizeof(iiRETURNEXPR));
555  break;
556  }
557  if ((traceit&TRACE_SHOW_PROC)
558  || (pi->trace_flag&TRACE_SHOW_PROC))
559  {
560  if (traceit&TRACE_SHOW_LINENO) PrintLn();
561  Print("leaving %-*.*s %s (level %d)\n",myynest*2,myynest*2," ",IDID(pn),myynest);
562  }
563  //const char *n="NULL";
564  //if (currRingHdl!=NULL) n=IDID(currRingHdl);
565  //Print("currRing(%d):%s(%x) after %s\n",myynest,n,currRing,IDID(pn));
566 #ifdef RDEBUG
567  if (traceit&TRACE_SHOW_RINGS) iiShowLevRings();
568 #endif
569  if (err)
570  {
572  //iiRETURNEXPR.Init(); //done by CleanUp
573  }
574  if (iiCurrArgs!=NULL)
575  {
576  if (!err) Warn("too many arguments for %s",IDID(pn));
577  iiCurrArgs->CleanUp();
580  }
581  procstack->pop();
582  if (err)
583  return TRUE;
584  return FALSE;
585 }
#define TRACE_SHOW_LINENO
Definition: reporter.h:30
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define TRACE_SHOW_RINGS
Definition: reporter.h:35
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
package pack
Definition: subexpr.h:57
idhdl currPackHdl
Definition: ipid.cc:61
#define IDID(a)
Definition: ipid.h:119
#define FALSE
Definition: auxiliary.h:94
sleftv iiRETURNEXPR
Definition: iplib.cc:471
language_defs language
Definition: subexpr.h:58
proclevel * procstack
Definition: ipid.cc:58
static void iiShowLevRings()
Definition: iplib.cc:475
#define TRUE
Definition: auxiliary.h:98
void Init()
Definition: subexpr.h:108
void * ADDRESS
Definition: auxiliary.h:115
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:24
int traceit
Definition: febase.cc:47
static void iiCheckNest()
Definition: iplib.cc:490
char * procname
Definition: subexpr.h:56
poly res
Definition: myNF.cc:322
Definition: subexpr.h:21
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:10
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:137
#define pi
Definition: libparse.cc:1143
ring * iiLocalRing
Definition: iplib.cc:470
#define NULL
Definition: omList.c:10
BOOLEAN iiPStart(idhdl pn, sleftv *v)
Definition: iplib.cc:371
package currPack
Definition: ipid.cc:63
leftv iiCurrArgs
Definition: ipshell.cc:78
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
#define TRACE_SHOW_PROC
Definition: reporter.h:28
idhdl packFindHdl(package r)
Definition: ipid.cc:739
void iiCheckPack(package &p)
Definition: ipshell.cc:1505
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
void push(char *)
Definition: ipid.cc:711
void pop()
Definition: ipid.cc:721
char trace_flag
Definition: subexpr.h:61
void Werror(const char *fmt,...)
Definition: reporter.cc:189
#define Warn
Definition: emacs.cc:80

§ iiMakeResolv()

void iiMakeResolv ( resolvente  r,
int  length,
int  rlen,
char *  name,
int  typ0,
intvec **  weights = NULL 
)

Definition at line 766 of file ipshell.cc.

768 {
769  lists L=liMakeResolv(r,length,rlen,typ0,weights);
770  int i=0;
771  idhdl h;
772  char * s=(char *)omAlloc(strlen(name)+5);
773 
774  while (i<=L->nr)
775  {
776  sprintf(s,"%s(%d)",name,i+1);
777  if (i==0)
778  h=enterid(s,myynest,typ0,&(currRing->idroot), FALSE);
779  else
780  h=enterid(s,myynest,MODUL_CMD,&(currRing->idroot), FALSE);
781  if (h!=NULL)
782  {
783  h->data.uideal=(ideal)L->m[i].data;
784  h->attribute=L->m[i].attribute;
786  Print("//defining: %s as %d-th syzygy module\n",s,i+1);
787  }
788  else
789  {
790  idDelete((ideal *)&(L->m[i].data));
791  Warn("cannot define %s",s);
792  }
793  //L->m[i].data=NULL;
794  //L->m[i].rtyp=0;
795  //L->m[i].attribute=NULL;
796  i++;
797  }
798  omFreeSize((ADDRESS)L->m,(L->nr+1)*sizeof(sleftv));
800  omFreeSize((ADDRESS)s,strlen(name)+5);
801 }
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
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
Definition: lists.h:22
if(0 > strat->sl)
Definition: myNF.cc:73
#define FALSE
Definition: auxiliary.h:94
#define V_DEF_RES
Definition: options.h:48
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:115
#define omAlloc(size)
Definition: omAllocDecl.h:210
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:10
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:259
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
char name(const Variable &v)
Definition: factory.h:178
#define BVERBOSE(a)
Definition: options.h:33
int nr
Definition: lists.h:43
#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:215
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

§ iiMap()

leftv iiMap ( map  theMap,
const char *  what 
)

Definition at line 607 of file ipshell.cc.

608 {
609  idhdl w,r;
610  leftv v;
611  int i;
612  nMapFunc nMap;
613 
614  r=IDROOT->get(theMap->preimage,myynest);
615  if ((currPack!=basePack)
616  &&((r==NULL) || ((r->typ != RING_CMD) )))
617  r=basePack->idroot->get(theMap->preimage,myynest);
618  if ((r==NULL) && (currRingHdl!=NULL)
619  && (strcmp(theMap->preimage,IDID(currRingHdl))==0))
620  {
621  r=currRingHdl;
622  }
623  if ((r!=NULL) && (r->typ == RING_CMD))
624  {
625  ring src_ring=IDRING(r);
626  if ((nMap=n_SetMap(src_ring->cf, currRing->cf))==NULL)
627  {
628  Werror("can not map from ground field of %s to current ground field",
629  theMap->preimage);
630  return NULL;
631  }
632  if (IDELEMS(theMap)<src_ring->N)
633  {
634  theMap->m=(polyset)omReallocSize((ADDRESS)theMap->m,
635  IDELEMS(theMap)*sizeof(poly),
636  (src_ring->N)*sizeof(poly));
637  for(i=IDELEMS(theMap);i<src_ring->N;i++)
638  theMap->m[i]=NULL;
639  IDELEMS(theMap)=src_ring->N;
640  }
641  if (what==NULL)
642  {
643  WerrorS("argument of a map must have a name");
644  }
645  else if ((w=src_ring->idroot->get(what,myynest))!=NULL)
646  {
647  char *save_r=NULL;
649  sleftv tmpW;
650  memset(&tmpW,0,sizeof(sleftv));
651  tmpW.rtyp=IDTYP(w);
652  if (tmpW.rtyp==MAP_CMD)
653  {
654  tmpW.rtyp=IDEAL_CMD;
655  save_r=IDMAP(w)->preimage;
656  IDMAP(w)->preimage=0;
657  }
658  tmpW.data=IDDATA(w);
659  // check overflow
660  BOOLEAN overflow=FALSE;
661  if ((tmpW.rtyp==IDEAL_CMD)
662  || (tmpW.rtyp==MODUL_CMD)
663  || (tmpW.rtyp==MAP_CMD))
664  {
665  ideal id=(ideal)tmpW.data;
666  long *degs=(long*)omAlloc(IDELEMS(id)*sizeof(long));
667  for(int i=IDELEMS(id)-1;i>=0;i--)
668  {
669  poly p=id->m[i];
670  if (p!=NULL) degs[i]=p_Totaldegree(p,src_ring);
671  else degs[i]=0;
672  }
673  for(int j=IDELEMS(theMap)-1;j>=0 && !overflow;j--)
674  {
675  if (theMap->m[j]!=NULL)
676  {
677  long deg_monexp=pTotaldegree(theMap->m[j]);
678 
679  for(int i=IDELEMS(id)-1;i>=0;i--)
680  {
681  poly p=id->m[i];
682  if ((p!=NULL) && (degs[i]!=0) &&
683  ((unsigned long)deg_monexp > (currRing->bitmask / ((unsigned long)degs[i])/2)))
684  {
685  overflow=TRUE;
686  break;
687  }
688  }
689  }
690  }
691  omFreeSize(degs,IDELEMS(id)*sizeof(long));
692  }
693  else if (tmpW.rtyp==POLY_CMD)
694  {
695  for(int j=IDELEMS(theMap)-1;j>=0 && !overflow;j--)
696  {
697  if (theMap->m[j]!=NULL)
698  {
699  long deg_monexp=pTotaldegree(theMap->m[j]);
700  poly p=(poly)tmpW.data;
701  long deg=0;
702  if ((p!=NULL) && ((deg=p_Totaldegree(p,src_ring))!=0) &&
703  ((unsigned long)deg_monexp > (currRing->bitmask / ((unsigned long)deg)/2)))
704  {
705  overflow=TRUE;
706  break;
707  }
708  }
709  }
710  }
711  if (overflow)
712  Warn("possible OVERFLOW in map, max exponent is %ld",currRing->bitmask/2);
713 #if 0
714  if (((tmpW.rtyp==IDEAL_CMD)||(tmpW.rtyp==MODUL_CMD)) && idIs0(IDIDEAL(w)))
715  {
716  v->rtyp=tmpW.rtyp;
717  v->data=idInit(IDELEMS(IDIDEAL(w)),IDIDEAL(w)->rank);
718  }
719  else
720 #endif
721  {
722  if ((tmpW.rtyp==IDEAL_CMD)
723  ||(tmpW.rtyp==MODUL_CMD)
724  ||(tmpW.rtyp==MATRIX_CMD)
725  ||(tmpW.rtyp==MAP_CMD))
726  {
727  v->rtyp=tmpW.rtyp;
728  char *tmp = theMap->preimage;
729  theMap->preimage=(char*)1L;
730  // map gets 1 as its rank (as an ideal)
731  v->data=maMapIdeal(IDIDEAL(w), src_ring, (ideal)theMap, currRing,nMap);
732  theMap->preimage=tmp; // map gets its preimage back
733  }
734  if (v->data==NULL) /*i.e. not IDEAL_CMD/MODUL_CMD/MATRIX_CMD/MAP */
735  {
736  if (maApplyFetch(MAP_CMD,theMap,v,&tmpW,src_ring,NULL,NULL,0,nMap))
737  {
738  Werror("cannot map %s(%d)",Tok2Cmdname(w->typ),w->typ);
740  if (save_r!=NULL) IDMAP(w)->preimage=save_r;
741  return NULL;
742  }
743  }
744  }
745  if (save_r!=NULL)
746  {
747  IDMAP(w)->preimage=save_r;
748  IDMAP((idhdl)v)->preimage=omStrDup(save_r);
749  v->rtyp=MAP_CMD;
750  }
751  return v;
752  }
753  else
754  {
755  Werror("%s undefined in %s",what,theMap->preimage);
756  }
757  }
758  else
759  {
760  Werror("cannot find preimage %s",theMap->preimage);
761  }
762  return NULL;
763 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
if(0 > strat->sl)
Definition: myNF.cc:73
#define IDID(a)
Definition: ipid.h:119
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:98
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:49
#define IDIDEAL(a)
Definition: ipid.h:130
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1430
void * ADDRESS
Definition: auxiliary.h:115
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define omAlloc(size)
Definition: omAllocDecl.h:210
Definition: idrec.h:34
idhdl get(const char *s, int lev)
Definition: ipid.cc:91
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:10
#define IDTYP(a)
Definition: ipid.h:116
const ring r
Definition: syzextra.cc:208
ideal maMapIdeal(const ideal map_id, const ring preimage_r, const ideal image_id, const ring image_r, const nMapFunc nMap)
polynomial map for ideals/module/matrix map_id: the ideal to map map_r: the base ring for map_id imag...
Definition: gen_maps.cc:88
int j
Definition: myNF.cc:70
static long pTotaldegree(poly p)
Definition: polys.h:264
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
idhdl currRingHdl
Definition: ipid.cc:65
omBin sleftv_bin
Definition: subexpr.cc:50
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
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:725
#define IDMAP(a)
Definition: ipid.h:132
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
poly * polyset
Definition: hutil.h:15
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:132
package basePack
Definition: ipid.cc:64
#define IDRING(a)
Definition: ipid.h:124
const CanonicalForm & w
Definition: facAbsFact.cc:55
package currPack
Definition: ipid.cc:63
int rtyp
Definition: subexpr.h:92
int typ
Definition: idrec.h:43
polyrec * poly
Definition: hilb.h:10
#define IDDATA(a)
Definition: ipid.h:123
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
void Werror(const char *fmt,...)
Definition: reporter.cc:189
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ iiOpsTwoChar()

int iiOpsTwoChar ( const char *  s)

Definition at line 119 of file ipshell.cc.

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

§ iiParameter()

BOOLEAN iiParameter ( leftv  p)

Definition at line 1249 of file ipshell.cc.

1250 {
1251  if (iiCurrArgs==NULL)
1252  {
1253  if (strcmp(p->name,"#")==0)
1254  return iiDefaultParameter(p);
1255  Werror("not enough arguments for proc %s",VoiceName());
1256  p->CleanUp();
1257  return TRUE;
1258  }
1259  leftv h=iiCurrArgs;
1260  leftv rest=h->next; /*iiCurrArgs is not NULL here*/
1261  BOOLEAN is_default_list=FALSE;
1262  if (strcmp(p->name,"#")==0)
1263  {
1264  is_default_list=TRUE;
1265  rest=NULL;
1266  }
1267  else
1268  {
1269  h->next=NULL;
1270  }
1271  BOOLEAN res=iiAssign(p,h);
1272  if (is_default_list)
1273  {
1274  iiCurrArgs=NULL;
1275  }
1276  else
1277  {
1278  iiCurrArgs=rest;
1279  }
1280  h->CleanUp();
1282  return res;
1283 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
void * ADDRESS
Definition: auxiliary.h:115
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:66
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
BOOLEAN iiDefaultParameter(leftv p)
Definition: ipshell.cc:1166
leftv iiCurrArgs
Definition: ipshell.cc:78
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
void Werror(const char *fmt,...)
Definition: reporter.cc:189
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1793

§ iiProcArgs()

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  // skip leading spaces:
156  loop
157  {
158  if ((*s==' ')||(*s=='\t'))
159  s++;
160  else if ((*s=='\n')&&(*(s+1)==' '))
161  s+=2;
162  else // start of new arg or \0 or )
163  break;
164  }
165  e=s;
166  while ((*e!=',')
167  &&((par!=0) || (*e!=')'))
168  &&(*e!='\0'))
169  {
170  if (*e=='(') par++;
171  else if (*e==')') par--;
172  args_found=args_found || (*e>' ');
173  e++;
174  }
175  in_args=(*e==',');
176  if (args_found)
177  {
178  *e='\0';
179  // check for space:
180  if ((int)strlen(argstr)+12 /* parameter + ;*/ +(int)strlen(s)>= argstrlen)
181  {
182  argstrlen*=2;
183  char *a=(char *)omAlloc( argstrlen);
184  strcpy(a,argstr);
185  omFree((ADDRESS)argstr);
186  argstr=a;
187  }
188  // copy the result to argstr
189  if(strncmp(s,"alias ",6)!=0)
190  {
191  strcat(argstr,"parameter ");
192  }
193  strcat(argstr,s);
194  strcat(argstr,"; ");
195  e++; // e was pointing to ','
196  }
197  } while (in_args);
198  return argstr;
199 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
const poly a
Definition: syzextra.cc:212
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
void * ADDRESS
Definition: auxiliary.h:115
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define omFree(addr)
Definition: omAllocDecl.h:261
int BOOLEAN
Definition: auxiliary.h:85
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ iiProcName()

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

§ iiPStart()

BOOLEAN iiPStart ( idhdl  pn,
sleftv sl 
)

Definition at line 371 of file iplib.cc.

372 {
373  procinfov pi=NULL;
374  int old_echo=si_echo;
375  BOOLEAN err=FALSE;
376  char save_flags=0;
377 
378  /* init febase ======================================== */
379  /* we do not enter this case if filename != NULL !! */
380  if (pn!=NULL)
381  {
382  pi = IDPROC(pn);
383  if(pi!=NULL)
384  {
385  save_flags=pi->trace_flag;
386  if( pi->data.s.body==NULL )
387  {
388  iiGetLibProcBuffer(pi);
389  if (pi->data.s.body==NULL) return TRUE;
390  }
391 // omUpdateInfo();
392 // int m=om_Info.UsedBytes;
393 // Print("proc %s, mem=%d\n",IDID(pn),m);
394  }
395  }
396  else return TRUE;
397  /* generate argument list ======================================*/
398  if (v!=NULL)
399  {
401  memcpy(iiCurrArgs,v,sizeof(sleftv));
402  memset(v,0,sizeof(sleftv));
403  }
404  else
405  {
407  }
408  iiCurrProc=pn;
409  /* start interpreter ======================================*/
410  myynest++;
411  if (myynest > SI_MAX_NEST)
412  {
413  WerrorS("nesting too deep");
414  err=TRUE;
415  }
416  else
417  {
418  err=iiAllStart(pi,pi->data.s.body,BT_proc,pi->data.s.body_lineno-(v!=NULL));
419 
420  if (iiLocalRing[myynest-1] != currRing)
421  {
423  {
424  //idhdl hn;
425  const char *n;
426  const char *o;
427  idhdl nh=NULL, oh=NULL;
428  if (iiLocalRing[myynest-1]!=NULL)
430  if (oh!=NULL) o=oh->id;
431  else o="none";
432  if (currRing!=NULL)
433  nh=rFindHdl(currRing,NULL);
434  if (nh!=NULL) n=nh->id;
435  else n="none";
436  Werror("ring change during procedure call: %s -> %s (level %d)",o,n,myynest);
438  err=TRUE;
439  }
441  }
442  if ((currRing==NULL)
443  && (currRingHdl!=NULL))
445  else
446  if ((currRing!=NULL) &&
448  ||(IDLEV(currRingHdl)>=myynest-1)))
449  {
452  }
453  //Print("kill locals for %s (level %d)\n",IDID(pn),myynest);
455 #ifndef SING_NDEBUG
456  checkall();
457 #endif
458  //Print("end kill locals for %s (%d)\n",IDID(pn),myynest);
459  }
460  myynest--;
461  si_echo=old_echo;
462  if (pi!=NULL)
463  pi->trace_flag=save_flags;
464 // omUpdateInfo();
465 // int m=om_Info.UsedBytes;
466 // Print("exit %s, mem=%d\n",IDID(pn),m);
467  return err;
468 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:94
sleftv iiRETURNEXPR
Definition: iplib.cc:471
#define TRUE
Definition: auxiliary.h:98
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:24
Definition: idrec.h:34
idhdl iiCurrProc
Definition: ipshell.cc:79
#define SI_MAX_NEST
Definition: iplib.cc:33
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:10
BOOLEAN RingDependend()
Definition: subexpr.cc:403
void killlocals(int v)
Definition: ipshell.cc:378
procinfodata data
Definition: subexpr.h:62
idhdl currRingHdl
Definition: ipid.cc:65
omBin sleftv_bin
Definition: subexpr.cc:50
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1564
#define IDLEV(a)
Definition: ipid.h:118
BOOLEAN iiAllStart(procinfov pi, char *p, feBufferTypes t, int l)
Definition: iplib.cc:311
#define IDPROC(a)
Definition: ipid.h:137
#define pi
Definition: libparse.cc:1143
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
ring * iiLocalRing
Definition: iplib.cc:470
#define NULL
Definition: omList.c:10
#define IDRING(a)
Definition: ipid.h:124
leftv iiCurrArgs
Definition: ipshell.cc:78
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
const char * id
Definition: idrec.h:39
void rSetHdl(idhdl h)
Definition: ipshell.cc:5002
char * iiGetLibProcBuffer(procinfo *pi, int part)
Definition: iplib.cc:210
int BOOLEAN
Definition: auxiliary.h:85
char trace_flag
Definition: subexpr.h:61
void Werror(const char *fmt,...)
Definition: reporter.cc:189
int si_echo
Definition: febase.cc:41

§ iiRegularity()

int iiRegularity ( lists  L)

Definition at line 956 of file ipshell.cc.

957 {
958  int len,reg,typ0;
959 
960  resolvente r=liFindRes(L,&len,&typ0);
961 
962  if (r==NULL)
963  return -2;
964  intvec *weights=NULL;
965  int add_row_shift=0;
966  intvec *ww=(intvec *)atGet(&(L->m[0]),"isHomog",INTVEC_CMD);
967  if (ww!=NULL)
968  {
969  weights=ivCopy(ww);
970  add_row_shift = ww->min_in();
971  (*weights) -= add_row_shift;
972  }
973  //Print("attr:%x\n",weights);
974 
975  intvec *dummy=syBetti(r,len,&reg,weights);
976  if (weights!=NULL) delete weights;
977  delete dummy;
978  omFreeSize((ADDRESS)r,len*sizeof(ideal));
979  return reg+1+add_row_shift;
980 }
sleftv * m
Definition: lists.h:45
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
Definition: lists.cc:312
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
intvec * ivCopy(const intvec *o)
Definition: intvec.h:126
void * ADDRESS
Definition: auxiliary.h:115
int min_in()
Definition: intvec.h:113
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
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:18
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
Definition: syz.cc:791

§ iiTestAssume()

BOOLEAN iiTestAssume ( leftv  a,
leftv  b 
)

Definition at line 6323 of file ipshell.cc.

6324 {
6325  // assume a: level
6326  if ((a->Typ()==INT_CMD)&&((long)a->Data()>=0))
6327  {
6328  if ((TEST_V_ALLWARN) && (myynest==0)) WarnS("ASSUME at top level is of no use: see documentation");
6329  char assume_yylinebuf[80];
6330  strncpy(assume_yylinebuf,my_yylinebuf,79);
6331  int lev=(long)a->Data();
6332  int startlev=0;
6333  idhdl h=ggetid("assumeLevel");
6334  if ((h!=NULL)&&(IDTYP(h)==INT_CMD)) startlev=(long)IDINT(h);
6335  if(lev <=startlev)
6336  {
6337  BOOLEAN bo=b->Eval();
6338  if (bo) { WerrorS("syntax error in ASSUME");return TRUE;}
6339  if (b->Typ()!=INT_CMD) { WerrorS("ASUMME(<level>,<int expr>)");return TRUE; }
6340  if (b->Data()==NULL) { Werror("ASSUME failed:%s",assume_yylinebuf);return TRUE;}
6341  }
6342  }
6343  b->CleanUp();
6344  a->CleanUp();
6345  return FALSE;
6346 }
int Eval()
Definition: subexpr.cc:1761
Definition: tok.h:95
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define WarnS
Definition: emacs.cc:81
int Typ()
Definition: subexpr.cc:996
Definition: idrec.h:34
int myynest
Definition: febase.cc:46
#define IDTYP(a)
Definition: ipid.h:116
char my_yylinebuf[80]
Definition: febase.cc:48
#define NULL
Definition: omList.c:10
#define IDINT(a)
Definition: ipid.h:122
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
void * Data()
Definition: subexpr.cc:1138
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
void Werror(const char *fmt,...)
Definition: reporter.cc:189
#define TEST_V_ALLWARN
Definition: options.h:135
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)
Definition: ipid.cc:496

§ iiTokType()

int iiTokType ( int  op)

Definition at line 240 of file iparith.cc.

241 {
242  for (unsigned i=0;i<sArithBase.nCmdUsed;i++)
243  {
244  if (sArithBase.sCmds[i].tokval==op)
245  return sArithBase.sCmds[i].toktype;
246  }
247  return 0;
248 }
int i
Definition: cfEzgcd.cc:123
unsigned nCmdUsed
number of commands used
Definition: iparith.cc:194
static SArithBase sArithBase
Base entry for arithmetic.
Definition: iparith.cc:204
cmdnames * sCmds
array of existing commands
Definition: iparith.cc:189

§ iiTryLoadLib()

BOOLEAN iiTryLoadLib ( leftv  v,
const char *  id 
)

Definition at line 656 of file iplib.cc.

657 {
658  BOOLEAN LoadResult = TRUE;
659  char libnamebuf[128];
660  char *libname = (char *)omAlloc(strlen(id)+5);
661  const char *suffix[] = { "", ".lib", ".so", ".sl", NULL };
662  int i = 0;
663  // FILE *fp;
664  // package pack;
665  // idhdl packhdl;
666  lib_types LT;
667  for(i=0; suffix[i] != NULL; i++)
668  {
669  sprintf(libname, "%s%s", id, suffix[i]);
670  *libname = mytolower(*libname);
671  if((LT = type_of_LIB(libname, libnamebuf)) > LT_NOTFOUND)
672  {
673  char *s=omStrDup(libname);
674  #ifdef HAVE_DYNAMIC_LOADING
675  char libnamebuf[256];
676  #endif
677 
678  if (LT==LT_SINGULAR)
679  LoadResult = iiLibCmd(s, FALSE, FALSE,TRUE);
680  #ifdef HAVE_DYNAMIC_LOADING
681  else if ((LT==LT_ELF) || (LT==LT_HPUX))
682  LoadResult = load_modules(s,libnamebuf,FALSE);
683  #endif
684  else if (LT==LT_BUILTIN)
685  {
686  LoadResult=load_builtin(s,FALSE, iiGetBuiltinModInit(s));
687  }
688  if(!LoadResult )
689  {
690  v->name = iiConvName(libname);
691  break;
692  }
693  }
694  }
695  omFree(libname);
696  return LoadResult;
697 }
BOOLEAN load_builtin(const char *newlib, BOOLEAN autoexport, SModulFunc_t init)
Definition: iplib.cc:1080
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:94
Definition: mod_raw.h:16
#define TRUE
Definition: auxiliary.h:98
lib_types type_of_LIB(const char *newlib, char *libnamebuf)
Definition: mod_lib.cc:24
#define omAlloc(size)
Definition: omAllocDecl.h:210
BOOLEAN iiLibCmd(char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force)
Definition: iplib.cc:718
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:1201
#define NULL
Definition: omList.c:10
SModulFunc_t iiGetBuiltinModInit(const char *libname)
Definition: iplib.cc:643
char libnamebuf[128]
Definition: libparse.cc:1096
char * iiConvName(const char *libname)
Definition: iplib.cc:1214
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition: iplib.cc:982
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ iiTwoOps()

const char* iiTwoOps ( int  t)

Definition at line 253 of file gentable.cc.

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

§ iiWRITE()

BOOLEAN iiWRITE ( leftv  res,
leftv  exprlist 
)

Definition at line 580 of file ipshell.cc.

581 {
582  sleftv vf;
583  if (iiConvert(v->Typ(),LINK_CMD,iiTestConvert(v->Typ(),LINK_CMD),v,&vf))
584  {
585  WerrorS("link expected");
586  return TRUE;
587  }
588  si_link l=(si_link)vf.Data();
589  if (vf.next == NULL)
590  {
591  WerrorS("write: need at least two arguments");
592  return TRUE;
593  }
594 
595  BOOLEAN b=slWrite(l,vf.next); /* iiConvert preserves next */
596  if (b)
597  {
598  const char *s;
599  if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
600  else s=sNoName;
601  Werror("cannot write to %s",s);
602  }
603  vf.CleanUp();
604  return b;
605 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:293
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:401
const char sNoName[]
Definition: subexpr.cc:56
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
leftv next
Definition: subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
Definition: tok.h:116
#define NULL
Definition: omList.c:10
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
void * Data()
Definition: subexpr.cc:1138
int BOOLEAN
Definition: auxiliary.h:85
const poly b
Definition: syzextra.cc:213
void Werror(const char *fmt,...)
Definition: reporter.cc:189
int l
Definition: cfEzgcd.cc:94

§ IsCmd()

int IsCmd ( const char *  n,
int &  tok 
)

Definition at line 8746 of file iparith.cc.

8747 {
8748  int i;
8749  int an=1;
8750  int en=sArithBase.nLastIdentifier;
8751 
8752  loop
8753  //for(an=0; an<sArithBase.nCmdUsed; )
8754  {
8755  if(an>=en-1)
8756  {
8757  if (strcmp(n, sArithBase.sCmds[an].name) == 0)
8758  {
8759  i=an;
8760  break;
8761  }
8762  else if ((an!=en) && (strcmp(n, sArithBase.sCmds[en].name) == 0))
8763  {
8764  i=en;
8765  break;
8766  }
8767  else
8768  {
8769  // -- blackbox extensions:
8770  // return 0;
8771  return blackboxIsCmd(n,tok);
8772  }
8773  }
8774  i=(an+en)/2;
8775  if (*n < *(sArithBase.sCmds[i].name))
8776  {
8777  en=i-1;
8778  }
8779  else if (*n > *(sArithBase.sCmds[i].name))
8780  {
8781  an=i+1;
8782  }
8783  else
8784  {
8785  int v=strcmp(n,sArithBase.sCmds[i].name);
8786  if(v<0)
8787  {
8788  en=i-1;
8789  }
8790  else if(v>0)
8791  {
8792  an=i+1;
8793  }
8794  else /*v==0*/
8795  {
8796  break;
8797  }
8798  }
8799  }
8801  tok=sArithBase.sCmds[i].tokval;
8802  if(sArithBase.sCmds[i].alias==2)
8803  {
8804  Warn("outdated identifier `%s` used - please change your code",
8805  sArithBase.sCmds[i].name);
8806  sArithBase.sCmds[i].alias=1;
8807  }
8808  #if 0
8809  if (currRingHdl==NULL)
8810  {
8811  #ifdef SIQ
8812  if (siq<=0)
8813  {
8814  #endif
8815  if ((tok>=BEGIN_RING) && (tok<=END_RING))
8816  {
8817  WerrorS("no ring active");
8818  return 0;
8819  }
8820  #ifdef SIQ
8821  }
8822  #endif
8823  }
8824  #endif
8825  if (!expected_parms)
8826  {
8827  switch (tok)
8828  {
8829  case IDEAL_CMD:
8830  case INT_CMD:
8831  case INTVEC_CMD:
8832  case MAP_CMD:
8833  case MATRIX_CMD:
8834  case MODUL_CMD:
8835  case POLY_CMD:
8836  case PROC_CMD:
8837  case RING_CMD:
8838  case STRING_CMD:
8839  cmdtok = tok;
8840  break;
8841  }
8842  }
8843  return sArithBase.sCmds[i].toktype;
8844 }
Definition: tok.h:95
loop
Definition: myNF.cc:98
BOOLEAN siq
Definition: subexpr.cc:58
int cmdtok
Definition: grammar.cc:174
void WerrorS(const char *s)
Definition: feFopen.cc:24
BOOLEAN expected_parms
Definition: grammar.cc:173
idhdl currRingHdl
Definition: ipid.cc:65
int i
Definition: cfEzgcd.cc:123
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
unsigned nLastIdentifier
valid indentifieres are slot 1..nLastIdentifier
Definition: iparith.cc:196
#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:204
cmdnames * sCmds
array of existing commands
Definition: iparith.cc:189
const char * lastreserved
Definition: ipshell.cc:80
#define Warn
Definition: emacs.cc:80

§ jjBETTI()

BOOLEAN jjBETTI ( leftv  res,
leftv  v 
)

Definition at line 886 of file ipshell.cc.

887 {
888  sleftv tmp;
889  memset(&tmp,0,sizeof(tmp));
890  tmp.rtyp=INT_CMD;
891  tmp.data=(void *)1;
892  if ((u->Typ()==IDEAL_CMD)
893  || (u->Typ()==MODUL_CMD))
894  return jjBETTI2_ID(res,u,&tmp);
895  else
896  return jjBETTI2(res,u,&tmp);
897 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:95
BOOLEAN jjBETTI2(leftv res, leftv u, leftv v)
Definition: ipshell.cc:920
void * data
Definition: subexpr.h:89
int rtyp
Definition: subexpr.h:92
BOOLEAN jjBETTI2_ID(leftv res, leftv u, leftv v)
Definition: ipshell.cc:899

§ jjBETTI2()

BOOLEAN jjBETTI2 ( leftv  res,
leftv  u,
leftv  v 
)

Definition at line 920 of file ipshell.cc.

921 {
922  resolvente r;
923  int len;
924  int reg,typ0;
925  lists l=(lists)u->Data();
926 
927  intvec *weights=NULL;
928  int add_row_shift=0;
929  intvec *ww=NULL;
930  if (l->nr>=0) ww=(intvec *)atGet(&(l->m[0]),"isHomog",INTVEC_CMD);
931  if (ww!=NULL)
932  {
933  weights=ivCopy(ww);
934  add_row_shift = ww->min_in();
935  (*weights) -= add_row_shift;
936  }
937  //Print("attr:%x\n",weights);
938 
939  r=liFindRes(l,&len,&typ0);
940  if (r==NULL) return TRUE;
941  intvec* res_im=syBetti(r,len,&reg,weights,(int)(long)v->Data());
942  res->data=(void*)res_im;
943  omFreeSize((ADDRESS)r,(len)*sizeof(ideal));
944  //Print("rowShift: %d ",add_row_shift);
945  for(int i=1;i<=res_im->rows();i++)
946  {
947  if (IMATELEM(*res_im,1,i)==0) { add_row_shift--; }
948  else break;
949  }
950  //Print(" %d\n",add_row_shift);
951  atSet(res,omStrDup("rowShift"),(void*)(long)add_row_shift,INT_CMD);
952  if (weights!=NULL) delete weights;
953  return FALSE;
954 }
sleftv * m
Definition: lists.h:45
void atSet(idhdl root, const char *name, void *data, int typ)
Definition: attrib.cc:156
Definition: tok.h:95
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
Definition: lists.cc:312
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:94
int rows() const
Definition: intvec.h:88
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
intvec * ivCopy(const intvec *o)
Definition: intvec.h:126
#define TRUE
Definition: auxiliary.h:98
void * ADDRESS
Definition: auxiliary.h:115
int min_in()
Definition: intvec.h:113
void * data
Definition: subexpr.h:89
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
int i
Definition: cfEzgcd.cc:123
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:135
int nr
Definition: lists.h:43
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
void * Data()
Definition: subexpr.cc:1138
ideal * resolvente
Definition: ideals.h:18
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
Definition: syz.cc:791
#define IMATELEM(M, I, J)
Definition: intvec.h:77
int l
Definition: cfEzgcd.cc:94
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ jjBETTI2_ID()

BOOLEAN jjBETTI2_ID ( leftv  res,
leftv  u,
leftv  v 
)

Definition at line 899 of file ipshell.cc.

900 {
902  l->Init(1);
903  l->m[0].rtyp=u->Typ();
904  l->m[0].data=u->Data();
905  attr *a=u->Attribute();
906  if (a!=NULL)
907  l->m[0].attribute=*a;
908  sleftv tmp2;
909  memset(&tmp2,0,sizeof(tmp2));
910  tmp2.rtyp=LIST_CMD;
911  tmp2.data=(void *)l;
912  BOOLEAN r=jjBETTI2(res,&tmp2,v);
913  l->m[0].data=NULL;
914  l->m[0].attribute=NULL;
915  l->m[0].rtyp=DEF_CMD;
916  l->Clean();
917  return r;
918 }
#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:15
Definition: lists.h:22
attr * Attribute()
Definition: subexpr.cc:1393
BOOLEAN jjBETTI2(leftv res, leftv u, leftv v)
Definition: ipshell.cc:920
int Typ()
Definition: subexpr.cc:996
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)
#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:1138
Definition: tok.h:117
attr attribute
Definition: subexpr.h:90
omBin slists_bin
Definition: lists.cc:23
int BOOLEAN
Definition: auxiliary.h:85
int l
Definition: cfEzgcd.cc:94

§ jjCHARSERIES()

BOOLEAN jjCHARSERIES ( leftv  res,
leftv  u 
)

Definition at line 3237 of file ipshell.cc.

3238 {
3239  res->data=singclap_irrCharSeries((ideal)u->Data(), currRing);
3240  return (res->data==NULL);
3241 }
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:10
matrix singclap_irrCharSeries(ideal I, const ring r)
Definition: clapsing.cc:1398
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1138

§ jjIMPORTFROM()

BOOLEAN jjIMPORTFROM ( leftv  res,
leftv  u,
leftv  v 
)

Definition at line 2185 of file ipassign.cc.

2186 {
2187  //Print("importfrom %s::%s ->.\n",v->Name(),u->Name() );
2188  assume(u->Typ()==PACKAGE_CMD);
2189  char *vn=(char *)v->Name();
2190  idhdl h=((package)(u->Data()))->idroot->get(vn /*v->Name()*/, myynest);
2191  if (h!=NULL)
2192  {
2193  //check for existence
2194  if (((package)(u->Data()))==basePack)
2195  {
2196  WarnS("source and destination packages are identical");
2197  return FALSE;
2198  }
2199  idhdl t=basePack->idroot->get(vn /*v->Name()*/, myynest);
2200  if (t!=NULL)
2201  {
2202  if (BVERBOSE(V_REDEFINE)) Warn("redefining %s (%s)",vn,my_yylinebuf);
2203  killhdl(t);
2204  }
2205  sleftv tmp_expr;
2206  if (iiDeclCommand(&tmp_expr,v,myynest,DEF_CMD,&IDROOT)) return TRUE;
2207  sleftv h_expr;
2208  memset(&h_expr,0,sizeof(h_expr));
2209  h_expr.rtyp=IDHDL;
2210  h_expr.data=h;
2211  h_expr.name=vn;
2212  return iiAssign(&tmp_expr,&h_expr);
2213  }
2214  else
2215  {
2216  Werror("`%s` not found in `%s`",v->Name(), u->Name());
2217  return TRUE;
2218  }
2219  return FALSE;
2220 }
ip_package * package
Definition: structs.h:46
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:94
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:98
#define WarnS
Definition: emacs.cc:81
int Typ()
Definition: subexpr.cc:996
const char * Name()
Definition: subexpr.h:121
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:89
int myynest
Definition: febase.cc:46
char my_yylinebuf[80]
Definition: febase.cc:48
Definition: tok.h:58
const char * name
Definition: subexpr.h:88
#define assume(x)
Definition: mod2.h:394
#define BVERBOSE(a)
Definition: options.h:33
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition: ipshell.cc:1122
#define NULL
Definition: omList.c:10
void killhdl(idhdl h, package proot)
Definition: ipid.cc:378
package basePack
Definition: ipid.cc:64
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1138
static Poly * h
Definition: janet.cc:978
#define V_REDEFINE
Definition: options.h:43
void Werror(const char *fmt,...)
Definition: reporter.cc:189
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1793
#define Warn
Definition: emacs.cc:80

§ jjLIST_PL()

BOOLEAN jjLIST_PL ( leftv  res,
leftv  v 
)

Definition at line 7387 of file iparith.cc.

7388 {
7389  int sl=0;
7390  if (v!=NULL) sl = v->listLength();
7391  lists L;
7392  if((sl==1)&&(v->Typ()==RESOLUTION_CMD))
7393  {
7394  int add_row_shift = 0;
7395  intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
7396  if (weights!=NULL) add_row_shift=weights->min_in();
7397  L=syConvRes((syStrategy)v->Data(),FALSE,add_row_shift);
7398  }
7399  else
7400  {
7402  leftv h=NULL;
7403  int i;
7404  int rt;
7405 
7406  L->Init(sl);
7407  for (i=0;i<sl;i++)
7408  {
7409  if (h!=NULL)
7410  { /* e.g. not in the first step:
7411  * h is the pointer to the old sleftv,
7412  * v is the pointer to the next sleftv
7413  * (in this moment) */
7414  h->next=v;
7415  }
7416  h=v;
7417  v=v->next;
7418  h->next=NULL;
7419  rt=h->Typ();
7420  if (rt==0)
7421  {
7422  L->Clean();
7423  Werror("`%s` is undefined",h->Fullname());
7424  return TRUE;
7425  }
7426  if (rt==RING_CMD)
7427  {
7428  L->m[i].rtyp=rt; L->m[i].data=h->Data();
7429  ((ring)L->m[i].data)->ref++;
7430  }
7431  else
7432  L->m[i].Copy(h);
7433  }
7434  }
7435  res->data=(char *)L;
7436  return FALSE;
7437 }
#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:94
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition: ipshell.cc:3073
int listLength()
Definition: subexpr.cc:61
#define TRUE
Definition: auxiliary.h:98
int min_in()
Definition: intvec.h:113
int Typ()
Definition: subexpr.cc:996
const char * Fullname()
Definition: subexpr.h:126
void * data
Definition: subexpr.h:89
Definition: intvec.h:14
void Copy(leftv e)
Definition: subexpr.cc:689
int i
Definition: cfEzgcd.cc:123
leftv next
Definition: subexpr.h:87
INLINE_THIS void Init(int l=0)
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:1138
omBin slists_bin
Definition: lists.cc:23
static Poly * h
Definition: janet.cc:978
void Werror(const char *fmt,...)
Definition: reporter.cc:189

§ jjLOAD()

BOOLEAN jjLOAD ( const char *  s,
BOOLEAN  autoexport = FALSE 
)

load lib/module given in v

Definition at line 5194 of file iparith.cc.

5195 {
5196  char libnamebuf[256];
5197  lib_types LT = type_of_LIB(s, libnamebuf);
5198 
5199 #ifdef HAVE_DYNAMIC_LOADING
5200  extern BOOLEAN load_modules(const char *newlib, char *fullpath, BOOLEAN autoexport);
5201 #endif /* HAVE_DYNAMIC_LOADING */
5202  switch(LT)
5203  {
5204  default:
5205  case LT_NONE:
5206  Werror("%s: unknown type", s);
5207  break;
5208  case LT_NOTFOUND:
5209  Werror("cannot open %s", s);
5210  break;
5211 
5212  case LT_SINGULAR:
5213  {
5214  char *plib = iiConvName(s);
5215  idhdl pl = IDROOT->get(plib,0);
5216  if (pl==NULL)
5217  {
5218  pl = enterid( plib,0, PACKAGE_CMD, &(basePack->idroot), TRUE );
5219  IDPACKAGE(pl)->language = LANG_SINGULAR;
5220  IDPACKAGE(pl)->libname=omStrDup(plib);
5221  }
5222  else if (IDTYP(pl)!=PACKAGE_CMD)
5223  {
5224  Werror("can not create package `%s`",plib);
5225  omFree(plib);
5226  return TRUE;
5227  }
5228  package savepack=currPack;
5229  currPack=IDPACKAGE(pl);
5230  IDPACKAGE(pl)->loaded=TRUE;
5231  char libnamebuf[256];
5232  FILE * fp = feFopen( s, "r", libnamebuf, TRUE );
5233  BOOLEAN bo=iiLoadLIB(fp, libnamebuf, s, pl, autoexport, TRUE);
5234  currPack=savepack;
5235  IDPACKAGE(pl)->loaded=(!bo);
5236  return bo;
5237  }
5238  case LT_BUILTIN:
5239  SModulFunc_t iiGetBuiltinModInit(const char*);
5240  return load_builtin(s,autoexport, iiGetBuiltinModInit(s));
5241  case LT_MACH_O:
5242  case LT_ELF:
5243  case LT_HPUX:
5244 #ifdef HAVE_DYNAMIC_LOADING
5245  return load_modules(s, libnamebuf, autoexport);
5246 #else /* HAVE_DYNAMIC_LOADING */
5247  WerrorS("Dynamic modules are not supported by this version of Singular");
5248  break;
5249 #endif /* HAVE_DYNAMIC_LOADING */
5250  }
5251  return TRUE;
5252 }
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:98
lib_types type_of_LIB(const char *newlib, char *libnamebuf)
Definition: mod_lib.cc:24
void WerrorS(const char *s)
Definition: feFopen.cc:24
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:136
#define IDTYP(a)
Definition: ipid.h:116
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:259
#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:47
lib_types
Definition: mod_raw.h:16
BOOLEAN load_builtin(const char *newlib, BOOLEAN autoexport, SModulFunc_t init)
Definition: iplib.cc:1080
#define NULL
Definition: omList.c:10
SModulFunc_t iiGetBuiltinModInit(const char *libname)
Definition: iplib.cc:643
package basePack
Definition: ipid.cc:64
package currPack
Definition: ipid.cc:63
int(* SModulFunc_t)(SModulFunctions *)
Definition: ipid.h:82
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:807
char * iiConvName(const char *libname)
Definition: iplib.cc:1214
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition: iplib.cc:982
void Werror(const char *fmt,...)
Definition: reporter.cc:189
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ jjLOAD_TRY()

BOOLEAN jjLOAD_TRY ( const char *  s)

Definition at line 5258 of file iparith.cc.

5259 {
5260  void (*WerrorS_save)(const char *s) = WerrorS_callback;
5263  BOOLEAN bo=jjLOAD(s,TRUE);
5264  if (TEST_OPT_PROT && (bo || (WerrorS_dummy_cnt>0)))
5265  Print("loading of >%s< failed\n",s);
5266  WerrorS_callback=WerrorS_save;
5267  errorreported=0;
5268  return FALSE;
5269 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define Print
Definition: emacs.cc:83
#define TEST_OPT_PROT
Definition: options.h:98
static int WerrorS_dummy_cnt
Definition: iparith.cc:5253
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport)
load lib/module given in v
Definition: iparith.cc:5194
static void WerrorS_dummy(const char *)
Definition: iparith.cc:5254
void(* WerrorS_callback)(const char *s)
Definition: feFopen.cc:21
short errorreported
Definition: feFopen.cc:23
int BOOLEAN
Definition: auxiliary.h:85

§ jjMINRES()

BOOLEAN jjMINRES ( leftv  res,
leftv  v 
)

Definition at line 865 of file ipshell.cc.

866 {
867  int len=0;
868  int typ0;
869  lists L=(lists)v->Data();
870  intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
871  int add_row_shift = 0;
872  if (weights==NULL)
873  weights=(intvec*)atGet(&(L->m[0]),"isHomog",INTVEC_CMD);
874  if (weights!=NULL) add_row_shift=weights->min_in();
875  resolvente rr=liFindRes(L,&len,&typ0);
876  if (rr==NULL) return TRUE;
877  resolvente r=iiCopyRes(rr,len);
878 
879  syMinimizeResolvente(r,len,0);
880  omFreeSize((ADDRESS)rr,len*sizeof(ideal));
881  len++;
882  res->data=(char *)liMakeResolv(r,len,-1,typ0,NULL,add_row_shift);
883  return FALSE;
884 }
sleftv * m
Definition: lists.h:45
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
Definition: lists.cc:312
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:94
void syMinimizeResolvente(resolvente res, int length, int first)
Definition: syz.cc:360
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define TRUE
Definition: auxiliary.h:98
void * ADDRESS
Definition: auxiliary.h:115
int min_in()
Definition: intvec.h:113
void * data
Definition: subexpr.h:89
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
static resolvente iiCopyRes(resolvente r, int l)
Definition: ipshell.cc:855
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:215
void * Data()
Definition: subexpr.cc:1138
ideal * resolvente
Definition: ideals.h:18

§ jjRESULTANT()

BOOLEAN jjRESULTANT ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)

Definition at line 3230 of file ipshell.cc.

3231 {
3232  res->data=singclap_resultant((poly)u->CopyD(),(poly)v->CopyD(),
3233  (poly)w->CopyD(), currRing);
3234  return errorreported;
3235 }
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:10
short errorreported
Definition: feFopen.cc:23
polyrec * poly
Definition: hilb.h:10
void * CopyD(int t)
Definition: subexpr.cc:708

§ jjSYSTEM()

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

§ jjVARIABLES_ID()

BOOLEAN jjVARIABLES_ID ( leftv  res,
leftv  u 
)

Definition at line 6196 of file ipshell.cc.

6197 {
6198  int *e=(int *)omAlloc0((rVar(currRing)+1)*sizeof(int));
6199  ideal I=(ideal)u->Data();
6200  int i;
6201  int n=0;
6202  for(i=I->nrows*I->ncols-1;i>=0;i--)
6203  {
6204  int n0=pGetVariables(I->m[i],e);
6205  if (n0>n) n=n0;
6206  }
6207  jjINT_S_TO_ID(n,e,res);
6208  return FALSE;
6209 }
#define FALSE
Definition: auxiliary.h:94
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
static void jjINT_S_TO_ID(int n, int *e, leftv res)
Definition: ipshell.cc:6166
#define pGetVariables(p, e)
Definition: polys.h:234
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
void * Data()
Definition: subexpr.cc:1138
#define omAlloc0(size)
Definition: omAllocDecl.h:211

§ jjVARIABLES_P()

BOOLEAN jjVARIABLES_P ( leftv  res,
leftv  u 
)

Definition at line 6188 of file ipshell.cc.

6189 {
6190  int *e=(int *)omAlloc0((rVar(currRing)+1)*sizeof(int));
6191  int n=pGetVariables((poly)u->Data(),e);
6192  jjINT_S_TO_ID(n,e,res);
6193  return FALSE;
6194 }
#define FALSE
Definition: auxiliary.h:94
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
static void jjINT_S_TO_ID(int n, int *e, leftv res)
Definition: ipshell.cc:6166
#define pGetVariables(p, e)
Definition: polys.h:234
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void * Data()
Definition: subexpr.cc:1138
polyrec * poly
Definition: hilb.h:10
#define omAlloc0(size)
Definition: omAllocDecl.h:211

§ killlocals()

void killlocals ( int  v)

Definition at line 378 of file ipshell.cc.

379 {
380  BOOLEAN changed=FALSE;
381  idhdl sh=currRingHdl;
382  ring cr=currRing;
383  if (sh!=NULL) changed=((IDLEV(sh)<v) || (IDRING(sh)->ref>0));
384  //if (changed) Print("currRing=%s(%x), lev=%d,ref=%d\n",IDID(sh),IDRING(sh),IDLEV(sh),IDRING(sh)->ref);
385 
386  killlocals_rec(&(basePack->idroot),v,currRing);
387 
389  {
390  int t=iiRETURNEXPR.Typ();
391  if (/*iiRETURNEXPR.Typ()*/ t==RING_CMD)
392  {
394  if (((ring)h->data)->idroot!=NULL)
395  killlocals0(v,&(((ring)h->data)->idroot),(ring)h->data);
396  }
397  else if (/*iiRETURNEXPR.Typ()*/ t==LIST_CMD)
398  {
399  leftv h=&iiRETURNEXPR;
400  changed |=killlocals_list(v,(lists)h->data);
401  }
402  }
403  if (changed)
404  {
406  if (currRingHdl==NULL)
407  currRing=NULL;
408  else if(cr!=currRing)
409  rChangeCurrRing(cr);
410  }
411 
412  if (myynest<=1) iiNoKeepRing=TRUE;
413  //Print("end killlocals >= %d\n",v);
414  //listall();
415 }
int iiRETURNEXPR_len
Definition: iplib.cc:472
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:94
sleftv iiRETURNEXPR
Definition: iplib.cc:471
#define TRUE
Definition: auxiliary.h:98
void killlocals_rec(idhdl *root, int v, ring r)
Definition: ipshell.cc:322
int Typ()
Definition: subexpr.cc:996
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:10
BOOLEAN killlocals_list(int v, lists L)
Definition: ipshell.cc:358
static BOOLEAN iiNoKeepRing
Definition: ipshell.cc:82
idhdl currRingHdl
Definition: ipid.cc:65
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1564
#define IDLEV(a)
Definition: ipid.h:118
void rChangeCurrRing(ring r)
Definition: polys.cc:12
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:64
#define IDRING(a)
Definition: ipid.h:124
Definition: tok.h:117
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
static void killlocals0(int v, idhdl *localhdl, const ring r)
Definition: ipshell.cc:287

§ kQHWeight()

BOOLEAN kQHWeight ( leftv  res,
leftv  v 
)

Definition at line 3213 of file ipshell.cc.

3214 {
3215  res->data=(char *)id_QHomWeight((ideal)v->Data(), currRing);
3216  if (res->data==NULL)
3217  res->data=(char *)new intvec(rVar(currRing));
3218  return FALSE;
3219 }
#define FALSE
Definition: auxiliary.h:94
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
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:10
Definition: intvec.h:14
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1138

§ kWeight()

BOOLEAN kWeight ( leftv  res,
leftv  id 
)

Definition at line 3191 of file ipshell.cc.

3192 {
3193  ideal F=(ideal)id->Data();
3194  intvec * iv = new intvec(rVar(currRing));
3195  polyset s;
3196  int sl, n, i;
3197  int *x;
3198 
3199  res->data=(char *)iv;
3200  s = F->m;
3201  sl = IDELEMS(F) - 1;
3202  n = rVar(currRing);
3203  double wNsqr = (double)2.0 / (double)n;
3205  x = (int * )omAlloc(2 * (n + 1) * sizeof(int));
3206  wCall(s, sl, x, wNsqr, currRing);
3207  for (i = n; i!=0; i--)
3208  (*iv)[i-1] = x[i + n + 1];
3209  omFreeSize((ADDRESS)x, 2 * (n + 1) * sizeof(int));
3210  return FALSE;
3211 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:94
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
void * ADDRESS
Definition: auxiliary.h:115
#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:10
Definition: intvec.h:14
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:24
poly * polyset
Definition: hutil.h:15
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:1138
double wFunctionalBuch(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
Definition: weight0.c:78

§ list_cmd()

void list_cmd ( int  typ,
const char *  what,
const char *  prefix,
BOOLEAN  iterate,
BOOLEAN  fullname = FALSE 
)

Definition at line 417 of file ipshell.cc.

418 {
419  package savePack=currPack;
420  idhdl h,start;
421  BOOLEAN all = typ<0;
422  BOOLEAN really_all=FALSE;
423 
424  if ( typ==0 )
425  {
426  if (strcmp(what,"all")==0)
427  {
428  if (currPack!=basePack)
429  list_cmd(-1,NULL,prefix,iterate,fullname); // list current package
430  really_all=TRUE;
431  h=basePack->idroot;
432  }
433  else
434  {
435  h = ggetid(what);
436  if (h!=NULL)
437  {
438  if (iterate) list1(prefix,h,TRUE,fullname);
439  if (IDTYP(h)==ALIAS_CMD) PrintS("A");
440  if ((IDTYP(h)==RING_CMD)
441  //|| (IDTYP(h)==PACKE_CMD)
442  )
443  {
444  h=IDRING(h)->idroot;
445  }
446  else if(IDTYP(h)==PACKAGE_CMD)
447  {
448  currPack=IDPACKAGE(h);
449  //Print("list_cmd:package\n");
450  all=TRUE;typ=PROC_CMD;fullname=TRUE;really_all=TRUE;
451  h=IDPACKAGE(h)->idroot;
452  }
453  else
454  {
455  currPack=savePack;
456  return;
457  }
458  }
459  else
460  {
461  Werror("%s is undefined",what);
462  currPack=savePack;
463  return;
464  }
465  }
466  all=TRUE;
467  }
468  else if (RingDependend(typ))
469  {
470  h = currRing->idroot;
471  }
472  else
473  h = IDROOT;
474  start=h;
475  while (h!=NULL)
476  {
477  if ((all
478  && (IDTYP(h)!=PROC_CMD)
479  &&(IDTYP(h)!=PACKAGE_CMD)
480  &&(IDTYP(h)!=CRING_CMD)
481  )
482  || (typ == IDTYP(h))
483  || ((IDTYP(h)==CRING_CMD) && (typ==RING_CMD))
484  )
485  {
486  list1(prefix,h,start==currRingHdl, fullname);
487  if ((IDTYP(h)==RING_CMD)
488  && (really_all || (all && (h==currRingHdl)))
489  && ((IDLEV(h)==0)||(IDLEV(h)==myynest)))
490  {
491  list_cmd(0,IDID(h),"// ",FALSE);
492  }
493  if (IDTYP(h)==PACKAGE_CMD && really_all)
494  {
495  package save_p=currPack;
496  currPack=IDPACKAGE(h);
497  list_cmd(0,IDID(h),"// ",FALSE);
498  currPack=save_p;
499  }
500  }
501  h = IDNEXT(h);
502  }
503  currPack=savePack;
504 }
#define IDID(a)
Definition: ipid.h:119
#define FALSE
Definition: auxiliary.h:94
#define IDNEXT(a)
Definition: ipid.h:115
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:98
static void list1(const char *s, idhdl h, BOOLEAN c, BOOLEAN fullname)
Definition: ipshell.cc:147
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:136
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:10
#define IDTYP(a)
Definition: ipid.h:116
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:417
idhdl currRingHdl
Definition: ipid.cc:65
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDLEV(a)
Definition: ipid.h:118
Definition: tok.h:34
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:64
#define IDRING(a)
Definition: ipid.h:124
package currPack
Definition: ipid.cc:63
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
void Werror(const char *fmt,...)
Definition: reporter.cc:189
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)
Definition: ipid.cc:496

§ loNewtonP()

BOOLEAN loNewtonP ( leftv  res,
leftv  arg1 
)

compute Newton Polytopes of input polynomials

Definition at line 4453 of file ipshell.cc.

4454 {
4455  res->data= (void*)loNewtonPolytope( (ideal)arg1->Data() );
4456  return FALSE;
4457 }
#define FALSE
Definition: auxiliary.h:94
ideal loNewtonPolytope(const ideal id)
Definition: mpr_base.cc:3190
void * data
Definition: subexpr.h:89
void * Data()
Definition: subexpr.cc:1138

§ loSimplex()

BOOLEAN loSimplex ( leftv  res,
leftv  args 
)

Implementation of the Simplex Algorithm.

For args, see class simplex.

Definition at line 4459 of file ipshell.cc.

4460 {
4461  if ( !(rField_is_long_R(currRing)) )
4462  {
4463  WerrorS("Ground field not implemented!");
4464  return TRUE;
4465  }
4466 
4467  simplex * LP;
4468  matrix m;
4469 
4470  leftv v= args;
4471  if ( v->Typ() != MATRIX_CMD ) // 1: matrix
4472  return TRUE;
4473  else
4474  m= (matrix)(v->CopyD());
4475 
4476  LP = new simplex(MATROWS(m),MATCOLS(m));
4477  LP->mapFromMatrix(m);
4478 
4479  v= v->next;
4480  if ( v->Typ() != INT_CMD ) // 2: m = number of constraints
4481  return TRUE;
4482  else
4483  LP->m= (int)(long)(v->Data());
4484 
4485  v= v->next;
4486  if ( v->Typ() != INT_CMD ) // 3: n = number of variables
4487  return TRUE;
4488  else
4489  LP->n= (int)(long)(v->Data());
4490 
4491  v= v->next;
4492  if ( v->Typ() != INT_CMD ) // 4: m1 = number of <= constraints
4493  return TRUE;
4494  else
4495  LP->m1= (int)(long)(v->Data());
4496 
4497  v= v->next;
4498  if ( v->Typ() != INT_CMD ) // 5: m2 = number of >= constraints
4499  return TRUE;
4500  else
4501  LP->m2= (int)(long)(v->Data());
4502 
4503  v= v->next;
4504  if ( v->Typ() != INT_CMD ) // 6: m3 = number of == constraints
4505  return TRUE;
4506  else
4507  LP->m3= (int)(long)(v->Data());
4508 
4509 #ifdef mprDEBUG_PROT
4510  Print("m (constraints) %d\n",LP->m);
4511  Print("n (columns) %d\n",LP->n);
4512  Print("m1 (<=) %d\n",LP->m1);
4513  Print("m2 (>=) %d\n",LP->m2);
4514  Print("m3 (==) %d\n",LP->m3);
4515 #endif
4516 
4517  LP->compute();
4518 
4519  lists lres= (lists)omAlloc( sizeof(slists) );
4520  lres->Init( 6 );
4521 
4522  lres->m[0].rtyp= MATRIX_CMD; // output matrix
4523  lres->m[0].data=(void*)LP->mapToMatrix(m);
4524 
4525  lres->m[1].rtyp= INT_CMD; // found a solution?
4526  lres->m[1].data=(void*)(long)LP->icase;
4527 
4528  lres->m[2].rtyp= INTVEC_CMD;
4529  lres->m[2].data=(void*)LP->posvToIV();
4530 
4531  lres->m[3].rtyp= INTVEC_CMD;
4532  lres->m[3].data=(void*)LP->zrovToIV();
4533 
4534  lres->m[4].rtyp= INT_CMD;
4535  lres->m[4].data=(void*)(long)LP->m;
4536 
4537  lres->m[5].rtyp= INT_CMD;
4538  lres->m[5].data=(void*)(long)LP->n;
4539 
4540  res->data= (void*)lres;
4541 
4542  return FALSE;
4543 }
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:95
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:94
Linear Programming / Linear Optimization using Simplex - Algorithm.
Definition: mpr_numeric.h:194
#define TRUE
Definition: auxiliary.h:98
intvec * zrovToIV()
void WerrorS(const char *s)
Definition: feFopen.cc:24
int Typ()
Definition: subexpr.cc:996
#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:10
intvec * posvToIV()
BOOLEAN mapFromMatrix(matrix m)
ip_smatrix * matrix
int m
Definition: cfEzgcd.cc:119
leftv next
Definition: subexpr.h:87
INLINE_THIS void Init(int l=0)
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:534
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1138
#define MATROWS(i)
Definition: matpol.h:27
int icase
Definition: mpr_numeric.h:201
void * CopyD(int t)
Definition: subexpr.cc:708

§ mpJacobi()

BOOLEAN mpJacobi ( leftv  res,
leftv  a 
)

Definition at line 2961 of file ipshell.cc.

2962 {
2963  int i,j;
2964  matrix result;
2965  ideal id=(ideal)a->Data();
2966 
2967  result =mpNew(IDELEMS(id),rVar(currRing));
2968  for (i=1; i<=IDELEMS(id); i++)
2969  {
2970  for (j=1; j<=rVar(currRing); j++)
2971  {
2972  MATELEM(result,i,j) = pDiff(id->m[i-1],j);
2973  }
2974  }
2975  res->data=(char *)result;
2976  return FALSE;
2977 }
#define FALSE
Definition: auxiliary.h:94
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
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:10
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47
void * Data()
Definition: subexpr.cc:1138
#define pDiff(a, b)
Definition: polys.h:278
return result
Definition: facAbsBiFact.cc:76
#define MATELEM(mat, i, j)
Definition: matpol.h:29

§ mpKoszul()

BOOLEAN mpKoszul ( leftv  res,
leftv  c,
leftv  b,
leftv  id 
)

Definition at line 2983 of file ipshell.cc.

2984 {
2985  int n=(int)(long)b->Data();
2986  int d=(int)(long)c->Data();
2987  int k,l,sign,row,col;
2988  matrix result;
2989  ideal temp;
2990  BOOLEAN bo;
2991  poly p;
2992 
2993  if ((d>n) || (d<1) || (n<1))
2994  {
2995  res->data=(char *)mpNew(1,1);
2996  return FALSE;
2997  }
2998  int *choise = (int*)omAlloc(d*sizeof(int));
2999  if (id==NULL)
3000  temp=idMaxIdeal(1);
3001  else
3002  temp=(ideal)id->Data();
3003 
3004  k = binom(n,d);
3005  l = k*d;
3006  l /= n-d+1;
3007  result =mpNew(l,k);
3008  col = 1;
3009  idInitChoise(d,1,n,&bo,choise);
3010  while (!bo)
3011  {
3012  sign = 1;
3013  for (l=1;l<=d;l++)
3014  {
3015  if (choise[l-1]<=IDELEMS(temp))
3016  {
3017  p = pCopy(temp->m[choise[l-1]-1]);
3018  if (sign == -1) p = pNeg(p);
3019  sign *= -1;
3020  row = idGetNumberOfChoise(l-1,d,1,n,choise);
3021  MATELEM(result,row,col) = p;
3022  }
3023  }
3024  col++;
3025  idGetNextChoise(d,n,&bo,choise);
3026  }
3027  if (id==NULL) idDelete(&temp);
3028 
3029  res->data=(char *)result;
3030  return FALSE;
3031 }
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
Definition: ideals.h:33
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define pNeg(p)
Definition: polys.h:181
int k
Definition: cfEzgcd.cc:93
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
#define IDELEMS(i)
Definition: simpleideals.h:24
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47
#define NULL
Definition: omList.c:10
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)
void * Data()
Definition: subexpr.cc:1138
int idGetNumberOfChoise(int t, int d, int begin, int end, int *choise)
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:85
static int sign(int x)
Definition: ring.cc:3328
int binom(int n, int r)
return result
Definition: facAbsBiFact.cc:76
int l
Definition: cfEzgcd.cc:94
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168
#define MATELEM(mat, i, j)
Definition: matpol.h:29

§ nuLagSolve()

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 4568 of file ipshell.cc.

4569 {
4570 
4571  poly gls;
4572  gls= (poly)(arg1->Data());
4573  int howclean= (int)(long)arg3->Data();
4574 
4575  if ( !(rField_is_R(currRing) ||
4576  rField_is_Q(currRing) ||
4579  {
4580  WerrorS("Ground field not implemented!");
4581  return TRUE;
4582  }
4583 
4586  {
4587  unsigned long int ii = (unsigned long int)arg2->Data();
4588  setGMPFloatDigits( ii, ii );
4589  }
4590 
4591  if ( gls == NULL || pIsConstant( gls ) )
4592  {
4593  WerrorS("Input polynomial is constant!");
4594  return TRUE;
4595  }
4596 
4597  int ldummy;
4598  int deg= currRing->pLDeg( gls, &ldummy, currRing );
4599  int i,vpos=0;
4600  poly piter;
4601  lists elist;
4602  lists rlist;
4603 
4604  elist= (lists)omAlloc( sizeof(slists) );
4605  elist->Init( 0 );
4606 
4607  if ( rVar(currRing) > 1 )
4608  {
4609  piter= gls;
4610  for ( i= 1; i <= rVar(currRing); i++ )
4611  if ( pGetExp( piter, i ) )
4612  {
4613  vpos= i;
4614  break;
4615  }
4616  while ( piter )
4617  {
4618  for ( i= 1; i <= rVar(currRing); i++ )
4619  if ( (vpos != i) && (pGetExp( piter, i ) != 0) )
4620  {
4621  WerrorS("The input polynomial must be univariate!");
4622  return TRUE;
4623  }
4624  pIter( piter );
4625  }
4626  }
4627 
4628  rootContainer * roots= new rootContainer();
4629  number * pcoeffs= (number *)omAlloc( (deg+1) * sizeof( number ) );
4630  piter= gls;
4631  for ( i= deg; i >= 0; i-- )
4632  {
4633  if ( piter && pTotaldegree(piter) == i )
4634  {
4635  pcoeffs[i]= nCopy( pGetCoeff( piter ) );
4636  //nPrint( pcoeffs[i] );PrintS(" ");
4637  pIter( piter );
4638  }
4639  else
4640  {
4641  pcoeffs[i]= nInit(0);
4642  }
4643  }
4644 
4645 #ifdef mprDEBUG_PROT
4646  for (i=deg; i >= 0; i--)
4647  {
4648  nPrint( pcoeffs[i] );PrintS(" ");
4649  }
4650  PrintLn();
4651 #endif
4652 
4653  roots->fillContainer( pcoeffs, NULL, 1, deg, rootContainer::onepoly, 1 );
4654  roots->solver( howclean );
4655 
4656  int elem= roots->getAnzRoots();
4657  char *dummy;
4658  int j;
4659 
4660  rlist= (lists)omAlloc( sizeof(slists) );
4661  rlist->Init( elem );
4662 
4664  {
4665  for ( j= 0; j < elem; j++ )
4666  {
4667  rlist->m[j].rtyp=NUMBER_CMD;
4668  rlist->m[j].data=(void *)nCopy((number)(roots->getRoot(j)));
4669  //rlist->m[j].data=(void *)(number)(roots->getRoot(j));
4670  }
4671  }
4672  else
4673  {
4674  for ( j= 0; j < elem; j++ )
4675  {
4676  dummy = complexToStr( (*roots)[j], gmp_output_digits, currRing->cf );
4677  rlist->m[j].rtyp=STRING_CMD;
4678  rlist->m[j].data=(void *)dummy;
4679  }
4680  }
4681 
4682  elist->Clean();
4683  //omFreeSize( (ADDRESS) elist, sizeof(slists) );
4684 
4685  // this is (via fillContainer) the same data as in root
4686  //for ( i= deg; i >= 0; i-- ) nDelete( &pcoeffs[i] );
4687  //omFreeSize( (ADDRESS) pcoeffs, (deg+1) * sizeof( number ) );
4688 
4689  delete roots;
4690 
4691  res->rtyp= LIST_CMD;
4692  res->data= (void*)rlist;
4693 
4694  return FALSE;
4695 }
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:310
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:94
static BOOLEAN rField_is_R(const ring r)
Definition: ring.h:510
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
#define TRUE
Definition: auxiliary.h:98
bool solver(const int polishmode=PM_NONE)
Definition: mpr_numeric.cc:449
void WerrorS(const char *s)
Definition: feFopen.cc:24
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:10
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
int j
Definition: myNF.cc:70
static long pTotaldegree(poly p)
Definition: polys.h:264
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:221
void fillContainer(number *_coeffs, number *_ievpoint, const int _var, const int _tdg, const rootType _rt, const int _anz)
Definition: mpr_numeric.cc:312
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:501
gmp_complex * getRoot(const int i)
Definition: mpr_numeric.h:88
static BOOLEAN rField_is_long_C(const ring r)
Definition: ring.h:537
INLINE_THIS void Init(int l=0)
#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:534
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:1138
Definition: tok.h:117
char * complexToStr(gmp_complex &c, const unsigned int oprec, const coeffs src)
Definition: mpr_complex.cc:706
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
polyrec * poly
Definition: hilb.h:10
#define nInit(i)
Definition: numbers.h:24

§ nuMPResMat()

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 4545 of file ipshell.cc.

4546 {
4547  ideal gls = (ideal)(arg1->Data());
4548  int imtype= (int)(long)arg2->Data();
4549 
4550  uResultant::resMatType mtype= determineMType( imtype );
4551 
4552  // check input ideal ( = polynomial system )
4553  if ( mprIdealCheck( gls, arg1->Name(), mtype, true ) != mprOk )
4554  {
4555  return TRUE;
4556  }
4557 
4558  uResultant *resMat= new uResultant( gls, mtype, false );
4559  if (resMat!=NULL)
4560  {
4561  res->rtyp = MODUL_CMD;
4562  res->data= (void*)resMat->accessResMat()->getMatrix();
4563  if (!errorreported) delete resMat;
4564  }
4565  return errorreported;
4566 }
Base class for solving 0-dim poly systems using u-resultant.
Definition: mpr_base.h:62
resMatrixBase * accessResMat()
Definition: mpr_base.h:78
#define TRUE
Definition: auxiliary.h:98
uResultant::resMatType determineMType(int imtype)
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)
short errorreported
Definition: feFopen.cc:23
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1138

§ nuUResSolve()

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 4798 of file ipshell.cc.

4799 {
4800  leftv v= args;
4801 
4802  ideal gls;
4803  int imtype;
4804  int howclean;
4805 
4806  // get ideal
4807  if ( v->Typ() != IDEAL_CMD )
4808  return TRUE;
4809  else gls= (ideal)(v->Data());
4810  v= v->next;
4811 
4812  // get resultant matrix type to use (0,1)
4813  if ( v->Typ() != INT_CMD )
4814  return TRUE;
4815  else imtype= (int)(long)v->Data();
4816  v= v->next;
4817 
4818  if (imtype==0)
4819  {
4820  ideal test_id=idInit(1,1);
4821  int j;
4822  for(j=IDELEMS(gls)-1;j>=0;j--)
4823  {
4824  if (gls->m[j]!=NULL)
4825  {
4826  test_id->m[0]=gls->m[j];
4827  intvec *dummy_w=id_QHomWeight(test_id, currRing);
4828  if (dummy_w!=NULL)
4829  {
4830  WerrorS("Newton polytope not of expected dimension");
4831  delete dummy_w;
4832  return TRUE;
4833  }
4834  }
4835  }
4836  }
4837 
4838  // get and set precision in digits ( > 0 )
4839  if ( v->Typ() != INT_CMD )
4840  return TRUE;
4841  else if ( !(rField_is_R(currRing) || rField_is_long_R(currRing) || \
4843  {
4844  unsigned long int ii=(unsigned long int)v->Data();
4845  setGMPFloatDigits( ii, ii );
4846  }
4847  v= v->next;
4848 
4849  // get interpolation steps (0,1,2)
4850  if ( v->Typ() != INT_CMD )
4851  return TRUE;
4852  else howclean= (int)(long)v->Data();
4853 
4854  uResultant::resMatType mtype= determineMType( imtype );
4855  int i,count;
4856  lists listofroots= NULL;
4857  number smv= NULL;
4858  BOOLEAN interpolate_det= (mtype==uResultant::denseResMat)?TRUE:FALSE;
4859 
4860  //emptylist= (lists)omAlloc( sizeof(slists) );
4861  //emptylist->Init( 0 );
4862 
4863  //res->rtyp = LIST_CMD;
4864  //res->data= (void *)emptylist;
4865 
4866  // check input ideal ( = polynomial system )
4867  if ( mprIdealCheck( gls, args->Name(), mtype ) != mprOk )
4868  {
4869  return TRUE;
4870  }
4871 
4872  uResultant * ures;
4873  rootContainer ** iproots;
4874  rootContainer ** muiproots;
4875  rootArranger * arranger;
4876 
4877  // main task 1: setup of resultant matrix
4878  ures= new uResultant( gls, mtype );
4879  if ( ures->accessResMat()->initState() != resMatrixBase::ready )
4880  {
4881  WerrorS("Error occurred during matrix setup!");
4882  return TRUE;
4883  }
4884 
4885  // if dense resultant, check if minor nonsingular
4886  if ( mtype == uResultant::denseResMat )
4887  {
4888  smv= ures->accessResMat()->getSubDet();
4889 #ifdef mprDEBUG_PROT
4890  PrintS("// Determinant of submatrix: ");nPrint(smv);PrintLn();
4891 #endif
4892  if ( nIsZero(smv) )
4893  {
4894  WerrorS("Unsuitable input ideal: Minor of resultant matrix is singular!");
4895  return TRUE;
4896  }
4897  }
4898 
4899  // main task 2: Interpolate specialized resultant polynomials
4900  if ( interpolate_det )
4901  iproots= ures->interpolateDenseSP( false, smv );
4902  else
4903  iproots= ures->specializeInU( false, smv );
4904 
4905  // main task 3: Interpolate specialized resultant polynomials
4906  if ( interpolate_det )
4907  muiproots= ures->interpolateDenseSP( true, smv );
4908  else
4909  muiproots= ures->specializeInU( true, smv );
4910 
4911 #ifdef mprDEBUG_PROT
4912  int c= iproots[0]->getAnzElems();
4913  for (i=0; i < c; i++) pWrite(iproots[i]->getPoly());
4914  c= muiproots[0]->getAnzElems();
4915  for (i=0; i < c; i++) pWrite(muiproots[i]->getPoly());
4916 #endif
4917 
4918  // main task 4: Compute roots of specialized polys and match them up
4919  arranger= new rootArranger( iproots, muiproots, howclean );
4920  arranger->solve_all();
4921 
4922  // get list of roots
4923  if ( arranger->success() )
4924  {
4925  arranger->arrange();
4926  listofroots= listOfRoots(arranger, gmp_output_digits );
4927  }
4928  else
4929  {
4930  WerrorS("Solver was unable to find any roots!");
4931  return TRUE;
4932  }
4933 
4934  // free everything
4935  count= iproots[0]->getAnzElems();
4936  for (i=0; i < count; i++) delete iproots[i];
4937  omFreeSize( (ADDRESS) iproots, count * sizeof(rootContainer*) );
4938  count= muiproots[0]->getAnzElems();
4939  for (i=0; i < count; i++) delete muiproots[i];
4940  omFreeSize( (ADDRESS) muiproots, count * sizeof(rootContainer*) );
4941 
4942  delete ures;
4943  delete arranger;
4944  nDelete( &smv );
4945 
4946  res->data= (void *)listofroots;
4947 
4948  //emptylist->Clean();
4949  // omFreeSize( (ADDRESS) emptylist, sizeof(slists) );
4950 
4951  return FALSE;
4952 }
int status int void size_t count
Definition: si_signals.h:59
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:310
Base class for solving 0-dim poly systems using u-resultant.
Definition: mpr_base.h:62
Definition: tok.h:95
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:94
static BOOLEAN rField_is_R(const ring r)
Definition: ring.h:510
resMatrixBase * accessResMat()
Definition: mpr_base.h:78
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
intvec * id_QHomWeight(ideal id, const ring r)
#define TRUE
Definition: auxiliary.h:98
uResultant::resMatType determineMType(int imtype)
void * ADDRESS
Definition: auxiliary.h:115
void pWrite(poly p)
Definition: polys.h:290
void WerrorS(const char *s)
Definition: feFopen.cc:24
int getAnzElems()
Definition: mpr_numeric.h:95
rootContainer ** specializeInU(BOOLEAN matchUp=false, const number subDetVal=NULL)
Definition: mpr_base.cc:3059
int Typ()
Definition: subexpr.cc:996
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:10
Definition: intvec.h:14
int j
Definition: myNF.cc:70
bool success()
Definition: mpr_numeric.h:162
void arrange()
Definition: mpr_numeric.cc:895
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
void solve_all()
Definition: mpr_numeric.cc:870
#define IDELEMS(i)
Definition: simpleideals.h:24
mprState mprIdealCheck(const ideal theIdeal, const char *name, uResultant::resMatType mtype, BOOLEAN rmatrix=false)
rootContainer ** interpolateDenseSP(BOOLEAN matchUp=false, const number subDetVal=NULL)
Definition: mpr_base.cc:2921
#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:537
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
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:534
void * Data()
Definition: subexpr.cc:1138
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
virtual IStateType initState() const
Definition: mpr_base.h:41
int BOOLEAN
Definition: auxiliary.h:85
lists listOfRoots(rootArranger *self, const unsigned int oprec)
Definition: ipshell.cc:4955
virtual number getSubDet()
Definition: mpr_base.h:37

§ nuVanderSys()

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 4697 of file ipshell.cc.

4698 {
4699  int i;
4700  ideal p,w;
4701  p= (ideal)arg1->Data();
4702  w= (ideal)arg2->Data();
4703 
4704  // w[0] = f(p^0)
4705  // w[1] = f(p^1)
4706  // ...
4707  // p can be a vector of numbers (multivariate polynom)
4708  // or one number (univariate polynom)
4709  // tdg = deg(f)
4710 
4711  int n= IDELEMS( p );
4712  int m= IDELEMS( w );
4713  int tdg= (int)(long)arg3->Data();
4714 
4715  res->data= (void*)NULL;
4716 
4717  // check the input
4718  if ( tdg < 1 )
4719  {
4720  WerrorS("Last input parameter must be > 0!");
4721  return TRUE;
4722  }
4723  if ( n != rVar(currRing) )
4724  {
4725  Werror("Size of first input ideal must be equal to %d!",rVar(currRing));
4726  return TRUE;
4727  }
4728  if ( m != (int)pow((double)tdg+1,(double)n) )
4729  {
4730  Werror("Size of second input ideal must be equal to %d!",
4731  (int)pow((double)tdg+1,(double)n));
4732  return TRUE;
4733  }
4734  if ( !(rField_is_Q(currRing) /* ||
4735  rField_is_R() || rField_is_long_R() ||
4736  rField_is_long_C()*/ ) )
4737  {
4738  WerrorS("Ground field not implemented!");
4739  return TRUE;
4740  }
4741 
4742  number tmp;
4743  number *pevpoint= (number *)omAlloc( n * sizeof( number ) );
4744  for ( i= 0; i < n; i++ )
4745  {
4746  pevpoint[i]=nInit(0);
4747  if ( (p->m)[i] )
4748  {
4749  tmp = pGetCoeff( (p->m)[i] );
4750  if ( nIsZero(tmp) || nIsOne(tmp) || nIsMOne(tmp) )
4751  {
4752  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4753  WerrorS("Elements of first input ideal must not be equal to -1, 0, 1!");
4754  return TRUE;
4755  }
4756  } else tmp= NULL;
4757  if ( !nIsZero(tmp) )
4758  {
4759  if ( !pIsConstant((p->m)[i]))
4760  {
4761  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4762  WerrorS("Elements of first input ideal must be numbers!");
4763  return TRUE;
4764  }
4765  pevpoint[i]= nCopy( tmp );
4766  }
4767  }
4768 
4769  number *wresults= (number *)omAlloc( m * sizeof( number ) );
4770  for ( i= 0; i < m; i++ )
4771  {
4772  wresults[i]= nInit(0);
4773  if ( (w->m)[i] && !nIsZero(pGetCoeff((w->m)[i])) )
4774  {
4775  if ( !pIsConstant((w->m)[i]))
4776  {
4777  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4778  omFreeSize( (ADDRESS)wresults, m * sizeof( number ) );
4779  WerrorS("Elements of second input ideal must be numbers!");
4780  return TRUE;
4781  }
4782  wresults[i]= nCopy(pGetCoeff((w->m)[i]));
4783  }
4784  }
4785 
4786  vandermonde vm( m, n, tdg, pevpoint, FALSE );
4787  number *ncpoly= vm.interpolateDense( wresults );
4788  // do not free ncpoly[]!!
4789  poly rpoly= vm.numvec2poly( ncpoly );
4790 
4791  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4792  omFreeSize( (ADDRESS)wresults, m * sizeof( number ) );
4793 
4794  res->data= (void*)rpoly;
4795  return FALSE;
4796 }
vandermonde system solver for interpolating polynomials from their values
Definition: mpr_numeric.h:28
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
void * ADDRESS
Definition: auxiliary.h:115
void WerrorS(const char *s)
Definition: feFopen.cc:24
#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:10
int m
Definition: cfEzgcd.cc:119
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:221
int i
Definition: cfEzgcd.cc:123
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:501
#define IDELEMS(i)
Definition: simpleideals.h:24
#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:1138
polyrec * poly
Definition: hilb.h:10
#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:189

§ paPrint()

void paPrint ( const char *  n,
package  p 
)

Definition at line 6211 of file ipshell.cc.

6212 {
6213  Print(" %s (",n);
6214  switch (p->language)
6215  {
6216  case LANG_SINGULAR: PrintS("S"); break;
6217  case LANG_C: PrintS("C"); break;
6218  case LANG_TOP: PrintS("T"); break;
6219  case LANG_NONE: PrintS("N"); break;
6220  default: PrintS("U");
6221  }
6222  if(p->libname!=NULL)
6223  Print(",%s", p->libname);
6224  PrintS(")");
6225 }
#define Print
Definition: emacs.cc:83
return P p
Definition: myNF.cc:203
Definition: subexpr.h:21
void PrintS(const char *s)
Definition: reporter.cc:284
#define NULL
Definition: omList.c:10

§ rDecompose()

lists rDecompose ( const ring  r)

Definition at line 2010 of file ipshell.cc.

2011 {
2012  assume( r != NULL );
2013  const coeffs C = r->cf;
2014  assume( C != NULL );
2015 
2016  // sanity check: require currRing==r for rings with polynomial data
2017  if ( (r!=currRing) && (
2018  (nCoeff_is_algExt(C) && (C != currRing->cf))
2019  || (r->qideal != NULL)
2020 #ifdef HAVE_PLURAL
2021  || (rIsPluralRing(r))
2022 #endif
2023  )
2024  )
2025  {
2026  WerrorS("ring with polynomial data must be the base ring or compatible");
2027  return NULL;
2028  }
2029  // 0: char/ cf - ring
2030  // 1: list (var)
2031  // 2: list (ord)
2032  // 3: qideal
2033  // possibly:
2034  // 4: C
2035  // 5: D
2037  if (rIsPluralRing(r))
2038  L->Init(6);
2039  else
2040  L->Init(4);
2041  // ----------------------------------------
2042  // 0: char/ cf - ring
2043  if (rField_is_numeric(r))
2044  {
2045  rDecomposeC(&(L->m[0]),r);
2046  }
2047  else if (rField_is_Ring(r))
2048  {
2049  rDecomposeRing(&(L->m[0]),r);
2050  }
2051  else if ( r->cf->extRing!=NULL )// nCoeff_is_algExt(r->cf))
2052  {
2053  rDecomposeCF(&(L->m[0]), r->cf->extRing, r);
2054  }
2055  else if(rField_is_GF(r))
2056  {
2058  Lc->Init(4);
2059  // char:
2060  Lc->m[0].rtyp=INT_CMD;
2061  Lc->m[0].data=(void*)(long)r->cf->m_nfCharQ;
2062  // var:
2064  Lv->Init(1);
2065  Lv->m[0].rtyp=STRING_CMD;
2066  Lv->m[0].data=(void *)omStrDup(*rParameter(r));
2067  Lc->m[1].rtyp=LIST_CMD;
2068  Lc->m[1].data=(void*)Lv;
2069  // ord:
2071  Lo->Init(1);
2073  Loo->Init(2);
2074  Loo->m[0].rtyp=STRING_CMD;
2075  Loo->m[0].data=(void *)omStrDup(rSimpleOrdStr(ringorder_lp));
2076 
2077  intvec *iv=new intvec(1); (*iv)[0]=1;
2078  Loo->m[1].rtyp=INTVEC_CMD;
2079  Loo->m[1].data=(void *)iv;
2080 
2081  Lo->m[0].rtyp=LIST_CMD;
2082  Lo->m[0].data=(void*)Loo;
2083 
2084  Lc->m[2].rtyp=LIST_CMD;
2085  Lc->m[2].data=(void*)Lo;
2086  // q-ideal:
2087  Lc->m[3].rtyp=IDEAL_CMD;
2088  Lc->m[3].data=(void *)idInit(1,1);
2089  // ----------------------
2090  L->m[0].rtyp=LIST_CMD;
2091  L->m[0].data=(void*)Lc;
2092  }
2093  else
2094  {
2095  L->m[0].rtyp=INT_CMD;
2096  L->m[0].data=(void *)(long)r->cf->ch;
2097  }
2098  // ----------------------------------------
2099  // 1: list (var)
2101  LL->Init(r->N);
2102  int i;
2103  for(i=0; i<r->N; i++)
2104  {
2105  LL->m[i].rtyp=STRING_CMD;
2106  LL->m[i].data=(void *)omStrDup(r->names[i]);
2107  }
2108  L->m[1].rtyp=LIST_CMD;
2109  L->m[1].data=(void *)LL;
2110  // ----------------------------------------
2111  // 2: list (ord)
2113  i=rBlocks(r)-1;
2114  LL->Init(i);
2115  i--;
2116  lists LLL;
2117  for(; i>=0; i--)
2118  {
2119  intvec *iv;
2120  int j;
2121  LL->m[i].rtyp=LIST_CMD;
2123  LLL->Init(2);
2124  LLL->m[0].rtyp=STRING_CMD;
2125  LLL->m[0].data=(void *)omStrDup(rSimpleOrdStr(r->order[i]));
2126 
2127  if(r->order[i] == ringorder_IS) // || r->order[i] == ringorder_s || r->order[i] == ringorder_S)
2128  {
2129  assume( r->block0[i] == r->block1[i] );
2130  const int s = r->block0[i];
2131  assume( -2 < s && s < 2);
2132 
2133  iv=new intvec(1);
2134  (*iv)[0] = s;
2135  }
2136  else if (r->block1[i]-r->block0[i] >=0 )
2137  {
2138  int bl=j=r->block1[i]-r->block0[i];
2139  if (r->order[i]==ringorder_M)
2140  {
2141  j=(j+1)*(j+1)-1;
2142  bl=j+1;
2143  }
2144  else if (r->order[i]==ringorder_am)
2145  {
2146  j+=r->wvhdl[i][bl+1];
2147  }
2148  iv=new intvec(j+1);
2149  if ((r->wvhdl!=NULL) && (r->wvhdl[i]!=NULL))
2150  {
2151  for(;j>=0; j--) (*iv)[j]=r->wvhdl[i][j+(j>bl)];
2152  }
2153  else switch (r->order[i])
2154  {
2155  case ringorder_dp:
2156  case ringorder_Dp:
2157  case ringorder_ds:
2158  case ringorder_Ds:
2159  case ringorder_lp:
2160  for(;j>=0; j--) (*iv)[j]=1;
2161  break;
2162  default: /* do nothing */;
2163  }
2164  }
2165  else
2166  {
2167  iv=new intvec(1);
2168  }
2169  LLL->m[1].rtyp=INTVEC_CMD;
2170  LLL->m[1].data=(void *)iv;
2171  LL->m[i].data=(void *)LLL;
2172  }
2173  L->m[2].rtyp=LIST_CMD;
2174  L->m[2].data=(void *)LL;
2175  // ----------------------------------------
2176  // 3: qideal
2177  L->m[3].rtyp=IDEAL_CMD;
2178  if (r->qideal==NULL)
2179  L->m[3].data=(void *)idInit(1,1);
2180  else
2181  L->m[3].data=(void *)idCopy(r->qideal);
2182  // ----------------------------------------
2183 #ifdef HAVE_PLURAL // NC! in rDecompose
2184  if (rIsPluralRing(r))
2185  {
2186  L->m[4].rtyp=MATRIX_CMD;
2187  L->m[4].data=(void *)mp_Copy(r->GetNC()->C, r, r);
2188  L->m[5].rtyp=MATRIX_CMD;
2189  L->m[5].data=(void *)mp_Copy(r->GetNC()->D, r, r);
2190  }
2191 #endif
2192  return L;
2193 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
sleftv * m
Definition: lists.h:45
Definition: tok.h:95
Definition: lists.h:22
void WerrorS(const char *s)
Definition: feFopen.cc:24
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:513
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:616
CanonicalForm Lc(const CanonicalForm &f)
void * data
Definition: subexpr.h:89
void rDecomposeCF(leftv h, const ring r, const ring R)
Definition: ipshell.cc:1590
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static int rBlocks(ring r)
Definition: ring.h:559
const ring r
Definition: syzextra.cc:208
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:927
Definition: intvec.h:14
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
The main handler for Singular numbers which are suitable for Singular polynomials.
static void rDecomposeC(leftv h, const ring R)
Definition: ipshell.cc:1712
const char * rSimpleOrdStr(int ord)
Definition: ring.cc:88
int i
Definition: cfEzgcd.cc:123
Induced (Schreyer) ordering.
Definition: ring.h:101
ideal idCopy(ideal A)
Definition: ideals.h:60
INLINE_THIS void Init(int l=0)
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
void rDecomposeRing(leftv h, const ring R)
Definition: ipshell.cc:1776
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:92
Definition: tok.h:117
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:74
omBin slists_bin
Definition: lists.cc:23
static BOOLEAN rField_is_numeric(const ring r)
Definition: ring.h:507
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ rDecompose_CF()

BOOLEAN rDecompose_CF ( leftv  res,
const coeffs  C 
)

Definition at line 1808 of file ipshell.cc.

1809 {
1810  assume( C != NULL );
1811 
1812  // sanity check: require currRing==r for rings with polynomial data
1813  if ( nCoeff_is_algExt(C) && (C != currRing->cf))
1814  {
1815  WerrorS("ring with polynomial data must be the base ring or compatible");
1816  return TRUE;
1817  }
1818  if (nCoeff_is_numeric(C))
1819  {
1820  rDecomposeC_41(res,C);
1821  }
1822 #ifdef HAVE_RINGS
1823  else if (nCoeff_is_Ring(C))
1824  {
1825  rDecomposeRing_41(res,C);
1826  }
1827 #endif
1828  else if ( C->extRing!=NULL )// nCoeff_is_algExt(r->cf))
1829  {
1830  rDecomposeCF(res, C->extRing, currRing);
1831  }
1832  else if(nCoeff_is_GF(C))
1833  {
1835  Lc->Init(4);
1836  // char:
1837  Lc->m[0].rtyp=INT_CMD;
1838  Lc->m[0].data=(void*)(long)C->m_nfCharQ;
1839  // var:
1841  Lv->Init(1);
1842  Lv->m[0].rtyp=STRING_CMD;
1843  Lv->m[0].data=(void *)omStrDup(*n_ParameterNames(C));
1844  Lc->m[1].rtyp=LIST_CMD;
1845  Lc->m[1].data=(void*)Lv;
1846  // ord:
1848  Lo->Init(1);
1850  Loo->Init(2);
1851  Loo->m[0].rtyp=STRING_CMD;
1852  Loo->m[0].data=(void *)omStrDup(rSimpleOrdStr(ringorder_lp));
1853 
1854  intvec *iv=new intvec(1); (*iv)[0]=1;
1855  Loo->m[1].rtyp=INTVEC_CMD;
1856  Loo->m[1].data=(void *)iv;
1857 
1858  Lo->m[0].rtyp=LIST_CMD;
1859  Lo->m[0].data=(void*)Loo;
1860 
1861  Lc->m[2].rtyp=LIST_CMD;
1862  Lc->m[2].data=(void*)Lo;
1863  // q-ideal:
1864  Lc->m[3].rtyp=IDEAL_CMD;
1865  Lc->m[3].data=(void *)idInit(1,1);
1866  // ----------------------
1867  res->rtyp=LIST_CMD;
1868  res->data=(void*)Lc;
1869  }
1870  else
1871  {
1872  res->rtyp=INT_CMD;
1873  res->data=(void *)(long)C->ch;
1874  }
1875  // ----------------------------------------
1876  return FALSE;
1877 }
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition: coeffs.h:812
sleftv * m
Definition: lists.h:45
static FORCE_INLINE BOOLEAN nCoeff_is_numeric(const coeffs r)
Definition: coeffs.h:849
Definition: tok.h:95
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
CanonicalForm Lc(const CanonicalForm &f)
static FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r)
Definition: coeffs.h:762
void rDecomposeRing_41(leftv h, const coeffs C)
Definition: ipshell.cc:1748
void * data
Definition: subexpr.h:89
void rDecomposeCF(leftv h, const ring r, const ring R)
Definition: ipshell.cc:1590
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:927
Definition: intvec.h:14
#define assume(x)
Definition: mod2.h:394
const char * rSimpleOrdStr(int ord)
Definition: ring.cc:88
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition: coeffs.h:856
static void rDecomposeC_41(leftv h, const coeffs C)
Definition: ipshell.cc:1678
INLINE_THIS void Init(int l=0)
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:92
Definition: tok.h:117
omBin slists_bin
Definition: lists.cc:23
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ rDecompose_list_cf()

lists rDecompose_list_cf ( const ring  r)

Definition at line 1879 of file ipshell.cc.

1880 {
1881  assume( r != NULL );
1882  const coeffs C = r->cf;
1883  assume( C != NULL );
1884 
1885  // sanity check: require currRing==r for rings with polynomial data
1886  if ( (r!=currRing) && (
1887  (r->qideal != NULL)
1888 #ifdef HAVE_PLURAL
1889  || (rIsPluralRing(r))
1890 #endif
1891  )
1892  )
1893  {
1894  WerrorS("ring with polynomial data must be the base ring or compatible");
1895  return NULL;
1896  }
1897  // 0: char/ cf - ring
1898  // 1: list (var)
1899  // 2: list (ord)
1900  // 3: qideal
1901  // possibly:
1902  // 4: C
1903  // 5: D
1905  if (rIsPluralRing(r))
1906  L->Init(6);
1907  else
1908  L->Init(4);
1909  // ----------------------------------------
1910  // 0: char/ cf - ring
1911  L->m[0].rtyp=CRING_CMD;
1912  L->m[0].data=(char*)r->cf; r->cf->ref++;
1913  // ----------------------------------------
1914  // 1: list (var)
1916  LL->Init(r->N);
1917  int i;
1918  for(i=0; i<r->N; i++)
1919  {
1920  LL->m[i].rtyp=STRING_CMD;
1921  LL->m[i].data=(void *)omStrDup(r->names[i]);
1922  }
1923  L->m[1].rtyp=LIST_CMD;
1924  L->m[1].data=(void *)LL;
1925  // ----------------------------------------
1926  // 2: list (ord)
1928  i=rBlocks(r)-1;
1929  LL->Init(i);
1930  i--;
1931  lists LLL;
1932  for(; i>=0; i--)
1933  {
1934  intvec *iv;
1935  int j;
1936  LL->m[i].rtyp=LIST_CMD;
1938  LLL->Init(2);
1939  LLL->m[0].rtyp=STRING_CMD;
1940  LLL->m[0].data=(void *)omStrDup(rSimpleOrdStr(r->order[i]));
1941 
1942  if(r->order[i] == ringorder_IS) // || r->order[i] == ringorder_s || r->order[i] == ringorder_S)
1943  {
1944  assume( r->block0[i] == r->block1[i] );
1945  const int s = r->block0[i];
1946  assume( -2 < s && s < 2);
1947 
1948  iv=new intvec(1);
1949  (*iv)[0] = s;
1950  }
1951  else if (r->block1[i]-r->block0[i] >=0 )
1952  {
1953  int bl=j=r->block1[i]-r->block0[i];
1954  if (r->order[i]==ringorder_M)
1955  {
1956  j=(j+1)*(j+1)-1;
1957  bl=j+1;
1958  }
1959  else if (r->order[i]==ringorder_am)
1960  {
1961  j+=r->wvhdl[i][bl+1];
1962  }
1963  iv=new intvec(j+1);
1964  if ((r->wvhdl!=NULL) && (r->wvhdl[i]!=NULL))
1965  {
1966  for(;j>=0; j--) (*iv)[j]=r->wvhdl[i][j+(j>bl)];
1967  }
1968  else switch (r->order[i])
1969  {
1970  case ringorder_dp:
1971  case ringorder_Dp:
1972  case ringorder_ds:
1973  case ringorder_Ds:
1974  case ringorder_lp:
1975  for(;j>=0; j--) (*iv)[j]=1;
1976  break;
1977  default: /* do nothing */;
1978  }
1979  }
1980  else
1981  {
1982  iv=new intvec(1);
1983  }
1984  LLL->m[1].rtyp=INTVEC_CMD;
1985  LLL->m[1].data=(void *)iv;
1986  LL->m[i].data=(void *)LLL;
1987  }
1988  L->m[2].rtyp=LIST_CMD;
1989  L->m[2].data=(void *)LL;
1990  // ----------------------------------------
1991  // 3: qideal
1992  L->m[3].rtyp=IDEAL_CMD;
1993  if (r->qideal==NULL)
1994  L->m[3].data=(void *)idInit(1,1);
1995  else
1996  L->m[3].data=(void *)idCopy(r->qideal);
1997  // ----------------------------------------
1998 #ifdef HAVE_PLURAL // NC! in rDecompose
1999  if (rIsPluralRing(r))
2000  {
2001  L->m[4].rtyp=MATRIX_CMD;
2002  L->m[4].data=(void *)mp_Copy(r->GetNC()->C, r, r);
2003  L->m[5].rtyp=MATRIX_CMD;
2004  L->m[5].data=(void *)mp_Copy(r->GetNC()->D, r, r);
2005  }
2006 #endif
2007  return L;
2008 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
sleftv * m
Definition: lists.h:45
Definition: lists.h:22
void WerrorS(const char *s)
Definition: feFopen.cc:24
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:10
static int rBlocks(ring r)
Definition: ring.h:559
Definition: tok.h:56
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
The main handler for Singular numbers which are suitable for Singular polynomials.
const char * rSimpleOrdStr(int ord)
Definition: ring.cc:88
int i
Definition: cfEzgcd.cc:123
Induced (Schreyer) ordering.
Definition: ring.h:101
ideal idCopy(ideal A)
Definition: ideals.h:60
INLINE_THIS void Init(int l=0)
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:92
Definition: tok.h:117
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:74
omBin slists_bin
Definition: lists.cc:23
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ rDefault()

idhdl rDefault ( const char *  s)

Definition at line 1519 of file ipshell.cc.

1520 {
1521  idhdl tmp=NULL;
1522 
1523  if (s!=NULL) tmp = enterid(s, myynest, RING_CMD, &IDROOT);
1524  if (tmp==NULL) return NULL;
1525 
1526 // if ((currRing->ppNoether)!=NULL) pDelete(&(currRing->ppNoether));
1528  {
1530  memset(&sLastPrinted,0,sizeof(sleftv));
1531  }
1532 
1533  ring r = IDRING(tmp) = (ring) omAlloc0Bin(sip_sring_bin);
1534 
1535  r->cf = nInitChar(n_Zp, (void*)32003); // r->cf->ch = 32003;
1536  r->N = 3;
1537  /*r->P = 0; Alloc0 in idhdl::set, ipid.cc*/
1538  /*names*/
1539  r->names = (char **) omAlloc0(3 * sizeof(char_ptr));
1540  r->names[0] = omStrDup("x");
1541  r->names[1] = omStrDup("y");
1542  r->names[2] = omStrDup("z");
1543  /*weights: entries for 3 blocks: NULL*/
1544  r->wvhdl = (int **)omAlloc0(3 * sizeof(int_ptr));
1545  /*order: dp,C,0*/
1546  r->order = (int *) omAlloc(3 * sizeof(int *));
1547  r->block0 = (int *)omAlloc0(3 * sizeof(int *));
1548  r->block1 = (int *)omAlloc0(3 * sizeof(int *));
1549  /* ringorder dp for the first block: var 1..3 */
1550  r->order[0] = ringorder_dp;
1551  r->block0[0] = 1;
1552  r->block1[0] = 3;
1553  /* ringorder C for the second block: no vars */
1554  r->order[1] = ringorder_C;
1555  /* the last block: everything is 0 */
1556  r->order[2] = 0;
1557 
1558  /* complete ring intializations */
1559  rComplete(r);
1560  rSetHdl(tmp);
1561  return currRingHdl;
1562 }
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:30
#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:259
const ring r
Definition: syzextra.cc:208
BOOLEAN RingDependend()
Definition: subexpr.cc:403
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:3351
idhdl currRingHdl
Definition: ipid.cc:65
omBin sip_sring_bin
Definition: ring.cc:54
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define NULL
Definition: omList.c:10
#define IDRING(a)
Definition: ipid.h:124
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
void rSetHdl(idhdl h)
Definition: ipshell.cc:5002
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:334
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ rFindHdl()

idhdl rFindHdl ( ring  r,
idhdl  n 
)

Definition at line 1564 of file ipshell.cc.

1565 {
1567  if (h!=NULL) return h;
1568  if (IDROOT!=basePack->idroot) h=rSimpleFindHdl(r,basePack->idroot,n);
1569  if (h!=NULL) return h;
1571  while(p!=NULL)
1572  {
1573  if ((p->cPack!=basePack)
1574  && (p->cPack!=currPack))
1575  h=rSimpleFindHdl(r,p->cPack->idroot,n);
1576  if (h!=NULL) return h;
1577  p=p->next;
1578  }
1579  idhdl tmp=basePack->idroot;
1580  while (tmp!=NULL)
1581  {
1582  if (IDTYP(tmp)==PACKAGE_CMD)
1583  h=rSimpleFindHdl(r,IDPACKAGE(tmp)->idroot,n);
1584  if (h!=NULL) return h;
1585  tmp=IDNEXT(tmp);
1586  }
1587  return NULL;
1588 }
idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n)
Definition: ipshell.cc:6103
return P p
Definition: myNF.cc:203
#define IDNEXT(a)
Definition: ipid.h:115
proclevel * procstack
Definition: ipid.cc:58
#define IDROOT
Definition: ipid.h:20
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:136
#define IDTYP(a)
Definition: ipid.h:116
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:64
package currPack
Definition: ipid.cc:63
static Poly * h
Definition: janet.cc:978
package cPack
Definition: ipid.h:61

§ rInit()

ring rInit ( leftv  pn,
leftv  rv,
leftv  ord 
)

Definition at line 5488 of file ipshell.cc.

5489 {
5490 #ifdef HAVE_RINGS
5491  //unsigned int ringtype = 0;
5492  mpz_ptr modBase = NULL;
5493  unsigned int modExponent = 1;
5494 #endif
5495  int float_len=0;
5496  int float_len2=0;
5497  ring R = NULL;
5498  //BOOLEAN ffChar=FALSE;
5499 
5500  /* ch -------------------------------------------------------*/
5501  // get ch of ground field
5502 
5503  // allocated ring
5504  R = (ring) omAlloc0Bin(sip_sring_bin);
5505 
5506  coeffs cf = NULL;
5507 
5508  assume( pn != NULL );
5509  const int P = pn->listLength();
5510 
5511  if (pn->Typ()==CRING_CMD)
5512  {
5513  cf=(coeffs)pn->CopyD();
5514  leftv pnn=pn;
5515  if(P>1) /*parameter*/
5516  {
5517  pnn = pnn->next;
5518  const int pars = pnn->listLength();
5519  assume( pars > 0 );
5520  char ** names = (char**)omAlloc0(pars * sizeof(char_ptr));
5521 
5522  if (rSleftvList2StringArray(pnn, names))
5523  {
5524  WerrorS("parameter expected");
5525  goto rInitError;
5526  }
5527 
5528  TransExtInfo extParam;
5529 
5530  extParam.r = rDefault( cf, pars, names); // Q/Zp [ p_1, ... p_pars ]
5531  for(int i=pars-1; i>=0;i--)
5532  {
5533  omFree(names[i]);
5534  }
5535  omFree(names);
5536 
5537  cf = nInitChar(n_transExt, &extParam);
5538  }
5539  assume( cf != NULL );
5540  }
5541  else if (pn->Typ()==INT_CMD)
5542  {
5543  int ch = (int)(long)pn->Data();
5544  leftv pnn=pn;
5545 
5546  /* parameter? -------------------------------------------------------*/
5547  pnn = pnn->next;
5548 
5549  if (pnn == NULL) // no params!?
5550  {
5551  if (ch!=0)
5552  {
5553  int ch2=IsPrime(ch);
5554  if ((ch<2)||(ch!=ch2))
5555  {
5556  Warn("%d is invalid as characteristic of the ground field. 32003 is used.", ch);
5557  ch=32003;
5558  }
5559  cf = nInitChar(n_Zp, (void*)(long)ch);
5560  }
5561  else
5562  cf = nInitChar(n_Q, (void*)(long)ch);
5563  }
5564  else
5565  {
5566  const int pars = pnn->listLength();
5567 
5568  assume( pars > 0 );
5569 
5570  // predefined finite field: (p^k, a)
5571  if ((ch!=0) && (ch!=IsPrime(ch)) && (pars == 1))
5572  {
5573  GFInfo param;
5574 
5575  param.GFChar = ch;
5576  param.GFDegree = 1;
5577  param.GFPar_name = pnn->name;
5578 
5579  cf = nInitChar(n_GF, &param);
5580  }
5581  else // (0/p, a, b, ..., z)
5582  {
5583  if ((ch!=0) && (ch!=IsPrime(ch)))
5584  {
5585  WerrorS("too many parameters");
5586  goto rInitError;
5587  }
5588 
5589  char ** names = (char**)omAlloc0(pars * sizeof(char_ptr));
5590 
5591  if (rSleftvList2StringArray(pnn, names))
5592  {
5593  WerrorS("parameter expected");
5594  goto rInitError;
5595  }
5596 
5597  TransExtInfo extParam;
5598 
5599  extParam.r = rDefault( ch, pars, names); // Q/Zp [ p_1, ... p_pars ]
5600  for(int i=pars-1; i>=0;i--)
5601  {
5602  omFree(names[i]);
5603  }
5604  omFree(names);
5605 
5606  cf = nInitChar(n_transExt, &extParam);
5607  }
5608  }
5609 
5610  //if (cf==NULL) ->Error: Invalid ground field specification
5611  }
5612  else if ((pn->name != NULL)
5613  && ((strcmp(pn->name,"real")==0) || (strcmp(pn->name,"complex")==0)))
5614  {
5615  leftv pnn=pn->next;
5616  BOOLEAN complex_flag=(strcmp(pn->name,"complex")==0);
5617  if ((pnn!=NULL) && (pnn->Typ()==INT_CMD))
5618  {
5619  float_len=(int)(long)pnn->Data();
5620  float_len2=float_len;
5621  pnn=pnn->next;
5622  if ((pnn!=NULL) && (pnn->Typ()==INT_CMD))
5623  {
5624  float_len2=(int)(long)pnn->Data();
5625  pnn=pnn->next;
5626  }
5627  }
5628 
5629  if (!complex_flag)
5630  complex_flag= (pnn!=NULL) && (pnn->name!=NULL);
5631  if( !complex_flag && (float_len2 <= (short)SHORT_REAL_LENGTH))
5632  cf=nInitChar(n_R, NULL);
5633  else // longR or longC?
5634  {
5635  LongComplexInfo param;
5636 
5637  param.float_len = si_min (float_len, 32767);
5638  param.float_len2 = si_min (float_len2, 32767);
5639 
5640  // set the parameter name
5641  if (complex_flag)
5642  {
5643  if (param.float_len < SHORT_REAL_LENGTH)
5644  {
5647  }
5648  if ((pnn == NULL) || (pnn->name == NULL))
5649  param.par_name=(const char*)"i"; //default to i
5650  else
5651  param.par_name = (const char*)pnn->name;
5652  }
5653 
5654  cf = nInitChar(complex_flag ? n_long_C: n_long_R, (void*)&param);
5655  }
5656  assume( cf != NULL );
5657  }
5658 #ifdef HAVE_RINGS
5659  else if ((pn->name != NULL) && (strcmp(pn->name, "integer") == 0))
5660  {
5661  // TODO: change to use coeffs_BIGINT!?
5662  modBase = (mpz_ptr) omAlloc(sizeof(mpz_t));
5663  mpz_init_set_si(modBase, 0);
5664  if (pn->next!=NULL)
5665  {
5666  leftv pnn=pn;
5667  if (pnn->next->Typ()==INT_CMD)
5668  {
5669  pnn=pnn->next;
5670  mpz_set_ui(modBase, (int)(long) pnn->Data());
5671  if ((pnn->next!=NULL) && (pnn->next->Typ()==INT_CMD))
5672  {
5673  pnn=pnn->next;
5674  modExponent = (long) pnn->Data();
5675  }
5676  while ((pnn->next!=NULL) && (pnn->next->Typ()==INT_CMD))
5677  {
5678  pnn=pnn->next;
5679  mpz_mul_ui(modBase, modBase, (int)(long) pnn->Data());
5680  }
5681  }
5682  else if (pnn->next->Typ()==BIGINT_CMD)
5683  {
5684  number p=(number)pnn->next->CopyD();
5685  nlGMP(p,(number)modBase,coeffs_BIGINT); // TODO? // extern void nlGMP(number &i, number n, const coeffs r); // FIXME: n_MPZ( modBase, p, coeffs_BIGINT); ?
5686  n_Delete(&p,coeffs_BIGINT);
5687  }
5688  }
5689  else
5690  cf=nInitChar(n_Z,NULL);
5691 
5692  if ((mpz_cmp_ui(modBase, 1) == 0) && (mpz_cmp_ui(modBase, 0) < 0))
5693  {
5694  WerrorS("Wrong ground ring specification (module is 1)");
5695  goto rInitError;
5696  }
5697  if (modExponent < 1)
5698  {
5699  WerrorS("Wrong ground ring specification (exponent smaller than 1");
5700  goto rInitError;
5701  }
5702  // module is 0 ---> integers ringtype = 4;
5703  // we have an exponent
5704  if (modExponent > 1 && cf == NULL)
5705  {
5706  if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*sizeof(unsigned long)))
5707  {
5708  /* this branch should be active for modExponent = 2..32 resp. 2..64,
5709  depending on the size of a long on the respective platform */
5710  //ringtype = 1; // Use Z/2^ch
5711  cf=nInitChar(n_Z2m,(void*)(long)modExponent);
5712  mpz_clear(modBase);
5713  omFreeSize (modBase, sizeof (mpz_t));
5714  }
5715  else
5716  {
5717  if (mpz_cmp_ui(modBase,0)==0)
5718  {
5719  WerrorS("modulus must not be 0 or parameter not allowed");
5720  goto rInitError;
5721  }
5722  //ringtype = 3;
5723  ZnmInfo info;
5724  info.base= modBase;
5725  info.exp= modExponent;
5726  cf=nInitChar(n_Znm,(void*) &info); //exponent is missing
5727  }
5728  }
5729  // just a module m > 1
5730  else if (cf == NULL)
5731  {
5732  if (mpz_cmp_ui(modBase,0)==0)
5733  {
5734  WerrorS("modulus must not be 0 or parameter not allowed");
5735  goto rInitError;
5736  }
5737  //ringtype = 2;
5738  ZnmInfo info;
5739  info.base= modBase;
5740  info.exp= modExponent;
5741  cf=nInitChar(n_Zn,(void*) &info);
5742  }
5743  assume( cf != NULL );
5744  }
5745 #endif
5746  // ring NEW = OLD, (), (); where OLD is a polynomial ring...
5747  else if ((pn->Typ()==RING_CMD) && (P == 1))
5748  {
5749  TransExtInfo extParam;
5750  extParam.r = (ring)pn->Data();
5751  cf = nInitChar(n_transExt, &extParam);
5752  }
5753  //else if ((pn->Typ()==QRING_CMD) && (P == 1)) // same for qrings - which should be fields!?
5754  //{
5755  // AlgExtInfo extParam;
5756  // extParam.r = (ring)pn->Data();
5757 
5758  // cf = nInitChar(n_algExt, &extParam); // Q[a]/<minideal>
5759  //}
5760  else
5761  {
5762  WerrorS("Wrong or unknown ground field specification");
5763 #if 0
5764 // debug stuff for unknown cf descriptions:
5765  sleftv* p = pn;
5766  while (p != NULL)
5767  {
5768  Print( "pn[%p]: type: %d [%s]: %p, name: %s", (void*)p, p->Typ(), Tok2Cmdname(p->Typ()), p->Data(), (p->name == NULL? "NULL" : p->name) );
5769  PrintLn();
5770  p = p->next;
5771  }
5772 #endif
5773  goto rInitError;
5774  }
5775 
5776  /*every entry in the new ring is initialized to 0*/
5777 
5778  /* characteristic -----------------------------------------------*/
5779  /* input: 0 ch=0 : Q parameter=NULL ffChar=FALSE float_len
5780  * 0 1 : Q(a,...) *names FALSE
5781  * 0 -1 : R NULL FALSE 0
5782  * 0 -1 : R NULL FALSE prec. >6
5783  * 0 -1 : C *names FALSE prec. 0..?
5784  * p p : Fp NULL FALSE
5785  * p -p : Fp(a) *names FALSE
5786  * q q : GF(q=p^n) *names TRUE
5787  */
5788  if (cf==NULL)
5789  {
5790  WerrorS("Invalid ground field specification");
5791  goto rInitError;
5792 // const int ch=32003;
5793 // cf=nInitChar(n_Zp, (void*)(long)ch);
5794  }
5795 
5796  assume( R != NULL );
5797 
5798  R->cf = cf;
5799 
5800  /* names and number of variables-------------------------------------*/
5801  {
5802  int l=rv->listLength();
5803 
5804  if (l>MAX_SHORT)
5805  {
5806  Werror("too many ring variables(%d), max is %d",l,MAX_SHORT);
5807  goto rInitError;
5808  }
5809  R->N = l; /*rv->listLength();*/
5810  }
5811  R->names = (char **)omAlloc0(R->N * sizeof(char_ptr));
5812  if (rSleftvList2StringArray(rv, R->names))
5813  {
5814  WerrorS("name of ring variable expected");
5815  goto rInitError;
5816  }
5817 
5818  /* check names and parameters for conflicts ------------------------- */
5819  rRenameVars(R); // conflicting variables will be renamed
5820  /* ordering -------------------------------------------------------------*/
5821  if (rSleftvOrdering2Ordering(ord, R))
5822  goto rInitError;
5823 
5824  // Complete the initialization
5825  if (rComplete(R,1))
5826  goto rInitError;
5827 
5828 /*#ifdef HAVE_RINGS
5829 // currently, coefficients which are ring elements require a global ordering:
5830  if (rField_is_Ring(R) && (R->OrdSgn==-1))
5831  {
5832  WerrorS("global ordering required for these coefficients");
5833  goto rInitError;
5834  }
5835 #endif*/
5836 
5837  rTest(R);
5838 
5839  // try to enter the ring into the name list
5840  // need to clean up sleftv here, before this ring can be set to
5841  // new currRing or currRing can be killed beacuse new ring has
5842  // same name
5843  pn->CleanUp();
5844  rv->CleanUp();
5845  ord->CleanUp();
5846  //if ((tmp = enterid(s, myynest, RING_CMD, &IDROOT))==NULL)
5847  // goto rInitError;
5848 
5849  //memcpy(IDRING(tmp),R,sizeof(*R));
5850  // set current ring
5851  //omFreeBin(R, ip_sring_bin);
5852  //return tmp;
5853  return R;
5854 
5855  // error case:
5856  rInitError:
5857  if ((R != NULL)&&(R->cf!=NULL)) rDelete(R);
5858  pn->CleanUp();
5859  rv->CleanUp();
5860  ord->CleanUp();
5861  return NULL;
5862 }
mpz_ptr base
Definition: rmodulon.h:19
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
only used if HAVE_RINGS is defined
Definition: coeffs.h:44
Definition: tok.h:95
#define SHORT_REAL_LENGTH
Definition: numbers.h:54
const short MAX_SHORT
Definition: ipshell.cc:5476
static BOOLEAN rSleftvList2StringArray(leftv sl, char **p)
Definition: ipshell.cc:5440
only used if HAVE_RINGS is defined
Definition: coeffs.h:46
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:39
static int si_min(const int a, const int b)
Definition: auxiliary.h:121
BOOLEAN rSleftvOrdering2Ordering(sleftv *ord, ring R)
Definition: ipshell.cc:5168
Definition: tok.h:38
return P p
Definition: myNF.cc:203
rational (GMP) numbers
Definition: coeffs.h:31
const char * GFPar_name
Definition: coeffs.h:96
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
{p < 2^31}
Definition: coeffs.h:30
int listLength()
Definition: subexpr.cc:61
void WerrorS(const char *s)
Definition: feFopen.cc:24
void nlGMP(number &i, number n, const coeffs r)
Definition: longrat.cc:1467
coeffs coeffs_BIGINT
Definition: ipid.cc:54
int Typ()
Definition: subexpr.cc:996
#define omAlloc(size)
Definition: omAllocDecl.h:210
Creation data needed for finite fields.
Definition: coeffs.h:92
idhdl rDefault(const char *s)
Definition: ipshell.cc:1519
real floating point (GMP) numbers
Definition: coeffs.h:34
short float_len2
additional char-flags, rInit
Definition: coeffs.h:102
char * char_ptr
Definition: structs.h:56
single prescision (6,6) real numbers
Definition: coeffs.h:32
Definition: tok.h:56
short float_len
additional char-flags, rInit
Definition: coeffs.h:101
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:3351
only used if HAVE_RINGS is defined
Definition: coeffs.h:45
const char * name
Definition: subexpr.h:88
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:394
The main handler for Singular numbers which are suitable for Singular polynomials.
int GFDegree
Definition: coeffs.h:95
const ExtensionInfo & info
< [in] sqrfree poly
const ring R
Definition: DebugPrint.cc:36
complex floating point (GMP) numbers
Definition: coeffs.h:42
#define rTest(r)
Definition: ring.h:778
omBin sip_sring_bin
Definition: ring.cc:54
only used if HAVE_RINGS is defined
Definition: coeffs.h:43
struct for passing initialization parameters to naInitChar
Definition: transext.h:92
unsigned long exp
Definition: rmodulon.h:19
int i
Definition: cfEzgcd.cc:123
int IsPrime(int p)
Definition: prime.cc:61
static void rRenameVars(ring R)
Definition: ipshell.cc:2359
leftv next
Definition: subexpr.h:87
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
int GFChar
Definition: coeffs.h:94
CanonicalForm cf
Definition: cfModGcd.cc:4024
#define NULL
Definition: omList.c:10
{p^n < 2^16}
Definition: coeffs.h:33
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:132
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
void * Data()
Definition: subexpr.cc:1138
const char * par_name
parameter name
Definition: coeffs.h:103
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
kBucketDestroy & P
Definition: myNF.cc:191
int BOOLEAN
Definition: auxiliary.h:85
void Werror(const char *fmt,...)
Definition: reporter.cc:189
void * CopyD(int t)
Definition: subexpr.cc:708
#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:334
#define Warn
Definition: emacs.cc:80

§ rKill() [1/2]

void rKill ( idhdl  h)

Definition at line 6077 of file ipshell.cc.

6078 {
6079  ring r = IDRING(h);
6080  int ref=0;
6081  if (r!=NULL)
6082  {
6083  // avoid, that sLastPrinted is the last reference to the base ring:
6084  // clean up before killing the last "named" refrence:
6085  if ((sLastPrinted.rtyp==RING_CMD)
6086  && (sLastPrinted.data==(void*)r))
6087  {
6088  sLastPrinted.CleanUp(r);
6089  }
6090  ref=r->ref;
6091  rKill(r);
6092  }
6093  if (h==currRingHdl)
6094  {
6095  if (ref<=0) { currRing=NULL; currRingHdl=NULL;}
6096  else
6097  {
6099  }
6100  }
6101 }
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:10
const ring r
Definition: syzextra.cc:208
void rKill(ring r)
Definition: ipshell.cc:6026
idhdl currRingHdl
Definition: ipid.cc:65
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1564
#define NULL
Definition: omList.c:10
#define IDRING(a)
Definition: ipid.h:124
int rtyp
Definition: subexpr.h:92
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333

§ rKill() [2/2]

void rKill ( ring  r)

Definition at line 6026 of file ipshell.cc.

6027 {
6028  if ((r->ref<=0)&&(r->order!=NULL))
6029  {
6030 #ifdef RDEBUG
6031  if (traceit &TRACE_SHOW_RINGS) Print("kill ring %lx\n",(long)r);
6032 #endif
6033  if (r->qideal!=NULL)
6034  {
6035  id_Delete(&r->qideal, r);
6036  r->qideal = NULL;
6037  }
6038  int j;
6039  for (j=0;j<myynest;j++)
6040  {
6041  if (iiLocalRing[j]==r)
6042  {
6043  if (j==0) WarnS("killing the basering for level 0");
6044  iiLocalRing[j]=NULL;
6045  }
6046  }
6047 // any variables depending on r ?
6048  while (r->idroot!=NULL)
6049  {
6050  r->idroot->lev=myynest; // avoid warning about kill global objects
6051  killhdl2(r->idroot,&(r->idroot),r);
6052  }
6053  if (r==currRing)
6054  {
6055  // all dependend stuff is done, clean global vars:
6056  if ((currRing->ppNoether)!=NULL) pDelete(&(currRing->ppNoether));
6058  {
6060  }
6061  //if ((myynest>0) && (iiRETURNEXPR.RingDependend()))
6062  //{
6063  // WerrorS("return value depends on local ring variable (export missing ?)");
6064  // iiRETURNEXPR.CleanUp();
6065  //}
6066  currRing=NULL;
6067  currRingHdl=NULL;
6068  }
6069 
6070  /* nKillChar(r); will be called from inside of rDelete */
6071  rDelete(r);
6072  return;
6073  }
6074  r->ref--;
6075 }
#define TRACE_SHOW_RINGS
Definition: reporter.h:35
#define Print
Definition: emacs.cc:83
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
int traceit
Definition: febase.cc:47
#define WarnS
Definition: emacs.cc:81
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:10
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:409
const ring r
Definition: syzextra.cc:208
BOOLEAN RingDependend()
Definition: subexpr.cc:403
int j
Definition: myNF.cc:70
idhdl currRingHdl
Definition: ipid.cc:65
ring * iiLocalRing
Definition: iplib.cc:470
#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:169
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333

§ rSetHdl()

void rSetHdl ( idhdl  h)

Definition at line 5002 of file ipshell.cc.

5003 {
5004  ring rg = NULL;
5005  if (h!=NULL)
5006  {
5007 // Print(" new ring:%s (l:%d)\n",IDID(h),IDLEV(h));
5008  rg = IDRING(h);
5009  if (rg==NULL) return; //id <>NULL, ring==NULL
5010  omCheckAddrSize((ADDRESS)h,sizeof(idrec));
5011  if (IDID(h)) // OB: ????
5012  omCheckAddr((ADDRESS)IDID(h));
5013  rTest(rg);
5014  }
5015 
5016  // clean up history
5018  {
5020  memset(&sLastPrinted,0,sizeof(sleftv));
5021  }
5022 
5023  if ((rg!=currRing)&&(currRing!=NULL))
5024  {
5026  if (DENOMINATOR_LIST!=NULL)
5027  {
5028  if (TEST_V_ALLWARN)
5029  Warn("deleting denom_list for ring change to %s",IDID(h));
5030  do
5031  {
5032  n_Delete(&(dd->n),currRing->cf);
5033  dd=dd->next;
5035  DENOMINATOR_LIST=dd;
5036  } while(DENOMINATOR_LIST!=NULL);
5037  }
5038  }
5039 
5040  // test for valid "currRing":
5041  if ((rg!=NULL) && (rg->idroot==NULL))
5042  {
5043  ring old=rg;
5044  rg=rAssure_HasComp(rg);
5045  if (old!=rg)
5046  {
5047  rKill(old);
5048  IDRING(h)=rg;
5049  }
5050  }
5051  /*------------ change the global ring -----------------------*/
5052  rChangeCurrRing(rg);
5053  currRingHdl = h;
5054 }
#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:119
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:89
void * ADDRESS
Definition: auxiliary.h:115
ring rAssure_HasComp(const ring r)
Definition: ring.cc:4522
Definition: idrec.h:34
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN RingDependend()
Definition: subexpr.cc:403
void rKill(ring r)
Definition: ipshell.cc:6026
#define omFree(addr)
Definition: omAllocDecl.h:261
#define rTest(r)
Definition: ring.h:778
idhdl currRingHdl
Definition: ipid.cc:65
void rChangeCurrRing(ring r)
Definition: polys.cc:12
#define NULL
Definition: omList.c:10
denominator_list next
Definition: kutil.h:67
#define IDRING(a)
Definition: ipid.h:124
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:333
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
static Poly * h
Definition: janet.cc:978
#define TEST_V_ALLWARN
Definition: options.h:135
#define Warn
Definition: emacs.cc:80

§ rSimpleFindHdl()

idhdl rSimpleFindHdl ( ring  r,
idhdl  root,
idhdl  n = NULL 
)

Definition at line 6103 of file ipshell.cc.

6104 {
6105  idhdl h=root;
6106  while (h!=NULL)
6107  {
6108  if ((IDTYP(h)==RING_CMD)
6109  && (h!=n)
6110  && (IDRING(h)==r)
6111  )
6112  {
6113  return h;
6114  }
6115  h=IDNEXT(h);
6116  }
6117  return NULL;
6118 }
#define IDNEXT(a)
Definition: ipid.h:115
Definition: idrec.h:34
#define IDTYP(a)
Definition: ipid.h:116
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
#define IDRING(a)
Definition: ipid.h:124
static Poly * h
Definition: janet.cc:978

§ scIndIndset()

lists scIndIndset ( ideal  S,
BOOLEAN  all,
ideal  Q 
)

Definition at line 1022 of file ipshell.cc.

1023 {
1024  int i;
1025  indset save;
1027 
1028  hexist = hInit(S, Q, &hNexist, currRing);
1029  if (hNexist == 0)
1030  {
1031  intvec *iv=new intvec(rVar(currRing));
1032  for(i=0; i<rVar(currRing); i++) (*iv)[i]=1;
1033  res->Init(1);
1034  res->m[0].rtyp=INTVEC_CMD;
1035  res->m[0].data=(intvec*)iv;
1036  return res;
1037  }
1038  else if (hisModule!=0)
1039  {
1040  res->Init(0);
1041  return res;
1042  }
1043  save = ISet = (indset)omAlloc0Bin(indlist_bin);
1044  hMu = 0;
1045  hwork = (scfmon)omAlloc(hNexist * sizeof(scmon));
1046  hvar = (varset)omAlloc((rVar(currRing) + 1) * sizeof(int));
1047  hpure = (scmon)omAlloc((1 + (rVar(currRing) * rVar(currRing))) * sizeof(long));
1048  hrad = hexist;
1049  hNrad = hNexist;
1050  radmem = hCreate(rVar(currRing) - 1);
1051  hCo = rVar(currRing) + 1;
1052  hNvar = rVar(currRing);
1053  hRadical(hrad, &hNrad, hNvar);
1054  hSupp(hrad, hNrad, hvar, &hNvar);
1055  if (hNvar)
1056  {
1057  hCo = hNvar;
1058  memset(hpure, 0, (rVar(currRing) + 1) * sizeof(long));
1059  hPure(hrad, 0, &hNrad, hvar, hNvar, hpure, &hNpure);
1060  hLexR(hrad, hNrad, hvar, hNvar);
1062  }
1063  if (hCo && (hCo < rVar(currRing)))
1064  {
1066  }
1067  if (hMu!=0)
1068  {
1069  ISet = save;
1070  hMu2 = 0;
1071  if (all && (hCo+1 < rVar(currRing)))
1072  {
1075  i=hMu+hMu2;
1076  res->Init(i);
1077  if (hMu2 == 0)
1078  {
1080  }
1081  }
1082  else
1083  {
1084  res->Init(hMu);
1085  }
1086  for (i=0;i<hMu;i++)
1087  {
1088  res->m[i].data = (void *)save->set;
1089  res->m[i].rtyp = INTVEC_CMD;
1090  ISet = save;
1091  save = save->nx;
1093  }
1094  omFreeBin((ADDRESS)save, indlist_bin);
1095  if (hMu2 != 0)
1096  {
1097  save = JSet;
1098  for (i=hMu;i<hMu+hMu2;i++)
1099  {
1100  res->m[i].data = (void *)save->set;
1101  res->m[i].rtyp = INTVEC_CMD;
1102  JSet = save;
1103  save = save->nx;
1105  }
1106  omFreeBin((ADDRESS)save, indlist_bin);
1107  }
1108  }
1109  else
1110  {
1111  res->Init(0);
1113  }
1114  hKill(radmem, rVar(currRing) - 1);
1115  omFreeSize((ADDRESS)hpure, (1 + (rVar(currRing) * rVar(currRing))) * sizeof(long));
1116  omFreeSize((ADDRESS)hvar, (rVar(currRing) + 1) * sizeof(int));
1117  omFreeSize((ADDRESS)hwork, hNexist * sizeof(scmon));
1119  return res;
1120 }
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:496
int hNexist
Definition: hutil.cc:22
int * varset
Definition: hutil.h:19
int hCo
Definition: hdegree.cc:22
Definition: lists.h:22
scmon * scfmon
Definition: hutil.h:18
#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:583
monf hCreate(int Nvar)
Definition: hutil.cc:1002
int hNvar
Definition: hutil.cc:22
void * ADDRESS
Definition: auxiliary.h:115
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:10
indset ISet
Definition: hdegree.cc:279
Definition: intvec.h:14
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:313
indlist * indset
Definition: hutil.h:31
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:279
int * scmon
Definition: hutil.h:17
int i
Definition: cfEzgcd.cc:123
void hLexR(scfmon rad, int Nrad, varset var, int Nvar)
Definition: hutil.cc:571
INLINE_THIS void Init(int l=0)
#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

§ semicProc()

BOOLEAN semicProc ( leftv  ,
leftv  ,
leftv   
)

Definition at line 4441 of file ipshell.cc.

4442 {
4443  sleftv tmp;
4444  memset(&tmp,0,sizeof(tmp));
4445  tmp.rtyp=INT_CMD;
4446  /* tmp.data = (void *)0; -- done by memset */
4447 
4448  return semicProc3(res,u,v,&tmp);
4449 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:95
BOOLEAN semicProc3(leftv res, leftv u, leftv v, leftv w)
Definition: ipshell.cc:4401
poly res
Definition: myNF.cc:322
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
int rtyp
Definition: subexpr.h:92

§ semicProc3()

BOOLEAN semicProc3 ( leftv  ,
leftv  ,
leftv  ,
leftv   
)

Definition at line 4401 of file ipshell.cc.

4402 {
4403  semicState state;
4404  BOOLEAN qh=(((int)(long)w->Data())==1);
4405 
4406  // -----------------
4407  // check arguments
4408  // -----------------
4409 
4410  lists l1 = (lists)u->Data( );
4411  lists l2 = (lists)v->Data( );
4412 
4413  if( (state=list_is_spectrum( l1 ))!=semicOK )
4414  {
4415  WerrorS( "first argument is not a spectrum" );
4416  list_error( state );
4417  }
4418  else if( (state=list_is_spectrum( l2 ))!=semicOK )
4419  {
4420  WerrorS( "second argument is not a spectrum" );
4421  list_error( state );
4422  }
4423  else
4424  {
4425  spectrum s1= spectrumFromList( l1 );
4426  spectrum s2= spectrumFromList( l2 );
4427 
4428  res->rtyp = INT_CMD;
4429  if (qh)
4430  res->data = (void*)(long)(s1.mult_spectrumh( s2 ));
4431  else
4432  res->data = (void*)(long)(s1.mult_spectrum( s2 ));
4433  }
4434 
4435  // -----------------
4436  // check status
4437  // -----------------
4438 
4439  return (state!=semicOK);
4440 }
Definition: tok.h:95
Definition: lists.h:22
spectrum spectrumFromList(lists l)
Definition: ipshell.cc:3274
void list_error(semicState state)
Definition: ipshell.cc:3358
void WerrorS(const char *s)
Definition: feFopen.cc:24
Definition: semic.h:63
poly res
Definition: myNF.cc:322
semicState list_is_spectrum(lists l)
Definition: ipshell.cc:4143
int mult_spectrumh(spectrum &)
Definition: semic.cc:425
semicState
Definition: ipshell.cc:3324
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:85
int mult_spectrum(spectrum &)
Definition: semic.cc:396

§ setOption()

BOOLEAN setOption ( leftv  res,
leftv  v 
)

Definition at line 575 of file misc_ip.cc.

576 {
577  const char *n;
578  do
579  {
580  if (v->Typ()==STRING_CMD)
581  {
582  n=(const char *)v->CopyD(STRING_CMD);
583  }
584  else
585  {
586  if (v->name==NULL)
587  return TRUE;
588  if (v->rtyp==0)
589  {
590  n=v->name;
591  v->name=NULL;
592  }
593  else
594  {
595  n=omStrDup(v->name);
596  }
597  }
598 
599  int i;
600 
601  if(strcmp(n,"get")==0)
602  {
603  intvec *w=new intvec(2);
604  (*w)[0]=si_opt_1;
605  (*w)[1]=si_opt_2;
606  res->rtyp=INTVEC_CMD;
607  res->data=(void *)w;
608  goto okay;
609  }
610  if(strcmp(n,"set")==0)
611  {
612  if((v->next!=NULL)
613  &&(v->next->Typ()==INTVEC_CMD))
614  {
615  v=v->next;
616  intvec *w=(intvec*)v->Data();
617  si_opt_1=(*w)[0];
618  si_opt_2=(*w)[1];
619 #if 0
623  ) {
625  }
626 #endif
627  goto okay;
628  }
629  }
630  if(strcmp(n,"none")==0)
631  {
632  si_opt_1=0;
633  si_opt_2=0;
634  goto okay;
635  }
636  for (i=0; (i==0) || (optionStruct[i-1].setval!=0); i++)
637  {
638  if (strcmp(n,optionStruct[i].name)==0)
639  {
640  if (optionStruct[i].setval & validOpts)
641  {
643  // optOldStd disables redthrough
644  if (optionStruct[i].setval == Sy_bit(OPT_OLDSTD))
646  }
647  else
648  Warn("cannot set option");
649 #if 0
653  ) {
655  }
656 #endif
657  goto okay;
658  }
659  else if ((strncmp(n,"no",2)==0)
660  && (strcmp(n+2,optionStruct[i].name)==0))
661  {
662  if (optionStruct[i].setval & validOpts)
663  {
665  }
666  else
667  Warn("cannot clear option");
668  goto okay;
669  }
670  }
671  for (i=0; (i==0) || (verboseStruct[i-1].setval!=0); i++)
672  {
673  if (strcmp(n,verboseStruct[i].name)==0)
674  {
676  #ifdef YYDEBUG
677  #if YYDEBUG
678  /*debugging the bison grammar --> grammar.cc*/
679  extern int yydebug;
680  if (BVERBOSE(V_YACC)) yydebug=1;
681  else yydebug=0;
682  #endif
683  #endif
684  goto okay;
685  }
686  else if ((strncmp(n,"no",2)==0)
687  && (strcmp(n+2,verboseStruct[i].name)==0))
688  {
690  #ifdef YYDEBUG
691  #if YYDEBUG
692  /*debugging the bison grammar --> grammar.cc*/
693  extern int yydebug;
694  if (BVERBOSE(V_YACC)) yydebug=1;
695  else yydebug=0;
696  #endif
697  #endif
698  goto okay;
699  }
700  }
701  Werror("unknown option `%s`",n);
702  okay:
703  if (currRing != NULL)
704  currRing->options = si_opt_1 & TEST_RINGDEP_OPTS;
705  omFree((ADDRESS)n);
706  v=v->next;
707  } while (v!=NULL);
708 
709  // set global variable to show memory usage
710  extern int om_sing_opt_show_mem;
711  if (BVERBOSE(V_SHOW_MEM)) om_sing_opt_show_mem = 1;
712  else om_sing_opt_show_mem = 0;
713 
714  return FALSE;
715 }
unsigned si_opt_1
Definition: options.c:5
#define FALSE
Definition: auxiliary.h:94
const struct soptionStruct optionStruct[]
Definition: misc_ip.cc:516
#define OPT_OLDSTD
Definition: options.h:81
#define TRUE
Definition: auxiliary.h:98
void * ADDRESS
Definition: auxiliary.h:115
unsigned setval
Definition: ipid.h:152
unsigned resetval
Definition: ipid.h:153
int Typ()
Definition: subexpr.cc:996
#define Sy_bit(x)
Definition: options.h:30
BITSET validOpts
Definition: kstd1.cc:63
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:540
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:10
#define V_SHOW_MEM
Definition: options.h:41
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
Definition: intvec.h:14
const char * name
Definition: subexpr.h:88
#define omFree(addr)
Definition: omAllocDecl.h:261
int i
Definition: cfEzgcd.cc:123
const struct soptionStruct verboseStruct[]
Definition: misc_ip.cc:546
char name(const Variable &v)
Definition: factory.h:178
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
#define V_YACC
Definition: options.h:42
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
int yydebug
Definition: grammar.cc:1795
const CanonicalForm & w
Definition: facAbsFact.cc:55
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1138
#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:189
void * CopyD(int t)
Definition: subexpr.cc:708
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ showOption()

char* showOption ( )

Definition at line 717 of file misc_ip.cc.

718 {
719  int i;
720  BITSET tmp;
721 
722  StringSetS("//options:");
723  if ((si_opt_1!=0)||(si_opt_2!=0))
724  {
725  tmp=si_opt_1;
726  if(tmp)
727  {
728  for (i=0; optionStruct[i].setval!=0; i++)
729  {
730  if (optionStruct[i].setval & tmp)
731  {
732  StringAppend(" %s",optionStruct[i].name);
733  tmp &=optionStruct[i].resetval;
734  }
735  }
736  for (i=0; i<32; i++)
737  {
738  if (tmp & Sy_bit(i)) StringAppend(" %d",i);
739  }
740  }
741  tmp=si_opt_2;
742  if (tmp)
743  {
744  for (i=0; verboseStruct[i].setval!=0; i++)
745  {
746  if (verboseStruct[i].setval & tmp)
747  {
748  StringAppend(" %s",verboseStruct[i].name);
749  tmp &=verboseStruct[i].resetval;
750  }
751  }
752  for (i=1; i<32; i++)
753  {
754  if (tmp & Sy_bit(i)) StringAppend(" %d",i+32);
755  }
756  }
757  return StringEndS();
758  }
759  StringAppendS(" none");
760  return StringEndS();
761 }
unsigned si_opt_1
Definition: options.c:5
const struct soptionStruct optionStruct[]
Definition: misc_ip.cc:516
unsigned setval
Definition: ipid.h:152
unsigned resetval
Definition: ipid.h:153
char * StringEndS()
Definition: reporter.cc:151
#define BITSET
Definition: structs.h:18
#define Sy_bit(x)
Definition: options.h:30
void StringSetS(const char *st)
Definition: reporter.cc:128
void StringAppendS(const char *st)
Definition: reporter.cc:107
#define StringAppend
Definition: emacs.cc:82
int i
Definition: cfEzgcd.cc:123
const struct soptionStruct verboseStruct[]
Definition: misc_ip.cc:546
char name(const Variable &v)
Definition: factory.h:178
unsigned si_opt_2
Definition: options.c:6

§ singular_example()

void singular_example ( char *  str)

Definition at line 439 of file misc_ip.cc.

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

§ singular_system()

leftv singular_system ( sleftv  h)

§ spaddProc()

BOOLEAN spaddProc ( leftv  ,
leftv  ,
leftv   
)

Definition at line 4318 of file ipshell.cc.

4319 {
4320  semicState state;
4321 
4322  // -----------------
4323  // check arguments
4324  // -----------------
4325 
4326  lists l1 = (lists)first->Data( );
4327  lists l2 = (lists)second->Data( );
4328 
4329  if( (state=list_is_spectrum( l1 )) != semicOK )
4330  {
4331  WerrorS( "first argument is not a spectrum:" );
4332  list_error( state );
4333  }
4334  else if( (state=list_is_spectrum( l2 )) != semicOK )
4335  {
4336  WerrorS( "second argument is not a spectrum:" );
4337  list_error( state );
4338  }
4339  else
4340  {
4341  spectrum s1= spectrumFromList ( l1 );
4342  spectrum s2= spectrumFromList ( l2 );
4343  spectrum sum( s1+s2 );
4344 
4345  result->rtyp = LIST_CMD;
4346  result->data = (char*)(getList(sum));
4347  }
4348 
4349  return (state!=semicOK);
4350 }
Definition: lists.h:22
spectrum spectrumFromList(lists l)
Definition: ipshell.cc:3274
void list_error(semicState state)
Definition: ipshell.cc:3358
void WerrorS(const char *s)
Definition: feFopen.cc:24
Definition: semic.h:63
lists getList(spectrum &spec)
Definition: ipshell.cc:3286
semicState list_is_spectrum(lists l)
Definition: ipshell.cc:4143
semicState
Definition: ipshell.cc:3324
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:117
return result
Definition: facAbsBiFact.cc:76

§ spectrumfProc()

BOOLEAN spectrumfProc ( leftv  ,
leftv   
)

Definition at line 4074 of file ipshell.cc.

4075 {
4076  spectrumState state = spectrumOK;
4077 
4078  // -------------------
4079  // check consistency
4080  // -------------------
4081 
4082  // check for a local polynomial ring
4083 
4084  if( currRing->OrdSgn != -1 )
4085  // ?? HS: the test above is also true for k[x][[y]], k[[x]][y]
4086  // or should we use:
4087  //if( !ringIsLocal( ) )
4088  {
4089  WerrorS( "only works for local orderings" );
4090  state = spectrumWrongRing;
4091  }
4092  else if( currRing->qideal != NULL )
4093  {
4094  WerrorS( "does not work in quotient rings" );
4095  state = spectrumWrongRing;
4096  }
4097  else
4098  {
4099  lists L = (lists)NULL;
4100  int flag = 2; // symmetric optimization
4101 
4102  state = spectrumCompute( (poly)first->Data( ),&L,flag );
4103 
4104  if( state==spectrumOK )
4105  {
4106  result->rtyp = LIST_CMD;
4107  result->data = (char*)L;
4108  }
4109  else
4110  {
4111  spectrumPrintError(state);
4112  }
4113  }
4114 
4115  return (state!=spectrumOK);
4116 }
spectrumState
Definition: ipshell.cc:3440
Definition: lists.h:22
void WerrorS(const char *s)
Definition: feFopen.cc:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void spectrumPrintError(spectrumState state)
Definition: ipshell.cc:3992
spectrumState spectrumCompute(poly h, lists *L, int fast)
Definition: ipshell.cc:3700
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:117
polyrec * poly
Definition: hilb.h:10
return result
Definition: facAbsBiFact.cc:76

§ spectrumProc()

BOOLEAN spectrumProc ( leftv  ,
leftv   
)

Definition at line 4023 of file ipshell.cc.

4024 {
4025  spectrumState state = spectrumOK;
4026 
4027  // -------------------
4028  // check consistency
4029  // -------------------
4030 
4031  // check for a local ring
4032 
4033  if( !ringIsLocal(currRing ) )
4034  {
4035  WerrorS( "only works for local orderings" );
4036  state = spectrumWrongRing;
4037  }
4038 
4039  // no quotient rings are allowed
4040 
4041  else if( currRing->qideal != NULL )
4042  {
4043  WerrorS( "does not work in quotient rings" );
4044  state = spectrumWrongRing;
4045  }
4046  else
4047  {
4048  lists L = (lists)NULL;
4049  int flag = 1; // weight corner optimization is safe
4050 
4051  state = spectrumCompute( (poly)first->Data( ),&L,flag );
4052 
4053  if( state==spectrumOK )
4054  {
4055  result->rtyp = LIST_CMD;
4056  result->data = (char*)L;
4057  }
4058  else
4059  {
4060  spectrumPrintError(state);
4061  }
4062  }
4063 
4064  return (state!=spectrumOK);
4065 }
spectrumState
Definition: ipshell.cc:3440
Definition: lists.h:22
void WerrorS(const char *s)
Definition: feFopen.cc:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void spectrumPrintError(spectrumState state)
Definition: ipshell.cc:3992
spectrumState spectrumCompute(poly h, lists *L, int fast)
Definition: ipshell.cc:3700
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:117
BOOLEAN ringIsLocal(const ring r)
Definition: spectrum.cc:461
polyrec * poly
Definition: hilb.h:10
return result
Definition: facAbsBiFact.cc:76

§ spmulProc()

BOOLEAN spmulProc ( leftv  ,
leftv  ,
leftv   
)

Definition at line 4360 of file ipshell.cc.

4361 {
4362  semicState state;
4363 
4364  // -----------------
4365  // check arguments
4366  // -----------------
4367 
4368  lists l = (lists)first->Data( );
4369  int k = (int)(long)second->Data( );
4370 
4371  if( (state=list_is_spectrum( l ))!=semicOK )
4372  {
4373  WerrorS( "first argument is not a spectrum" );
4374  list_error( state );
4375  }
4376  else if( k < 0 )
4377  {
4378  WerrorS( "second argument should be positive" );
4379  state = semicMulNegative;
4380  }
4381  else
4382  {
4383  spectrum s= spectrumFromList( l );
4384  spectrum product( k*s );
4385 
4386  result->rtyp = LIST_CMD;
4387  result->data = (char*)getList(product);
4388  }
4389 
4390  return (state!=semicOK);
4391 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
Definition: lists.h:22
spectrum spectrumFromList(lists l)
Definition: ipshell.cc:3274
void list_error(semicState state)
Definition: ipshell.cc:3358
void WerrorS(const char *s)
Definition: feFopen.cc:24
int k
Definition: cfEzgcd.cc:93
Definition: semic.h:63
lists getList(spectrum &spec)
Definition: ipshell.cc:3286
semicState list_is_spectrum(lists l)
Definition: ipshell.cc:4143
semicState
Definition: ipshell.cc:3324
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:117
return result
Definition: facAbsBiFact.cc:76
int l
Definition: cfEzgcd.cc:94

§ syBetti1()

BOOLEAN syBetti1 ( leftv  res,
leftv  u 
)

Definition at line 3061 of file ipshell.cc.

3062 {
3063  sleftv tmp;
3064  memset(&tmp,0,sizeof(tmp));
3065  tmp.rtyp=INT_CMD;
3066  tmp.data=(void *)1;
3067  return syBetti2(res,u,&tmp);
3068 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:95
void * data
Definition: subexpr.h:89
BOOLEAN syBetti2(leftv res, leftv u, leftv w)
Definition: ipshell.cc:3038
int rtyp
Definition: subexpr.h:92

§ syBetti2()

BOOLEAN syBetti2 ( leftv  res,
leftv  u,
leftv  w 
)

Definition at line 3038 of file ipshell.cc.

3039 {
3040  syStrategy syzstr=(syStrategy)u->Data();
3041 
3042  BOOLEAN minim=(int)(long)w->Data();
3043  int row_shift=0;
3044  int add_row_shift=0;
3045  intvec *weights=NULL;
3046  intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3047  if (ww!=NULL)
3048  {
3049  weights=ivCopy(ww);
3050  add_row_shift = ww->min_in();
3051  (*weights) -= add_row_shift;
3052  }
3053 
3054  res->data=(void *)syBettiOfComputation(syzstr,minim,&row_shift,weights);
3055  //row_shift += add_row_shift;
3056  //Print("row_shift=%d, add_row_shift=%d\n",row_shift,add_row_shift);
3057  atSet(res,omStrDup("rowShift"),(void*)(long)add_row_shift,INT_CMD);
3058 
3059  return FALSE;
3060 }
void atSet(idhdl root, const char *name, void *data, int typ)
Definition: attrib.cc:156
Definition: tok.h:95
#define FALSE
Definition: auxiliary.h:94
intvec * ivCopy(const intvec *o)
Definition: intvec.h:126
int min_in()
Definition: intvec.h:113
void * data
Definition: subexpr.h:89
Definition: intvec.h:14
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:1763
void * Data()
Definition: subexpr.cc:1138
int BOOLEAN
Definition: auxiliary.h:85
ssyStrategy * syStrategy
Definition: syz.h:35
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ syConvList()

syStrategy syConvList ( lists  li)

Definition at line 3146 of file ipshell.cc.

3147 {
3148  int typ0;
3150 
3151  resolvente fr = liFindRes(li,&(result->length),&typ0,&(result->weights));
3152  if (fr != NULL)
3153  {
3154 
3155  result->fullres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
3156  for (int i=result->length-1;i>=0;i--)
3157  {
3158  if (fr[i]!=NULL)
3159  result->fullres[i] = idCopy(fr[i]);
3160  }
3161  result->list_length=result->length;
3162  omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
3163  }
3164  else
3165  {
3166  omFreeSize(result, sizeof(ssyStrategy));
3167  result = NULL;
3168  }
3169  return result;
3170 }
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:312
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:115
int i
Definition: cfEzgcd.cc:123
resolvente fullres
Definition: syz.h:57
ideal idCopy(ideal A)
Definition: ideals.h:60
#define NULL
Definition: omList.c:10
short list_length
Definition: syz.h:62
ideal * resolvente
Definition: ideals.h:18
#define omAlloc0(size)
Definition: omAllocDecl.h:211
return result
Definition: facAbsBiFact.cc:76
ssyStrategy * syStrategy
Definition: syz.h:35

§ syConvRes()

lists syConvRes ( syStrategy  syzstr,
BOOLEAN  toDel = FALSE,
int  add_row_shift = 0 
)

Definition at line 3073 of file ipshell.cc.

3074 {
3075  resolvente fullres = syzstr->fullres;
3076  resolvente minres = syzstr->minres;
3077 
3078  const int length = syzstr->length;
3079 
3080  if ((fullres==NULL) && (minres==NULL))
3081  {
3082  if (syzstr->hilb_coeffs==NULL)
3083  { // La Scala
3084  fullres = syReorder(syzstr->res, length, syzstr);
3085  }
3086  else
3087  { // HRES
3088  minres = syReorder(syzstr->orderedRes, length, syzstr);
3089  syKillEmptyEntres(minres, length);
3090  }
3091  }
3092 
3093  resolvente tr;
3094  int typ0=IDEAL_CMD;
3095 
3096  if (minres!=NULL)
3097  tr = minres;
3098  else
3099  tr = fullres;
3100 
3101  resolvente trueres=NULL; intvec ** w=NULL;
3102 
3103  if (length>0)
3104  {
3105  trueres = (resolvente)omAlloc0((length)*sizeof(ideal));
3106  for (int i=(length)-1;i>=0;i--)
3107  {
3108  if (tr[i]!=NULL)
3109  {
3110  trueres[i] = idCopy(tr[i]);
3111  }
3112  }
3113  if ( id_RankFreeModule(trueres[0], currRing) > 0)
3114  typ0 = MODUL_CMD;
3115  if (syzstr->weights!=NULL)
3116  {
3117  w = (intvec**)omAlloc0(length*sizeof(intvec*));
3118  for (int i=length-1;i>=0;i--)
3119  {
3120  if (syzstr->weights[i]!=NULL) w[i] = ivCopy(syzstr->weights[i]);
3121  }
3122  }
3123  }
3124 
3125  lists li = liMakeResolv(trueres, length, syzstr->list_length,typ0,
3126  w, add_row_shift);
3127 
3128  if (w != NULL) omFreeSize(w, length*sizeof(intvec*));
3129 
3130  if (toDel)
3131  syKillComputation(syzstr);
3132  else
3133  {
3134  if( fullres != NULL && syzstr->fullres == NULL )
3135  syzstr->fullres = fullres;
3136 
3137  if( minres != NULL && syzstr->minres == NULL )
3138  syzstr->minres = minres;
3139  }
3140  return li;
3141 }
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:1649
Definition: lists.h:22
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
intvec * ivCopy(const intvec *o)
Definition: intvec.h:126
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:10
resolvente orderedRes
Definition: syz.h:48
Definition: intvec.h:14
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
int i
Definition: cfEzgcd.cc:123
resolvente fullres
Definition: syz.h:57
ideal idCopy(ideal A)
Definition: ideals.h:60
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:215
const CanonicalForm & w
Definition: facAbsFact.cc:55
short list_length
Definition: syz.h:62
ideal * resolvente
Definition: ideals.h:18
void syKillEmptyEntres(resolvente res, int length)
Definition: syz1.cc:2208
void syKillComputation(syStrategy syzstr, ring r=currRing)
Definition: syz1.cc:1503
#define omAlloc0(size)
Definition: omAllocDecl.h:211

§ syForceMin()

syStrategy syForceMin ( lists  li)

Definition at line 3175 of file ipshell.cc.

3176 {
3177  int typ0;
3179 
3180  resolvente fr = liFindRes(li,&(result->length),&typ0);
3181  result->minres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
3182  for (int i=result->length-1;i>=0;i--)
3183  {
3184  if (fr[i]!=NULL)
3185  result->minres[i] = idCopy(fr[i]);
3186  }
3187  omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
3188  return result;
3189 }
int length
Definition: syz.h:60
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
Definition: lists.cc:312
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:115
int i
Definition: cfEzgcd.cc:123
ideal idCopy(ideal A)
Definition: ideals.h:60
resolvente minres
Definition: syz.h:58
#define NULL
Definition: omList.c:10
ideal * resolvente
Definition: ideals.h:18
#define omAlloc0(size)
Definition: omAllocDecl.h:211
return result
Definition: facAbsBiFact.cc:76
ssyStrategy * syStrategy
Definition: syz.h:35

§ test_cmd()

void test_cmd ( int  i)

Definition at line 506 of file ipshell.cc.

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

§ Tok2Cmdname()

const char* Tok2Cmdname ( int  i)

Definition at line 132 of file gentable.cc.

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

§ type_cmd()

void type_cmd ( leftv  v)

Definition at line 246 of file ipshell.cc.

247 {
248  BOOLEAN oldShortOut = FALSE;
249 
250  if (currRing != NULL)
251  {
252  oldShortOut = currRing->ShortOut;
253  currRing->ShortOut = 1;
254  }
255  int t=v->Typ();
256  Print("// %s %s ",v->Name(),Tok2Cmdname(t));
257  switch (t)
258  {
259  case MAP_CMD:Print(" from %s\n",((map)(v->Data()))->preimage); break;
260  case INTMAT_CMD: Print(" %d x %d\n",((intvec*)(v->Data()))->rows(),
261  ((intvec*)(v->Data()))->cols()); break;
262  case MATRIX_CMD:Print(" %u x %u\n" ,
263  MATROWS((matrix)(v->Data())),
264  MATCOLS((matrix)(v->Data())));break;
265  case MODUL_CMD: Print(", rk %d\n", (int)(((ideal)(v->Data()))->rank));break;
266  case LIST_CMD: Print(", size %d\n",((lists)(v->Data()))->nr+1); break;
267 
268  case PROC_CMD:
269  case RING_CMD:
270  case IDEAL_CMD: PrintLn(); break;
271 
272  //case INT_CMD:
273  //case STRING_CMD:
274  //case INTVEC_CMD:
275  //case POLY_CMD:
276  //case VECTOR_CMD:
277  //case PACKAGE_CMD:
278 
279  default:
280  break;
281  }
282  v->Print();
283  if (currRing != NULL)
284  currRing->ShortOut = oldShortOut;
285 }
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:310
#define Print
Definition: emacs.cc:83
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:94
int Typ()
Definition: subexpr.cc:996
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:10
Definition: intvec.h:14
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:132
void * Data()
Definition: subexpr.cc:1138
Definition: tok.h:117
#define MATROWS(i)
Definition: matpol.h:27
int BOOLEAN
Definition: auxiliary.h:85

§ versionString()

char* versionString ( )

Definition at line 778 of file misc_ip.cc.

779 {
780  StringSetS("");
781  StringAppend("Singular for %s version %s (%d, %d bit) %s #%s",
782  S_UNAME, VERSION, // SINGULAR_VERSION,
783  SINGULAR_VERSION, sizeof(void*)*8,
784 #ifdef MAKE_DISTRIBUTION
785  VERSION_DATE, GIT_VERSION);
786 #else
787  singular_date, GIT_VERSION);
788 #endif
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 }
#define OM_CHECK
Definition: omalloc_debug.c:15
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
Definition: feread.cc:33
void feStringAppendResources(int warn)
Definition: reporter.cc:398
const BOOLEAN p_procs_dynamic
#define SINGULAR_VERSION
Definition: mod2.h:86
char * fe_fgets(const char *pr, char *s, int size)
Definition: feread.cc:310
char * fe_fgets_dummy(const char *, char *, int)
Definition: feread.cc:450
int siRandomStart
Definition: cntrlc.cc:102
char * StringEndS()
Definition: reporter.cc:151
#define MAKE_DISTRIBUTION
Definition: distrib.h:1
void feStringAppendBrowsers(int warn)
Definition: fehelp.cc:352
#define MDEBUG
Definition: mod2.h:185
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
SI_FOREACH_BUILTIN(SI_GET_BUILTIN_MOD_INIT0) }
#define StringAppend
Definition: emacs.cc:82
#define version
Definition: libparse.cc:1260
#define OM_TRACK
Definition: omalloc_debug.c:10
#define VERSION
Definition: mod2.h:16
#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

§ currid

const char* currid

Definition at line 171 of file grammar.cc.

§ dArith1

struct sValCmd1 dArith1[]

Definition at line 19 of file table.h.

§ dArith2

struct sValCmd2 dArith2[]

Definition at line 292 of file table.h.

§ dArith3

struct sValCmd3 dArith3[]

Definition at line 715 of file table.h.

§ dArithM

struct sValCmdM dArithM[]

Definition at line 825 of file table.h.

§ iiCurrArgs

leftv iiCurrArgs

Definition at line 78 of file ipshell.cc.

§ iiCurrProc

idhdl iiCurrProc

Definition at line 79 of file ipshell.cc.

§ iiLocalRing

ring* iiLocalRing

Definition at line 470 of file iplib.cc.

§ iiOp

int iiOp

Definition at line 225 of file iparith.cc.

§ iiRETURNEXPR

sleftv iiRETURNEXPR

Definition at line 471 of file iplib.cc.

§ iiRETURNEXPR_len

int iiRETURNEXPR_len

Definition at line 472 of file iplib.cc.

§ lastreserved

const char* lastreserved

Definition at line 80 of file ipshell.cc.

§ myynest

int myynest

Definition at line 46 of file febase.cc.

§ printlevel

int printlevel

Definition at line 42 of file febase.cc.

§ si_echo

int si_echo

Definition at line 41 of file febase.cc.

§ yyInRingConstruction

BOOLEAN yyInRingConstruction

Definition at line 172 of file grammar.cc.