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++;
83 if (istr[
j] !=
'\0') name =
omStrDup(&(istr[
j]));
88 while (istr[
j] ==
' '&& istr[
j] !=
'\0')
j++;
89 if (istr[
j] !=
'\0') name =
omStrDup(&(istr[
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);
287 if (l->m->Read !=
NULL) v = l->m->Read(l);
291 if (l->m->Read2 !=
NULL) v = l->m->Read2(l,a);
296 Werror(
"read: Error to open link of type %s, mode: %s, name: %s for reading",
297 l->m->type, l->mode, l->name);
308 Werror(
"read: Error for link of type %s, mode: %s, name: %s",
309 l->m->type, l->mode, l->name);
332 if (l->m->Write !=
NULL)
333 res = l->m->Write(l,v);
338 Werror(
"write: Error for link of type %s, mode: %s, name: %s",
339 l->m->type, l->mode, l->name);
344 Werror(
"write: Error to open link of type %s, mode: %s, name: %s for writing",
345 l->m->type, l->mode, l->name);
361 if (l->m->Dump !=
NULL)
367 Werror(
"dump: Error for link of type %s, mode: %s, name: %s",
368 l->m->type, l->mode, l->name);
374 Werror(
"dump: Error to open link of type %s, mode: %s, name: %s for writing",
375 l->m->type, l->mode, l->name);
391 if (l->m->GetDump !=
NULL)
392 res = l->m->GetDump(l);
397 Werror(
"getdump: Error for link of type %s, mode: %s, name: %s",
398 l->m->type, l->mode, l->name);
404 Werror(
"dump: Error open link of type %s, mode: %s, name: %s for reading",
405 l->m->type, l->mode, l->name);
414 static si_link_extension
slTypeInit(si_link_extension
s,
const char* type)
423 else if (strcmp(type,
"DBM") == 0)
427 else if (strcmp(type,
"ssi") == 0)
431 else if (strcmp(type,
"|") == 0)
436 Warn(
"Found unknown link type: %s", type);
437 Warn(
"Use default link type: %s", si_link_root->type);
444 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)
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)
BOOLEAN slPrepClose(si_link l)
BOOLEAN slWrite(si_link l, leftv v)
void rChangeCurrRing(ring r)
#define omGetSpecBin(size)
const Variable & v
< [in] a sqrfree bivariate poly
char name(const Variable &v)
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,...)
BOOLEAN slSetRingDummy(si_link, ring r, BOOLEAN send)
si_link_extension slInitPipeExtension(si_link_extension s)
#define SI_LINK_OPEN_P(l)