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

« back to all changes in this revision

Viewing changes to doc/include/api_introspection.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
The package provides six commands to control compilation and linking.
 
3
These are:
 
4
 
 
5
[list_begin definitions]
 
6
[comment ---------------------------------------------------------------------]
 
7
[call [cmd ::critcl::check] [opt [arg label]] [arg text]]
 
8
 
 
9
This command is useful to test if some functionality is available in
 
10
the build environment, and then select other C code fragments based on
 
11
that information.
 
12
 
 
13
It immediately compiles the C code in [arg text] and returns a boolean
 
14
value based on the result of the compilation.
 
15
 
 
16
The command returns [const true] on success, and [const false] otherwise.
 
17
 
 
18
If specified, the [arg label] is used to uniquely mark the check in the
 
19
generated log.
 
20
 
 
21
[comment ---------------------------------------------------------------------]
 
22
[call [cmd ::critcl::checklink] [opt [arg label]] [arg text]]
 
23
 
 
24
This command is an extenson of [cmd critcl::check] above, useful to
 
25
test if some functionality is available in the build environment, and
 
26
then select other C code fragments based on that information.
 
27
 
 
28
It immediately compiles and links the C code in [arg text] and returns
 
29
a boolean value based on the result of compilation and linking.
 
30
 
 
31
The command returns [const true] on success, and [const false] otherwise.
 
32
 
 
33
If specified, the [arg label] is used to uniquely mark the check in the
 
34
generated log.
 
35
 
 
36
[comment ---------------------------------------------------------------------]
 
37
[call [cmd ::critcl::msg] [opt [option -nonewline]] [arg msg]]
 
38
 
 
39
This command can be used by critc-based code to report results from
 
40
[cmd critcl::check] and [cmd critcl::checklink]. The default
 
41
implementation used by mode [term {compile & run}] ignores any calls.
 
42
 
 
43
[para] Tools like the [manpage {CriTcl Application}] are allowed to
 
44
redefine this procedure to perform their own way of message
 
45
reporting. The package [package critcl::app] and the application on
 
46
top print such messages to [term stdout], for example.
 
47
 
 
48
[comment ---------------------------------------------------------------------]
 
49
[call [cmd ::critcl::print] [opt [option -nonewline]] [opt [arg chan]] [arg msg]]
 
50
 
 
51
This command is used by the critcl internals to report its activity.
 
52
Its signature is equivalent to the Tcl builtin command [cmd ::puts].
 
53
The default implementation is effectively [cmd ::puts].
 
54
 
 
55
[para] Tools directly using either the critcl package, or the critcl
 
56
application package are allowed to redefine this procedure to perform
 
57
their own way of printing.
 
58
 
 
59
[para] An example of this is
 
60
[uri https://chiselapp.com/user/andreas_kupries/repository/Kettle/index Kettle]
 
61
where the newest revisions use this to highlight build warnings.
 
62
 
 
63
[comment ---------------------------------------------------------------------]
 
64
[call [cmd ::critcl::compiled]]
 
65
 
 
66
This command returns a boolean value. It returns [const true] if the C
 
67
code of the current [file .critcl] file is already compiled, and
 
68
[const false] otherwise.
 
69
 
 
70
[para] This predicate effectively enables a [file .critcl] file used
 
71
as its own Tcl companion file (see [cmd critcl::tsources]) to
 
72
distinguish between sourced by mode "compile & run" for compilation
 
73
and sourced from either the result of mode "generate package" or during
 
74
the load phase of "compile & run".
 
75
 
 
76
In case of the two latter possibilities the result is [const true],
 
77
and [const false] for the first.
 
78
 
 
79
[comment ---------------------------------------------------------------------]
 
80
[call [cmd ::critcl::compiling]]
 
81
 
 
82
This command returns a boolean value. It returns [const true] if C
 
83
code can be compiled on this platform in general, i.e. if a C compiler
 
84
is available, and [const false] otherwise.
 
85
 
 
86
[comment ---------------------------------------------------------------------]
 
87
[call [cmd ::critcl::done]]
 
88
 
 
89
This command returns a boolean value. It returns [const true] when
 
90
critcl has built the embedded C code, and [const false] otherwise.
 
91
 
 
92
[para] This enables the Tcl code of a critcl-based package to
 
93
distinguish between it getting used as a prebuilt package, versus
 
94
dynamic compile & run, and take action based on that.
 
95
 
 
96
[para] [emph Note] that this command is only useful from within a
 
97
[file .critcl] file. The result is managed on a per-file basis, like
 
98
is done for the commands embedding C code and controlling the
 
99
behaviour of compiler and linker.
 
100
 
 
101
[para] See also section [sectref {Modes Of Operation/Use}].
 
102
 
 
103
[comment ---------------------------------------------------------------------]
 
104
[call [cmd ::critcl::failed]]
 
105
 
 
106
This command returns a boolean value. It returns [const true] if
 
107
critcl has failed to build the package. As part of this it forces the
 
108
building of the package, but not its loading. Note that it will
 
109
attempt to build the package only on the first call; future calls for
 
110
the same package will return a cached result.
 
111
 
 
112
[para] This enables a critcl-based package to check itself for
 
113
availability and throw an error if it could not be built.
 
114
 
 
115
[para] [emph Note] that this command is only useful from within in a
 
116
[file .critcl] file. The result is managed on a per-file basis, like
 
117
is done for the commands embedding C code and controlling the
 
118
behaviour of compiler and linker.
 
119
 
 
120
[comment ---------------------------------------------------------------------]
 
121
[call [cmd ::critcl::load]]
 
122
 
 
123
This command is like [cmd critcl::failed], except that it also forces
 
124
the loading of the generated shared library, if it was built, and that
 
125
its result has reversed sense. 
 
126
 
 
127
[para] It returns [const true] if critcl succeeded in building and
 
128
loading the package.
 
129
 
 
130
[para] This enables a critcl-based package to to not only check itself
 
131
for availability and throw an error if it could not be built, but also
 
132
force an immediate load, circumventing the default behaviour, which is
 
133
lazy. See also section [sectref {Runtime Behaviour}].
 
134
 
 
135
[para] [emph Note] that this command is only useful from within in a
 
136
[file .critcl] file. The result is managed on a per-file basis, like
 
137
is done for the commands embedding C code and controlling the
 
138
behaviour of compiler and linker.
 
139
 
 
140
[list_end]