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 66 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 57 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 74 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 84 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 92 of file gentable.cc.

Data Fields
short arg
int p
proc1 p
short res

§ sValAssign

struct sValAssign

Definition at line 99 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 546 of file ipshell.cc.

547 {
548  int rc = 0;
549  while (v!=NULL)
550  {
551  switch (v->Typ())
552  {
553  case INT_CMD:
554  case POLY_CMD:
555  case VECTOR_CMD:
556  case NUMBER_CMD:
557  rc++;
558  break;
559  case INTVEC_CMD:
560  case INTMAT_CMD:
561  rc += ((intvec *)(v->Data()))->length();
562  break;
563  case MATRIX_CMD:
564  case IDEAL_CMD:
565  case MODUL_CMD:
566  {
567  matrix mm = (matrix)(v->Data());
568  rc += mm->rows() * mm->cols();
569  }
570  break;
571  case LIST_CMD:
572  rc+=((lists)v->Data())->nr+1;
573  break;
574  default:
575  rc++;
576  }
577  v = v->next;
578  }
579  return rc;
580 }
int & rows()
Definition: matpol.h:24
Definition: tok.h:94
int Typ()
Definition: subexpr.cc:979
Definition: intvec.h:14
ip_smatrix * matrix
Definition: tok.h:99
leftv next
Definition: subexpr.h:88
int & cols()
Definition: matpol.h:25
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
void * Data()
Definition: subexpr.cc:1121
Definition: tok.h:116

§ iiAddCproc()

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

Definition at line 908 of file iplib.cc.

910 {
911  procinfov pi;
912  idhdl h;
913 
914  #ifndef SING_NDEBUG
915  int dummy;
916  if (IsCmd(procname,dummy))
917  {
918  Werror(">>%s< is a reserved name",procname);
919  return 0;
920  }
921  #endif
922 
923  h = enterid(procname,0, PROC_CMD, &IDROOT, TRUE);
924  if ( h!= NULL )
925  {
926  pi = IDPROC(h);
927  pi->libname = omStrDup(libname);
928  pi->procname = omStrDup(procname);
929  pi->language = LANG_C;
930  pi->ref = 1;
931  pi->is_static = pstatic;
932  pi->data.o.function = func;
933  return(1);
934  }
935  else
936  {
937  PrintS("iiAddCproc: failed.\n");
938  }
939  return(0);
940 }
language_defs language
Definition: subexpr.h:59
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:101
short ref
Definition: subexpr.h:60
Definition: idrec.h:34
char * procname
Definition: subexpr.h:57
Definition: subexpr.h:21
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:259
char * libname
Definition: subexpr.h:56
procinfodata data
Definition: subexpr.h:63
void PrintS(const char *s)
Definition: reporter.cc:284
char is_static
Definition: subexpr.h:61
#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
void Werror(const char *fmt,...)
Definition: reporter.cc:189
int IsCmd(const char *n, int &tok)
Definition: iparith.cc:8830
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ iiAlias()

BOOLEAN iiAlias ( leftv  p)

Definition at line 743 of file ipid.cc.

744 {
745  if (iiCurrArgs==NULL)
746  {
747  Werror("not enough arguments for proc %s",VoiceName());
748  p->CleanUp();
749  return TRUE;
750  }
752  iiCurrArgs=h->next;
753  h->next=NULL;
754  if (h->rtyp!=IDHDL)
755  {
756  BOOLEAN res=iiAssign(p,h);
757  h->CleanUp();
759  return res;
760  }
761  if ((h->Typ()!=p->Typ()) &&(p->Typ()!=DEF_CMD))
762  {
763  WerrorS("type mismatch");
764  return TRUE;
765  }
766  idhdl pp=(idhdl)p->data;
767  switch(pp->typ)
768  {
769 #ifdef SINGULAR_4_1
770  case CRING_CMD:
771  nKillChar((coeffs)pp);
772  break;
773 #endif
774  case DEF_CMD:
775  case INT_CMD:
776  break;
777  case INTVEC_CMD:
778  case INTMAT_CMD:
779  delete IDINTVEC(pp);
780  break;
781  case NUMBER_CMD:
782  nDelete(&IDNUMBER(pp));
783  break;
784  case BIGINT_CMD:
786  break;
787  case MAP_CMD:
788  {
789  map im = IDMAP(pp);
790  omFree((ADDRESS)im->preimage);
791  }
792  // continue as ideal:
793  case IDEAL_CMD:
794  case MODUL_CMD:
795  case MATRIX_CMD:
796  idDelete(&IDIDEAL(pp));
797  break;
798  case PROC_CMD:
799  case RESOLUTION_CMD:
800  case STRING_CMD:
801  omFree((ADDRESS)IDSTRING(pp));
802  break;
803  case LIST_CMD:
804  IDLIST(pp)->Clean();
805  break;
806  case LINK_CMD:
808  break;
809  // case ring: cannot happen
810  default:
811  Werror("unknown type %d",p->Typ());
812  return TRUE;
813  }
814  pp->typ=ALIAS_CMD;
815  IDDATA(pp)=(char*)h->data;
816  int eff_typ=h->Typ();
817  if ((RingDependend(eff_typ))
818  || ((eff_typ==LIST_CMD) && (lRingDependend((lists)h->Data()))))
819  {
820  ipSwapId(pp,IDROOT,currRing->idroot);
821  }
822  h->CleanUp();
824  return FALSE;
825 }
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:84
Definition: tok.h:94
#define IDLINK(a)
Definition: ipid.h:135
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
Definition: lists.h:22
#define IDINTVEC(a)
Definition: ipid.h:125
#define FALSE
Definition: auxiliary.h:97
Definition: tok.h:38
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:101
#define IDIDEAL(a)
Definition: ipid.h:130
void * ADDRESS
Definition: auxiliary.h:118
void WerrorS(const char *s)
Definition: feFopen.cc:24
coeffs coeffs_BIGINT
Definition: ipid.cc:54
int Typ()
Definition: subexpr.cc:979
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
poly pp
Definition: myNF.cc:296
void * data
Definition: subexpr.h:90
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:55
Definition: tok.h:57
#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
Definition: tok.h:99
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:88
#define IDNUMBER(a)
Definition: ipid.h:129
Definition: tok.h:34
Definition: tok.h:115
#define NULL
Definition: omList.c:10
leftv iiCurrArgs
Definition: ipshell.cc:78
int rtyp
Definition: subexpr.h:93
void CleanUp(ring r=currRing)
Definition: subexpr.cc:320
void * Data()
Definition: subexpr.cc:1121
int typ
Definition: idrec.h:43
Definition: tok.h:116
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:88
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
Definition: ipid.cc:579
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:490
void Werror(const char *fmt,...)
Definition: reporter.cc:189
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1780

§ 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:57
char * libname
Definition: subexpr.h:56
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:93
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:320
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:88
#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 6319 of file ipshell.cc.

6320 {
6321  memset(res,0,sizeof(sleftv));
6322  res->rtyp=a->Typ();
6323  switch (res->rtyp /*a->Typ()*/)
6324  {
6325  case INTVEC_CMD:
6326  case INTMAT_CMD:
6327  return iiApplyINTVEC(res,a,op,proc);
6328  case BIGINTMAT_CMD:
6329  return iiApplyBIGINTMAT(res,a,op,proc);
6330  case IDEAL_CMD:
6331  case MODUL_CMD:
6332  case MATRIX_CMD:
6333  return iiApplyIDEAL(res,a,op,proc);
6334  case LIST_CMD:
6335  return iiApplyLIST(res,a,op,proc);
6336  }
6337  WerrorS("first argument to `apply` must allow an index");
6338  return TRUE;
6339 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
#define TRUE
Definition: auxiliary.h:101
void WerrorS(const char *s)
Definition: feFopen.cc:24
int Typ()
Definition: subexpr.cc:979
BOOLEAN iiApplyBIGINTMAT(leftv, leftv, int, leftv)
Definition: ipshell.cc:6277
BOOLEAN iiApplyLIST(leftv res, leftv a, int op, leftv proc)
Definition: ipshell.cc:6287
BOOLEAN iiApplyIDEAL(leftv, leftv, int, leftv)
Definition: ipshell.cc:6282
Definition: tok.h:99
int rtyp
Definition: subexpr.h:93
Definition: tok.h:116
BOOLEAN iiApplyINTVEC(leftv res, leftv a, int op, leftv proc)
Definition: ipshell.cc:6245

§ iiARROW()

BOOLEAN iiARROW ( leftv  ,
char *  ,
char *   
)

Definition at line 6368 of file ipshell.cc.

6369 {
6370  char *ss=(char*)omAlloc(strlen(a)+strlen(s)+30); /* max. 27 currently */
6371  // find end of s:
6372  int end_s=strlen(s);
6373  while ((end_s>0) && ((s[end_s]<=' ')||(s[end_s]==';'))) end_s--;
6374  s[end_s+1]='\0';
6375  char *name=(char *)omAlloc(strlen(a)+strlen(s)+30);
6376  sprintf(name,"%s->%s",a,s);
6377  // find start of last expression
6378  int start_s=end_s-1;
6379  while ((start_s>=0) && (s[start_s]!=';')) start_s--;
6380  if (start_s<0) // ';' not found
6381  {
6382  sprintf(ss,"parameter def %s;return(%s);\n",a,s);
6383  }
6384  else // s[start_s] is ';'
6385  {
6386  s[start_s]='\0';
6387  sprintf(ss,"parameter def %s;%s;return(%s);\n",a,s,s+start_s+1);
6388  }
6389  memset(r,0,sizeof(*r));
6390  // now produce procinfo for PROC_CMD:
6391  r->data = (void *)omAlloc0Bin(procinfo_bin);
6392  ((procinfo *)(r->data))->language=LANG_NONE;
6393  iiInitSingularProcinfo((procinfo *)r->data,"",name,0,0);
6394  ((procinfo *)r->data)->data.s.body=ss;
6395  omFree(name);
6396  r->rtyp=PROC_CMD;
6397  //r->rtyp=STRING_CMD;
6398  //r->data=ss;
6399  return FALSE;
6400 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
const poly a
Definition: syzextra.cc:212
procinfo * iiInitSingularProcinfo(procinfov pi, const char *libname, const char *procname, int line, long pos, BOOLEAN pstatic)
Definition: iplib.cc:883
#define FALSE
Definition: auxiliary.h:97
#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 1780 of file ipassign.cc.

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

6403 {
6404  char* ring_name=omStrDup((char*)r->Name());
6405  int t=arg->Typ();
6406  if (t==RING_CMD)
6407  {
6408  sleftv tmp;
6409  memset(&tmp,0,sizeof(tmp));
6410  tmp.rtyp=IDHDL;
6411  tmp.data=(char*)rDefault(ring_name);
6412  if (tmp.data!=NULL)
6413  {
6414  BOOLEAN b=iiAssign(&tmp,arg);
6415  if (b) return TRUE;
6416  rSetHdl(ggetid(ring_name));
6417  omFree(ring_name);
6418  return FALSE;
6419  }
6420  else
6421  return TRUE;
6422  }
6423  #ifdef SINGULAR_4_1
6424  else if (t==CRING_CMD)
6425  {
6426  sleftv tmp;
6427  sleftv n;
6428  memset(&n,0,sizeof(n));
6429  n.name=ring_name;
6430  if (iiDeclCommand(&tmp,&n,myynest,CRING_CMD,&IDROOT)) return TRUE;
6431  if (iiAssign(&tmp,arg)) return TRUE;
6432  //Print("create %s\n",r->Name());
6433  //Print("from %s(%d)\n",Tok2Cmdname(arg->Typ()),arg->Typ());
6434  return FALSE;
6435  }
6436  #endif
6437  //Print("create %s\n",r->Name());
6438  //Print("from %s(%d)\n",Tok2Cmdname(arg->Typ()),arg->Typ());
6439  return TRUE;// not handled -> error for now
6440 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
#define FALSE
Definition: auxiliary.h:97
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:101
#define IDHDL
Definition: tok.h:31
idhdl rDefault(const char *s)
Definition: ipshell.cc:1523
void * data
Definition: subexpr.h:90
int myynest
Definition: febase.cc:46
Definition: tok.h:55
const ring r
Definition: syzextra.cc:208
const char * name
Definition: subexpr.h:89
#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:1124
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:93
void rSetHdl(idhdl h)
Definition: ipshell.cc:5017
int BOOLEAN
Definition: auxiliary.h:88
const poly b
Definition: syzextra.cc:213
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)
Definition: ipid.cc:490
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1780
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ iiBranchTo()

BOOLEAN iiBranchTo ( leftv  r,
leftv  args 
)

Definition at line 1181 of file ipshell.cc.

1182 {
1183  // <string1...stringN>,<proc>
1184  // known: args!=NULL, l>=1
1185  int l=args->listLength();
1186  int ll=0;
1187  if (iiCurrArgs!=NULL) ll=iiCurrArgs->listLength();
1188  if (ll!=(l-1)) return FALSE;
1189  leftv h=args;
1190  short *t=(short*)omAlloc(l*sizeof(short));
1191  t[0]=l-1;
1192  int b;
1193  int i;
1194  for(i=1;i<l;i++,h=h->next)
1195  {
1196  if (h->Typ()!=STRING_CMD)
1197  {
1198  omFree(t);
1199  Werror("arg %d is not a string",i);
1200  return TRUE;
1201  }
1202  int tt;
1203  b=IsCmd((char *)h->Data(),tt);
1204  if(b) t[i]=tt;
1205  else
1206  {
1207  omFree(t);
1208  Werror("arg %d is not a type name",i);
1209  return TRUE;
1210  }
1211  }
1212  if (h->Typ()!=PROC_CMD)
1213  {
1214  omFree(t);
1215  Werror("last arg (%d) is not a proc",i);
1216  return TRUE;
1217  }
1218  b=iiCheckTypes(iiCurrArgs,t,0);
1219  omFree(t);
1220  if (b && (h->rtyp==IDHDL) && (h->e==NULL))
1221  {
1222  BOOLEAN err;
1223  //Print("branchTo: %s\n",h->Name());
1224  iiCurrProc=(idhdl)h->data;
1226  if( pi->data.s.body==NULL )
1227  {
1229  if (pi->data.s.body==NULL) return TRUE;
1230  }
1231  if ((pi->pack!=NULL)&&(currPack!=pi->pack))
1232  {
1233  currPack=pi->pack;
1236  //Print("set pack=%s\n",IDID(currPackHdl));
1237  }
1238  err=iiAllStart(pi,pi->data.s.body,BT_proc,pi->data.s.body_lineno-(iiCurrArgs==NULL));
1240  if (iiCurrArgs!=NULL)
1241  {
1242  if (!err) Warn("too many arguments for %s",IDID(iiCurrProc));
1243  iiCurrArgs->CleanUp();
1245  iiCurrArgs=NULL;
1246  }
1247  return 2-err;
1248  }
1249  return FALSE;
1250 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
idhdl currPackHdl
Definition: ipid.cc:61
#define IDID(a)
Definition: ipid.h:119
#define FALSE
Definition: auxiliary.h:97
int listLength()
Definition: subexpr.cc:61
#define TRUE
Definition: auxiliary.h:101
void * ADDRESS
Definition: auxiliary.h:118
#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:88
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:6460
package currPack
Definition: ipid.cc:63
leftv iiCurrArgs
Definition: ipshell.cc:78
void CleanUp(ring r=currRing)
Definition: subexpr.cc:320
idhdl packFindHdl(package r)
Definition: ipid.cc:730
void iiCheckPack(package &p)
Definition: ipshell.cc:1509
#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:88
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:8830
#define Warn
Definition: emacs.cc:80

§ iiCheckPack()

void iiCheckPack ( package p)

Definition at line 1509 of file ipshell.cc.

1510 {
1511  if (p!=basePack)
1512  {
1513  idhdl t=basePack->idroot;
1514  while ((t!=NULL) && (IDTYP(t)!=PACKAGE_CMD) && (IDPACKAGE(t)!=p)) t=t->next;
1515  if (t==NULL)
1516  {
1517  WarnS("package not found\n");
1518  p=basePack;
1519  }
1520  }
1521 }
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 1465 of file ipshell.cc.

1466 {
1467  if (currRing==NULL)
1468  {
1469  #ifdef SIQ
1470  if (siq<=0)
1471  {
1472  #endif
1473  if (RingDependend(i))
1474  {
1475  WerrorS("no ring active");
1476  return TRUE;
1477  }
1478  #ifdef SIQ
1479  }
1480  #endif
1481  }
1482  return FALSE;
1483 }
#define FALSE
Definition: auxiliary.h:97
BOOLEAN siq
Definition: subexpr.cc:58
#define TRUE
Definition: auxiliary.h:101
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 6460 of file ipshell.cc.

6461 {
6462  if (args==NULL)
6463  {
6464  if (type_list[0]==0) return TRUE;
6465  else
6466  {
6467  if (report) WerrorS("no arguments expected");
6468  return FALSE;
6469  }
6470  }
6471  int l=args->listLength();
6472  if (l!=(int)type_list[0])
6473  {
6474  if (report) iiReportTypes(0,l,type_list);
6475  return FALSE;
6476  }
6477  for(int i=1;i<=l;i++,args=args->next)
6478  {
6479  short t=type_list[i];
6480  if (t!=ANY_TYPE)
6481  {
6482  if (((t==IDHDL)&&(args->rtyp!=IDHDL))
6483  || (t!=args->Typ()))
6484  {
6485  if (report) iiReportTypes(i,args->Typ(),type_list);
6486  return FALSE;
6487  }
6488  }
6489  }
6490  return TRUE;
6491 }
#define ANY_TYPE
Definition: tok.h:30
#define FALSE
Definition: auxiliary.h:97
int listLength()
Definition: subexpr.cc:61
#define TRUE
Definition: auxiliary.h:101
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:6442
int i
Definition: cfEzgcd.cc:123
leftv next
Definition: subexpr.h:88
#define NULL
Definition: omList.c:10
int l
Definition: cfEzgcd.cc:94

§ iiConvName()

char* iiConvName ( const char *  libname)

Definition at line 1184 of file iplib.cc.

1185 {
1186  char *tmpname = omStrDup(libname);
1187  char *p = strrchr(tmpname, DIR_SEP);
1188  char *r;
1189  if(p==NULL) p = tmpname;
1190  else p++;
1191  r = (char *)strchr(p, '.');
1192  if( r!= NULL) *r = '\0';
1193  r = omStrDup(p);
1194  *r = mytoupper(*r);
1195  // printf("iiConvName: '%s' '%s' => '%s'\n", libname, tmpname, r);
1196  omFree((ADDRESS)tmpname);
1197 
1198  return(r);
1199 }
char mytoupper(char c)
Definition: iplib.cc:1165
return P p
Definition: myNF.cc:203
void * ADDRESS
Definition: auxiliary.h:118
#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 986 of file ipshell.cc.

987 {
988 #ifdef HAVE_SDB
989  sdb_flags=1;
990 #endif
991  Print("\n-- break point in %s --\n",VoiceName());
993  char * s;
995  s = (char *)omAlloc(BREAK_LINE_LENGTH+4);
996  loop
997  {
998  memset(s,0,80);
1000  if (s[BREAK_LINE_LENGTH-1]!='\0')
1001  {
1002  Print("line too long, max is %d chars\n",BREAK_LINE_LENGTH);
1003  }
1004  else
1005  break;
1006  }
1007  if (*s=='\n')
1008  {
1010  }
1011 #if MDEBUG
1012  else if(strncmp(s,"cont;",5)==0)
1013  {
1015  }
1016 #endif /* MDEBUG */
1017  else
1018  {
1019  strcat( s, "\n;~\n");
1020  newBuffer(s,BT_execute);
1021  }
1022 }
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:97
#define TRUE
Definition: auxiliary.h:101
#define omAlloc(size)
Definition: omAllocDecl.h:210
BOOLEAN iiDebugMarker
Definition: ipshell.cc:984
const char * VoiceName()
Definition: fevoices.cc:66
#define BREAK_LINE_LENGTH
Definition: ipshell.cc:985
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 1124 of file ipshell.cc.

1125 {
1126  BOOLEAN res=FALSE;
1127  const char *id = name->name;
1128 
1129  memset(sy,0,sizeof(sleftv));
1130  if ((name->name==NULL)||(isdigit(name->name[0])))
1131  {
1132  WerrorS("object to declare is not a name");
1133  res=TRUE;
1134  }
1135  else
1136  {
1137  if (t==QRING_CMD) t=RING_CMD; // qring is always RING_CMD
1138 
1139  if (TEST_V_ALLWARN
1140  && (name->rtyp!=0)
1141  && (name->rtyp!=IDHDL)
1142  && (currRingHdl!=NULL) && (IDLEV(currRingHdl)==myynest))
1143  {
1144  Warn("`%s` is %s in %s:%d:%s",name->name,Tok2Cmdname(name->rtyp),
1146  }
1147  {
1148  sy->data = (char *)enterid(id,lev,t,root,init_b);
1149  }
1150  if (sy->data!=NULL)
1151  {
1152  sy->rtyp=IDHDL;
1153  currid=sy->name=IDID((idhdl)sy->data);
1154  // name->name=NULL; /* used in enterid */
1155  //sy->e = NULL;
1156  if (name->next!=NULL)
1157  {
1159  res=iiDeclCommand(sy->next,name->next,lev,t,root, isring);
1160  }
1161  }
1162  else res=TRUE;
1163  }
1164  name->CleanUp();
1165  return res;
1166 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
int yylineno
Definition: febase.cc:45
#define IDID(a)
Definition: ipid.h:119
#define FALSE
Definition: auxiliary.h:97
char * filename
Definition: fevoices.h:62
#define TRUE
Definition: auxiliary.h:101
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:90
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:89
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:88
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition: ipshell.cc:1124
#define NULL
Definition: omList.c:10
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
Voice * currentVoice
Definition: fevoices.cc:57
int rtyp
Definition: subexpr.h:93
void CleanUp(ring r=currRing)
Definition: subexpr.cc:320
Definition: tok.h:155
int BOOLEAN
Definition: auxiliary.h:88
#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:376
procinfodata data
Definition: subexpr.h:63
idhdl currRingHdl
Definition: ipid.cc:65
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1568
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:5017
void push(char *)
Definition: ipid.cc:702
void pop()
Definition: ipid.cc:712
int BOOLEAN
Definition: auxiliary.h:88
int si_echo
Definition: febase.cc:41

§ iiExport() [1/2]

BOOLEAN iiExport ( leftv  v,
int  toLev 
)

Definition at line 1385 of file ipshell.cc.

1386 {
1387  BOOLEAN nok=FALSE;
1388  leftv r=v;
1389  while (v!=NULL)
1390  {
1391  if ((v->name==NULL)||(v->rtyp==0)||(v->e!=NULL))
1392  {
1393  Werror("cannot export:%s of internal type %d",v->name,v->rtyp);
1394  nok=TRUE;
1395  }
1396  else
1397  {
1398  if(iiInternalExport(v, toLev))
1399  {
1400  r->CleanUp();
1401  return TRUE;
1402  }
1403  }
1404  v=v->next;
1405  }
1406  r->CleanUp();
1407  return nok;
1408 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
Subexpr e
Definition: subexpr.h:107
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
const ring r
Definition: syzextra.cc:208
const char * name
Definition: subexpr.h:89
leftv next
Definition: subexpr.h:88
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
static BOOLEAN iiInternalExport(leftv v, int toLev)
Definition: ipshell.cc:1287
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:93
void CleanUp(ring r=currRing)
Definition: subexpr.cc:320
int BOOLEAN
Definition: auxiliary.h:88
void Werror(const char *fmt,...)
Definition: reporter.cc:189

§ iiExport() [2/2]

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

Definition at line 1411 of file ipshell.cc.

1412 {
1413 #ifdef SINGULAR_4_1
1414 // if ((pack==basePack)&&(pack!=currPack))
1415 // { Warn("'exportto' to Top is depreciated in >>%s<<",my_yylinebuf);}
1416 #endif
1417  BOOLEAN nok=FALSE;
1418  leftv rv=v;
1419  while (v!=NULL)
1420  {
1421  if ((v->name==NULL)||(v->rtyp==0)||(v->e!=NULL)
1422  )
1423  {
1424  Werror("cannot export:%s of internal type %d",v->name,v->rtyp);
1425  nok=TRUE;
1426  }
1427  else
1428  {
1429  idhdl old=pack->idroot->get( v->name,toLev);
1430  if (old!=NULL)
1431  {
1432  if ((pack==currPack) && (old==(idhdl)v->data))
1433  {
1434  if (BVERBOSE(V_REDEFINE)) Warn("`%s` is already global",IDID(old));
1435  break;
1436  }
1437  else if (IDTYP(old)==v->Typ())
1438  {
1439  if (BVERBOSE(V_REDEFINE))
1440  {
1441  Warn("redefining %s (%s)",IDID(old),my_yylinebuf);
1442  }
1443  v->name=omStrDup(v->name);
1444  killhdl2(old,&(pack->idroot),currRing);
1445  }
1446  else
1447  {
1448  rv->CleanUp();
1449  return TRUE;
1450  }
1451  }
1452  //Print("iiExport: pack=%s\n",IDID(root));
1453  if(iiInternalExport(v, toLev, pack))
1454  {
1455  rv->CleanUp();
1456  return TRUE;
1457  }
1458  }
1459  v=v->next;
1460  }
1461  rv->CleanUp();
1462  return nok;
1463 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
Subexpr e
Definition: subexpr.h:107
#define IDID(a)
Definition: ipid.h:119
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
int Typ()
Definition: subexpr.cc:979
Definition: idrec.h:34
idhdl get(const char *s, int lev)
Definition: ipid.cc:91
void * data
Definition: subexpr.h:90
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:403
char my_yylinebuf[80]
Definition: febase.cc:48
const char * name
Definition: subexpr.h:89
leftv next
Definition: subexpr.h:88
#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:1287
#define NULL
Definition: omList.c:10
package currPack
Definition: ipid.cc:63
int rtyp
Definition: subexpr.h:93
void CleanUp(ring r=currRing)
Definition: subexpr.cc:320
int BOOLEAN
Definition: auxiliary.h:88
#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 8294 of file iparith.cc.

8295 {
8296  memset(res,0,sizeof(sleftv));
8297  BOOLEAN call_failed=FALSE;
8298 
8299  if (!errorreported)
8300  {
8301  BOOLEAN failed=FALSE;
8302  iiOp=op;
8303  int i = 0;
8304  while (dA1[i].cmd==op)
8305  {
8306  if (at==dA1[i].arg)
8307  {
8308  if (currRing!=NULL)
8309  {
8310  if (check_valid(dA1[i].valid_for,op)) break;
8311  }
8312  else
8313  {
8314  if (RingDependend(dA1[i].res))
8315  {
8316  WerrorS("no ring active");
8317  break;
8318  }
8319  }
8320  if (traceit&TRACE_CALL)
8321  Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(at));
8322  res->rtyp=dA1[i].res;
8323  if ((call_failed=dA1[i].p(res,a)))
8324  {
8325  break;// leave loop, goto error handling
8326  }
8327  if (a->Next()!=NULL)
8328  {
8330  failed=iiExprArith1(res->next,a->next,op);
8331  }
8332  a->CleanUp();
8333  return failed;
8334  }
8335  i++;
8336  }
8337  // implicite type conversion --------------------------------------------
8338  if (dA1[i].cmd!=op)
8339  {
8341  i=0;
8342  //Print("fuer %c , typ: %s\n",op,Tok2Cmdname(at));
8343  while (dA1[i].cmd==op)
8344  {
8345  int ai;
8346  //Print("test %s\n",Tok2Cmdname(dA1[i].arg));
8347  if ((ai=iiTestConvert(at,dA1[i].arg,dConvertTypes))!=0)
8348  {
8349  if (currRing!=NULL)
8350  {
8351  if (check_valid(dA1[i].valid_for,op)) break;
8352  }
8353  else
8354  {
8355  if (RingDependend(dA1[i].res))
8356  {
8357  WerrorS("no ring active");
8358  break;
8359  }
8360  }
8361  if (traceit&TRACE_CALL)
8362  Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(dA1[i].arg));
8363  res->rtyp=dA1[i].res;
8364  failed= ((iiConvert(at,dA1[i].arg,ai,a,an,dConvertTypes))
8365  || (call_failed=dA1[i].p(res,an)));
8366  // everything done, clean up temp. variables
8367  if (failed)
8368  {
8369  // leave loop, goto error handling
8370  break;
8371  }
8372  else
8373  {
8374  if (an->Next() != NULL)
8375  {
8376  res->next = (leftv)omAllocBin(sleftv_bin);
8377  failed=iiExprArith1(res->next,an->next,op);
8378  }
8379  // everything ok, clean up and return
8380  an->CleanUp();
8382  a->CleanUp();
8383  return failed;
8384  }
8385  }
8386  i++;
8387  }
8388  an->CleanUp();
8390  }
8391  // error handling
8392  if (!errorreported)
8393  {
8394  if ((at==0) && (a->Fullname()!=sNoName))
8395  {
8396  Werror("`%s` is not defined",a->Fullname());
8397  }
8398  else
8399  {
8400  i=0;
8401  const char *s = iiTwoOps(op);
8402  Werror("%s(`%s`) failed"
8403  ,s,Tok2Cmdname(at));
8404  if ((!call_failed) && BVERBOSE(V_SHOW_USE))
8405  {
8406  while (dA1[i].cmd==op)
8407  {
8408  if ((dA1[i].res!=0)
8409  && (dA1[i].p!=jjWRONG))
8410  Werror("expected %s(`%s`)"
8411  ,s,Tok2Cmdname(dA1[i].arg));
8412  i++;
8413  }
8414  }
8415  }
8416  }
8417  res->rtyp = UNKNOWN;
8418  }
8419  a->CleanUp();
8420  return TRUE;
8421 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
const CanonicalForm int s
Definition: facAbsFact.cc:55
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:292
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
#define Print
Definition: emacs.cc:83
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition: iparith.cc:8422
#define FALSE
Definition: auxiliary.h:97
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:360
return P p
Definition: myNF.cc:203
const char sNoName[]
Definition: subexpr.cc:56
#define TRUE
Definition: auxiliary.h:101
#define UNKNOWN
Definition: tok.h:217
void * ADDRESS
Definition: auxiliary.h:118
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:70
const char * Fullname()
Definition: subexpr.h:127
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:9230
const char * Tok2Cmdname(int tok)
Definition: iparith.cc:8952
int RingDependend(int t)
Definition: gentable.cc:23
const char * iiTwoOps(int t)
Definition: gentable.cc:252
static BOOLEAN jjWRONG(leftv, leftv)
Definition: iparith.cc:3660
leftv Next()
Definition: subexpr.h:138
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:88
#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:93
void CleanUp(ring r=currRing)
Definition: subexpr.cc:320
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
int iiOp
Definition: iparith.cc:227
int BOOLEAN
Definition: auxiliary.h:88
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 8222 of file iparith.cc.

8226 {
8227  leftv b=a->next;
8228  a->next=NULL;
8229  int bt=b->Typ();
8230  BOOLEAN bo=iiExprArith2TabIntern(res,a,op,b,TRUE,dA2,at,bt,dConvertTypes);
8231  a->next=b;
8232  a->CleanUp();
8233  return bo;
8234 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
#define TRUE
Definition: auxiliary.h:101
int Typ()
Definition: subexpr.cc:979
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:8063
leftv next
Definition: subexpr.h:88
#define NULL
Definition: omList.c:10
void CleanUp(ring r=currRing)
Definition: subexpr.cc:320
int BOOLEAN
Definition: auxiliary.h:88
const poly b
Definition: syzextra.cc:213

§ iiExprArith3()

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

Definition at line 8634 of file iparith.cc.

8635 {
8636  memset(res,0,sizeof(sleftv));
8637 
8638  if (!errorreported)
8639  {
8640 #ifdef SIQ
8641  if (siq>0)
8642  {
8643  //Print("siq:%d\n",siq);
8645  memcpy(&d->arg1,a,sizeof(sleftv));
8646  //a->Init();
8647  memcpy(&d->arg2,b,sizeof(sleftv));
8648  //b->Init();
8649  memcpy(&d->arg3,c,sizeof(sleftv));
8650  //c->Init();
8651  d->op=op;
8652  d->argc=3;
8653  res->data=(char *)d;
8654  res->rtyp=COMMAND;
8655  return FALSE;
8656  }
8657 #endif
8658  int at=a->Typ();
8659  // handling bb-objects ----------------------------------------------
8660  if (at>MAX_TOK)
8661  {
8662  blackbox *bb=getBlackboxStuff(at);
8663  if (bb!=NULL)
8664  {
8665  if(!bb->blackbox_Op3(op,res,a,b,c)) return FALSE;
8666  if (errorreported) return TRUE;
8667  // else: no op defined
8668  }
8669  else return TRUE;
8670  if (errorreported) return TRUE;
8671  }
8672  int bt=b->Typ();
8673  int ct=c->Typ();
8674 
8675  iiOp=op;
8676  int i=0;
8677  while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
8678  return iiExprArith3TabIntern(res,op,a,b,c,dArith3+i,at,bt,ct,dConvertTypes);
8679  }
8680  a->CleanUp();
8681  b->CleanUp();
8682  c->CleanUp();
8683  //Print("op: %d,result typ:%d\n",op,res->rtyp);
8684  return TRUE;
8685 }
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:8480
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
ip_command * command
Definition: ipid.h:24
const struct sConvertTypes dConvertTypes[]
Definition: table.h:1184
#define FALSE
Definition: auxiliary.h:97
Definition: tok.h:213
BOOLEAN siq
Definition: subexpr.cc:58
#define TRUE
Definition: auxiliary.h:101
int Typ()
Definition: subexpr.cc:979
void * data
Definition: subexpr.h:90
struct sValCmd3 dArith3[]
Definition: table.h:712
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:93
void CleanUp(ring r=currRing)
Definition: subexpr.cc:320
int iiOp
Definition: iparith.cc:227
#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 8686 of file iparith.cc.

8690 {
8691  leftv b=a->next;
8692  a->next=NULL;
8693  int bt=b->Typ();
8694  leftv c=b->next;
8695  b->next=NULL;
8696  int ct=c->Typ();
8697  BOOLEAN bo=iiExprArith3TabIntern(res,op,a,b,c,dA3,at,bt,ct,dConvertTypes);
8698  b->next=c;
8699  a->next=b;
8700  a->CleanUp();
8701  return bo;
8702 }
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:8480
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
int Typ()
Definition: subexpr.cc:979
leftv next
Definition: subexpr.h:88
#define NULL
Definition: omList.c:10
void CleanUp(ring r=currRing)
Definition: subexpr.cc:320
int BOOLEAN
Definition: auxiliary.h:88
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 1485 of file ipshell.cc.

1486 {
1487  int i;
1488  if(!idIsZeroDim(I)) return NULL; // not zero-dim.
1489  poly po=NULL;
1491  {
1492  scComputeHC(I,currRing->qideal,ak,po);
1493  if (po!=NULL)
1494  {
1495  pGetCoeff(po)=nInit(1);
1496  for (i=rVar(currRing); i>0; i--)
1497  {
1498  if (pGetExp(po, i) > 0) pDecrExp(po,i);
1499  }
1500  pSetComp(po,ak);
1501  pSetm(po);
1502  }
1503  }
1504  else
1505  po=pOne();
1506  return po;
1507 }
#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:580
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:163
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:298
#define rHasLocalOrMixedOrdering_currRing()
Definition: ring.h:754
#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 1339 of file ipshell.cc.

1340 {
1341  idhdl h=(idhdl)v->data;
1342  if(h==NULL)
1343  {
1344  Warn("'%s': no such identifier\n", v->name);
1345  return FALSE;
1346  }
1347  package frompack=v->req_packhdl;
1348  if (frompack==NULL) frompack=currPack;
1349  if ((RingDependend(IDTYP(h)))
1350  || ((IDTYP(h)==LIST_CMD)
1351  && (lRingDependend(IDLIST(h)))
1352  )
1353  )
1354  {
1355  //Print("// ==> Ringdependent set nesting to 0\n");
1356  return (iiInternalExport(v, toLev));
1357  }
1358  else
1359  {
1360  IDLEV(h)=toLev;
1361  v->req_packhdl=rootpack;
1362  if (h==frompack->idroot)
1363  {
1364  frompack->idroot=h->next;
1365  }
1366  else
1367  {
1368  idhdl hh=frompack->idroot;
1369  while ((hh!=NULL) && (hh->next!=h))
1370  hh=hh->next;
1371  if ((hh!=NULL) && (hh->next==h))
1372  hh->next=h->next;
1373  else
1374  {
1375  Werror("`%s` not found",v->Name());
1376  return TRUE;
1377  }
1378  }
1379  h->next=rootpack->idroot;
1380  rootpack->idroot=h;
1381  }
1382  return FALSE;
1383 }
#define IDLIST(a)
Definition: ipid.h:134
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
const char * Name()
Definition: subexpr.h:122
Definition: idrec.h:34
void * data
Definition: subexpr.h:90
#define IDTYP(a)
Definition: ipid.h:116
int RingDependend(int t)
Definition: gentable.cc:23
const char * name
Definition: subexpr.h:89
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:1287
#define NULL
Definition: omList.c:10
package req_packhdl
Definition: subexpr.h:108
package currPack
Definition: ipid.cc:63
Definition: tok.h:116
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:97
#define TRUE
Definition: auxiliary.h:101
void * ADDRESS
Definition: auxiliary.h:118
#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:1184
int BOOLEAN
Definition: auxiliary.h:88
#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:168
#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:165
#define FALSE
Definition: auxiliary.h:97
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:167
#define TRUE
Definition: auxiliary.h:101
void print_init()
Definition: libparse.cc:3480
void * ADDRESS
Definition: auxiliary.h:118
void WerrorS(const char *s)
Definition: feFopen.cc:24
char * get()
Definition: subexpr.h:171
#define V_DEBUG_LIB
Definition: options.h:46
libstackv pop(const char *p)
Definition: iplib.cc:1273
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:97
#define TRUE
Definition: auxiliary.h:101
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:1184

§ 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:84
#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:58
idhdl currPackHdl
Definition: ipid.cc:61
#define IDID(a)
Definition: ipid.h:119
#define FALSE
Definition: auxiliary.h:97
sleftv iiRETURNEXPR
Definition: iplib.cc:471
language_defs language
Definition: subexpr.h:59
proclevel * procstack
Definition: ipid.cc:58
static void iiShowLevRings()
Definition: iplib.cc:475
#define TRUE
Definition: auxiliary.h:101
void Init()
Definition: subexpr.h:109
void * ADDRESS
Definition: auxiliary.h:118
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:57
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:56
procinfodata data
Definition: subexpr.h:63
omBin sleftv_bin
Definition: subexpr.cc:50
char is_static
Definition: subexpr.h:61
#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:320
#define TRACE_SHOW_PROC
Definition: reporter.h:28
idhdl packFindHdl(package r)
Definition: ipid.cc:730
void iiCheckPack(package &p)
Definition: ipshell.cc:1509
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
void push(char *)
Definition: ipid.cc:702
void pop()
Definition: ipid.cc:712
char trace_flag
Definition: subexpr.h:62
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 768 of file ipshell.cc.

770 {
771  lists L=liMakeResolv(r,length,rlen,typ0,weights);
772  int i=0;
773  idhdl h;
774  char * s=(char *)omAlloc(strlen(name)+5);
775 
776  while (i<=L->nr)
777  {
778  sprintf(s,"%s(%d)",name,i+1);
779  if (i==0)
780  h=enterid(s,myynest,typ0,&(currRing->idroot), FALSE);
781  else
782  h=enterid(s,myynest,MODUL_CMD,&(currRing->idroot), FALSE);
783  if (h!=NULL)
784  {
785  h->data.uideal=(ideal)L->m[i].data;
786  h->attribute=L->m[i].attribute;
788  Print("//defining: %s as %d-th syzygy module\n",s,i+1);
789  }
790  else
791  {
792  idDelete((ideal *)&(L->m[i].data));
793  Warn("cannot define %s",s);
794  }
795  //L->m[i].data=NULL;
796  //L->m[i].rtyp=0;
797  //L->m[i].attribute=NULL;
798  i++;
799  }
800  omFreeSize((ADDRESS)L->m,(L->nr+1)*sizeof(sleftv));
802  omFreeSize((ADDRESS)s,strlen(name)+5);
803 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
#define Print
Definition: emacs.cc:83
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
Definition: lists.h:22
if(0 > strat->sl)
Definition: myNF.cc:73
#define FALSE
Definition: auxiliary.h:97
#define V_DEF_RES
Definition: options.h:48
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:118
#define omAlloc(size)
Definition: omAllocDecl.h:210
Definition: idrec.h:34
void * data
Definition: subexpr.h:90
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:91
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 609 of file ipshell.cc.

610 {
611  idhdl w,r;
612  leftv v;
613  int i;
614  nMapFunc nMap;
615 
616  r=IDROOT->get(theMap->preimage,myynest);
617  if ((currPack!=basePack)
618  &&((r==NULL) || ((r->typ != RING_CMD) )))
619  r=basePack->idroot->get(theMap->preimage,myynest);
620  if ((r==NULL) && (currRingHdl!=NULL)
621  && (strcmp(theMap->preimage,IDID(currRingHdl))==0))
622  {
623  r=currRingHdl;
624  }
625  if ((r!=NULL) && (r->typ == RING_CMD))
626  {
627  ring src_ring=IDRING(r);
628  if ((nMap=n_SetMap(src_ring->cf, currRing->cf))==NULL)
629  {
630  Werror("can not map from ground field of %s to current ground field",
631  theMap->preimage);
632  return NULL;
633  }
634  if (IDELEMS(theMap)<src_ring->N)
635  {
636  theMap->m=(polyset)omReallocSize((ADDRESS)theMap->m,
637  IDELEMS(theMap)*sizeof(poly),
638  (src_ring->N)*sizeof(poly));
639  for(i=IDELEMS(theMap);i<src_ring->N;i++)
640  theMap->m[i]=NULL;
641  IDELEMS(theMap)=src_ring->N;
642  }
643  if (what==NULL)
644  {
645  WerrorS("argument of a map must have a name");
646  }
647  else if ((w=src_ring->idroot->get(what,myynest))!=NULL)
648  {
649  char *save_r=NULL;
651  sleftv tmpW;
652  memset(&tmpW,0,sizeof(sleftv));
653  tmpW.rtyp=IDTYP(w);
654  if (tmpW.rtyp==MAP_CMD)
655  {
656  tmpW.rtyp=IDEAL_CMD;
657  save_r=IDMAP(w)->preimage;
658  IDMAP(w)->preimage=0;
659  }
660  tmpW.data=IDDATA(w);
661  // check overflow
662  BOOLEAN overflow=FALSE;
663  if ((tmpW.rtyp==IDEAL_CMD)
664  || (tmpW.rtyp==MODUL_CMD)
665  || (tmpW.rtyp==MAP_CMD))
666  {
667  ideal id=(ideal)tmpW.data;
668  long *degs=(long*)omAlloc(IDELEMS(id)*sizeof(long));
669  for(int i=IDELEMS(id)-1;i>=0;i--)
670  {
671  poly p=id->m[i];
672  if (p!=NULL) degs[i]=p_Totaldegree(p,src_ring);
673  else degs[i]=0;
674  }
675  for(int j=IDELEMS(theMap)-1;j>=0 && !overflow;j--)
676  {
677  if (theMap->m[j]!=NULL)
678  {
679  long deg_monexp=pTotaldegree(theMap->m[j]);
680 
681  for(int i=IDELEMS(id)-1;i>=0;i--)
682  {
683  poly p=id->m[i];
684  if ((p!=NULL) && (degs[i]!=0) &&
685  ((unsigned long)deg_monexp > (currRing->bitmask / ((unsigned long)degs[i])/2)))
686  {
687  overflow=TRUE;
688  break;
689  }
690  }
691  }
692  }
693  omFreeSize(degs,IDELEMS(id)*sizeof(long));
694  }
695  else if (tmpW.rtyp==POLY_CMD)
696  {
697  for(int j=IDELEMS(theMap)-1;j>=0 && !overflow;j--)
698  {
699  if (theMap->m[j]!=NULL)
700  {
701  long deg_monexp=pTotaldegree(theMap->m[j]);
702  poly p=(poly)tmpW.data;
703  long deg=0;
704  if ((p!=NULL) && ((deg=p_Totaldegree(p,src_ring))!=0) &&
705  ((unsigned long)deg_monexp > (currRing->bitmask / ((unsigned long)deg)/2)))
706  {
707  overflow=TRUE;
708  break;
709  }
710  }
711  }
712  }
713  if (overflow)
714  Warn("possible OVERFLOW in map, max exponent is %ld",currRing->bitmask/2);
715 #if 0
716  if (((tmpW.rtyp==IDEAL_CMD)||(tmpW.rtyp==MODUL_CMD)) && idIs0(IDIDEAL(w)))
717  {
718  v->rtyp=tmpW.rtyp;
719  v->data=idInit(IDELEMS(IDIDEAL(w)),IDIDEAL(w)->rank);
720  }
721  else
722 #endif
723  {
724  if ((tmpW.rtyp==IDEAL_CMD)
725  ||(tmpW.rtyp==MODUL_CMD)
726  ||(tmpW.rtyp==MATRIX_CMD)
727  ||(tmpW.rtyp==MAP_CMD))
728  {
729  v->rtyp=tmpW.rtyp;
730  char *tmp = theMap->preimage;
731  theMap->preimage=(char*)1L;
732  // map gets 1 as its rank (as an ideal)
733  v->data=maMapIdeal(IDIDEAL(w), src_ring, (ideal)theMap, currRing,nMap);
734  theMap->preimage=tmp; // map gets its preimage back
735  }
736  if (v->data==NULL) /*i.e. not IDEAL_CMD/MODUL_CMD/MATRIX_CMD/MAP */
737  {
738  if (maApplyFetch(MAP_CMD,theMap,v,&tmpW,src_ring,NULL,NULL,0,nMap))
739  {
740  Werror("cannot map %s(%d)",Tok2Cmdname(w->typ),w->typ);
742  if (save_r!=NULL) IDMAP(w)->preimage=save_r;
743  return NULL;
744  }
745  }
746  }
747  if (save_r!=NULL)
748  {
749  IDMAP(w)->preimage=save_r;
750  IDMAP((idhdl)v)->preimage=omStrDup(save_r);
751  v->rtyp=MAP_CMD;
752  }
753  return v;
754  }
755  else
756  {
757  Werror("%s undefined in %s",what,theMap->preimage);
758  }
759  }
760  else
761  {
762  Werror("cannot find preimage %s",theMap->preimage);
763  }
764  return NULL;
765 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
if(0 > strat->sl)
Definition: myNF.cc:73
#define IDID(a)
Definition: ipid.h:119
#define FALSE
Definition: auxiliary.h:97
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:101
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:118
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:90
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:265
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:128
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:93
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:88
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 1251 of file ipshell.cc.

1252 {
1253  if (iiCurrArgs==NULL)
1254  {
1255  if (strcmp(p->name,"#")==0)
1256  return iiDefaultParameter(p);
1257  Werror("not enough arguments for proc %s",VoiceName());
1258  p->CleanUp();
1259  return TRUE;
1260  }
1261  leftv h=iiCurrArgs;
1262  leftv rest=h->next; /*iiCurrArgs is not NULL here*/
1263  BOOLEAN is_default_list=FALSE;
1264  if (strcmp(p->name,"#")==0)
1265  {
1266  is_default_list=TRUE;
1267  rest=NULL;
1268  }
1269  else
1270  {
1271  h->next=NULL;
1272  }
1273  BOOLEAN res=iiAssign(p,h);
1274  if (is_default_list)
1275  {
1276  iiCurrArgs=NULL;
1277  }
1278  else
1279  {
1280  iiCurrArgs=rest;
1281  }
1282  h->CleanUp();
1284  return res;
1285 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
void * ADDRESS
Definition: auxiliary.h:118
poly res
Definition: myNF.cc:322
const char * name
Definition: subexpr.h:89
omBin sleftv_bin
Definition: subexpr.cc:50
const char * VoiceName()
Definition: fevoices.cc:66
leftv next
Definition: subexpr.h:88
#define NULL
Definition: omList.c:10
BOOLEAN iiDefaultParameter(leftv p)
Definition: ipshell.cc:1168
leftv iiCurrArgs
Definition: ipshell.cc:78
void CleanUp(ring r=currRing)
Definition: subexpr.cc:320
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:88
void Werror(const char *fmt,...)
Definition: reporter.cc:189
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1780

§ 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:97
void * ADDRESS
Definition: auxiliary.h:118
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define omFree(addr)
Definition: omAllocDecl.h:261
int BOOLEAN
Definition: auxiliary.h:88
#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:84
#define FALSE
Definition: auxiliary.h:97
sleftv iiRETURNEXPR
Definition: iplib.cc:471
#define TRUE
Definition: auxiliary.h:101
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:391
void killlocals(int v)
Definition: ipshell.cc:376
procinfodata data
Definition: subexpr.h:63
idhdl currRingHdl
Definition: ipid.cc:65
omBin sleftv_bin
Definition: subexpr.cc:50
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1568
#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:320
const char * id
Definition: idrec.h:39
void rSetHdl(idhdl h)
Definition: ipshell.cc:5017
char * iiGetLibProcBuffer(procinfo *pi, int part)
Definition: iplib.cc:210
int BOOLEAN
Definition: auxiliary.h:88
char trace_flag
Definition: subexpr.h:62
void Werror(const char *fmt,...)
Definition: reporter.cc:189
int si_echo
Definition: febase.cc:41

§ iiRegularity()

int iiRegularity ( lists  L)

Definition at line 958 of file ipshell.cc.

959 {
960  int len,reg,typ0;
961 
962  resolvente r=liFindRes(L,&len,&typ0);
963 
964  if (r==NULL)
965  return -2;
966  intvec *weights=NULL;
967  int add_row_shift=0;
968  intvec *ww=(intvec *)atGet(&(L->m[0]),"isHomog",INTVEC_CMD);
969  if (ww!=NULL)
970  {
971  weights=ivCopy(ww);
972  add_row_shift = ww->min_in();
973  (*weights) -= add_row_shift;
974  }
975  //Print("attr:%x\n",weights);
976 
977  intvec *dummy=syBetti(r,len,&reg,weights);
978  if (weights!=NULL) delete weights;
979  delete dummy;
980  omFreeSize((ADDRESS)r,len*sizeof(ideal));
981  return reg+1+add_row_shift;
982 }
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:118
int min_in()
Definition: intvec.h:113
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
Definition: tok.h:99
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:135
#define NULL
Definition: omList.c:10
ideal * resolvente
Definition: ideals.h:20
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
Definition: syz.cc:791

§ iiTestAssume()

BOOLEAN iiTestAssume ( leftv  a,
leftv  b 
)

Definition at line 6341 of file ipshell.cc.

6342 {
6343  // assume a: level
6344  if ((a->Typ()==INT_CMD)&&((long)a->Data()>=0))
6345  {
6346  if ((TEST_V_ALLWARN) && (myynest==0)) WarnS("ASSUME at top level is of no use: see documentation");
6347  char assume_yylinebuf[80];
6348  strncpy(assume_yylinebuf,my_yylinebuf,79);
6349  int lev=(long)a->Data();
6350  int startlev=0;
6351  idhdl h=ggetid("assumeLevel");
6352  if ((h!=NULL)&&(IDTYP(h)==INT_CMD)) startlev=(long)IDINT(h);
6353  if(lev <=startlev)
6354  {
6355  BOOLEAN bo=b->Eval();
6356  if (bo) { WerrorS("syntax error in ASSUME");return TRUE;}
6357  if (b->Typ()!=INT_CMD) { WerrorS("ASUMME(<level>,<int expr>)");return TRUE; }
6358  if (b->Data()==NULL) { Werror("ASSUME failed:%s",assume_yylinebuf);return TRUE;}
6359  }
6360  }
6361  b->CleanUp();
6362  a->CleanUp();
6363  return FALSE;
6364 }
int Eval()
Definition: subexpr.cc:1744
Definition: tok.h:94
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define WarnS
Definition: emacs.cc:81
int Typ()
Definition: subexpr.cc:979
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:320
void * Data()
Definition: subexpr.cc:1121
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:88
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:490

§ iiTokType()

int iiTokType ( int  op)

Definition at line 242 of file iparith.cc.

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

§ 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:1052
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:97
Definition: mod_raw.h:16
#define TRUE
Definition: auxiliary.h:101
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:89
#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:1171
#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:1184
int BOOLEAN
Definition: auxiliary.h:88
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition: iplib.cc:955
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ iiTwoOps()

const char* iiTwoOps ( int  t)

Definition at line 252 of file gentable.cc.

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

§ iiWRITE()

BOOLEAN iiWRITE ( leftv  res,
leftv  exprlist 
)

Definition at line 582 of file ipshell.cc.

583 {
584  sleftv vf;
585  if (iiConvert(v->Typ(),LINK_CMD,iiTestConvert(v->Typ(),LINK_CMD),v,&vf))
586  {
587  WerrorS("link expected");
588  return TRUE;
589  }
590  si_link l=(si_link)vf.Data();
591  if (vf.next == NULL)
592  {
593  WerrorS("write: need at least two arguments");
594  return TRUE;
595  }
596 
597  BOOLEAN b=slWrite(l,vf.next); /* iiConvert preserves next */
598  if (b)
599  {
600  const char *s;
601  if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
602  else s=sNoName;
603  Werror("cannot write to %s",s);
604  }
605  vf.CleanUp();
606  return b;
607 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:292
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:360
const char sNoName[]
Definition: subexpr.cc:56
#define TRUE
Definition: auxiliary.h:101
void WerrorS(const char *s)
Definition: feFopen.cc:24
leftv next
Definition: subexpr.h:88
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
Definition: tok.h:115
#define NULL
Definition: omList.c:10
void CleanUp(ring r=currRing)
Definition: subexpr.cc:320
void * Data()
Definition: subexpr.cc:1121
int BOOLEAN
Definition: auxiliary.h:88
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 8830 of file iparith.cc.

8831 {
8832  int i;
8833  int an=1;
8834  int en=sArithBase.nLastIdentifier;
8835 
8836  loop
8837  //for(an=0; an<sArithBase.nCmdUsed; )
8838  {
8839  if(an>=en-1)
8840  {
8841  if (strcmp(n, sArithBase.sCmds[an].name) == 0)
8842  {
8843  i=an;
8844  break;
8845  }
8846  else if ((an!=en) && (strcmp(n, sArithBase.sCmds[en].name) == 0))
8847  {
8848  i=en;
8849  break;
8850  }
8851  else
8852  {
8853  // -- blackbox extensions:
8854  // return 0;
8855  return blackboxIsCmd(n,tok);
8856  }
8857  }
8858  i=(an+en)/2;
8859  if (*n < *(sArithBase.sCmds[i].name))
8860  {
8861  en=i-1;
8862  }
8863  else if (*n > *(sArithBase.sCmds[i].name))
8864  {
8865  an=i+1;
8866  }
8867  else
8868  {
8869  int v=strcmp(n,sArithBase.sCmds[i].name);
8870  if(v<0)
8871  {
8872  en=i-1;
8873  }
8874  else if(v>0)
8875  {
8876  an=i+1;
8877  }
8878  else /*v==0*/
8879  {
8880  break;
8881  }
8882  }
8883  }
8885  tok=sArithBase.sCmds[i].tokval;
8886  if(sArithBase.sCmds[i].alias==2)
8887  {
8888  Warn("outdated identifier `%s` used - please change your code",
8889  sArithBase.sCmds[i].name);
8890  sArithBase.sCmds[i].alias=1;
8891  }
8892  #if 0
8893  if (currRingHdl==NULL)
8894  {
8895  #ifdef SIQ
8896  if (siq<=0)
8897  {
8898  #endif
8899  if ((tok>=BEGIN_RING) && (tok<=END_RING))
8900  {
8901  WerrorS("no ring active");
8902  return 0;
8903  }
8904  #ifdef SIQ
8905  }
8906  #endif
8907  }
8908  #endif
8909  if (!expected_parms)
8910  {
8911  switch (tok)
8912  {
8913  case IDEAL_CMD:
8914  case INT_CMD:
8915  case INTVEC_CMD:
8916  case MAP_CMD:
8917  case MATRIX_CMD:
8918  case MODUL_CMD:
8919  case POLY_CMD:
8920  case PROC_CMD:
8921  case RING_CMD:
8922  case STRING_CMD:
8923  cmdtok = tok;
8924  break;
8925  }
8926  }
8927  return sArithBase.sCmds[i].toktype;
8928 }
Definition: tok.h:94
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
int nLastIdentifier
valid indentifieres are slot 1..nLastIdentifier
Definition: iparith.cc:198
idhdl currRingHdl
Definition: ipid.cc:65
int i
Definition: cfEzgcd.cc:123
Definition: tok.h:99
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int blackboxIsCmd(const char *n, int &tok)
used by scanner: returns ROOT_DECL for known types (and the type number in tok)
Definition: blackbox.cc:189
static SArithBase sArithBase
Base entry for arithmetic.
Definition: iparith.cc:206
cmdnames * sCmds
array of existing commands
Definition: iparith.cc:191
const char * lastreserved
Definition: ipshell.cc:80
#define Warn
Definition: emacs.cc:80

§ jjBETTI()

BOOLEAN jjBETTI ( leftv  res,
leftv  v 
)

Definition at line 888 of file ipshell.cc.

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

§ jjBETTI2()

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

Definition at line 922 of file ipshell.cc.

923 {
924  resolvente r;
925  int len;
926  int reg,typ0;
927  lists l=(lists)u->Data();
928 
929  intvec *weights=NULL;
930  int add_row_shift=0;
931  intvec *ww=NULL;
932  if (l->nr>=0) ww=(intvec *)atGet(&(l->m[0]),"isHomog",INTVEC_CMD);
933  if (ww!=NULL)
934  {
935  weights=ivCopy(ww);
936  add_row_shift = ww->min_in();
937  (*weights) -= add_row_shift;
938  }
939  //Print("attr:%x\n",weights);
940 
941  r=liFindRes(l,&len,&typ0);
942  if (r==NULL) return TRUE;
943  intvec* res_im=syBetti(r,len,&reg,weights,(int)(long)v->Data());
944  res->data=(void*)res_im;
945  omFreeSize((ADDRESS)r,(len)*sizeof(ideal));
946  //Print("rowShift: %d ",add_row_shift);
947  for(int i=1;i<=res_im->rows();i++)
948  {
949  if (IMATELEM(*res_im,1,i)==0) { add_row_shift--; }
950  else break;
951  }
952  //Print(" %d\n",add_row_shift);
953  atSet(res,omStrDup("rowShift"),(void*)(long)add_row_shift,INT_CMD);
954  if (weights!=NULL) delete weights;
955  return FALSE;
956 }
sleftv * m
Definition: lists.h:45
void atSet(idhdl root, const char *name, void *data, int typ)
Definition: attrib.cc:156
Definition: tok.h:94
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
Definition: lists.cc:312
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:97
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:101
void * ADDRESS
Definition: auxiliary.h:118
int min_in()
Definition: intvec.h:113
void * data
Definition: subexpr.h:90
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
int i
Definition: cfEzgcd.cc:123
Definition: tok.h:99
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:1121
ideal * resolvente
Definition: ideals.h:20
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 901 of file ipshell.cc.

902 {
904  l->Init(1);
905  l->m[0].rtyp=u->Typ();
906  l->m[0].data=u->Data();
907  attr *a=u->Attribute();
908  if (a!=NULL)
909  l->m[0].attribute=*a;
910  sleftv tmp2;
911  memset(&tmp2,0,sizeof(tmp2));
912  tmp2.rtyp=LIST_CMD;
913  tmp2.data=(void *)l;
914  BOOLEAN r=jjBETTI2(res,&tmp2,v);
915  l->m[0].data=NULL;
916  l->m[0].attribute=NULL;
917  l->m[0].rtyp=DEF_CMD;
918  l->Clean();
919  return r;
920 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
const poly a
Definition: syzextra.cc:212
Definition: attrib.h:15
Definition: lists.h:22
attr * Attribute()
Definition: subexpr.cc:1376
BOOLEAN jjBETTI2(leftv res, leftv u, leftv v)
Definition: ipshell.cc:922
int Typ()
Definition: subexpr.cc:979
void * data
Definition: subexpr.h:90
const ring r
Definition: syzextra.cc:208
Definition: tok.h:57
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:93
void Clean(ring r=currRing)
Definition: lists.h:25
void * Data()
Definition: subexpr.cc:1121
Definition: tok.h:116
attr attribute
Definition: subexpr.h:91
omBin slists_bin
Definition: lists.cc:23
int BOOLEAN
Definition: auxiliary.h:88
int l
Definition: cfEzgcd.cc:94

§ jjCHARSERIES()

BOOLEAN jjCHARSERIES ( leftv  res,
leftv  u 
)

Definition at line 3252 of file ipshell.cc.

3253 {
3254  res->data=singclap_irrCharSeries((ideal)u->Data(), currRing);
3255  return (res->data==NULL);
3256 }
void * data
Definition: subexpr.h:90
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:1121

§ jjIMPORTFROM()

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

Definition at line 2172 of file ipassign.cc.

2173 {
2174  //Print("importfrom %s::%s ->.\n",v->Name(),u->Name() );
2175  assume(u->Typ()==PACKAGE_CMD);
2176  char *vn=(char *)v->Name();
2177  idhdl h=((package)(u->Data()))->idroot->get(vn /*v->Name()*/, myynest);
2178  if (h!=NULL)
2179  {
2180  //check for existence
2181  if (((package)(u->Data()))==basePack)
2182  {
2183  WarnS("source and destination packages are identical");
2184  return FALSE;
2185  }
2186  idhdl t=basePack->idroot->get(vn /*v->Name()*/, myynest);
2187  if (t!=NULL)
2188  {
2189  Warn("redefining %s (%s)",vn,my_yylinebuf);
2190  killhdl(t);
2191  }
2192  sleftv tmp_expr;
2193  if (iiDeclCommand(&tmp_expr,v,myynest,DEF_CMD,&IDROOT)) return TRUE;
2194  sleftv h_expr;
2195  memset(&h_expr,0,sizeof(h_expr));
2196  h_expr.rtyp=IDHDL;
2197  h_expr.data=h;
2198  h_expr.name=vn;
2199  return iiAssign(&tmp_expr,&h_expr);
2200  }
2201  else
2202  {
2203  Werror("`%s` not found in `%s`",v->Name(), u->Name());
2204  return TRUE;
2205  }
2206  return FALSE;
2207 }
ip_package * package
Definition: structs.h:46
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
#define FALSE
Definition: auxiliary.h:97
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:101
#define WarnS
Definition: emacs.cc:81
int Typ()
Definition: subexpr.cc:979
const char * Name()
Definition: subexpr.h:122
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:90
int myynest
Definition: febase.cc:46
char my_yylinebuf[80]
Definition: febase.cc:48
Definition: tok.h:57
const char * name
Definition: subexpr.h:89
#define assume(x)
Definition: mod2.h:403
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition: ipshell.cc:1124
#define NULL
Definition: omList.c:10
void killhdl(idhdl h, package proot)
Definition: ipid.cc:372
package basePack
Definition: ipid.cc:64
int rtyp
Definition: subexpr.h:93
void * Data()
Definition: subexpr.cc:1121
static Poly * h
Definition: janet.cc:978
void Werror(const char *fmt,...)
Definition: reporter.cc:189
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1780
#define Warn
Definition: emacs.cc:80

§ jjLIST_PL()

BOOLEAN jjLIST_PL ( leftv  res,
leftv  v 
)

Definition at line 7480 of file iparith.cc.

7481 {
7482  int sl=0;
7483  if (v!=NULL) sl = v->listLength();
7484  lists L;
7485  if((sl==1)&&(v->Typ()==RESOLUTION_CMD))
7486  {
7487  int add_row_shift = 0;
7488  intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
7489  if (weights!=NULL) add_row_shift=weights->min_in();
7490  L=syConvRes((syStrategy)v->Data(),FALSE,add_row_shift);
7491  }
7492  else
7493  {
7495  leftv h=NULL;
7496  int i;
7497  int rt;
7498 
7499  L->Init(sl);
7500  for (i=0;i<sl;i++)
7501  {
7502  if (h!=NULL)
7503  { /* e.g. not in the first step:
7504  * h is the pointer to the old sleftv,
7505  * v is the pointer to the next sleftv
7506  * (in this moment) */
7507  h->next=v;
7508  }
7509  h=v;
7510  v=v->next;
7511  h->next=NULL;
7512  rt=h->Typ();
7513  if (rt==0)
7514  {
7515  L->Clean();
7516  Werror("`%s` is undefined",h->Fullname());
7517  return TRUE;
7518  }
7519  if (rt==RING_CMD)
7520  {
7521  L->m[i].rtyp=rt; L->m[i].data=h->Data();
7522  ((ring)L->m[i].data)->ref++;
7523  }
7524  else
7525  L->m[i].Copy(h);
7526  }
7527  }
7528  res->data=(char *)L;
7529  return FALSE;
7530 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:97
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition: ipshell.cc:3088
int listLength()
Definition: subexpr.cc:61
#define TRUE
Definition: auxiliary.h:101
int min_in()
Definition: intvec.h:113
int Typ()
Definition: subexpr.cc:979
const char * Fullname()
Definition: subexpr.h:127
void * data
Definition: subexpr.h:90
Definition: intvec.h:14
void Copy(leftv e)
Definition: subexpr.cc:660
int i
Definition: cfEzgcd.cc:123
Definition: tok.h:99
leftv next
Definition: subexpr.h:88
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:93
void Clean(ring r=currRing)
Definition: lists.h:25
void * Data()
Definition: subexpr.cc:1121
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 5332 of file iparith.cc.

5333 {
5334  char libnamebuf[256];
5335  lib_types LT = type_of_LIB(s, libnamebuf);
5336 
5337 #ifdef HAVE_DYNAMIC_LOADING
5338  extern BOOLEAN load_modules(const char *newlib, char *fullpath, BOOLEAN autoexport);
5339 #endif /* HAVE_DYNAMIC_LOADING */
5340  switch(LT)
5341  {
5342  default:
5343  case LT_NONE:
5344  Werror("%s: unknown type", s);
5345  break;
5346  case LT_NOTFOUND:
5347  Werror("cannot open %s", s);
5348  break;
5349 
5350  case LT_SINGULAR:
5351  {
5352  char *plib = iiConvName(s);
5353  idhdl pl = IDROOT->get(plib,0);
5354  if (pl==NULL)
5355  {
5356  pl = enterid( plib,0, PACKAGE_CMD, &(basePack->idroot), TRUE );
5357  IDPACKAGE(pl)->language = LANG_SINGULAR;
5358  IDPACKAGE(pl)->libname=omStrDup(plib);
5359  }
5360  else if (IDTYP(pl)!=PACKAGE_CMD)
5361  {
5362  Werror("can not create package `%s`",plib);
5363  omFree(plib);
5364  return TRUE;
5365  }
5366  package savepack=currPack;
5367  currPack=IDPACKAGE(pl);
5368  IDPACKAGE(pl)->loaded=TRUE;
5369  char libnamebuf[256];
5370  FILE * fp = feFopen( s, "r", libnamebuf, TRUE );
5371  BOOLEAN bo=iiLoadLIB(fp, libnamebuf, s, pl, autoexport, TRUE);
5372  currPack=savepack;
5373  IDPACKAGE(pl)->loaded=(!bo);
5374  return bo;
5375  }
5376  case LT_BUILTIN:
5377  SModulFunc_t iiGetBuiltinModInit(const char*);
5378  return load_builtin(s,autoexport, iiGetBuiltinModInit(s));
5379  case LT_MACH_O:
5380  case LT_ELF:
5381  case LT_HPUX:
5382 #ifdef HAVE_DYNAMIC_LOADING
5383  return load_modules(s, libnamebuf, autoexport);
5384 #else /* HAVE_DYNAMIC_LOADING */
5385  WerrorS("Dynamic modules are not supported by this version of Singular");
5386  break;
5387 #endif /* HAVE_DYNAMIC_LOADING */
5388  }
5389  return TRUE;
5390 }
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:101
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:1052
#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:1184
int BOOLEAN
Definition: auxiliary.h:88
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition: iplib.cc:955
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 5396 of file iparith.cc.

5397 {
5398  void (*WerrorS_save)(const char *s) = WerrorS_callback;
5401  BOOLEAN bo=jjLOAD(s,TRUE);
5402  if (TEST_OPT_PROT && (bo || (WerrorS_dummy_cnt>0)))
5403  Print("loading of >%s< failed\n",s);
5404  WerrorS_callback=WerrorS_save;
5405  errorreported=0;
5406  return FALSE;
5407 }
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:5391
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport)
load lib/module given in v
Definition: iparith.cc:5332
static void WerrorS_dummy(const char *)
Definition: iparith.cc:5392
void(* WerrorS_callback)(const char *s)
Definition: feFopen.cc:21
short errorreported
Definition: feFopen.cc:23
int BOOLEAN
Definition: auxiliary.h:88

§ jjMINRES()

BOOLEAN jjMINRES ( leftv  res,
leftv  v 
)

Definition at line 867 of file ipshell.cc.

868 {
869  int len=0;
870  int typ0;
871  lists L=(lists)v->Data();
872  intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
873  int add_row_shift = 0;
874  if (weights==NULL)
875  weights=(intvec*)atGet(&(L->m[0]),"isHomog",INTVEC_CMD);
876  if (weights!=NULL) add_row_shift=weights->min_in();
877  resolvente rr=liFindRes(L,&len,&typ0);
878  if (rr==NULL) return TRUE;
879  resolvente r=iiCopyRes(rr,len);
880 
881  syMinimizeResolvente(r,len,0);
882  omFreeSize((ADDRESS)rr,len*sizeof(ideal));
883  len++;
884  res->data=(char *)liMakeResolv(r,len,-1,typ0,NULL,add_row_shift);
885  return FALSE;
886 }
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:97
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:101
void * ADDRESS
Definition: auxiliary.h:118
int min_in()
Definition: intvec.h:113
void * data
Definition: subexpr.h:90
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
static resolvente iiCopyRes(resolvente r, int l)
Definition: ipshell.cc:857
Definition: tok.h:99
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:1121
ideal * resolvente
Definition: ideals.h:20

§ jjRESULTANT()

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

Definition at line 3245 of file ipshell.cc.

3246 {
3247  res->data=singclap_resultant((poly)u->CopyD(),(poly)v->CopyD(),
3248  (poly)w->CopyD(), currRing);
3249  return errorreported;
3250 }
poly singclap_resultant(poly f, poly g, poly x, const ring r)
Definition: clapsing.cc:317
void * data
Definition: subexpr.h:90
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:679

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

6215 {
6216  int *e=(int *)omAlloc0((rVar(currRing)+1)*sizeof(int));
6217  ideal I=(ideal)u->Data();
6218  int i;
6219  int n=0;
6220  for(i=I->nrows*I->ncols-1;i>=0;i--)
6221  {
6222  int n0=pGetVariables(I->m[i],e);
6223  if (n0>n) n=n0;
6224  }
6225  jjINT_S_TO_ID(n,e,res);
6226  return FALSE;
6227 }
#define FALSE
Definition: auxiliary.h:97
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
static void jjINT_S_TO_ID(int n, int *e, leftv res)
Definition: ipshell.cc:6184
#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:1121
#define omAlloc0(size)
Definition: omAllocDecl.h:211

§ jjVARIABLES_P()

BOOLEAN jjVARIABLES_P ( leftv  res,
leftv  u 
)

Definition at line 6206 of file ipshell.cc.

6207 {
6208  int *e=(int *)omAlloc0((rVar(currRing)+1)*sizeof(int));
6209  int n=pGetVariables((poly)u->Data(),e);
6210  jjINT_S_TO_ID(n,e,res);
6211  return FALSE;
6212 }
#define FALSE
Definition: auxiliary.h:97
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
static void jjINT_S_TO_ID(int n, int *e, leftv res)
Definition: ipshell.cc:6184
#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:1121
polyrec * poly
Definition: hilb.h:10
#define omAlloc0(size)
Definition: omAllocDecl.h:211

§ killlocals()

void killlocals ( int  v)

Definition at line 376 of file ipshell.cc.

377 {
378  BOOLEAN changed=FALSE;
379  idhdl sh=currRingHdl;
380  ring cr=currRing;
381  if (sh!=NULL) changed=((IDLEV(sh)<v) || (IDRING(sh)->ref>0));
382  //if (changed) Print("currRing=%s(%x), lev=%d,ref=%d\n",IDID(sh),IDRING(sh),IDLEV(sh),IDRING(sh)->ref);
383 
384  killlocals_rec(&(basePack->idroot),v,currRing);
385 
387  {
388  int t=iiRETURNEXPR.Typ();
389  if (/*iiRETURNEXPR.Typ()*/ t==RING_CMD)
390  {
392  if (((ring)h->data)->idroot!=NULL)
393  killlocals0(v,&(((ring)h->data)->idroot),(ring)h->data);
394  }
395  else if (/*iiRETURNEXPR.Typ()*/ t==LIST_CMD)
396  {
397  leftv h=&iiRETURNEXPR;
398  changed |=killlocals_list(v,(lists)h->data);
399  }
400  }
401  if (changed)
402  {
404  if (currRingHdl==NULL)
405  currRing=NULL;
406  else if(cr!=currRing)
407  rChangeCurrRing(cr);
408  }
409 
410  if (myynest<=1) iiNoKeepRing=TRUE;
411  //Print("end killlocals >= %d\n",v);
412  //listall();
413 }
int iiRETURNEXPR_len
Definition: iplib.cc:472
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:97
sleftv iiRETURNEXPR
Definition: iplib.cc:471
#define TRUE
Definition: auxiliary.h:101
void killlocals_rec(idhdl *root, int v, ring r)
Definition: ipshell.cc:320
int Typ()
Definition: subexpr.cc:979
Definition: idrec.h:34
void * data
Definition: subexpr.h:90
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:356
static BOOLEAN iiNoKeepRing
Definition: ipshell.cc:82
idhdl currRingHdl
Definition: ipid.cc:65
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1568
#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:116
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:88
static void killlocals0(int v, idhdl *localhdl, const ring r)
Definition: ipshell.cc:285

§ kQHWeight()

BOOLEAN kQHWeight ( leftv  res,
leftv  v 
)

Definition at line 3228 of file ipshell.cc.

3229 {
3230  res->data=(char *)id_QHomWeight((ideal)v->Data(), currRing);
3231  if (res->data==NULL)
3232  res->data=(char *)new intvec(rVar(currRing));
3233  return FALSE;
3234 }
#define FALSE
Definition: auxiliary.h:97
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
intvec * id_QHomWeight(ideal id, const ring r)
void * data
Definition: subexpr.h:90
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:1121

§ kWeight()

BOOLEAN kWeight ( leftv  res,
leftv  id 
)

Definition at line 3206 of file ipshell.cc.

3207 {
3208  ideal F=(ideal)id->Data();
3209  intvec * iv = new intvec(rVar(currRing));
3210  polyset s;
3211  int sl, n, i;
3212  int *x;
3213 
3214  res->data=(char *)iv;
3215  s = F->m;
3216  sl = IDELEMS(F) - 1;
3217  n = rVar(currRing);
3218  double wNsqr = (double)2.0 / (double)n;
3220  x = (int * )omAlloc(2 * (n + 1) * sizeof(int));
3221  wCall(s, sl, x, wNsqr, currRing);
3222  for (i = n; i!=0; i--)
3223  (*iv)[i-1] = x[i + n + 1];
3224  omFreeSize((ADDRESS)x, 2 * (n + 1) * sizeof(int));
3225  return FALSE;
3226 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:97
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
void * ADDRESS
Definition: auxiliary.h:118
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:90
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:1121
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 415 of file ipshell.cc.

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

§ loNewtonP()

BOOLEAN loNewtonP ( leftv  res,
leftv  arg1 
)

compute Newton Polytopes of input polynomials

Definition at line 4468 of file ipshell.cc.

4469 {
4470  res->data= (void*)loNewtonPolytope( (ideal)arg1->Data() );
4471  return FALSE;
4472 }
#define FALSE
Definition: auxiliary.h:97
ideal loNewtonPolytope(const ideal id)
Definition: mpr_base.cc:3190
void * data
Definition: subexpr.h:90
void * Data()
Definition: subexpr.cc:1121

§ loSimplex()

BOOLEAN loSimplex ( leftv  res,
leftv  args 
)

Implementation of the Simplex Algorithm.

For args, see class simplex.

Definition at line 4474 of file ipshell.cc.

4475 {
4476  if ( !(rField_is_long_R(currRing)) )
4477  {
4478  WerrorS("Ground field not implemented!");
4479  return TRUE;
4480  }
4481 
4482  simplex * LP;
4483  matrix m;
4484 
4485  leftv v= args;
4486  if ( v->Typ() != MATRIX_CMD ) // 1: matrix
4487  return TRUE;
4488  else
4489  m= (matrix)(v->CopyD());
4490 
4491  LP = new simplex(MATROWS(m),MATCOLS(m));
4492  LP->mapFromMatrix(m);
4493 
4494  v= v->next;
4495  if ( v->Typ() != INT_CMD ) // 2: m = number of constraints
4496  return TRUE;
4497  else
4498  LP->m= (int)(long)(v->Data());
4499 
4500  v= v->next;
4501  if ( v->Typ() != INT_CMD ) // 3: n = number of variables
4502  return TRUE;
4503  else
4504  LP->n= (int)(long)(v->Data());
4505 
4506  v= v->next;
4507  if ( v->Typ() != INT_CMD ) // 4: m1 = number of <= constraints
4508  return TRUE;
4509  else
4510  LP->m1= (int)(long)(v->Data());
4511 
4512  v= v->next;
4513  if ( v->Typ() != INT_CMD ) // 5: m2 = number of >= constraints
4514  return TRUE;
4515  else
4516  LP->m2= (int)(long)(v->Data());
4517 
4518  v= v->next;
4519  if ( v->Typ() != INT_CMD ) // 6: m3 = number of == constraints
4520  return TRUE;
4521  else
4522  LP->m3= (int)(long)(v->Data());
4523 
4524 #ifdef mprDEBUG_PROT
4525  Print("m (constraints) %d\n",LP->m);
4526  Print("n (columns) %d\n",LP->n);
4527  Print("m1 (<=) %d\n",LP->m1);
4528  Print("m2 (>=) %d\n",LP->m2);
4529  Print("m3 (==) %d\n",LP->m3);
4530 #endif
4531 
4532  LP->compute();
4533 
4534  lists lres= (lists)omAlloc( sizeof(slists) );
4535  lres->Init( 6 );
4536 
4537  lres->m[0].rtyp= MATRIX_CMD; // output matrix
4538  lres->m[0].data=(void*)LP->mapToMatrix(m);
4539 
4540  lres->m[1].rtyp= INT_CMD; // found a solution?
4541  lres->m[1].data=(void*)(long)LP->icase;
4542 
4543  lres->m[2].rtyp= INTVEC_CMD;
4544  lres->m[2].data=(void*)LP->posvToIV();
4545 
4546  lres->m[3].rtyp= INTVEC_CMD;
4547  lres->m[3].data=(void*)LP->zrovToIV();
4548 
4549  lres->m[4].rtyp= INT_CMD;
4550  lres->m[4].data=(void*)(long)LP->m;
4551 
4552  lres->m[5].rtyp= INT_CMD;
4553  lres->m[5].data=(void*)(long)LP->n;
4554 
4555  res->data= (void*)lres;
4556 
4557  return FALSE;
4558 }
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
matrix mapToMatrix(matrix m)
void compute()
#define Print
Definition: emacs.cc:83
Definition: tok.h:94
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:97
Linear Programming / Linear Optimization using Simplex - Algorithm.
Definition: mpr_numeric.h:194
#define TRUE
Definition: auxiliary.h:101
intvec * zrovToIV()
void WerrorS(const char *s)
Definition: feFopen.cc:24
int Typ()
Definition: subexpr.cc:979
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:90
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
Definition: tok.h:99
leftv next
Definition: subexpr.h:88
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:531
int rtyp
Definition: subexpr.h:93
void * Data()
Definition: subexpr.cc:1121
#define MATROWS(i)
Definition: matpol.h:27
int icase
Definition: mpr_numeric.h:201
void * CopyD(int t)
Definition: subexpr.cc:679

§ mpJacobi()

BOOLEAN mpJacobi ( leftv  res,
leftv  a 
)

Definition at line 2976 of file ipshell.cc.

2977 {
2978  int i,j;
2979  matrix result;
2980  ideal id=(ideal)a->Data();
2981 
2982  result =mpNew(IDELEMS(id),rVar(currRing));
2983  for (i=1; i<=IDELEMS(id); i++)
2984  {
2985  for (j=1; j<=rVar(currRing); j++)
2986  {
2987  MATELEM(result,i,j) = pDiff(id->m[i-1],j);
2988  }
2989  }
2990  res->data=(char *)result;
2991  return FALSE;
2992 }
#define FALSE
Definition: auxiliary.h:97
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
void * data
Definition: subexpr.h:90
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:48
void * Data()
Definition: subexpr.cc:1121
#define pDiff(a, b)
Definition: polys.h:279
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 2998 of file ipshell.cc.

2999 {
3000  int n=(int)(long)b->Data();
3001  int d=(int)(long)c->Data();
3002  int k,l,sign,row,col;
3003  matrix result;
3004  ideal temp;
3005  BOOLEAN bo;
3006  poly p;
3007 
3008  if ((d>n) || (d<1) || (n<1))
3009  {
3010  res->data=(char *)mpNew(1,1);
3011  return FALSE;
3012  }
3013  int *choise = (int*)omAlloc(d*sizeof(int));
3014  if (id==NULL)
3015  temp=idMaxIdeal(1);
3016  else
3017  temp=(ideal)id->Data();
3018 
3019  k = binom(n,d);
3020  l = k*d;
3021  l /= n-d+1;
3022  result =mpNew(l,k);
3023  col = 1;
3024  idInitChoise(d,1,n,&bo,choise);
3025  while (!bo)
3026  {
3027  sign = 1;
3028  for (l=1;l<=d;l++)
3029  {
3030  if (choise[l-1]<=IDELEMS(temp))
3031  {
3032  p = pCopy(temp->m[choise[l-1]-1]);
3033  if (sign == -1) p = pNeg(p);
3034  sign *= -1;
3035  row = idGetNumberOfChoise(l-1,d,1,n,choise);
3036  MATELEM(result,row,col) = p;
3037  }
3038  }
3039  col++;
3040  idGetNextChoise(d,n,&bo,choise);
3041  }
3042  if (id==NULL) idDelete(&temp);
3043 
3044  res->data=(char *)result;
3045  return FALSE;
3046 }
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
Definition: ideals.h:35
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
#define FALSE
Definition: auxiliary.h:97
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:90
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:48
#define NULL
Definition: omList.c:10
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)
void * Data()
Definition: subexpr.cc:1121
int idGetNumberOfChoise(int t, int d, int begin, int end, int *choise)
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:88
static int sign(int x)
Definition: ring.cc:3412
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 4583 of file ipshell.cc.

4584 {
4585 
4586  poly gls;
4587  gls= (poly)(arg1->Data());
4588  int howclean= (int)(long)arg3->Data();
4589 
4590  if ( !(rField_is_R(currRing) ||
4591  rField_is_Q(currRing) ||
4594  {
4595  WerrorS("Ground field not implemented!");
4596  return TRUE;
4597  }
4598 
4601  {
4602  unsigned long int ii = (unsigned long int)arg2->Data();
4603  setGMPFloatDigits( ii, ii );
4604  }
4605 
4606  if ( gls == NULL || pIsConstant( gls ) )
4607  {
4608  WerrorS("Input polynomial is constant!");
4609  return TRUE;
4610  }
4611 
4612  int ldummy;
4613  int deg= currRing->pLDeg( gls, &ldummy, currRing );
4614  int i,vpos=0;
4615  poly piter;
4616  lists elist;
4617  lists rlist;
4618 
4619  elist= (lists)omAlloc( sizeof(slists) );
4620  elist->Init( 0 );
4621 
4622  if ( rVar(currRing) > 1 )
4623  {
4624  piter= gls;
4625  for ( i= 1; i <= rVar(currRing); i++ )
4626  if ( pGetExp( piter, i ) )
4627  {
4628  vpos= i;
4629  break;
4630  }
4631  while ( piter )
4632  {
4633  for ( i= 1; i <= rVar(currRing); i++ )
4634  if ( (vpos != i) && (pGetExp( piter, i ) != 0) )
4635  {
4636  WerrorS("The input polynomial must be univariate!");
4637  return TRUE;
4638  }
4639  pIter( piter );
4640  }
4641  }
4642 
4643  rootContainer * roots= new rootContainer();
4644  number * pcoeffs= (number *)omAlloc( (deg+1) * sizeof( number ) );
4645  piter= gls;
4646  for ( i= deg; i >= 0; i-- )
4647  {
4648  if ( piter && pTotaldegree(piter) == i )
4649  {
4650  pcoeffs[i]= nCopy( pGetCoeff( piter ) );
4651  //nPrint( pcoeffs[i] );PrintS(" ");
4652  pIter( piter );
4653  }
4654  else
4655  {
4656  pcoeffs[i]= nInit(0);
4657  }
4658  }
4659 
4660 #ifdef mprDEBUG_PROT
4661  for (i=deg; i >= 0; i--)
4662  {
4663  nPrint( pcoeffs[i] );PrintS(" ");
4664  }
4665  PrintLn();
4666 #endif
4667 
4668  roots->fillContainer( pcoeffs, NULL, 1, deg, rootContainer::onepoly, 1 );
4669  roots->solver( howclean );
4670 
4671  int elem= roots->getAnzRoots();
4672  char *dummy;
4673  int j;
4674 
4675  rlist= (lists)omAlloc( sizeof(slists) );
4676  rlist->Init( elem );
4677 
4679  {
4680  for ( j= 0; j < elem; j++ )
4681  {
4682  rlist->m[j].rtyp=NUMBER_CMD;
4683  rlist->m[j].data=(void *)nCopy((number)(roots->getRoot(j)));
4684  //rlist->m[j].data=(void *)(number)(roots->getRoot(j));
4685  }
4686  }
4687  else
4688  {
4689  for ( j= 0; j < elem; j++ )
4690  {
4691  dummy = complexToStr( (*roots)[j], gmp_output_digits, currRing->cf );
4692  rlist->m[j].rtyp=STRING_CMD;
4693  rlist->m[j].data=(void *)dummy;
4694  }
4695  }
4696 
4697  elist->Clean();
4698  //omFreeSize( (ADDRESS) elist, sizeof(slists) );
4699 
4700  // this is (via fillContainer) the same data as in root
4701  //for ( i= deg; i >= 0; i-- ) nDelete( &pcoeffs[i] );
4702  //omFreeSize( (ADDRESS) pcoeffs, (deg+1) * sizeof( number ) );
4703 
4704  delete roots;
4705 
4706  res->rtyp= LIST_CMD;
4707  res->data= (void*)rlist;
4708 
4709  return FALSE;
4710 }
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:97
static BOOLEAN rField_is_R(const ring r)
Definition: ring.h:507
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
#define TRUE
Definition: auxiliary.h:101
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:90
#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:265
#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:534
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:531
int rtyp
Definition: subexpr.h:93
#define nCopy(n)
Definition: numbers.h:15
void Clean(ring r=currRing)
Definition: lists.h:25
void * Data()
Definition: subexpr.cc:1121
Definition: tok.h:116
char * complexToStr(gmp_complex &c, const unsigned int oprec, const coeffs src)
Definition: mpr_complex.cc:717
size_t gmp_output_digits
Definition: mpr_complex.cc:44
void setGMPFloatDigits(size_t digits, size_t rest)
Set size of mantissa digits - the number of output digits (basis 10) the size of mantissa consists of...
Definition: mpr_complex.cc:62
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 4560 of file ipshell.cc.

4561 {
4562  ideal gls = (ideal)(arg1->Data());
4563  int imtype= (int)(long)arg2->Data();
4564 
4565  uResultant::resMatType mtype= determineMType( imtype );
4566 
4567  // check input ideal ( = polynomial system )
4568  if ( mprIdealCheck( gls, arg1->Name(), mtype, true ) != mprOk )
4569  {
4570  return TRUE;
4571  }
4572 
4573  uResultant *resMat= new uResultant( gls, mtype, false );
4574  if (resMat!=NULL)
4575  {
4576  res->rtyp = MODUL_CMD;
4577  res->data= (void*)resMat->accessResMat()->getMatrix();
4578  if (!errorreported) delete resMat;
4579  }
4580  return errorreported;
4581 }
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:101
uResultant::resMatType determineMType(int imtype)
const char * Name()
Definition: subexpr.h:122
Definition: mpr_base.h:98
void * data
Definition: subexpr.h:90
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:93
void * Data()
Definition: subexpr.cc:1121

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

4814 {
4815  leftv v= args;
4816 
4817  ideal gls;
4818  int imtype;
4819  int howclean;
4820 
4821  // get ideal
4822  if ( v->Typ() != IDEAL_CMD )
4823  return TRUE;
4824  else gls= (ideal)(v->Data());
4825  v= v->next;
4826 
4827  // get resultant matrix type to use (0,1)
4828  if ( v->Typ() != INT_CMD )
4829  return TRUE;
4830  else imtype= (int)(long)v->Data();
4831  v= v->next;
4832 
4833  if (imtype==0)
4834  {
4835  ideal test_id=idInit(1,1);
4836  int j;
4837  for(j=IDELEMS(gls)-1;j>=0;j--)
4838  {
4839  if (gls->m[j]!=NULL)
4840  {
4841  test_id->m[0]=gls->m[j];
4842  intvec *dummy_w=id_QHomWeight(test_id, currRing);
4843  if (dummy_w!=NULL)
4844  {
4845  WerrorS("Newton polytope not of expected dimension");
4846  delete dummy_w;
4847  return TRUE;
4848  }
4849  }
4850  }
4851  }
4852 
4853  // get and set precision in digits ( > 0 )
4854  if ( v->Typ() != INT_CMD )
4855  return TRUE;
4856  else if ( !(rField_is_R(currRing) || rField_is_long_R(currRing) || \
4858  {
4859  unsigned long int ii=(unsigned long int)v->Data();
4860  setGMPFloatDigits( ii, ii );
4861  }
4862  v= v->next;
4863 
4864  // get interpolation steps (0,1,2)
4865  if ( v->Typ() != INT_CMD )
4866  return TRUE;
4867  else howclean= (int)(long)v->Data();
4868 
4869  uResultant::resMatType mtype= determineMType( imtype );
4870  int i,count;
4871  lists listofroots= NULL;
4872  number smv= NULL;
4873  BOOLEAN interpolate_det= (mtype==uResultant::denseResMat)?TRUE:FALSE;
4874 
4875  //emptylist= (lists)omAlloc( sizeof(slists) );
4876  //emptylist->Init( 0 );
4877 
4878  //res->rtyp = LIST_CMD;
4879  //res->data= (void *)emptylist;
4880 
4881  // check input ideal ( = polynomial system )
4882  if ( mprIdealCheck( gls, args->Name(), mtype ) != mprOk )
4883  {
4884  return TRUE;
4885  }
4886 
4887  uResultant * ures;
4888  rootContainer ** iproots;
4889  rootContainer ** muiproots;
4890  rootArranger * arranger;
4891 
4892  // main task 1: setup of resultant matrix
4893  ures= new uResultant( gls, mtype );
4894  if ( ures->accessResMat()->initState() != resMatrixBase::ready )
4895  {
4896  WerrorS("Error occurred during matrix setup!");
4897  return TRUE;
4898  }
4899 
4900  // if dense resultant, check if minor nonsingular
4901  if ( mtype == uResultant::denseResMat )
4902  {
4903  smv= ures->accessResMat()->getSubDet();
4904 #ifdef mprDEBUG_PROT
4905  PrintS("// Determinant of submatrix: ");nPrint(smv);PrintLn();
4906 #endif
4907  if ( nIsZero(smv) )
4908  {
4909  WerrorS("Unsuitable input ideal: Minor of resultant matrix is singular!");
4910  return TRUE;
4911  }
4912  }
4913 
4914  // main task 2: Interpolate specialized resultant polynomials
4915  if ( interpolate_det )
4916  iproots= ures->interpolateDenseSP( false, smv );
4917  else
4918  iproots= ures->specializeInU( false, smv );
4919 
4920  // main task 3: Interpolate specialized resultant polynomials
4921  if ( interpolate_det )
4922  muiproots= ures->interpolateDenseSP( true, smv );
4923  else
4924  muiproots= ures->specializeInU( true, smv );
4925 
4926 #ifdef mprDEBUG_PROT
4927  int c= iproots[0]->getAnzElems();
4928  for (i=0; i < c; i++) pWrite(iproots[i]->getPoly());
4929  c= muiproots[0]->getAnzElems();
4930  for (i=0; i < c; i++) pWrite(muiproots[i]->getPoly());
4931 #endif
4932 
4933  // main task 4: Compute roots of specialized polys and match them up
4934  arranger= new rootArranger( iproots, muiproots, howclean );
4935  arranger->solve_all();
4936 
4937  // get list of roots
4938  if ( arranger->success() )
4939  {
4940  arranger->arrange();
4941  listofroots= listOfRoots(arranger, gmp_output_digits );
4942  }
4943  else
4944  {
4945  WerrorS("Solver was unable to find any roots!");
4946  return TRUE;
4947  }
4948 
4949  // free everything
4950  count= iproots[0]->getAnzElems();
4951  for (i=0; i < count; i++) delete iproots[i];
4952  omFreeSize( (ADDRESS) iproots, count * sizeof(rootContainer*) );
4953  count= muiproots[0]->getAnzElems();
4954  for (i=0; i < count; i++) delete muiproots[i];
4955  omFreeSize( (ADDRESS) muiproots, count * sizeof(rootContainer*) );
4956 
4957  delete ures;
4958  delete arranger;
4959  nDelete( &smv );
4960 
4961  res->data= (void *)listofroots;
4962 
4963  //emptylist->Clean();
4964  // omFreeSize( (ADDRESS) emptylist, sizeof(slists) );
4965 
4966  return FALSE;
4967 }
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:84
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:94
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:97
static BOOLEAN rField_is_R(const ring r)
Definition: ring.h:507
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:101
uResultant::resMatType determineMType(int imtype)
void * ADDRESS
Definition: auxiliary.h:118
void pWrite(poly p)
Definition: polys.h:291
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:979
const char * Name()
Definition: subexpr.h:122
Definition: mpr_base.h:98
#define nPrint(a)
only for debug, over any initalized currRing
Definition: numbers.h:46
void * data
Definition: subexpr.h:90
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:88
static BOOLEAN rField_is_long_C(const ring r)
Definition: ring.h:534
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:531
void * Data()
Definition: subexpr.cc:1121
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:88
lists listOfRoots(rootArranger *self, const unsigned int oprec)
Definition: ipshell.cc:4970
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 4712 of file ipshell.cc.

4713 {
4714  int i;
4715  ideal p,w;
4716  p= (ideal)arg1->Data();
4717  w= (ideal)arg2->Data();
4718 
4719  // w[0] = f(p^0)
4720  // w[1] = f(p^1)
4721  // ...
4722  // p can be a vector of numbers (multivariate polynom)
4723  // or one number (univariate polynom)
4724  // tdg = deg(f)
4725 
4726  int n= IDELEMS( p );
4727  int m= IDELEMS( w );
4728  int tdg= (int)(long)arg3->Data();
4729 
4730  res->data= (void*)NULL;
4731 
4732  // check the input
4733  if ( tdg < 1 )
4734  {
4735  WerrorS("Last input parameter must be > 0!");
4736  return TRUE;
4737  }
4738  if ( n != rVar(currRing) )
4739  {
4740  Werror("Size of first input ideal must be equal to %d!",rVar(currRing));
4741  return TRUE;
4742  }
4743  if ( m != (int)pow((double)tdg+1,(double)n) )
4744  {
4745  Werror("Size of second input ideal must be equal to %d!",
4746  (int)pow((double)tdg+1,(double)n));
4747  return TRUE;
4748  }
4749  if ( !(rField_is_Q(currRing) /* ||
4750  rField_is_R() || rField_is_long_R() ||
4751  rField_is_long_C()*/ ) )
4752  {
4753  WerrorS("Ground field not implemented!");
4754  return TRUE;
4755  }
4756 
4757  number tmp;
4758  number *pevpoint= (number *)omAlloc( n * sizeof( number ) );
4759  for ( i= 0; i < n; i++ )
4760  {
4761  pevpoint[i]=nInit(0);
4762  if ( (p->m)[i] )
4763  {
4764  tmp = pGetCoeff( (p->m)[i] );
4765  if ( nIsZero(tmp) || nIsOne(tmp) || nIsMOne(tmp) )
4766  {
4767  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4768  WerrorS("Elements of first input ideal must not be equal to -1, 0, 1!");
4769  return TRUE;
4770  }
4771  } else tmp= NULL;
4772  if ( !nIsZero(tmp) )
4773  {
4774  if ( !pIsConstant((p->m)[i]))
4775  {
4776  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4777  WerrorS("Elements of first input ideal must be numbers!");
4778  return TRUE;
4779  }
4780  pevpoint[i]= nCopy( tmp );
4781  }
4782  }
4783 
4784  number *wresults= (number *)omAlloc( m * sizeof( number ) );
4785  for ( i= 0; i < m; i++ )
4786  {
4787  wresults[i]= nInit(0);
4788  if ( (w->m)[i] && !nIsZero(pGetCoeff((w->m)[i])) )
4789  {
4790  if ( !pIsConstant((w->m)[i]))
4791  {
4792  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4793  omFreeSize( (ADDRESS)wresults, m * sizeof( number ) );
4794  WerrorS("Elements of second input ideal must be numbers!");
4795  return TRUE;
4796  }
4797  wresults[i]= nCopy(pGetCoeff((w->m)[i]));
4798  }
4799  }
4800 
4801  vandermonde vm( m, n, tdg, pevpoint, FALSE );
4802  number *ncpoly= vm.interpolateDense( wresults );
4803  // do not free ncpoly[]!!
4804  poly rpoly= vm.numvec2poly( ncpoly );
4805 
4806  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4807  omFreeSize( (ADDRESS)wresults, m * sizeof( number ) );
4808 
4809  res->data= (void*)rpoly;
4810  return FALSE;
4811 }
vandermonde system solver for interpolating polynomials from their values
Definition: mpr_numeric.h:28
#define FALSE
Definition: auxiliary.h:97
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:580
#define TRUE
Definition: auxiliary.h:101
#define nIsOne(n)
Definition: numbers.h:25
void * ADDRESS
Definition: auxiliary.h:118
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:90
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:1121
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 6229 of file ipshell.cc.

6230 {
6231  Print(" %s (",n);
6232  switch (p->language)
6233  {
6234  case LANG_SINGULAR: PrintS("S"); break;
6235  case LANG_C: PrintS("C"); break;
6236  case LANG_TOP: PrintS("T"); break;
6237  case LANG_NONE: PrintS("N"); break;
6238  default: PrintS("U");
6239  }
6240  if(p->libname!=NULL)
6241  Print(",%s", p->libname);
6242  PrintS(")");
6243 }
#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 2023 of file ipshell.cc.

2024 {
2025  assume( r != NULL );
2026  const coeffs C = r->cf;
2027  assume( C != NULL );
2028 
2029  // sanity check: require currRing==r for rings with polynomial data
2030  if ( (r!=currRing) && (
2031  (nCoeff_is_algExt(C) && (C != currRing->cf))
2032  || (r->qideal != NULL)
2033 #ifdef HAVE_PLURAL
2034  || (rIsPluralRing(r))
2035 #endif
2036  )
2037  )
2038  {
2039  WerrorS("ring with polynomial data must be the base ring or compatible");
2040  return NULL;
2041  }
2042  // 0: char/ cf - ring
2043  // 1: list (var)
2044  // 2: list (ord)
2045  // 3: qideal
2046  // possibly:
2047  // 4: C
2048  // 5: D
2050  if (rIsPluralRing(r))
2051  L->Init(6);
2052  else
2053  L->Init(4);
2054  // ----------------------------------------
2055  // 0: char/ cf - ring
2056  if (rField_is_numeric(r))
2057  {
2058  rDecomposeC(&(L->m[0]),r);
2059  }
2060  else if (rField_is_Ring(r))
2061  {
2062  rDecomposeRing(&(L->m[0]),r);
2063  }
2064  else if ( r->cf->extRing!=NULL )// nCoeff_is_algExt(r->cf))
2065  {
2066  rDecomposeCF(&(L->m[0]), r->cf->extRing, r);
2067  }
2068  else if(rField_is_GF(r))
2069  {
2071  Lc->Init(4);
2072  // char:
2073  Lc->m[0].rtyp=INT_CMD;
2074  Lc->m[0].data=(void*)(long)r->cf->m_nfCharQ;
2075  // var:
2077  Lv->Init(1);
2078  Lv->m[0].rtyp=STRING_CMD;
2079  Lv->m[0].data=(void *)omStrDup(*rParameter(r));
2080  Lc->m[1].rtyp=LIST_CMD;
2081  Lc->m[1].data=(void*)Lv;
2082  // ord:
2084  Lo->Init(1);
2086  Loo->Init(2);
2087  Loo->m[0].rtyp=STRING_CMD;
2088  Loo->m[0].data=(void *)omStrDup(rSimpleOrdStr(ringorder_lp));
2089 
2090  intvec *iv=new intvec(1); (*iv)[0]=1;
2091  Loo->m[1].rtyp=INTVEC_CMD;
2092  Loo->m[1].data=(void *)iv;
2093 
2094  Lo->m[0].rtyp=LIST_CMD;
2095  Lo->m[0].data=(void*)Loo;
2096 
2097  Lc->m[2].rtyp=LIST_CMD;
2098  Lc->m[2].data=(void*)Lo;
2099  // q-ideal:
2100  Lc->m[3].rtyp=IDEAL_CMD;
2101  Lc->m[3].data=(void *)idInit(1,1);
2102  // ----------------------
2103  L->m[0].rtyp=LIST_CMD;
2104  L->m[0].data=(void*)Lc;
2105  }
2106  else
2107  {
2108  L->m[0].rtyp=INT_CMD;
2109  L->m[0].data=(void *)(long)r->cf->ch;
2110  }
2111  // ----------------------------------------
2112  // 1: list (var)
2114  LL->Init(r->N);
2115  int i;
2116  for(i=0; i<r->N; i++)
2117  {
2118  LL->m[i].rtyp=STRING_CMD;
2119  LL->m[i].data=(void *)omStrDup(r->names[i]);
2120  }
2121  L->m[1].rtyp=LIST_CMD;
2122  L->m[1].data=(void *)LL;
2123  // ----------------------------------------
2124  // 2: list (ord)
2126  i=rBlocks(r)-1;
2127  LL->Init(i);
2128  i--;
2129  lists LLL;
2130  for(; i>=0; i--)
2131  {
2132  intvec *iv;
2133  int j;
2134  LL->m[i].rtyp=LIST_CMD;
2136  LLL->Init(2);
2137  LLL->m[0].rtyp=STRING_CMD;
2138  LLL->m[0].data=(void *)omStrDup(rSimpleOrdStr(r->order[i]));
2139 
2140  if(r->order[i] == ringorder_IS) // || r->order[i] == ringorder_s || r->order[i] == ringorder_S)
2141  {
2142  assume( r->block0[i] == r->block1[i] );
2143  const int s = r->block0[i];
2144  assume( -2 < s && s < 2);
2145 
2146  iv=new intvec(1);
2147  (*iv)[0] = s;
2148  }
2149  else if (r->block1[i]-r->block0[i] >=0 )
2150  {
2151  int bl=j=r->block1[i]-r->block0[i];
2152  if (r->order[i]==ringorder_M)
2153  {
2154  j=(j+1)*(j+1)-1;
2155  bl=j+1;
2156  }
2157  else if (r->order[i]==ringorder_am)
2158  {
2159  j+=r->wvhdl[i][bl+1];
2160  }
2161  iv=new intvec(j+1);
2162  if ((r->wvhdl!=NULL) && (r->wvhdl[i]!=NULL))
2163  {
2164  for(;j>=0; j--) (*iv)[j]=r->wvhdl[i][j+(j>bl)];
2165  }
2166  else switch (r->order[i])
2167  {
2168  case ringorder_dp:
2169  case ringorder_Dp:
2170  case ringorder_ds:
2171  case ringorder_Ds:
2172  case ringorder_lp:
2173  for(;j>=0; j--) (*iv)[j]=1;
2174  break;
2175  default: /* do nothing */;
2176  }
2177  }
2178  else
2179  {
2180  iv=new intvec(1);
2181  }
2182  LLL->m[1].rtyp=INTVEC_CMD;
2183  LLL->m[1].data=(void *)iv;
2184  LL->m[i].data=(void *)LLL;
2185  }
2186  L->m[2].rtyp=LIST_CMD;
2187  L->m[2].data=(void *)LL;
2188  // ----------------------------------------
2189  // 3: qideal
2190  L->m[3].rtyp=IDEAL_CMD;
2191  if (r->qideal==NULL)
2192  L->m[3].data=(void *)idInit(1,1);
2193  else
2194  L->m[3].data=(void *)idCopy(r->qideal);
2195  // ----------------------------------------
2196 #ifdef HAVE_PLURAL // NC! in rDecompose
2197  if (rIsPluralRing(r))
2198  {
2199  L->m[4].rtyp=MATRIX_CMD;
2200  L->m[4].data=(void *)mp_Copy(r->GetNC()->C, r, r);
2201  L->m[5].rtyp=MATRIX_CMD;
2202  L->m[5].data=(void *)mp_Copy(r->GetNC()->D, r, r);
2203  }
2204 #endif
2205  return L;
2206 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
sleftv * m
Definition: lists.h:45
Definition: tok.h:94
Definition: lists.h:22
void WerrorS(const char *s)
Definition: feFopen.cc:24
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:510
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:613
CanonicalForm Lc(const CanonicalForm &f)
void * data
Definition: subexpr.h:90
void rDecomposeCF(leftv h, const ring r, const ring R)
Definition: ipshell.cc:1594
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:556
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:924
Definition: intvec.h:14
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
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:1718
const char * rSimpleOrdStr(int ord)
Definition: ring.cc:88
int i
Definition: cfEzgcd.cc:123
Induced (Schreyer) ordering.
Definition: ring.h:101
Definition: tok.h:99
ideal idCopy(ideal A)
Definition: ideals.h:62
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:1784
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:93
Definition: tok.h:116
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:75
omBin slists_bin
Definition: lists.cc:23
static BOOLEAN rField_is_numeric(const ring r)
Definition: ring.h:504
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ rDecompose_CF()

BOOLEAN rDecompose_CF ( leftv  res,
const coeffs  C 
)

Definition at line 1817 of file ipshell.cc.

1818 {
1819  assume( C != NULL );
1820 
1821  // sanity check: require currRing==r for rings with polynomial data
1822  if ( nCoeff_is_algExt(C) && (C != currRing->cf))
1823  {
1824  WerrorS("ring with polynomial data must be the base ring or compatible");
1825  return TRUE;
1826  }
1827  if (nCoeff_is_numeric(C))
1828  {
1829  rDecomposeC_41(res,C);
1830  }
1831 #ifdef HAVE_RINGS
1832  else if (nCoeff_is_Ring(C))
1833  {
1834  rDecomposeRing_41(res,C);
1835  }
1836 #endif
1837  else if ( C->extRing!=NULL )// nCoeff_is_algExt(r->cf))
1838  {
1839  rDecomposeCF(res, C->extRing, currRing);
1840  }
1841  else if(nCoeff_is_GF(C))
1842  {
1844  Lc->Init(4);
1845  // char:
1846  Lc->m[0].rtyp=INT_CMD;
1847  Lc->m[0].data=(void*)(long)C->m_nfCharQ;
1848  // var:
1850  Lv->Init(1);
1851  Lv->m[0].rtyp=STRING_CMD;
1852  Lv->m[0].data=(void *)omStrDup(*n_ParameterNames(C));
1853  Lc->m[1].rtyp=LIST_CMD;
1854  Lc->m[1].data=(void*)Lv;
1855  // ord:
1857  Lo->Init(1);
1859  Loo->Init(2);
1860  Loo->m[0].rtyp=STRING_CMD;
1861  Loo->m[0].data=(void *)omStrDup(rSimpleOrdStr(ringorder_lp));
1862 
1863  intvec *iv=new intvec(1); (*iv)[0]=1;
1864  Loo->m[1].rtyp=INTVEC_CMD;
1865  Loo->m[1].data=(void *)iv;
1866 
1867  Lo->m[0].rtyp=LIST_CMD;
1868  Lo->m[0].data=(void*)Loo;
1869 
1870  Lc->m[2].rtyp=LIST_CMD;
1871  Lc->m[2].data=(void*)Lo;
1872  // q-ideal:
1873  Lc->m[3].rtyp=IDEAL_CMD;
1874  Lc->m[3].data=(void *)idInit(1,1);
1875  // ----------------------
1876  res->rtyp=LIST_CMD;
1877  res->data=(void*)Lc;
1878  }
1879  else
1880  {
1881  res->rtyp=INT_CMD;
1882  res->data=(void *)(long)C->ch;
1883  }
1884  // ----------------------------------------
1885  return FALSE;
1886 }
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:846
Definition: tok.h:94
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
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:1755
void * data
Definition: subexpr.h:90
void rDecomposeCF(leftv h, const ring r, const ring R)
Definition: ipshell.cc:1594
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:924
Definition: intvec.h:14
#define assume(x)
Definition: mod2.h:403
const char * rSimpleOrdStr(int ord)
Definition: ring.cc:88
Definition: tok.h:99
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition: coeffs.h:853
static void rDecomposeC_41(leftv h, const coeffs C)
Definition: ipshell.cc:1683
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:93
Definition: tok.h:116
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 1890 of file ipshell.cc.

1891 {
1892  assume( r != NULL );
1893  const coeffs C = r->cf;
1894  assume( C != NULL );
1895 
1896  // sanity check: require currRing==r for rings with polynomial data
1897  if ( (r!=currRing) && (
1898  (nCoeff_is_algExt(C) && (C != currRing->cf))
1899  || (r->qideal != NULL)
1900 #ifdef HAVE_PLURAL
1901  || (rIsPluralRing(r))
1902 #endif
1903  )
1904  )
1905  {
1906  WerrorS("ring with polynomial data must be the base ring or compatible");
1907  return NULL;
1908  }
1909  // 0: char/ cf - ring
1910  // 1: list (var)
1911  // 2: list (ord)
1912  // 3: qideal
1913  // possibly:
1914  // 4: C
1915  // 5: D
1917  if (rIsPluralRing(r))
1918  L->Init(6);
1919  else
1920  L->Init(4);
1921  // ----------------------------------------
1922  // 0: char/ cf - ring
1923  L->m[0].rtyp=CRING_CMD;
1924  L->m[0].data=(char*)r->cf; r->cf->ref++;
1925  // ----------------------------------------
1926  // 1: list (var)
1928  LL->Init(r->N);
1929  int i;
1930  for(i=0; i<r->N; i++)
1931  {
1932  LL->m[i].rtyp=STRING_CMD;
1933  LL->m[i].data=(void *)omStrDup(r->names[i]);
1934  }
1935  L->m[1].rtyp=LIST_CMD;
1936  L->m[1].data=(void *)LL;
1937  // ----------------------------------------
1938  // 2: list (ord)
1940  i=rBlocks(r)-1;
1941  LL->Init(i);
1942  i--;
1943  lists LLL;
1944  for(; i>=0; i--)
1945  {
1946  intvec *iv;
1947  int j;
1948  LL->m[i].rtyp=LIST_CMD;
1950  LLL->Init(2);
1951  LLL->m[0].rtyp=STRING_CMD;
1952  LLL->m[0].data=(void *)omStrDup(rSimpleOrdStr(r->order[i]));
1953 
1954  if(r->order[i] == ringorder_IS) // || r->order[i] == ringorder_s || r->order[i] == ringorder_S)
1955  {
1956  assume( r->block0[i] == r->block1[i] );
1957  const int s = r->block0[i];
1958  assume( -2 < s && s < 2);
1959 
1960  iv=new intvec(1);
1961  (*iv)[0] = s;
1962  }
1963  else if (r->block1[i]-r->block0[i] >=0 )
1964  {
1965  int bl=j=r->block1[i]-r->block0[i];
1966  if (r->order[i]==ringorder_M)
1967  {
1968  j=(j+1)*(j+1)-1;
1969  bl=j+1;
1970  }
1971  else if (r->order[i]==ringorder_am)
1972  {
1973  j+=r->wvhdl[i][bl+1];
1974  }
1975  iv=new intvec(j+1);
1976  if ((r->wvhdl!=NULL) && (r->wvhdl[i]!=NULL))
1977  {
1978  for(;j>=0; j--) (*iv)[j]=r->wvhdl[i][j+(j>bl)];
1979  }
1980  else switch (r->order[i])
1981  {
1982  case ringorder_dp:
1983  case ringorder_Dp:
1984  case ringorder_ds:
1985  case ringorder_Ds:
1986  case ringorder_lp:
1987  for(;j>=0; j--) (*iv)[j]=1;
1988  break;
1989  default: /* do nothing */;
1990  }
1991  }
1992  else
1993  {
1994  iv=new intvec(1);
1995  }
1996  LLL->m[1].rtyp=INTVEC_CMD;
1997  LLL->m[1].data=(void *)iv;
1998  LL->m[i].data=(void *)LLL;
1999  }
2000  L->m[2].rtyp=LIST_CMD;
2001  L->m[2].data=(void *)LL;
2002  // ----------------------------------------
2003  // 3: qideal
2004  L->m[3].rtyp=IDEAL_CMD;
2005  if (r->qideal==NULL)
2006  L->m[3].data=(void *)idInit(1,1);
2007  else
2008  L->m[3].data=(void *)idCopy(r->qideal);
2009  // ----------------------------------------
2010 #ifdef HAVE_PLURAL // NC! in rDecompose
2011  if (rIsPluralRing(r))
2012  {
2013  L->m[4].rtyp=MATRIX_CMD;
2014  L->m[4].data=(void *)mp_Copy(r->GetNC()->C, r, r);
2015  L->m[5].rtyp=MATRIX_CMD;
2016  L->m[5].data=(void *)mp_Copy(r->GetNC()->D, r, r);
2017  }
2018 #endif
2019  return L;
2020 }
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:90
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:556
Definition: tok.h:55
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:924
Definition: intvec.h:14
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
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
Definition: tok.h:99
ideal idCopy(ideal A)
Definition: ideals.h:62
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:93
Definition: tok.h:116
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:75
omBin slists_bin
Definition: lists.cc:23
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ rDefault()

idhdl rDefault ( const char *  s)

Definition at line 1523 of file ipshell.cc.

1524 {
1525  idhdl tmp=NULL;
1526 
1527  if (s!=NULL) tmp = enterid(s, myynest, RING_CMD, &IDROOT);
1528  if (tmp==NULL) return NULL;
1529 
1530 // if ((currRing->ppNoether)!=NULL) pDelete(&(currRing->ppNoether));
1532  {
1534  memset(&sLastPrinted,0,sizeof(sleftv));
1535  }
1536 
1537  ring r = IDRING(tmp) = (ring) omAlloc0Bin(sip_sring_bin);
1538 
1539  r->cf = nInitChar(n_Zp, (void*)32003); // r->cf->ch = 32003;
1540  r->N = 3;
1541  /*r->P = 0; Alloc0 in idhdl::set, ipid.cc*/
1542  /*names*/
1543  r->names = (char **) omAlloc0(3 * sizeof(char_ptr));
1544  r->names[0] = omStrDup("x");
1545  r->names[1] = omStrDup("y");
1546  r->names[2] = omStrDup("z");
1547  /*weights: entries for 3 blocks: NULL*/
1548  r->wvhdl = (int **)omAlloc0(3 * sizeof(int_ptr));
1549  /*order: dp,C,0*/
1550  r->order = (int *) omAlloc(3 * sizeof(int *));
1551  r->block0 = (int *)omAlloc0(3 * sizeof(int *));
1552  r->block1 = (int *)omAlloc0(3 * sizeof(int *));
1553  /* ringorder dp for the first block: var 1..3 */
1554  r->order[0] = ringorder_dp;
1555  r->block0[0] = 1;
1556  r->block1[0] = 3;
1557  /* ringorder C for the second block: no vars */
1558  r->order[1] = ringorder_C;
1559  /* the last block: everything is 0 */
1560  r->order[2] = 0;
1561 
1562  /* complete ring intializations */
1563  rComplete(r);
1564  rSetHdl(tmp);
1565  return currRingHdl;
1566 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
{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:391
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:3435
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:320
void rSetHdl(idhdl h)
Definition: ipshell.cc:5017
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:329
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ rFindHdl()

idhdl rFindHdl ( ring  r,
idhdl  n 
)

Definition at line 1568 of file ipshell.cc.

1569 {
1571  if (h!=NULL) return h;
1572  if (IDROOT!=basePack->idroot) h=rSimpleFindHdl(r,basePack->idroot,n);
1573  if (h!=NULL) return h;
1575  while(p!=NULL)
1576  {
1577  if ((p->cPack!=basePack)
1578  && (p->cPack!=currPack))
1579  h=rSimpleFindHdl(r,p->cPack->idroot,n);
1580  if (h!=NULL) return h;
1581  p=p->next;
1582  }
1583  idhdl tmp=basePack->idroot;
1584  while (tmp!=NULL)
1585  {
1586  if (IDTYP(tmp)==PACKAGE_CMD)
1587  h=rSimpleFindHdl(r,IDPACKAGE(tmp)->idroot,n);
1588  if (h!=NULL) return h;
1589  tmp=IDNEXT(tmp);
1590  }
1591  return NULL;
1592 }
idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n)
Definition: ipshell.cc:6121
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 5503 of file ipshell.cc.

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

§ rKill() [1/2]

void rKill ( idhdl  h)

Definition at line 6095 of file ipshell.cc.

6096 {
6097  ring r = IDRING(h);
6098  int ref=0;
6099  if (r!=NULL)
6100  {
6101  // avoid, that sLastPrinted is the last reference to the base ring:
6102  // clean up before killing the last "named" refrence:
6103  if ((sLastPrinted.rtyp==RING_CMD)
6104  && (sLastPrinted.data==(void*)r))
6105  {
6106  sLastPrinted.CleanUp(r);
6107  }
6108  ref=r->ref;
6109  rKill(r);
6110  }
6111  if (h==currRingHdl)
6112  {
6113  if (ref<=0) { currRing=NULL; currRingHdl=NULL;}
6114  else
6115  {
6117  }
6118  }
6119 }
void * data
Definition: subexpr.h:90
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:6044
idhdl currRingHdl
Definition: ipid.cc:65
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1568
#define NULL
Definition: omList.c:10
#define IDRING(a)
Definition: ipid.h:124
int rtyp
Definition: subexpr.h:93
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:320

§ rKill() [2/2]

void rKill ( ring  r)

Definition at line 6044 of file ipshell.cc.

6045 {
6046  if ((r->ref<=0)&&(r->order!=NULL))
6047  {
6048 #ifdef RDEBUG
6049  if (traceit &TRACE_SHOW_RINGS) Print("kill ring %lx\n",(long)r);
6050 #endif
6051  if (r->qideal!=NULL)
6052  {
6053  id_Delete(&r->qideal, r);
6054  r->qideal = NULL;
6055  }
6056  int j;
6057  for (j=0;j<myynest;j++)
6058  {
6059  if (iiLocalRing[j]==r)
6060  {
6061  if (j==0) WarnS("killing the basering for level 0");
6062  iiLocalRing[j]=NULL;
6063  }
6064  }
6065 // any variables depending on r ?
6066  while (r->idroot!=NULL)
6067  {
6068  r->idroot->lev=myynest; // avoid warning about kill global objects
6069  killhdl2(r->idroot,&(r->idroot),r);
6070  }
6071  if (r==currRing)
6072  {
6073  // all dependend stuff is done, clean global vars:
6074  if ((currRing->ppNoether)!=NULL) pDelete(&(currRing->ppNoether));
6076  {
6078  }
6079  //if ((myynest>0) && (iiRETURNEXPR.RingDependend()))
6080  //{
6081  // WerrorS("return value depends on local ring variable (export missing ?)");
6082  // iiRETURNEXPR.CleanUp();
6083  //}
6084  currRing=NULL;
6085  currRingHdl=NULL;
6086  }
6087 
6088  /* nKillChar(r); will be called from inside of rDelete */
6089  rDelete(r);
6090  return;
6091  }
6092  r->ref--;
6093 }
#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:403
const ring r
Definition: syzextra.cc:208
BOOLEAN RingDependend()
Definition: subexpr.cc:391
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:320

§ rSetHdl()

void rSetHdl ( idhdl  h)

Definition at line 5017 of file ipshell.cc.

5018 {
5019  ring rg = NULL;
5020  if (h!=NULL)
5021  {
5022 // Print(" new ring:%s (l:%d)\n",IDID(h),IDLEV(h));
5023  rg = IDRING(h);
5024  if (rg==NULL) return; //id <>NULL, ring==NULL
5025  omCheckAddrSize((ADDRESS)h,sizeof(idrec));
5026  if (IDID(h)) // OB: ????
5027  omCheckAddr((ADDRESS)IDID(h));
5028  rTest(rg);
5029  }
5030 
5031  // clean up history
5033  {
5035  memset(&sLastPrinted,0,sizeof(sleftv));
5036  }
5037 
5038  if ((rg!=currRing)&&(currRing!=NULL))
5039  {
5041  if (DENOMINATOR_LIST!=NULL)
5042  {
5043  if (TEST_V_ALLWARN)
5044  Warn("deleting denom_list for ring change to %s",IDID(h));
5045  do
5046  {
5047  n_Delete(&(dd->n),currRing->cf);
5048  dd=dd->next;
5050  DENOMINATOR_LIST=dd;
5051  } while(DENOMINATOR_LIST!=NULL);
5052  }
5053  }
5054 
5055  // test for valid "currRing":
5056  if ((rg!=NULL) && (rg->idroot==NULL))
5057  {
5058  ring old=rg;
5059  rg=rAssure_HasComp(rg);
5060  if (old!=rg)
5061  {
5062  rKill(old);
5063  IDRING(h)=rg;
5064  }
5065  }
5066  /*------------ change the global ring -----------------------*/
5067  rChangeCurrRing(rg);
5068  currRingHdl = h;
5069 }
#define omCheckAddrSize(addr, size)
Definition: omAllocDecl.h:327
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
#define IDID(a)
Definition: ipid.h:119
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:89
void * ADDRESS
Definition: auxiliary.h:118
ring rAssure_HasComp(const ring r)
Definition: ring.cc:4557
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:391
void rKill(ring r)
Definition: ipshell.cc:6044
#define omFree(addr)
Definition: omAllocDecl.h:261
#define rTest(r)
Definition: ring.h:775
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:320
#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 6121 of file ipshell.cc.

6122 {
6123  idhdl h=root;
6124  while (h!=NULL)
6125  {
6126  if ((IDTYP(h)==RING_CMD)
6127  && (h!=n)
6128  && (IDRING(h)==r)
6129  )
6130  {
6131  return h;
6132  }
6133  h=IDNEXT(h);
6134  }
6135  return NULL;
6136 }
#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 1024 of file ipshell.cc.

1025 {
1026  int i;
1027  indset save;
1029 
1030  hexist = hInit(S, Q, &hNexist, currRing);
1031  if (hNexist == 0)
1032  {
1033  intvec *iv=new intvec(rVar(currRing));
1034  for(i=0; i<rVar(currRing); i++) (*iv)[i]=1;
1035  res->Init(1);
1036  res->m[0].rtyp=INTVEC_CMD;
1037  res->m[0].data=(intvec*)iv;
1038  return res;
1039  }
1040  else if (hisModule!=0)
1041  {
1042  res->Init(0);
1043  return res;
1044  }
1045  save = ISet = (indset)omAlloc0Bin(indlist_bin);
1046  hMu = 0;
1047  hwork = (scfmon)omAlloc(hNexist * sizeof(scmon));
1048  hvar = (varset)omAlloc((rVar(currRing) + 1) * sizeof(int));
1049  hpure = (scmon)omAlloc((1 + (rVar(currRing) * rVar(currRing))) * sizeof(long));
1050  hrad = hexist;
1051  hNrad = hNexist;
1052  radmem = hCreate(rVar(currRing) - 1);
1053  hCo = rVar(currRing) + 1;
1054  hNvar = rVar(currRing);
1055  hRadical(hrad, &hNrad, hNvar);
1056  hSupp(hrad, hNrad, hvar, &hNvar);
1057  if (hNvar)
1058  {
1059  hCo = hNvar;
1060  memset(hpure, 0, (rVar(currRing) + 1) * sizeof(long));
1061  hPure(hrad, 0, &hNrad, hvar, hNvar, hpure, &hNpure);
1062  hLexR(hrad, hNrad, hvar, hNvar);
1064  }
1065  if (hCo && (hCo < rVar(currRing)))
1066  {
1068  }
1069  if (hMu!=0)
1070  {
1071  ISet = save;
1072  hMu2 = 0;
1073  if (all && (hCo+1 < rVar(currRing)))
1074  {
1077  i=hMu+hMu2;
1078  res->Init(i);
1079  if (hMu2 == 0)
1080  {
1082  }
1083  }
1084  else
1085  {
1086  res->Init(hMu);
1087  }
1088  for (i=0;i<hMu;i++)
1089  {
1090  res->m[i].data = (void *)save->set;
1091  res->m[i].rtyp = INTVEC_CMD;
1092  ISet = save;
1093  save = save->nx;
1095  }
1096  omFreeBin((ADDRESS)save, indlist_bin);
1097  if (hMu2 != 0)
1098  {
1099  save = JSet;
1100  for (i=hMu;i<hMu+hMu2;i++)
1101  {
1102  res->m[i].data = (void *)save->set;
1103  res->m[i].rtyp = INTVEC_CMD;
1104  JSet = save;
1105  save = save->nx;
1107  }
1108  omFreeBin((ADDRESS)save, indlist_bin);
1109  }
1110  }
1111  else
1112  {
1113  res->Init(0);
1115  }
1116  hKill(radmem, rVar(currRing) - 1);
1117  omFreeSize((ADDRESS)hpure, (1 + (rVar(currRing) * rVar(currRing))) * sizeof(long));
1118  omFreeSize((ADDRESS)hvar, (rVar(currRing) + 1) * sizeof(int));
1119  omFreeSize((ADDRESS)hwork, hNexist * sizeof(scmon));
1121  return res;
1122 }
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:21
int hCo
Definition: hdegree.cc:22
Definition: lists.h:22
scmon * scfmon
Definition: hutil.h:20
#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:580
monf hCreate(int Nvar)
Definition: hutil.cc:1002
int hNvar
Definition: hutil.cc:22
void * ADDRESS
Definition: auxiliary.h:118
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:90
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:33
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:19
int i
Definition: cfEzgcd.cc:123
Definition: tok.h:99
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:93
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 4456 of file ipshell.cc.

4457 {
4458  sleftv tmp;
4459  memset(&tmp,0,sizeof(tmp));
4460  tmp.rtyp=INT_CMD;
4461  /* tmp.data = (void *)0; -- done by memset */
4462 
4463  return semicProc3(res,u,v,&tmp);
4464 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
Definition: tok.h:94
BOOLEAN semicProc3(leftv res, leftv u, leftv v, leftv w)
Definition: ipshell.cc:4416
poly res
Definition: myNF.cc:322
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
int rtyp
Definition: subexpr.h:93

§ semicProc3()

BOOLEAN semicProc3 ( leftv  ,
leftv  ,
leftv  ,
leftv   
)

Definition at line 4416 of file ipshell.cc.

4417 {
4418  semicState state;
4419  BOOLEAN qh=(((int)(long)w->Data())==1);
4420 
4421  // -----------------
4422  // check arguments
4423  // -----------------
4424 
4425  lists l1 = (lists)u->Data( );
4426  lists l2 = (lists)v->Data( );
4427 
4428  if( (state=list_is_spectrum( l1 ))!=semicOK )
4429  {
4430  WerrorS( "first argument is not a spectrum" );
4431  list_error( state );
4432  }
4433  else if( (state=list_is_spectrum( l2 ))!=semicOK )
4434  {
4435  WerrorS( "second argument is not a spectrum" );
4436  list_error( state );
4437  }
4438  else
4439  {
4440  spectrum s1= spectrumFromList( l1 );
4441  spectrum s2= spectrumFromList( l2 );
4442 
4443  res->rtyp = INT_CMD;
4444  if (qh)
4445  res->data = (void*)(long)(s1.mult_spectrumh( s2 ));
4446  else
4447  res->data = (void*)(long)(s1.mult_spectrum( s2 ));
4448  }
4449 
4450  // -----------------
4451  // check status
4452  // -----------------
4453 
4454  return (state!=semicOK);
4455 }
Definition: tok.h:94
Definition: lists.h:22
spectrum spectrumFromList(lists l)
Definition: ipshell.cc:3289
void list_error(semicState state)
Definition: ipshell.cc:3373
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:4158
int mult_spectrumh(spectrum &)
Definition: semic.cc:425
semicState
Definition: ipshell.cc:3339
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:88
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:97
const struct soptionStruct optionStruct[]
Definition: misc_ip.cc:516
#define OPT_OLDSTD
Definition: options.h:81
#define TRUE
Definition: auxiliary.h:101
void * ADDRESS
Definition: auxiliary.h:118
unsigned setval
Definition: ipid.h:152
unsigned resetval
Definition: ipid.h:153
int Typ()
Definition: subexpr.cc:979
#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:537
void * data
Definition: subexpr.h:90
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:89
#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
Definition: tok.h:99
leftv next
Definition: subexpr.h:88
#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:93
void * Data()
Definition: subexpr.cc:1121
#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:679
#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:118
#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:403
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:119
#define NULL
Definition: omList.c:10
char * iiGetLibName(procinfov pi)
Definition: iplib.cc:101
#define SEEK_SET
Definition: mod2.h:123
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 4333 of file ipshell.cc.

4334 {
4335  semicState state;
4336 
4337  // -----------------
4338  // check arguments
4339  // -----------------
4340 
4341  lists l1 = (lists)first->Data( );
4342  lists l2 = (lists)second->Data( );
4343 
4344  if( (state=list_is_spectrum( l1 )) != semicOK )
4345  {
4346  WerrorS( "first argument is not a spectrum:" );
4347  list_error( state );
4348  }
4349  else if( (state=list_is_spectrum( l2 )) != semicOK )
4350  {
4351  WerrorS( "second argument is not a spectrum:" );
4352  list_error( state );
4353  }
4354  else
4355  {
4356  spectrum s1= spectrumFromList ( l1 );
4357  spectrum s2= spectrumFromList ( l2 );
4358  spectrum sum( s1+s2 );
4359 
4360  result->rtyp = LIST_CMD;
4361  result->data = (char*)(getList(sum));
4362  }
4363 
4364  return (state!=semicOK);
4365 }
Definition: lists.h:22
spectrum spectrumFromList(lists l)
Definition: ipshell.cc:3289
void list_error(semicState state)
Definition: ipshell.cc:3373
void WerrorS(const char *s)
Definition: feFopen.cc:24
Definition: semic.h:63
lists getList(spectrum &spec)
Definition: ipshell.cc:3301
semicState list_is_spectrum(lists l)
Definition: ipshell.cc:4158
semicState
Definition: ipshell.cc:3339
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:116
return result
Definition: facAbsBiFact.cc:76

§ spectrumfProc()

BOOLEAN spectrumfProc ( leftv  ,
leftv   
)

Definition at line 4089 of file ipshell.cc.

4090 {
4091  spectrumState state = spectrumOK;
4092 
4093  // -------------------
4094  // check consistency
4095  // -------------------
4096 
4097  // check for a local polynomial ring
4098 
4099  if( currRing->OrdSgn != -1 )
4100  // ?? HS: the test above is also true for k[x][[y]], k[[x]][y]
4101  // or should we use:
4102  //if( !ringIsLocal( ) )
4103  {
4104  WerrorS( "only works for local orderings" );
4105  state = spectrumWrongRing;
4106  }
4107  else if( currRing->qideal != NULL )
4108  {
4109  WerrorS( "does not work in quotient rings" );
4110  state = spectrumWrongRing;
4111  }
4112  else
4113  {
4114  lists L = (lists)NULL;
4115  int flag = 2; // symmetric optimization
4116 
4117  state = spectrumCompute( (poly)first->Data( ),&L,flag );
4118 
4119  if( state==spectrumOK )
4120  {
4121  result->rtyp = LIST_CMD;
4122  result->data = (char*)L;
4123  }
4124  else
4125  {
4126  spectrumPrintError(state);
4127  }
4128  }
4129 
4130  return (state!=spectrumOK);
4131 }
spectrumState
Definition: ipshell.cc:3455
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:4007
spectrumState spectrumCompute(poly h, lists *L, int fast)
Definition: ipshell.cc:3715
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:116
polyrec * poly
Definition: hilb.h:10
return result
Definition: facAbsBiFact.cc:76

§ spectrumProc()

BOOLEAN spectrumProc ( leftv  ,
leftv   
)

Definition at line 4038 of file ipshell.cc.

4039 {
4040  spectrumState state = spectrumOK;
4041 
4042  // -------------------
4043  // check consistency
4044  // -------------------
4045 
4046  // check for a local ring
4047 
4048  if( !ringIsLocal(currRing ) )
4049  {
4050  WerrorS( "only works for local orderings" );
4051  state = spectrumWrongRing;
4052  }
4053 
4054  // no quotient rings are allowed
4055 
4056  else if( currRing->qideal != NULL )
4057  {
4058  WerrorS( "does not work in quotient rings" );
4059  state = spectrumWrongRing;
4060  }
4061  else
4062  {
4063  lists L = (lists)NULL;
4064  int flag = 1; // weight corner optimization is safe
4065 
4066  state = spectrumCompute( (poly)first->Data( ),&L,flag );
4067 
4068  if( state==spectrumOK )
4069  {
4070  result->rtyp = LIST_CMD;
4071  result->data = (char*)L;
4072  }
4073  else
4074  {
4075  spectrumPrintError(state);
4076  }
4077  }
4078 
4079  return (state!=spectrumOK);
4080 }
spectrumState
Definition: ipshell.cc:3455
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:4007
spectrumState spectrumCompute(poly h, lists *L, int fast)
Definition: ipshell.cc:3715
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:116
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 4375 of file ipshell.cc.

4376 {
4377  semicState state;
4378 
4379  // -----------------
4380  // check arguments
4381  // -----------------
4382 
4383  lists l = (lists)first->Data( );
4384  int k = (int)(long)second->Data( );
4385 
4386  if( (state=list_is_spectrum( l ))!=semicOK )
4387  {
4388  WerrorS( "first argument is not a spectrum" );
4389  list_error( state );
4390  }
4391  else if( k < 0 )
4392  {
4393  WerrorS( "second argument should be positive" );
4394  state = semicMulNegative;
4395  }
4396  else
4397  {
4398  spectrum s= spectrumFromList( l );
4399  spectrum product( k*s );
4400 
4401  result->rtyp = LIST_CMD;
4402  result->data = (char*)getList(product);
4403  }
4404 
4405  return (state!=semicOK);
4406 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
Definition: lists.h:22
spectrum spectrumFromList(lists l)
Definition: ipshell.cc:3289
void list_error(semicState state)
Definition: ipshell.cc:3373
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:3301
semicState list_is_spectrum(lists l)
Definition: ipshell.cc:4158
semicState
Definition: ipshell.cc:3339
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:116
return result
Definition: facAbsBiFact.cc:76
int l
Definition: cfEzgcd.cc:94

§ syBetti1()

BOOLEAN syBetti1 ( leftv  res,
leftv  u 
)

Definition at line 3076 of file ipshell.cc.

3077 {
3078  sleftv tmp;
3079  memset(&tmp,0,sizeof(tmp));
3080  tmp.rtyp=INT_CMD;
3081  tmp.data=(void *)1;
3082  return syBetti2(res,u,&tmp);
3083 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
Definition: tok.h:94
void * data
Definition: subexpr.h:90
BOOLEAN syBetti2(leftv res, leftv u, leftv w)
Definition: ipshell.cc:3053
int rtyp
Definition: subexpr.h:93

§ syBetti2()

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

Definition at line 3053 of file ipshell.cc.

3054 {
3055  syStrategy syzstr=(syStrategy)u->Data();
3056 
3057  BOOLEAN minim=(int)(long)w->Data();
3058  int row_shift=0;
3059  int add_row_shift=0;
3060  intvec *weights=NULL;
3061  intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3062  if (ww!=NULL)
3063  {
3064  weights=ivCopy(ww);
3065  add_row_shift = ww->min_in();
3066  (*weights) -= add_row_shift;
3067  }
3068 
3069  res->data=(void *)syBettiOfComputation(syzstr,minim,&row_shift,weights);
3070  //row_shift += add_row_shift;
3071  //Print("row_shift=%d, add_row_shift=%d\n",row_shift,add_row_shift);
3072  atSet(res,omStrDup("rowShift"),(void*)(long)add_row_shift,INT_CMD);
3073 
3074  return FALSE;
3075 }
void atSet(idhdl root, const char *name, void *data, int typ)
Definition: attrib.cc:156
Definition: tok.h:94
#define FALSE
Definition: auxiliary.h:97
intvec * ivCopy(const intvec *o)
Definition: intvec.h:126
int min_in()
Definition: intvec.h:113
void * data
Definition: subexpr.h:90
Definition: intvec.h:14
Definition: tok.h:99
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:135
#define NULL
Definition: omList.c:10
intvec * syBettiOfComputation(syStrategy syzstr, BOOLEAN minim=TRUE, int *row_shift=NULL, intvec *weights=NULL)
Definition: syz1.cc:1767
void * Data()
Definition: subexpr.cc:1121
int BOOLEAN
Definition: auxiliary.h:88
ssyStrategy * syStrategy
Definition: syz.h:35
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ syConvList()

syStrategy syConvList ( lists  li)

Definition at line 3161 of file ipshell.cc.

3162 {
3163  int typ0;
3165 
3166  resolvente fr = liFindRes(li,&(result->length),&typ0,&(result->weights));
3167  if (fr != NULL)
3168  {
3169 
3170  result->fullres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
3171  for (int i=result->length-1;i>=0;i--)
3172  {
3173  if (fr[i]!=NULL)
3174  result->fullres[i] = idCopy(fr[i]);
3175  }
3176  result->list_length=result->length;
3177  omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
3178  }
3179  else
3180  {
3181  omFreeSize(result, sizeof(ssyStrategy));
3182  result = NULL;
3183  }
3184  return result;
3185 }
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:118
int i
Definition: cfEzgcd.cc:123
resolvente fullres
Definition: syz.h:57
ideal idCopy(ideal A)
Definition: ideals.h:62
#define NULL
Definition: omList.c:10
short list_length
Definition: syz.h:62
ideal * resolvente
Definition: ideals.h:20
#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 3088 of file ipshell.cc.

3089 {
3090  resolvente fullres = syzstr->fullres;
3091  resolvente minres = syzstr->minres;
3092 
3093  const int length = syzstr->length;
3094 
3095  if ((fullres==NULL) && (minres==NULL))
3096  {
3097  if (syzstr->hilb_coeffs==NULL)
3098  { // La Scala
3099  fullres = syReorder(syzstr->res, length, syzstr);
3100  }
3101  else
3102  { // HRES
3103  minres = syReorder(syzstr->orderedRes, length, syzstr);
3104  syKillEmptyEntres(minres, length);
3105  }
3106  }
3107 
3108  resolvente tr;
3109  int typ0=IDEAL_CMD;
3110 
3111  if (minres!=NULL)
3112  tr = minres;
3113  else
3114  tr = fullres;
3115 
3116  resolvente trueres=NULL; intvec ** w=NULL;
3117 
3118  if (length>0)
3119  {
3120  trueres = (resolvente)omAlloc0((length)*sizeof(ideal));
3121  for (int i=(length)-1;i>=0;i--)
3122  {
3123  if (tr[i]!=NULL)
3124  {
3125  trueres[i] = idCopy(tr[i]);
3126  }
3127  }
3128  if ( id_RankFreeModule(trueres[0], currRing) > 0)
3129  typ0 = MODUL_CMD;
3130  if (syzstr->weights!=NULL)
3131  {
3132  w = (intvec**)omAlloc0(length*sizeof(intvec*));
3133  for (int i=length-1;i>=0;i--)
3134  {
3135  if (syzstr->weights[i]!=NULL) w[i] = ivCopy(syzstr->weights[i]);
3136  }
3137  }
3138  }
3139 
3140  lists li = liMakeResolv(trueres, length, syzstr->list_length,typ0,
3141  w, add_row_shift);
3142 
3143  if (w != NULL) omFreeSize(w, length*sizeof(intvec*));
3144 
3145  if (toDel)
3146  syKillComputation(syzstr);
3147  else
3148  {
3149  if( fullres != NULL && syzstr->fullres == NULL )
3150  syzstr->fullres = fullres;
3151 
3152  if( minres != NULL && syzstr->minres == NULL )
3153  syzstr->minres = minres;
3154  }
3155  return li;
3156 }
int length
Definition: syz.h:60
intvec ** weights
Definition: syz.h:45
resolvente syReorder(resolvente res, int length, syStrategy syzstr, BOOLEAN toCopy=TRUE, resolvente totake=NULL)
Definition: syz1.cc:1653
Definition: lists.h:22
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
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:62
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:20
void syKillEmptyEntres(resolvente res, int length)
Definition: syz1.cc:2209
void syKillComputation(syStrategy syzstr, ring r=currRing)
Definition: syz1.cc:1497
#define omAlloc0(size)
Definition: omAllocDecl.h:211

§ syForceMin()

syStrategy syForceMin ( lists  li)

Definition at line 3190 of file ipshell.cc.

3191 {
3192  int typ0;
3194 
3195  resolvente fr = liFindRes(li,&(result->length),&typ0);
3196  result->minres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
3197  for (int i=result->length-1;i>=0;i--)
3198  {
3199  if (fr[i]!=NULL)
3200  result->minres[i] = idCopy(fr[i]);
3201  }
3202  omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
3203  return result;
3204 }
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:118
int i
Definition: cfEzgcd.cc:123
ideal idCopy(ideal A)
Definition: ideals.h:62
resolvente minres
Definition: syz.h:58
#define NULL
Definition: omList.c:10
ideal * resolvente
Definition: ideals.h:20
#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 508 of file ipshell.cc.

509 {
510  int ii;
511 
512  if (i<0)
513  {
514  ii= -i;
515  if (ii < 32)
516  {
517  si_opt_1 &= ~Sy_bit(ii);
518  }
519  else if (ii < 64)
520  {
521  si_opt_2 &= ~Sy_bit(ii-32);
522  }
523  else
524  WerrorS("out of bounds\n");
525  }
526  else if (i<32)
527  {
528  ii=i;
529  if (Sy_bit(ii) & kOptions)
530  {
531  Warn("Gerhard, use the option command");
532  si_opt_1 |= Sy_bit(ii);
533  }
534  else if (Sy_bit(ii) & validOpts)
535  si_opt_1 |= Sy_bit(ii);
536  }
537  else if (i<64)
538  {
539  ii=i-32;
540  si_opt_2 |= Sy_bit(ii);
541  }
542  else
543  WerrorS("out of bounds\n");
544 }
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 128 of file gentable.cc.

129 {
130  if (tok < 0)
131  {
132  return cmds[0].name;
133  }
134  if (tok==COMMAND) return "command";
135  if (tok==ANY_TYPE) return "any_type";
136  if (tok==NONE) return "nothing";
137  //if (tok==IFBREAK) return "if_break";
138  //if (tok==VECTOR_FROM_POLYS) return "vector_from_polys";
139  //if (tok==ORDER_VECTOR) return "ordering";
140  //if (tok==REF_VAR) return "ref";
141  //if (tok==OBJECT) return "object";
142  //if (tok==PRINT_EXPR) return "print_expr";
143  if (tok==IDHDL) return "identifier";
144  #ifdef SINGULAR_4_1
145  //if (tok==CRING_CMD) return "Ring";
146  #endif
147  // we do not blackbox objects during table generation:
148  //if (tok>MAX_TOK) return getBlackboxName(tok);
149  int i = 0;
150  while (cmds[i].tokval!=0)
151  {
152  if ((cmds[i].tokval == tok)&&(cmds[i].alias==0))
153  {
154  return cmds[i].name;
155  }
156  i++;
157  }
158  i=0;// try again for old/alias names:
159  while (cmds[i].tokval!=0)
160  {
161  if (cmds[i].tokval == tok)
162  {
163  return cmds[i].name;
164  }
165  i++;
166  }
167  #if 0
168  char *s=(char*)malloc(10);
169  sprintf(s,"(%d)",tok);
170  return s;
171  #else
172  return cmds[0].name;
173  #endif
174 }
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:894
#define NONE
Definition: tok.h:216
#define COMMAND
Definition: tok.h:29

§ type_cmd()

void type_cmd ( leftv  v)

Definition at line 244 of file ipshell.cc.

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

§ 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_VOIDP*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:92
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:432
int siRandomStart
Definition: cntrlc.cc:103
char * StringEndS()
Definition: reporter.cc:151
void feStringAppendBrowsers(int warn)
Definition: fehelp.cc:352
#define MDEBUG
Definition: mod2.h:194
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:19
const char * singular_date
Definition: misc_ip.cc:775
#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 712 of file table.h.

§ dArithM

struct sValCmdM dArithM[]

Definition at line 821 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 227 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.