My Project
Loading...
Searching...
No Matches
silink.h
Go to the documentation of this file.
1#ifndef SILINK_H
2#define SILINK_H
3/****************************************
4* Computer Algebra System SINGULAR *
5****************************************/
6/*
7* ABSTRACT: general interface to links
8*/
9
10#include "singularconfig.h"
11#include "omalloc/omalloc.h"
12#include "kernel/structs.h"
13
15#include "Singular/lists.h"
16#include "Singular/attrib.h"
17
18struct sip_link;
19typedef struct sip_link ip_link;
20typedef ip_link * si_link;
21
22
23// extension links:
24typedef BOOLEAN (*slOpenProc)(si_link l, short flag, leftv h);
33typedef const char* (*slStatusProc)(si_link l, const char *request);
34typedef BOOLEAN (*slSetRingProc)(si_link l, ring r, BOOLEAN send);
35
37{
38 si_link_extension next;
50 const char *type;
51};
52
54{
55 si_link_extension m; // methods
56 char *mode;
57 char *name; // used for filename and/or further specs
58 void *data; // the link itself
59 BITSET flags; // 0=close open = 1: read = 2: write = 3
60 short ref; // reference counter
61};
62
63// flags:
64#define SI_LINK_CLOSE 0
65#define SI_LINK_OPEN 1
66#define SI_LINK_READ 2
67#define SI_LINK_WRITE 4
68
69// tests:
70#define SI_LINK_CLOSE_P(l) (!(l)->flags)
71#define SI_LINK_OPEN_P(l) ((l)->flags & SI_LINK_OPEN)
72#define SI_LINK_W_OPEN_P(l) ((l)->flags & SI_LINK_WRITE)
73#define SI_LINK_R_OPEN_P(l) ((l)->flags & SI_LINK_READ)
74#define SI_LINK_RW_OPEN_P(l) (SI_LINK_W_OPEN_P(l) && SI_LINK_R_OPEN_P(l))
75
76#define SI_LINK_SET_CLOSE_P(l) ((l)->flags = SI_LINK_CLOSE)
77#define SI_LINK_SET_OPEN_P(l, flag) ((l)->flags |= SI_LINK_OPEN |flag)
78#define SI_LINK_SET_W_OPEN_P(l) ((l)->flags |= (SI_LINK_OPEN | SI_LINK_WRITE))
79#define SI_LINK_SET_R_OPEN_P(l) ((l)->flags |= (SI_LINK_OPEN | SI_LINK_READ))
80#define SI_LINK_SET_RW_OPEN_P(l) ((l)->flags |= (SI_LINK_OPEN | SI_LINK_READ | SI_LINK_WRITE))
81
82BOOLEAN slOpen(si_link l, short flag, leftv h);
89const char* slStatus(si_link l, const char *request);
90BOOLEAN slInit(si_link l, char *str);
91void slKill(si_link l);
92void slCleanUp(si_link l);
93void slStandardInit();
94static inline si_link slCopy(si_link l)
95{
96 l->ref++;
97 return l;
98}
99
100
101static inline char* slString(si_link l)
102{
103 if (l->name != NULL)
104 {
105 return omStrDup(l->name);
106 }
107 else
108 {
109 return omStrDup("");
110 }
111}
112
116
117int slStatusSsiL(lists L, int timeout);
118int ssiBatch(const char *host, const char * port);
119
120
121typedef struct
122{
125 void * next;
127
129
132#endif // SILINK_H
int BOOLEAN
Definition: auxiliary.h:87
int l
Definition: cfEzgcd.cc:100
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: lists.h:24
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
#define EXTERN_VAR
Definition: globaldefs.h:6
STATIC_VAR Poly * h
Definition: janet.cc:971
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define NULL
Definition: omList.c:12
omBin_t * omBin
Definition: omStructs.h:12
sleftv * leftv
Definition: structs.h:57
#define BITSET
Definition: structs.h:16