Changes To Documentation

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

     1         -Manual Page
     2         -===========
            1  +High-Level API Manual Page
            2  +==========================
     3      3   
     4      4   `package require tcc4tcl`
     5      5   
     6         -tcc4tcl::cproc
     7         ---------------
            6  +tcc4tcl::new
            7  +------------
            8  +Creates a new TCC interpreter instance.
            9  +
           10  +Synposis:
           11  +
           12  +        tcc4tcl::new ?<outputFile> ?<packageNameAndVersionAsAList>??
           13  +
           14  +Returns an opaque handle which is also a Tcl command to operate on.
           15  +
           16  +$handle cproc
           17  +-------------
     8     18   Creates a Tcl procedure that calls C code.
     9     19   
           20  +Synoposis:
           21  +
           22  +        $handle cproc <procName> <argList> <returnType> <code>
           23  +
           24  +  1. `<procName>` is the name of the Tcl procedure to create
           25  +  1. `<argList>` is a list of arguments and their types for the C function;
           26  +    1. The list is in the format of: type1 name1 type2 name2 ... typeN nameN
           27  +    1. The supported types are:
           28  +       1. Tcl_Interp*: Must be first argument, will be the interpreter and the user will not need to pass this parameter
           29  +       1. int
           30  +       1. long
           31  +       1. float
           32  +       1. double
           33  +       1. char*
           34  +       1. Tcl_Obj*: Passes the Tcl object in unchanged
           35  +       1. void*
           36  +  1. `<returnType>` is the return type for the C function
           37  +    1. The supported types are:
           38  +       1. void: No return value
           39  +       1. ok: Return TCL\_OK or TCL_ERROR
           40  +       1. int
           41  +       1. long
           42  +       1. float
           43  +       1. double
           44  +       1. char*: TCL\_STATIC string (immutable from C -- use this for constants)
           45  +       1. string, dstring: return a (char*) that is a TCL\_DYNAMIC string (allocated from Tcl\_Alloc, will be managed by Tcl)
           46  +       1. vstring: return a (char*) that is a TCL\_VOLATILE string (mutable from C, will be copied be Tcl -- use this for local variables)
           47  +       1. default: Tcl\_Obj*, a Tcl Object
           48  +  1. `<code>` is the C code that comprises the function
           49  +
           50  +$handle ccode
           51  +-------------
           52  +Compile arbitrary C code.
           53  +
           54  +Synopsis:
           55  +
           56  +        $handle ccode <code>
           57  +
           58  +$handle tk
           59  +----------
           60  +Request that Tk be used for this handle.
           61  +
           62  +Synposis:
           63  +
           64  +        $handle tk
           65  +
           66  +$handle linktclcommand
           67  +----------------------
           68  +Create a Tcl command that calls an existing C command as a Tcl command.
           69  +
           70  +Synopsis:
           71  +
           72  +        $handle linktclcommand <CSymbol> <TclCommandName>
           73  +
           74  +$handle code
           75  +------------
           76  +Return text of what code will be compiled when the _go_ subcommand is called.
           77  +
           78  +Synposis:
           79  +
           80  +        $handle code
           81  +
           82  +$handle go
           83  +----------
           84  +Execute all requested operations and output to memory, an executable, or DLL.
           85  +
           86  +Once this command completes the handle is released.
           87  +
    10     88   Synopsis:
    11     89   
    12         -  1.  `tcc4tcl::cproc <procName> <argList> <returnType> <code>`
    13         -    1. `<procName>` is the name of the Tcl procedure to create
    14         -    1. `<argList>` is a list of arguments and their types for the C function;
    15         -      1. The list is in the format of: type1 name1 type2 name2 ... typeN nameN
    16         -      1. The supported types are:
    17         -         1. Tcl_Interp*: Must be first argument, will be the interpreter and the user will not need to pass this parameter
    18         -         1. int
    19         -         1. long
    20         -         1. float
    21         -         1. double
    22         -         1. char*
    23         -         1. Tcl_Obj*: Passes the Tcl object in unchanged
    24         -         1. void*
    25         -    1. `<returnType>` is the return type for the C function
    26         -      1. The supported types are:
    27         -         1. void: No return value
    28         -         1. ok: Return TCL\_OK or TCL_ERROR
    29         -         1. int
    30         -         1. long
    31         -         1. float
    32         -         1. double
    33         -         1. char*: TCL\_STATIC string (immutable from C -- use this for constants)
    34         -         1. string, dstring: return a (char*) that is a TCL\_DYNAMIC string (allocated from Tcl\_Alloc, will be managed by Tcl)
    35         -         1. vstring: return a (char*) that is a TCL\_VOLATILE string (mutable from C, will be copied be Tcl -- use this for local variables)
    36         -         1. default: Tcl\_Obj*, a Tcl Object
    37         -    1. `<code>` is the C code that comprises the function
           90  +        $handle go
    38     91   
    39         -Examples:
    40         -
    41         -  1.  Create a Tcl procedure called "add" which accepts 2 integers (a, b) and returns a long:
    42         -    1.  `tcc4tcl::cproc add {int a int b} long { return(a+b); }`
    43         -  2.  Create a Tcl procedure called "mkdir" which accepts a Tcl_Obj* and returns a return code:
    44         -    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); }`
    45         -
    46         -
    47         -tcc4tcl::ccode
    48         ---------------
    49         -
    50         -tcc4tcl::cdata
    51         ---------------
           92  +See also [Low-Level API]