Changes To Documentation

Changes to "Documentation" between 2014-06-17 16:56:43 and 2014-06-22 22:27:56

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


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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89



























90

91





92






-
-
+
+



-
-
+
+
+
+
+
+
+
+
+
+
+
+


+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-

-
-
-
-
-
+
-
-
-
-
-
-
Manual Page
===========
High-Level API Manual Page
==========================

`package require tcc4tcl`

tcc4tcl::cproc
--------------
tcc4tcl::new
------------
Creates a new TCC interpreter instance.

Synposis:

        tcc4tcl::new ?<outputFile> ?<packageNameAndVersionAsAList>??

Returns an opaque handle which is also a Tcl command to operate on.

$handle cproc
-------------
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

$handle ccode
-------------
Compile arbitrary C code.

Synopsis:

        $handle ccode <code>

$handle tk
----------
Request that Tk be used for this handle.

Synposis:

        $handle tk

$handle linktclcommand
----------------------
Create a Tcl command that calls an existing C command as a Tcl command.

Synopsis:

        $handle linktclcommand <CSymbol> <TclCommandName>

$handle code
------------
Return text of what code will be compiled when the _go_ subcommand is called.

Synposis:

        $handle code

$handle go
----------
Execute all requested operations and output to memory, an executable, or DLL.

Once this command completes the handle is released.

Synopsis:

  1.  `tcc4tcl::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

        $handle go
Examples:

  1.  Create a Tcl procedure called "add" which accepts 2 integers (a, b) and returns a long:
    1.  `tcc4tcl::cproc add {int a int b} long { return(a+b); }`
  2.  Create a Tcl procedure called "mkdir" which accepts a Tcl_Obj* and returns a return code:
    1.  `tcc4tcl::cproc mkdir {Tcl_Interp* interp char* dir} ok { int mkdir_ret; mkdir_ret = mkdir(dir); if (mkdir_ret != 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj("failed", -1)); return(TCL_ERROR); }; return(TCL_OK); }`

See also [Low-Level API]

tcc4tcl::ccode
--------------

tcc4tcl::cdata
--------------