45 static si_link_extension
slTypeInit(si_link_extension
s,
const char* type);
58 while (istr[i] !=
':' && istr[i] !=
'\0') i++;
70 while (istr[
j] !=
' ' && istr[
j] !=
'\0')
j++;
77 while (istr[
j] ==
' '&& istr[
j] !=
'\0')
j++;
78 if (istr[
j] !=
'\0') name =
omStrDup(&(istr[
j]));
83 while (istr[
j] ==
' '&& istr[
j] !=
'\0')
j++;
84 if (istr[
j] !=
'\0') name =
omStrDup(&(istr[
j]));
92 si_link_extension prev =
s;
94 while (strcmp(s->type, type) != 0)
135 if (l->m->Close !=
NULL) l->m->Close(l);
137 if ((l->data !=
NULL) && (l->m->Kill !=
NULL)) l->m->Kill(l);
140 memset((
void *) l, 0,
sizeof(ip_link));
150 if ((l!=
NULL) &&(l->ref == 0))
158 if (l ==
NULL)
return "empty link";
159 else if (l->m ==
NULL)
return "unknown link type";
160 else if (strcmp(request,
"type") == 0)
return l->m->type;
161 else if (strcmp(request,
"mode") == 0)
return l->mode;
162 else if (strcmp(request,
"name") == 0)
return l->name;
163 else if (strcmp(request,
"exists") ==0)
166 if (si_lstat(l->name,&buf)==0)
return "yes";
169 else if (strcmp(request,
"open") == 0)
174 else if (strcmp(request,
"openread") == 0)
179 else if (strcmp(request,
"openwrite") == 0)
184 else if (l->m->Status ==
NULL)
return "unknown status request";
185 else return l->m->Status(l, request);
209 Warn(
"open: link of type: %s, mode: %s, name: %s is already open",
210 l->m->type, l->mode, l->name);
213 else if (l->m->Open !=
NULL)
215 res = l->m->Open(l, flag, h);
217 Werror(
"open: Error for link %s of type: %s, mode: %s, name: %s",
218 c, l->m->type, l->mode, l->name);
232 if (l->m->PrepClose !=
NULL)
234 res = l->m->PrepClose(l);
236 Werror(
"close: Error for link of type: %s, mode: %s, name: %s",
237 l->m->type, l->mode, l->name);
250 if (l->m->Close !=
NULL)
252 res = l->m->Close(l);
254 Werror(
"close: Error for link of type: %s, mode: %s, name: %s",
255 l->m->type, l->mode, l->name);
283 if (l->m->Read !=
NULL) v = l->m->Read(l);
287 if (l->m->Read2 !=
NULL) v = l->m->Read2(l,a);
292 Werror(
"read: Error to open link of type %s, mode: %s, name: %s for reading",
293 l->m->type, l->mode, l->name);
304 Werror(
"read: Error for link of type %s, mode: %s, name: %s",
305 l->m->type, l->mode, l->name);
328 if (l->m->Write !=
NULL)
329 res = l->m->Write(l,v);
334 Werror(
"write: Error for link of type %s, mode: %s, name: %s",
335 l->m->type, l->mode, l->name);
340 Werror(
"write: Error to open link of type %s, mode: %s, name: %s for writing",
341 l->m->type, l->mode, l->name);
357 if (l->m->Dump !=
NULL)
363 Werror(
"dump: Error for link of type %s, mode: %s, name: %s",
364 l->m->type, l->mode, l->name);
370 Werror(
"dump: Error to open link of type %s, mode: %s, name: %s for writing",
371 l->m->type, l->mode, l->name);
387 if (l->m->GetDump !=
NULL)
388 res = l->m->GetDump(l);
393 Werror(
"getdump: Error for link of type %s, mode: %s, name: %s",
394 l->m->type, l->mode, l->name);
400 Werror(
"dump: Error open link of type %s, mode: %s, name: %s for reading",
401 l->m->type, l->mode, l->name);
409 static si_link_extension
slTypeInit(si_link_extension
s,
const char* type)
418 else if (strcmp(type,
"DBM") == 0)
422 else if (strcmp(type,
"ssi") == 0)
426 else if (strcmp(type,
"|") == 0)
431 Warn(
"Found unknown link type: %s", type);
432 Warn(
"Use default link type: %s", si_link_root->type);
439 Werror(
"Can not initialize link type %s", type);
const CanonicalForm int s
Class used for (list of) interpreter objects.
#define SI_LINK_CLOSE_P(l)
static void * feOptValue(feOptIndex opt)
leftv slRead(si_link l, leftv a)
#define SI_LINK_R_OPEN_P(l)
si_link_extension slInitSsiExtension(si_link_extension s)
si_link_extension si_link_root
static si_link_extension slTypeInit(si_link_extension s, const char *type)
void WerrorS(const char *s)
const char * slStatus(si_link l, const char *request)
BOOLEAN slOpen(si_link l, short flag, leftv h)
#define SI_LINK_SET_CLOSE_P(l)
omBin s_si_link_extension_bin
volatile BOOLEAN do_shutdown
BOOLEAN slInit(si_link l, char *istr)
BOOLEAN slPrepClose(si_link l)
char name(const Variable &v)
BOOLEAN slWrite(si_link l, leftv v)
void rChangeCurrRing(ring r)
#define omGetSpecBin(size)
const Variable & v
< [in] a sqrfree bivariate poly
BOOLEAN slSetRingDummy(si_link, ring r, BOOLEAN)
si_link_extension slInitDBMExtension(si_link_extension s)
#define SI_LINK_W_OPEN_P(l)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
BOOLEAN slDump(si_link l)
volatile int defer_shutdown
void slCleanUp(si_link l)
BOOLEAN slClose(si_link l)
BOOLEAN slGetDump(si_link l)
#define omFreeBin(addr, bin)
void Werror(const char *fmt,...)
si_link_extension slInitPipeExtension(si_link_extension s)
#define SI_LINK_OPEN_P(l)