2
[list_begin definitions]
4
[comment {- - -- --- ----- -------- ------------- ---------------------}]
5
[call [cmd insvariable] [arg ctype] [arg name] [opt [arg comment]] \
6
[opt [arg constructor]] [opt [arg destructor]]]
8
This command specifies a field in the instance structure of the class.
10
Multiple fields can be specified, and are saved in the order
13
[para] [emph Attention:] Specification of an instance variable
14
precludes the use of an external C [cmd type] for the instance
17
[para] [emph Attention:] Specification of an instance variable
18
automatically causes the definition of an instance variable of type
19
[const Tcl_Command], and named [const cmd], holding the token of the
20
instance command, and the definition of an instance method named
21
[const destroy]. This implicit instance variable is managed by the
24
[para] Beyond the basic [arg name] and C type of the new variable the
25
definition may also contain a [arg comment] describing it, and C code
26
blocks to initialize and release the variable.
28
These are effectively local forms of the commands [cmd constructor]
29
and [cmd destructor]. Please read their descriptions for details
30
regarding the C environment available to the code.
32
[para] The comment, if specified will be embedded into the generated C
33
code for easier cross-referencing from generated [file .c] file to
36
[comment {- - -- --- ----- -------- ------------- ---------------------}]
37
[call [cmd method] [arg name] [method command] [arg arguments] \
40
This command specifies an instance method and the C code block
41
implementing its functionality. This is the first of three forms. The
42
method is specified like a [cmd critcl::ccommand], with a fixed set of
43
C-level arguments. The [arg body] has to perform everything
44
(i.e. argument extraction, checking, result return, and of course the
45
actual functionality) by itself.
47
[para] For this the [arg body] has access to
49
[list_begin definitions]
50
[def [var instance]] Pointer to the instance structure.
51
[def [var interp]] Pointer to the Tcl interpreter (Tcl_Interp*) the
52
instance structure is associated with
53
[def [var objc]] The number of method arguments.
54
[def [var objv]] The method arguments, as C array of Tcl_Obj pointers.
57
The [arg arguments] of the definition are only a human readable form
58
of the method arguments and syntax and are not used in the C code,
59
except as comments put into the generated code. Again, it is the
60
responsibility of the [arg body] to check the number of arguments,
61
extract them, check their types, etc.
63
[comment {- - -- --- ----- -------- ------------- ---------------------}]
64
[call [cmd method] [arg name] [method proc] [arg arguments] \
65
[arg resulttype] [arg body]]
67
This command specifies an instance method and the C code block
68
implementing its functionality. This is the second of three
69
forms. The method is specified like a [cmd critcl::cproc].
71
Contrary to the first variant here the [arg arguments] are computer
72
readable, expected to be in the same format as the [arg arguments] of
73
[cmd critcl::cproc]. The same is true for the [arg resulttype].
75
The system automatically generates a wrapper doing argument checking
76
and conversion, and result conversion, like for [cmd critcl::cproc].
78
[para] The [arg body] has access to
80
[list_begin definitions]
81
[def [var instance]] Pointer to the instance structure.
82
[def [var interp]] Pointer to the Tcl interpreter (Tcl_Interp*) the
83
instance structure is associated with
84
[def ...] All [arg arguments] under their specified names and C types
85
as per their definition.
88
[comment {- - -- --- ----- -------- ------------- ---------------------}]
89
[call [cmd method] [arg name] [method as] [arg funname] \
92
This command specifies an instance method and the C code block
93
implementing its functionality. This is the third and last of three
96
[para] The instance method is implemented by the external function
97
[arg funname], i.e. a function which is declared outside of the instance
98
code itself, or in a [cmd support] block.
100
[para] It is assumed that the first four arguments of that function
101
represent the parameters
103
[list_begin definitions]
104
[def [var instance]] Pointer to the instance structure.
105
[def [var interp]] Pointer to the Tcl interpreter (Tcl_Interp*) the
106
instance structure is associated with
107
[def [var objc]] The number of method arguments.
108
[def [var objv]] The method arguments, as C array of Tcl_Obj pointers.
111
Any additional arguments specified will be added after these and are
112
passed into the C code as is, i.e. are considered to be C expressions.
114
[comment {- - -- --- ----- -------- ------------- ---------------------}]
115
[call [cmd method_introspection]]
117
This command generates one class- and one instance-method both of
118
which will return a list of the instance methods of the class, and
119
supporting structures, like the function to compute the information,
120
and a class variable caching it.
122
[para] The two methods and the class variable are all named
125
[comment {- - -- --- ----- -------- ------------- ---------------------}]