Check-in [69e476dcd5]
Overview
Comment:Pass interp to the register command
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 69e476dcd50aa6ac96340fb346c25c46cf2eff273a0e52f8820d4ec7fde1bc8e
User & Date: rkeene on 2019-05-02 14:40:44.917
Other Links: manifest | tags
Context
2019-05-02
19:58
Start of data/directory handling check-in: 32b55a907b user: rkeene tags: trunk
14:40
Pass interp to the register command check-in: 69e476dcd5 user: rkeene tags: trunk
14:36
Start of a register interface check-in: f74a2e47ab user: rkeene tags: trunk
Changes
Modified Makefile from [6b8d3d9487] to [f8664e614e].
1
2
3
4
5
6
7
8
9



10
11


12
13
14
15
16
17
18
1
2
3
4
5
6
7
8
9
10
11
12


13
14
15
16
17
18
19
20
21









+
+
+
-
-
+
+







all: example.so

example.c: $(shell find example -type f) $(shell find lib -type f) xvfs.c.rvt xvfs-create Makefile
	./xvfs-create --directory example --name example > example.c.new
	mv example.c.new example.c

example.o: example.c xvfs-core.h Makefile
	cc -fPIC -Wall -I. -o example.o -c example.c

xvfs-core.o: xvfs-core.c xvfs-core.h Makefile
	cc -fPIC -Wall -I. -o xvfs-core.o -c xvfs-core.c

example.so: example.o Makefile
	cc -fPIC -shared -o example.so example.o
example.so: example.o xvfs-core.o Makefile
	cc -fPIC -shared -o example.so example.o xvfs-core.o

test: example.so
	echo 'load ./example.so Xvfs_example; puts OK' | tclsh | grep '^OK$$'

clean:
	rm -f example.so example.o example.c








1
2
3
4
5
6
7
+
+
+
+
+
+
+
#include <xvfs-core.h>
#include <tcl.h>

int Xvfs_Register(Tcl_Interp *interp, const char *fsName, int protocolVersion, xvfs_proc_getChildren_t getChildrenProc, xvfs_proc_getData_t getData) {
	Tcl_SetResult(interp, "Not implemented", NULL);
	return(TCL_ERROR);
}
1
2
3
4
5
6
7
8
9
10
11

12
13
1
2
3
4
5
6
7
8
9
10

11
12
13










-
+


#ifndef XVFS_COMMON_H_1B4B28D60EBAA11D5FF85642FA7CA22C29E8E817
#define XVFS_COMMON_H_1B4B28D60EBAA11D5FF85642FA7CA22C29E8E817 1

#include <tcl.h>

#define XVFS_PROTOCOL_VERSION 1

typedef const char **(*xvfs_proc_getChildren_t)(const char *path, Tcl_WideInt limit);
typedef const unsigned char *(*xvfs_proc_getData_t)(const char *path, Tcl_WideInt start, Tcl_WideInt length);

int Xvfs_Register(const char *fsName, int protocolVersion, xvfs_proc_getChildren_t getChildrenProc, xvfs_proc_getData_t getData);
int Xvfs_Register(Tcl_Interp *interp, const char *fsName, int protocolVersion, xvfs_proc_getChildren_t getChildrenProc, xvfs_proc_getData_t getData);

#endif
25
26
27
28
29
30
31
32

33
34
35

36
37
38
39
40
41
25
26
27
28
29
30
31

32
33
34

35
36
37
38
39
40
41







-
+


-
+






	return(NULL);
}

static const unsigned char *xvfs_<?= $::xvfs::fsName ?>_getData(const char *path, Tcl_WideInt start, Tcl_WideInt length) {
	return(NULL);
}

int Xvfs_<?= $::xvfs::fsName ?>_Init() {
int Xvfs_<?= $::xvfs::fsName ?>_Init(Tcl_Interp *interp) {
	int register_ret;
	
	register_ret = Xvfs_Register("<?= $::xvfs::fsName ?>", XVFS_PROTOCOL_VERSION, xvfs_<?= $::xvfs::fsName ?>_getChildren, xvfs_<?= $::xvfs::fsName ?>_getData);
	register_ret = Xvfs_Register(interp, "<?= $::xvfs::fsName ?>", XVFS_PROTOCOL_VERSION, xvfs_<?= $::xvfs::fsName ?>_getChildren, xvfs_<?= $::xvfs::fsName ?>_getData);
	if (register_ret != TCL_OK) {
		return(register_ret);
	}
	
	return(TCL_OK);
}