Loading...
Searching...
No Matches
silink.h
Go to the documentation of this file.
#ifndef SILINK_H
#define SILINK_H
/****************************************
* Computer Algebra System SINGULAR *
****************************************/
/*
* ABSTRACT: general interface to links
*/
#include "singularconfig.h"
#include "omalloc/omalloc.h"
#include "kernel/structs.h"
#include "Singular/links/sing_dbm.h"
#include "Singular/lists.h"
#include "Singular/attrib.h"
struct sip_link;
typedef struct sip_link ip_link;
typedef ip_link * si_link;
// extension links:
typedef BOOLEAN (*slOpenProc)(si_link l, short flag, leftv h);
typedef BOOLEAN (*slWriteProc)(si_link l, leftv lv);
typedef BOOLEAN (*slCloseProc)(si_link l);
typedef BOOLEAN (*slPrepCloseProc)(si_link l);
typedef BOOLEAN (*slKillProc)(si_link l);
typedef leftv (*slReadProc)(si_link l);
typedef leftv (*slRead2Proc)(si_link l, leftv a);
typedef BOOLEAN (*slDumpProc)(si_link l);
typedef BOOLEAN (*slGetDumpProc)(si_link l);
typedef const char* (*slStatusProc)(si_link l, const char *request);
typedef BOOLEAN (*slSetRingProc)(si_link l, ring r, BOOLEAN send);
struct s_si_link_extension
{
si_link_extension next;
slOpenProc Open;
slCloseProc Close;
slPrepCloseProc PrepClose;
slKillProc Kill;
slReadProc Read;
slRead2Proc Read2;
slWriteProc Write;
slDumpProc Dump;
slGetDumpProc GetDump;
slStatusProc Status;
slSetRingProc SetRing;
const char *type;
};
struct sip_link
{
si_link_extension m; // methods
char *mode;
char *name; // used for filename and/or further specs
void *data; // the link itself
BITSET flags; // 0=close open = 1: read = 2: write = 3
short ref; // reference counter
};
// flags:
#define SI_LINK_CLOSE 0
#define SI_LINK_OPEN 1
#define SI_LINK_READ 2
#define SI_LINK_WRITE 4
// tests:
#define SI_LINK_CLOSE_P(l) (!(l)->flags)
#define SI_LINK_OPEN_P(l) ((l)->flags & SI_LINK_OPEN)
#define SI_LINK_W_OPEN_P(l) ((l)->flags & SI_LINK_WRITE)
#define SI_LINK_R_OPEN_P(l) ((l)->flags & SI_LINK_READ)
#define SI_LINK_RW_OPEN_P(l) (SI_LINK_W_OPEN_P(l) && SI_LINK_R_OPEN_P(l))
#define SI_LINK_SET_CLOSE_P(l) ((l)->flags = SI_LINK_CLOSE)
#define SI_LINK_SET_OPEN_P(l, flag) ((l)->flags |= SI_LINK_OPEN |flag)
#define SI_LINK_SET_W_OPEN_P(l) ((l)->flags |= (SI_LINK_OPEN | SI_LINK_WRITE))
#define SI_LINK_SET_R_OPEN_P(l) ((l)->flags |= (SI_LINK_OPEN | SI_LINK_READ))
#define SI_LINK_SET_RW_OPEN_P(l) ((l)->flags |= (SI_LINK_OPEN | SI_LINK_READ | SI_LINK_WRITE))
BOOLEAN slOpen(si_link l, short flag, leftv h);
BOOLEAN slClose(si_link l);
BOOLEAN slPrepClose(si_link l);
leftv slRead(si_link l,leftv a=NULL);
BOOLEAN slWrite(si_link l, leftv v);
BOOLEAN slDump(si_link l);
BOOLEAN slGetDump(si_link l);
const char* slStatus(si_link l, const char *request);
BOOLEAN slInit(si_link l, char *str);
void slKill(si_link l);
void slCleanUp(si_link l);
void slStandardInit();
static inline si_link slCopy(si_link l)
{
l->ref++;
return l;
}
static inline char* slString(si_link l)
{
if (l->name != NULL)
{
return omStrDup(l->name);
}
else
{
return omStrDup("");
}
}
EXTERN_VAR omBin s_si_link_extension_bin;
EXTERN_VAR omBin sip_link_bin;
EXTERN_VAR omBin ip_link_bin;
int slStatusSsiL(lists L, int timeout, BOOLEAN* ignore=NULL);
int ssiBatch(const char *host, const char * port);
typedef struct
{
leftv u;
si_link l;
void * next;
} link_struct;
typedef link_struct* link_list;
EXTERN_VAR link_list ssiToBeClosed;
EXTERN_VAR volatile BOOLEAN ssiToBeClosed_inactive;
BOOLEAN ssiWrite2(si_link l, leftv res, leftv v);
#endif // SILINK_H
attrib.h
BITSET
#define BITSET
Definition auxiliary.h:85
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
l
int l
Definition cfEzgcd.cc:100
res
CanonicalForm res
Definition facAbsFact.cc:60
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
EXTERN_VAR
#define EXTERN_VAR
Definition globaldefs.h:6
h
STATIC_VAR Poly * h
Definition janet.cc:971
lists.h
lists
slists * lists
Definition mpr_numeric.h:146
omStrDup
#define omStrDup(s)
Definition omAllocDecl.h:263
NULL
#define NULL
Definition omList.c:12
omBin
omBin_t * omBin
Definition omStructs.h:12
omalloc.h
sip_link_bin
VAR omBin sip_link_bin
Definition silink.cc:40
s_si_link_extension_bin
VAR omBin s_si_link_extension_bin
Definition silink.cc:39
ip_link_bin
VAR omBin ip_link_bin
Definition silink.cc:41
slWrite
BOOLEAN slWrite(si_link l, leftv v)
Definition silink.cc:307
s_si_link_extension::Close
slCloseProc Close
Definition silink.h:40
s_si_link_extension::next
si_link_extension next
Definition silink.h:38
sip_link::m
si_link_extension m
Definition silink.h:55
ssiToBeClosed_inactive
EXTERN_VAR volatile BOOLEAN ssiToBeClosed_inactive
Definition silink.h:131
s_si_link_extension::Status
slStatusProc Status
Definition silink.h:48
slPrepClose
BOOLEAN slPrepClose(si_link l)
Definition silink.cc:223
s_si_link_extension::Write
slWriteProc Write
Definition silink.h:45
link_list
link_struct * link_list
Definition silink.h:128
slCopy
static si_link slCopy(si_link l)
Definition silink.h:94
sip_link::name
char * name
Definition silink.h:57
slKill
void slKill(si_link l)
Definition silink.cc:146
slString
static char * slString(si_link l)
Definition silink.h:101
slDump
BOOLEAN slDump(si_link l)
Definition silink.cc:344
slRead2Proc
leftv(* slRead2Proc)(si_link l, leftv a)
Definition silink.h:30
slGetDump
BOOLEAN slGetDump(si_link l)
Definition silink.cc:374
s_si_link_extension::Read
slReadProc Read
Definition silink.h:43
slWriteProc
BOOLEAN(* slWriteProc)(si_link l, leftv lv)
Definition silink.h:25
s_si_link_extension::SetRing
slSetRingProc SetRing
Definition silink.h:49
s_si_link_extension::GetDump
slGetDumpProc GetDump
Definition silink.h:47
si_link
ip_link * si_link
Definition silink.h:20
s_si_link_extension::Read2
slRead2Proc Read2
Definition silink.h:44
link_struct::next
void * next
Definition silink.h:125
sip_link::flags
BITSET flags
Definition silink.h:59
sip_link::data
void * data
Definition silink.h:58
slStatusSsiL
int slStatusSsiL(lists L, int timeout, BOOLEAN *ignore=NULL)
Definition ssiLink.cc:2919
slKillProc
BOOLEAN(* slKillProc)(si_link l)
Definition silink.h:28
slStatus
const char * slStatus(si_link l, const char *request)
Definition silink.cc:156
sip_link::mode
char * mode
Definition silink.h:56
slClose
BOOLEAN slClose(si_link l)
Definition silink.cc:240
slReadProc
leftv(* slReadProc)(si_link l)
Definition silink.h:29
link_struct::u
leftv u
Definition silink.h:123
slRead
leftv slRead(si_link l, leftv a=NULL)
Definition silink.cc:261
s_si_link_extension::Dump
slDumpProc Dump
Definition silink.h:46
link_struct::l
si_link l
Definition silink.h:124
s_si_link_extension::Kill
slKillProc Kill
Definition silink.h:42
ssiWrite2
BOOLEAN ssiWrite2(si_link l, leftv res, leftv v)
Definition ssiLink.cc:3475
s_si_link_extension::Open
slOpenProc Open
Definition silink.h:39
slGetDumpProc
BOOLEAN(* slGetDumpProc)(si_link l)
Definition silink.h:32
s_si_link_extension::type
const char * type
Definition silink.h:50
slPrepCloseProc
BOOLEAN(* slPrepCloseProc)(si_link l)
Definition silink.h:27
ssiBatch
int ssiBatch(const char *host, const char *port)
Definition ssiLink.cc:3123
slCleanUp
void slCleanUp(si_link l)
Definition silink.cc:127
slStandardInit
void slStandardInit()
Definition asciiLink.cc:633
slStatusProc
const char *(* slStatusProc)(si_link l, const char *request)
Definition silink.h:33
slOpenProc
BOOLEAN(* slOpenProc)(si_link l, short flag, leftv h)
Definition silink.h:24
ssiToBeClosed
EXTERN_VAR link_list ssiToBeClosed
Definition silink.h:130
slInit
BOOLEAN slInit(si_link l, char *str)
Definition silink.cc:48
sip_link::ref
short ref
Definition silink.h:60
slSetRingProc
BOOLEAN(* slSetRingProc)(si_link l, ring r, BOOLEAN send)
Definition silink.h:34
slCloseProc
BOOLEAN(* slCloseProc)(si_link l)
Definition silink.h:26
s_si_link_extension::PrepClose
slPrepCloseProc PrepClose
Definition silink.h:41
slDumpProc
BOOLEAN(* slDumpProc)(si_link l)
Definition silink.h:31
slOpen
BOOLEAN slOpen(si_link l, short flag, leftv h)
Definition silink.cc:194
link_struct
Definition silink.h:122
s_si_link_extension
Definition silink.h:37
sip_link
Definition silink.h:54
sing_dbm.h
structs.h
leftv
sleftv * leftv
Definition structs.h:53