critcl::app(3tcl)
๐ NAME ๐
critcl::app โ Critcl โ Application Package Reference. That's the whole vibe of this page, bestie. And hey, this is the critcl::app(3tcl) page from C Runtime In Tcl (CriTcl), so you're in exactly the right place. ๐
โจ SYNOPSIS โจ
okay so here's the whole summoning ritual, verbatim:
package require Tcl 8.4
package require critcl::app ?3.1.18?
package require critcl ?2?
package require platform ?1.0.2?
package require cmdline
::critcl::app::main commandline
๐ฆ DESCRIPTION ๐ฆ
C Runtime In Tcl, aka CriTcl, is a whole system for compiling C code that's embedded in Tcl, on the fly โ and then either loading the resulting objects straight into Tcl so you can use them immediately, or packaging them up for distribution. Use CriTcl when you want to โจglow upโจ performance by rewriting the routines that are your bottlenecks in C. It's giving "I know a girl who can do both." ๐
This document is the reference manpage for the critcl::app package. Its intended audience is developers working on critcl's internals. These commands are not needed to simply write a Critcl script โ so if that's you, breathe, you don't need this. If you're in need of an overview of the whole system instead, please go and read the Introduction To CriTcl. ๐ซถ
This package resides in the Application Layer of CriTcl. Behold the hierarchy:
*================*
|Applications |
| critcl |
| critcl::app |
*================*
+----------------+
|Core Packages |
| critcl |
| critcl::util |
+----------------+
+----------------+
|Support Packages|
| stubs::* |
| md5, platform |
| ... |
+----------------+
โฆand it implements the functionality of the CriTcl Application, and through this, the mode generate package. The actual application is (only) a shim wrapping around this package. It itself is built on top of the core package critcl. No cap. ๐ธ
๐ฅ API ๐ฅ
The package exports exactly one single command. One. Iconic, honestly.
::critcl::app::maincommandline โ so the commandline here is a list of zero or more options, followed by zero or more Critcl script files. By default the Critcl script files get built and the results get cached. This cuts down on the time needed to load the package. The last occurrence of-pkgand-tea, if provided, selects the corresponding alternative mode of operations. For a larger set of examples please see section "Building Critcl Packages" in the document about Using CriTcl. ๐
And now, the options. Buckle up, there's a lot, and they're all getting their moment:
๐ OPTIONS ๐
The following options are understood:
-v,--versionโ prints the version tostdoutand exits. That's it, that's the whole thing. ๐-Ipath โ arranges for the compiler to search path for headers. Uses of this option are cumulative.
Ignored when generating a TEA package (see option -tea below).
-Lpath โ arranges for the linker to search path. Uses of this option are cumulative.
Ignored when generating a TEA package (see option -tea below).
-cachepath โ sets path as the directory to use as the result cache. The default is"~/.critcl/<platform>", or"~/.critcl/<pid>.<epoch>"when generating a package. See option-pkg, below. ๐
Ignored when generating a TEA package (see option -tea below).
-cleanโ arranges for all files and directories in the result cache to be deleted before compilation begins. It's giving fresh start, clean slate, no baggage.
Ignored when generating a package because this mode starts out with a unique and empty result cache. See option -pkg, below.
Ignored when generating a TEA package (see option -tea below).
-configpath โ provides a custom configuration file. By default a configuration included in the system core is used. When specified multiple times the last value is used.
Ignored when generating a TEA package (see option -tea below).
-debugmode โ activates one of the following debugging modes:memoryโ track and report memory allocations made by the Tcl core.symbolsโ compile all".c"files with debugging symbols.allโ bothmemoryandsymbols.
Ignored when generating a TEA package (see option -tea below). Uses of this option are cumulative.
-disablename โ sets the value of the custom build configuration option name to false. It is equivalent to"-with-name 0".
Validated only if one of the input files for the Critcl script actually defines and uses a custom build configuration option with that name. ๐
Ignored when generating a TEA package (see option -tea below).
-enablename โ sets the value of the custom build configuration option name to true. It is equivalent to"-with-name 1".
Validated only if one of the input files for the Critcl script actually defines and uses a custom build configuration option with that name. ๐
Ignored when generating a TEA package (see option -tea below).
-forceโ forces compilation even if a shared library for the file already exists. Unlike cleaning the cache, this is lazy in the destruction of files and only affects relevant files. Minimal effort, maximum result. โจ
Ignored when generating a package (see option -pkg, below), which starts out with a unique and empty result cache.
Ignored when generating a TEA package (see option -tea below).
-helpโ prints a short description of command line syntax and options and then exits the application. Your little helper. ๐ซถ-keepโ causes the system to cache compiled".c"files. Also prevents the deletion of the unique result cache used by the run when generating a package (see option-pkgbelow). Intended for debugging of critcl itself, where it may be necessary to inspect the generated C code. ๐
Ignored when generating a TEA package (see option -tea below).
-libdirdirectory โ adds directory to the list of directories the linker searches for libraries in (like-L). With-pkg, generated packages are saved in directory. When specified multiple times the last value is used. The default is"lib", resolved relative to the current working directory.-includedirdirectory โ adds directory to the list of directories the compiler searches for headers in. With-pkg, generated header files are saved in directory. Uses of this option are cumulative. The last value is used as the destination for generated header files. The default is the relative directory"include", resolved relative to the current working directory.
Ignored when generating a TEA package (see option -tea below).
-pkgโ generates a package from the Critcl script files. Input files are processed first as usual, but are then bundled into a single library, with additional generated files to form the library into a standard Tcl package. That's generation mode, bestie. If both options, i.e.-pkgand-teaare specified the last one specified wins. ๐
Options -clean and -force are ignored. -libdir is relevant in both this and -tea mode.
The basename of the first file is the name of the package to generate. If its file extension indicates a shared library (".so", ".sl", ".dylib", and ".dll") it is also removed from the set of input files. Each Critcl script file is kept as part of the input. A single file without a suffix is assumed to be a Critcl script. A file without a suffix, but other input files following is treated like the name of a shared library proper, and removed from the set of input files.
Examples:
... -pkg ... foo
=> Package name is: foo
=> Input file is: foo.tcl
... -pkg ... foo bar.tcl
=> Package name is: foo
=> Input file is: bar.tcl
... -pkg ... foo.tcl
=> Package name is: foo
=> Input file is: foo.tcl
... -pkg ... foo.so bar.tcl
=> Package name is: foo
=> Input file is: bar.tcl
-showโ prints the configuration of the chosen target tostdoutand then exits. Set-target, below. ๐-showallโ prints the whole chosen configuration file tostdoutand then exits. See-config, above. ๐-targetname โ overrides the default choice of build target. Only the last occurrence of this option is used. The named target must exist in the chosen configuration file. Use-targets(see below) to get a list of the acceptable targets. Use-configto select the configuration file.
Ignored when generating a TEA package (see option -tea below).
-targetsโ prints the list of all known targets from the chosen configuration file tostdoutand then exits. Use-configto select the configuration file. ๐-teaโ like-pkg, except no binaries are generated. Creates a directory hierarchy containing the Critcl script, its companion files, and a TEA-conformant build system with most of the needed support code, including copies of the critcl packages.
If both -pkg and -tea are specified the last occurrence wins. ๐
-I, -L, -clean, -force, -cache, -includedir, -enable, -disable, and -with-FOO are ignored. In contrast, the option -libdir is relevant in both this and -pkg mode.
The basename of the first file is the name of the package to generate. If its file extension indicates a shared library (".so", ".sl", ".dylib", and ".dll") it is also removed from the set of input files. Each Critcl script file is kept as part of the input. A single file without a suffix is assumed to be a Critcl script. A file without a suffix, but other input files following is treated like the name of a shared library proper, and removed from the set of input files.
Examples:
... -tea ... foo
=> Package name is: foo
=> Input file is: foo.tcl
... -tea ... foo bar.tcl
=> Package name is: foo
=> Input file is: bar.tcl
... -tea ... foo.tcl
=> Package name is: foo
=> Input file is: foo.tcl
... -tea ... foo.so bar.tcl
=> Package name is: foo
=> Input file is: bar.tcl
-with-name value โ this option sets the value of the custom build configuration option name to value.
The information is validated only if one of the ".critcl" input files actually defines and uses a custom build configuration option with that name. ๐
Ignored when generating a TEA package (see option -tea below).
๐ธ MODES OF OPERATION/USE ๐ธ
Okay so bestie, CriTcl is a multitalented icon โ she can be used in three different modes of operation, and they're called:
- Compile & Run, and
- Generate Package
- Generate TEA Package
Compile & Run was the OG mode and it's the default for critcl_pkg. What does she do? She collects the C fragments from the Critcl script, builds them as needed, and caches the results so that load times later are, like, so much better. Caching queen ๐
The second mode, Generate Package, showed up to enable the creation of (prebuilt) deliverable packages which do not depend on the existence of a build system โ meaning, no C compiler needed on the target machine. Iconic, honestly. This was originally done through the experimental Critbind tool, and now it's handled by the CriTcl Application, also named critcl. Glow up โจ
Newly introduced with Critcl version 3 is Generate TEA Package. This mode constructs a directory hierarchy from the package which can later be built like a regular TEA package, i.e. using
.../configure --prefix ...
make all isntall
(yes, isntall is exactly how it's written in the original, no cap, we do not correct the original here ๐)
๐ PACKAGE STRUCTURE ๐
Packages generated by critcl have the following basic structure:
<TOP>
+- pkgIndex.tcl
+- critcl-rt.tcl
+- license.terms (optional)
|
+- tcl (optional)
| +- <tsources files>
|
+- <platform>
+- <shared library>
โจ Notes โจ
- The file
pkgIndex.tclis the standard package index file expected by Tcl's package management. It is sourced during a search for packages, and declares the package to Tcl with its files, and how to handle them. Lowkey the whole front door of the package. - The file
critcl-rt.tclis a helper file containing the common code used bypkgIndex.tclto perform its tasks. She's the bestie in the background making it all work. - The file
license.termsis optional and only appears if the.critclfile the package is generated from used the commandcritcl::licenseto declare package author and license. ๐ซถ - All files declared with the command
critcl::tsourcesget put into the sub-directorytcl. - The shared library generated by critcl is put into a platform-specific sub-directory. Per platform, per vibe. ๐
The whole structure โ and especially that last point โ enables us to later merge the results (for the same package, and version) for multiple target platforms into a single directory structure without conflict, by simply copying the top directories over each other. The only files which can conflict are in the <TOP> and tcl directories, and for these we know that they are identical across targets. The way that works out so cleanly?? Obsessed. The result of such a merge would look like:
<TOP>
+- pkgIndex.tcl
+- critcl-rt.tcl
+- license.terms (optional)
|
+- tcl (optional)
| +- <tsources files>
|
+- <platform1>
| +- <shared library1>
+- <platform2>
| +- <shared library2>
...
+- <platformN>
+- <shared libraryN>
The latest changes are found at the top. ๐
๐ฆ CHANGES FOR VERSION 3.1.18.1 ๐ฆ
- Attention: While the overall version (of the bundle) moves to
3.1.18.1the versions of packagescritclandcritcl::appare unchanged. (Yeah, the bundle leveled up, the packages stayed exactly as they were. No glow-up for them this round.) - Bugfix Generally removed a number of 8.5-isms which slipped into
3.1.18, breaking ability to use it with Tcl 8.4. ๐ They really just wandered in uninvited. - Bugfix Corrected broken
build.tcluninstall. - Bugfix Package
critcl::classbumped to version1.1.1. Fixed partial template substitution breaking compilation of the generated code. ๐ ๏ธ
๐ CHANGES FOR VERSION 3.1.18 ๐
- Feature (Developer support). Merged pull request #96 from
sebres/main-direct-invoke. Enables direct invokation of themain.tclfile for starkits from within a dev checkout, i.e. outside of a starkit, or starpack. - Feature. Added channel types to the set of builtin argument and result types. The argument types are for simple channel access, access requiring unshared channels, and taking the channel fully into the C level, away from Tcl. The result type comes in variants for newly created channels, known channels, and to return taken channels back to Tcl. The first will register the returned value in the interpreter, the second assumes that it already is. So many flavours, all of them valid. ๐
- Bugfix. Issue #96. Reworked the documentation around the argument type
Tcl_Interp*to make its special status more visible, explain uses, and call it out from result types where its use will be necessary or at least useful. Main character type gets main character documentation energy. - Feature. Package
critcl::classbumped to version1.1. Extended with the ability to create a C API for classes, and the ability to disable the generation of the Tcl API. - Bugfix. Merged pull request #99 from
pooryorick/master. Fixes to the target directory calculations done by the install code. - Merged pull request #94 from
andreas-kupries/documentation. A larger documentation cleanup. The main work was done bypooryorick, followed by tweaks done by myself. - Extended the test suite with lots of cases based on the examples for the various generator packages. IOW the new test cases replicate/encapsulate the examples and demonstrate that the packages used by the examples generate working code. Testing era, fr fr. ๐งช
- Bugfix. Issue #95. Changed the field
critcl_bytes.stounsigned char*to match Tcl's type. Further constified the field to make clear that read-only usage is the common case for it. - Bugfix/Feature. Package
critcl::cutilbumped to version0.2. Fixed missing inclusion of headerstring.hincritcl_alloc.h, needed formemcpyin macroSTREP. Added macrosALLOC_PLUSandSTRDUP. Moved documentation ofSTREP...macros into proper place (alloc section, not assert). She finally sits where she belongs. - Merged pull request #83 from
apnadkarni/vc-fixes. Removed deprecated-Gsfor MSVC builds, and other Windows fixups. ๐ช - Feature. Package
critcl::iassocbumped to version1.1. Refactored internals to generate an include header for use by.cfiles. This now matches what other generator packages do. The template file is inlined and removed. Consistency?? We love to see it. - Merged pull request #82 from
gahr/home-symlinkModified tests to handle possibility of$HOMEa symlink. - Merged pull request #81 from
gahr/test-not-installedModified test support to find uninstalled critcl packages when running tests. Handles all butcritcl::md5. - Merged pull request #85 from
snoe925/issue-84to fix Issue #84 breaking installation on OSX. ๐ - Merged pull request #87 from
apnadkarni/tea-fixesto fix Issue #86, broken-teaoption, generating an incomplete package. - Feature. New package
critcl::callbackproviding C-level functions and data structures to manage callbacks from C to Tcl. ๐ - Feature. Package
critcl::literalsbumped to version1.3. Added mode+listenabling the conversion of multiple literals into a list of their strings. - Feature. Package
critcl::enumbumped to version1.1. Added basic mode handling, supportingtcl(default) and+list(extension enabling the conversion of multiple enum values into a list of their strings). - Feature. Package
critcl::emapbumped to version1.2. Extended existing mode handling with+listextension enabling the conversion of multiple emap values into a list of their strings. - Feature. Extended the set of available types by applying a few range restrictions to the scalar types (
int,long,wideint,double,float).
Example: int > 0 is now a viable type name.
Heads up bestie: this is actually more limited than the description might let you believe.
See the package reference for the details. ๐
โญ CHANGES FOR VERSION 3.1.17 โญ
- Extension: Allow duplicate arg- and result-type definitions if they are fully identical. (Twins are fine, doppelgรคngers are not. ๐ซถ)
- Bugfix. The application mishandled the possibility of identical-named
critcl::tsources. Possible becausecritcl::tsourcescan be in subdirectories, a structure which is not retained in the assembled package, causing such files to overwrite each other and at least one lost. Fixed by adding a serial number to the file names in the assembled package. Numbered them so nobody gets deleted, periodt. - Bugfix in the static scanner which made it loose requirement information. Further added code to generally cleanup results at the end (removal of duplicates, mainly).
- Bugfix: Fixed issue #76. Support installation directories which are not in the
auto_path. Without the patch the installed critcl will not find its own packages and fail. Thank you to Simon Bachmann [https://github.com/lupylucke] for the report and patch, and then his patience with me to getting to actually apply it. ๐ - Bugfix: Fixed issue #75. Extended
critcl::includeto now take multiple paths. - Added new compatibility package
lmap84. - Fixed typos in various documentation files. ๐
- Fixed bug introduced by commit
86f415dd30(3.1.16release). The separation ofcritcl::ccodeinto user and work layers means that location retrieval has to go one more level up to find the user location. Just one more floor up, bestie. - New supporting package
critcl::cutil. Provides common C level facilities useful to packages (assertions, tracing, memory allocation shorthands). - Modified package
critclto make use of the new tracing facilities to provide tracing of arguments and results forcritcl::ccommandandcritcl::cprocinvokations. - Modified packages
critclandcritcl::classto provide better function names for (class) method tracing. Bumped packagecritcl::classto version1.0.7. - Extended the support package
critcl::literalswith limited configurability. It is now able to generate code for C-level access to the pool without Tcl types (Modec). The previously existing functionality is accesssible under modetcl, which also is the default. Both modes can be used together. โจ - Extended the support package
critcl::emapwith limited configurability. It is now able to generate code for C-level access to the mapping without Tcl types (Modec). The previously existing functionality is accessible under modetcl, which also is the default. Both modes can be used together. โจ
โจ CHANGES FOR VERSION 3.1.16 โจ
okay bestie, this one is stacked, buckle up ๐
- New feature. We extended
critcl::cproc's argument handling so you can now mix required and optional arguments however you want โ arbitrary mixing, no cap, slay. ๐ - New feature. Potential Incompatibility. We also extended
critcl::cproc's argument handling so that an argument namedargsgets treated as variadic if it's the last argument of the procedure. iykyk, watch out for that one ๐ซถ - New feature. Two new introspection commands dropped:
critcl::hasargtypeandcritcl::has-resulttype. They let you test whether a specific (named) type conversion is actually implemented or not. iconic behavior honestly ๐ - New result type added:
Tcl_Obj*0, with the aliasobject0. The difference between it andTcl_Obj*is all in the reference counting. โจ - Extended the command
critcl::argtypesupportwith a new optional argument, so you can explicitly specify the identifier used for guarding against multiple definitions. - Bugfix: Fixed a problem with the implementation of issue #54 (peep 3.1.14 for that lore). Now we always create the secondary log file โ otherwise end-of-log handling can break, because it just assumes the file exists unconditionally. ๐ญ
- Bugfix: Fixed a problem with the internal change to the hook
HandleDeclAfterBuild. The forgottencritcl::cconstgot corrected. ๐ - Debugging aid: Added a comment holding the name of the result type when emitting result conversions.
- Bugfix: Fixed issue #60. Unbundled the package directories that contained multiple packages โ all directories under
lib/now contain exactly one package. periodt. ๐ - Bugfix: Fixed issue #62, where a few
dict existscommands were operating on a fixed string instead of a variable. oops ๐ญ - Bugfix: Fixed issue #56. Release builders are reminded to run the tests. (run the tests bestie, please ๐)
- Bugfix: Fixed issue #55. For FreeBSD, critcl's platform package now identifies the Kernel ABI version. Initialization of the cache directory now also uses
platform::identifyfor the default path, instead ofplatform::generic. - Bugfix: Fixed issue #58. Simplified the setup and use of md5. Critcl now makes use of its own package for md5, using itself to build it. And no, there's no chicken/egg problem here, because the
-pkgmode used for this does not use md5 โ that's limited to modecompile & run. ๐ฃ
๐ธ CHANGES FOR VERSION 3.1.15 ๐ธ
- Fixed version number bogosity with 3.1.14. (we said 3.1.14, we meant it, but the number was lying ๐)
๐ฆ CHANGES FOR VERSION 3.1.14 ๐ฆ
- Fixed issue #36. Added a message to the
alltarget of theMakefilegenerated for TEA mode. Also tweaked other parts of the output to be less noisy. ๐คซ - Accepted the request implied in issue #54. Now we unconditionally save the compiler/linker build log into the
logkey of the dictionary returned bycresults, and save a copy of only the execution output in the new keyexl("execution log"). ๐ - Fixed issue #53. Clarified the documentation of commands
critcl::loadandcritcl::failedwith regard to their results and the throwing of errors (spoiler: it does not happen). - Fixed issue #48. Modified mode
"compile & run"to allow new declarations in a file after it was built, instead of erroring out. The new decls get built when needed. Mode"precompile"is unchanged and will continue to trap that situation. โจ - Fixed issue #52. Updated the local Tcl/Tk headers to
8.4.20,8.5.13, and8.6.4. fresh headers, glowing skin ๐ - Fixed issue #45. New feature: command
critcl::cconst. critcl::util: new commandlocate, which finds a file across a set of paths and reports an error when it's not found. This is for use in autoconf-like header-searches and similar configuration tests. ๐- Modified
'AbortWhenCalledAfterBuild'to dump the entire stack (info frame!). This should make it way easier to determine the location of the troubling declaration. ๐
๐ง CHANGES FOR VERSION 3.1.13 ๐ง
- Merged PR #43. Fixed a bug loading adjunct Tcl sources.
- Fixes in documentation and generated code of package
"critcl::enum". Bumped to version1.0.1. - Fixes in documentation of package
"critcl::bitmap". - New package
"critcl::emap". In essence a variant or cross of"critcl::bitmap"with behaviour like"critcl::enum". it's giving crossover episode ๐ - Merged PR #49. Fixed a documentation typo.
- Merged PR #46. Fixed a documentation typo.
- Merged PR #47. Fixes to test results to match the accumulated code changes. Also made portable across Tcl versions (because the error syntax varies). ๐
- New predefined argument- and result-type
"wideint"mapping toTcl_WideInt. - New predefined argument-type
"bytes"mapping to a tuple of byte-array data and length. Note: the existing"bytearray"type (and its aliases) was left untouched, to keep backward compatibility. ๐ซถ - Modified the internal interface between the Tcl shim and the C function underneath
"critcl::cproc"with respect to the handling of optional arguments. An optional argument"X"now induces the use of two C arguments,"X"and"has_X". The new argument"has_X"is of boolean (int) type. It's set to true whenXis set, and set to false whenXhas the default value. C code that cares about knowing if the argument is default or not can now check that quickly, without having to code the default value inside. NOTE: this change is visible in the output of the advanced commands"argcnames","argcsignature","argvardecls", and"argconversion". ๐ - Fixed issue #50 and documented the availability of the variable
"interp"(typeTcl_Interp*) within"critcl::cinit"C code fragments. Note that while the old, undocumented name of the variable,"ip", is still usable, it is deprecated. It will be fully removed in two releases, i.e. for release 3.1.15. The variable name was changed to be consistent with other code environments. โ ๏ธ - Fixed issue #51. Disabled the generation of
#linedirectives for"critcl::config lines 0"coming from template files, or code generated with them before the final value of this setting was known. - Fixed an issue with handling of namespaced package names in
"critcl::iassoc". Equivalent to a bug in"critcl::class"fixed for critcl 3.1.1, critcl::class 1.0.1. Note:"literals","enum","emap", and"bitmap"do not require a fix, as they're all built on top of"iassoc". โจ
๐ CHANGES FOR VERSION 3.1.12 ๐
- Fixed issue 42. Clear
::errorInfoimmediately after startup to prevent leakage of irrelevant (caught) errors into our script and confusing the usage code. ๐งผ - Fixed issue 40. Keep the order of libraries, and allow duplicates. Both of these are things that are occasionally required for proper linking.
- Extended the utility package
critcl::literalsto declare a cproc result-type for a pool.
Further fixed the generated header to handle multiple inclusion.
Bumped version to 1.1.
- Fixed an issue with utility package
critcl::bitmap.
Fixed the generated header to handle multiple inclusion.
Bumped version to 1.0.1.
- Created a new utility package
critcl::enumfor the quick and easy setup and use of mappings between C values and Tcl strings. Built on top ofcritcl::literals. ๐ - Added examples demonstrating the use of the utility packages
critcl::literals,critcl::bitmap, andcritcl::enum. ๐
๐ CHANGES FOR VERSION 3.1.11 ๐
- Fixed issue #37, via pull request #38, with thanks to Jos DeCoster. Information was stored into the
v::delprocandv::clientdataarrays using a different key than when retrieving the same information, thus failing the latter. ๐ - New convenience command
critcl::includefor easy inclusion of headers and other C files. - New command
critcl::maketo generate a local header of other C files for use by other parts of a package through inclusion. - New utility package
critcl::literalsfor quick and easy setup of and access to pools of fixedTcl_Obj*strings. Built on top ofcritcl::iassoc. ๐ - New utility package
critcl::bitmapfor quick and easy setup and use of mappings between C bitsets and Tcl lists whose string elements represent that set. Built on top ofcritcl::iassoc.
๐ฅ CHANGES FOR VERSION 3.1.10 ๐ฅ
- Fixed code version numbering forgotten with 3.1.9. (the number justโฆ wasn't numbering, bestie ๐)
- Fixed issue #35. In package mode (
-pkg) the object cache directory is unique to the process, so we don't need content-hashing to generate unique file names. A simple counter is sufficient and much faster. โก
Note that mode "compile & run" is not as blessed and still uses content-hashing with md5 to ensure unique file names in its per-user object cache.
- Fixed an issue where
ccommandforgot to use its body as input for the UUID generation. Thus it was ignoring changes to the body in modecompile & run, and not rebuilding a library for changed sources. Bug and fix reported by Peter Spjuth. ๐ซถ
โญ CHANGES FOR VERSION 3.1.9 โญ
- Fixed issue #27. Added missing platform definitions for various alternate linux and OS X targets.
- Fixed issue #28. Added missing
-mXXflags for linking at thelinux-{32,64}-*targets. - Fixed issue #29. Replaced the use of raw
"cheaders"information in the processing of"cdefines"with the proper include directives derived from it. - Fixed the issue behind rejected pull request #30 by Andrew Shadura. Dynamically extract the stubs variable declarations from the Tcl header files and generate matching variable definitions for use in the package code. The generated code will now always be consistent with the headers, even when critcl's own copy of them is replaced by system headers. โจ
- Fixed issue #31. Accepted a patch by Andrew Shadura, with changes (comments), for easier integration of critcl with OS package systems, replacing critcl's copies of Tcl headers with their own.
- Fixed issue #32. Merged pull request by Andrew Shadura. Various typos in documentation and comments. (typos are not the vibe ๐)
- Fixed issue #34. Handle files starting with a dot better. ๐
๐ CHANGES FOR VERSION 3.1.8 ๐
- Fixed an issue with package indices generated for Tcl 8.4. Join the list of commands with a semi-colon, not a newline. (one tiny character, so much chaos ๐)
- Fixed issue #26, which brought up use-cases I had forgotten to consider while fixing bug #21 (see critcl 3.1.6). ๐ญ
๐ CHANGES FOR VERSION 3.1.7 ๐
- Fixed issue #24. Bestie, we now extract and unconditionally display compiler warnings found in the build log. The way this matters: it stops you from missing warnings that, even though they're not failing the build, might still be lowkey flagging actual problems. ๐
- New feature. Output hook! All non-messaging user output now gets routed through the command
critcl::print, and when you're using the critcl application-as-package you're allowed to override it. Main character energy fr fr. โจ - New feature, by Ashok P. Nadkarni. Platform configurations can inherit values from configurations defined before them. Obsessed. ๐ฆ
๐ CHANGES FOR VERSION 3.1.6 ๐
- Fixed issue #21. So the multi-definition of the stub-table pointer variables was fine with all the C linkers seen so far, but C++ linkers did not like it at all. Reworked the code so that this set of variables is generated only once, in the wrapper around all the pieces to assemble. Slay. ๐
- Fixed issue #22, the handling of the command identifier arguments of
critcl::ccommand,critcl::cproc, andcritcl::cdata. We now properly allow any Tcl identifier and generate proper internal C identifiers from them.
As part of this the signature of command critcl::name2c changed. The command now delivers a list of four values instead of three. The new value was added at the end.
Further adapted the implementation of package critcl::class, a user of critcl::name2c. This package is now at version 1.0.6 and requires critcl 3.1.6.
Lastly fixed the mis-handling of option -cname in critcl::ccommand, and critcl::cproc.
- Fixed issue #23.
๐ธ CHANGES FOR VERSION 3.1.5 ๐ธ
- Fixed issue #19. Made the regular expression extracting the MSVC version number more general so it actually works on german language systems. Ngl this may have to be revisited in the future, for other Windows locales. ๐
- Fixed issue #20. Made option
-teawork on windows, at least in a unix emulation environment likemsys/mingw. We take those. ๐
๐ฆ CHANGES FOR VERSION 3.1.4 ๐ฆ
- Bugfix in package
critcl::class. Generate a dummy field in the class structure if the class has no class variables. Without this change the structure would be empty, and a number of compilers are just not able to handle such a type. Like, at all. ๐ - Fixed a typo which broke the
win64configuration. - Fixed issue #16, a typo in the documentation of command
critcl::class.
โจ CHANGES FOR VERSION 3.1.3 โจ
- Enhancement. In detail:
- Added new argument type
"pstring", for"Pascal String", a counted string, i.e. a combination of string pointer and string length. ๐ - Added new methods
critcl::argtypesupportand::critcl::argsupportto define and use additional supporting code for an argument type, here used by"pstring"above to define the necessary structure. - Semi-bugfixes in the packages
critcl::classandcritcl::iassoc. Pragmas for the AS meta data scanner to ensure that the template files are made part of the package. Versions bumped to1.0.4and1.0.1respectively. ๐ซถ
๐ CHANGES FOR VERSION 3.1.2 ๐
- Enhancement. In detail:
- Extended
critcl::cprocto be able to handle optional arguments, in a limited way. This is automatically available tocritcl::classcproc-based methods as well. Iconic. - Bugfix in
lassignemulation for Tcl 8.4. Properly set unused variables to the empty string. Bumped version of emulation packagelassign84to1.0.1.
๐ CHANGES FOR VERSION 3.1.1 ๐
- Bugfixes all around. In detail:
- Fixed the generation of
wrong#argserrors forcritcl::cprocand derived code (critcl::classcproc-based methods). UseNULLif there are no arguments, and take the offset into account. - Fixed the handling of package names by
critcl::class. Forgot that they may contain namespace separators. ๐ญ Bumped to version1.0.1. - Extended a
critcl::classgenerated error message in instance creation for clarity. Bumped to version1.0.2.
๐ CHANGES FOR VERSION 3.1 ๐
- Added a new higher-level package
critcl::iassoc.
This package simplifies the creation of code associating data with an interpreter via Tcl's Tcl_(Get|Set)AssocData() APIs. The user can concentrate on his data while all the necessary boilerplate C code to support this is generated by the package. โจ
This package uses several of the new features which were added to the core critcl package, see below.
- Added the higher-level package
critcl::class.
This package simplifies the creation of C level objects with class and instance commands. The user can write a class definition with class- and instance-variables and -methods similar to a TclOO class, with all the necessary boilerplate C code to support this generated by the package. ๐
This package uses several of the new features which were added to the core critcl package, see below.
- Extended the API for handling TEApot metadata. Added the command
critcl::meta?to query the stored information. Main use currently envisioned is retrieval of the current package's name by utility commands, for use in constructed names. This particular information is always available due to the static scan of the package file on execution of the firstcritclcommand.
The new packages critcl::iassoc and critcl::class (see above) are users of this command.
- Extended the API with a command,
critcl::name2c, exposing the process of converting a Tcl name into base name, namespace, and C namespace. This enables higher-level code generators to generate the same type of C identifiers as critcl itself. ๐ฆ
The new package critcl::class (see above) is a user of this command.
- Extended the API with a command,
critcl::source, executing critcl commands found in a separate file in the context of the current file. This enables easier management of larger bodies of code as it allows the user to split such up into easier to digest smaller chunks without causing the generation of multiple packages. - Related to the previous item, extended the API with commands to divert collection of generated C code into memory. This makes it easier to use the commands for embedded C code in higher-level code generators.
See the section Advanced: Diversions for details of the provided commands.
The new package critcl::class (see above) is a user of these facilities.
- Extended the API with commands helping developers with the generation of proper C
#linedirectives. This allows higher-level code generators to generate and insert their own directives, ensuring that compile errors in their code are properly attributed.
See the section Advanced: Location management for details of the provided commands.
The new packages critcl::iassoc and critcl::class (see above) are users of these facilities.
- Extended the API with commands giving users the ability to define custom argument and result types for
::critcl::cproc.
See the section Advanced: Extending cproc for details of the provided commands. ๐ธ
๐ CHANGES FOR VERSION 3.0.7 ๐
- Fixed the code generated by
critcl::c++command. The emitted code handed a non-static string table toTcl_GetIndexFromObj, in violation of the contract, which requires the table to have a fixed address.
Bestie this was a memory smash waiting to happen. Like, not cute at all. ๐ Thanks to Brian Griffin for alrerting us to the general problem.
๐ CHANGES FOR VERSION 3.0.6 ๐
- Fixed github issue 10. The critcl application now delivers a proper exit code (
1) on build failure, instead of always indicating success (status0). ๐ซถ - Fixed github issue 13. Handling of
bufferoverflowU.libfor release builds was inconsistent with handling for debug builds. It is now identically handled (conditional) by both cases. - Documentation cleanup, mainly in the installation guide, and the
README.mdshown by github.
โญ CHANGES FOR VERSION 3.0.5 โญ
- Fixed bug in the new code for
#linepragmas triggered when specifying C code without leading whitespace. - Extended the documentation to have manpages for the license, source retrieval, installer, and developer's guides. โจ
๐ CHANGES FOR VERSION 3.0.4 ๐
- Fixed generation of the package's
initnamewhen the incoming code is read fromstdinand has no proper path. - Fixed github issue 11. Now using
/LIBPATHinstead of-Lon Windows (libincludeconfiguration setting). - Extended critcl to handle
-l:pathformat of-loptions. GNU ld 2.22+ handles this by searching for the path as is. Good when specifying static libraries, as plain-llooks for shared libraries in preference over static. critcl handles it now, as older GNU ld's do not understand it, nor the various vendor-specific linkers. - Fixed github issue #12. Critcl now determines the version of MSVC in use and uses it to switch between various link debug options. Simplified the handling of
bufferoverflowU.libalso, making use of the same mechanism and collapsing the two configurations sections we had back into one. - Reworked the insertion of
#linepragmas into the generated C code to avoid limitations on the line number argument imposed by various compilers, and be more accurate. ๐ - Modified argument processing. Option
-libdirnow also implies-Lfor its argument. - Extended handling of option
-show(critcl::showconfig) to list the path of the configuration file the data is coming from. Good for debugging configuration processing. - Extended the build script with targets to regenerate the embedded documentation, and diagrams, and to generate a release. ๐
๐ง CHANGES FOR VERSION 3.0.3 ๐ง
- Fixed github issues 5 and 8, for the example
build.tclscripts. Working around a missing variable::errorInfo. It should always be present, however there seem to be revisions of Tcl around which violate this assumption. ๐ญ
โจ CHANGES FOR VERSION 3.0.2 โจ
okay bestie, sit down, this is the little patch release that fixed a whole pile of stuff ๐
- Fixed a lil issue in compile-and-run mode where commands that got put into the
auto_indexwere just... not found by Tcl's[unknown]command. Rude of them tbh. Fixed now ๐ซถ - Fixed an array key mismatch that was breaking the usage of client data and delete function for procedure. Shoutout to Jos DeCoster who reported it and sent a patch โ king behaviour, we love to see it ๐
- Implemented a command line option
-Lโ it's literally the equivalent of option-I, except it's just for library search paths. Sibling energy fr fr ๐ - Fixed github issues 5 and 8. Basically we're working around a missing variable
::errorInfo. Like, that thing should always be present, that's the whole vibe, but apparently there are revisions of Tcl floating around out there that violate this assumption. Not our fault but we handled it anyway ๐ญ
๐ธ CHANGES FOR VERSION 3.0.1 ๐ธ
- Bugfixes all around. In detail (because we're thorough in this house):
- Fixed recording of Tcl version requirements. Keep package name and version together โ this unbreaks the generated meta data and the generated package load command. They were lowkey not vibing before, now they are ๐
- Fixed the build scripts: when installing, or wrapping for TEA, generate any missing directories. No more crying about folders that don't exist yet ๐
- Modified the build scripts so they properly exit the application when the window of their GUI is closed through the (X) button. You know, the way it's supposed to work. Iconic โจ
- Removed an 8.5-ism โ specifically
open wbโ which had slipped into the main build script. Sneaky little thing, caught it ๐ - Modified the example build scripts to separate the output for the different examples (and packages) by adding empty lines. Cleaner output, cleaner mind ๐ฆ
stack::cexample bugfix: Include API declarations for use in the companion files. Important, don't skip it โญ- Extended the documentation: noted the need for a working installation of a C compiler. Yeah bestie, you do actually need a C compiler, no cap ๐
- Extended the Windows target definitions and code to handle the manifest files used by modern MS development environments. Note that this code handles both possibilities โ environments using manifests, and (old(er)) environments without. Inclusive king ๐
- Extended the Windows 64bit target definitions and code to auto-detect the need for the helper library
"bufferoverflowU.lib"and reconfigure the compile and link commands appropriately. We assume that the library must be linked when present. This should be no harm if the library is present, yet not needed โ just superfluous. We search for the library in the paths specified by the environment variableLIB. That's the whole lore ๐
๐ CHANGES FOR VERSION 3 ๐
okay so this is the big one, the main character version bump, and it happened because two things became visibly incompatible. Let's get into it ๐
- The command
critcl::platformwas deprecated back in version 2.1, superceded bycritcl::targetplatform, yet kept for compatibility. Now it has been removed. Gone. Periodt ๐ - The command
critcl::compiledwas kept in version 2.1 with semantics in contradiction to its name, for compatibility. That contradiction has been removed, which changes the visible semantics of the command to be in line with its name. So it does what it says on the tin now, bestie ๐ - The change to version 3 became necessary because of the two incompatible visible changes above. That's it, that's the reason ๐
- Extended the application package with code handling a new option
-tea. Specifying this option invokes a special mode where critcl generates a TEA package, i.e. wraps the input into a directory hierarchy and support files which provide it a TEA-lookalike buildsystem.
This new option, and -pkg, exclude each other. If both are specified the last used option takes precedence.
The generated package directory hierarchy is mostly self-contained, but not fully. It requires not only a working installation of Tcl, but also working installations of the packages md5 and cmdline. Both of these are provided by the Tcllib bundle. Not required, but recommended to have installed, are any of the packages which can accelerate md5's operation, i.e. cryptkit, tcllibc, or Trf.
- Extended the critcl package with a new command
critcl::scan, taking the path to a".critcl"file, statically scanning it, and returning license, version, a list of its companion files, list of imported APIs, and list of developer-specified custom configuration options. This data is the foundation for the TEA wrapping described above.
Note that this is a static scan. While the other build modes can (must) execute the ".critcl" file and make platform-specific decisions regarding the assembled C code, companion files, etc., the TEA wrap mode is not in a position to make platform-specific decisions. It has to wrap everything which might conceivably be needed when actually building. Hence the static scan. This has however its own set of problems, namely the inability to figure out any dynamic construction of companion file paths, at least on its own. Thus:
- Extended the API used by critcl-based packages with the command
critcl::owns. While this command is ignored by the regular build modes, the static scanner described above takes its arguments as the names of companion files which have to be wrapped into the TEA package and could not be figured by the scanner otherwise โ like because of dynamic paths tocritcl::tsources,critcl::csources, getting sourced directly, or simply being adjunct datafiles. It's the "please don't forget these" command, iykyk ๐ซถ - Extended the API used by critcl-based packages with the command
critcl::apifor the management of stubs tables, be it their use, and/or declaration and export.
Please see section Stubs Table Management of the critcl package documentation for details ๐
- Extended the API used by critcl-based packages with the command
critcl::userconfigfor the management of developer-specified custom configuration options, be it their use and/or declaration.
Please see section Custom Build Configuration of the critcl package documentation for details โจ
- Extended the API used by critcl-based packages with the commands
critcl::description,critcl::summary,critcl::subject,critcl::meta, andcritcl::buildrequirementfor the declaration of TEApot meta data for/about the package.
Please see section Package Meta Data of the critcl package documentation for details ๐
โจ CHANGES FOR VERSION 2.1 โจ
okay so this is the glow-up era, bestie. buckle up, we got a whole pile of fixes ๐
- fixed a bug where
critcl::tsourceswas reading relative paths as relative to the current working directory instead of relative to the.critclfile that used the command โ literally every other command of this type does it the right way, so this one was being a little chaos gremlin ๐ - fixed internals so that info collected for multiple
.critclfiles doesn't leak between them anymore. notable side effect:critcl::tkis not a global configuration option anymore. boundaries, we love to see it ๐ซถ - fixed
critcl::licenseso it's a null-operation in mode"compile & run"instead of throwing an error. no more random tantrums โจ - fixed the critcl application interfering with the
"compile & run"result cache in-pkgmode โ it now uses a wholly separate (and by default transient) directory for that mode. separate spaces, healthy vibes ๐ - fixed a bug where changes to a
.critclfile didn't trigger a rebuild for mode"compile & run". all the relevant API commands now make sure the UUID changes, so the rebuild actually happens ๐ฅ - fixed a bug in the backend handling of
critcl::debugwhere the companion c-sources of a.critclfile weren't compiled with debug options, even though the.critclfile itself was. no more half-debugged situations ๐ญ - fixed a bug in
critcl::debugthat stopped it from recognizing mode"all"when that wasn't the first argument to the command. position matters, apparently ๐ - fixed a bug in
"preload.c"that prevented it from compiling on non-windows platforms ๐ - fixed a long-standing bug in how namespace qualifiers were handled in the command name argument of
critcl::cprocandcritcl::ccommand. you can now specify a fully qualified command name with zero issues. finally ๐ - extended/reworked
critcl::tsourcesto be the canonical way of declaring.tclcompanion files, even for mode"compile & run"โญ - extended/reworked
critcl::tsourcesso a.critclfile can be used as its own Tcl companion file ๐ - extended
critcl::frameworkto internally check for an OS X build target, and to ignore the declaration if it's not ๐ธ - extended
critcl::failedso it can be called more than once in a.critclfile. the first call forces the build (if it wasn't done already) to get the result, and any further calls just return the cached result of that first call ๐ - extended the handling of environment variable
CCin the code that figures out which compiler to use โ it now deals with (i.e. removes) paths to the compiler, compiler file extensions, and compiler options specified after the compiler itself, leaving only the bare name of the compiler โจ - extended the code that searches for preloaded libraries so it prints the paths it searched โ debugging a failed search is so much easier now ๐
- a new command
critcl::tcldeclares the version of Tcl minimally needed to build and run the.critclfile and package. defaults to8.4if you don't declare it. also extended critcl to have the stubs and headers for all of Tcl8.4,8.5, and8.6๐ฅ - a new command
critcl::loadforces the build and load of a.critclfile. this is the official way to override critcl's default lazy-build-&-load-on-demand scheme for mode"compile & run".
โ ๏ธ note that after usingcritcl::load/critcl::failedin a.critclfile, it is not possible to use critcl commands in that file anymore. doing so will throw an error. consider yourself warned, bestie ๐ณ
- extended the generation of
'#line'pragmas to useinfo frame(if available), giving the C compiler exact line numbers into the.critclfile for reporting warnings and errors ๐ - extended
critcl::checkwith logging to help debug build-time checks of the environment, plus an additional optional argument to provide labeling ๐ท๏ธ - added a new command
critcl::checklinkwhich not only checks the environment by compiling the code, but also checks its linkability ๐ - added a new command
critcl::msgfor messaging, just likecritcl::erroris for error reporting. likewise this is a hook that a user of the package is allowed to override. the default implementation, used by modecompile & run, does nothing. the implementation for modegenerate packageprints the message tostdout๐ข
the envisioned use is reporting results determined by critcl::check and critcl::checklink during building, to help with debugging when something goes wrong with a check ๐
- exposed the argument processing internals of
critcl::procfor use by advanced users. the new commands are:critcl::argnamescritcl::argcnamescritcl::argcsignaturecritcl::argvardeclscritcl::argconversion
please see section Advanced Embedded C Code of the critcl package documentation for details ๐
- extended the critcl package to intercept
package provideand record the file -> package name mapping. plus other internal changes now allow the use of namespaced package names while still using proper path names and init function ๐๏ธ - dropped the unused commands
critcl::optimizeandcritcl::include. gone, not missed ๐ - dropped
-libmode from the critcl application ๐ฎ - dropped remnants of support for Tcl
8.3and before. rip to the ancients ๐ชฆ
๐ซถ AUTHORS ๐ซถ
Jean Claude Wippler, Steve Landers, Andreas Kupries
the icons themselves, we stan ๐
๐ญ BUGS, IDEAS, FEEDBACK ๐ญ
ngl, this document and the package it describes will undoubtedly contain bugs and other problems. please report them at:
https://github.com/andreas-kupries/critcl/issues
ideas for enhancements you may have for either the package, the application, and/or the documentation are also super welcome and should be reported at that same link:
https://github.com/andreas-kupries/critcl/issues
like genuinely, tell them. they want to know ๐ฅบ
๐ KEYWORDS ๐
C code, Embedded C Code, code generator, compile & run, compiler, dynamic code generation, dynamic compilation, generate package, linker, on demand compilation, on-the-fly compilation
๐ CATEGORY ๐
Glueing/Embedded C code
๐ COPYRIGHT ๐
Copyright (c) Jean-Claude Wippler
Copyright (c) Steve Landers
Copyright (c) 2011-2018 Andreas Kupries
and that's a wrap on the whole page, bestie ๐ฆ this little beauty is critcl::app(3tcl), version 3.1.18, dated doc 3.1.18 โ slay, you read the entire thing, main character energy fr fr ๐โจ๐ธ
๐ฆ where this page comes from
- debian bookworm: critcl 3.1.18.1+dfsg-3 ยท BSD
- ubuntu jammy: critcl 3.1.18.1+dfsg-3 ยท BSD
- ubuntu noble: critcl 3.1.18.1+dfsg-3 ยท BSD
- Copyright (c) 2011-2018 Andreas Kupries
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms