#include <kernel/mod2.h>
#include <misc/options.h>
#include <omalloc/omalloc.h>
#include <Singular/tok.h>
#include <Singular/subexpr.h>
#include <Singular/ipshell.h>
#include <Singular/ipid.h>
#include <Singular/fevoices.h>
#include <kernel/oswrapper/feread.h>
#include <Singular/links/silink.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
Go to the source code of this file.
|
static BOOLEAN | DumpAscii (FILE *fd, idhdl h, char ***list_of_libs) |
|
static BOOLEAN | DumpAsciiIdhdl (FILE *fd, idhdl h, char ***list_of_libs) |
|
static const char * | GetIdString (idhdl h) |
|
static int | DumpRhs (FILE *fd, idhdl h) |
|
static BOOLEAN | DumpQring (FILE *fd, idhdl h, const char *type_str) |
|
static BOOLEAN | DumpAsciiMaps (FILE *fd, idhdl h, idhdl rhdl) |
|
static BOOLEAN | CollectLibs (char *name, char ***list_of_libs) |
|
BOOLEAN | slOpenAscii (si_link l, short flag, leftv) |
|
BOOLEAN | slCloseAscii (si_link l) |
|
leftv | slReadAscii2 (si_link l, leftv pr) |
|
leftv | slReadAscii (si_link l) |
|
BOOLEAN | slWriteAscii (si_link l, leftv v) |
|
const char * | slStatusAscii (si_link l, const char *request) |
|
BOOLEAN | slDumpAscii (si_link l) |
|
BOOLEAN | slGetDumpAscii (si_link l) |
|
void | slStandardInit () |
|
◆ MAX_LIBS
◆ CollectLibs()
static BOOLEAN CollectLibs |
( |
char * |
name, |
|
|
char *** |
list_of_libs |
|
) |
| |
|
static |
Definition at line 427 of file asciiLink.cc.
429 if (*list_of_libs==
NULL)
433 (*list_of_libs)[0]=
name;
434 (*list_of_libs)[
MAX_LIBS-1]=(
char*)1;
439 char **
p=*list_of_libs;
440 while (((*p)!=
NULL)&&((*p!=(
char*)1)))
void WerrorS(const char *s)
char name(const Variable &v)
◆ DumpAscii()
static BOOLEAN DumpAscii |
( |
FILE * |
fd, |
|
|
idhdl |
h, |
|
|
char *** |
list_of_libs |
|
) |
| |
|
static |
Definition at line 244 of file asciiLink.cc.
static BOOLEAN DumpAsciiIdhdl(FILE *fd, idhdl h, char ***list_of_libs)
static BOOLEAN DumpAscii(FILE *fd, idhdl h, char ***list_of_libs)
◆ DumpAsciiIdhdl()
static BOOLEAN DumpAsciiIdhdl |
( |
FILE * |
fd, |
|
|
idhdl |
h, |
|
|
char *** |
list_of_libs |
|
) |
| |
|
static |
Definition at line 292 of file asciiLink.cc.
295 int type_id =
IDTYP(h);
299 if (strcmp(
IDID(h),
"Top")==0)
return FALSE;
305 if (strcmp(
IDID(h),
"QQ")==0)
return FALSE;
306 if (strcmp(
IDID(h),
"ZZ")==0)
return FALSE;
307 if (strcmp(
IDID(h),
"AE")==0)
return FALSE;
308 if (strcmp(
IDID(h),
"QAE")==0)
return FALSE;
309 if (strcmp(
IDID(h),
"flint_poly_Q")==0)
return FALSE;
313 if (type_str ==
NULL)
331 if (fprintf(
fd,
"%s %s", type_str,
IDID(h)) == EOF)
337 if (fprintf(
fd,
"[%d][%d]", id->nrows, id->ncols)== EOF)
return TRUE;
347 return (fprintf(
fd,
";\n") == EOF);
351 if (fprintf(
fd,
" = ") == EOF)
return TRUE;
357 if (fprintf(
fd,
";\n") == EOF)
return TRUE;
static const char * GetIdString(idhdl h)
static int DumpRhs(FILE *fd, idhdl h)
static BOOLEAN CollectLibs(char *name, char ***list_of_libs)
static BOOLEAN DumpQring(FILE *fd, idhdl h, const char *type_str)
◆ DumpAsciiMaps()
Definition at line 263 of file asciiLink.cc.
276 if (fprintf(
fd,
"setring %s;\n",
IDID(rhdl)) == EOF)
return TRUE;
278 IDMAP(h)->preimage, rhs) == EOF)
static BOOLEAN DumpAsciiMaps(FILE *fd, idhdl h, idhdl rhdl)
char * String(BOOLEAN typed=FALSE)
const char * Tok2Cmdname(int tok)
◆ DumpQring()
Definition at line 408 of file asciiLink.cc.
410 char *ring_str = h->
String();
416 if (fprintf(
fd,
"attrib(temp_ideal, \"isSB\", 1);\n") == EOF)
return TRUE;
417 if (fprintf(
fd,
"%s %s = temp_ideal;\n", type_str,
IDID(h)) == EOF)
419 if (fprintf(
fd,
"kill temp_ring;\n") == EOF)
return TRUE;
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
char * String(BOOLEAN typed=FALSE)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
const char * Tok2Cmdname(int tok)
char * iiStringMatrix(matrix im, int dim, const ring r, char ch)
◆ DumpRhs()
static int DumpRhs |
( |
FILE * |
fd, |
|
|
idhdl |
h |
|
) |
| |
|
static |
Definition at line 459 of file asciiLink.cc.
461 int type_id =
IDTYP(h);
468 fprintf(
fd,
"list(");
485 while (*pstr !=
'\0')
487 if (*pstr ==
'"' || *pstr ==
'\\') fputc(
'\\',
fd);
499 char *pstr = pi->
data.s.body;
501 while (*pstr !=
'\0')
503 if (*pstr ==
'"' || *pstr ==
'\\') fputc(
'\\',
fd);
509 else fputs(
"(null)",
fd);
515 if (rhs ==
NULL)
return EOF;
519 else if (type_id ==
IDEAL_CMD) { fprintf(
fd,
"ideal(");need_klammer=
TRUE; }
520 else if (type_id ==
MODUL_CMD) { fprintf(
fd,
"module(");need_klammer=
TRUE; }
521 else if (type_id ==
BIGINT_CMD) { fprintf(
fd,
"bigint(");need_klammer=
TRUE; }
523 if (fprintf(
fd,
"%s", rhs) == EOF)
return EOF;
532 if (fprintf(
fd,
"; minpoly = %s", rhs) == EOF) {
omFree(rhs);
return EOF;}
535 else if (need_klammer) fprintf(
fd,
")");
char * String(BOOLEAN typed=FALSE)
static int DumpRhs(FILE *fd, idhdl h)
void StringSetS(const char *st)
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic ...
void p_Write(poly p, ring lmRing, ring tailRing)
◆ GetIdString()
Definition at line 362 of file asciiLink.cc.
371 int i, nl = l->
nr + 1;
static const char * GetIdString(idhdl h)
const char * Tok2Cmdname(int tok)
◆ slCloseAscii()
Definition at line 102 of file asciiLink.cc.
105 if (
l->name[0] !=
'\0')
107 return (fclose((FILE *)
l->data)!=0);
#define SI_LINK_SET_CLOSE_P(l)
◆ slDumpAscii()
Definition at line 215 of file asciiLink.cc.
217 FILE *
fd = (FILE *)
l->data;
219 char **list_of_libs=
NULL;
226 char **
p=list_of_libs;
229 while((*p!=
NULL) && (*p!=(
char*)1))
231 fprintf(fd,
"load(\"%s\",\"try\");\n",*p);
236 fprintf(fd,
"RETURN();\n");
static BOOLEAN DumpAsciiMaps(FILE *fd, idhdl h, idhdl rhdl)
static BOOLEAN DumpAscii(FILE *fd, idhdl h, char ***list_of_libs)
◆ slGetDumpAscii()
Definition at line 540 of file asciiLink.cc.
542 if (
l->name[0] ==
'\0')
544 WerrorS(
"getdump: Can not get dump from stdin");
566 FILE *
f = (FILE *)
l->data;
void WerrorS(const char *s)
BOOLEAN newFile(char *fname, FILE *f)
◆ slOpenAscii()
Definition at line 41 of file asciiLink.cc.
46 if (
l->mode[0] !=
'\0' && (strcmp(
l->mode,
"r") == 0))
52 else if (strcmp(
l->mode,
"w") == 0) mode =
"w";
56 if (
l->name[0] ==
'\0')
61 l->data = (
void *) stdin;
66 l->data = (
void *) stdout;
74 char *filename=
l->name;
91 l->data = (
void *) outfile;
#define SI_LINK_SET_OPEN_P(l, flag)
FILE * myfopen(const char *path, const char *mode)
◆ slReadAscii()
Definition at line 146 of file asciiLink.cc.
149 memset(&tmp,0,
sizeof(
sleftv));
151 tmp.
data=(
void*)
"? ";
Class used for (list of) interpreter objects.
leftv slReadAscii2(si_link l, leftv pr)
◆ slReadAscii2()
Definition at line 112 of file asciiLink.cc.
114 FILE *
fp=(FILE *)
l->data;
116 if (fp!=
NULL &&
l->name[0] !=
'\0')
123 Print(
"//Reading %ld chars\n",len);
136 WerrorS(
"read(<link>,<string>) expected");
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
Class used for (list of) interpreter objects.
void WerrorS(const char *s)
size_t myfread(void *ptr, size_t size, size_t nmemb, FILE *stream)
int status int void * buf
const Variable & v
< [in] a sqrfree bivariate poly
◆ slStandardInit()
Definition at line 574 of file asciiLink.cc.
const CanonicalForm int s
leftv slReadAscii(si_link l)
BOOLEAN slOpenAscii(si_link l, short flag, leftv)
si_link_extension si_link_root
BOOLEAN slGetDumpAscii(si_link l)
omBin s_si_link_extension_bin
leftv slReadAscii2(si_link l, leftv pr)
const char * slStatusAscii(si_link l, const char *request)
BOOLEAN slCloseAscii(si_link l)
BOOLEAN slWriteAscii(si_link l, leftv v)
BOOLEAN slDumpAscii(si_link l)
◆ slStatusAscii()
Definition at line 198 of file asciiLink.cc.
200 if (strcmp(request,
"read") == 0)
203 else return "not ready";
205 else if (strcmp(request,
"write") == 0)
208 else return "not ready";
210 else return "unknown status request";
#define SI_LINK_R_OPEN_P(l)
#define SI_LINK_W_OPEN_P(l)
◆ slWriteAscii()
Definition at line 155 of file asciiLink.cc.
157 FILE *outfile=(FILE *)
l->data;
168 ideal I=(ideal)v->
Data();
172 fwrite(s,strlen(s),1,outfile);
174 if (
i<
IDELEMS(I)-1) fwrite(
",",1,1,outfile);
183 fprintf(outfile,
"%s\n",s);
188 WerrorS(
"cannot convert to string");
const CanonicalForm int s
void WerrorS(const char *s)
char * String(void *d=NULL, BOOLEAN typed=FALSE, int dim=1)
Called for conversion to string (used by string(..), write(..),..)
◆ si_link_root
si_link_extension si_link_root |