3
<title>critcl_introduction - 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_introduction.html' by tcllib/doctools with format 'html'
97
<! -- Copyright © Jean-Claude Wippler -- Copyright © Steve Landers -- Copyright © 2011-2013 Andreas Kupries
99
<! -- CVS: $Id$ critcl_introduction.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_introduction(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_introduction - Introduction To CriTcl</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="#section1">Description</a></li>
114
<li class="section"><a href="#section2">Related Documents</a></li>
115
<li class="section"><a href="#section3">Modes Of Operation/Use</a></li>
116
<li class="section"><a href="#section4">System Architecture</a></li>
117
<li class="section"><a href="#section5">Examples</a></li>
118
<li class="section"><a href="#section6">Changes for version 2.1</a></li>
119
<li class="section"><a href="#section7">Changes for version 3</a></li>
120
<li class="section"><a href="#section8">Changes for version 3.0.1</a></li>
121
<li class="section"><a href="#section9">Changes for version 3.0.2</a></li>
122
<li class="section"><a href="#section10">Changes for version 3.0.3</a></li>
123
<li class="section"><a href="#section11">Changes for version 3.0.4</a></li>
124
<li class="section"><a href="#section12">Changes for version 3.0.5</a></li>
125
<li class="section"><a href="#section13">Changes for version 3.0.6</a></li>
126
<li class="section"><a href="#section14">Changes for version 3.0.7</a></li>
127
<li class="section"><a href="#section15">Changes for version 3.1</a></li>
128
<li class="section"><a href="#section16">Changes for version 3.1.1</a></li>
129
<li class="section"><a href="#section17">Changes for version 3.1.2</a></li>
130
<li class="section"><a href="#section18">Changes for version 3.1.3</a></li>
131
<li class="section"><a href="#section19">Changes for version 3.1.4</a></li>
132
<li class="section"><a href="#section20">Changes for version 3.1.5</a></li>
133
<li class="section"><a href="#section21">Changes for version 3.1.6</a></li>
134
<li class="section"><a href="#section22">Changes for version 3.1.7</a></li>
135
<li class="section"><a href="#section23">Changes for version 3.1.8</a></li>
136
<li class="section"><a href="#section24">Changes for version 3.1.9</a></li>
137
<li class="section"><a href="#section25">Authors</a></li>
138
<li class="section"><a href="#section26">Bugs, Ideas, Feedback</a></li>
139
<li class="section"><a href="#keywords">Keywords</a></li>
140
<li class="section"><a href="#category">Category</a></li>
141
<li class="section"><a href="#copyright">Copyright</a></li>
144
<div id="section1" class="section"><h2><a name="section1">Description</a></h2>
145
<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
146
system to build C extension packages for Tcl on the fly, from C code
147
embedded within Tcl scripts, for all who wish to make their code go
149
<p>CriTcl started life as an experiment by Jean-Claude Wippler and was a
150
self-contained Tcl package to build C code into a Tcl/Tk extension on
151
the fly. It was somewhat inspired by Brian Ingerson's <i class="term">Inline</i>
152
for <i class="term">Perl</i>, but is considerably more lightweight.</p>
153
<p>It is for the last 5% to 10% when pure Tcl, which does go a long way,
154
is not sufficient anymore. I.e. for</p>
155
<ol class="enumerated">
156
<li><p>when the last bits of performance are needed,</p></li>
157
<li><p>access to 3rd party libraries,</p></li>
158
<li><p>hiding critical pieces of your library or application, and</p></li>
159
<li><p>simply needing features provided only by C.</p></li>
161
<p>The following sections first reference a few related documents
162
which may or may not be of interest to you, depending on if you are
163
just a plain user of the system, trying to get and build/install it,
164
or are going deep into the internals for either edification or
166
<p>This is followed by an introduction to the modes of operation
167
supported by the system, and its general architecture as seen by a
170
<div id="section2" class="section"><h2><a name="section2">Related Documents</a></h2>
171
<ol class="enumerated">
172
<li><p><i class="term"><a href="license.html">Critcl - License</a></i>.</p></li>
173
<li><p><i class="term"><a href="critcl_usingit.html">Using Critcl</a></i></p></li>
174
<li><p><i class="term"><a href="critcl_sources.html">Critcl - How To Get The Sources</a></i>.</p></li>
175
<li><p><i class="term"><a href="critcl_installer.html">Critcl - The Installer's Guide</a></i>.</p></li>
176
<li><p><i class="term"><a href="critcl_apppkg.html">Critcl - Application Package Reference</a></i></p></li>
177
<li><p><i class="term"><a href="critcl_pkg.html">Critcl - Package Reference</a></i></p></li>
178
<li><p><i class="term"><a href="critcl_devguide.html">Critcl - The Developer's Guide</a></i>.</p></li>
181
<div id="section3" class="section"><h2><a name="section3">Modes Of Operation/Use</a></h2>
182
<p>CriTcl can be used in three different modes of operation, called</p>
183
<ol class="enumerated">
184
<li><p><i class="term"><a href="../index.html#key0">Compile & Run</a></i>, and</p></li>
185
<li><p><i class="term"><a href="../index.html#key9">Generate Package</a></i></p></li>
186
<li><p><i class="term">Generate TEA Package</i></p></li>
188
<p>Of these three <i class="term"><a href="../index.html#key0">Compile & Run</a></i> came first and is the default
189
when using the package directly. In that case the package collects the
190
C fragments, builds them as needed, and caches the results for quick
191
reuse when the same code is used in the future again.</p>
192
<p>The second mode, <i class="term"><a href="../index.html#key9">Generate Package</a></i>, was introduced to enable
193
the creation of (prebuilt) deliverable packages which do not depend on
194
the existence of a build system, i.e. C compiler, on the target
196
This was originally done through the experimental <b class="cmd">Critbind</b> tool,
197
and is now handled by the <i class="term"><a href="critcl_app.html">CriTcl Application</a></i>, also named
198
<b class="cmd"><a href="critcl_pkg.html">critcl</a></b>.</p>
199
<p>Newly introduced with Critcl version 3 is
200
<i class="term">Generate TEA Package</i>. This mode constructs a directory
201
hierarchy from the package which can later be built like a regular TEA
202
package, i.e. using</p>
203
<pre class="example">
204
.../configure --prefix ...
208
<div id="section4" class="section"><h2><a name="section4">System Architecture</a></h2>
209
<p>The system consists of two main layers, as seen in the figure below,
210
plus a support layer containing general packages the system uses during
212
<p><img alt="architecture" src="../image/architecture.png"></p>
213
<ol class="enumerated">
214
<li><p>At the top we have an application built on top of the core packages,
215
providing command line access to the second and third usage modes,
216
i.e. <i class="term"><a href="../index.html#key9">Generate Package</a></i> and <i class="term">Generate TEA Package</i>.</p>
217
<dl class="definitions">
218
<dt><b class="syscmd"><a href="critcl_pkg.html">critcl</a></b></dt>
220
<dt><b class="package"><a href="critcl_apppkg.html">critcl::app</a></b></dt>
224
<li><p>Below that is the core package providing the essential functionality
225
of the system, plus various utility packages which make common tasks
227
<dl class="definitions">
228
<dt><b class="package"><a href="critcl_pkg.html">critcl</a></b></dt>
230
<dt><b class="package"><a href="critcl_util.html">critcl::util</a></b></dt>
234
<li><p>Lastly a layer of supporting packages, mostly external to critcl.</p>
235
<dl class="definitions">
236
<dt><b class="package">md5</b></dt>
237
<dd><p>For this pure-Tcl package to be fast users should get one of several
238
possible accelerator packages:</p>
239
<ol class="enumerated">
240
<li><p><b class="package">tcllibc</b></p></li>
241
<li><p><b class="package">Trf</b></p></li>
242
<li><p><b class="package">md5c</b></p></li>
244
<dt><b class="package">cmdline</b></dt>
246
<dt><b class="package">platform</b></dt>
248
<dt><b class="package">stubs::container</b></dt>
250
<dt><b class="package">stubs::reader</b></dt>
252
<dt><b class="package">stubs::writer</b></dt>
254
<dt><b class="package">stubs::gen</b></dt>
256
<dt><b class="package">stubs::gen::init</b></dt>
258
<dt><b class="package">stubs::gen::header</b></dt>
260
<dt><b class="package">stubs::gen::decl</b></dt>
262
<dt><b class="package">stubs::gen::macro</b></dt>
264
<dt><b class="package">stubs::gen::slot</b></dt>
266
<dt><b class="package">stubs::gen::lib</b></dt>
272
<div id="section5" class="section"><h2><a name="section5">Examples</a></h2>
273
<p>The sources of Critcl, should you have gotten them, contain
274
several larger examples show-casing various aspects of the
275
system. These demonstration packages can all be found in the
276
sub-directory "<b class="file">examples/</b>" of the sources.</p>
277
<p>Lots of smaller examples can be found in the document
278
<i class="term">Using CriTcl</i>, an introduction to Critcl by way of a of
279
examples. These focus more on specific critcl commands than the
280
overall picture shown by the large examples mentioned in the previous
283
<div id="section6" class="section"><h2><a name="section6">Changes for version 2.1</a></h2>
284
<ol class="enumerated">
285
<li><p>Fixed bug where <b class="cmd">critcl::tsources</b> interpreted relative
286
paths as relative to the current working directory instead of
287
relative to the "<b class="file">.critcl</b>" file using the command, as all other
288
commands of this type do.</p></li>
289
<li><p>Fixed internals, preventing information collected for multiple
290
"<b class="file">.critcl</b>" files to leak between them. Notably, <b class="cmd">critcl::tk</b>
291
is not a global configuration option anymore.</p></li>
292
<li><p>Fixed the command <b class="cmd">critcl::license</b> to be a null-operation
293
in mode "compile & run", instead of throwing an error.</p></li>
294
<li><p>Fixed the critcl application's interference with the "compile &
295
run" result cache in <b class="option">-pkg</b> mode by having it use a wholly
296
separate (and by default transient) directory for that mode.</p></li>
297
<li><p>Fixed bug where changes to a "<b class="file">.critcl</b>" file did not result
298
in a rebuild for mode "compile & run". All relevant API commands now
299
ensure UUID changes.</p></li>
300
<li><p>Fixed bug in the backend handling of <b class="cmd">critcl::debug</b> where
301
the companion c-sources of a "<b class="file">.critcl</b>" file were not compiled
302
with debug options, although the "<b class="file">.critcl</b>" file was.</p></li>
303
<li><p>Fixed bug in <b class="cmd">critcl::debug</b> which prevented recognition of
304
mode "all" when it was not the first argument to the command.</p></li>
305
<li><p>Fixed bug in "<b class="file">preload.c</b>" preventing its compilation on
306
non-windows platforms.</p></li>
307
<li><p>Fixed long-standing bug in the handling of namespace qualifiers
308
in the command name argument of <b class="cmd">critcl::cproc</b> and
309
<b class="cmd">critcl::ccommand</b>. It is now possible to specify a fully
310
qualified command name without issues.</p></li>
311
<li><p>Extended/reworked <b class="cmd">critcl::tsources</b> to be the canonical
312
way of declaring "<b class="file">.tcl</b>" companion files even for mode "compile &
314
<li><p>Extended/reworked <b class="cmd">critcl::tsources</b> to allow the use of a
315
"<b class="file">.critcl</b>" file as its own Tcl companion file.</p></li>
316
<li><p>Extended <b class="cmd">critcl::framework</b> to internally check for OS X
317
build target, and to ignore the declaration if its not.</p></li>
318
<li><p>Extended <b class="cmd">critcl::failed</b> to be callable more than once in
319
a "<b class="file">.critcl</b>" file. The first call forces the build, if it was not
320
done already, to get the result. Further calls return the cached
321
result of the first call.</p></li>
322
<li><p>Extended the handling of environment variable CC in the code
323
determining the compiler to use to deal with (i.e. remove) paths to
324
the compiler, compiler file extensions, and compiler options specified
325
after the compiler itself, leaving only the bare name of the compiler.</p></li>
326
<li><p>Extended the code handling the search for preloaded libraries
327
to print the paths it searched, making debugging of a search failure
329
<li><p>A new command <b class="cmd">critcl::tcl</b> can be used to declare the
330
version of Tcl minimally needed to build and run the "<b class="file">.critcl</b>"
331
file and package. Defaults to 8.4 if not declared. Extended critcl to
332
have the stubs and headers for all of Tcl 8.4, 8.5, and 8.6.</p></li>
333
<li><p>A new command <b class="cmd">critcl::load</b> forces the build and load of a
334
"<b class="file">.critcl</b>" file. This is the official way for overriding critcl's
335
default lazy-build-&-load-on-demand scheme for mode "compile & run".</p>
336
<p><em>Note</em> that after using <b class="cmd">critcl::load</b> /
337
<b class="cmd">critcl::failed</b> in a "<b class="file">.critcl</b>" file it is not possible to
338
use critcl commands in that file anymore. Doing so will throw an
340
<li><p>Extended the generation of '#line' pragmas to use
341
<b class="cmd">info frame</b> (if available) to provide the C compiler with exact
342
line numbers into the "<b class="file">.critcl</b>" file for the reporting of
343
warnings and errors.</p></li>
344
<li><p>Extended <b class="cmd">critcl::check</b> with logging to help with
345
debugging build-time checks of the environment, plus an additional
346
optional argument to provide labeling.</p></li>
347
<li><p>Added a new command <b class="cmd">critcl::checklink</b> which not only
348
tries to check the environment via compiling the code, but also
349
its linkability.</p></li>
350
<li><p>Added a new command <b class="cmd">critcl::msg</b> for messaging, like
351
command <b class="cmd">critcl::error</b> is for error reporting. Likewise this is a
352
hook a user of the package is allowed to override. The default
353
implementation, used by mode <i class="term"><a href="../index.html#key0">compile & run</a></i> does nothing. The
354
implementation for mode <i class="term"><a href="../index.html#key9">generate package</a></i> prints the message
356
<p>Envisioned use is for the reporting of results determined by
357
<b class="cmd">critcl::check</b> and <b class="cmd">critcl::checklink</b> during building, to
358
help with debugging when something goes wrong with a check.</p></li>
359
<li><p>Exposed the argument processing internals of <b class="cmd">critcl::proc</b>
360
for use by advanced users. The new commands are</p>
361
<ol class="enumerated">
362
<li><p><b class="cmd">critcl::argnames</b></p></li>
363
<li><p><b class="cmd">critcl::argcnames</b></p></li>
364
<li><p><b class="cmd">critcl::argcsignature</b></p></li>
365
<li><p><b class="cmd">critcl::argvardecls</b></p></li>
366
<li><p><b class="cmd">critcl::argconversion</b></p></li>
368
<p>Please see section <em>Advanced Embedded C Code</em> of the
369
<b class="package"><a href="critcl_pkg.html">critcl</a></b> package documentation for details.</p></li>
370
<li><p>Extended the critcl package to intercept <b class="cmd">package
371
provide</b> and record the file -> package name mapping. Plus other
372
internal changes now allow the use of namespaced package names while
373
still using proper path names and init function.</p></li>
374
<li><p>Dropped the unused commands <b class="cmd">critcl::optimize</b> and
375
<b class="cmd">critcl::include</b>.</p></li>
376
<li><p>Dropped <b class="option">-lib</b> mode from the critcl application.</p></li>
377
<li><p>Dropped remnants of support for Tcl 8.3 and before.</p></li>
380
<div id="section7" class="section"><h2><a name="section7">Changes for version 3</a></h2>
381
<ol class="enumerated">
382
<li><p>The command <b class="cmd">critcl::platform</b> was deprecated in version
383
2.1, superceded by <b class="cmd">critcl::targetplatform</b>, yet kept for
384
compatibility. Now it has been removed.</p></li>
385
<li><p>The command <b class="cmd">critcl::compiled</b> was kept with in version 2.1
386
with semantics in contradiction to its, for compatibility. This
387
contradiction has been removed, changing the visible semantics of the
388
command to be in line with its name.</p></li>
389
<li><p>The change to version 3 became necessary because of the two
390
incompatible visible changes above.</p></li>
391
<li><p>Extended the application package with code handling a new
392
option <b class="option">-tea</b>. Specifying this option invokes a special mode
393
where critcl generates a TEA package, i.e. wraps the input into a
394
directory hierarchy and support files which provide it TEA-lookalike
396
<p>This new option, and <b class="option">-pkg</b>, exclude each other. If
397
both are specified the last used option takes precedence.</p>
398
<p>The generated package directory hierarchy is mostly
399
self-contained, but not fully. It requires not only a working
400
installation of Tcl, but also working installations of the packages
401
<b class="package">md5</b> and <b class="package">cmdline</b>. Both of these are provided by the
402
<b class="package">Tcllib</b> bundle. Not required, but recommended to have
403
installed are any of the packages which can accelerate md5's
404
operation, i.e. <b class="package">cryptkit</b>, <b class="package">tcllibc</b>, or
405
<b class="package">Trf</b>.</p></li>
406
<li><p>Extended the critcl package with a new command
407
<b class="cmd">critcl::scan</b> taking the path to a "<b class="file">.critcl</b>" file,
408
statically scanning it, and returning license, version, a list of its
409
companion files, list of imported APIs, and list of
410
developer-specified custom configuration options. This data is the
411
foundation for the TEA wrapping described above.</p>
412
<p>Note that this is a <em>static</em> scan. While the other build
413
modes can (must) execute the "<b class="file">.critcl</b>" file and make
414
platform-specific decisions regarding the assembled C code, companion
415
files, etc. the TEA wrap mode is not in a position to make
416
platform-specific decisions. It has to wrap everything which might
417
conceivably be needed when actually building. Hence the static scan.
418
This has however its own set of problems, namely the inability to
419
figure out any dynamic construction of companion file paths, at least
420
on its own. Thus:</p></li>
421
<li><p>Extended the API used by critcl-based packages with the command
422
<b class="cmd">critcl::owns</b>. While this command is ignored by the regular build
423
modes the static scanner described above takes its arguments as the
424
names of companion files which have to be wrapped into the TEA package
425
and could not be figured by the scanner otherwise, like because of
426
dynamic paths to <b class="cmd">critcl::tsources</b>, <b class="cmd">critcl::csources</b>,
427
getting sourced directly, or simply being adjunct datafiles.</p></li>
428
<li><p>Extended the API used by critcl-based packages with the command
429
<b class="cmd">critcl::api</b> for the management of stubs tables, be it their use,
430
and/or declaration and export.</p>
431
<p>Please see section <em>Stubs Table Management</em> of the
432
<b class="package"><a href="critcl_pkg.html">critcl</a></b> package documentation for details.</p></li>
433
<li><p>Extended the API used by critcl-based packages with the command
434
<b class="cmd">critcl::userconfig</b> for the management of developer-specified
435
custom configuration options, be it their use and/or declaration.</p>
436
<p>Please see section <em>Custom Build Configuration</em> of the
437
<b class="package"><a href="critcl_pkg.html">critcl</a></b> package documentation for details.</p></li>
438
<li><p>Extended the API used by critcl-based packages with the
439
commands <b class="cmd">critcl::description</b>, <b class="cmd">critcl::summary</b>,
440
<b class="cmd">critcl::subject</b>, <b class="cmd">critcl::meta</b>, and
441
<b class="cmd">critcl::buildrequirement</b> for the declaration of TEApot meta data
442
for/about the package.</p>
443
<p>Please see section <em>Package Meta Data</em> of the
444
<b class="package"><a href="critcl_pkg.html">critcl</a></b> package documentation for details.</p></li>
447
<div id="section8" class="section"><h2><a name="section8">Changes for version 3.0.1</a></h2>
448
<ol class="enumerated">
449
<li><p>Bugfixes all around. In detail:</p></li>
450
<li><p>Fixed recording of Tcl version requirements. Keep package name
451
and version together, unbreaking generated meta data and generated
452
package load command.</p></li>
453
<li><p>Fixed the build scripts: When installing, or wrapping for TEA,
454
generate any missing directories</p></li>
455
<li><p>Modified the build scripts to properly exit the application
456
when the window of their GUI is closed through the (X) button.</p></li>
457
<li><p>Removed an 8.5-ism (open wb) which had slipped into the main
458
build script.</p></li>
459
<li><p>Modified the example build scripts to separate the output for
460
the different examples (and packages) by adding empty lines.</p></li>
461
<li><p>stack::c example bugfix: Include API declarations for use in
462
the companion files.</p></li>
463
<li><p>Extended the documentation: Noted the need for a working
464
installation of a C compiler.</p></li>
465
<li><p>Extended the Windows target definitions and code to handle the
466
manifest files used by modern MS development environments. Note that
467
this code handles both possibilities, environment using manifests, and
468
(old(er)) environments without.</p></li>
469
<li><p>Extended the Windows 64bit target definitions and code to
470
auto-detect the need for the helper library "bufferoverflowU.lib" and
471
reconfigure the compile and link commands appropriately. We assume
472
that the library must be linked when present. This should be no harm
473
if the library is present, yet not needed. Just superfluous. We search
474
for the library in the paths specified by the environment variable
478
<div id="section9" class="section"><h2><a name="section9">Changes for version 3.0.2</a></h2>
479
<ol class="enumerated">
480
<li><p>Fixed issue in compile-and-run mode where commands put into the
481
auto_index are not found by Tcl's [unknown] command.</p></li>
482
<li><p>Fixed an array key mismatch breaking usage of client data and
483
delete function for procedure. Reported by Jos DeCoster, with patch.</p></li>
484
<li><p>Implemented a command line option <b class="option">-L</b>, an equivalent of
485
option <b class="option">-I</b>, just for library search paths.</p></li>
486
<li><p>Fixed github issues 5 and 8. Working around a missing variable
487
::errorInfo. It should always be present, however there seem to be
488
revisions of Tcl around which violate this assumption.</p></li>
491
<div id="section10" class="section"><h2><a name="section10">Changes for version 3.0.3</a></h2>
492
<ol class="enumerated">
493
<li><p>Fixed github issues 5 and 8, for the example build.tcl
494
scripts. Working around a missing variable ::errorInfo. It should
495
always be present, however there seem to be revisions of Tcl around
496
which violate this assumption.</p></li>
499
<div id="section11" class="section"><h2><a name="section11">Changes for version 3.0.4</a></h2>
500
<ol class="enumerated">
501
<li><p>Fixed generation of the package's initname when the incoming
502
code is read from stdin and has no proper path.</p></li>
503
<li><p>Fixed github issue 11. Now using /LIBPATH instead of -L
504
on Windows (libinclude configuration setting).</p></li>
505
<li><p>Extended critcl to handle -l:path format of -l options.
506
GNU ld 2.22+ handles this by searching for the path as
507
is. Good when specifying static libraries, as plain -l looks
508
for shared libraries in preference over static. critcl handles
509
it now, as older GNU ld's do not understand it, nor the
510
various vendor-specific linkers.</p></li>
511
<li><p>Fixed github issue #12. Critcl now determines the version of
512
MSVC in use and uses it to switch between various link debug
513
options. Simplified the handling of bufferoverflowU.lib also,
514
making use of the same mechanism and collapsing the two
515
configurations sections we had back into one.</p></li>
516
<li><p>Reworked the insertion of #line pragmas into the generated C
517
code to avoid limitations on the line number argument imposed
518
by various compilers, and be more accurate.</p></li>
519
<li><p>Modified argument processing. Option -libdir now also
520
implies -L for its argument.</p></li>
521
<li><p>Extended handling of option -show (<b class="cmd">critcl::showconfig</b>)
522
to list the path of the configuration file the data is coming
523
from. Good for debugging configuration processing.</p></li>
524
<li><p>Extended the build script with targets to regenerate the
525
embedded documentation, and diagrams, and to generate a
529
<div id="section12" class="section"><h2><a name="section12">Changes for version 3.0.5</a></h2>
530
<ol class="enumerated">
531
<li><p>Fixed bug in the new code for #line pragmas triggered when
532
specifying C code without leading whitespace.</p></li>
533
<li><p>Extended the documentation to have manpages for the license,
534
source retrieval, installer, and developer's guides.</p></li>
537
<div id="section13" class="section"><h2><a name="section13">Changes for version 3.0.6</a></h2>
538
<ol class="enumerated">
539
<li><p>Fixed github issue 10. The critcl application now delivers a
540
proper exit code (1) on build failure, instead of always
541
indicating success (status 0).</p></li>
542
<li><p>Fixed github issue 13. Handling of bufferoverflowU.lib for
543
release builds was inconsistent with handling for debug
544
builds. It is now identically handled (conditional) by
546
<li><p>Documentation cleanup, mainly in the installation guide, and
547
the README.md shown by github</p></li>
550
<div id="section14" class="section"><h2><a name="section14">Changes for version 3.0.7</a></h2>
551
<ol class="enumerated">
552
<li><p>Fixed the code generated by <b class="cmd">critcl::c++command</b>.
553
The emitted code handed a non-static string table to
554
<b class="function">Tcl_GetIndexFromObj</b>, in violation of the contract, which
555
requires the table to have a fixed address. This was a memory
556
smash waiting to happen. Thanks to Brian Griffin for alrerting
557
us to the general problem.</p></li>
560
<div id="section15" class="section"><h2><a name="section15">Changes for version 3.1</a></h2>
561
<ol class="enumerated">
562
<li><p>Added a new higher-level package <b class="package"><a href="critcl_iassoc.html">critcl::iassoc</a></b>.</p>
563
<p>This package simplifies the creation of code associating data
564
with an interpreter via Tcl's <b class="function">Tcl_(Get|Set)AssocData()</b> APIs. The
565
user can concentrate on his data while all the necessary boilerplate
566
C code to support this is generated by the package.</p>
567
<p>This package uses several of the new features which were added
568
to the core <b class="package"><a href="critcl_pkg.html">critcl</a></b> package, see below.</p></li>
569
<li><p>Added the higher-level package <b class="package"><a href="critcl_class.html">critcl::class</a></b>.</p>
570
<p>This package simplifies the creation of C level objects with
571
class and instance commands. The user can write a class definition
572
with class- and instance-variables and -methods similar to a TclOO
573
class, with all the necessary boilerplate C code to support this
574
generated by the package.</p>
575
<p>This package uses several of the new features which were added
576
to the core <b class="package"><a href="critcl_pkg.html">critcl</a></b> package, see below.</p></li>
577
<li><p>Extended the API for handling TEApot metadata. Added the
578
command <b class="cmd">critcl::meta?</b> to query the stored information. Main use
579
currently envisioned is retrieval of the current package's name by
580
utility commands, for use in constructed names. This particular
581
information is always available due to the static scan of the package
582
file on execution of the first critcl command.</p>
583
<p>The new packages <b class="package"><a href="critcl_iassoc.html">critcl::iassoc</a></b> and
584
<b class="package"><a href="critcl_class.html">critcl::class</a></b> (see above) are users of this command.</p></li>
585
<li><p>Extended the API with a command, <b class="cmd">critcl::name2c</b>, exposing
586
the process of converting a Tcl name into base name, namespace, and C
587
namespace. This enables higher-level code generators to generate the same
588
type of C identifiers as <b class="package"><a href="critcl_pkg.html">critcl</a></b> itself.</p>
589
<p>The new package <b class="package"><a href="critcl_class.html">critcl::class</a></b> (see above) is a user
590
of this command.</p></li>
591
<li><p>Extended the API with a command, <b class="cmd">critcl::source</b>,
592
executing critcl commands found in a separate file in the context of
593
the current file. This enables easier management of larger bodies of
594
code as it allows the user to split such up into easier to digest
595
smaller chunks without causing the generation of multiple packages.</p></li>
596
<li><p>Related to the previous item, extended the API with commands to
597
divert collection of generated C code into memory. This makes it
598
easier to use the commands for embedded C code in higher-level code
600
<p>See the section <b class="sectref">Advanced: Diversions</b> for details of
601
the provided commands.</p>
602
<p>The new package <b class="package"><a href="critcl_class.html">critcl::class</a></b> (see above) is a user
603
of these facilities.</p></li>
604
<li><p>Extended the API with commands helping developers with the
605
generation of proper C <i class="term">#line</i> directives. This allows
606
higher-level code generators to generate and insert their own
607
directives, ensuring that compile errors in their code are properly
609
<p>See the section <b class="sectref">Advanced: Location management</b> for
610
details of the provided commands.</p>
611
<p>The new packages <b class="package"><a href="critcl_iassoc.html">critcl::iassoc</a></b> and
612
<b class="package"><a href="critcl_class.html">critcl::class</a></b> (see above) are users of these facilities.</p></li>
613
<li><p>Extended the API with commands giving users the ability to
614
define custom argument and result types for <b class="cmd">::critcl::cproc</b>.</p>
615
<p>See the section <b class="sectref">Advanced: Extending cproc</b> for
616
details of the provided commands.</p></li>
619
<div id="section16" class="section"><h2><a name="section16">Changes for version 3.1.1</a></h2>
620
<ol class="enumerated">
621
<li><p>Bugfixes all around. In detail:</p></li>
622
<li><p>Fixed the generation of wrong#args errors for
623
<b class="cmd">critcl::cproc</b> and derived code (<b class="package"><a href="critcl_class.html">critcl::class</a></b>
624
cproc-based methods). Use NULL if there are no arguments, and
625
take the offset into account.</p></li>
626
<li><p>Fixed the handling of package names by
627
<b class="package"><a href="critcl_class.html">critcl::class</a></b>. Forgot that they may contain namespace
628
separators. Bumped to version 1.0.1.</p></li>
629
<li><p>Extended a <b class="package"><a href="critcl_class.html">critcl::class</a></b> generated error message in
630
instance creation for clarity. Bumped to version 1.0.2.</p></li>
633
<div id="section17" class="section"><h2><a name="section17">Changes for version 3.1.2</a></h2>
634
<ol class="enumerated">
635
<li><p>Enhancement. In detail:</p></li>
636
<li><p>Extended <b class="cmd">critcl::cproc</b> to be able to handle optional
637
arguments, in a limited way. This is automatically available to
638
<b class="package"><a href="critcl_class.html">critcl::class</a></b> cproc-based methods as well.</p></li>
639
<li><p>Bugfix in <b class="cmd">lassign</b> emulation for Tcl 8.4. Properly set
640
unused variables to the empty string. Bumped version of
641
emulation package <b class="package">lassign84</b> to 1.0.1.</p></li>
644
<div id="section18" class="section"><h2><a name="section18">Changes for version 3.1.3</a></h2>
645
<ol class="enumerated">
646
<li><p>Enhancement. In detail:</p></li>
647
<li><p>Added new argument type "pstring", for "Pascal String", a
648
counted string, i.e. a combination of string pointer and string
650
<li><p>Added new methods <b class="cmd">critcl::argtypesupport</b> and
651
<b class="cmd">::critcl::argsupport</b> to define and use additional
652
supporting code for an argument type, here used by "pstring"
653
above to define the necessary structure.</p></li>
654
<li><p>Semi-bugfixes in the packages <b class="package"><a href="critcl_class.html">critcl::class</a></b> and
655
<b class="package"><a href="critcl_iassoc.html">critcl::iassoc</a></b>. Pragmas for the AS meta data scanner
656
to ensure that the template files are made part of the package.
657
Versions bumped to 1.0.4 and 1.0.1 respectively.</p></li>
660
<div id="section19" class="section"><h2><a name="section19">Changes for version 3.1.4</a></h2>
661
<ol class="enumerated">
662
<li><p>Bugfix in package <b class="package"><a href="critcl_class.html">critcl::class</a></b>. Generate a dummy
663
field in the class structure if the class has no class
664
variables. Without this change the structure would be empty,
665
and a number of compilers are not able to handle such a type.</p></li>
666
<li><p>Fixed a typo which broke the win64 configuration.</p></li>
667
<li><p>Fixed issue #16, a typo in the documentation of command
668
<b class="cmd"><a href="critcl_class.html">critcl::class</a></b>.</p></li>
671
<div id="section20" class="section"><h2><a name="section20">Changes for version 3.1.5</a></h2>
672
<ol class="enumerated">
673
<li><p>Fixed issue #19. Made the regular expression extracting the
674
MSVC version number more general to make it work on german
675
language systems. This may have to be revisited in the future,
676
for other Windows locales.</p></li>
677
<li><p>Fixed issue #20. Made option -tea work on windows, at least in
678
a unix emulation environment like msys/mingw.</p></li>
681
<div id="section21" class="section"><h2><a name="section21">Changes for version 3.1.6</a></h2>
682
<ol class="enumerated">
683
<li><p>Fixed issue #21. While the multi-definition of the stub-table
684
pointer variables was ok with for all the C linkers seen so far
685
C++ linkers did not like this at all. Reworked the code to
686
ensure that this set of variables is generated only once, in
687
the wrapper around all the pieces to assemble.</p></li>
688
<li><p>Fixed issue #22, the handling of the command identifier
689
arguments of <b class="cmd">critcl::ccommand</b>, <b class="cmd">critcl::cproc</b>, and
690
<b class="cmd">critcl::cdata</b>. We now properly allow any Tcl identifier
691
and generate proper internal C identifiers from them.</p>
692
<p>As part of this the signature of command <b class="cmd">critcl::name2c</b>
693
changed. The command now delivers a list of four values instead
694
of three. The new value was added at the end.</p>
695
<p>Further adapted the implementation of package
696
<b class="package"><a href="critcl_class.html">critcl::class</a></b>, a user of <b class="cmd">critcl::name2c</b>.
697
This package is now at version 1.0.6 and requires critcl 3.1.6</p>
698
<p>Lastly fixed the mis-handling of option <b class="option">-cname</b> in
699
<b class="cmd">critcl::ccommand</b>, and <b class="cmd">critcl::cproc</b>.</p></li>
700
<li><p>Fixed issue #23.</p></li>
703
<div id="section22" class="section"><h2><a name="section22">Changes for version 3.1.7</a></h2>
704
<ol class="enumerated">
705
<li><p>Fixed issue #24. Extract and unconditionally display compiler
706
warnings found in the build log. Prevents users from missing
707
warnings which, while not causing the build to fail, may
708
still indicate problems.</p></li>
709
<li><p>New feature. Output hook. All non-messaging user output is now
710
routed through the command <b class="cmd">critcl::print</b>, and users are
711
allowed to override it when using the critcl application-as-package.</p></li>
712
<li><p>New feature, by Ashok P. Nadkarni. Platform configurations can
713
inherit values from configurations defined before them.</p></li>
716
<div id="section23" class="section"><h2><a name="section23">Changes for version 3.1.8</a></h2>
717
<ol class="enumerated">
718
<li><p>Fixed issue with package indices generated for Tcl 8.4.
719
Join the list of commands with semi-colon, not newline.</p></li>
720
<li><p>Fixed issue #26 which brought up use-cases I had forgotten to
721
consider while fixing bug #21 (see critcl 3.1.6).</p></li>
724
<div id="section24" class="section"><h2><a name="section24">Changes for version 3.1.9</a></h2>
725
<ol class="enumerated">
726
<li><p>Fixed issue #27. Added missing platform definitions for
727
various alternate linux and OS X targets.</p></li>
728
<li><p>Fixed issue #28. Added missing -mXX flags for linking at the
729
linux-{32,64}-* targets.</p></li>
730
<li><p>Fixed issue #29. Replaced the use of raw "cheaders"
731
information in the processing of "cdefines" with the proper
732
include directives derived from it.</p></li>
733
<li><p>Fixed the issue behind rejected pull request #30 by Andrew
734
Shadura. Dynamically extract the stubs variable declarations
735
from the Tcl header files and generate matching variable
736
definitions for use in the package code. The generated code
737
will now be always consistent with the headers, even when
738
critcl's own copy of them is replaced by system headers.</p></li>
739
<li><p>Fixed issue #31. Accepted patch by Andrew Shadura, with
740
changes (comments), for easier integration of critcl with
741
OS package systems, replacing critcl's copies of Tcl headers
742
with their own.</p></li>
743
<li><p>Fixed issue #32. Merged pull request by Andrew Shadura.
744
Various typos in documentation and comments.</p></li>
745
<li><p>Fixed issue #33. Handle files starting with a dot better.</p></li>
748
<div id="section25" class="section"><h2><a name="section25">Authors</a></h2>
749
<p>Jean Claude Wippler, Steve Landers, Andreas Kupries</p>
751
<div id="section26" class="section"><h2><a name="section26">Bugs, Ideas, Feedback</a></h2>
752
<p>This document, and the package it describes, will undoubtedly contain
753
bugs and other problems.
754
Please report them at <a href="https://github.com/andreas-kupries/critcl/issues">https://github.com/andreas-kupries/critcl/issues</a>.
755
Ideas for enhancements you may have for either package, application,
756
and/or the documentation are also very welcome and should be reported
757
at <a href="https://github.com/andreas-kupries/critcl/issues">https://github.com/andreas-kupries/critcl/issues</a> as well.</p>
759
<div id="keywords" class="section"><h2><a name="keywords">Keywords</a></h2>
760
<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>
762
<div id="category" class="section"><h2><a name="category">Category</a></h2>
763
<p>Glueing/Embedded C code</p>
765
<div id="copyright" class="section"><h2><a name="copyright">Copyright</a></h2>
766
<p>Copyright © Jean-Claude Wippler<br>
767
Copyright © Steve Landers<br>
768
Copyright © 2011-2013 Andreas Kupries</p>