45static 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++;
83 while (istr[
j] ==
' '&& istr[
j] !=
'\0')
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)
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);
409static 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);
439 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)
#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)
GLOBAL_VAR BOOLEAN FE_OPT_NO_SHELL_FLAG
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)
int name
New type name for int.