1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
-
-
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
|
#ifndef XVFS_COMMON_H_1B4B28D60EBAA11D5FF85642FA7CA22C29E8E817
#define XVFS_COMMON_H_1B4B28D60EBAA11D5FF85642FA7CA22C29E8E817 1
#ifndef XVFS_CORE_H_1B4B28D60EBAA11D5FF85642FA7CA22C29E8E817
#define XVFS_CORE_H_1B4B28D60EBAA11D5FF85642FA7CA22C29E8E817 1
#include <tcl.h>
#define XVFS_PROTOCOL_VERSION 1
typedef const char **(*xvfs_proc_getChildren_t)(const char *path, Tcl_WideInt *count);
typedef const unsigned char *(*xvfs_proc_getData_t)(const char *path, Tcl_WideInt start, Tcl_WideInt *length);
typedef int (*xvfs_proc_getInfo_t)(const char *path, Tcl_StatBuf *statBuf);
struct Xvfs_FSInfo {
int protocolVersion;
const char *name;
xvfs_proc_getChildren_t getChildrenProc;
xvfs_proc_getData_t getDataProc;
xvfs_proc_getInfo_t getInfoProc;
};
#define XVFS_REGISTER_INTERFACE(name) int name(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo);
#if XVFS_MODE == standalone
#define Xvfs_Register(interp, fsInfo) xvfs_standalone_register(interp, fsInfo)
#if defined(XVFS_MODE_STANDALONE)
/*
* In standalone mode, we just redefine calls to
* Xvfs_Register() to go to the xvfs_standalone_register()
* function
*/
# define Xvfs_Register xvfs_standalone_register
XVFS_REGISTER_INTERFACE(Xvfs_Register)
#elif defined(XVFS_MODE_FLEXIBLE)
/*
* In flexible mode we declare an external symbol named
* Xvfs_Register(), as well as an internal symbol called
* xvfs_flexible_register(), which we redefine future
* calls to Xvfs_Register() to invoke
*/
extern XVFS_REGISTER_INTERFACE(Xvfs_Register)
# define Xvfs_Register xvfs_flexible_register
XVFS_REGISTER_INTERFACE(Xvfs_Register)
#elif defined(XVFS_MODE_CLIENT)
/*
* In client mode we declare an external symbol named
* Xvfs_Register() that must be provided by the environment
* we are loaded into
*/
extern XVFS_REGISTER_INTERFACE(Xvfs_Register)
#elif defined(XVFS_MODE_SERVER)
/*
* In server mode we are going to implementing Xvfs_Register()
* for flexible/client modes, just forward declare it
*/
XVFS_REGISTER_INTERFACE(Xvfs_Register)
#else
# error Unsupported XVFS_MODE
#endif
int Xvfs_Register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo);
#endif
|