35 #include <sys/types.h> 50 static si_link_extension
slTypeInit(si_link_extension
s,
const char* type);
63 while (istr[
i] !=
':' && istr[
i] !=
'\0')
i++;
75 while (istr[
j] !=
' ' && istr[
j] !=
'\0')
j++;
82 while (istr[
j] ==
' '&& istr[
j] !=
'\0')
j++;
88 while (istr[
j] ==
' '&& istr[
j] !=
'\0')
j++;
97 si_link_extension prev =
s;
99 while (strcmp(
s->type, type) != 0)
140 if (
l->m->Close !=
NULL)
l->m->Close(
l);
142 if ((
l->data !=
NULL) && (
l->m->Kill !=
NULL))
l->m->Kill(
l);
145 memset((
void *)
l, 0,
sizeof(ip_link));
155 if ((
l!=
NULL) &&(
l->ref == 0))
163 if (
l ==
NULL)
return "empty link";
164 else if (
l->m ==
NULL)
return "unknown link type";
165 else if (strcmp(request,
"type") == 0)
return l->m->type;
166 else if (strcmp(request,
"mode") == 0)
return l->mode;
167 else if (strcmp(request,
"name") == 0)
return l->name;
168 else if (strcmp(request,
"exists") ==0)
171 if (si_lstat(
l->name,&
buf)==0)
return "yes";
174 else if (strcmp(request,
"open") == 0)
179 else if (strcmp(request,
"openread") == 0)
184 else if (strcmp(request,
"openwrite") == 0)
189 else if (
l->m->Status ==
NULL)
return "unknown status request";
190 else return l->m->Status(
l, request);
214 Warn(
"open: link of type: %s, mode: %s, name: %s is already open",
215 l->m->type,
l->mode,
l->name);
218 else if (
l->m->Open !=
NULL)
220 res =
l->m->Open(
l, flag,
h);
222 Werror(
"open: Error for link %s of type: %s, mode: %s, name: %s",
223 c,
l->m->type,
l->mode,
l->name);
237 if (
l->m->PrepClose !=
NULL)
239 res =
l->m->PrepClose(
l);
241 Werror(
"close: Error for link of type: %s, mode: %s, name: %s",
242 l->m->type,
l->mode,
l->name);
255 if (
l->m->Close !=
NULL)
257 res =
l->m->Close(
l);
259 Werror(
"close: Error for link of type: %s, mode: %s, name: %s",
260 l->m->type,
l->mode,
l->name);
288 if (
l->m->Read !=
NULL)
v =
l->m->Read(
l);
292 if (
l->m->Read2 !=
NULL)
v =
l->m->Read2(
l,
a);
297 Werror(
"read: Error to open link of type %s, mode: %s, name: %s for reading",
298 l->m->type,
l->mode,
l->name);
309 Werror(
"read: Error for link of type %s, mode: %s, name: %s",
310 l->m->type,
l->mode,
l->name);
333 if (
l->m->Write !=
NULL)
339 Werror(
"write: Error for link of type %s, mode: %s, name: %s",
340 l->m->type,
l->mode,
l->name);
345 Werror(
"write: Error to open link of type %s, mode: %s, name: %s for writing",
346 l->m->type,
l->mode,
l->name);
362 if (
l->m->Dump !=
NULL)
368 Werror(
"dump: Error for link of type %s, mode: %s, name: %s",
369 l->m->type,
l->mode,
l->name);
375 Werror(
"dump: Error to open link of type %s, mode: %s, name: %s for writing",
376 l->m->type,
l->mode,
l->name);
392 if (
l->m->GetDump !=
NULL)
393 res =
l->m->GetDump(
l);
398 Werror(
"getdump: Error for link of type %s, mode: %s, name: %s",
399 l->m->type,
l->mode,
l->name);
405 Werror(
"dump: Error open link of type %s, mode: %s, name: %s for reading",
406 l->m->type,
l->mode,
l->name);
415 static si_link_extension
slTypeInit(si_link_extension
s,
const char* type)
424 else if (strcmp(type,
"DBM") == 0)
428 else if (strcmp(type,
"ssi") == 0)
432 else if (strcmp(type,
"|") == 0)
437 Warn(
"Found unknown link type: %s", type);
445 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
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
volatile BOOLEAN do_shutdown
BOOLEAN slInit(si_link l, char *istr)
int status int void * buf
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)
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)