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);
207 Warn(
"open: link of type: %s, mode: %s, name: %s is already open",
208 l->m->type,
l->mode,
l->name);
211 else if (
l->m->Open !=
NULL)
213 res =
l->m->Open(
l, flag,
h);
215 Werror(
"open: Error for link %s of type: %s, mode: %s, name: %s",
216 c,
l->m->type,
l->mode,
l->name);
230 if (
l->m->PrepClose !=
NULL)
232 res =
l->m->PrepClose(
l);
234 Werror(
"close: Error for link of type: %s, mode: %s, name: %s",
235 l->m->type,
l->mode,
l->name);
248 if (
l->m->Close !=
NULL)
250 res =
l->m->Close(
l);
252 Werror(
"close: Error for link of type: %s, mode: %s, name: %s",
253 l->m->type,
l->mode,
l->name);
281 if (
l->m->Read !=
NULL)
v =
l->m->Read(
l);
285 if (
l->m->Read2 !=
NULL)
v =
l->m->Read2(
l,a);
290 Werror(
"read: Error to open link of type %s, mode: %s, name: %s for reading",
291 l->m->type,
l->mode,
l->name);
302 Werror(
"read: Error for link of type %s, mode: %s, name: %s",
303 l->m->type,
l->mode,
l->name);
326 if (
l->m->Write !=
NULL)
332 Werror(
"write: Error for link of type %s, mode: %s, name: %s",
333 l->m->type,
l->mode,
l->name);
338 Werror(
"write: Error to open link of type %s, mode: %s, name: %s for writing",
339 l->m->type,
l->mode,
l->name);
355 if (
l->m->Dump !=
NULL)
361 Werror(
"dump: Error for link of type %s, mode: %s, name: %s",
362 l->m->type,
l->mode,
l->name);
368 Werror(
"dump: Error to open link of type %s, mode: %s, name: %s for writing",
369 l->m->type,
l->mode,
l->name);
385 if (
l->m->GetDump !=
NULL)
386 res =
l->m->GetDump(
l);
391 Werror(
"getdump: Error for link of type %s, mode: %s, name: %s",
392 l->m->type,
l->mode,
l->name);
398 Werror(
"dump: Error open link of type %s, mode: %s, name: %s for reading",
399 l->m->type,
l->mode,
l->name);
407static si_link_extension
slTypeInit(si_link_extension
s,
const char* type)
416 else if (strcmp(type,
"DBM") == 0)
420 else if (strcmp(type,
"ssi") == 0)
424 else if (strcmp(type,
"|") == 0)
429 Warn(
"Found unknown link type: %s", type);
437 Werror(
"Can not initialize link type %s", type);
EXTERN_VAR si_link_extension si_link_root
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)
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)
int name
New type name for int.