~ubuntu-branches/ubuntu/utopic/critcl/utopic

« back to all changes in this revision

Viewing changes to doc/include/class_spec_clife.inc

  • Committer: Package Import Robot
  • Author(s): Andrew Shadura
  • Date: 2013-05-11 00:08:06 UTC
  • Revision ID: package-import@ubuntu.com-20130511000806-7hq1zc3fnn0gat79
Tags: upstream-3.1.9
ImportĀ upstreamĀ versionĀ 3.1.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
[list_begin definitions]
 
3
 
 
4
[comment {- - -- --- ----- -------- ------------- ---------------------}]
 
5
[call [cmd classconstructor] [arg body]]
 
6
 
 
7
This command specifies a C code block surrounding the initialization
 
8
of the class variables, i.e. the fields of the class structure.
 
9
 
 
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.
 
12
 
 
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].
 
18
 
 
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.
 
22
 
 
23
[para] The C code blocks of multiple calls (including the constructors
 
24
of classvariable definitions) are executed in order of specification.
 
25
 
 
26
[para] The result of the command is the empty string.
 
27
 
 
28
[para] The C code in [arg body] has access to the following
 
29
environment:
 
30
 
 
31
[list_begin definitions]
 
32
 
 
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.
 
36
 
 
37
[def [var class]] Pointer to the class structure to initialize.
 
38
 
 
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.
 
46
 
 
47
[list_end]
 
48
 
 
49
[comment {- - -- --- ----- -------- ------------- ---------------------}]
 
50
[call [cmd classdestructor] [arg body]]
 
51
 
 
52
This command specifies a C code block surrounding the release of the
 
53
class variables, i.e. the fields of the class structure.
 
54
 
 
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.
 
57
 
 
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].
 
63
 
 
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.
 
67
 
 
68
[para] The C code blocks of multiple calls (including the constructors
 
69
of class variable definitions) are executed in order of specification.
 
70
 
 
71
[para] The result of the command is the empty string.
 
72
 
 
73
[para] The C code in [arg body] has access to the same
 
74
environment as the class constructor code blocks.
 
75
 
 
76
[comment {- - -- --- ----- -------- ------------- ---------------------}]
 
77
[list_end]