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 485 of file asciiLink.cc.
486{
487 if (*list_of_libs==
NULL)
488 {
489 #define MAX_LIBS 256
491 (*list_of_libs)[0]=
name;
492 (*list_of_libs)[
MAX_LIBS-1]=(
char*)1;
494 }
495 else
496 {
497 char **
p=*list_of_libs;
498 while (((*
p)!=
NULL)&&((*
p!=(
char*)1)))
499 {
502 }
504 {
507 }
508 else
509 {
511 }
512 }
514}
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 257 of file asciiLink.cc.
258{
260
262
263
264
267
269
272 else
274}
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 305 of file asciiLink.cc.
306{
309
311 {
315 }
317 {
318
321 #ifdef SINGULAR_4_2
324 #endif
325 }
326
327
328 if (type_str ==
NULL)
330
331
334
335
338
339
342
343
348
349
350 if (fprintf(
fd,
"%s %s", type_str,
IDID(
h)) == EOF)
352
354 {
356 if (fprintf(
fd,
"[%d][%d]", id->nrows, id->ncols)== EOF)
return TRUE;
357 }
359 {
362 }
364 {
366 if (fprintf(
fd,
"[%d][%d]", (
int)id->rank,
IDELEMS(
id))== EOF)
return TRUE;
367 }
368
370 {
371 return (fputs(
";\n",
fd) == EOF);
372 }
373
374
375 if (fputs(
" = ",
fd) == EOF)
return TRUE;
376
377
379
380
381 if (fputs(
";\n",
fd) == EOF)
return TRUE;
382
384}
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 276 of file asciiLink.cc.
277{
280
284 {
285 char *rhs;
288
289 if (fprintf(
fd,
"setring %s;\n",
IDID(rhdl)) == EOF)
return TRUE;
291 IDMAP(
h)->preimage, rhs) == EOF)
292 {
295 }
296 else
297 {
300 }
301 }
303}
static BOOLEAN DumpAsciiMaps(FILE *fd, idhdl h, idhdl rhdl)
const char * Tok2Cmdname(int tok)
◆ DumpNCring()
Definition at line 436 of file asciiLink.cc.
437{
438 char *ring_str =
h->String();
440
442 {
443 if (fprintf(
fd,
"ring temp_ring = %s;\n", ring_str)
445 if (fprintf(
fd,
"ideal temp_C = %s;\n",
448 if (fprintf(
fd,
"ideal temp_D = %s;\n",
451 if (fprintf(
fd,
"def %s = nc_algebra(temp_C,temp_D);\n",
IDID(
h)) == EOF)
453 if (fputs(
"kill temp_ring;\n",
fd) == EOF)
return TRUE;
454 }
456 {
457
458
461 }
464}
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 466 of file asciiLink.cc.
467{
468 char *ring_str =
h->String();
470 if (fprintf(
fd,
"ring temp_ring = %s;\n", ring_str) == EOF)
return TRUE;
471 if (fprintf(
fd,
"ideal temp_ideal = %s;\n",
474 if (fputs(
"attrib(temp_ideal, \"isSB\", 1);\n",
fd) == EOF)
return TRUE;
475 if (fprintf(
fd,
"qring %s = temp_ideal;\n",
IDID(
h)) == EOF)
477 if (fputs(
"kill temp_ring;\n",
fd) == EOF)
return TRUE;
478 else
479 {
482 }
483}
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 517 of file asciiLink.cc.
518{
520
522 {
525
527
529 {
532 }
533 if (nl > 0)
534 {
536 }
538 }
540 {
543 while (*
pstr !=
'\0')
544 {
545 if (*
pstr ==
'"' || *
pstr ==
'\\') fputc(
'\\',
fd);
548 }
550 }
552 {
555 {
556
557 char *
pstr =
pi->data.s.body;
559 while (*
pstr !=
'\0')
560 {
561 if (*
pstr ==
'"' || *
pstr ==
'\\') fputc(
'\\',
fd);
564 }
566 }
567 else fputs(
"(null)",
fd);
568 }
569 else
570 {
571 char *rhs =
h->String();
572
573 if (rhs ==
NULL)
return EOF;
574
577 else if (type_id ==
IDEAL_CMD) { fputs(
"ideal(",
fd);need_klammer=
TRUE; }
579 { fputs(
"module(",
fd);need_klammer=
TRUE; }
581
582 if (fputs(rhs,
fd) == EOF)
return EOF;
584
587 {
591 if (fprintf(
fd,
"; minpoly = %s", rhs) == EOF) {
omFree(rhs);
return EOF;}
593 }
594 else if (need_klammer) fputc(
')',
fd);
595 }
596 return 1;
597}
@ 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 386 of file asciiLink.cc.
387{
389
390 switch(type)
391 {
393
394
395
396
397
398
399
400
401
402
404 #ifdef SINGULAR_4_2
407 #endif
425
429
430 default:
433 }
434}
◆ slCloseAscii()
Definition at line 98 of file asciiLink.cc.
99{
101 if (
l->name[0] !=
'\0')
102 {
103 return (fclose((FILE *)
l->data)!=0);
104 }
106}
#define SI_LINK_SET_CLOSE_P(l)
◆ slDumpAscii()
Definition at line 228 of file asciiLink.cc.
229{
230 FILE *
fd = (FILE *)
l->data;
232 char **list_of_libs=
NULL;
234
236
239 char **
p=list_of_libs;
241 {
242 while((*
p!=
NULL) && (*
p!=(
char*)1))
243 {
244 fprintf(
fd,
"load(\"%s\",\"try\");\n",*
p);
246 }
248 }
249 fputs(
"RETURN();\n",
fd);
251
253}
◆ slGetDumpAscii()
Definition at line 599 of file asciiLink.cc.
600{
601 if (
l->name[0] ==
'\0')
602 {
603 WerrorS(
"getdump: Can not get dump from stdin");
605 }
606 else
607 {
611
614
616
618
621 else
622 {
623
624
625 FILE *
f = (FILE *)
l->data;
628 }
629 }
630}
BOOLEAN newFile(char *fname)
◆ slOpenAscii()
Definition at line 36 of file asciiLink.cc.
37{
39 const char *mode;
41 {
42 if (
l->mode[0] !=
'\0' && (strcmp(
l->mode,
"r") == 0))
45 }
46
48 else if (strcmp(
l->mode,
"w") == 0) mode =
"w";
49 else mode = "a";
50
51
52 if (
l->name[0] ==
'\0')
53 {
54
56 {
57 l->data = (
void *) stdin;
58 mode = "r";
59 }
60 else
61 {
62 l->data = (
void *) stdout;
63 mode = "a";
64 }
65 }
66 else
67 {
68
69 FILE *outfile;
70 char *filename=
l->name;
71
72 if(filename[0]=='>')
73 {
74 if (filename[1]=='>')
75 {
76 filename+=2;
77 mode = "a";
78 }
79 else
80 {
81 filename++;
82 mode="w";
83 }
84 }
87 l->data = (
void *) outfile;
88 else
90 }
91
96}
FILE * myfopen(const char *path, const char *mode)
#define SI_LINK_SET_OPEN_P(l, flag)
◆ slReadAscii()
Definition at line 143 of file asciiLink.cc.
144{
146 memset(&tmp,0,
sizeof(
sleftv));
148 tmp.
data=(
void*)
"? ";
150}
static leftv slReadAscii2(si_link l, leftv pr)
Class used for (list of) interpreter objects.
◆ slReadAscii2()
Definition at line 108 of file asciiLink.cc.
109{
110 FILE *
fp=(FILE *)
l->data;
112 if (
fp!=
NULL &&
l->name[0] !=
'\0')
113 {
116 if (len<0) len=0;
120 Print(
"//Reading %ld chars\n",len);
123 }
124 else
125 {
127 {
130 }
131 else
132 {
133 WerrorS(
"read(<link>,<string>) expected");
135 }
136 }
141}
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 633 of file asciiLink.cc.
634{
649}
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 211 of file asciiLink.cc.
212{
213 if (strcmp(request, "read") == 0)
214 {
216 else return "not ready";
217 }
218 else if (strcmp(request, "write") == 0)
219 {
221 else return "not ready";
222 }
223 else return "unknown status request";
224}
#define SI_LINK_W_OPEN_P(l)
#define SI_LINK_R_OPEN_P(l)
◆ slWriteAscii()
Definition at line 152 of file asciiLink.cc.
153{
154 FILE *outfile=(FILE *)
l->data;
158 {
160 {
164 {
165 ideal I=(ideal)
v->Data();
167 {
169 fwrite(
s,strlen(
s),1,outfile);
171 if (
i<
IDELEMS(I)-1) fwrite(
",",1,1,outfile);
172 }
173 break;
174 }
175 #if 1
177 {
179 for(
int i=0;
i<
l->nr;
i++)
180 {
181 char *
s=
l->m[
i].String();
182 fwrite(
s,strlen(
s),1,outfile);
184 if (
i!=
l->nr-1) fputc(
',',outfile);
185 fputc('\n',outfile);
186 }
187 break;
188 }
189 #endif
190 default:
192
194 {
196 fputc('\n',outfile);
198 }
199 else
200 {
201 WerrorS(
"cannot convert to string");
203 }
204 }
206 }
207 fflush(outfile);
208 return err;
209}
◆ FE_OPT_NO_SHELL_FLAG
◆ si_link_root