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
63
64
65
66
67
68
69
70
|
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
63
64
65
66
67
68
69
70
71
72
|
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
Creates a Tcl procedure that calls C code.
Synoposis:
$handle cproc <procName> <argList> <returnType> ?<code>?
1. `<procName>` is the name of the Tcl procedure to create
1. `<argList>` is a list of arguments and their types for the C function;
1. The list is in the format of: type1 name1 type2 name2 ... typeN nameN
1. The supported types are:
1. Tcl_Interp*: Must be first argument, will be the interpreter and the user will not need to pass this parameter
1. int
1. long
1. float
1. double
1. char*
1. Tcl_Obj*: Passes the Tcl object in unchanged
1. void*
1. `<returnType>` is the return type for the C function
1. The supported types are:
1. void: No return value
1. ok: Return TCL\_OK or TCL_ERROR
1. int
1. long
1. float
1. double
1. char*: TCL\_STATIC string (immutable from C -- use this for constants)
1. string, dstring: return a (char*) that is a TCL\_DYNAMIC string (allocated from Tcl\_Alloc, will be managed by Tcl)
1. vstring: return a (char*) that is a TCL\_VOLATILE string (mutable from C, will be copied be Tcl -- use this for local variables)
1. default: Tcl\_Obj*, a Tcl Object
1. `<code>` is the C code that comprises the function. If the `<code>` argument is omitted it is assumed there is already an implementation (with the name specified as `<procName>`, minus any namespace declarations) and this just creates the wrapper and Tcl command.
2. `<argList>` is a list of arguments and their types for the C function;
2. The list is in the format of: type1 name1 type2 name2 ... typeN nameN
2. The supported types are:
2. Tcl_Interp*: Must be first argument, will be the interpreter and the user will not need to pass this parameter
2. int
2. long
2. float
2. double
2. char*
2. Tcl_Obj*: Passes the Tcl object in unchanged
2. Tcl_WideInt
2. void*
3. `<returnType>` is the return type for the C function
3. The supported types are:
3. void: No return value
3. ok: Return TCL\_OK or TCL_ERROR
3. int
3. long
3. float
3. double
3. Tcl_WideInt
3. char*: TCL\_STATIC string (immutable from C -- use this for constants)
3. string, dstring: return a (char*) that is a TCL\_DYNAMIC string (allocated from Tcl\_Alloc, will be managed by Tcl)
3. vstring: return a (char*) that is a TCL\_VOLATILE string (mutable from C, will be copied be Tcl -- use this for local variables)
3. default: Tcl\_Obj*, a Tcl Object
4. `<code>` is the C code that comprises the function. If the `<code>` argument is omitted it is assumed there is already an implementation (with the name specified as `<procName>`, minus any namespace declarations) and this just creates the wrapper and Tcl command.
$handle ccode
-------------
Compile arbitrary C code.
Synopsis:
|