2
[list_begin definitions]
4
[comment {- - -- --- ----- -------- ------------- ---------------------}]
5
[call [cmd classconstructor] [arg body]]
7
This command specifies a C code block surrounding the initialization
8
of the class variables, i.e. the fields of the class structure.
10
[emph Note] that allocation and release of the class structure itself
11
is done by the system andf not the responsibility of the user.
13
[para] For the initialization (and release) of a class variable it is
14
recommended to use the [arg constructor] and [arg destructor]
15
arguments of the variable's definition (See command
16
[cmd classvariable]) for this instead of using a separate
17
[cmd classconstructor].
19
[para] This is an optional command. Using it more than once is allowed
20
too and each use will add another C code fragment to use during
21
construction. I.e. multiple calls aggregate.
23
[para] The C code blocks of multiple calls (including the constructors
24
of classvariable definitions) are executed in order of specification.
26
[para] The result of the command is the empty string.
28
[para] The C code in [arg body] has access to the following
31
[list_begin definitions]
33
[def [var interp]] Pointer to the Tcl interpreter (Tcl_Interp*) the
34
class structure will be associated with. It enables the generation
35
of a Tcl error message should construction fail.
37
[def [var class]] Pointer to the class structure to initialize.
39
[def error] A C code label the constructor can jump to should it have
40
to signal a construction failure. It is the responsibility of the
41
constructor to release any variables already initialized before
42
jumping to this label. This also why the 'execution in order of
43
specification' is documented and can be relied on. It gives us the
44
knowledge which other constructors have already been run and
45
initialized what other fields.
49
[comment {- - -- --- ----- -------- ------------- ---------------------}]
50
[call [cmd classdestructor] [arg body]]
52
This command specifies a C code block surrounding the release of the
53
class variables, i.e. the fields of the class structure.
55
[emph Note] that allocation and release of the class structure itself
56
is done by the system and not the responsibility of the user.
58
[para] For the initialization (and release) of a class variable it is
59
recommended to use the [arg constructor] and [arg destructor]
60
arguments of the variable's definition (See command
61
[cmd classvariable]) for this instead of using a separate
62
[cmd classconstructor].
64
[para] This is an optional command. Using it more than once is allowed
65
too and each use will add another C code fragment to use during
66
construction. I.e. multiple calls aggregate.
68
[para] The C code blocks of multiple calls (including the constructors
69
of class variable definitions) are executed in order of specification.
71
[para] The result of the command is the empty string.
73
[para] The C code in [arg body] has access to the same
74
environment as the class constructor code blocks.
76
[comment {- - -- --- ----- -------- ------------- ---------------------}]