44static si_link_extension
slTypeInit(si_link_extension
s,
const char* type);
57 while (istr[
i] !=
':' && istr[
i] !=
'\0')
i++;
69 while (istr[
j] !=
' ' && istr[
j] !=
'\0')
j++;
76 while (istr[
j] ==
' '&& istr[
j] !=
'\0')
j++;
82 while (istr[
j] ==
' '&& istr[
j] !=
'\0')
j++;
91 si_link_extension prev =
s;
93 while (strcmp(
s->type, type) != 0)
134 if (
l->m->Close !=
NULL)
l->m->Close(
l);
136 if ((
l->data !=
NULL) && (
l->m->Kill !=
NULL))
l->m->Kill(
l);
139 memset((
void *)
l, 0,
sizeof(ip_link));
149 if ((
l!=
NULL) &&(
l->ref == 0))
157 if (
l ==
NULL)
return "empty link";
158 else if (
l->m ==
NULL)
return "unknown link type";
159 else if (strcmp(request,
"type") == 0)
return l->m->type;
160 else if (strcmp(request,
"mode") == 0)
return l->mode;
161 else if (strcmp(request,
"name") == 0)
return l->name;
162 else if (strcmp(request,
"exists") ==0)
165 if (si_lstat(
l->name,&
buf)==0)
return "yes";
168 else if (strcmp(request,
"open") == 0)
173 else if (strcmp(request,
"openread") == 0)
178 else if (strcmp(request,
"openwrite") == 0)
183 else if (
l->m->Status ==
NULL)
return "unknown status request";
184 else return l->m->Status(
l, request);
208 Warn(
"open: link of type: %s, mode: %s, name: %s is already open",
209 l->m->type,
l->mode,
l->name);
212 else if (
l->m->Open !=
NULL)
214 res =
l->m->Open(
l, flag,
h);
216 Werror(
"open: Error for link %s of type: %s, mode: %s, name: %s",
217 c,
l->m->type,
l->mode,
l->name);
231 if (
l->m->PrepClose !=
NULL)
233 res =
l->m->PrepClose(
l);
235 Werror(
"close: Error for link of type: %s, mode: %s, name: %s",
236 l->m->type,
l->mode,
l->name);
249 if (
l->m->Close !=
NULL)
251 res =
l->m->Close(
l);
253 Werror(
"close: Error for link of type: %s, mode: %s, name: %s",
254 l->m->type,
l->mode,
l->name);
282 if (
l->m->Read !=
NULL)
v =
l->m->Read(
l);
286 if (
l->m->Read2 !=
NULL)
v =
l->m->Read2(
l,a);
291 Werror(
"read: Error to open link of type %s, mode: %s, name: %s for reading",
292 l->m->type,
l->mode,
l->name);
303 Werror(
"read: Error for link of type %s, mode: %s, name: %s",
304 l->m->type,
l->mode,
l->name);
327 if (
l->m->Write !=
NULL)
333 Werror(
"write: Error for link of type %s, mode: %s, name: %s",
334 l->m->type,
l->mode,
l->name);
339 Werror(
"write: Error to open link of type %s, mode: %s, name: %s for writing",
340 l->m->type,
l->mode,
l->name);
356 if (
l->m->Dump !=
NULL)
362 Werror(
"dump: Error for link of type %s, mode: %s, name: %s",
363 l->m->type,
l->mode,
l->name);
369 Werror(
"dump: Error to open link of type %s, mode: %s, name: %s for writing",
370 l->m->type,
l->mode,
l->name);
386 if (
l->m->GetDump !=
NULL)
387 res =
l->m->GetDump(
l);
392 Werror(
"getdump: Error for link of type %s, mode: %s, name: %s",
393 l->m->type,
l->mode,
l->name);
399 Werror(
"dump: Error open link of type %s, mode: %s, name: %s for reading",
400 l->m->type,
l->mode,
l->name);
408static si_link_extension
slTypeInit(si_link_extension
s,
const char* type)
417 else if (strcmp(type,
"DBM") == 0)
421 else if (strcmp(type,
"ssi") == 0)
425 else if (strcmp(type,
"|") == 0)
430 Warn(
"Found unknown link type: %s", type);
438 Werror(
"Can not initialize link type %s", type);
Class used for (list of) interpreter objects.
VAR volatile BOOLEAN do_shutdown
VAR volatile int defer_shutdown
const CanonicalForm int s
const Variable & v
< [in] a sqrfree bivariate poly
void WerrorS(const char *s)
static void * feOptValue(feOptIndex opt)
#define omFreeBin(addr, bin)
#define omGetSpecBin(size)
si_link_extension slInitPipeExtension(si_link_extension s)
void rChangeCurrRing(ring r)
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
void Werror(const char *fmt,...)
int status int void * buf
BOOLEAN slWrite(si_link l, leftv v)
VAR omBin s_si_link_extension_bin
BOOLEAN slPrepClose(si_link l)
leftv slRead(si_link l, leftv a)
BOOLEAN slDump(si_link l)
BOOLEAN slGetDump(si_link l)
VAR si_link_extension si_link_root
static si_link_extension slTypeInit(si_link_extension s, const char *type)
const char * slStatus(si_link l, const char *request)
BOOLEAN slClose(si_link l)
void slCleanUp(si_link l)
BOOLEAN slInit(si_link l, char *istr)
BOOLEAN slOpen(si_link l, short flag, leftv h)
BOOLEAN slSetRingDummy(si_link, ring r, BOOLEAN)
#define SI_LINK_W_OPEN_P(l)
#define SI_LINK_SET_CLOSE_P(l)
#define SI_LINK_R_OPEN_P(l)
#define SI_LINK_OPEN_P(l)
#define SI_LINK_CLOSE_P(l)
si_link_extension slInitDBMExtension(si_link_extension s)
si_link_extension slInitSsiExtension(si_link_extension s)
char name(const Variable &v)