#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 428 of file asciiLink.cc.
430 if (*list_of_libs==
NULL)
434 (*list_of_libs)[0]=
name;
435 (*list_of_libs)[
MAX_LIBS-1]=(
char*)1;
440 char **
p=*list_of_libs;
441 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 245 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 293 of file asciiLink.cc.
310 if (strcmp(
IDID(
h),
"flint_poly_Q")==0)
return FALSE;
314 if (type_str ==
NULL)
332 if (fprintf(
fd,
"%s %s", type_str,
IDID(
h)) == EOF)
338 if (fprintf(
fd,
"[%d][%d]", id->nrows, id->ncols)== EOF)
return TRUE;
348 return (fputs(
";\n",
fd) == EOF);
352 if (fputs(
" = ",
fd) == EOF)
return TRUE;
358 if (fputs(
";\n",
fd) == 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 264 of file asciiLink.cc.
277 if (fprintf(
fd,
"setring %s;\n",
IDID(rhdl)) == EOF)
return TRUE;
279 IDMAP(
h)->preimage, rhs) == EOF)
static BOOLEAN DumpAsciiMaps(FILE *fd, idhdl h, idhdl rhdl)
const char * Tok2Cmdname(int tok)
◆ DumpQring()
Definition at line 409 of file asciiLink.cc.
411 char *ring_str =
h->String();
417 if (fputs(
"attrib(temp_ideal, \"isSB\", 1);\n",
fd) == EOF)
return TRUE;
418 if (fprintf(
fd,
"%s %s = temp_ideal;\n", type_str,
IDID(
h)) == EOF)
420 if (fputs(
"kill temp_ring;\n",
fd) == EOF)
return TRUE;
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
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 460 of file asciiLink.cc.
486 while (*
pstr !=
'\0')
488 if (*
pstr ==
'"' || *
pstr ==
'\\') fputc(
'\\',
fd);
500 char *
pstr =
pi->data.s.body;
502 while (*
pstr !=
'\0')
504 if (*
pstr ==
'"' || *
pstr ==
'\\') fputc(
'\\',
fd);
510 else fputs(
"(null)",
fd);
514 char *rhs =
h->String();
516 if (rhs ==
NULL)
return EOF;
520 else if (type_id ==
IDEAL_CMD) { fputs(
"ideal(",
fd);need_klammer=
TRUE; }
521 else if (type_id ==
MODUL_CMD) { fputs(
"module(",
fd);need_klammer=
TRUE; }
524 if (fputs(rhs,
fd) == EOF)
return EOF;
533 if (fprintf(
fd,
"; minpoly = %s", rhs) == EOF) {
omFree(rhs);
return EOF;}
536 else if (need_klammer) fputc(
')',
fd);
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 363 of file asciiLink.cc.
372 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 216 of file asciiLink.cc.
218 FILE *
fd = (FILE *)
l->data;
220 char **list_of_libs=
NULL;
227 char **
p=list_of_libs;
230 while((*
p!=
NULL) && (*
p!=(
char*)1))
232 fprintf(
fd,
"load(\"%s\",\"try\");\n",*
p);
237 fputs(
"RETURN();\n",
fd);
static BOOLEAN DumpAsciiMaps(FILE *fd, idhdl h, idhdl rhdl)
static BOOLEAN DumpAscii(FILE *fd, idhdl h, char ***list_of_libs)
◆ slGetDumpAscii()
Definition at line 541 of file asciiLink.cc.
543 if (
l->name[0] ==
'\0')
545 WerrorS(
"getdump: Can not get dump from stdin");
567 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;
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 575 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 199 of file asciiLink.cc.
201 if (strcmp(request,
"read") == 0)
204 else return "not ready";
206 else if (strcmp(request,
"write") == 0)
209 else return "not ready";
211 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);
189 WerrorS(
"cannot convert to string");
const CanonicalForm int s
void WerrorS(const char *s)
const Variable & v
< [in] a sqrfree bivariate poly
◆ si_link_root
si_link_extension si_link_root |