Check-in [f74a2e47ab]
Overview
Comment:Start of a register interface
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f74a2e47ab44cc8fba74be50bfc0e1b0f38ecbdee7b1edbdce74e324cc0eb52d
User & Date: rkeene on 2019-05-02 14:36:25.185
Other Links: manifest | tags
Context
2019-05-02
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
14:23
Ensure correct casting check-in: e90770a5a7 user: rkeene tags: trunk
Changes
Modified Makefile from [10ea439cf8] to [6b8d3d9487].
1
2
3
4
5
6
7
8

9
10
11

12
13
14


15
16
17
18
19
20
21
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 -Wall -I. -o example.o -c example.c
	cc -fPIC -Wall -I. -o example.o -c example.c

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

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

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

distclean: clean

.PHONY: all clean distclean test
1
2


3
4
5





6
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);

#endif
18
19
20
21
22
23
24

25
26
27

28
29
30


31






32
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

35
36
37
38
39
40
41







+



+



+
+
-
+
+
+
+
+
+


<?
	package require xvfs
	xvfs::main $argv
?>

static const char **xvfs_<?= $::xvfs::fsName ?>_getChildren(const char *path, Tcl_WideInt limit) {
	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 register_ret;
	
	// Init->Register("<?= $::xvfs::fsName ?>", XVFS_PROTOCOL_VERSION, xvfs_<?= $::xvfs::fsName ?>_getChildren, xvfs_<?= $::xvfs::fsName ?>_getData)
	register_ret = Xvfs_Register("<?= $::xvfs::fsName ?>", XVFS_PROTOCOL_VERSION, xvfs_<?= $::xvfs::fsName ?>_getChildren, xvfs_<?= $::xvfs::fsName ?>_getData);
	if (register_ret != TCL_OK) {
		return(register_ret);
	}
	
	return(TCL_OK);
}