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) |
| |
| 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 468 of file asciiLink.cc.
469{
470 if (*list_of_libs==
NULL)
471 {
472 #define MAX_LIBS 256
474 (*list_of_libs)[0]=
name;
475 (*list_of_libs)[
MAX_LIBS-1]=(
char*)1;
477 }
478 else
479 {
480 char **
p=*list_of_libs;
481 while (((*
p)!=
NULL)&&((*
p!=(
char*)1)))
482 {
485 }
487 {
490 }
491 else
492 {
494 }
495 }
497}
char name(const Variable &v)
void WerrorS(const char *s)
◆ DumpAscii()
| static BOOLEAN DumpAscii |
( |
FILE * |
fd, |
|
|
idhdl |
h, |
|
|
char *** |
list_of_libs |
|
) |
| |
|
static |
Definition at line 240 of file asciiLink.cc.
241{
243
245
246
247
250
252
255 else
257}
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 288 of file asciiLink.cc.
289{
292
294 {
298 }
300 {
301
304 #ifdef SINGULAR_4_2
307 #endif
308 }
309
310
311 if (type_str ==
NULL)
313
314
317
318
321
322
325
326
331
332
333 if (fprintf(
fd,
"%s %s", type_str,
IDID(
h)) == EOF)
335
337 {
339 if (fprintf(
fd,
"[%d][%d]", id->nrows, id->ncols)== EOF)
return TRUE;
340 }
342 {
345 }
347 {
349 if (fprintf(
fd,
"[%d][%d]", (
int)id->rank,
IDELEMS(
id))== EOF)
return TRUE;
350 }
351
353 {
354 return (fputs(
";\n",
fd) == EOF);
355 }
356
357
358 if (fputs(
" = ",
fd) == EOF)
return TRUE;
359
360
362
363
364 if (fputs(
";\n",
fd) == EOF)
return TRUE;
365
367}
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 259 of file asciiLink.cc.
260{
263
267 {
268 char *rhs;
271
272 if (fprintf(
fd,
"setring %s;\n",
IDID(rhdl)) == EOF)
return TRUE;
274 IDMAP(
h)->preimage, rhs) == EOF)
275 {
278 }
279 else
280 {
283 }
284 }
286}
static BOOLEAN DumpAsciiMaps(FILE *fd, idhdl h, idhdl rhdl)
const char * Tok2Cmdname(int tok)
◆ DumpNCring()
Definition at line 419 of file asciiLink.cc.
420{
421 char *ring_str =
h->String();
423
425 {
426 if (fprintf(
fd,
"ring temp_ring = %s;\n", ring_str)
428 if (fprintf(
fd,
"ideal temp_C = %s;\n",
431 if (fprintf(
fd,
"ideal temp_D = %s;\n",
434 if (fprintf(
fd,
"def %s = nc_algebra(temp_C,temp_D);\n",
IDID(
h)) == EOF)
436 if (fputs(
"kill temp_ring;\n",
fd) == EOF)
return TRUE;
437 }
439 {
440
441
444 }
447}
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 449 of file asciiLink.cc.
450{
451 char *ring_str =
h->String();
453 if (fprintf(
fd,
"ring temp_ring = %s;\n", ring_str) == EOF)
return TRUE;
454 if (fprintf(
fd,
"ideal temp_ideal = %s;\n",
457 if (fputs(
"attrib(temp_ideal, \"isSB\", 1);\n",
fd) == EOF)
return TRUE;
458 if (fprintf(
fd,
"qring %s = temp_ideal;\n",
IDID(
h)) == EOF)
460 if (fputs(
"kill temp_ring;\n",
fd) == EOF)
return TRUE;
461 else
462 {
465 }
466}
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 500 of file asciiLink.cc.
501{
503
505 {
508
510
512 {
515 }
516 if (nl > 0)
517 {
519 }
521 }
523 {
526 while (*
pstr !=
'\0')
527 {
528 if (*
pstr ==
'"' || *
pstr ==
'\\') fputc(
'\\',
fd);
531 }
533 }
535 {
538 {
539
540 char *
pstr =
pi->data.s.body;
542 while (*
pstr !=
'\0')
543 {
544 if (*
pstr ==
'"' || *
pstr ==
'\\') fputc(
'\\',
fd);
547 }
549 }
550 else fputs(
"(null)",
fd);
551 }
552 else
553 {
554 char *rhs =
h->String();
555
556 if (rhs ==
NULL)
return EOF;
557
560 else if (type_id ==
IDEAL_CMD) { fputs(
"ideal(",
fd);need_klammer=
TRUE; }
562 { fputs(
"module(",
fd);need_klammer=
TRUE; }
564
565 if (fputs(rhs,
fd) == EOF)
return EOF;
567
570 {
574 if (fprintf(
fd,
"; minpoly = %s", rhs) == EOF) {
omFree(rhs);
return EOF;}
576 }
577 else if (need_klammer) fputc(
')',
fd);
578 }
579 return 1;
580}
@ 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 369 of file asciiLink.cc.
370{
372
373 switch(type)
374 {
376
377
378
379
380
381
382
383
384
385
387 #ifdef SINGULAR_4_2
390 #endif
408
412
413 default:
416 }
417}
◆ 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 211 of file asciiLink.cc.
212{
213 FILE *
fd = (FILE *)
l->data;
215 char **list_of_libs=
NULL;
217
219
222 char **
p=list_of_libs;
224 {
225 while((*
p!=
NULL) && (*
p!=(
char*)1))
226 {
227 fprintf(
fd,
"load(\"%s\",\"try\");\n",*
p);
229 }
231 }
232 fputs(
"RETURN();\n",
fd);
234
236}
◆ slGetDumpAscii()
Definition at line 582 of file asciiLink.cc.
583{
584 if (
l->name[0] ==
'\0')
585 {
586 WerrorS(
"getdump: Can not get dump from stdin");
588 }
589 else
590 {
594
597
599
601
604 else
605 {
606
607
608 FILE *
f = (FILE *)
l->data;
611 }
612 }
613}
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}
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)
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 616 of file asciiLink.cc.
617{
632}
BOOLEAN slGetDumpAscii(si_link l)
BOOLEAN slCloseAscii(si_link l)
EXTERN_VAR si_link_extension si_link_root
const char * slStatusAscii(si_link l, const char *request)
leftv slReadAscii(si_link l)
BOOLEAN slWriteAscii(si_link l, leftv v)
BOOLEAN slDumpAscii(si_link l)
BOOLEAN slOpenAscii(si_link l, short flag, leftv)
const CanonicalForm int s
VAR omBin s_si_link_extension_bin
◆ slStatusAscii()
Definition at line 194 of file asciiLink.cc.
195{
196 if (strcmp(request, "read") == 0)
197 {
199 else return "not ready";
200 }
201 else if (strcmp(request, "write") == 0)
202 {
204 else return "not ready";
205 }
206 else return "unknown status request";
207}
#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 default:
175
177 {
179 fputc('\n',outfile);
181 }
182 else
183 {
184 WerrorS(
"cannot convert to string");
186 }
187 }
189 }
190 fflush(outfile);
191 return err;
192}
◆ si_link_root