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) |
|
static BOOLEAN | DumpNCring (FILE *fd, idhdl h) |
|
static BOOLEAN | DumpAsciiMaps (FILE *fd, idhdl h, idhdl rhdl) |
|
static BOOLEAN | CollectLibs (char *name, char ***list_of_libs) |
|
static BOOLEAN | slOpenAscii (si_link l, short flag, leftv) |
|
static BOOLEAN | slCloseAscii (si_link l) |
|
static leftv | slReadAscii2 (si_link l, leftv pr) |
|
static leftv | slReadAscii (si_link l) |
|
static BOOLEAN | slWriteAscii (si_link l, leftv v) |
|
const char * | slStatusAscii (si_link l, const char *request) |
|
static BOOLEAN | slDumpAscii (si_link l) |
|
static BOOLEAN | slGetDumpAscii (si_link l) |
|
void | slStandardInit () |
|
◆ MAX_LIBS
◆ CollectLibs()
static BOOLEAN CollectLibs |
( |
char * |
name, |
|
|
char *** |
list_of_libs |
|
) |
| |
|
static |
Definition at line 483 of file asciiLink.cc.
484{
485 if (*list_of_libs==
NULL)
486 {
487 #define MAX_LIBS 256
489 (*list_of_libs)[0]=
name;
490 (*list_of_libs)[
MAX_LIBS-1]=(
char*)1;
492 }
493 else
494 {
495 char **
p=*list_of_libs;
496 while (((*
p)!=
NULL)&&((*
p!=(
char*)1)))
497 {
500 }
502 {
505 }
506 else
507 {
509 }
510 }
512}
void WerrorS(const char *s)
int name
New type name for int.
◆ DumpAscii()
static BOOLEAN DumpAscii |
( |
FILE * |
fd, |
|
|
idhdl |
h, |
|
|
char *** |
list_of_libs |
|
) |
| |
|
static |
Definition at line 255 of file asciiLink.cc.
256{
258
260
261
262
265
267
270 else
272}
static BOOLEAN DumpAscii(FILE *fd, idhdl h, char ***list_of_libs)
static BOOLEAN DumpAsciiIdhdl(FILE *fd, idhdl h, char ***list_of_libs)
◆ DumpAsciiIdhdl()
static BOOLEAN DumpAsciiIdhdl |
( |
FILE * |
fd, |
|
|
idhdl |
h, |
|
|
char *** |
list_of_libs |
|
) |
| |
|
static |
Definition at line 303 of file asciiLink.cc.
304{
307
309 {
313 }
315 {
316
319 #ifdef SINGULAR_4_2
322 #endif
323 }
324
325
326 if (type_str ==
NULL)
328
329
332
333
336
337
340
341
346
347
348 if (fprintf(
fd,
"%s %s", type_str,
IDID(
h)) == EOF)
350
352 {
354 if (fprintf(
fd,
"[%d][%d]", id->nrows, id->ncols)== EOF)
return TRUE;
355 }
357 {
360 }
362 {
364 if (fprintf(
fd,
"[%d][%d]", (
int)id->rank,
IDELEMS(
id))== EOF)
return TRUE;
365 }
366
368 {
369 return (fputs(
";\n",
fd) == EOF);
370 }
371
372
373 if (fputs(
" = ",
fd) == EOF)
return TRUE;
374
375
377
378
379 if (fputs(
";\n",
fd) == EOF)
return TRUE;
380
382}
static const char * GetIdString(idhdl h)
static BOOLEAN CollectLibs(char *name, char ***list_of_libs)
static BOOLEAN DumpNCring(FILE *fd, idhdl h)
static int DumpRhs(FILE *fd, idhdl h)
static BOOLEAN DumpQring(FILE *fd, idhdl h)
static BOOLEAN rIsNCRing(const ring r)
◆ DumpAsciiMaps()
Definition at line 274 of file asciiLink.cc.
275{
278
282 {
283 char *rhs;
286
287 if (fprintf(
fd,
"setring %s;\n",
IDID(rhdl)) == EOF)
return TRUE;
289 IDMAP(
h)->preimage, rhs) == EOF)
290 {
293 }
294 else
295 {
298 }
299 }
301}
static BOOLEAN DumpAsciiMaps(FILE *fd, idhdl h, idhdl rhdl)
const char * Tok2Cmdname(int tok)
◆ DumpNCring()
Definition at line 434 of file asciiLink.cc.
435{
436 char *ring_str =
h->String();
438
440 {
441 if (fprintf(
fd,
"ring temp_ring = %s;\n", ring_str)
443 if (fprintf(
fd,
"ideal temp_C = %s;\n",
446 if (fprintf(
fd,
"ideal temp_D = %s;\n",
449 if (fprintf(
fd,
"def %s = nc_algebra(temp_C,temp_D);\n",
IDID(
h)) == EOF)
451 if (fputs(
"kill temp_ring;\n",
fd) == EOF)
return TRUE;
452 }
454 {
455
456
459 }
462}
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
char * iiStringMatrix(matrix im, int dim, const ring r, char ch)
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
static BOOLEAN rIsLPRing(const ring r)
◆ DumpQring()
Definition at line 464 of file asciiLink.cc.
465{
466 char *ring_str =
h->String();
468 if (fprintf(
fd,
"ring temp_ring = %s;\n", ring_str) == EOF)
return TRUE;
469 if (fprintf(
fd,
"ideal temp_ideal = %s;\n",
472 if (fputs(
"attrib(temp_ideal, \"isSB\", 1);\n",
fd) == EOF)
return TRUE;
473 if (fprintf(
fd,
"qring %s = temp_ideal;\n",
IDID(
h)) == EOF)
475 if (fputs(
"kill temp_ring;\n",
fd) == EOF)
return TRUE;
476 else
477 {
480 }
481}
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
◆ DumpRhs()
static int DumpRhs |
( |
FILE * |
fd, |
|
|
idhdl |
h |
|
) |
| |
|
static |
Definition at line 515 of file asciiLink.cc.
516{
518
520 {
523
525
527 {
530 }
531 if (nl > 0)
532 {
534 }
536 }
538 {
541 while (*
pstr !=
'\0')
542 {
543 if (*
pstr ==
'"' || *
pstr ==
'\\') fputc(
'\\',
fd);
546 }
548 }
550 {
553 {
554
555 char *
pstr =
pi->data.s.body;
557 while (*
pstr !=
'\0')
558 {
559 if (*
pstr ==
'"' || *
pstr ==
'\\') fputc(
'\\',
fd);
562 }
564 }
565 else fputs(
"(null)",
fd);
566 }
567 else
568 {
569 char *rhs =
h->String();
570
571 if (rhs ==
NULL)
return EOF;
572
575 else if (type_id ==
IDEAL_CMD) { fputs(
"ideal(",
fd);need_klammer=
TRUE; }
577 { fputs(
"module(",
fd);need_klammer=
TRUE; }
579
580 if (fputs(rhs,
fd) == EOF)
return EOF;
582
585 {
589 if (fprintf(
fd,
"; minpoly = %s", rhs) == EOF) {
omFree(rhs);
return EOF;}
591 }
592 else if (need_klammer) fputc(
')',
fd);
593 }
594 return 1;
595}
@ n_algExt
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)
void StringSetS(const char *st)
◆ GetIdString()
Definition at line 384 of file asciiLink.cc.
385{
387
388 switch(type)
389 {
391
392
393
394
395
396
397
398
399
400
402 #ifdef SINGULAR_4_2
405 #endif
423
427
428 default:
431 }
432}
◆ slCloseAscii()
Definition at line 96 of file asciiLink.cc.
97{
99 if (
l->name[0] !=
'\0')
100 {
101 return (fclose((FILE *)
l->data)!=0);
102 }
104}
#define SI_LINK_SET_CLOSE_P(l)
◆ slDumpAscii()
Definition at line 226 of file asciiLink.cc.
227{
228 FILE *
fd = (FILE *)
l->data;
230 char **list_of_libs=
NULL;
232
234
237 char **
p=list_of_libs;
239 {
240 while((*
p!=
NULL) && (*
p!=(
char*)1))
241 {
242 fprintf(
fd,
"load(\"%s\",\"try\");\n",*
p);
244 }
246 }
247 fputs(
"RETURN();\n",
fd);
249
251}
◆ slGetDumpAscii()
Definition at line 597 of file asciiLink.cc.
598{
599 if (
l->name[0] ==
'\0')
600 {
601 WerrorS(
"getdump: Can not get dump from stdin");
603 }
604 else
605 {
609
612
614
616
619 else
620 {
621
622
623 FILE *
f = (FILE *)
l->data;
626 }
627 }
628}
BOOLEAN newFile(char *fname)
◆ slOpenAscii()
Definition at line 35 of file asciiLink.cc.
36{
37 const char *mode;
39 {
40 if (
l->mode[0] !=
'\0' && (strcmp(
l->mode,
"r") == 0))
43 }
44
46 else if (strcmp(
l->mode,
"w") == 0) mode =
"w";
47 else mode = "a";
48
49
50 if (
l->name[0] ==
'\0')
51 {
52
54 {
55 l->data = (
void *) stdin;
56 mode = "r";
57 }
58 else
59 {
60 l->data = (
void *) stdout;
61 mode = "a";
62 }
63 }
64 else
65 {
66
67 FILE *outfile;
68 char *filename=
l->name;
69
70 if(filename[0]=='>')
71 {
72 if (filename[1]=='>')
73 {
74 filename+=2;
75 mode = "a";
76 }
77 else
78 {
79 filename++;
80 mode="w";
81 }
82 }
85 l->data = (
void *) outfile;
86 else
88 }
89
94}
FILE * myfopen(const char *path, const char *mode)
#define SI_LINK_SET_OPEN_P(l, flag)
◆ slReadAscii()
Definition at line 141 of file asciiLink.cc.
142{
144 memset(&tmp,0,
sizeof(
sleftv));
146 tmp.
data=(
void*)
"? ";
148}
static leftv slReadAscii2(si_link l, leftv pr)
Class used for (list of) interpreter objects.
◆ slReadAscii2()
Definition at line 106 of file asciiLink.cc.
107{
108 FILE *
fp=(FILE *)
l->data;
111 {
114 if (len<0) len=0;
118 Print(
"//Reading %ld chars\n",len);
121 }
122 else
123 {
125 {
128 }
129 else
130 {
131 WerrorS(
"read(<link>,<string>) expected");
133 }
134 }
139}
const Variable & v
< [in] a sqrfree bivariate poly
size_t myfread(void *ptr, size_t size, size_t nmemb, FILE *stream)
if(!FE_OPT_NO_SHELL_FLAG)(void) system(sys)
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
EXTERN_VAR omBin sleftv_bin
int status int void * buf
◆ slStandardInit()
Definition at line 631 of file asciiLink.cc.
632{
647}
static BOOLEAN slGetDumpAscii(si_link l)
static BOOLEAN slCloseAscii(si_link l)
EXTERN_VAR si_link_extension si_link_root
static BOOLEAN slDumpAscii(si_link l)
const char * slStatusAscii(si_link l, const char *request)
static BOOLEAN slWriteAscii(si_link l, leftv v)
static leftv slReadAscii(si_link l)
static BOOLEAN slOpenAscii(si_link l, short flag, leftv)
const CanonicalForm int s
VAR omBin s_si_link_extension_bin
◆ slStatusAscii()
Definition at line 209 of file asciiLink.cc.
210{
211 if (strcmp(request, "read") == 0)
212 {
214 else return "not ready";
215 }
216 else if (strcmp(request, "write") == 0)
217 {
219 else return "not ready";
220 }
221 else return "unknown status request";
222}
#define SI_LINK_W_OPEN_P(l)
#define SI_LINK_R_OPEN_P(l)
◆ slWriteAscii()
Definition at line 150 of file asciiLink.cc.
151{
152 FILE *outfile=(FILE *)
l->data;
156 {
158 {
162 {
163 ideal I=(ideal)
v->Data();
165 {
167 fwrite(
s,strlen(
s),1,outfile);
169 if (
i<
IDELEMS(I)-1) fwrite(
",",1,1,outfile);
170 }
171 break;
172 }
173 #if 1
175 {
177 for(
int i=0;
i<
l->nr;
i++)
178 {
179 char *
s=
l->m[
i].String();
180 fwrite(
s,strlen(
s),1,outfile);
182 if (
i!=
l->nr-1) fputc(
',',outfile);
183 fputc('\n',outfile);
184 }
185 break;
186 }
187 #endif
188 default:
190
192 {
194 fputc('\n',outfile);
196 }
197 else
198 {
199 WerrorS(
"cannot convert to string");
201 }
202 }
204 }
205 fflush(outfile);
206 return err;
207}
◆ si_link_root