3
<title>critcl_app - C Runtime In Tcl (CriTcl)</title>
4
<style type="text/css"><!--
17
DIV.doctools H1,DIV.doctools H2 {
22
font-family: sans-serif;
25
background: transparent;
45
UL.toc,UL.toc UL, UL.toc UL UL {
46
font: normal 12pt/14pt sans-serif;
49
LI.section, LI.subsection {
57
font-family: monospace;
61
padding-bottom: 0.5ex;
69
border: 1px solid black;
71
UL.requirements LI, UL.syntax LI {
80
border: 1px solid black;
87
border-top: 1px solid black;
91
border-bottom: 1px solid black;
95
<! -- Generated from file '/home/aku/Projects/Packages/Critcl/dev-master/embedded/www/files/critcl_app.html' by tcllib/doctools with format 'html'
97
<! -- Copyright © Jean-Claude Wippler -- Copyright © Steve Landers -- Copyright © 2011-2013 Andreas Kupries
99
<! -- CVS: $Id$ critcl_app.n
101
<body><div class="doctools">
103
<a href="../toc.html">Table Of Contents</a>
104
| <a href="../index.html">Keyword Index</a>
106
<h1 class="title">critcl_app(n) 3.1.8 doc "C Runtime In Tcl (CriTcl)"</h1>
107
<div id="name" class="section"><h2><a name="name">Name</a></h2>
108
<p>critcl_app - CriTcl Application</p>
110
<div id="toc" class="section"><h2><a name="toc">Table Of Contents</a></h2>
112
<li class="section"><a href="#toc">Table Of Contents</a></li>
113
<li class="section"><a href="#synopsis">Synopsis</a></li>
114
<li class="section"><a href="#section1">Description</a></li>
115
<li class="section"><a href="#section2">Application Options</a></li>
116
<li class="section"><a href="#section3">Package Structure</a></li>
117
<li class="section"><a href="#section4">Changes for version 2.1</a></li>
118
<li class="section"><a href="#section5">Changes for version 3</a></li>
119
<li class="section"><a href="#section6">Changes for version 3.0.1</a></li>
120
<li class="section"><a href="#section7">Changes for version 3.0.2</a></li>
121
<li class="section"><a href="#section8">Changes for version 3.0.3</a></li>
122
<li class="section"><a href="#section9">Changes for version 3.0.4</a></li>
123
<li class="section"><a href="#section10">Changes for version 3.0.5</a></li>
124
<li class="section"><a href="#section11">Changes for version 3.0.6</a></li>
125
<li class="section"><a href="#section12">Changes for version 3.0.7</a></li>
126
<li class="section"><a href="#section13">Changes for version 3.1</a></li>
127
<li class="section"><a href="#section14">Changes for version 3.1.1</a></li>
128
<li class="section"><a href="#section15">Changes for version 3.1.2</a></li>
129
<li class="section"><a href="#section16">Changes for version 3.1.3</a></li>
130
<li class="section"><a href="#section17">Changes for version 3.1.4</a></li>
131
<li class="section"><a href="#section18">Changes for version 3.1.5</a></li>
132
<li class="section"><a href="#section19">Changes for version 3.1.6</a></li>
133
<li class="section"><a href="#section20">Changes for version 3.1.7</a></li>
134
<li class="section"><a href="#section21">Changes for version 3.1.8</a></li>
135
<li class="section"><a href="#section22">Changes for version 3.1.9</a></li>
136
<li class="section"><a href="#section23">Authors</a></li>
137
<li class="section"><a href="#section24">Bugs, Ideas, Feedback</a></li>
138
<li class="section"><a href="#keywords">Keywords</a></li>
139
<li class="section"><a href="#category">Category</a></li>
140
<li class="section"><a href="#copyright">Copyright</a></li>
143
<div id="synopsis" class="section"><h2><a name="synopsis">Synopsis</a></h2>
144
<div class="synopsis">
146
<li><a href="#1"><b class="cmd"><a href="critcl_pkg.html">critcl</a></b> <span class="opt">?<i class="arg">option</i>...?</span> <span class="opt">?<i class="arg">file</i>...?</span></a></li>
150
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
151
<p>Welcome to the <i class="term">C Runtime In Tcl</i>, <i class="term"><a href="critcl_pkg.html">CriTcl</a></i> for short, a
152
system to build C extension packages for Tcl on the fly, from C code
153
embedded within Tcl scripts, for all who wish to make their code go
155
<p>This document is the reference manpage for the <b class="cmd"><a href="critcl_pkg.html">critcl</a></b> command.
156
Its intended audience are people having to build packages using
157
<b class="package"><a href="critcl_pkg.html">critcl</a></b> for deployment. Writers of packages with embedded C
158
code can ignore this document.
159
If you are in need of an overview of the whole system instead, please
160
go and read the <i class="term"><a href="critcl_introduction.html">Introduction To CriTcl</a></i>.</p>
161
<p>This application resides in the Application Layer of CriTcl.</p>
162
<p><img alt="arch_application" src="../image/arch_application.png"></p>
164
The application supports the following general command line:</p>
165
<dl class="definitions">
166
<dt><a name="1"><b class="cmd"><a href="critcl_pkg.html">critcl</a></b> <span class="opt">?<i class="arg">option</i>...?</span> <span class="opt">?<i class="arg">file</i>...?</span></a></dt>
167
<dd><p>The exact set of options supported, their meaning, and interaction is
168
detailed in section <span class="sectref"><a href="#section2">Application Options</a></span> below.
169
For a larger set of examples please see section "Building Critcl Packages"
170
in the document about <i class="term">Using CriTcl</i>.</p></dd>
173
<div id="section2" class="section"><h2><a name="section2">Application Options</a></h2>
174
<p>The following options are understood</p>
176
<dt><b class="option">-v</b></dt>
178
<dt><b class="option">--version</b></dt>
179
<dd><p>These options cause critcl to print its version to <b class="const">stdout</b> and
181
<dt><b class="option">-I</b> path</dt>
182
<dd><p>This option specifies an additional global include path to use during
183
compilation of "<b class="file">.critcl</b>" files. All values are used if this is
184
specified multiple times.</p>
185
<p>This option is irrelevant when generating a TEA package (see
186
option <b class="option">-tea</b> below).</p></dd>
187
<dt><b class="option">-L</b> path</dt>
188
<dd><p>This option specifies an additional global library searh path to use
189
during linking of "<b class="file">.critcl</b>" files. All values are used if this is
190
specified multiple times.</p>
191
<p>This option is irrelevant when generating a TEA package (see
192
option <b class="option">-tea</b> below).</p></dd>
193
<dt><b class="option">-cache</b> path</dt>
194
<dd><p>This option specifies the path to the directory to use as the result
195
cache. If not specified it defaults to "<b class="file">~/.critcl/<platform></b>",
196
or, when generating a package (see option <b class="option">-pkg</b> below), to
197
"<b class="file">~/.critcl/<pid>.<epoch></b>",
198
When specified multiple times the last value is used.</p>
199
<p>This option is irrelevant when generating a TEA package (see
200
option <b class="option">-tea</b> below).</p></dd>
201
<dt><b class="option">-clean</b></dt>
202
<dd><p>When specified the result cache is emptied, i.e. all files and
203
directories found inside are deleted) before compilation begins.</p>
204
<p>This option is irrelevant when generating a package (see option
205
<b class="option">-pkg</b> below) because this mode starts out with a unique and
206
empty result cache.</p>
207
<p>This option is irrelevant when generating a TEA package (see
208
option <b class="option">-tea</b> below).</p></dd>
209
<dt><b class="option">-config</b> path</dt>
210
<dd><p>This option specifies the path to a custom configuration file,
211
allowing the user to use their own target specifications. If not
212
specified a hardwired default configuration embedded in the system
213
core is used instead.
214
When specified multiple times the last value is used.</p>
215
<p>This option is irrelevant when generating a TEA package (see
216
option <b class="option">-tea</b> below).</p></dd>
217
<dt><b class="option">-debug</b> mode</dt>
218
<dd><p>This option activates compilation with debugging. It accepts the modes
220
When specified multiple times the combination of all modes is used.</p>
221
<p>This option is irrelevant when generating a TEA package (see
222
option <b class="option">-tea</b> below).</p>
223
<dl class="definitions">
224
<dt><b class="const">memory</b></dt>
225
<dd><p>This mode activates memory debugging of allocations made through the
227
<dt><b class="const">symbols</b></dt>
228
<dd><p>This mode activates building of all "<b class="file">.c</b>" files with debugging
230
<dt><b class="const">all</b></dt>
231
<dd><p>This mode activates both <b class="const">memory</b> and <b class="const">symbols</b>.</p></dd>
233
<dt><b class="option">-disable</b> name</dt>
234
<dd><p>This option sets the value of the custom build configuration option
235
<i class="arg">name</i> to <b class="const">false</b>. It is equivalent to "-with-<i class="arg">name</i> 0".</p>
236
<p>The information is validated only if one of the "<b class="file">.critcl</b>"
237
input files actually defines and uses a custom build configuration
238
option with that <i class="arg">name</i>.</p>
239
<p>This option is irrelevant when generating a TEA package (see
240
option <b class="option">-tea</b> below).</p></dd>
241
<dt><b class="option">-enable</b> name</dt>
242
<dd><p>This option sets the value of the custom build configuration option
243
<i class="arg">name</i> to <b class="const">true</b>. It is equivalent to "-with-<i class="arg">name</i> 1".</p>
244
<p>The information is validated only if one of the "<b class="file">.critcl</b>"
245
input files actually defines and uses a custom build configuration
246
option with that <i class="arg">name</i>.</p>
247
<p>This option is irrelevant when generating a TEA package (see
248
option <b class="option">-tea</b> below).</p></dd>
249
<dt><b class="option">-force</b></dt>
250
<dd><p>When specified compilation is always done, even if a shared library
251
for the file exists already. This effect can be had through cleaning
252
the cache (see above) as well, except that it is lazy in the
253
destruction of files and will not destroy files unrelated to the ones
255
<p>This option is irrelevant when generating a package (see option
256
<b class="option">-pkg</b> below) because this mode starts out with a unique and
257
empty result cache.</p>
258
<p>This option is irrelevant when generating a TEA package (see
259
option <b class="option">-tea</b> below).</p></dd>
260
<dt><b class="option">-help</b></dt>
261
<dd><p>This option will cause the system to print a short help about command
262
line syntax and options and then exit the application.</p></dd>
263
<dt><b class="option">-keep</b></dt>
264
<dd><p>This option will cause the system to keep the "<b class="file">.c</b>" files
265
generated by a run in the result cache.
266
When generating a package (see option <b class="option">-pkg</b> below) this also
267
prevents the deletion of the unique result cache used by the run.
268
This option is intended for the debugging of <b class="cmd"><a href="critcl_pkg.html">critcl</a></b> itself,
269
where it may be necessary to inspect the generated C code.</p>
270
<p>This option is irrelevant when generating a TEA package (see
271
option <b class="option">-tea</b> below).</p></dd>
272
<dt><b class="option">-libdir</b> path</dt>
273
<dd><p>This option specifies the path under which the packages generated via
274
option <b class="option">-pkg</b> are saved. It also specifies a path to search
275
libraries in, like for <b class="option">-L</b>.
276
When specified multiple times the last value is used.
277
When not specified at all the default, "<b class="file">lib</b>", is used. Note how
278
this is a relative path, placing the result into the current working
280
<dt><b class="option">-includedir</b> path</dt>
281
<dd><p>This option specifies the path under which any generated package
282
headers are saved. It also specifies a path to search include files
283
in, like for <b class="option">-I</b>.
284
When specified multiple times the last value is used as destination,
285
however all previous values are kept on the include search path.
286
When not specified at all the default, "<b class="file">include</b>", is used. Note
287
how this is a relative path, placing the result into the current
288
working directory.</p>
289
<p>This option is irrelevant when generating a TEA package (see
290
option <b class="option">-tea</b> below).</p></dd>
291
<dt><b class="option">-pkg</b></dt>
292
<dd><p>The default mode of the application is to build the "<b class="file">.critcl</b>"
293
files listed on the command line and save the results in the result
294
cache. Essentially pre-filling the cache with important packages,
295
cutting down on the time needed to use these packages.</p>
296
<p>This option activates one of the other modes, package generation.
297
In this mode the input files are processed first as usual, however
298
after that they are bundled into a single library and additional files
299
are generated to make this library usable as a regular Tcl package.</p>
300
<p>The option <b class="option">-tea</b>, see below, invokes the last mode, TEA
301
generation. If both options, i.e. <b class="option">-pkg</b> and <b class="option">-tea</b> are
302
specified the last one specified wins.</p>
303
<p>In this mode the options <b class="option">-clean</b> and <b class="option">-force</b> are
304
irrelevant and ignored. In contrast, the option <b class="option">-libdir</b> is
305
relevant in both this and <b class="option">-tea</b> mode.</p>
306
<p>When this option is specified the basename of the first file argument
307
after the options is used as the name of the package to generate. If
308
the extension of that file indicates a shared library ("<b class="file">.so</b>",
309
"<b class="file">.sl</b>", "<b class="file">.dylib</b>", and "<b class="file">.dll</b>") it is also removed from
310
the set of input files. A "<b class="file">.tcl</b>" file is kept as part of the
311
input. A single file without extension is assumed to actually have a
312
"<b class="file">.tcl</b>" extension. A file without extension, but other input files
313
following is treated like the name of a shared library proper, and
314
removed from the set of input files.</p>
316
<pre class="example">
318
=> Package name is: foo
319
=> Input file is: foo.tcl
321
<pre class="example">
322
... -pkg ... foo bar.tcl
323
=> Package name is: foo
324
=> Input file is: bar.tcl
326
<pre class="example">
328
=> Package name is: foo
329
=> Input file is: foo.tcl
331
<pre class="example">
332
... -pkg ... foo.so bar.tcl
333
=> Package name is: foo
334
=> Input file is: bar.tcl
337
<dt><b class="option">-show</b></dt>
338
<dd><p>This option, when specified, will cause the system to print the
339
configuration of the chosen target to <b class="const">stdout</b> and then exit.
340
The choice of target can be influenced through the option
341
<b class="option">-target</b> (see below).</p></dd>
342
<dt><b class="option">-showall</b></dt>
343
<dd><p>This option, when specified, will cause the system to print the whole
344
chosen configuration file to <b class="const">stdout</b> and then exit.
345
The choice of configuration file can be influenced through the option
346
<b class="option">-config</b> (see above).</p></dd>
347
<dt><b class="option">-target</b> name</dt>
348
<dd><p>This option overrides the default choice of build target with
350
When specified multiple times the last value is used.
351
The named target must exist in the chosen configuration file.
352
Use option <b class="option">-targets</b> (see below) to get a list of the
354
The choice of configuration file can be influenced through the option
355
<b class="option">-config</b> (see above).</p>
356
<p>This option is irrelevant when generating a TEA package (see
357
option <b class="option">-tea</b> below).</p></dd>
358
<dt><b class="option">-targets</b></dt>
359
<dd><p>This option, when specified, will cause the system to print the list
360
of all known targets from the chosen configuration file to
361
<b class="const">stdout</b> and then exit.
362
The choice of configuration file can be influenced through the option
363
<b class="option">-config</b> (see above).</p></dd>
364
<dt><b class="option">-tea</b></dt>
365
<dd><p>Similar to option <b class="option">-pkg</b>, except that the invoked mode does not
366
generate binaries, but a directory hierarchy containing the
367
"<b class="file">.critcl</b>" file, its companion files, and a TEA-lookalike build
368
system with most of the needed support code (incliding copies of the
369
critcl packages).</p>
370
<p>If both options, i.e. <b class="option">-pkg</b> and <b class="option">-tea</b> are specified
371
the last one specified wins.</p>
372
<p>In this mode the options <b class="option">-I</b>, <b class="option">-L</b>, <b class="option">-clean</b>,
373
<b class="option">-force</b>, <b class="option">-cache</b>, <b class="option">-includedir</b>, <b class="option">-enable</b>,
374
<b class="option">-disable</b>, and <b class="option">-with-<b class="variable">FOO</b></b> are irrelevant and
375
ignored. In contrast, the option <b class="option">-libdir</b> is relevant in both
376
this and <b class="option">-pkg</b> mode.</p>
377
<p>When this option is specified the basename of the first file argument
378
after the options is used as the name of the package to generate. If
379
the extension of that file indicates a shared library ("<b class="file">.so</b>",
380
"<b class="file">.sl</b>", "<b class="file">.dylib</b>", and "<b class="file">.dll</b>") it is also removed from
381
the set of input files. A "<b class="file">.tcl</b>" file is kept as part of the
382
input. A single file without extension is assumed to actually have a
383
"<b class="file">.tcl</b>" extension. A file without extension, but other input files
384
following is treated like the name of a shared library proper, and
385
removed from the set of input files.</p>
387
<pre class="example">
389
=> Package name is: foo
390
=> Input file is: foo.tcl
392
<pre class="example">
393
... -tea ... foo bar.tcl
394
=> Package name is: foo
395
=> Input file is: bar.tcl
397
<pre class="example">
399
=> Package name is: foo
400
=> Input file is: foo.tcl
402
<pre class="example">
403
... -tea ... foo.so bar.tcl
404
=> Package name is: foo
405
=> Input file is: bar.tcl
408
<dt><b class="option">-with-<b class="variable">name</b></b> value</dt>
409
<dd><p>This option sets the value of the custom build configuration option
410
<i class="arg">name</i> to <i class="arg">value</i>.</p>
411
<p>The information is validated only if one of the "<b class="file">.critcl</b>"
412
input files actually defines and uses a custom build configuration
413
option with that <i class="arg">name</i>.</p>
414
<p>This option is irrelevant when generating a TEA package (see
415
option <b class="option">-tea</b> above).</p></dd>
418
<div id="section3" class="section"><h2><a name="section3">Package Structure</a></h2>
419
<p>Packages generated by critcl have the following basic structure:</p>
420
<pre class="example">
424
+- license.terms (optional)
427
| +- <tsources files>
430
+- <shared library>
432
<p><em>Notes</em></p>
433
<ol class="enumerated">
434
<li><p>The file "<b class="file">pkgIndex.tcl</b>" is the standard package index file
435
expected by Tcl's package management. It is sourced during a search
436
for packages, and declares the package to Tcl with its files, and how
437
to handle them.</p></li>
438
<li><p>The file "<b class="file">critcl-rt.tcl</b>" is a helper file containing the
439
common code used by "<b class="file">pkgIndex.tcl</b>" to perform its tasks.</p></li>
440
<li><p>The file "<b class="file">license.terms</b>" is optional and appears only if
441
the "<b class="file">.critcl</b>" file the package is generated from used the command
442
<b class="cmd">critcl::license</b> to declare package author and license.</p></li>
443
<li><p>All files declared with the command <b class="cmd">critcl::tsources</b> are
444
put into the sub-directory "<b class="file">tcl</b>".</p></li>
445
<li><p>The shared library generated by critcl is put into a
446
platform-specific sub-directory.</p></li>
448
<p>The whole structure, and especially the last point, enable us
449
to later merge the results (for the same package, and version) for
450
multiple target platforms into a single directory structure without
451
conflict, by simply copying the top directories over each other. The
452
only files which can conflict are in the <TOP> and "<b class="file">tcl</b>"
453
directories, and for these we know that they are identical across
454
targets. The result of such a merge would look like:</p>
455
<pre class="example">
459
+- license.terms (optional)
462
| +- <tsources files>
465
| +- <shared library1>
467
| +- <shared library2>
470
+- <shared libraryN>
473
<div id="section4" class="section"><h2><a name="section4">Changes for version 2.1</a></h2>
474
<ol class="enumerated">
475
<li><p>Fixed bug where <b class="cmd">critcl::tsources</b> interpreted relative
476
paths as relative to the current working directory instead of
477
relative to the "<b class="file">.critcl</b>" file using the command, as all other
478
commands of this type do.</p></li>
479
<li><p>Fixed internals, preventing information collected for multiple
480
"<b class="file">.critcl</b>" files to leak between them. Notably, <b class="cmd">critcl::tk</b>
481
is not a global configuration option anymore.</p></li>
482
<li><p>Fixed the command <b class="cmd">critcl::license</b> to be a null-operation
483
in mode "compile & run", instead of throwing an error.</p></li>
484
<li><p>Fixed the critcl application's interference with the "compile &
485
run" result cache in <b class="option">-pkg</b> mode by having it use a wholly
486
separate (and by default transient) directory for that mode.</p></li>
487
<li><p>Fixed bug where changes to a "<b class="file">.critcl</b>" file did not result
488
in a rebuild for mode "compile & run". All relevant API commands now
489
ensure UUID changes.</p></li>
490
<li><p>Fixed bug in the backend handling of <b class="cmd">critcl::debug</b> where
491
the companion c-sources of a "<b class="file">.critcl</b>" file were not compiled
492
with debug options, although the "<b class="file">.critcl</b>" file was.</p></li>
493
<li><p>Fixed bug in <b class="cmd">critcl::debug</b> which prevented recognition of
494
mode "all" when it was not the first argument to the command.</p></li>
495
<li><p>Fixed bug in "<b class="file">preload.c</b>" preventing its compilation on
496
non-windows platforms.</p></li>
497
<li><p>Fixed long-standing bug in the handling of namespace qualifiers
498
in the command name argument of <b class="cmd">critcl::cproc</b> and
499
<b class="cmd">critcl::ccommand</b>. It is now possible to specify a fully
500
qualified command name without issues.</p></li>
501
<li><p>Extended/reworked <b class="cmd">critcl::tsources</b> to be the canonical
502
way of declaring "<b class="file">.tcl</b>" companion files even for mode "compile &
504
<li><p>Extended/reworked <b class="cmd">critcl::tsources</b> to allow the use of a
505
"<b class="file">.critcl</b>" file as its own Tcl companion file.</p></li>
506
<li><p>Extended <b class="cmd">critcl::framework</b> to internally check for OS X
507
build target, and to ignore the declaration if its not.</p></li>
508
<li><p>Extended <b class="cmd">critcl::failed</b> to be callable more than once in
509
a "<b class="file">.critcl</b>" file. The first call forces the build, if it was not
510
done already, to get the result. Further calls return the cached
511
result of the first call.</p></li>
512
<li><p>Extended the handling of environment variable CC in the code
513
determining the compiler to use to deal with (i.e. remove) paths to
514
the compiler, compiler file extensions, and compiler options specified
515
after the compiler itself, leaving only the bare name of the compiler.</p></li>
516
<li><p>Extended the code handling the search for preloaded libraries
517
to print the paths it searched, making debugging of a search failure
519
<li><p>A new command <b class="cmd">critcl::tcl</b> can be used to declare the
520
version of Tcl minimally needed to build and run the "<b class="file">.critcl</b>"
521
file and package. Defaults to 8.4 if not declared. Extended critcl to
522
have the stubs and headers for all of Tcl 8.4, 8.5, and 8.6.</p></li>
523
<li><p>A new command <b class="cmd">critcl::load</b> forces the build and load of a
524
"<b class="file">.critcl</b>" file. This is the official way for overriding critcl's
525
default lazy-build-&-load-on-demand scheme for mode "compile & run".</p>
526
<p><em>Note</em> that after using <b class="cmd">critcl::load</b> /
527
<b class="cmd">critcl::failed</b> in a "<b class="file">.critcl</b>" file it is not possible to
528
use critcl commands in that file anymore. Doing so will throw an
530
<li><p>Extended the generation of '#line' pragmas to use
531
<b class="cmd">info frame</b> (if available) to provide the C compiler with exact
532
line numbers into the "<b class="file">.critcl</b>" file for the reporting of
533
warnings and errors.</p></li>
534
<li><p>Extended <b class="cmd">critcl::check</b> with logging to help with
535
debugging build-time checks of the environment, plus an additional
536
optional argument to provide labeling.</p></li>
537
<li><p>Added a new command <b class="cmd">critcl::checklink</b> which not only
538
tries to check the environment via compiling the code, but also
539
its linkability.</p></li>
540
<li><p>Added a new command <b class="cmd">critcl::msg</b> for messaging, like
541
command <b class="cmd">critcl::error</b> is for error reporting. Likewise this is a
542
hook a user of the package is allowed to override. The default
543
implementation, used by mode <i class="term"><a href="../index.html#key0">compile & run</a></i> does nothing. The
544
implementation for mode <i class="term"><a href="../index.html#key9">generate package</a></i> prints the message
546
<p>Envisioned use is for the reporting of results determined by
547
<b class="cmd">critcl::check</b> and <b class="cmd">critcl::checklink</b> during building, to
548
help with debugging when something goes wrong with a check.</p></li>
549
<li><p>Exposed the argument processing internals of <b class="cmd">critcl::proc</b>
550
for use by advanced users. The new commands are</p>
551
<ol class="enumerated">
552
<li><p><b class="cmd">critcl::argnames</b></p></li>
553
<li><p><b class="cmd">critcl::argcnames</b></p></li>
554
<li><p><b class="cmd">critcl::argcsignature</b></p></li>
555
<li><p><b class="cmd">critcl::argvardecls</b></p></li>
556
<li><p><b class="cmd">critcl::argconversion</b></p></li>
558
<p>Please see section <em>Advanced Embedded C Code</em> of the
559
<b class="package"><a href="critcl_pkg.html">critcl</a></b> package documentation for details.</p></li>
560
<li><p>Extended the critcl package to intercept <b class="cmd">package
561
provide</b> and record the file -> package name mapping. Plus other
562
internal changes now allow the use of namespaced package names while
563
still using proper path names and init function.</p></li>
564
<li><p>Dropped the unused commands <b class="cmd">critcl::optimize</b> and
565
<b class="cmd">critcl::include</b>.</p></li>
566
<li><p>Dropped <b class="option">-lib</b> mode from the critcl application.</p></li>
567
<li><p>Dropped remnants of support for Tcl 8.3 and before.</p></li>
570
<div id="section5" class="section"><h2><a name="section5">Changes for version 3</a></h2>
571
<ol class="enumerated">
572
<li><p>The command <b class="cmd">critcl::platform</b> was deprecated in version
573
2.1, superceded by <b class="cmd">critcl::targetplatform</b>, yet kept for
574
compatibility. Now it has been removed.</p></li>
575
<li><p>The command <b class="cmd">critcl::compiled</b> was kept with in version 2.1
576
with semantics in contradiction to its, for compatibility. This
577
contradiction has been removed, changing the visible semantics of the
578
command to be in line with its name.</p></li>
579
<li><p>The change to version 3 became necessary because of the two
580
incompatible visible changes above.</p></li>
581
<li><p>Extended the application package with code handling a new
582
option <b class="option">-tea</b>. Specifying this option invokes a special mode
583
where critcl generates a TEA package, i.e. wraps the input into a
584
directory hierarchy and support files which provide it TEA-lookalike
586
<p>This new option, and <b class="option">-pkg</b>, exclude each other. If
587
both are specified the last used option takes precedence.</p>
588
<p>The generated package directory hierarchy is mostly
589
self-contained, but not fully. It requires not only a working
590
installation of Tcl, but also working installations of the packages
591
<b class="package">md5</b> and <b class="package">cmdline</b>. Both of these are provided by the
592
<b class="package">Tcllib</b> bundle. Not required, but recommended to have
593
installed are any of the packages which can accelerate md5's
594
operation, i.e. <b class="package">cryptkit</b>, <b class="package">tcllibc</b>, or
595
<b class="package">Trf</b>.</p></li>
596
<li><p>Extended the critcl package with a new command
597
<b class="cmd">critcl::scan</b> taking the path to a "<b class="file">.critcl</b>" file,
598
statically scanning it, and returning license, version, a list of its
599
companion files, list of imported APIs, and list of
600
developer-specified custom configuration options. This data is the
601
foundation for the TEA wrapping described above.</p>
602
<p>Note that this is a <em>static</em> scan. While the other build
603
modes can (must) execute the "<b class="file">.critcl</b>" file and make
604
platform-specific decisions regarding the assembled C code, companion
605
files, etc. the TEA wrap mode is not in a position to make
606
platform-specific decisions. It has to wrap everything which might
607
conceivably be needed when actually building. Hence the static scan.
608
This has however its own set of problems, namely the inability to
609
figure out any dynamic construction of companion file paths, at least
610
on its own. Thus:</p></li>
611
<li><p>Extended the API used by critcl-based packages with the command
612
<b class="cmd">critcl::owns</b>. While this command is ignored by the regular build
613
modes the static scanner described above takes its arguments as the
614
names of companion files which have to be wrapped into the TEA package
615
and could not be figured by the scanner otherwise, like because of
616
dynamic paths to <b class="cmd">critcl::tsources</b>, <b class="cmd">critcl::csources</b>,
617
getting sourced directly, or simply being adjunct datafiles.</p></li>
618
<li><p>Extended the API used by critcl-based packages with the command
619
<b class="cmd">critcl::api</b> for the management of stubs tables, be it their use,
620
and/or declaration and export.</p>
621
<p>Please see section <em>Stubs Table Management</em> of the
622
<b class="package"><a href="critcl_pkg.html">critcl</a></b> package documentation for details.</p></li>
623
<li><p>Extended the API used by critcl-based packages with the command
624
<b class="cmd">critcl::userconfig</b> for the management of developer-specified
625
custom configuration options, be it their use and/or declaration.</p>
626
<p>Please see section <em>Custom Build Configuration</em> of the
627
<b class="package"><a href="critcl_pkg.html">critcl</a></b> package documentation for details.</p></li>
628
<li><p>Extended the API used by critcl-based packages with the
629
commands <b class="cmd">critcl::description</b>, <b class="cmd">critcl::summary</b>,
630
<b class="cmd">critcl::subject</b>, <b class="cmd">critcl::meta</b>, and
631
<b class="cmd">critcl::buildrequirement</b> for the declaration of TEApot meta data
632
for/about the package.</p>
633
<p>Please see section <em>Package Meta Data</em> of the
634
<b class="package"><a href="critcl_pkg.html">critcl</a></b> package documentation for details.</p></li>
637
<div id="section6" class="section"><h2><a name="section6">Changes for version 3.0.1</a></h2>
638
<ol class="enumerated">
639
<li><p>Bugfixes all around. In detail:</p></li>
640
<li><p>Fixed recording of Tcl version requirements. Keep package name
641
and version together, unbreaking generated meta data and generated
642
package load command.</p></li>
643
<li><p>Fixed the build scripts: When installing, or wrapping for TEA,
644
generate any missing directories</p></li>
645
<li><p>Modified the build scripts to properly exit the application
646
when the window of their GUI is closed through the (X) button.</p></li>
647
<li><p>Removed an 8.5-ism (open wb) which had slipped into the main
648
build script.</p></li>
649
<li><p>Modified the example build scripts to separate the output for
650
the different examples (and packages) by adding empty lines.</p></li>
651
<li><p>stack::c example bugfix: Include API declarations for use in
652
the companion files.</p></li>
653
<li><p>Extended the documentation: Noted the need for a working
654
installation of a C compiler.</p></li>
655
<li><p>Extended the Windows target definitions and code to handle the
656
manifest files used by modern MS development environments. Note that
657
this code handles both possibilities, environment using manifests, and
658
(old(er)) environments without.</p></li>
659
<li><p>Extended the Windows 64bit target definitions and code to
660
auto-detect the need for the helper library "bufferoverflowU.lib" and
661
reconfigure the compile and link commands appropriately. We assume
662
that the library must be linked when present. This should be no harm
663
if the library is present, yet not needed. Just superfluous. We search
664
for the library in the paths specified by the environment variable
668
<div id="section7" class="section"><h2><a name="section7">Changes for version 3.0.2</a></h2>
669
<ol class="enumerated">
670
<li><p>Fixed issue in compile-and-run mode where commands put into the
671
auto_index are not found by Tcl's [unknown] command.</p></li>
672
<li><p>Fixed an array key mismatch breaking usage of client data and
673
delete function for procedure. Reported by Jos DeCoster, with patch.</p></li>
674
<li><p>Implemented a command line option <b class="option">-L</b>, an equivalent of
675
option <b class="option">-I</b>, just for library search paths.</p></li>
676
<li><p>Fixed github issues 5 and 8. Working around a missing variable
677
::errorInfo. It should always be present, however there seem to be
678
revisions of Tcl around which violate this assumption.</p></li>
681
<div id="section8" class="section"><h2><a name="section8">Changes for version 3.0.3</a></h2>
682
<ol class="enumerated">
683
<li><p>Fixed github issues 5 and 8, for the example build.tcl
684
scripts. Working around a missing variable ::errorInfo. It should
685
always be present, however there seem to be revisions of Tcl around
686
which violate this assumption.</p></li>
689
<div id="section9" class="section"><h2><a name="section9">Changes for version 3.0.4</a></h2>
690
<ol class="enumerated">
691
<li><p>Fixed generation of the package's initname when the incoming
692
code is read from stdin and has no proper path.</p></li>
693
<li><p>Fixed github issue 11. Now using /LIBPATH instead of -L
694
on Windows (libinclude configuration setting).</p></li>
695
<li><p>Extended critcl to handle -l:path format of -l options.
696
GNU ld 2.22+ handles this by searching for the path as
697
is. Good when specifying static libraries, as plain -l looks
698
for shared libraries in preference over static. critcl handles
699
it now, as older GNU ld's do not understand it, nor the
700
various vendor-specific linkers.</p></li>
701
<li><p>Fixed github issue #12. Critcl now determines the version of
702
MSVC in use and uses it to switch between various link debug
703
options. Simplified the handling of bufferoverflowU.lib also,
704
making use of the same mechanism and collapsing the two
705
configurations sections we had back into one.</p></li>
706
<li><p>Reworked the insertion of #line pragmas into the generated C
707
code to avoid limitations on the line number argument imposed
708
by various compilers, and be more accurate.</p></li>
709
<li><p>Modified argument processing. Option -libdir now also
710
implies -L for its argument.</p></li>
711
<li><p>Extended handling of option -show (<b class="cmd">critcl::showconfig</b>)
712
to list the path of the configuration file the data is coming
713
from. Good for debugging configuration processing.</p></li>
714
<li><p>Extended the build script with targets to regenerate the
715
embedded documentation, and diagrams, and to generate a
719
<div id="section10" class="section"><h2><a name="section10">Changes for version 3.0.5</a></h2>
720
<ol class="enumerated">
721
<li><p>Fixed bug in the new code for #line pragmas triggered when
722
specifying C code without leading whitespace.</p></li>
723
<li><p>Extended the documentation to have manpages for the license,
724
source retrieval, installer, and developer's guides.</p></li>
727
<div id="section11" class="section"><h2><a name="section11">Changes for version 3.0.6</a></h2>
728
<ol class="enumerated">
729
<li><p>Fixed github issue 10. The critcl application now delivers a
730
proper exit code (1) on build failure, instead of always
731
indicating success (status 0).</p></li>
732
<li><p>Fixed github issue 13. Handling of bufferoverflowU.lib for
733
release builds was inconsistent with handling for debug
734
builds. It is now identically handled (conditional) by
736
<li><p>Documentation cleanup, mainly in the installation guide, and
737
the README.md shown by github</p></li>
740
<div id="section12" class="section"><h2><a name="section12">Changes for version 3.0.7</a></h2>
741
<ol class="enumerated">
742
<li><p>Fixed the code generated by <b class="cmd">critcl::c++command</b>.
743
The emitted code handed a non-static string table to
744
<b class="function">Tcl_GetIndexFromObj</b>, in violation of the contract, which
745
requires the table to have a fixed address. This was a memory
746
smash waiting to happen. Thanks to Brian Griffin for alrerting
747
us to the general problem.</p></li>
750
<div id="section13" class="section"><h2><a name="section13">Changes for version 3.1</a></h2>
751
<ol class="enumerated">
752
<li><p>Added a new higher-level package <b class="package"><a href="critcl_iassoc.html">critcl::iassoc</a></b>.</p>
753
<p>This package simplifies the creation of code associating data
754
with an interpreter via Tcl's <b class="function">Tcl_(Get|Set)AssocData()</b> APIs. The
755
user can concentrate on his data while all the necessary boilerplate
756
C code to support this is generated by the package.</p>
757
<p>This package uses several of the new features which were added
758
to the core <b class="package"><a href="critcl_pkg.html">critcl</a></b> package, see below.</p></li>
759
<li><p>Added the higher-level package <b class="package"><a href="critcl_class.html">critcl::class</a></b>.</p>
760
<p>This package simplifies the creation of C level objects with
761
class and instance commands. The user can write a class definition
762
with class- and instance-variables and -methods similar to a TclOO
763
class, with all the necessary boilerplate C code to support this
764
generated by the package.</p>
765
<p>This package uses several of the new features which were added
766
to the core <b class="package"><a href="critcl_pkg.html">critcl</a></b> package, see below.</p></li>
767
<li><p>Extended the API for handling TEApot metadata. Added the
768
command <b class="cmd">critcl::meta?</b> to query the stored information. Main use
769
currently envisioned is retrieval of the current package's name by
770
utility commands, for use in constructed names. This particular
771
information is always available due to the static scan of the package
772
file on execution of the first critcl command.</p>
773
<p>The new packages <b class="package"><a href="critcl_iassoc.html">critcl::iassoc</a></b> and
774
<b class="package"><a href="critcl_class.html">critcl::class</a></b> (see above) are users of this command.</p></li>
775
<li><p>Extended the API with a command, <b class="cmd">critcl::name2c</b>, exposing
776
the process of converting a Tcl name into base name, namespace, and C
777
namespace. This enables higher-level code generators to generate the same
778
type of C identifiers as <b class="package"><a href="critcl_pkg.html">critcl</a></b> itself.</p>
779
<p>The new package <b class="package"><a href="critcl_class.html">critcl::class</a></b> (see above) is a user
780
of this command.</p></li>
781
<li><p>Extended the API with a command, <b class="cmd">critcl::source</b>,
782
executing critcl commands found in a separate file in the context of
783
the current file. This enables easier management of larger bodies of
784
code as it allows the user to split such up into easier to digest
785
smaller chunks without causing the generation of multiple packages.</p></li>
786
<li><p>Related to the previous item, extended the API with commands to
787
divert collection of generated C code into memory. This makes it
788
easier to use the commands for embedded C code in higher-level code
790
<p>See the section <b class="sectref">Advanced: Diversions</b> for details of
791
the provided commands.</p>
792
<p>The new package <b class="package"><a href="critcl_class.html">critcl::class</a></b> (see above) is a user
793
of these facilities.</p></li>
794
<li><p>Extended the API with commands helping developers with the
795
generation of proper C <i class="term">#line</i> directives. This allows
796
higher-level code generators to generate and insert their own
797
directives, ensuring that compile errors in their code are properly
799
<p>See the section <b class="sectref">Advanced: Location management</b> for
800
details of the provided commands.</p>
801
<p>The new packages <b class="package"><a href="critcl_iassoc.html">critcl::iassoc</a></b> and
802
<b class="package"><a href="critcl_class.html">critcl::class</a></b> (see above) are users of these facilities.</p></li>
803
<li><p>Extended the API with commands giving users the ability to
804
define custom argument and result types for <b class="cmd">::critcl::cproc</b>.</p>
805
<p>See the section <b class="sectref">Advanced: Extending cproc</b> for
806
details of the provided commands.</p></li>
809
<div id="section14" class="section"><h2><a name="section14">Changes for version 3.1.1</a></h2>
810
<ol class="enumerated">
811
<li><p>Bugfixes all around. In detail:</p></li>
812
<li><p>Fixed the generation of wrong#args errors for
813
<b class="cmd">critcl::cproc</b> and derived code (<b class="package"><a href="critcl_class.html">critcl::class</a></b>
814
cproc-based methods). Use NULL if there are no arguments, and
815
take the offset into account.</p></li>
816
<li><p>Fixed the handling of package names by
817
<b class="package"><a href="critcl_class.html">critcl::class</a></b>. Forgot that they may contain namespace
818
separators. Bumped to version 1.0.1.</p></li>
819
<li><p>Extended a <b class="package"><a href="critcl_class.html">critcl::class</a></b> generated error message in
820
instance creation for clarity. Bumped to version 1.0.2.</p></li>
823
<div id="section15" class="section"><h2><a name="section15">Changes for version 3.1.2</a></h2>
824
<ol class="enumerated">
825
<li><p>Enhancement. In detail:</p></li>
826
<li><p>Extended <b class="cmd">critcl::cproc</b> to be able to handle optional
827
arguments, in a limited way. This is automatically available to
828
<b class="package"><a href="critcl_class.html">critcl::class</a></b> cproc-based methods as well.</p></li>
829
<li><p>Bugfix in <b class="cmd">lassign</b> emulation for Tcl 8.4. Properly set
830
unused variables to the empty string. Bumped version of
831
emulation package <b class="package">lassign84</b> to 1.0.1.</p></li>
834
<div id="section16" class="section"><h2><a name="section16">Changes for version 3.1.3</a></h2>
835
<ol class="enumerated">
836
<li><p>Enhancement. In detail:</p></li>
837
<li><p>Added new argument type "pstring", for "Pascal String", a
838
counted string, i.e. a combination of string pointer and string
840
<li><p>Added new methods <b class="cmd">critcl::argtypesupport</b> and
841
<b class="cmd">::critcl::argsupport</b> to define and use additional
842
supporting code for an argument type, here used by "pstring"
843
above to define the necessary structure.</p></li>
844
<li><p>Semi-bugfixes in the packages <b class="package"><a href="critcl_class.html">critcl::class</a></b> and
845
<b class="package"><a href="critcl_iassoc.html">critcl::iassoc</a></b>. Pragmas for the AS meta data scanner
846
to ensure that the template files are made part of the package.
847
Versions bumped to 1.0.4 and 1.0.1 respectively.</p></li>
850
<div id="section17" class="section"><h2><a name="section17">Changes for version 3.1.4</a></h2>
851
<ol class="enumerated">
852
<li><p>Bugfix in package <b class="package"><a href="critcl_class.html">critcl::class</a></b>. Generate a dummy
853
field in the class structure if the class has no class
854
variables. Without this change the structure would be empty,
855
and a number of compilers are not able to handle such a type.</p></li>
856
<li><p>Fixed a typo which broke the win64 configuration.</p></li>
857
<li><p>Fixed issue #16, a typo in the documentation of command
858
<b class="cmd"><a href="critcl_class.html">critcl::class</a></b>.</p></li>
861
<div id="section18" class="section"><h2><a name="section18">Changes for version 3.1.5</a></h2>
862
<ol class="enumerated">
863
<li><p>Fixed issue #19. Made the regular expression extracting the
864
MSVC version number more general to make it work on german
865
language systems. This may have to be revisited in the future,
866
for other Windows locales.</p></li>
867
<li><p>Fixed issue #20. Made option -tea work on windows, at least in
868
a unix emulation environment like msys/mingw.</p></li>
871
<div id="section19" class="section"><h2><a name="section19">Changes for version 3.1.6</a></h2>
872
<ol class="enumerated">
873
<li><p>Fixed issue #21. While the multi-definition of the stub-table
874
pointer variables was ok with for all the C linkers seen so far
875
C++ linkers did not like this at all. Reworked the code to
876
ensure that this set of variables is generated only once, in
877
the wrapper around all the pieces to assemble.</p></li>
878
<li><p>Fixed issue #22, the handling of the command identifier
879
arguments of <b class="cmd">critcl::ccommand</b>, <b class="cmd">critcl::cproc</b>, and
880
<b class="cmd">critcl::cdata</b>. We now properly allow any Tcl identifier
881
and generate proper internal C identifiers from them.</p>
882
<p>As part of this the signature of command <b class="cmd">critcl::name2c</b>
883
changed. The command now delivers a list of four values instead
884
of three. The new value was added at the end.</p>
885
<p>Further adapted the implementation of package
886
<b class="package"><a href="critcl_class.html">critcl::class</a></b>, a user of <b class="cmd">critcl::name2c</b>.
887
This package is now at version 1.0.6 and requires critcl 3.1.6</p>
888
<p>Lastly fixed the mis-handling of option <b class="option">-cname</b> in
889
<b class="cmd">critcl::ccommand</b>, and <b class="cmd">critcl::cproc</b>.</p></li>
890
<li><p>Fixed issue #23.</p></li>
893
<div id="section20" class="section"><h2><a name="section20">Changes for version 3.1.7</a></h2>
894
<ol class="enumerated">
895
<li><p>Fixed issue #24. Extract and unconditionally display compiler
896
warnings found in the build log. Prevents users from missing
897
warnings which, while not causing the build to fail, may
898
still indicate problems.</p></li>
899
<li><p>New feature. Output hook. All non-messaging user output is now
900
routed through the command <b class="cmd">critcl::print</b>, and users are
901
allowed to override it when using the critcl application-as-package.</p></li>
902
<li><p>New feature, by Ashok P. Nadkarni. Platform configurations can
903
inherit values from configurations defined before them.</p></li>
906
<div id="section21" class="section"><h2><a name="section21">Changes for version 3.1.8</a></h2>
907
<ol class="enumerated">
908
<li><p>Fixed issue with package indices generated for Tcl 8.4.
909
Join the list of commands with semi-colon, not newline.</p></li>
910
<li><p>Fixed issue #26 which brought up use-cases I had forgotten to
911
consider while fixing bug #21 (see critcl 3.1.6).</p></li>
914
<div id="section22" class="section"><h2><a name="section22">Changes for version 3.1.9</a></h2>
915
<ol class="enumerated">
916
<li><p>Fixed issue #27. Added missing platform definitions for
917
various alternate linux and OS X targets.</p></li>
918
<li><p>Fixed issue #28. Added missing -mXX flags for linking at the
919
linux-{32,64}-* targets.</p></li>
920
<li><p>Fixed issue #29. Replaced the use of raw "cheaders"
921
information in the processing of "cdefines" with the proper
922
include directives derived from it.</p></li>
923
<li><p>Fixed the issue behind rejected pull request #30 by Andrew
924
Shadura. Dynamically extract the stubs variable declarations
925
from the Tcl header files and generate matching variable
926
definitions for use in the package code. The generated code
927
will now be always consistent with the headers, even when
928
critcl's own copy of them is replaced by system headers.</p></li>
929
<li><p>Fixed issue #31. Accepted patch by Andrew Shadura, with
930
changes (comments), for easier integration of critcl with
931
OS package systems, replacing critcl's copies of Tcl headers
932
with their own.</p></li>
933
<li><p>Fixed issue #32. Merged pull request by Andrew Shadura.
934
Various typos in documentation and comments.</p></li>
935
<li><p>Fixed issue #33. Handle files starting with a dot better.</p></li>
938
<div id="section23" class="section"><h2><a name="section23">Authors</a></h2>
939
<p>Jean Claude Wippler, Steve Landers, Andreas Kupries</p>
941
<div id="section24" class="section"><h2><a name="section24">Bugs, Ideas, Feedback</a></h2>
942
<p>This document, and the package it describes, will undoubtedly contain
943
bugs and other problems.
944
Please report them at <a href="https://github.com/andreas-kupries/critcl/issues">https://github.com/andreas-kupries/critcl/issues</a>.
945
Ideas for enhancements you may have for either package, application,
946
and/or the documentation are also very welcome and should be reported
947
at <a href="https://github.com/andreas-kupries/critcl/issues">https://github.com/andreas-kupries/critcl/issues</a> as well.</p>
949
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
950
<p><a href="../index.html#key8">C code</a>, <a href="../index.html#key3">Embedded C Code</a>, <a href="../index.html#key6">code generator</a>, <a href="../index.html#key0">compile & run</a>, <a href="../index.html#key10">compiler</a>, <a href="../index.html#key1">dynamic code generation</a>, <a href="../index.html#key2">dynamic compilation</a>, <a href="../index.html#key9">generate package</a>, <a href="../index.html#key4">linker</a>, <a href="../index.html#key5">on demand compilation</a>, <a href="../index.html#key7">on-the-fly compilation</a></p>
952
<div id="category" class="section"><h2><a name="category">Category</a></h2>
953
<p>Glueing/Embedded C code</p>
955
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
956
<p>Copyright © Jean-Claude Wippler<br>
957
Copyright © Steve Landers<br>
958
Copyright © 2011-2013 Andreas Kupries</p>