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 68 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 59 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 76 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 86 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 94 of file gentable.cc.

Data Fields
short arg
int p
proc1 p
short res

§ sValAssign

struct sValAssign

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

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

§ iiAddCproc()

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

Definition at line 897 of file iplib.cc.

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

§ iiAlias()

BOOLEAN iiAlias ( leftv  p)

Definition at line 751 of file ipid.cc.

752 {
753  if (iiCurrArgs==NULL)
754  {
755  Werror("not enough arguments for proc %s",VoiceName());
756  p->CleanUp();
757  return TRUE;
758  }
760  iiCurrArgs=h->next;
761  h->next=NULL;
762  if (h->rtyp!=IDHDL)
763  {
764  BOOLEAN res=iiAssign(p,h);
765  h->CleanUp();
767  return res;
768  }
769  if ((h->Typ()!=p->Typ()) &&(p->Typ()!=DEF_CMD))
770  {
771  WerrorS("type mismatch");
772  return TRUE;
773  }
774  idhdl pp=(idhdl)p->data;
775  switch(pp->typ)
776  {
777 #ifdef SINGULAR_4_1
778  case CRING_CMD:
779  nKillChar((coeffs)pp);
780  break;
781 #endif
782  case DEF_CMD:
783  case INT_CMD:
784  break;
785  case INTVEC_CMD:
786  case INTMAT_CMD:
787  delete IDINTVEC(pp);
788  break;
789  case NUMBER_CMD:
790  nDelete(&IDNUMBER(pp));
791  break;
792  case BIGINT_CMD:
794  break;
795  case MAP_CMD:
796  {
797  map im = IDMAP(pp);
798  omFree((ADDRESS)im->preimage);
799  }
800  // continue as ideal:
801  case IDEAL_CMD:
802  case MODUL_CMD:
803  case MATRIX_CMD:
804  idDelete(&IDIDEAL(pp));
805  break;
806  case PROC_CMD:
807  case RESOLUTION_CMD:
808  case STRING_CMD:
809  omFree((ADDRESS)IDSTRING(pp));
810  break;
811  case LIST_CMD:
812  IDLIST(pp)->Clean();
813  break;
814  case LINK_CMD:
816  break;
817  // case ring: cannot happen
818  default:
819  Werror("unknown type %d",p->Typ());
820  return TRUE;
821  }
822  pp->typ=ALIAS_CMD;
823  IDDATA(pp)=(char*)h->data;
824  int eff_typ=h->Typ();
825  if ((RingDependend(eff_typ))
826  || ((eff_typ==LIST_CMD) && (lRingDependend((lists)h->Data()))))
827  {
828  ipSwapId(pp,IDROOT,currRing->idroot);
829  }
830  h->CleanUp();
832  return FALSE;
833 }
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:400
#define IDLIST(a)
Definition: ipid.h:134
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:95
#define IDLINK(a)
Definition: ipid.h:135
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
Definition: lists.h:22
#define IDINTVEC(a)
Definition: ipid.h:125
#define FALSE
Definition: auxiliary.h:95
Definition: tok.h:38
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:99
#define IDIDEAL(a)
Definition: ipid.h:130
void * ADDRESS
Definition: auxiliary.h:116
void WerrorS(const char *s)
Definition: feFopen.cc:24
coeffs coeffs_BIGINT
Definition: ipid.cc:54
int Typ()
Definition: subexpr.cc:1004
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
poly pp
Definition: myNF.cc:296
void * data
Definition: subexpr.h:89
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int RingDependend(int t)
Definition: gentable.cc:23
Definition: tok.h:56
Definition: tok.h:58
#define omFree(addr)
Definition: omAllocDecl.h:261
The main handler for Singular numbers which are suitable for Singular polynomials.
#define IDSTRING(a)
Definition: ipid.h:133
idrec * idhdl
Definition: ring.h:18
omBin sleftv_bin
Definition: subexpr.cc:50
const char * VoiceName()
Definition: fevoices.cc:66
#define nDelete(n)
Definition: numbers.h:16
#define IDMAP(a)
Definition: ipid.h:132
leftv next
Definition: subexpr.h:87
#define IDNUMBER(a)
Definition: ipid.h:129
Definition: tok.h:34
Definition: tok.h:116
#define NULL
Definition: omList.c:10
leftv iiCurrArgs
Definition: ipshell.cc:80
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:335
void * Data()
Definition: subexpr.cc:1146
int typ
Definition: idrec.h:43
Definition: tok.h:117
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
#define IDDATA(a)
Definition: ipid.h:123
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:86
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
Definition: ipid.cc:587
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:496
void Werror(const char *fmt,...)
Definition: reporter.cc:189
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1792

§ iiAllStart()

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

Definition at line 311 of file iplib.cc.

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

6324 {
6325  memset(res,0,sizeof(sleftv));
6326  res->rtyp=a->Typ();
6327  switch (res->rtyp /*a->Typ()*/)
6328  {
6329  case INTVEC_CMD:
6330  case INTMAT_CMD:
6331  return iiApplyINTVEC(res,a,op,proc);
6332  case BIGINTMAT_CMD:
6333  return iiApplyBIGINTMAT(res,a,op,proc);
6334  case IDEAL_CMD:
6335  case MODUL_CMD:
6336  case MATRIX_CMD:
6337  return iiApplyIDEAL(res,a,op,proc);
6338  case LIST_CMD:
6339  return iiApplyLIST(res,a,op,proc);
6340  }
6341  WerrorS("first argument to `apply` must allow an index");
6342  return TRUE;
6343 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define TRUE
Definition: auxiliary.h:99
void WerrorS(const char *s)
Definition: feFopen.cc:24
int Typ()
Definition: subexpr.cc:1004
BOOLEAN iiApplyBIGINTMAT(leftv, leftv, int, leftv)
Definition: ipshell.cc:6281
BOOLEAN iiApplyLIST(leftv res, leftv a, int op, leftv proc)
Definition: ipshell.cc:6291
BOOLEAN iiApplyIDEAL(leftv, leftv, int, leftv)
Definition: ipshell.cc:6286
int rtyp
Definition: subexpr.h:92
Definition: tok.h:117
BOOLEAN iiApplyINTVEC(leftv res, leftv a, int op, leftv proc)
Definition: ipshell.cc:6249

§ iiARROW()

BOOLEAN iiARROW ( leftv  ,
char *  ,
char *   
)

Definition at line 6372 of file ipshell.cc.

6373 {
6374  char *ss=(char*)omAlloc(strlen(a)+strlen(s)+30); /* max. 27 currently */
6375  // find end of s:
6376  int end_s=strlen(s);
6377  while ((end_s>0) && ((s[end_s]<=' ')||(s[end_s]==';'))) end_s--;
6378  s[end_s+1]='\0';
6379  char *name=(char *)omAlloc(strlen(a)+strlen(s)+30);
6380  sprintf(name,"%s->%s",a,s);
6381  // find start of last expression
6382  int start_s=end_s-1;
6383  while ((start_s>=0) && (s[start_s]!=';')) start_s--;
6384  if (start_s<0) // ';' not found
6385  {
6386  sprintf(ss,"parameter def %s;return(%s);\n",a,s);
6387  }
6388  else // s[start_s] is ';'
6389  {
6390  s[start_s]='\0';
6391  sprintf(ss,"parameter def %s;%s;return(%s);\n",a,s,s+start_s+1);
6392  }
6393  memset(r,0,sizeof(*r));
6394  // now produce procinfo for PROC_CMD:
6395  r->data = (void *)omAlloc0Bin(procinfo_bin);
6396  ((procinfo *)(r->data))->language=LANG_NONE;
6397  iiInitSingularProcinfo((procinfo *)r->data,"",name,0,0);
6398  ((procinfo *)r->data)->data.s.body=ss;
6399  omFree(name);
6400  r->rtyp=PROC_CMD;
6401  //r->rtyp=STRING_CMD;
6402  //r->data=ss;
6403  return FALSE;
6404 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:95
procinfo * iiInitSingularProcinfo(procinfov pi, const char *libname, const char *procname, int, long pos, BOOLEAN pstatic)
Definition: iplib.cc:883
#define omAlloc(size)
Definition: omAllocDecl.h:210
omBin procinfo_bin
Definition: subexpr.cc:51
const ring r
Definition: syzextra.cc:208
#define omFree(addr)
Definition: omAllocDecl.h:261
char name(const Variable &v)
Definition: factory.h:178
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206

§ iiAssign()

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

Definition at line 1792 of file ipassign.cc.

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

6407 {
6408  char* ring_name=omStrDup((char*)r->Name());
6409  int t=arg->Typ();
6410  if (t==RING_CMD)
6411  {
6412  sleftv tmp;
6413  memset(&tmp,0,sizeof(tmp));
6414  tmp.rtyp=IDHDL;
6415  tmp.data=(char*)rDefault(ring_name);
6416  if (tmp.data!=NULL)
6417  {
6418  BOOLEAN b=iiAssign(&tmp,arg);
6419  if (b) return TRUE;
6420  rSetHdl(ggetid(ring_name));
6421  omFree(ring_name);
6422  return FALSE;
6423  }
6424  else
6425  return TRUE;
6426  }
6427  #ifdef SINGULAR_4_1
6428  else if (t==CRING_CMD)
6429  {
6430  sleftv tmp;
6431  sleftv n;
6432  memset(&n,0,sizeof(n));
6433  n.name=ring_name;
6434  if (iiDeclCommand(&tmp,&n,myynest,CRING_CMD,&IDROOT)) return TRUE;
6435  if (iiAssign(&tmp,arg)) return TRUE;
6436  //Print("create %s\n",r->Name());
6437  //Print("from %s(%d)\n",Tok2Cmdname(arg->Typ()),arg->Typ());
6438  return FALSE;
6439  }
6440  #endif
6441  //Print("create %s\n",r->Name());
6442  //Print("from %s(%d)\n",Tok2Cmdname(arg->Typ()),arg->Typ());
6443  return TRUE;// not handled -> error for now
6444 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:95
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:99
#define IDHDL
Definition: tok.h:31
idhdl rDefault(const char *s)
Definition: ipshell.cc:1527
void * data
Definition: subexpr.h:89
int myynest
Definition: febase.cc:46
Definition: tok.h:56
const ring r
Definition: syzextra.cc:208
const char * name
Definition: subexpr.h:88
#define omFree(addr)
Definition: omAllocDecl.h:261
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition: ipshell.cc:1128
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void rSetHdl(idhdl h)
Definition: ipshell.cc:5021
int BOOLEAN
Definition: auxiliary.h:86
const poly b
Definition: syzextra.cc:213
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)
Definition: ipid.cc:498
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1792
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ iiBranchTo()

BOOLEAN iiBranchTo ( leftv  r,
leftv  args 
)

Definition at line 1185 of file ipshell.cc.

1186 {
1187  // <string1...stringN>,<proc>
1188  // known: args!=NULL, l>=1
1189  int l=args->listLength();
1190  int ll=0;
1191  if (iiCurrArgs!=NULL) ll=iiCurrArgs->listLength();
1192  if (ll!=(l-1)) return FALSE;
1193  leftv h=args;
1194  short *t=(short*)omAlloc(l*sizeof(short));
1195  t[0]=l-1;
1196  int b;
1197  int i;
1198  for(i=1;i<l;i++,h=h->next)
1199  {
1200  if (h->Typ()!=STRING_CMD)
1201  {
1202  omFree(t);
1203  Werror("arg %d is not a string",i);
1204  return TRUE;
1205  }
1206  int tt;
1207  b=IsCmd((char *)h->Data(),tt);
1208  if(b) t[i]=tt;
1209  else
1210  {
1211  omFree(t);
1212  Werror("arg %d is not a type name",i);
1213  return TRUE;
1214  }
1215  }
1216  if (h->Typ()!=PROC_CMD)
1217  {
1218  omFree(t);
1219  Werror("last arg (%d) is not a proc",i);
1220  return TRUE;
1221  }
1222  b=iiCheckTypes(iiCurrArgs,t,0);
1223  omFree(t);
1224  if (b && (h->rtyp==IDHDL) && (h->e==NULL))
1225  {
1226  BOOLEAN err;
1227  //Print("branchTo: %s\n",h->Name());
1228  iiCurrProc=(idhdl)h->data;
1230  if( pi->data.s.body==NULL )
1231  {
1233  if (pi->data.s.body==NULL) return TRUE;
1234  }
1235  if ((pi->pack!=NULL)&&(currPack!=pi->pack))
1236  {
1237  currPack=pi->pack;
1240  //Print("set pack=%s\n",IDID(currPackHdl));
1241  }
1242  err=iiAllStart(pi,pi->data.s.body,BT_proc,pi->data.s.body_lineno-(iiCurrArgs==NULL));
1244  if (iiCurrArgs!=NULL)
1245  {
1246  if (!err) Warn("too many arguments for %s",IDID(iiCurrProc));
1247  iiCurrArgs->CleanUp();
1249  iiCurrArgs=NULL;
1250  }
1251  return 2-err;
1252  }
1253  return FALSE;
1254 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
idhdl currPackHdl
Definition: ipid.cc:61
#define IDID(a)
Definition: ipid.h:119
#define FALSE
Definition: auxiliary.h:95
int listLength()
Definition: subexpr.cc:61
#define TRUE
Definition: auxiliary.h:99
void * ADDRESS
Definition: auxiliary.h:116
#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:81
#define omFree(addr)
Definition: omAllocDecl.h:261
idrec * idhdl
Definition: ring.h:18
omBin sleftv_bin
Definition: subexpr.cc:50
int i
Definition: cfEzgcd.cc:123
leftv next
Definition: subexpr.h:87
BOOLEAN iiAllStart(procinfov pi, char *p, feBufferTypes t, int l)
Definition: iplib.cc:311
#define IDPROC(a)
Definition: ipid.h:137
#define pi
Definition: libparse.cc:1143
#define NULL
Definition: omList.c:10
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
Definition: ipshell.cc:6464
package currPack
Definition: ipid.cc:63
leftv iiCurrArgs
Definition: ipshell.cc:80
void CleanUp(ring r=currRing)
Definition: subexpr.cc:335
idhdl packFindHdl(package r)
Definition: ipid.cc:738
void iiCheckPack(package &p)
Definition: ipshell.cc:1513
#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:86
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:8688
#define Warn
Definition: emacs.cc:80

§ iiCheckPack()

void iiCheckPack ( package p)

Definition at line 1513 of file ipshell.cc.

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

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

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

§ iiConvName()

char* iiConvName ( const char *  libname)

Definition at line 1190 of file iplib.cc.

1191 {
1192  char *tmpname = omStrDup(libname);
1193  char *p = strrchr(tmpname, DIR_SEP);
1194  char *r;
1195  if(p==NULL) p = tmpname;
1196  else p++;
1197  r = (char *)strchr(p, '.');
1198  if( r!= NULL) *r = '\0';
1199  r = omStrDup(p);
1200  *r = mytoupper(*r);
1201  // printf("iiConvName: '%s' '%s' => '%s'\n", libname, tmpname, r);
1202  omFree((ADDRESS)tmpname);
1203 
1204  return(r);
1205 }
char mytoupper(char c)
Definition: iplib.cc:1171
return P p
Definition: myNF.cc:203
void * ADDRESS
Definition: auxiliary.h:116
#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 990 of file ipshell.cc.

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

1129 {
1130  BOOLEAN res=FALSE;
1131  const char *id = name->name;
1132 
1133  memset(sy,0,sizeof(sleftv));
1134  if ((name->name==NULL)||(isdigit(name->name[0])))
1135  {
1136  WerrorS("object to declare is not a name");
1137  res=TRUE;
1138  }
1139  else
1140  {
1141  if (t==QRING_CMD) t=RING_CMD; // qring is always RING_CMD
1142 
1143  if (TEST_V_ALLWARN
1144  && (name->rtyp!=0)
1145  && (name->rtyp!=IDHDL)
1146  && (currRingHdl!=NULL) && (IDLEV(currRingHdl)==myynest))
1147  {
1148  Warn("`%s` is %s in %s:%d:%s",name->name,Tok2Cmdname(name->rtyp),
1150  }
1151  {
1152  sy->data = (char *)enterid(id,lev,t,root,init_b);
1153  }
1154  if (sy->data!=NULL)
1155  {
1156  sy->rtyp=IDHDL;
1157  currid=sy->name=IDID((idhdl)sy->data);
1158  // name->name=NULL; /* used in enterid */
1159  //sy->e = NULL;
1160  if (name->next!=NULL)
1161  {
1163  res=iiDeclCommand(sy->next,name->next,lev,t,root, isring);
1164  }
1165  }
1166  else res=TRUE;
1167  }
1168  name->CleanUp();
1169  return res;
1170 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int yylineno
Definition: febase.cc:45
#define IDID(a)
Definition: ipid.h:119
#define FALSE
Definition: auxiliary.h:95
char * filename
Definition: fevoices.h:62
#define TRUE
Definition: auxiliary.h:99
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:24
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
const char * currid
Definition: grammar.cc:171
void * data
Definition: subexpr.h:89
poly res
Definition: myNF.cc:322
int myynest
Definition: febase.cc:46
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:261
char my_yylinebuf[80]
Definition: febase.cc:48
const char * name
Definition: subexpr.h:88
idhdl currRingHdl
Definition: ipid.cc:65
omBin sleftv_bin
Definition: subexpr.cc:50
#define IDLEV(a)
Definition: ipid.h:118
leftv next
Definition: subexpr.h:87
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition: ipshell.cc:1128
#define NULL
Definition: omList.c:10
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:130
Voice * currentVoice
Definition: fevoices.cc:57
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:335
Definition: tok.h:157
int BOOLEAN
Definition: auxiliary.h:86
#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:380
procinfodata data
Definition: subexpr.h:62
idhdl currRingHdl
Definition: ipid.cc:65
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1572
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:5021
void push(char *)
Definition: ipid.cc:710
void pop()
Definition: ipid.cc:720
int BOOLEAN
Definition: auxiliary.h:86
int si_echo
Definition: febase.cc:41

§ iiExport() [1/2]

BOOLEAN iiExport ( leftv  v,
int  toLev 
)

Definition at line 1389 of file ipshell.cc.

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

§ iiExport() [2/2]

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

Definition at line 1415 of file ipshell.cc.

1416 {
1417 #ifdef SINGULAR_4_1
1418 // if ((pack==basePack)&&(pack!=currPack))
1419 // { Warn("'exportto' to Top is depreciated in >>%s<<",my_yylinebuf);}
1420 #endif
1421  BOOLEAN nok=FALSE;
1422  leftv rv=v;
1423  while (v!=NULL)
1424  {
1425  if ((v->name==NULL)||(v->rtyp==0)||(v->e!=NULL)
1426  )
1427  {
1428  Werror("cannot export:%s of internal type %d",v->name,v->rtyp);
1429  nok=TRUE;
1430  }
1431  else
1432  {
1433  idhdl old=pack->idroot->get( v->name,toLev);
1434  if (old!=NULL)
1435  {
1436  if ((pack==currPack) && (old==(idhdl)v->data))
1437  {
1438  if (BVERBOSE(V_REDEFINE)) Warn("`%s` is already global",IDID(old));
1439  break;
1440  }
1441  else if (IDTYP(old)==v->Typ())
1442  {
1443  if (BVERBOSE(V_REDEFINE))
1444  {
1445  Warn("redefining %s (%s)",IDID(old),my_yylinebuf);
1446  }
1447  v->name=omStrDup(v->name);
1448  killhdl2(old,&(pack->idroot),currRing);
1449  }
1450  else
1451  {
1452  rv->CleanUp();
1453  return TRUE;
1454  }
1455  }
1456  //Print("iiExport: pack=%s\n",IDID(root));
1457  if(iiInternalExport(v, toLev, pack))
1458  {
1459  rv->CleanUp();
1460  return TRUE;
1461  }
1462  }
1463  v=v->next;
1464  }
1465  rv->CleanUp();
1466  return nok;
1467 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Subexpr e
Definition: subexpr.h:106
#define IDID(a)
Definition: ipid.h:119
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
int Typ()
Definition: subexpr.cc:1004
Definition: idrec.h:34
idhdl get(const char *s, int lev)
Definition: ipid.cc:91
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define IDTYP(a)
Definition: ipid.h:116
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:411
char my_yylinebuf[80]
Definition: febase.cc:48
const char * name
Definition: subexpr.h:88
leftv next
Definition: subexpr.h:87
#define BVERBOSE(a)
Definition: options.h:33
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
static BOOLEAN iiInternalExport(leftv v, int toLev)
Definition: ipshell.cc:1291
#define NULL
Definition: omList.c:10
package currPack
Definition: ipid.cc:63
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:335
int BOOLEAN
Definition: auxiliary.h:86
#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 8153 of file iparith.cc.

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

8085 {
8086  leftv b=a->next;
8087  a->next=NULL;
8088  int bt=b->Typ();
8089  BOOLEAN bo=iiExprArith2TabIntern(res,a,op,b,TRUE,dA2,at,bt,dConvertTypes);
8090  a->next=b;
8091  a->CleanUp();
8092  return bo;
8093 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define TRUE
Definition: auxiliary.h:99
int Typ()
Definition: subexpr.cc:1004
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:7925
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
void CleanUp(ring r=currRing)
Definition: subexpr.cc:335
int BOOLEAN
Definition: auxiliary.h:86
const poly b
Definition: syzextra.cc:213

§ iiExprArith3()

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

Definition at line 8490 of file iparith.cc.

8491 {
8492  memset(res,0,sizeof(sleftv));
8493 
8494  if (!errorreported)
8495  {
8496 #ifdef SIQ
8497  if (siq>0)
8498  {
8499  //Print("siq:%d\n",siq);
8501  memcpy(&d->arg1,a,sizeof(sleftv));
8502  //a->Init();
8503  memcpy(&d->arg2,b,sizeof(sleftv));
8504  //b->Init();
8505  memcpy(&d->arg3,c,sizeof(sleftv));
8506  //c->Init();
8507  d->op=op;
8508  d->argc=3;
8509  res->data=(char *)d;
8510  res->rtyp=COMMAND;
8511  return FALSE;
8512  }
8513 #endif
8514  int at=a->Typ();
8515  // handling bb-objects ----------------------------------------------
8516  if (at>MAX_TOK)
8517  {
8518  blackbox *bb=getBlackboxStuff(at);
8519  if (bb!=NULL)
8520  {
8521  if(!bb->blackbox_Op3(op,res,a,b,c)) return FALSE;
8522  if (errorreported) return TRUE;
8523  // else: no op defined
8524  }
8525  else return TRUE;
8526  if (errorreported) return TRUE;
8527  }
8528  int bt=b->Typ();
8529  int ct=c->Typ();
8530 
8531  iiOp=op;
8532  int i=0;
8533  while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
8534  return iiExprArith3TabIntern(res,op,a,b,c,dArith3+i,at,bt,ct,dConvertTypes);
8535  }
8536  a->CleanUp();
8537  b->CleanUp();
8538  c->CleanUp();
8539  //Print("op: %d,result typ:%d\n",op,res->rtyp);
8540  return TRUE;
8541 }
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:8342
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
ip_command * command
Definition: ipid.h:24
const struct sConvertTypes dConvertTypes[]
Definition: table.h:1187
#define FALSE
Definition: auxiliary.h:95
Definition: tok.h:215
BOOLEAN siq
Definition: subexpr.cc:58
#define TRUE
Definition: auxiliary.h:99
int Typ()
Definition: subexpr.cc:1004
void * data
Definition: subexpr.h:89
struct sValCmd3 dArith3[]
Definition: table.h:719
int i
Definition: cfEzgcd.cc:123
short errorreported
Definition: feFopen.cc:23
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define NULL
Definition: omList.c:10
omBin sip_command_bin
Definition: ipid.cc:49
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:335
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 8542 of file iparith.cc.

8546 {
8547  leftv b=a->next;
8548  a->next=NULL;
8549  int bt=b->Typ();
8550  leftv c=b->next;
8551  b->next=NULL;
8552  int ct=c->Typ();
8553  BOOLEAN bo=iiExprArith3TabIntern(res,op,a,b,c,dA3,at,bt,ct,dConvertTypes);
8554  b->next=c;
8555  a->next=b;
8556  a->CleanUp();
8557  return bo;
8558 }
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:8342
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int Typ()
Definition: subexpr.cc:1004
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
void CleanUp(ring r=currRing)
Definition: subexpr.cc:335
int BOOLEAN
Definition: auxiliary.h:86
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 1489 of file ipshell.cc.

1490 {
1491  int i;
1492  if(!idIsZeroDim(I)) return NULL; // not zero-dim.
1493  poly po=NULL;
1495  {
1496  scComputeHC(I,currRing->qideal,ak,po);
1497  if (po!=NULL)
1498  {
1499  pGetCoeff(po)=nInit(1);
1500  for (i=rVar(currRing); i>0; i--)
1501  {
1502  if (pGetExp(po, i) > 0) pDecrExp(po,i);
1503  }
1504  pSetComp(po,ak);
1505  pSetm(po);
1506  }
1507  }
1508  else
1509  po=pOne();
1510  return po;
1511 }
#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:161
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
#define pSetComp(p, v)
Definition: polys.h:38
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h: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 1343 of file ipshell.cc.

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

§ iiLibCmd()

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

Definition at line 718 of file iplib.cc.

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

§ iiLoadLIB()

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

Definition at line 807 of file iplib.cc.

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

§ iiMake_proc()

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

Definition at line 501 of file iplib.cc.

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

§ iiMakeResolv()

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

Definition at line 772 of file ipshell.cc.

774 {
775  lists L=liMakeResolv(r,length,rlen,typ0,weights);
776  int i=0;
777  idhdl h;
778  char * s=(char *)omAlloc(strlen(name)+5);
779 
780  while (i<=L->nr)
781  {
782  sprintf(s,"%s(%d)",name,i+1);
783  if (i==0)
784  h=enterid(s,myynest,typ0,&(currRing->idroot), FALSE);
785  else
786  h=enterid(s,myynest,MODUL_CMD,&(currRing->idroot), FALSE);
787  if (h!=NULL)
788  {
789  h->data.uideal=(ideal)L->m[i].data;
790  h->attribute=L->m[i].attribute;
792  Print("//defining: %s as %d-th syzygy module\n",s,i+1);
793  }
794  else
795  {
796  idDelete((ideal *)&(L->m[i].data));
797  Warn("cannot define %s",s);
798  }
799  //L->m[i].data=NULL;
800  //L->m[i].rtyp=0;
801  //L->m[i].attribute=NULL;
802  i++;
803  }
804  omFreeSize((ADDRESS)L->m,(L->nr+1)*sizeof(sleftv));
806  omFreeSize((ADDRESS)s,strlen(name)+5);
807 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define Print
Definition: emacs.cc:83
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
Definition: lists.h:22
if(0 > strat->sl)
Definition: myNF.cc:73
#define FALSE
Definition: auxiliary.h:95
#define V_DEF_RES
Definition: options.h:48
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:116
#define omAlloc(size)
Definition: omAllocDecl.h:210
Definition: idrec.h:34
void * data
Definition: subexpr.h:89
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:261
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
char name(const Variable &v)
Definition: factory.h:178
#define BVERBOSE(a)
Definition: options.h:33
int nr
Definition: lists.h:43
#define NULL
Definition: omList.c:10
attr attribute
Definition: idrec.h:41
lists liMakeResolv(resolvente r, int length, int reallen, int typ0, intvec **weights, int add_row_shift)
Definition: lists.cc:215
attr attribute
Definition: subexpr.h:90
omBin slists_bin
Definition: lists.cc:23
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
static Poly * h
Definition: janet.cc:978
utypes data
Definition: idrec.h:40
#define Warn
Definition: emacs.cc:80

§ iiMap()

leftv iiMap ( map  theMap,
const char *  what 
)

Definition at line 613 of file ipshell.cc.

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

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

§ iiParameter()

BOOLEAN iiParameter ( leftv  p)

Definition at line 1255 of file ipshell.cc.

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

§ 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:95
void * ADDRESS
Definition: auxiliary.h:116
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define omFree(addr)
Definition: omAllocDecl.h:261
int BOOLEAN
Definition: auxiliary.h:86
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ iiProcName()

char* iiProcName ( char *  buf,
char &  ct,
char *&  e 
)

Definition at line 113 of file iplib.cc.

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

§ iiPStart()

BOOLEAN iiPStart ( idhdl  pn,
sleftv sl 
)

Definition at line 371 of file iplib.cc.

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

§ iiRegularity()

int iiRegularity ( lists  L)

Definition at line 962 of file ipshell.cc.

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

§ iiTestAssume()

BOOLEAN iiTestAssume ( leftv  a,
leftv  b 
)

Definition at line 6345 of file ipshell.cc.

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

§ iiTokType()

int iiTokType ( int  op)

Definition at line 242 of file iparith.cc.

243 {
244  for (unsigned 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 i
Definition: cfEzgcd.cc:123
unsigned nCmdUsed
number of commands used
Definition: iparith.cc:196
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:1056
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:95
Definition: mod_raw.h:16
#define TRUE
Definition: auxiliary.h:99
lib_types type_of_LIB(const char *newlib, char *libnamebuf)
Definition: mod_lib.cc:24
#define omAlloc(size)
Definition: omAllocDecl.h:210
BOOLEAN iiLibCmd(char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force)
Definition: iplib.cc:718
const char * name
Definition: subexpr.h:88
#define omFree(addr)
Definition: omAllocDecl.h:261
int i
Definition: cfEzgcd.cc:123
lib_types
Definition: mod_raw.h:16
char mytolower(char c)
Definition: iplib.cc:1177
#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:1190
int BOOLEAN
Definition: auxiliary.h:86
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition: iplib.cc:958
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ iiTwoOps()

const char* iiTwoOps ( int  t)

Definition at line 254 of file gentable.cc.

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

§ iiWRITE()

BOOLEAN iiWRITE ( leftv  res,
leftv  exprlist 
)

Definition at line 586 of file ipshell.cc.

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

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

§ jjBETTI()

BOOLEAN jjBETTI ( leftv  res,
leftv  v 
)

Definition at line 892 of file ipshell.cc.

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

§ jjBETTI2()

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

Definition at line 926 of file ipshell.cc.

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

§ jjBETTI2_ID()

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

Definition at line 905 of file ipshell.cc.

906 {
908  l->Init(1);
909  l->m[0].rtyp=u->Typ();
910  l->m[0].data=u->Data();
911  attr *a=u->Attribute();
912  if (a!=NULL)
913  l->m[0].attribute=*a;
914  sleftv tmp2;
915  memset(&tmp2,0,sizeof(tmp2));
916  tmp2.rtyp=LIST_CMD;
917  tmp2.data=(void *)l;
918  BOOLEAN r=jjBETTI2(res,&tmp2,v);
919  l->m[0].data=NULL;
920  l->m[0].attribute=NULL;
921  l->m[0].rtyp=DEF_CMD;
922  l->Clean();
923  return r;
924 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
const poly a
Definition: syzextra.cc:212
Definition: attrib.h:15
Definition: lists.h:22
attr * Attribute()
Definition: subexpr.cc:1401
BOOLEAN jjBETTI2(leftv res, leftv u, leftv v)
Definition: ipshell.cc:926
int Typ()
Definition: subexpr.cc:1004
void * data
Definition: subexpr.h:89
const ring r
Definition: syzextra.cc:208
Definition: tok.h:58
CFList tmp2
Definition: facFqBivar.cc:70
INLINE_THIS void Init(int l=0)
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:92
void Clean(ring r=currRing)
Definition: lists.h:25
void * Data()
Definition: subexpr.cc:1146
Definition: tok.h:117
attr attribute
Definition: subexpr.h:90
omBin slists_bin
Definition: lists.cc:23
int BOOLEAN
Definition: auxiliary.h:86
int l
Definition: cfEzgcd.cc:94

§ jjCHARSERIES()

BOOLEAN jjCHARSERIES ( leftv  res,
leftv  u 
)

Definition at line 3256 of file ipshell.cc.

3257 {
3258  res->data=singclap_irrCharSeries((ideal)u->Data(), currRing);
3259  return (res->data==NULL);
3260 }
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
matrix singclap_irrCharSeries(ideal I, const ring r)
Definition: clapsing.cc:1398
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1146

§ jjIMPORTFROM()

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

Definition at line 2184 of file ipassign.cc.

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

§ jjLIST_PL()

BOOLEAN jjLIST_PL ( leftv  res,
leftv  v 
)

Definition at line 7340 of file iparith.cc.

7341 {
7342  int sl=0;
7343  if (v!=NULL) sl = v->listLength();
7344  lists L;
7345  if((sl==1)&&(v->Typ()==RESOLUTION_CMD))
7346  {
7347  int add_row_shift = 0;
7348  intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
7349  if (weights!=NULL) add_row_shift=weights->min_in();
7350  L=syConvRes((syStrategy)v->Data(),FALSE,add_row_shift);
7351  }
7352  else
7353  {
7355  leftv h=NULL;
7356  int i;
7357  int rt;
7358 
7359  L->Init(sl);
7360  for (i=0;i<sl;i++)
7361  {
7362  if (h!=NULL)
7363  { /* e.g. not in the first step:
7364  * h is the pointer to the old sleftv,
7365  * v is the pointer to the next sleftv
7366  * (in this moment) */
7367  h->next=v;
7368  }
7369  h=v;
7370  v=v->next;
7371  h->next=NULL;
7372  rt=h->Typ();
7373  if (rt==0)
7374  {
7375  L->Clean();
7376  Werror("`%s` is undefined",h->Fullname());
7377  return TRUE;
7378  }
7379  if (rt==RING_CMD)
7380  {
7381  L->m[i].rtyp=rt; L->m[i].data=h->Data();
7382  ((ring)L->m[i].data)->ref++;
7383  }
7384  else
7385  L->m[i].Copy(h);
7386  }
7387  }
7388  res->data=(char *)L;
7389  return FALSE;
7390 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:95
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition: ipshell.cc:3092
int listLength()
Definition: subexpr.cc:61
#define TRUE
Definition: auxiliary.h:99
int min_in()
Definition: intvec.h:113
int Typ()
Definition: subexpr.cc:1004
const char * Fullname()
Definition: subexpr.h:126
void * data
Definition: subexpr.h:89
Definition: intvec.h:14
void Copy(leftv e)
Definition: subexpr.cc:695
int i
Definition: cfEzgcd.cc:123
leftv next
Definition: subexpr.h:87
INLINE_THIS void Init(int l=0)
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:135
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:92
void Clean(ring r=currRing)
Definition: lists.h:25
void * Data()
Definition: subexpr.cc:1146
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 5190 of file iparith.cc.

5191 {
5192  char libnamebuf[256];
5193  lib_types LT = type_of_LIB(s, libnamebuf);
5194 
5195 #ifdef HAVE_DYNAMIC_LOADING
5196  extern BOOLEAN load_modules(const char *newlib, char *fullpath, BOOLEAN autoexport);
5197 #endif /* HAVE_DYNAMIC_LOADING */
5198  switch(LT)
5199  {
5200  default:
5201  case LT_NONE:
5202  Werror("%s: unknown type", s);
5203  break;
5204  case LT_NOTFOUND:
5205  Werror("cannot open %s", s);
5206  break;
5207 
5208  case LT_SINGULAR:
5209  {
5210  char *plib = iiConvName(s);
5211  idhdl pl = IDROOT->get(plib,0);
5212  if (pl==NULL)
5213  {
5214  pl = enterid( plib,0, PACKAGE_CMD, &(basePack->idroot), TRUE );
5215  IDPACKAGE(pl)->language = LANG_SINGULAR;
5216  IDPACKAGE(pl)->libname=omStrDup(plib);
5217  }
5218  else if (IDTYP(pl)!=PACKAGE_CMD)
5219  {
5220  Werror("can not create package `%s`",plib);
5221  omFree(plib);
5222  return TRUE;
5223  }
5224  package savepack=currPack;
5225  currPack=IDPACKAGE(pl);
5226  IDPACKAGE(pl)->loaded=TRUE;
5227  char libnamebuf[256];
5228  FILE * fp = feFopen( s, "r", libnamebuf, TRUE );
5229  BOOLEAN bo=iiLoadLIB(fp, libnamebuf, s, pl, autoexport, TRUE);
5230  currPack=savepack;
5231  IDPACKAGE(pl)->loaded=(!bo);
5232  return bo;
5233  }
5234  case LT_BUILTIN:
5235  SModulFunc_t iiGetBuiltinModInit(const char*);
5236  return load_builtin(s,autoexport, iiGetBuiltinModInit(s));
5237  case LT_MACH_O:
5238  case LT_ELF:
5239  case LT_HPUX:
5240 #ifdef HAVE_DYNAMIC_LOADING
5241  return load_modules(s, libnamebuf, autoexport);
5242 #else /* HAVE_DYNAMIC_LOADING */
5243  WerrorS("Dynamic modules are not supported by this version of Singular");
5244  break;
5245 #endif /* HAVE_DYNAMIC_LOADING */
5246  }
5247  return TRUE;
5248 }
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:99
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:261
#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:1056
#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:1190
int BOOLEAN
Definition: auxiliary.h:86
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition: iplib.cc:958
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 5254 of file iparith.cc.

5255 {
5256  void (*WerrorS_save)(const char *s) = WerrorS_callback;
5259  BOOLEAN bo=jjLOAD(s,TRUE);
5260  if (TEST_OPT_PROT && (bo || (WerrorS_dummy_cnt>0)))
5261  Print("loading of >%s< failed\n",s);
5262  WerrorS_callback=WerrorS_save;
5263  errorreported=0;
5264  return FALSE;
5265 }
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:5249
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport)
load lib/module given in v
Definition: iparith.cc:5190
static void WerrorS_dummy(const char *)
Definition: iparith.cc:5250
void(* WerrorS_callback)(const char *s)
Definition: feFopen.cc:21
short errorreported
Definition: feFopen.cc:23
int BOOLEAN
Definition: auxiliary.h:86

§ jjMINRES()

BOOLEAN jjMINRES ( leftv  res,
leftv  v 
)

Definition at line 871 of file ipshell.cc.

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

§ jjRESULTANT()

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

Definition at line 3249 of file ipshell.cc.

3250 {
3251  res->data=singclap_resultant((poly)u->CopyD(),(poly)v->CopyD(),
3252  (poly)w->CopyD(), currRing);
3253  return errorreported;
3254 }
poly singclap_resultant(poly f, poly g, poly x, const ring r)
Definition: clapsing.cc:317
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
short errorreported
Definition: feFopen.cc:23
polyrec * poly
Definition: hilb.h:10
void * CopyD(int t)
Definition: subexpr.cc:714

§ 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 /*===== nc_hilb ===============================================*/
320  // Hilbert series of non-commutative monomial algebras
321  if(strcmp(sys_cmd,"nc_hilb") == 0)
322  {
323  ideal i;
324  int lV;
325  bool ig = FALSE;
326  if((h != NULL)&&(h->Typ() == IDEAL_CMD))
327  i = (ideal)h->Data();
328  else
329  {
330  WerrorS("ideal expected");
331  return TRUE;
332  }
333  h = h->next;
334  if((h != NULL)&&(h->Typ() == INT_CMD))
335  lV = (int)(long)h->Data();
336  else
337  {
338  WerrorS("int expected");
339  return TRUE;
340  }
341  h = h->next;
342  if(h != NULL)
343  ig = TRUE;
344  HilbertSeries_OrbitData(i,lV,ig);
345  return(FALSE);
346  }
347  else
348 /*==================== sh ==================================*/
349  if(strcmp(sys_cmd,"sh")==0)
350  {
351  if (feOptValue(FE_OPT_NO_SHELL))
352  {
353  WerrorS("shell execution is disallowed in restricted mode");
354  return TRUE;
355  }
356  res->rtyp=INT_CMD;
357  if (h==NULL) res->data = (void *)(long) system("sh");
358  else if (h->Typ()==STRING_CMD)
359  res->data = (void*)(long) system((char*)(h->Data()));
360  else
361  WerrorS("string expected");
362  return FALSE;
363  }
364  else
365 /*========reduce procedure like the global one but with jet bounds=======*/
366  if(strcmp(sys_cmd,"reduce_bound")==0)
367  {
368  poly p;
369  ideal pid=NULL;
370  const short t1[]={3,POLY_CMD,IDEAL_CMD,INT_CMD};
371  const short t2[]={3,IDEAL_CMD,IDEAL_CMD,INT_CMD};
372  const short t3[]={3,VECTOR_CMD,MODUL_CMD,INT_CMD};
373  const short t4[]={3,MODUL_CMD,MODUL_CMD,INT_CMD};
374  if ((iiCheckTypes(h,t1,0))||((iiCheckTypes(h,t3,0))))
375  {
376  p = (poly)h->CopyD();
377  }
378  else if ((iiCheckTypes(h,t2,0))||(iiCheckTypes(h,t4,1)))
379  {
380  pid = (ideal)h->CopyD();
381  }
382  else return TRUE;
383  //int htype;
384  res->rtyp= h->Typ(); /*htype*/
385  ideal q = (ideal)h->next->CopyD();
386  int bound = (int)(long)h->next->next->Data();
387  if (pid==NULL) /*(htype == POLY_CMD || htype == VECTOR_CMD)*/
388  res->data = (char *)kNFBound(q,currRing->qideal,p,bound);
389  else /*(htype == IDEAL_CMD || htype == MODUL_CMD)*/
390  res->data = (char *)kNFBound(q,currRing->qideal,pid,bound);
391  return FALSE;
392  }
393  else
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:3426
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
const CanonicalForm int s
Definition: facAbsFact.cc:55
ring rEnvelope(ring R)
Definition: ring.cc:5478
sleftv * m
Definition: lists.h:45
intvec * MivMatrixOrder(intvec *iv)
Definition: walk.cc:972
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2307
void factoryseed(int s)
random seed initializer
Definition: cf_random.cc:176
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define MAXPATHLEN
Definition: omRet2Info.c:22
int HCord
Definition: kutil.cc:235
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
matrix singntl_LLL(matrix m, const ring s)
Definition: clapsing.cc:1737
intvec * Mfpertvector(ideal G, intvec *ivtarget)
Definition: walk.cc:1521
Definition: tok.h:95
static void * feOptValue(feOptIndex opt)
Definition: feOpt.h:40
matrix evRowElim(matrix M, int i, int j, int k)
Definition: eigenval.cc:47
Definition: lists.h:22
ideal Mpwalk(ideal Go, int op_deg, int tp_deg, intvec *curr_weight, intvec *target_weight, int nP, int reduction, int printout)
Definition: walk.cc:5956
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:39
char * versionString()
Definition: misc_ip.cc:778
#define FALSE
Definition: auxiliary.h:95
return P p
Definition: myNF.cc:203
intvec * MivWeightOrderlp(intvec *ivstart)
Definition: walk.cc:1445
BOOLEAN semicProc3(leftv res, leftv u, leftv v, leftv w)
Definition: ipshell.cc:4420
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:5150
#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:4042
#define TRUE
Definition: auxiliary.h:99
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:902
intvec * MivWeightOrderdp(intvec *ivstart)
Definition: walk.cc:1465
BOOLEAN spmulProc(leftv result, leftv first, leftv second)
Definition: ipshell.cc:4379
void * value
Definition: fegetopt.h:93
const char * feSetOptValue(feOptIndex opt, char *optarg)
Definition: feOpt.cc:153
void WerrorS(const char *s)
Definition: feFopen.cc:24
gmp_complex numbers based on
Definition: mpr_complex.h:178
char * StringEndS()
Definition: reporter.cc:151
bool complexNearZero(gmp_complex *c, int digits)
Definition: mpr_complex.cc:767
void lduDecomp(const matrix aMat, matrix &pMat, matrix &lMat, matrix &dMat, matrix &uMat, poly &l, poly &u, poly &lTimesU)
LU-decomposition of a given (m x n)-matrix with performing only those divisions that yield zero remai...
int Typ()
Definition: subexpr.cc:1004
const char * Name()
Definition: subexpr.h:121
matrix evSwap(matrix M, int i, int j)
Definition: eigenval.cc:25
Definition: idrec.h:34
#define ivTest(v)
Definition: intvec.h:149
idhdl get(const char *s, int lev)
Definition: ipid.cc:91
intvec * MPertVectorslp(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1308
void * data
Definition: subexpr.h:89
void printBlackboxTypes()
list all defined type (for debugging)
Definition: blackbox.cc:206
void feStringAppendBrowsers(int warn)
Definition: fehelp.cc:352
ideal Mfwalk(ideal G, intvec *ivstart, intvec *ivtarget, int reduction, int printout)
Definition: walk.cc:8040
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:373
int myynest
Definition: febase.cc:46
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static int rBlocks(ring r)
Definition: ring.h: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:9680
#define FLAG_TWOSTD
Definition: ipid.h:107
Definition: intvec.h:14
int pcvDim(int d0, int d1)
Definition: pcv.cc:361
void newstructShow(newstruct_desc d)
Definition: newstruct.cc:830
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
void StringSetS(const char *st)
Definition: reporter.cc:128
#define pLPshift(p, sh, uptodeg, lV)
Definition: shiftgb.h:30
static BOOLEAN jjEXTENDED_SYSTEM(leftv res, leftv h)
Definition: extra.cc:2290
#define pmLastVblock(p, lV)
Definition: shiftgb.h:35
int M3ivSame(intvec *temp, intvec *u, intvec *v)
Definition: walk.cc:923
const char feNotImplemented[]
Definition: reporter.cc:54
struct fe_option feOptSpec[]
intvec * MwalkNextWeight(intvec *curr_weight, intvec *target_weight, ideal G)
ideal Mwalk(ideal Go, intvec *orig_M, intvec *target_M, ring baseRing, int reduction, int printout)
Definition: walk.cc:5311
ip_smatrix * matrix
intvec * MPertNextWeight(intvec *iva, ideal G, int deg)
void system(sys)
idhdl currRingHdl
Definition: ipid.cc:65
#define setFlag(A, F)
Definition: ipid.h:110
int simpleipc_cmd(char *cmd, int id, int v)
Definition: semaphore.c:167
int m
Definition: cfEzgcd.cc:119
void fePrintOptValues()
Definition: feOpt.cc:319
poly pcvCV2P(poly cv, int d0, int d1)
Definition: pcv.cc:263
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:4093
lists pcvLAddL(lists l1, lists l2)
Definition: pcv.cc:31
int pcvBasis(lists b, int i, poly m, int d, int n)
Definition: pcv.cc:391
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1097
poly kNFBound(ideal F, ideal Q, poly p, int bound, int syzComp, int lazyReduce)
Definition: kstd1.cc:3017
ideal freegb(ideal I, int uptodeg, int lVblock)
Definition: kstd2.cc:4347
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:425
#define FLAG_STD
Definition: ipid.h:106
leftv next
Definition: subexpr.h:87
static BOOLEAN rField_is_long_C(const ring r)
Definition: ring.h:534
intvec * Mivdp(int nR)
Definition: walk.cc:1016
#define BIMATELEM(M, I, J)
Definition: bigintmat.h:134
INLINE_THIS void Init(int l=0)
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
matrix evHessenberg(matrix M)
Definition: eigenval.cc:100
int & cols()
Definition: matpol.h:25
#define pLastVblock(p, lV)
Definition: shiftgb.h:33
Definition: tok.h:116
lists evEigenvals(matrix M)
Definition: eigenval_ip.cc:118
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
BOOLEAN semicProc(leftv res, leftv u, leftv v)
Definition: ipshell.cc:4460
int siSeed
Definition: sirandom.c:29
bool luSolveViaLDUDecomp(const matrix pMat, const matrix lMat, const matrix dMat, const matrix uMat, const poly l, const poly u, const poly lTimesU, const matrix bVec, matrix &xVec, matrix &H)
Solves the linear system A * x = b, where A is an (m x n)-matrix which is given by its LDU-decomposit...
void HilbertSeries_OrbitData(ideal S, int lV, bool IG_CASE)
Definition: hilb.cc:1863
ideal TranMImprovwalk(ideal G, intvec *curr_weight, intvec *target_tmp, int nP)
Definition: walk.cc:8405
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
Definition: ipshell.cc:6464
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
intvec * MivMatrixOrderdp(int nV)
Definition: walk.cc:1426
int rtyp
Definition: subexpr.h:92
#define TEST_FOR(A)
void * Data()
Definition: subexpr.cc:1146
ideal MAltwalk2(ideal Go, intvec *curr_weight, intvec *target_weight)
Definition: walk.cc:4289
ideal Mrwalk(ideal Go, intvec *orig_M, intvec *target_M, int weight_rad, int pert_deg, int reduction, int printout)
Definition: walk.cc:5612
poly pcvP2CV(poly p, int d0, int d1)
Definition: pcv.cc:246
Definition: tok.h:117
char * omFindExec(const char *name, char *exec)
Definition: omFindExec.c:251
omBin slists_bin
Definition: lists.cc:23
BOOLEAN spaddProc(leftv result, leftv first, leftv second)
Definition: ipshell.cc:4337
intvec * MivUnit(int nV)
Definition: walk.cc:1505
ideal idXXX(ideal h1, int k)
Definition: ideals.cc:657
ideal singclap_absFactorize(poly f, ideal &mipos, intvec **exps, int &numFactors, const ring r)
Definition: clapsing.cc:1793
BOOLEAN newstruct_set_proc(const char *bbname, const char *func, int args, procinfov pr)
Definition: newstruct.cc:850
size_t gmp_output_digits
Definition: mpr_complex.cc:44
ideal Mprwalk(ideal Go, intvec *orig_M, intvec *target_M, int weight_rad, int op_deg, int tp_deg, int nP, int reduction, int printout)
Definition: walk.cc:6397
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
lists gmsNF(ideal p, ideal g, matrix B, int D, int K)
Definition: gms.cc:22
feOptIndex feGetOptIndex(const char *name)
Definition: feOpt.cc:104
void countedref_reference_load()
Initialize blackbox types &#39;reference&#39; and &#39;shared&#39;, or both.
Definition: countedref.cc:700
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10
#define IDDATA(a)
Definition: ipid.h:123
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:770
ideal Mfrwalk(ideal G, intvec *ivstart, intvec *ivtarget, int weight_rad, int reduction, int printout)
Definition: walk.cc:8221
static Poly * h
Definition: janet.cc:978
#define IMATELEM(M, I, J)
Definition: intvec.h:77
#define NONE
Definition: tok.h:218
void feReInitResources()
Definition: feResource.cc:207
void Werror(const char *fmt,...)
Definition: reporter.cc:189
intvec * MivMatrixOrderlp(int nV)
Definition: walk.cc:1410
void * CopyD(int t)
Definition: subexpr.cc:714
int pcvMinDeg(poly p)
Definition: pcv.cc:108
void countedref_shared_load()
Definition: countedref.cc:724
return result
Definition: facAbsBiFact.cc:76
int l
Definition: cfEzgcd.cc:94
intvec * Mivlp(int nR)
Definition: walk.cc:1031
procinfo * procinfov
Definition: structs.h:63
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:16
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2579
ideal twostd(ideal I)
Compute two-sided GB:
Definition: nc.cc:21
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ jjVARIABLES_ID()

BOOLEAN jjVARIABLES_ID ( leftv  res,
leftv  u 
)

Definition at line 6218 of file ipshell.cc.

6219 {
6220  int *e=(int *)omAlloc0((rVar(currRing)+1)*sizeof(int));
6221  ideal I=(ideal)u->Data();
6222  int i;
6223  int n=0;
6224  for(i=I->nrows*I->ncols-1;i>=0;i--)
6225  {
6226  int n0=pGetVariables(I->m[i],e);
6227  if (n0>n) n=n0;
6228  }
6229  jjINT_S_TO_ID(n,e,res);
6230  return FALSE;
6231 }
#define FALSE
Definition: auxiliary.h:95
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:6188
#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:1146
#define omAlloc0(size)
Definition: omAllocDecl.h:211

§ jjVARIABLES_P()

BOOLEAN jjVARIABLES_P ( leftv  res,
leftv  u 
)

Definition at line 6210 of file ipshell.cc.

6211 {
6212  int *e=(int *)omAlloc0((rVar(currRing)+1)*sizeof(int));
6213  int n=pGetVariables((poly)u->Data(),e);
6214  jjINT_S_TO_ID(n,e,res);
6215  return FALSE;
6216 }
#define FALSE
Definition: auxiliary.h:95
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:6188
#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:1146
polyrec * poly
Definition: hilb.h:10
#define omAlloc0(size)
Definition: omAllocDecl.h:211

§ killlocals()

void killlocals ( int  v)

Definition at line 380 of file ipshell.cc.

381 {
382  BOOLEAN changed=FALSE;
383  idhdl sh=currRingHdl;
384  ring cr=currRing;
385  if (sh!=NULL) changed=((IDLEV(sh)<v) || (IDRING(sh)->ref>0));
386  //if (changed) Print("currRing=%s(%x), lev=%d,ref=%d\n",IDID(sh),IDRING(sh),IDLEV(sh),IDRING(sh)->ref);
387 
388  killlocals_rec(&(basePack->idroot),v,currRing);
389 
391  {
392  int t=iiRETURNEXPR.Typ();
393  if (/*iiRETURNEXPR.Typ()*/ t==RING_CMD)
394  {
396  if (((ring)h->data)->idroot!=NULL)
397  killlocals0(v,&(((ring)h->data)->idroot),(ring)h->data);
398  }
399  else if (/*iiRETURNEXPR.Typ()*/ t==LIST_CMD)
400  {
401  leftv h=&iiRETURNEXPR;
402  changed |=killlocals_list(v,(lists)h->data);
403  }
404  }
405  if (changed)
406  {
408  if (currRingHdl==NULL)
409  currRing=NULL;
410  else if(cr!=currRing)
411  rChangeCurrRing(cr);
412  }
413 
414  if (myynest<=1) iiNoKeepRing=TRUE;
415  //Print("end killlocals >= %d\n",v);
416  //listall();
417 }
int iiRETURNEXPR_len
Definition: iplib.cc:472
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:95
sleftv iiRETURNEXPR
Definition: iplib.cc:471
#define TRUE
Definition: auxiliary.h:99
void killlocals_rec(idhdl *root, int v, ring r)
Definition: ipshell.cc:324
int Typ()
Definition: subexpr.cc:1004
Definition: idrec.h:34
void * data
Definition: subexpr.h:89
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN killlocals_list(int v, lists L)
Definition: ipshell.cc:360
static BOOLEAN iiNoKeepRing
Definition: ipshell.cc:84
idhdl currRingHdl
Definition: ipid.cc:65
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1572
#define IDLEV(a)
Definition: ipid.h:118
void rChangeCurrRing(ring r)
Definition: polys.cc:12
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:64
#define IDRING(a)
Definition: ipid.h:124
Definition: tok.h:117
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:86
static void killlocals0(int v, idhdl *localhdl, const ring r)
Definition: ipshell.cc:289

§ kQHWeight()

BOOLEAN kQHWeight ( leftv  res,
leftv  v 
)

Definition at line 3232 of file ipshell.cc.

3233 {
3234  res->data=(char *)id_QHomWeight((ideal)v->Data(), currRing);
3235  if (res->data==NULL)
3236  res->data=(char *)new intvec(rVar(currRing));
3237  return FALSE;
3238 }
#define FALSE
Definition: auxiliary.h:95
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:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1146

§ kWeight()

BOOLEAN kWeight ( leftv  res,
leftv  id 
)

Definition at line 3210 of file ipshell.cc.

3211 {
3212  ideal F=(ideal)id->Data();
3213  intvec * iv = new intvec(rVar(currRing));
3214  polyset s;
3215  int sl, n, i;
3216  int *x;
3217 
3218  res->data=(char *)iv;
3219  s = F->m;
3220  sl = IDELEMS(F) - 1;
3221  n = rVar(currRing);
3222  double wNsqr = (double)2.0 / (double)n;
3224  x = (int * )omAlloc(2 * (n + 1) * sizeof(int));
3225  wCall(s, sl, x, wNsqr, currRing);
3226  for (i = n; i!=0; i--)
3227  (*iv)[i-1] = x[i + n + 1];
3228  omFreeSize((ADDRESS)x, 2 * (n + 1) * sizeof(int));
3229  return FALSE;
3230 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:95
#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:116
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
double(* wFunctional)(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
Definition: weight.cc:28
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
poly * polyset
Definition: hutil.h:15
void wCall(poly *s, int sl, int *x, double wNsqr, const ring R)
Definition: weight.cc:116
Variable x
Definition: cfModGcd.cc:4023
void * Data()
Definition: subexpr.cc:1146
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 419 of file ipshell.cc.

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

§ loNewtonP()

BOOLEAN loNewtonP ( leftv  res,
leftv  arg1 
)

compute Newton Polytopes of input polynomials

Definition at line 4472 of file ipshell.cc.

4473 {
4474  res->data= (void*)loNewtonPolytope( (ideal)arg1->Data() );
4475  return FALSE;
4476 }
#define FALSE
Definition: auxiliary.h:95
ideal loNewtonPolytope(const ideal id)
Definition: mpr_base.cc:3190
void * data
Definition: subexpr.h:89
void * Data()
Definition: subexpr.cc:1146

§ loSimplex()

BOOLEAN loSimplex ( leftv  res,
leftv  args 
)

Implementation of the Simplex Algorithm.

For args, see class simplex.

Definition at line 4478 of file ipshell.cc.

4479 {
4480  if ( !(rField_is_long_R(currRing)) )
4481  {
4482  WerrorS("Ground field not implemented!");
4483  return TRUE;
4484  }
4485 
4486  simplex * LP;
4487  matrix m;
4488 
4489  leftv v= args;
4490  if ( v->Typ() != MATRIX_CMD ) // 1: matrix
4491  return TRUE;
4492  else
4493  m= (matrix)(v->CopyD());
4494 
4495  LP = new simplex(MATROWS(m),MATCOLS(m));
4496  LP->mapFromMatrix(m);
4497 
4498  v= v->next;
4499  if ( v->Typ() != INT_CMD ) // 2: m = number of constraints
4500  return TRUE;
4501  else
4502  LP->m= (int)(long)(v->Data());
4503 
4504  v= v->next;
4505  if ( v->Typ() != INT_CMD ) // 3: n = number of variables
4506  return TRUE;
4507  else
4508  LP->n= (int)(long)(v->Data());
4509 
4510  v= v->next;
4511  if ( v->Typ() != INT_CMD ) // 4: m1 = number of <= constraints
4512  return TRUE;
4513  else
4514  LP->m1= (int)(long)(v->Data());
4515 
4516  v= v->next;
4517  if ( v->Typ() != INT_CMD ) // 5: m2 = number of >= constraints
4518  return TRUE;
4519  else
4520  LP->m2= (int)(long)(v->Data());
4521 
4522  v= v->next;
4523  if ( v->Typ() != INT_CMD ) // 6: m3 = number of == constraints
4524  return TRUE;
4525  else
4526  LP->m3= (int)(long)(v->Data());
4527 
4528 #ifdef mprDEBUG_PROT
4529  Print("m (constraints) %d\n",LP->m);
4530  Print("n (columns) %d\n",LP->n);
4531  Print("m1 (<=) %d\n",LP->m1);
4532  Print("m2 (>=) %d\n",LP->m2);
4533  Print("m3 (==) %d\n",LP->m3);
4534 #endif
4535 
4536  LP->compute();
4537 
4538  lists lres= (lists)omAlloc( sizeof(slists) );
4539  lres->Init( 6 );
4540 
4541  lres->m[0].rtyp= MATRIX_CMD; // output matrix
4542  lres->m[0].data=(void*)LP->mapToMatrix(m);
4543 
4544  lres->m[1].rtyp= INT_CMD; // found a solution?
4545  lres->m[1].data=(void*)(long)LP->icase;
4546 
4547  lres->m[2].rtyp= INTVEC_CMD;
4548  lres->m[2].data=(void*)LP->posvToIV();
4549 
4550  lres->m[3].rtyp= INTVEC_CMD;
4551  lres->m[3].data=(void*)LP->zrovToIV();
4552 
4553  lres->m[4].rtyp= INT_CMD;
4554  lres->m[4].data=(void*)(long)LP->m;
4555 
4556  lres->m[5].rtyp= INT_CMD;
4557  lres->m[5].data=(void*)(long)LP->n;
4558 
4559  res->data= (void*)lres;
4560 
4561  return FALSE;
4562 }
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
matrix mapToMatrix(matrix m)
void compute()
#define Print
Definition: emacs.cc:83
Definition: tok.h:95
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:95
Linear Programming / Linear Optimization using Simplex - Algorithm.
Definition: mpr_numeric.h:194
#define TRUE
Definition: auxiliary.h:99
intvec * zrovToIV()
void WerrorS(const char *s)
Definition: feFopen.cc:24
int Typ()
Definition: subexpr.cc:1004
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
intvec * posvToIV()
BOOLEAN mapFromMatrix(matrix m)
ip_smatrix * matrix
int m
Definition: cfEzgcd.cc:119
leftv next
Definition: subexpr.h:87
INLINE_THIS void Init(int l=0)
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define MATCOLS(i)
Definition: matpol.h:28
slists * lists
Definition: mpr_numeric.h:146
static BOOLEAN rField_is_long_R(const ring r)
Definition: ring.h:531
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1146
#define MATROWS(i)
Definition: matpol.h:27
int icase
Definition: mpr_numeric.h:201
void * CopyD(int t)
Definition: subexpr.cc:714

§ mpJacobi()

BOOLEAN mpJacobi ( leftv  res,
leftv  a 
)

Definition at line 2980 of file ipshell.cc.

2981 {
2982  int i,j;
2983  matrix result;
2984  ideal id=(ideal)a->Data();
2985 
2986  result =mpNew(IDELEMS(id),rVar(currRing));
2987  for (i=1; i<=IDELEMS(id); i++)
2988  {
2989  for (j=1; j<=rVar(currRing); j++)
2990  {
2991  MATELEM(result,i,j) = pDiff(id->m[i-1],j);
2992  }
2993  }
2994  res->data=(char *)result;
2995  return FALSE;
2996 }
#define FALSE
Definition: auxiliary.h:95
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47
void * Data()
Definition: subexpr.cc:1146
#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 3002 of file ipshell.cc.

3003 {
3004  int n=(int)(long)b->Data();
3005  int d=(int)(long)c->Data();
3006  int k,l,sign,row,col;
3007  matrix result;
3008  ideal temp;
3009  BOOLEAN bo;
3010  poly p;
3011 
3012  if ((d>n) || (d<1) || (n<1))
3013  {
3014  res->data=(char *)mpNew(1,1);
3015  return FALSE;
3016  }
3017  int *choise = (int*)omAlloc(d*sizeof(int));
3018  if (id==NULL)
3019  temp=idMaxIdeal(1);
3020  else
3021  temp=(ideal)id->Data();
3022 
3023  k = binom(n,d);
3024  l = k*d;
3025  l /= n-d+1;
3026  result =mpNew(l,k);
3027  col = 1;
3028  idInitChoise(d,1,n,&bo,choise);
3029  while (!bo)
3030  {
3031  sign = 1;
3032  for (l=1;l<=d;l++)
3033  {
3034  if (choise[l-1]<=IDELEMS(temp))
3035  {
3036  p = pCopy(temp->m[choise[l-1]-1]);
3037  if (sign == -1) p = pNeg(p);
3038  sign *= -1;
3039  row = idGetNumberOfChoise(l-1,d,1,n,choise);
3040  MATELEM(result,row,col) = p;
3041  }
3042  }
3043  col++;
3044  idGetNextChoise(d,n,&bo,choise);
3045  }
3046  if (id==NULL) idDelete(&temp);
3047 
3048  res->data=(char *)result;
3049  return FALSE;
3050 }
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
Definition: ideals.h:33
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define FALSE
Definition: auxiliary.h:95
return P p
Definition: myNF.cc:203
#define pNeg(p)
Definition: polys.h:181
int k
Definition: cfEzgcd.cc:93
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
#define IDELEMS(i)
Definition: simpleideals.h:24
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:47
#define NULL
Definition: omList.c:10
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)
void * Data()
Definition: subexpr.cc:1146
int idGetNumberOfChoise(int t, int d, int begin, int end, int *choise)
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:86
static int sign(int x)
Definition: ring.cc:3328
int binom(int n, int r)
return result
Definition: facAbsBiFact.cc:76
int l
Definition: cfEzgcd.cc:94
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168
#define MATELEM(mat, i, j)
Definition: matpol.h:29

§ nuLagSolve()

BOOLEAN nuLagSolve ( leftv  res,
leftv  arg1,
leftv  arg2,
leftv  arg3 
)

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

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

Definition at line 4587 of file ipshell.cc.

4588 {
4589 
4590  poly gls;
4591  gls= (poly)(arg1->Data());
4592  int howclean= (int)(long)arg3->Data();
4593 
4594  if ( !(rField_is_R(currRing) ||
4595  rField_is_Q(currRing) ||
4598  {
4599  WerrorS("Ground field not implemented!");
4600  return TRUE;
4601  }
4602 
4605  {
4606  unsigned long int ii = (unsigned long int)arg2->Data();
4607  setGMPFloatDigits( ii, ii );
4608  }
4609 
4610  if ( gls == NULL || pIsConstant( gls ) )
4611  {
4612  WerrorS("Input polynomial is constant!");
4613  return TRUE;
4614  }
4615 
4616  int ldummy;
4617  int deg= currRing->pLDeg( gls, &ldummy, currRing );
4618  int i,vpos=0;
4619  poly piter;
4620  lists elist;
4621  lists rlist;
4622 
4623  elist= (lists)omAlloc( sizeof(slists) );
4624  elist->Init( 0 );
4625 
4626  if ( rVar(currRing) > 1 )
4627  {
4628  piter= gls;
4629  for ( i= 1; i <= rVar(currRing); i++ )
4630  if ( pGetExp( piter, i ) )
4631  {
4632  vpos= i;
4633  break;
4634  }
4635  while ( piter )
4636  {
4637  for ( i= 1; i <= rVar(currRing); i++ )
4638  if ( (vpos != i) && (pGetExp( piter, i ) != 0) )
4639  {
4640  WerrorS("The input polynomial must be univariate!");
4641  return TRUE;
4642  }
4643  pIter( piter );
4644  }
4645  }
4646 
4647  rootContainer * roots= new rootContainer();
4648  number * pcoeffs= (number *)omAlloc( (deg+1) * sizeof( number ) );
4649  piter= gls;
4650  for ( i= deg; i >= 0; i-- )
4651  {
4652  if ( piter && pTotaldegree(piter) == i )
4653  {
4654  pcoeffs[i]= nCopy( pGetCoeff( piter ) );
4655  //nPrint( pcoeffs[i] );PrintS(" ");
4656  pIter( piter );
4657  }
4658  else
4659  {
4660  pcoeffs[i]= nInit(0);
4661  }
4662  }
4663 
4664 #ifdef mprDEBUG_PROT
4665  for (i=deg; i >= 0; i--)
4666  {
4667  nPrint( pcoeffs[i] );PrintS(" ");
4668  }
4669  PrintLn();
4670 #endif
4671 
4672  roots->fillContainer( pcoeffs, NULL, 1, deg, rootContainer::onepoly, 1 );
4673  roots->solver( howclean );
4674 
4675  int elem= roots->getAnzRoots();
4676  char *dummy;
4677  int j;
4678 
4679  rlist= (lists)omAlloc( sizeof(slists) );
4680  rlist->Init( elem );
4681 
4683  {
4684  for ( j= 0; j < elem; j++ )
4685  {
4686  rlist->m[j].rtyp=NUMBER_CMD;
4687  rlist->m[j].data=(void *)nCopy((number)(roots->getRoot(j)));
4688  //rlist->m[j].data=(void *)(number)(roots->getRoot(j));
4689  }
4690  }
4691  else
4692  {
4693  for ( j= 0; j < elem; j++ )
4694  {
4695  dummy = complexToStr( (*roots)[j], gmp_output_digits, currRing->cf );
4696  rlist->m[j].rtyp=STRING_CMD;
4697  rlist->m[j].data=(void *)dummy;
4698  }
4699  }
4700 
4701  elist->Clean();
4702  //omFreeSize( (ADDRESS) elist, sizeof(slists) );
4703 
4704  // this is (via fillContainer) the same data as in root
4705  //for ( i= deg; i >= 0; i-- ) nDelete( &pcoeffs[i] );
4706  //omFreeSize( (ADDRESS) pcoeffs, (deg+1) * sizeof( number ) );
4707 
4708  delete roots;
4709 
4710  res->rtyp= LIST_CMD;
4711  res->data= (void*)rlist;
4712 
4713  return FALSE;
4714 }
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:95
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:99
bool solver(const int polishmode=PM_NONE)
Definition: mpr_numeric.cc:449
void WerrorS(const char *s)
Definition: feFopen.cc:24
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define nPrint(a)
only for debug, over any initalized currRing
Definition: numbers.h:46
void * data
Definition: subexpr.h:89
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
int j
Definition: myNF.cc:70
static long pTotaldegree(poly p)
Definition: polys.h: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:92
#define nCopy(n)
Definition: numbers.h:15
void Clean(ring r=currRing)
Definition: lists.h:25
void * Data()
Definition: subexpr.cc:1146
Definition: tok.h:117
char * complexToStr(gmp_complex &c, const unsigned int oprec, const coeffs src)
Definition: mpr_complex.cc:706
size_t gmp_output_digits
Definition: mpr_complex.cc:44
void setGMPFloatDigits(size_t digits, size_t rest)
Set size of mantissa digits - the number of output digits (basis 10) the size of mantissa consists of...
Definition: mpr_complex.cc:62
polyrec * poly
Definition: hilb.h:10
#define nInit(i)
Definition: numbers.h:24

§ nuMPResMat()

BOOLEAN nuMPResMat ( leftv  res,
leftv  arg1,
leftv  arg2 
)

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

Definition at line 4564 of file ipshell.cc.

4565 {
4566  ideal gls = (ideal)(arg1->Data());
4567  int imtype= (int)(long)arg2->Data();
4568 
4569  uResultant::resMatType mtype= determineMType( imtype );
4570 
4571  // check input ideal ( = polynomial system )
4572  if ( mprIdealCheck( gls, arg1->Name(), mtype, true ) != mprOk )
4573  {
4574  return TRUE;
4575  }
4576 
4577  uResultant *resMat= new uResultant( gls, mtype, false );
4578  if (resMat!=NULL)
4579  {
4580  res->rtyp = MODUL_CMD;
4581  res->data= (void*)resMat->accessResMat()->getMatrix();
4582  if (!errorreported) delete resMat;
4583  }
4584  return errorreported;
4585 }
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:99
uResultant::resMatType determineMType(int imtype)
const char * Name()
Definition: subexpr.h:121
Definition: mpr_base.h:98
void * data
Definition: subexpr.h:89
virtual ideal getMatrix()
Definition: mpr_base.h:31
mprState mprIdealCheck(const ideal theIdeal, const char *name, uResultant::resMatType mtype, BOOLEAN rmatrix=false)
short errorreported
Definition: feFopen.cc:23
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1146

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

4818 {
4819  leftv v= args;
4820 
4821  ideal gls;
4822  int imtype;
4823  int howclean;
4824 
4825  // get ideal
4826  if ( v->Typ() != IDEAL_CMD )
4827  return TRUE;
4828  else gls= (ideal)(v->Data());
4829  v= v->next;
4830 
4831  // get resultant matrix type to use (0,1)
4832  if ( v->Typ() != INT_CMD )
4833  return TRUE;
4834  else imtype= (int)(long)v->Data();
4835  v= v->next;
4836 
4837  if (imtype==0)
4838  {
4839  ideal test_id=idInit(1,1);
4840  int j;
4841  for(j=IDELEMS(gls)-1;j>=0;j--)
4842  {
4843  if (gls->m[j]!=NULL)
4844  {
4845  test_id->m[0]=gls->m[j];
4846  intvec *dummy_w=id_QHomWeight(test_id, currRing);
4847  if (dummy_w!=NULL)
4848  {
4849  WerrorS("Newton polytope not of expected dimension");
4850  delete dummy_w;
4851  return TRUE;
4852  }
4853  }
4854  }
4855  }
4856 
4857  // get and set precision in digits ( > 0 )
4858  if ( v->Typ() != INT_CMD )
4859  return TRUE;
4860  else if ( !(rField_is_R(currRing) || rField_is_long_R(currRing) || \
4862  {
4863  unsigned long int ii=(unsigned long int)v->Data();
4864  setGMPFloatDigits( ii, ii );
4865  }
4866  v= v->next;
4867 
4868  // get interpolation steps (0,1,2)
4869  if ( v->Typ() != INT_CMD )
4870  return TRUE;
4871  else howclean= (int)(long)v->Data();
4872 
4873  uResultant::resMatType mtype= determineMType( imtype );
4874  int i,count;
4875  lists listofroots= NULL;
4876  number smv= NULL;
4877  BOOLEAN interpolate_det= (mtype==uResultant::denseResMat)?TRUE:FALSE;
4878 
4879  //emptylist= (lists)omAlloc( sizeof(slists) );
4880  //emptylist->Init( 0 );
4881 
4882  //res->rtyp = LIST_CMD;
4883  //res->data= (void *)emptylist;
4884 
4885  // check input ideal ( = polynomial system )
4886  if ( mprIdealCheck( gls, args->Name(), mtype ) != mprOk )
4887  {
4888  return TRUE;
4889  }
4890 
4891  uResultant * ures;
4892  rootContainer ** iproots;
4893  rootContainer ** muiproots;
4894  rootArranger * arranger;
4895 
4896  // main task 1: setup of resultant matrix
4897  ures= new uResultant( gls, mtype );
4898  if ( ures->accessResMat()->initState() != resMatrixBase::ready )
4899  {
4900  WerrorS("Error occurred during matrix setup!");
4901  return TRUE;
4902  }
4903 
4904  // if dense resultant, check if minor nonsingular
4905  if ( mtype == uResultant::denseResMat )
4906  {
4907  smv= ures->accessResMat()->getSubDet();
4908 #ifdef mprDEBUG_PROT
4909  PrintS("// Determinant of submatrix: ");nPrint(smv);PrintLn();
4910 #endif
4911  if ( nIsZero(smv) )
4912  {
4913  WerrorS("Unsuitable input ideal: Minor of resultant matrix is singular!");
4914  return TRUE;
4915  }
4916  }
4917 
4918  // main task 2: Interpolate specialized resultant polynomials
4919  if ( interpolate_det )
4920  iproots= ures->interpolateDenseSP( false, smv );
4921  else
4922  iproots= ures->specializeInU( false, smv );
4923 
4924  // main task 3: Interpolate specialized resultant polynomials
4925  if ( interpolate_det )
4926  muiproots= ures->interpolateDenseSP( true, smv );
4927  else
4928  muiproots= ures->specializeInU( true, smv );
4929 
4930 #ifdef mprDEBUG_PROT
4931  int c= iproots[0]->getAnzElems();
4932  for (i=0; i < c; i++) pWrite(iproots[i]->getPoly());
4933  c= muiproots[0]->getAnzElems();
4934  for (i=0; i < c; i++) pWrite(muiproots[i]->getPoly());
4935 #endif
4936 
4937  // main task 4: Compute roots of specialized polys and match them up
4938  arranger= new rootArranger( iproots, muiproots, howclean );
4939  arranger->solve_all();
4940 
4941  // get list of roots
4942  if ( arranger->success() )
4943  {
4944  arranger->arrange();
4945  listofroots= listOfRoots(arranger, gmp_output_digits );
4946  }
4947  else
4948  {
4949  WerrorS("Solver was unable to find any roots!");
4950  return TRUE;
4951  }
4952 
4953  // free everything
4954  count= iproots[0]->getAnzElems();
4955  for (i=0; i < count; i++) delete iproots[i];
4956  omFreeSize( (ADDRESS) iproots, count * sizeof(rootContainer*) );
4957  count= muiproots[0]->getAnzElems();
4958  for (i=0; i < count; i++) delete muiproots[i];
4959  omFreeSize( (ADDRESS) muiproots, count * sizeof(rootContainer*) );
4960 
4961  delete ures;
4962  delete arranger;
4963  nDelete( &smv );
4964 
4965  res->data= (void *)listofroots;
4966 
4967  //emptylist->Clean();
4968  // omFreeSize( (ADDRESS) emptylist, sizeof(slists) );
4969 
4970  return FALSE;
4971 }
int status int void size_t count
Definition: si_signals.h:59
complex root finder for univariate polynomials based on laguers algorithm
Definition: mpr_numeric.h:65
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
void PrintLn()
Definition: reporter.cc:310
Base class for solving 0-dim poly systems using u-resultant.
Definition: mpr_base.h:62
Definition: tok.h:95
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:95
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:99
uResultant::resMatType determineMType(int imtype)
void * ADDRESS
Definition: auxiliary.h:116
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:1004
const char * Name()
Definition: subexpr.h:121
Definition: mpr_base.h:98
#define nPrint(a)
only for debug, over any initalized currRing
Definition: numbers.h:46
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
int j
Definition: myNF.cc:70
bool success()
Definition: mpr_numeric.h:162
void arrange()
Definition: mpr_numeric.cc:895
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
void solve_all()
Definition: mpr_numeric.cc:870
#define IDELEMS(i)
Definition: simpleideals.h:24
mprState mprIdealCheck(const ideal theIdeal, const char *name, uResultant::resMatType mtype, BOOLEAN rmatrix=false)
rootContainer ** interpolateDenseSP(BOOLEAN matchUp=false, const number subDetVal=NULL)
Definition: mpr_base.cc:2921
#define nDelete(n)
Definition: numbers.h:16
leftv next
Definition: subexpr.h:87
static BOOLEAN rField_is_long_C(const ring r)
Definition: ring.h: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:1146
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:86
lists listOfRoots(rootArranger *self, const unsigned int oprec)
Definition: ipshell.cc:4974
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 4716 of file ipshell.cc.

4717 {
4718  int i;
4719  ideal p,w;
4720  p= (ideal)arg1->Data();
4721  w= (ideal)arg2->Data();
4722 
4723  // w[0] = f(p^0)
4724  // w[1] = f(p^1)
4725  // ...
4726  // p can be a vector of numbers (multivariate polynom)
4727  // or one number (univariate polynom)
4728  // tdg = deg(f)
4729 
4730  int n= IDELEMS( p );
4731  int m= IDELEMS( w );
4732  int tdg= (int)(long)arg3->Data();
4733 
4734  res->data= (void*)NULL;
4735 
4736  // check the input
4737  if ( tdg < 1 )
4738  {
4739  WerrorS("Last input parameter must be > 0!");
4740  return TRUE;
4741  }
4742  if ( n != rVar(currRing) )
4743  {
4744  Werror("Size of first input ideal must be equal to %d!",rVar(currRing));
4745  return TRUE;
4746  }
4747  if ( m != (int)pow((double)tdg+1,(double)n) )
4748  {
4749  Werror("Size of second input ideal must be equal to %d!",
4750  (int)pow((double)tdg+1,(double)n));
4751  return TRUE;
4752  }
4753  if ( !(rField_is_Q(currRing) /* ||
4754  rField_is_R() || rField_is_long_R() ||
4755  rField_is_long_C()*/ ) )
4756  {
4757  WerrorS("Ground field not implemented!");
4758  return TRUE;
4759  }
4760 
4761  number tmp;
4762  number *pevpoint= (number *)omAlloc( n * sizeof( number ) );
4763  for ( i= 0; i < n; i++ )
4764  {
4765  pevpoint[i]=nInit(0);
4766  if ( (p->m)[i] )
4767  {
4768  tmp = pGetCoeff( (p->m)[i] );
4769  if ( nIsZero(tmp) || nIsOne(tmp) || nIsMOne(tmp) )
4770  {
4771  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4772  WerrorS("Elements of first input ideal must not be equal to -1, 0, 1!");
4773  return TRUE;
4774  }
4775  } else tmp= NULL;
4776  if ( !nIsZero(tmp) )
4777  {
4778  if ( !pIsConstant((p->m)[i]))
4779  {
4780  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4781  WerrorS("Elements of first input ideal must be numbers!");
4782  return TRUE;
4783  }
4784  pevpoint[i]= nCopy( tmp );
4785  }
4786  }
4787 
4788  number *wresults= (number *)omAlloc( m * sizeof( number ) );
4789  for ( i= 0; i < m; i++ )
4790  {
4791  wresults[i]= nInit(0);
4792  if ( (w->m)[i] && !nIsZero(pGetCoeff((w->m)[i])) )
4793  {
4794  if ( !pIsConstant((w->m)[i]))
4795  {
4796  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4797  omFreeSize( (ADDRESS)wresults, m * sizeof( number ) );
4798  WerrorS("Elements of second input ideal must be numbers!");
4799  return TRUE;
4800  }
4801  wresults[i]= nCopy(pGetCoeff((w->m)[i]));
4802  }
4803  }
4804 
4805  vandermonde vm( m, n, tdg, pevpoint, FALSE );
4806  number *ncpoly= vm.interpolateDense( wresults );
4807  // do not free ncpoly[]!!
4808  poly rpoly= vm.numvec2poly( ncpoly );
4809 
4810  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4811  omFreeSize( (ADDRESS)wresults, m * sizeof( number ) );
4812 
4813  res->data= (void*)rpoly;
4814  return FALSE;
4815 }
vandermonde system solver for interpolating polynomials from their values
Definition: mpr_numeric.h:28
#define FALSE
Definition: auxiliary.h:95
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:99
#define nIsOne(n)
Definition: numbers.h:25
void * ADDRESS
Definition: auxiliary.h:116
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define nIsMOne(n)
Definition: numbers.h:26
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int m
Definition: cfEzgcd.cc:119
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:221
int i
Definition: cfEzgcd.cc:123
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:501
#define IDELEMS(i)
Definition: simpleideals.h:24
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define nCopy(n)
Definition: numbers.h:15
void * Data()
Definition: subexpr.cc:1146
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 6233 of file ipshell.cc.

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

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

§ rDecompose_CF()

BOOLEAN rDecompose_CF ( leftv  res,
const coeffs  C 
)

Definition at line 1821 of file ipshell.cc.

1822 {
1823  assume( C != NULL );
1824 
1825  // sanity check: require currRing==r for rings with polynomial data
1826  if ( nCoeff_is_algExt(C) && (C != currRing->cf))
1827  {
1828  WerrorS("ring with polynomial data must be the base ring or compatible");
1829  return TRUE;
1830  }
1831  if (nCoeff_is_numeric(C))
1832  {
1833  rDecomposeC_41(res,C);
1834  }
1835 #ifdef HAVE_RINGS
1836  else if (nCoeff_is_Ring(C))
1837  {
1838  rDecomposeRing_41(res,C);
1839  }
1840 #endif
1841  else if ( C->extRing!=NULL )// nCoeff_is_algExt(r->cf))
1842  {
1843  rDecomposeCF(res, C->extRing, currRing);
1844  }
1845  else if(nCoeff_is_GF(C))
1846  {
1848  Lc->Init(4);
1849  // char:
1850  Lc->m[0].rtyp=INT_CMD;
1851  Lc->m[0].data=(void*)(long)C->m_nfCharQ;
1852  // var:
1854  Lv->Init(1);
1855  Lv->m[0].rtyp=STRING_CMD;
1856  Lv->m[0].data=(void *)omStrDup(*n_ParameterNames(C));
1857  Lc->m[1].rtyp=LIST_CMD;
1858  Lc->m[1].data=(void*)Lv;
1859  // ord:
1861  Lo->Init(1);
1863  Loo->Init(2);
1864  Loo->m[0].rtyp=STRING_CMD;
1865  Loo->m[0].data=(void *)omStrDup(rSimpleOrdStr(ringorder_lp));
1866 
1867  intvec *iv=new intvec(1); (*iv)[0]=1;
1868  Loo->m[1].rtyp=INTVEC_CMD;
1869  Loo->m[1].data=(void *)iv;
1870 
1871  Lo->m[0].rtyp=LIST_CMD;
1872  Lo->m[0].data=(void*)Loo;
1873 
1874  Lc->m[2].rtyp=LIST_CMD;
1875  Lc->m[2].data=(void*)Lo;
1876  // q-ideal:
1877  Lc->m[3].rtyp=IDEAL_CMD;
1878  Lc->m[3].data=(void *)idInit(1,1);
1879  // ----------------------
1880  res->rtyp=LIST_CMD;
1881  res->data=(void*)Lc;
1882  }
1883  else
1884  {
1885  res->rtyp=INT_CMD;
1886  res->data=(void *)(long)C->ch;
1887  }
1888  // ----------------------------------------
1889  return FALSE;
1890 }
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:95
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
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:1759
void * data
Definition: subexpr.h:89
void rDecomposeCF(leftv h, const ring r, const ring R)
Definition: ipshell.cc:1598
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
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:1687
INLINE_THIS void Init(int l=0)
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:92
Definition: tok.h:117
omBin slists_bin
Definition: lists.cc:23
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ rDecompose_list_cf()

lists rDecompose_list_cf ( const ring  r)

Definition at line 1894 of file ipshell.cc.

1895 {
1896  assume( r != NULL );
1897  const coeffs C = r->cf;
1898  assume( C != NULL );
1899 
1900  // sanity check: require currRing==r for rings with polynomial data
1901  if ( (r!=currRing) && (
1902  (nCoeff_is_algExt(C) && (C != currRing->cf))
1903  || (r->qideal != NULL)
1904 #ifdef HAVE_PLURAL
1905  || (rIsPluralRing(r))
1906 #endif
1907  )
1908  )
1909  {
1910  WerrorS("ring with polynomial data must be the base ring or compatible");
1911  return NULL;
1912  }
1913  // 0: char/ cf - ring
1914  // 1: list (var)
1915  // 2: list (ord)
1916  // 3: qideal
1917  // possibly:
1918  // 4: C
1919  // 5: D
1921  if (rIsPluralRing(r))
1922  L->Init(6);
1923  else
1924  L->Init(4);
1925  // ----------------------------------------
1926  // 0: char/ cf - ring
1927  L->m[0].rtyp=CRING_CMD;
1928  L->m[0].data=(char*)r->cf; r->cf->ref++;
1929  // ----------------------------------------
1930  // 1: list (var)
1932  LL->Init(r->N);
1933  int i;
1934  for(i=0; i<r->N; i++)
1935  {
1936  LL->m[i].rtyp=STRING_CMD;
1937  LL->m[i].data=(void *)omStrDup(r->names[i]);
1938  }
1939  L->m[1].rtyp=LIST_CMD;
1940  L->m[1].data=(void *)LL;
1941  // ----------------------------------------
1942  // 2: list (ord)
1944  i=rBlocks(r)-1;
1945  LL->Init(i);
1946  i--;
1947  lists LLL;
1948  for(; i>=0; i--)
1949  {
1950  intvec *iv;
1951  int j;
1952  LL->m[i].rtyp=LIST_CMD;
1954  LLL->Init(2);
1955  LLL->m[0].rtyp=STRING_CMD;
1956  LLL->m[0].data=(void *)omStrDup(rSimpleOrdStr(r->order[i]));
1957 
1958  if(r->order[i] == ringorder_IS) // || r->order[i] == ringorder_s || r->order[i] == ringorder_S)
1959  {
1960  assume( r->block0[i] == r->block1[i] );
1961  const int s = r->block0[i];
1962  assume( -2 < s && s < 2);
1963 
1964  iv=new intvec(1);
1965  (*iv)[0] = s;
1966  }
1967  else if (r->block1[i]-r->block0[i] >=0 )
1968  {
1969  int bl=j=r->block1[i]-r->block0[i];
1970  if (r->order[i]==ringorder_M)
1971  {
1972  j=(j+1)*(j+1)-1;
1973  bl=j+1;
1974  }
1975  else if (r->order[i]==ringorder_am)
1976  {
1977  j+=r->wvhdl[i][bl+1];
1978  }
1979  iv=new intvec(j+1);
1980  if ((r->wvhdl!=NULL) && (r->wvhdl[i]!=NULL))
1981  {
1982  for(;j>=0; j--) (*iv)[j]=r->wvhdl[i][j+(j>bl)];
1983  }
1984  else switch (r->order[i])
1985  {
1986  case ringorder_dp:
1987  case ringorder_Dp:
1988  case ringorder_ds:
1989  case ringorder_Ds:
1990  case ringorder_lp:
1991  for(;j>=0; j--) (*iv)[j]=1;
1992  break;
1993  default: /* do nothing */;
1994  }
1995  }
1996  else
1997  {
1998  iv=new intvec(1);
1999  }
2000  LLL->m[1].rtyp=INTVEC_CMD;
2001  LLL->m[1].data=(void *)iv;
2002  LL->m[i].data=(void *)LLL;
2003  }
2004  L->m[2].rtyp=LIST_CMD;
2005  L->m[2].data=(void *)LL;
2006  // ----------------------------------------
2007  // 3: qideal
2008  L->m[3].rtyp=IDEAL_CMD;
2009  if (r->qideal==NULL)
2010  L->m[3].data=(void *)idInit(1,1);
2011  else
2012  L->m[3].data=(void *)idCopy(r->qideal);
2013  // ----------------------------------------
2014 #ifdef HAVE_PLURAL // NC! in rDecompose
2015  if (rIsPluralRing(r))
2016  {
2017  L->m[4].rtyp=MATRIX_CMD;
2018  L->m[4].data=(void *)mp_Copy(r->GetNC()->C, r, r);
2019  L->m[5].rtyp=MATRIX_CMD;
2020  L->m[5].data=(void *)mp_Copy(r->GetNC()->D, r, r);
2021  }
2022 #endif
2023  return L;
2024 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
sleftv * m
Definition: lists.h:45
Definition: lists.h:22
void WerrorS(const char *s)
Definition: feFopen.cc:24
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static int rBlocks(ring r)
Definition: ring.h:556
Definition: tok.h:56
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
ideal idCopy(ideal A)
Definition: ideals.h:60
INLINE_THIS void Init(int l=0)
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:92
Definition: tok.h:117
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:74
omBin slists_bin
Definition: lists.cc:23
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ rDefault()

idhdl rDefault ( const char *  s)

Definition at line 1527 of file ipshell.cc.

1528 {
1529  idhdl tmp=NULL;
1530 
1531  if (s!=NULL) tmp = enterid(s, myynest, RING_CMD, &IDROOT);
1532  if (tmp==NULL) return NULL;
1533 
1534 // if ((currRing->ppNoether)!=NULL) pDelete(&(currRing->ppNoether));
1536  {
1538  memset(&sLastPrinted,0,sizeof(sleftv));
1539  }
1540 
1541  ring r = IDRING(tmp) = (ring) omAlloc0Bin(sip_sring_bin);
1542 
1543  r->cf = nInitChar(n_Zp, (void*)32003); // r->cf->ch = 32003;
1544  r->N = 3;
1545  /*r->P = 0; Alloc0 in idhdl::set, ipid.cc*/
1546  /*names*/
1547  r->names = (char **) omAlloc0(3 * sizeof(char_ptr));
1548  r->names[0] = omStrDup("x");
1549  r->names[1] = omStrDup("y");
1550  r->names[2] = omStrDup("z");
1551  /*weights: entries for 3 blocks: NULL*/
1552  r->wvhdl = (int **)omAlloc0(3 * sizeof(int_ptr));
1553  /*order: dp,C,0*/
1554  r->order = (int *) omAlloc(3 * sizeof(int *));
1555  r->block0 = (int *)omAlloc0(3 * sizeof(int *));
1556  r->block1 = (int *)omAlloc0(3 * sizeof(int *));
1557  /* ringorder dp for the first block: var 1..3 */
1558  r->order[0] = ringorder_dp;
1559  r->block0[0] = 1;
1560  r->block1[0] = 3;
1561  /* ringorder C for the second block: no vars */
1562  r->order[1] = ringorder_C;
1563  /* the last block: everything is 0 */
1564  r->order[2] = 0;
1565 
1566  /* complete ring intializations */
1567  rComplete(r);
1568  rSetHdl(tmp);
1569  return currRingHdl;
1570 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
{p < 2^31}
Definition: coeffs.h:30
#define IDROOT
Definition: ipid.h:20
#define omAlloc(size)
Definition: omAllocDecl.h:210
Definition: idrec.h:34
int myynest
Definition: febase.cc:46
char * char_ptr
Definition: structs.h:56
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:261
const ring r
Definition: syzextra.cc:208
BOOLEAN RingDependend()
Definition: subexpr.cc:405
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3351
idhdl currRingHdl
Definition: ipid.cc:65
omBin sip_sring_bin
Definition: ring.cc:54
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define NULL
Definition: omList.c:10
#define IDRING(a)
Definition: ipid.h:124
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:335
void rSetHdl(idhdl h)
Definition: ipshell.cc:5021
int * int_ptr
Definition: structs.h:57
#define omAlloc0(size)
Definition: omAllocDecl.h:211
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:334
#define omStrDup(s)
Definition: omAllocDecl.h:263

§ rFindHdl()

idhdl rFindHdl ( ring  r,
idhdl  n 
)

Definition at line 1572 of file ipshell.cc.

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

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

§ rKill() [1/2]

void rKill ( idhdl  h)

Definition at line 6099 of file ipshell.cc.

6100 {
6101  ring r = IDRING(h);
6102  int ref=0;
6103  if (r!=NULL)
6104  {
6105  // avoid, that sLastPrinted is the last reference to the base ring:
6106  // clean up before killing the last "named" refrence:
6107  if ((sLastPrinted.rtyp==RING_CMD)
6108  && (sLastPrinted.data==(void*)r))
6109  {
6110  sLastPrinted.CleanUp(r);
6111  }
6112  ref=r->ref;
6113  rKill(r);
6114  }
6115  if (h==currRingHdl)
6116  {
6117  if (ref<=0) { currRing=NULL; currRingHdl=NULL;}
6118  else
6119  {
6121  }
6122  }
6123 }
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
void rKill(ring r)
Definition: ipshell.cc:6048
idhdl currRingHdl
Definition: ipid.cc:65
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1572
#define NULL
Definition: omList.c:10
#define IDRING(a)
Definition: ipid.h:124
int rtyp
Definition: subexpr.h:92
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:335

§ rKill() [2/2]

void rKill ( ring  r)

Definition at line 6048 of file ipshell.cc.

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

§ rSetHdl()

void rSetHdl ( idhdl  h)

Definition at line 5021 of file ipshell.cc.

5022 {
5023  ring rg = NULL;
5024  if (h!=NULL)
5025  {
5026 // Print(" new ring:%s (l:%d)\n",IDID(h),IDLEV(h));
5027  rg = IDRING(h);
5028  if (rg==NULL) return; //id <>NULL, ring==NULL
5029  omCheckAddrSize((ADDRESS)h,sizeof(idrec));
5030  if (IDID(h)) // OB: ????
5031  omCheckAddr((ADDRESS)IDID(h));
5032  rTest(rg);
5033  }
5034 
5035  // clean up history
5037  {
5039  memset(&sLastPrinted,0,sizeof(sleftv));
5040  }
5041 
5042  if ((rg!=currRing)&&(currRing!=NULL))
5043  {
5045  if (DENOMINATOR_LIST!=NULL)
5046  {
5047  if (TEST_V_ALLWARN)
5048  Warn("deleting denom_list for ring change to %s",IDID(h));
5049  do
5050  {
5051  n_Delete(&(dd->n),currRing->cf);
5052  dd=dd->next;
5054  DENOMINATOR_LIST=dd;
5055  } while(DENOMINATOR_LIST!=NULL);
5056  }
5057  }
5058 
5059  // test for valid "currRing":
5060  if ((rg!=NULL) && (rg->idroot==NULL))
5061  {
5062  ring old=rg;
5063  rg=rAssure_HasComp(rg);
5064  if (old!=rg)
5065  {
5066  rKill(old);
5067  IDRING(h)=rg;
5068  }
5069  }
5070  /*------------ change the global ring -----------------------*/
5071  rChangeCurrRing(rg);
5072  currRingHdl = h;
5073 }
#define omCheckAddrSize(addr, size)
Definition: omAllocDecl.h:327
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define IDID(a)
Definition: ipid.h:119
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:89
void * ADDRESS
Definition: auxiliary.h:116
ring rAssure_HasComp(const ring r)
Definition: ring.cc:4522
Definition: idrec.h:34
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN RingDependend()
Definition: subexpr.cc:405
void rKill(ring r)
Definition: ipshell.cc:6048
#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:335
#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 6125 of file ipshell.cc.

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

1029 {
1030  int i;
1031  indset save;
1033 
1034  hexist = hInit(S, Q, &hNexist, currRing);
1035  if (hNexist == 0)
1036  {
1037  intvec *iv=new intvec(rVar(currRing));
1038  for(i=0; i<rVar(currRing); i++) (*iv)[i]=1;
1039  res->Init(1);
1040  res->m[0].rtyp=INTVEC_CMD;
1041  res->m[0].data=(intvec*)iv;
1042  return res;
1043  }
1044  else if (hisModule!=0)
1045  {
1046  res->Init(0);
1047  return res;
1048  }
1049  save = ISet = (indset)omAlloc0Bin(indlist_bin);
1050  hMu = 0;
1051  hwork = (scfmon)omAlloc(hNexist * sizeof(scmon));
1052  hvar = (varset)omAlloc((rVar(currRing) + 1) * sizeof(int));
1053  hpure = (scmon)omAlloc((1 + (rVar(currRing) * rVar(currRing))) * sizeof(long));
1054  hrad = hexist;
1055  hNrad = hNexist;
1056  radmem = hCreate(rVar(currRing) - 1);
1057  hCo = rVar(currRing) + 1;
1058  hNvar = rVar(currRing);
1059  hRadical(hrad, &hNrad, hNvar);
1060  hSupp(hrad, hNrad, hvar, &hNvar);
1061  if (hNvar)
1062  {
1063  hCo = hNvar;
1064  memset(hpure, 0, (rVar(currRing) + 1) * sizeof(long));
1065  hPure(hrad, 0, &hNrad, hvar, hNvar, hpure, &hNpure);
1066  hLexR(hrad, hNrad, hvar, hNvar);
1068  }
1069  if (hCo && (hCo < rVar(currRing)))
1070  {
1072  }
1073  if (hMu!=0)
1074  {
1075  ISet = save;
1076  hMu2 = 0;
1077  if (all && (hCo+1 < rVar(currRing)))
1078  {
1081  i=hMu+hMu2;
1082  res->Init(i);
1083  if (hMu2 == 0)
1084  {
1086  }
1087  }
1088  else
1089  {
1090  res->Init(hMu);
1091  }
1092  for (i=0;i<hMu;i++)
1093  {
1094  res->m[i].data = (void *)save->set;
1095  res->m[i].rtyp = INTVEC_CMD;
1096  ISet = save;
1097  save = save->nx;
1099  }
1100  omFreeBin((ADDRESS)save, indlist_bin);
1101  if (hMu2 != 0)
1102  {
1103  save = JSet;
1104  for (i=hMu;i<hMu+hMu2;i++)
1105  {
1106  res->m[i].data = (void *)save->set;
1107  res->m[i].rtyp = INTVEC_CMD;
1108  JSet = save;
1109  save = save->nx;
1111  }
1112  omFreeBin((ADDRESS)save, indlist_bin);
1113  }
1114  }
1115  else
1116  {
1117  res->Init(0);
1119  }
1120  hKill(radmem, rVar(currRing) - 1);
1121  omFreeSize((ADDRESS)hpure, (1 + (rVar(currRing) * rVar(currRing))) * sizeof(long));
1122  omFreeSize((ADDRESS)hvar, (rVar(currRing) + 1) * sizeof(int));
1123  omFreeSize((ADDRESS)hwork, hNexist * sizeof(scmon));
1125  return res;
1126 }
int hMu2
Definition: hdegree.cc:22
sleftv * m
Definition: lists.h:45
void hDimSolve(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:29
scfmon hwork
Definition: hutil.cc:19
void hIndAllMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:496
int hNexist
Definition: hutil.cc:22
int * varset
Definition: hutil.h:19
int hCo
Definition: hdegree.cc:22
Definition: lists.h:22
scmon * scfmon
Definition: hutil.h:18
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
scfmon hexist
Definition: hutil.cc:19
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
monf hCreate(int Nvar)
Definition: hutil.cc:1002
int hNvar
Definition: hutil.cc:22
void * ADDRESS
Definition: auxiliary.h:116
int hNrad
Definition: hutil.cc:22
int hNpure
Definition: hutil.cc:22
scmon hpure
Definition: hutil.cc:20
#define Q
Definition: sirandom.c:25
void hRadical(scfmon rad, int *Nrad, int Nvar)
Definition: hutil.cc:417
#define omAlloc(size)
Definition: omAllocDecl.h:210
scfmon hrad
Definition: hutil.cc:19
void * data
Definition: subexpr.h:89
void hDelete(scfmon ev, int ev_length)
Definition: hutil.cc:146
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
indset ISet
Definition: hdegree.cc:279
Definition: intvec.h:14
void hKill(monf xmem, int Nvar)
Definition: hutil.cc:1016
varset hvar
Definition: hutil.cc:21
void hIndMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:313
indlist * indset
Definition: hutil.h:31
void hPure(scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
Definition: hutil.cc:627
omBin indlist_bin
Definition: hdegree.cc:23
indset JSet
Definition: hdegree.cc:279
int * scmon
Definition: hutil.h:17
int i
Definition: cfEzgcd.cc:123
void hLexR(scfmon rad, int Nrad, varset var, int Nvar)
Definition: hutil.cc:571
INLINE_THIS void Init(int l=0)
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
slists * lists
Definition: mpr_numeric.h:146
monf radmem
Definition: hutil.cc:24
int rtyp
Definition: subexpr.h:92
omBin slists_bin
Definition: lists.cc:23
int hisModule
Definition: hutil.cc:23
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
scfmon hInit(ideal S, ideal Q, int *Nexist, ring tailRing)
Definition: hutil.cc:34
int hMu
Definition: hdegree.cc:22
void hSupp(scfmon stc, int Nstc, varset var, int *Nvar)
Definition: hutil.cc:180

§ semicProc()

BOOLEAN semicProc ( leftv  ,
leftv  ,
leftv   
)

Definition at line 4460 of file ipshell.cc.

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

§ semicProc3()

BOOLEAN semicProc3 ( leftv  ,
leftv  ,
leftv  ,
leftv   
)

Definition at line 4420 of file ipshell.cc.

4421 {
4422  semicState state;
4423  BOOLEAN qh=(((int)(long)w->Data())==1);
4424 
4425  // -----------------
4426  // check arguments
4427  // -----------------
4428 
4429  lists l1 = (lists)u->Data( );
4430  lists l2 = (lists)v->Data( );
4431 
4432  if( (state=list_is_spectrum( l1 ))!=semicOK )
4433  {
4434  WerrorS( "first argument is not a spectrum" );
4435  list_error( state );
4436  }
4437  else if( (state=list_is_spectrum( l2 ))!=semicOK )
4438  {
4439  WerrorS( "second argument is not a spectrum" );
4440  list_error( state );
4441  }
4442  else
4443  {
4444  spectrum s1= spectrumFromList( l1 );
4445  spectrum s2= spectrumFromList( l2 );
4446 
4447  res->rtyp = INT_CMD;
4448  if (qh)
4449  res->data = (void*)(long)(s1.mult_spectrumh( s2 ));
4450  else
4451  res->data = (void*)(long)(s1.mult_spectrum( s2 ));
4452  }
4453 
4454  // -----------------
4455  // check status
4456  // -----------------
4457 
4458  return (state!=semicOK);
4459 }
Definition: tok.h:95
Definition: lists.h:22
spectrum spectrumFromList(lists l)
Definition: ipshell.cc:3293
void list_error(semicState state)
Definition: ipshell.cc:3377
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:4162
int mult_spectrumh(spectrum &)
Definition: semic.cc:425
semicState
Definition: ipshell.cc:3343
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:86
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:95
const struct soptionStruct optionStruct[]
Definition: misc_ip.cc:516
#define OPT_OLDSTD
Definition: options.h:81
#define TRUE
Definition: auxiliary.h:99
void * ADDRESS
Definition: auxiliary.h:116
unsigned setval
Definition: ipid.h:152
unsigned resetval
Definition: ipid.h:153
int Typ()
Definition: subexpr.cc:1004
#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:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define V_SHOW_MEM
Definition: options.h:41
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
Definition: intvec.h:14
const char * name
Definition: subexpr.h:88
#define omFree(addr)
Definition: omAllocDecl.h:261
int i
Definition: cfEzgcd.cc:123
const struct soptionStruct verboseStruct[]
Definition: misc_ip.cc:546
char name(const Variable &v)
Definition: factory.h:178
leftv next
Definition: subexpr.h:87
#define OPT_INTSTRATEGY
Definition: options.h:87
#define BVERBOSE(a)
Definition: options.h:33
CanonicalForm test
Definition: cfModGcd.cc:4037
#define V_YACC
Definition: options.h:42
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
int yydebug
Definition: grammar.cc:1795
const CanonicalForm & w
Definition: facAbsFact.cc:55
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1146
#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:714
#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:116
#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 4337 of file ipshell.cc.

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

§ spectrumfProc()

BOOLEAN spectrumfProc ( leftv  ,
leftv   
)

Definition at line 4093 of file ipshell.cc.

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

§ spectrumProc()

BOOLEAN spectrumProc ( leftv  ,
leftv   
)

Definition at line 4042 of file ipshell.cc.

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

§ spmulProc()

BOOLEAN spmulProc ( leftv  ,
leftv  ,
leftv   
)

Definition at line 4379 of file ipshell.cc.

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

§ syBetti1()

BOOLEAN syBetti1 ( leftv  res,
leftv  u 
)

Definition at line 3080 of file ipshell.cc.

3081 {
3082  sleftv tmp;
3083  memset(&tmp,0,sizeof(tmp));
3084  tmp.rtyp=INT_CMD;
3085  tmp.data=(void *)1;
3086  return syBetti2(res,u,&tmp);
3087 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:95
void * data
Definition: subexpr.h:89
BOOLEAN syBetti2(leftv res, leftv u, leftv w)
Definition: ipshell.cc:3057
int rtyp
Definition: subexpr.h:92

§ syBetti2()

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

Definition at line 3057 of file ipshell.cc.

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

§ syConvList()

syStrategy syConvList ( lists  li)

Definition at line 3165 of file ipshell.cc.

3166 {
3167  int typ0;
3169 
3170  resolvente fr = liFindRes(li,&(result->length),&typ0,&(result->weights));
3171  if (fr != NULL)
3172  {
3173 
3174  result->fullres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
3175  for (int i=result->length-1;i>=0;i--)
3176  {
3177  if (fr[i]!=NULL)
3178  result->fullres[i] = idCopy(fr[i]);
3179  }
3180  result->list_length=result->length;
3181  omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
3182  }
3183  else
3184  {
3185  omFreeSize(result, sizeof(ssyStrategy));
3186  result = NULL;
3187  }
3188  return result;
3189 }
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:116
int i
Definition: cfEzgcd.cc:123
resolvente fullres
Definition: syz.h:57
ideal idCopy(ideal A)
Definition: ideals.h:60
#define NULL
Definition: omList.c:10
short list_length
Definition: syz.h:62
ideal * resolvente
Definition: ideals.h:18
#define omAlloc0(size)
Definition: omAllocDecl.h:211
return result
Definition: facAbsBiFact.cc:76
ssyStrategy * syStrategy
Definition: syz.h:35

§ syConvRes()

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

Definition at line 3092 of file ipshell.cc.

3093 {
3094  resolvente fullres = syzstr->fullres;
3095  resolvente minres = syzstr->minres;
3096 
3097  const int length = syzstr->length;
3098 
3099  if ((fullres==NULL) && (minres==NULL))
3100  {
3101  if (syzstr->hilb_coeffs==NULL)
3102  { // La Scala
3103  fullres = syReorder(syzstr->res, length, syzstr);
3104  }
3105  else
3106  { // HRES
3107  minres = syReorder(syzstr->orderedRes, length, syzstr);
3108  syKillEmptyEntres(minres, length);
3109  }
3110  }
3111 
3112  resolvente tr;
3113  int typ0=IDEAL_CMD;
3114 
3115  if (minres!=NULL)
3116  tr = minres;
3117  else
3118  tr = fullres;
3119 
3120  resolvente trueres=NULL; intvec ** w=NULL;
3121 
3122  if (length>0)
3123  {
3124  trueres = (resolvente)omAlloc0((length)*sizeof(ideal));
3125  for (int i=(length)-1;i>=0;i--)
3126  {
3127  if (tr[i]!=NULL)
3128  {
3129  trueres[i] = idCopy(tr[i]);
3130  }
3131  }
3132  if ( id_RankFreeModule(trueres[0], currRing) > 0)
3133  typ0 = MODUL_CMD;
3134  if (syzstr->weights!=NULL)
3135  {
3136  w = (intvec**)omAlloc0(length*sizeof(intvec*));
3137  for (int i=length-1;i>=0;i--)
3138  {
3139  if (syzstr->weights[i]!=NULL) w[i] = ivCopy(syzstr->weights[i]);
3140  }
3141  }
3142  }
3143 
3144  lists li = liMakeResolv(trueres, length, syzstr->list_length,typ0,
3145  w, add_row_shift);
3146 
3147  if (w != NULL) omFreeSize(w, length*sizeof(intvec*));
3148 
3149  if (toDel)
3150  syKillComputation(syzstr);
3151  else
3152  {
3153  if( fullres != NULL && syzstr->fullres == NULL )
3154  syzstr->fullres = fullres;
3155 
3156  if( minres != NULL && syzstr->minres == NULL )
3157  syzstr->minres = minres;
3158  }
3159  return li;
3160 }
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:1643
Definition: lists.h:22
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
intvec * ivCopy(const intvec *o)
Definition: intvec.h:126
resolvente res
Definition: syz.h:47
intvec ** hilb_coeffs
Definition: syz.h:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
resolvente orderedRes
Definition: syz.h:48
Definition: intvec.h:14
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
int i
Definition: cfEzgcd.cc:123
resolvente fullres
Definition: syz.h:57
ideal idCopy(ideal A)
Definition: ideals.h:60
resolvente minres
Definition: syz.h:58
#define NULL
Definition: omList.c:10
lists liMakeResolv(resolvente r, int length, int reallen, int typ0, intvec **weights, int add_row_shift)
Definition: lists.cc:215
const CanonicalForm & w
Definition: facAbsFact.cc:55
short list_length
Definition: syz.h:62
ideal * resolvente
Definition: ideals.h:18
void syKillEmptyEntres(resolvente res, int length)
Definition: syz1.cc:2199
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 3194 of file ipshell.cc.

3195 {
3196  int typ0;
3198 
3199  resolvente fr = liFindRes(li,&(result->length),&typ0);
3200  result->minres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
3201  for (int i=result->length-1;i>=0;i--)
3202  {
3203  if (fr[i]!=NULL)
3204  result->minres[i] = idCopy(fr[i]);
3205  }
3206  omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
3207  return result;
3208 }
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:116
int i
Definition: cfEzgcd.cc:123
ideal idCopy(ideal A)
Definition: ideals.h:60
resolvente minres
Definition: syz.h:58
#define NULL
Definition: omList.c:10
ideal * resolvente
Definition: ideals.h:18
#define omAlloc0(size)
Definition: omAllocDecl.h:211
return result
Definition: facAbsBiFact.cc:76
ssyStrategy * syStrategy
Definition: syz.h:35

§ test_cmd()

void test_cmd ( int  i)

Definition at line 512 of file ipshell.cc.

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

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

§ type_cmd()

void type_cmd ( leftv  v)

Definition at line 248 of file ipshell.cc.

249 {
250  BOOLEAN oldShortOut = FALSE;
251 
252  if (currRing != NULL)
253  {
254  oldShortOut = currRing->ShortOut;
255  currRing->ShortOut = 1;
256  }
257  int t=v->Typ();
258  Print("// %s %s ",v->Name(),Tok2Cmdname(t));
259  switch (t)
260  {
261  case MAP_CMD:Print(" from %s\n",((map)(v->Data()))->preimage); break;
262  case INTMAT_CMD: Print(" %d x %d\n",((intvec*)(v->Data()))->rows(),
263  ((intvec*)(v->Data()))->cols()); break;
264  case MATRIX_CMD:Print(" %u x %u\n" ,
265  MATROWS((matrix)(v->Data())),
266  MATCOLS((matrix)(v->Data())));break;
267  case MODUL_CMD: Print(", rk %d\n", (int)(((ideal)(v->Data()))->rank));break;
268  case LIST_CMD: Print(", size %d\n",((lists)(v->Data()))->nr+1); break;
269 
270  case PROC_CMD:
271  case RING_CMD:
272  case IDEAL_CMD: PrintLn(); break;
273 
274  //case INT_CMD:
275  //case STRING_CMD:
276  //case INTVEC_CMD:
277  //case POLY_CMD:
278  //case VECTOR_CMD:
279  //case PACKAGE_CMD:
280 
281  default:
282  break;
283  }
284  v->Print();
285  if (currRing != NULL)
286  currRing->ShortOut = oldShortOut;
287 }
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:95
int Typ()
Definition: subexpr.cc:1004
const char * Name()
Definition: subexpr.h:121
void Print(leftv store=NULL, int spaces=0)
Called by type_cmd (e.g. "r;") or as default in jPRINT.
Definition: subexpr.cc:73
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:130
void * Data()
Definition: subexpr.cc:1146
Definition: tok.h:117
#define MATROWS(i)
Definition: matpol.h:27
int BOOLEAN
Definition: auxiliary.h:86

§ versionString()

char* versionString ( )

Definition at line 778 of file misc_ip.cc.

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

§ dArith3

struct sValCmd3 dArith3[]

Definition at line 719 of file table.h.

§ dArithM

struct sValCmdM dArithM[]

Definition at line 828 of file table.h.

§ iiCurrArgs

leftv iiCurrArgs

Definition at line 80 of file ipshell.cc.

§ iiCurrProc

idhdl iiCurrProc

Definition at line 81 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 82 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.