critcl(1)

πŸ“¦ version 3.1.18.1, in debian bookworm, ubuntu jammy, ubuntu noble

✨ NAME ✨

critcl β€” the CriTcl Application 🫢


πŸŽ€ SYNOPSIS πŸŽ€

critcl ?option...? ?file...?

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so bestie, 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. The vibe? Use CriTcl to improve performance by rewriting in C those routines that are performance bottlenecks. speed, but make it C πŸ’…

This doc right here is the reference manpage for the critcl command. Its intended audience are people having to build packages using critcl for deployment. Writers of packages with embedded C code can ignore this document, fr fr. If you are in need of an overview of the whole system instead, please go and read the Introduction To CriTcl. πŸ¦‹

This application resides in the Application Layer of CriTcl. iykyk:

*================*
|Applications    |
| critcl         |
| critcl::app    |
*================*

+----------------+
|Core Packages   |
| critcl         |
| critcl::util   |
+----------------+

+----------------+
|Support Packages|
| stubs::*       |
| md5, platform  |
|  ...           |
+----------------+

So the application supports the following general command line, periodt:

critcl ?option...? ?file...?
  • The exact set of options supported, their meaning, and interaction is detailed in section Application Options below. For a larger set of examples please see section "Building Critcl Packages" in the document about Using CriTcl. πŸŽ€

πŸ‘‘ APPLICATION OPTIONS πŸ‘‘

The following options are understood, no cap:

  • -v, --version β€” Print the version to stdout and exit. πŸ“’
  • -I path β€” 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). πŸ™ˆ

  • -L path β€” Arranges for the linker to search path. Uses of this option are cumulative. πŸ”—

Ignored when generating a TEA package (see option -tea below). πŸ™ˆ

  • -cache path β€” 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. πŸ’€πŸ§Ή

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). πŸ™ˆ

  • -config path β€” 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). πŸ™ˆ

  • -debug mode β€” Activates one of the following debugging modes, bestie pick your fighter:
    • memory β€” Track and report memory allocations made by the Tcl core. 🧠
    • symbols β€” Compile all ".c" files with debugging symbols. πŸ”£
    • all β€” Both memory and symbols. ✨

Ignored when generating a TEA package (see option -tea below). Uses of this option are cumulative. πŸ™ˆ

  • -disable name β€” 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). πŸ™ˆ

  • -enable name β€” 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. πŸ’ͺ

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. πŸ†˜
  • -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 -pkg below), 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). πŸ™ˆ

  • -libdir directory β€” 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. πŸ“š
  • -includedir directory β€” 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. πŸ“¦βœ¨

generation. If both options, i.e. -pkg and -tea are 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, bestie:

... -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 to stdout and then exits. Set -target, below. πŸ‘€
  • -showall β€” Prints the whole chosen configuration file to stdout and then exits. See -config, above. πŸ“œ
  • -target name β€” 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 -config to 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 to stdout and then exits. Use -config to 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, again:

... -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). πŸ™ˆ

πŸŽ€ PACKAGE STRUCTURE πŸŽ€

okay bestie so when critcl builds you a package, it doesn't just dump files everywhere like some chaotic gremlin πŸ’… it follows a whole structure. here's the blueprint:

<TOP>
+- pkgIndex.tcl
+- critcl-rt.tcl
+- license.terms (optional)
|
+- tcl (optional)
|  +- <tsources files>
|
+- <platform>
   +- <shared library>

Notes πŸ“

  1. The file pkgIndex.tcl is the standard package index file that Tcl's package management expects. It gets sourced whenever Tcl goes looking for packages, and it's the thing that declares the package to Tcl, along with its files, and tells Tcl how to deal with them.
  2. The file critcl-rt.tcl is a helper file. It holds the shared code that pkgIndex.tcl uses to actually do its job.
  3. The file license.terms is optional β€” it only shows up if the .critcl file the package was generated from used the command critcl::license to declare the package author and license.
  4. Every file you declare with the command critcl::tsources gets dropped into the sub-directory tcl.
  5. The shared library that critcl generates gets put into a platform-specific sub-directory.

so why this whole layout? the entire structure β€” and especially that last point β€” is what lets you later merge the results for the same package and version across multiple target platforms into one single directory structure with zero conflict. you literally just copy the top directories over each other. the only files that could conflict live in the <TOP> and tcl directories, and for those we already know they're identical across targets. no drama πŸ’–

a merged result would look like this:

<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 πŸ’–

  1. Attention: the overall version (of the bundle) moves to 3.1.18.1, but the versions of the packages critcl and critcl::app stay exactly the same. no glow-up for them, sorry 🫢
  2. Bugfix β€” generally removed a whole bunch of 8.5-isms that had slipped into 3.1.18 and were breaking the ability to use it with Tcl 8.4. embarrassing but we fixed it πŸ’€
  3. Bugfix β€” corrected the broken build.tcl uninstall.
  4. Bugfix β€” package critcl::class bumped to version 1.1.1. Fixed partial template substitution that was breaking compilation of the generated code.

✨ CHANGES FOR VERSION 3.1.18 ✨

  1. Feature (Developer support). Merged pull request #96 from sebres/main-direct-invoke. This enables direct invocation of the main.tcl file for starkits from within a dev checkout β€” i.e. outside of a starkit, or starpack. main character energy, honestly πŸ‘‘
  2. Feature. Added channel types to the set of builtin argument and result types. The argument types cover 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 for returning taken channels back to Tcl. The first variant will register the returned value in the interpreter, the second assumes that it already is registered. πŸ”₯
  3. Bugfix. Issue #96. Reworked the documentation around the argument type Tcl_Interp* so its special status is way more visible, explained its uses, and called it out from the result types where using it will be necessary or at least useful.
  4. Feature. Package critcl::class bumped to version 1.1. Extended with the ability to create a C API for classes, plus the ability to disable the generation of the Tcl API. options, we love options πŸ’…
  5. Bugfix. Merged pull request #99 from pooryorick/master. Fixes to the target directory calculations done by the install code.
  6. Merged pull request #94 from andreas-kupries/documentation. A larger documentation cleanup. The main work was done by pooryorick, followed by tweaks done by myself.
  7. 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. test coverage slay 🧚
  8. Bugfix. Issue #95. Changed the field critcl_bytes.s to unsigned char* to match Tcl's type. Further constified the field to make clear that read-only usage is the common case for it.
  9. Bugfix/Feature. Package critcl::cutil bumped to version 0.2. Fixed missing inclusion of the header string.h in critcl_alloc.h, needed for memcpy in the macro STREP. Added the macros ALLOC_PLUS and STRDUP. Moved the documentation of the STREP... macros into its proper place (the alloc section, not assert).
  10. Merged pull request #83 from apnadkarni/vc-fixes. Removed the deprecated -Gs for MSVC builds, plus other Windows fixups.
  11. Feature. Package critcl::iassoc bumped to version 1.1. Refactored internals to generate an include header for use by .c files. This now matches what the other generator packages do. The template file is inlined and removed.
  12. Merged pull request #82 from gahr/home-symlink. Modified tests to handle the possibility of $HOME being a symlink.
  13. Merged pull request #81 from gahr/test-not-installed. Modified test support to find uninstalled critcl packages when running tests. Handles all but critcl::md5.
  14. Merged pull request #85 from snoe925/issue-84 to fix Issue #84 which was breaking installation on OSX.
  15. Merged pull request #87 from apnadkarni/tea-fixes to fix Issue #86, the broken -tea option, which was generating an incomplete package.
  16. Feature. New package critcl::callback providing C-level functions and data structures to manage callbacks from C to Tcl. πŸ¦‹
  17. Feature. Package critcl::literals bumped to version 1.3. Added mode +list enabling the conversion of multiple literals into a list of their strings.
  18. Feature. Package critcl::enum bumped to version 1.1. Added basic mode handling, supporting tcl (the default) and +list (an extension enabling the conversion of multiple enum values into a list of their strings).
  19. Feature. Package critcl::emap bumped to version 1.2. Extended the existing mode handling with the +list extension enabling the conversion of multiple emap values into a list of their strings.
  20. 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. 🀯

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 🌸

  1. Extension: Allow duplicate arg- and result-type definitions if they are fully identical. if it's a perfect match it's fine, no cap πŸ’―
  2. Bugfix. The application mishandled the possibility of identical-named critcl::tsources. This is possible because critcl::tsources can be in subdirectories β€” a structure which is not retained in the assembled package β€” causing such files to overwrite each other and at least one of them to be lost. Fixed by adding a serial number to the file names in the assembled package.
  3. Bugfix in the static scanner which made it lose requirement information. Further added code to generally cleanup results at the end (removal of duplicates, mainly).
  4. 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 fails. 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. πŸ™ˆ
  5. Bugfix: Fixed issue #75. Extended critcl::include to now take multiple paths.
  6. Added new compatibility package lmap84.
  7. Fixed typos in various documentation files.
  8. Fixed bug introduced by commit 86f415dd30 (3.1.16 release). The separation of critcl::ccode into user and work layers means that location retrieval has to go one more level up to find the user location.
  9. New supporting package critcl::cutil. Provides common C level facilities useful to packages (assertions, tracing, memory allocation shorthands).
  10. Modified package critcl to make use of the new tracing facilities to provide tracing of arguments and results for critcl::ccommand and critcl::cproc invokations.
  11. Modified packages critcl and critcl::class to provide better function names for (class) method tracing. Bumped package critcl::class to version 1.0.7.
  12. Extended the support package critcl::literals with limited configurability. It is now able to generate code for C-level access to the pool without Tcl types (Mode c). The previously existing functionality is accessible under mode tcl, which also is the default. Both modes can be used together. ✨
  13. Extended the support package critcl::emap with limited configurability. It is now able to generate code for C-level access to the mapping without Tcl types (Mode c). The previously existing functionality is accessible under mode tcl, which also is the default. Both modes can be used together.

✨ CHANGES FOR VERSION 3.1.16 ✨

  1. New feature. We extended critcl::cproc's argument handling so you can mix required and optional arguments however you want β€” no cap, any order, it just works. πŸ’…
  2. New feature. Potential Incompatibility. Also extended critcl::cproc's argument handling so that an argument named args gets treated as variadic if it's the last argument of the procedure. Okay so heads up bestie, this one can bite you if you weren't expecting it. 🫢
  3. New feature. Two brand-new introspection commands entered the chat: critcl::hasargtype and critcl::has-resulttype. They let you test whether a specific (named) type conversion is actually implemented or not. Iconic, honestly. ✨
  4. Added a new result type Tcl_Obj*0, with the alias object0. The difference between it and Tcl_Obj*? It's all in the reference counting. πŸ‘‘
  5. Extended the command critcl::argtypesupport with a new optional argument, which you use to explicitly specify the identifier for guarding against multiple definitions. Very demure, very mindful.
  6. Bugfix: Fixed a problem with the implementation of issue #54 (peep 3.1.14 for the lore). The secondary log file now always gets created β€” because otherwise end-of-log handling can break, since it unconditionally assumes the file exists. 😭
  7. Bugfix: Fixed a problem with the internal change to the hook HandleDeclAfterBuild. The forgotten critcl::cconst has been corrected. Not me forgetting it fr.
  8. Debugging aid: Added a comment holding the name of the result type whenever result conversions get emitted. Little breadcrumb trail, we love to see it. πŸ“
  9. Bugfix: Fixed issue #60. Unbundled the package directories that were containing multiple packages. All directories under "lib/" now contain exactly one package. One package per directory, periodt.
  10. Bugfix: Fixed issue #62 β€” a few dict exists commands were operating on a fixed string instead of a variable. πŸ’€
  11. Bugfix: Fixed issue #56. Release builders are reminded to run the tests. (Run. The. Tests. Bestie. 🧚)
  12. 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::identify for the default path, instead of platform::generic. ✨
  13. 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. There's no chicken/egg problem here because the -pkg mode used for this does not use md5 β€” that's limited to mode compile & run. 🐣

✨ CHANGES FOR VERSION 3.1.15 ✨

  1. Fixed version number bogosity with 3.1.14. That's it. That's the whole changelog. 😭 (Numbering was giving chaos, we cleaned it up.)

✨ CHANGES FOR VERSION 3.1.14 ✨

  1. Fixed issue #36. Added a message to the all target of the Makefile generated for TEA mode. Also tweaked other parts of the output so it's less noisy. Shhh, we're being quiet now. 🀫
  2. Accepted the request implied in issue #54. Now we unconditionally save the compiler/linker build log into the key log of the dictionary returned by cresults, and we save a copy of only the execution output in the new key exl ("execution log"). 🌸
  3. Fixed issue #53. Clarified the documentation of commands critcl::load and critcl::failed with regard to their results and the throwing of errors β€” spoiler: it does not happen. πŸ™ˆ
  4. 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 the situation. πŸ‘‘
  5. Fixed issue #52. Updated the local Tcl/Tk headers to 8.4.20, 8.5.13, and 8.6.4. Fresh headers, fresh vibes. ✨
  6. Fixed issue #45. New feature command critcl::cconst. πŸŽ€
  7. critcl::util: New command locate to find a file across a set of paths, and report an error when it's not found. This is for use in autoconf-like header-searches and similar configuration tests. iykyk. πŸ”₯
  8. Modified 'AbortWhenCalledAfterBuild' to dump the entire stack (info frame!). This should make it easier to determine the location of the troubling declaration. Get that stack trace, bestie. πŸ’…

✨ CHANGES FOR VERSION 3.1.13 ✨

  1. Merged PR #43. Fixed a bug loading adjunct Tcl sources. πŸ¦‹
  2. Fixes in the documentation and generated code of package "critcl::enum". Bumped to version 1.0.1. ✨
  3. Fixes in the documentation of package "critcl::bitmap". πŸ“
  4. New package "critcl::emap". In essence a variant or cross of "critcl::bitmap" with behaviour like "critcl::enum". It's giving hybrid. πŸ’œ
  5. Merged PR #49. Fixed a documentation typo. πŸ”
  6. Merged PR #46. Fixed a documentation typo. (Yes, another one. We love a good cleanup era.) 🌸
  7. Merged PR #47. Fixes to test results to match the accumulated code changes. Also made portable across Tcl versions (varying error syntax). Portability queen. πŸ‘‘
  8. New predefined argument- and result-type "wideint" mapping to Tcl_WideInt. πŸ¦‹
  9. 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. No breaking bestie's code over here. 🫢
  10. 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 when X is set, and set to false when X has 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". πŸ‘€
  1. Fixed issue #50 and documented the availability of the variable "interp" (type Tcl_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. RIP ip, you served us well. 😭
  2. Fixed issue #51. Disabled the generation of #line directives for "critcl::config lines 0" coming from template files, or code generated with them before the final value of this setting was known. πŸ”₯
  3. 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 are all built on top of "iassoc". πŸ’…

✨ CHANGES FOR VERSION 3.1.12 ✨

  1. Fixed issue 42. Clear ::errorInfo immediately after startup to prevent leakage of irrelevant (caught) errors into our script and confusing the usage code. No stale errors in this house. 🚫
  2. Fixed issue 40. Keep the order of libraries, and allow duplicates. Both are things that are occasionally required for proper linking. πŸ’–
  3. Extended the utility package critcl::literals to declare a cproc result-type for a pool.

Further fixed the generated header to handle multiple inclusion.

Bumped version to 1.1. ✨

  1. Fixed an issue with utility package critcl::bitmap.

Fixed the generated header to handle multiple inclusion.

Bumped version to 1.0.1. πŸŽ€

  1. Created a new utility package critcl::enum for the quick and easy setup and use of mappings between C values and Tcl strings. Built on top of critcl::literals. Slay. πŸ‘‘
  2. Added examples demonstrating the use of the utility packages critcl::literals, critcl::bitmap, and critcl::enum. Learn by doing, bestie. πŸ“š

✨ CHANGES FOR VERSION 3.1.11 ✨

  1. Fixed issue #37, via pull request #38, with thanks to Jos DeCoster. Information was stored into the v::delproc and v::clientdata arrays using a different key than when retrieving the same information, thus failing the latter. Classic key mismatch moment. 😭
  2. New convenience command critcl::include for easy inclusion of headers and other C files. πŸ¦‹
  3. New command critcl::make to generate a local header of other C files for use by other parts of a package through inclusion. ✨
  4. New utility package critcl::literals for quick and easy setup of and access to pools of fixed Tcl_Obj* strings. Built on top of critcl::iassoc. πŸ’œ
  5. New utility package critcl::bitmap for quick and easy setup and use of mappings between C bitsets and Tcl lists whose string elements represent that set. Built on top of critcl::iassoc. 🌈

✨ CHANGES FOR VERSION 3.1.10 ✨

  1. Fixed code version numbering forgotten with 3.1.9. (We forgot to bump it. It happens.) πŸ™ˆ
  2. Fixed issue #35. In package mode (-pkg) the object cache directory is unique to the process, thus we do not 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. πŸ‘‘
  1. Fixed an issue where the ccommand forgot to use its body as input for the UUID generation. Thus it was ignoring changes to it in mode compile & run, and not rebuilding a library for changed sources. Bug and fix reported by Peter Spjuth. πŸ™

✨ CHANGES FOR VERSION 3.1.9 ✨

  1. Fixed issue #27. Added missing platform definitions for various alternate linux and OS X targets. 🌍
  2. Fixed issue #28. Added missing -mXX flags for linking at the linux-{32,64}-* targets. πŸ”—
  3. Fixed issue #29. Replaced the use of raw "cheaders" information in the processing of "cdefines" with the proper include directives derived from it. πŸ’…
  4. 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. Consistency queen. πŸ‘‘
  5. 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. 🫢
  6. Fixed issue #32. Merged pull request by Andrew Shadura. Various typos in documentation and comments. πŸ”
  7. Fixed issue #34. Handle files starting with a dot better. Little dotfiles, we see you now. πŸ’€

✨ CHANGES FOR VERSION 3.1.8 ✨

  1. Fixed an issue with package indices generated for Tcl 8.4. Join the list of commands with a semi-colon, not a newline. Punctuation matters, bestie. ✨
  2. Fixed issue #26, which brought up use-cases I had forgotten to consider while fixing bug #21 (peep critcl 3.1.6 for that whole saga). 😭

✨ CHANGES FOR VERSION 3.1.7 ✨

  1. πŸ’€ Fixed issue #24. Compiler warnings found in the build log get extracted and displayed unconditionally now. Why? So nobody misses a warning that, like, doesn't actually fail the build but is still out here signaling that something is wrong. Bestie, a warning is a warning.
  2. 🌟 New feature. Output hook, hello! All non-messaging user output now gets routed through the command critcl::print, and you're allowed to override it when you're using the critcl application-as-package. The way that's customizable? Obsessed.
  3. πŸ‘‘ New feature, and it's by Ashok P. Nadkarni. Platform configurations can now inherit values from configurations defined before them. Generational. Literally.

πŸ’– CHANGES FOR VERSION 3.1.6 πŸ’–

  1. 😭 Fixed issue #21. So the multi-definition of the stub-table pointer variables was fine for every C linker seen so far, but C++ linkers were not having it, at all. Reworked the code so this set of variables is generated only once, in the wrapper around all the pieces to assemble. One job, one variable. Periodt.
  2. 🌸 Fixed issue #22 β€” the handling of the command identifier arguments of critcl::ccommand, critcl::cproc, and critcl::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.

  1. 🫢 Fixed issue #23.

πŸ¦‹ CHANGES FOR VERSION 3.1.5 πŸ¦‹

  1. πŸ” Fixed issue #19. Made the regular expression extracting the MSVC version number more general so it actually works on German language systems. And, ngl, this may have to be revisited in the future, for other Windows locales.
  2. πŸ“ Fixed issue #20. Made option -tea work on Windows β€” at least in a unix emulation environment like msys/mingw.

πŸŽ€ CHANGES FOR VERSION 3.1.4 πŸŽ€

  1. πŸ› 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 literally not able to handle such a type. Empty struct? No thoughts, head empty, won't compile.
  2. ✨ Fixed a typo which broke the win64 configuration.
  3. πŸ“– Fixed issue #16, a typo in the documentation of command critcl::class.

🌈 CHANGES FOR VERSION 3.1.3 🌈

  1. πŸ’… Enhancement. In detail:
  2. 🧡 Added new argument type "pstring", for "Pascal String" β€” a counted string, i.e. a combination of string pointer and string length.
  3. πŸ› οΈ Added new methods critcl::argtypesupport and ::critcl::argsupport to define and use additional supporting code for an argument type, here used by "pstring" above to define the necessary structure.
  4. 🩹 Semi-bugfixes in the packages critcl::class and critcl::iassoc. Pragmas for the AS meta data scanner to ensure that the template files are made part of the package. Versions bumped to 1.0.4 and 1.0.1 respectively.

⭐ CHANGES FOR VERSION 3.1.2 ⭐

  1. πŸ’… Enhancement. In detail:
  2. 🎁 Extended critcl::cproc to be able to handle optional arguments, in a limited way. This is automatically available to critcl::class cproc-based methods as well.
  3. πŸ› Bugfix in the lassign emulation for Tcl 8.4. Properly set unused variables to the empty string. Bumped version of emulation package lassign84 to 1.0.1.

πŸ’œ CHANGES FOR VERSION 3.1.1 πŸ’œ

  1. 🩹 Bugfixes all around. In detail:
  2. πŸ”§ Fixed the generation of wrong#args errors for critcl::cproc and derived code (critcl::class cproc-based methods). Use NULL if there are no arguments, and take the offset into account.
  3. πŸ“¦ Fixed the handling of package names by critcl::class. Forgot that they may contain namespace separators. Bumped to version 1.0.1.
  4. πŸ’¬ Extended a critcl::class generated error message in instance creation for clarity. Bumped to version 1.0.2.

πŸ‘‘ CHANGES FOR VERSION 3.1 πŸ‘‘

  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. You get to concentrate on your data while all the necessary boilerplate C code to support this is generated by the package. Iconic behaviour, honestly.

This package uses several of the new features which were added to the core critcl package, see below.

  1. 🌟 Added the higher-level package critcl::class.

This package simplifies the creation of C level objects with class and instance commands. You 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.

  1. πŸ” 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 first critcl command.

The new packages critcl::iassoc and critcl::class (see above) are users of this command.

  1. 🧠 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.

  1. πŸ“‚ 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, since it lets you split such up into easier to digest smaller chunks without causing the generation of multiple packages.
  2. πŸ”€ 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.

  1. πŸ“ Extended the API with commands helping developers with the generation of proper C #line directives. 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.

  1. 🧩 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 🧚

  1. πŸ’€ Fixed the code generated by critcl::c++command. The emitted code handed a non-static string table to Tcl_GetIndexFromObj, in violation of the contract, which requires the table to have a fixed address. This was a memory smash waiting to happen. Thanks to Brian Griffin for alrerting us to the general problem.
🚨 Not me emphasizing this one: a non-static table passed where a fixed address is required is genuinely undefined-behaviour territory. Say it with me β€” fixed address, or it's over.

🫢 CHANGES FOR VERSION 3.0.6 🫢

  1. βœ… Fixed github issue 10. The critcl application now delivers a proper exit code (1) on build failure, instead of always indicating success (status 0). Imagine failing and reporting success, the audacity.
  2. πŸ” Fixed github issue 13. Handling of bufferoverflowU.lib for release builds was inconsistent with handling for debug builds. It is now identically handled (conditional) by both cases.
  3. 🧹 Documentation cleanup, mainly in the installation guide, and the README.md shown by github.

🌸 CHANGES FOR VERSION 3.0.5 🌸

  1. πŸ› Fixed bug in the new code for #line pragmas triggered when specifying C code without leading whitespace.
  2. πŸ“š Extended the documentation to have manpages for the license, source retrieval, installer, and developer's guides.

✨ CHANGES FOR VERSION 3.0.4 ✨

  1. πŸ”§ Fixed generation of the package's initname when the incoming code is read from stdin and has no proper path.
  2. πŸͺŸ Fixed github issue 11. Now using /LIBPATH instead of -L on Windows (libinclude configuration setting).
  3. πŸ”— Extended critcl to handle -l:path format of -l options. GNU ld 2.22+ handles this by searching for the path as is. Good when specifying static libraries, as plain -l looks 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.
  4. 🧠 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.lib also, making use of the same mechanism and collapsing the two configurations sections we had back into one.
  5. πŸ“ Reworked the insertion of #line pragmas into the generated C code to avoid limitations on the line number argument imposed by various compilers, and be more accurate.
  6. πŸ› οΈ Modified argument processing. Option -libdir now also implies -L for its argument.
  7. πŸ” 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.
  8. πŸ“¦ Extended the build script with targets to regenerate the embedded documentation, and diagrams, and to generate a release.

🌟 CHANGES FOR VERSION 3.0.3 🌟

  1. 🩹 Fixed github issues 5 and 8, for the example build.tcl scripts. Working around a missing variable ::errorInfo. It should always be present, however there seem to be revisions of Tcl around which violate this assumption.
πŸ’­ Bestie, that variable should always exist. The way that it sometimes just doesn't? Rude. Anyway, worked around, moving on.

πŸ’– CHANGES FOR VERSION 3.0.2 πŸ’–

  • [1] fixed a lil issue in compile-and-run mode where commands dropped into the auto_index were just... not being found by Tcl's [unknown] command?? rude. fixed now bestie. ✨
  • [2] fixed an array key mismatch that was breaking usage of client data and the delete function for procedure. reported by Jos DeCoster, with a patch and everything. king behaviour tbh. πŸ‘‘
  • [3] implemented a command line option -L β€” it's literally the equivalent of option -I, except it's for library search paths. same energy, different department. πŸ’…
  • [4] fixed github issues 5 and 8. we're working around a missing variable ::errorInfo β€” which like, should always be present, but apparently there are revisions of Tcl out there that violate that assumption. not us being dramatic, just being safe. 😭

🌸 CHANGES FOR VERSION 3.0.1 🌸

  • [1] bugfixes all around. in detail:
  • [2] fixed the recording of Tcl version requirements. package name and version now stay together, which un-breaks the generated meta data and the generated package load command. they were going through a situationship, now they're official. 🫢
  • [3] fixed the build scripts: when installing, or wrapping for TEA, generate any missing directories. no more crying over directories that don't exist yet.
  • [4] modified the build scripts so they properly exit the application when the window of their GUI is closed through the (X) button. yes bestie, clicking X should close it. revolutionary, i know. πŸ’€
  • [5] removed an 8.5-ism (open wb) which had slipped into the main build script. it was not invited and it has been escorted out. πŸšͺ
  • [6] modified the example build scripts to separate the output for the different examples (and packages) by adding empty lines. breathing room. aesthetic. iconic. 🌈
  • [7] stack::c example bugfix: include API declarations for use in the companion files.
  • [8] extended the documentation: noted the need for a working installation of a C compiler. (yes. you need a C compiler. for the C. shocking, i know. πŸ™ˆ)
  • [9] 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 the (old(er)) environments without. versatile. multitalented. main character. ✨
  • [10] 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 variable LIB.

πŸ‘‘ CHANGES FOR VERSION 3 πŸ‘‘

  • [1] the command critcl::platform was deprecated back in version 2.1, superceded by critcl::targetplatform, but it was kept around for compatibility. now? it has been removed. gone. no cap. πŸ’…
  • [2] the command critcl::compiled was kept in version 2.1 with semantics in contradiction to its name, for compatibility. that contradiction has been removed, changing the visible semantics of the command to be in line with its name. it finally knows who it is. self-discovery arc complete. πŸ¦‹
  • [3] the change to version 3 became necessary because of the two incompatible visible changes above. yeah. that's the reason. two glow-ups, one version bump. periodt.
  • [4] 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. ✨

  • [5] 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: πŸ‘‡

  • [6] 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 to critcl::tsources, critcl::csources, getting sourced directly, or simply being adjunct datafiles.
  • [7] extended the API used by critcl-based packages with the command critcl::api for 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. πŸ“š

  • [8] extended the API used by critcl-based packages with the command critcl::userconfig for 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. πŸŽ€

  • [9] extended the API used by critcl-based packages with the commands critcl::description, critcl::summary, critcl::subject, critcl::meta, and critcl::buildrequirement for 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 bestie this one is a BIG glow-up, like the whole era where critcl got its life together πŸ’– here's the tea, item by item, no skips:

  1. fixed a bug where critcl::tsources was being weird and reading relative paths as relative to the current working directory, instead of relative to the .critcl file that used the command β€” which, like, every other command of this type does. embarrassing behavior honestly, glad it's gone 🫢
  2. fixed the internals so info collected for multiple .critcl files doesn't leak between them. big one: critcl::tk is not a global configuration option anymore. no cap. πŸ”₯
  3. fixed critcl::license so it's a null-operation in mode "compile & run" instead of throwing an error at you for no reason. rude before, chill now πŸ’…
  4. fixed the critcl application messing with the "compile & run" result cache in -pkg mode, by making it use a wholly separate (and by default transient) directory for that mode. separate vibes, separate dirs ✨
  5. fixed a bug where changes to a .critcl file did not trigger a rebuild in mode "compile & run". all the relevant API commands now make sure UUID changes happen. rebuilds are back, we ate πŸ’€
  6. fixed a bug in the backend handling of critcl::debug where the companion c-sources of a .critcl file weren't compiled with debug options, even though the .critcl file itself was. like hello?? inconsistency πŸ’€
  7. fixed a bug in critcl::debug that stopped it from recognizing mode "all" when "all" wasn't the first argument to the command. order shouldn't matter bestie 😭
  8. fixed a bug in "preload.c" that was stopping it from compiling on non-windows platforms. oops 🫠
  9. fixed a long-standing bug in how namespace qualifiers were handled in the command name argument of critcl::cproc and critcl::ccommand. so now you can specify a fully qualified command name with zero issues. iconic πŸ‘‘
  10. extended/reworked critcl::tsources to be the canonical way of declaring .tcl companion files, even for mode "compile & run". main character energy fr fr 🌟
  11. extended/reworked critcl::tsources to allow using a .critcl file as its own Tcl companion file. yes really πŸŒ€
  12. extended critcl::framework to internally check for an OS X build target, and to just ignore the declaration if it isn't one. not our business then πŸ’…
  13. extended critcl::failed so it can be called more than once inside a .critcl file. the first call forces the build (if it wasn't done already) to get the result; any further calls just return the cached result from that first call. consistency queen πŸŽ€
  14. extended the handling of the environment variable CC in 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. stripped down to the essentials ✨
  15. extended the code that handles searching for preloaded libraries so it prints the paths it searched, which makes debugging a search failure way easier. transparency slay πŸ”
  16. a new command critcl::tcl can be used to declare the version of Tcl minimally needed to build and run the .critcl file and package. defaults to 8.4 if you don't declare it. also extended critcl to have the stubs and headers for all of Tcl 8.4, 8.5, and 8.6. glow up 🌈
  17. a new command critcl::load forces the build and load of a .critcl file. this is the official way to override critcl's default lazy-build-&-load-on-demand scheme for mode "compile & run". boss move πŸ’ͺ
heads up though: after using critcl::load / critcl::failed in a .critcl file, you cannot use critcl commands in that file anymore. trying it will throw an error. that's the deal, bestie 😭
  1. extended the generation of '#line' pragmas to use info frame (if it's available) to give the C compiler exact line numbers into the .critcl file, for the reporting of warnings and errors. pinpoint accuracy, we love 🎯
  2. extended critcl::check with logging to help with debugging build-time checks of the environment, plus an additional optional argument to provide labeling. observability queen πŸ‘‘
  3. added a new command critcl::checklink which doesn't just try to check the environment by compiling the code β€” it also checks its linkability. full picture πŸ”—
  4. added a new command critcl::msg for messaging, the same way critcl::error is for error reporting. likewise, this is a hook that a user of the package is allowed to override. the default implementation, used by mode compile & run, does nothing at all. the implementation for mode generate package prints the message to stdout.

the envisioned use is reporting results determined by critcl::check and critcl::checklink during building, to help with debugging when a check goes wrong πŸ›

  1. exposed the argument processing internals of critcl::proc for advanced users to use. the new commands are:
    1. critcl::argnames
    2. critcl::argcnames
    3. critcl::argcsignature
    4. critcl::argvardecls
    5. critcl::argconversion

please see section Advanced Embedded C Code of the critcl package documentation for details 🧚

  1. extended the critcl package to intercept package provide and 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. yes chef πŸ‘©β€πŸ³
  2. dropped the unused commands critcl::optimize and critcl::include. bye, you will not be missed πŸ’€
  3. dropped -lib mode from the critcl application. gone girl 🫑
  4. dropped remnants of support for Tcl 8.3 and before. ancient history, archive it πŸ“¦

πŸ‘‘ AUTHORS πŸ‘‘

Jean Claude Wippler, Steve Landers, Andreas Kupries

the founding mothers of this whole operation, honestly 🫢


πŸ› BUGS, IDEAS, FEEDBACK πŸ’Œ

this document, and the package it describes, will undoubtedly contain bugs and other problems. like, obviously, it's software bestie 😭 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 very welcome and should be reported at https://github.com/andreas-kupries/critcl/issues as well. come through, we want your thoughts πŸ’–


πŸ”‘ 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

iykyk ✨


πŸ—‚οΈ CATEGORY πŸ—‚οΈ

Glueing/Embedded C code


Copyright (c) Jean-Claude Wippler
Copyright (c) Steve Landers
Copyright (c) 2011-2018 Andreas Kupries

and that's a wrap on critcl(1), bestie πŸŽ€ this whole page is from the doc source, version 3.1.18, dated critcl(1) β€” go build something iconic with it, ok? slay, periodt πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from