critcl_introduction(3tcl)
π¦ critcl_introduction β Introduction To CriTcl π¦
okay bestie, welcome to critcl_introduction(3tcl), aka the glow-up tour of C Runtime In Tcl (we call it CriTcl around here π
). this is part one of the whole saga and we're gonna get you β¨orientedβ¨.
π NAME π
critcl_introduction β Introduction To CriTcl. that's it, that's the name, she's iconic and she knows it π
πΈ DESCRIPTION πΈ
C Runtime In Tcl, or just CriTcl, is a whole system for compiling C code that's embedded inside Tcl β on the fly, no big deal π β and then either loading the resulting objects straight into Tcl for immediate use, or packaging them up for distribution. you use CriTcl when you want more speed: take those routines that are your performance bottlenecks and rewrite them in C. slay.
CriTcl started life as an experiment by Jean-Claude Wippler, and it was a self-contained Tcl package that built C code into a Tcl/Tk extension on the fly. it was kinda inspired by Brian Ingerson's Inline for Perl, but honestly? CriTcl is considerably more lightweight. π
she's for that last 5% to 10% β you know, the part where pure Tcl (which does go a long way, respect) just isn't sufficient anymore. I.e. for:
- when the last bits of performance are needed,
- access to 3rd party libraries,
- hiding critical pieces of your library or application, and
- simply needing features provided only by C.
the sections coming up first point you at a few related documents which may or may not be your vibe, depending on whether you're just a plain user of the system, trying to get it and build/install it, or going deep into the internals for either edification or modification. π
after that comes an intro to the modes of operation the system supports, plus its general architecture as seen by a user. buckle up. π
π RELATED DOCUMENTS π
- Critcl - License.
- Using Critcl
- Critcl - How To Get The Sources.
- Critcl - The Installer's Guide.
- Critcl - Application Package Reference
- Critcl - Package Reference
- Critcl - The Developer's Guide.
ποΈ MODES OF OPERATION/USE ποΈ
CriTcl can be used in three different modes of operation, called:
- Compile & Run, and
- Generate Package
- Generate TEA Package
Compile & Run was the original mode and is the default for critcl_pkg. it collects the C fragments from the Critcl script, builds them as needed, and caches the results so later load times are faster. lowkey efficient of her. β¨
the second mode, Generate Package, was introduced so you could create (prebuilt) deliverable packages that don't depend on a build system existing on the target machine β i.e. no C compiler required over there. this was originally done through the experimental Critbind tool, and is now handled by the CriTcl Application, also named critcl.
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 bestie, that says isntall β that's what the page says, I'm not touching it, it's part of the lore π«Ά
ποΈ SYSTEM ARCHITECTURE ποΈ
the system consists of two main layers, as seen in the figure below, plus a support layer containing general packages the system uses during operation.
+----------------+
|Applications |
| critcl |
| critcl::app |
+----------------+
+----------------+
|Core Packages |
| critcl |
| critcl::util |
+----------------+
+----------------+
|Support Packages|
| stubs::* |
| md5, platform |
| ... |
+----------------+
- at the top we have an application built on top of the core packages, providing command line access to the second and third usage modes, i.e. Generate Package and Generate TEA Package.
critclcritcl::app
- below that is the core package providing the essential functionality of the system, plus various utility packages which make common tasks more convenient.
critclcritcl::util
- lastly a layer of supporting packages, mostly external to critcl.
md5β for this pure-Tcl package to be fast, users should get one of several possible accelerator packages:tcllibcTrfmd5c
cmdlineplatformstubs::containerstubs::readerstubs::writerstubs::genstubs::gen::initstubs::gen::headerstubs::gen::declstubs::gen::macrostubs::gen::slotstubs::gen::lib
π EXAMPLES π
the sources of Critcl β assuming you got them β contain several larger examples showing off various aspects of the system. these demonstration packages can all be found in the sub-directory examples/ of the sources.
lots of smaller examples can be found in the document Using CriTcl, an introduction to Critcl by way of a whole bunch of examples. those focus more on specific critcl commands than the overall picture the large examples in the previous paragraph show you. π«Ά
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.1, the versions of packagescritclandcritcl::appare unchanged. - Bugfix Generally removed a number of 8.5-isms which slipped into 3.1.18, breaking ability to use it with Tcl 8.4.
- 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 the"main.tcl"file 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.
- 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. - 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.
- 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 header"string.h"in"critcl_alloc.h", needed formemcpyin macroSTREP. Added macrosALLOC_PLUSandSTRDUP. Moved documentation ofSTREP... macros into proper place (alloc section, not assert). - 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. - 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 > 0is now a viable type name. - This is actually more limited than the description might let you believe.
- See the package reference for the details.
- Example:
β¨ CHANGES FOR VERSION 3.1.17 β¨
bestie this release was booking, she did a little bit of everything π
- Extension β duplicate arg-type and result-type definitions are now allowed, as long as they are fully identical. identical or bust, no in-between.
- Bugfix. The application was mishandling the possibility of
critcl::tsourcesthat share the same name. Which is a whole situation, becausecritcl::tsourcescan live in subdirectories, and that structure is not retained in the assembled package β so those files would overwrite each other and at least one would be gone π. Fixed by adding a serial number to the file names in the assembled package. - Bugfix in the static scanner, which was making it lose requirement information. Also added code to generally clean up results at the end (removing duplicates, mainly).
- Bugfix: Fixed issue #76. Support installation directories that are not in the
auto_path. Without the patch, the installed critcl will not find its own packages and will 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. (classic.)
- Fixed bug introduced by commit
86f415dd30(the 3.1.16 release). The separation ofcritcl::ccodeinto user and work layers means that location retrieval has to go one more level up to find the user location. - 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, providing 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 accessible 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 π¦
- New feature. Extended
critcl::cproc's argument handling to allow arbitrary mixing of required and optional arguments. go off. - New feature. Potential Incompatibility.
Extended critcl::cproc's argument handling to treat an argument args as variadic if it is the last argument of the procedure.
- New feature. Added two introspection commands,
critcl::has-argtypeandcritcl::has-resulttype. These enable a user to test if a specific (named) type conversion is implemented or not. - Added new result type
Tcl_Obj*0, with aliasobject0. The difference toTcl_Obj*is in the reference counting. - Extended the command
critcl::argtypesupportwith a new optional argument through which to explicitly specify the identifier for guarding against multiple definitions. - Bugfix: Fixed problem with the implementation of issue #54 (See 3.1.14). Always create the secondary log file. Otherwise end-of-log handling may break, unconditionally assuming its existence.
- Bugfix: Fixed problem with the internal change to the hook
HandleDeclAfterBuild. Corrected the forgottencritcl::cconst. - Debugging aid: Added comment holding the name of the result type when emitting result conversions.
- Bugfix: Fixed issue #60. Unbundled the package directories containing multiple packages. All directories under
lib/now contain exactly one package. - Bugfix: Fixed issue #62, a few
dict existscommands operating on a fixed string instead of a variable. - Bugfix: Fixed issue #56. Release builders are reminded to run the tests π.
- 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 formd5, using itself to built it. There is no chicken/egg problem with this, as the-pkgmode used for this does not usemd5. That is limited to mode compile & run.
π CHANGES FOR VERSION 3.1.15 π
- Fixed version number bogosity with 3.1.14. (she simply. had the wrong number. iconic behavior honestly.)
πΈ CHANGES FOR VERSION 3.1.14 πΈ
- Fixed issue #36. Added message to target
allof the Makefile generated for TEA mode. Additionally tweaked other parts of the output to be less noisy. - Accepted request implied in issue #54. Unconditionally save the compiler/linker build log into key
logof 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 (does not happen). - Fixed issue #48. Modified mode "compile & run" to allow new declarations in a file, after it was build, instead of erroring out. The new decls are build when needed. Mode "precompile" is unchanged and will continue to trap the situation.
- Fixed issue #52. Updated the local Tcl/Tk headers to
8.4.20,8.5.13, and8.6.4. - Fixed issue #45. New feature command
critcl::cconst. critcl::util: New commandlocateto find a file across a set of paths, and report an error when not found. This is for use in autoconf-like header-searches and similar configuration tests.- Modified
AbortWhenCalledAfterBuildto dump the entire stack (info frame!). This should make it easier to determine the location of the troubling declaration.
π CHANGES FOR VERSION 3.1.13 π
- Merged PR #43. Fixed 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". - Merged PR #49. Fixed documentation typo.
- Merged PR #46. Fixed documentation typo.
- Merged PR #47. Fixes to test results to match the accumulated code changes. Also made portable across Tcl versions (varying error syntax).
- New predefined argument- and result-type
"wideint"mapping toTcl_WideInt. - New predefined argument-type
"bytes"mapping to 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 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 is set to true whenXis set, and set to false whenXhas the default value. C code which cares about knowing if the argument is default or not is now able to 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 variable
"interp"(typeTcl_Interp*) within"critcl::cinit"C code fragments.
Note: 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 release3.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 issue with handling of namespaced package names in
"critcl::iassoc". Equivalent to a bug in"critcl::class"fixed for critcl3.1.1,critcl::class1.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 β
- 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 are things which are occasionally required for proper linking.
- Extended the utility package
critcl::literalsto declare acprocresult-type for a pool.
Further fixed the generated header to handle multiple inclusion.
Bumped version to 1.1.
- Fixed issue with utility package
critcl::bitmap.
Fixed the generated header to handle multiple inclusion.
Bumped version to 1.0.1.
- Created 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 β¨
- [1] β Fixed issue #37, via pull request #38, big thanks to Jos DeCoster π. The tea is that info was being stored into the
v::delprocandv::clientdataarrays using a different key than the one used when getting that same info back β so of course the retrieval just... failed. Not the vibe. Fixed now. π«Ά - [2] β New convenience command
critcl::include, for easy inclusion of headers and other C files. Chef's kiss, so convenient. β¨ - [3] β New command
critcl::make, which generates a local header of other C files so that other parts of a package can use them through inclusion. iykyk π - [4] β New utility package
critcl::literals, for quick and easy setup of and access to pools of fixedTcl_Obj*strings. Built on top ofcritcl::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. Also built on top ofcritcl::iassoc. π
β¨ CHANGES FOR VERSION 3.1.10 β¨
- [1] β Fixed the code version numbering, which had been straight up forgotten back in 3.1.9. Not me forgetting to bump the number π.
- [2] β Fixed issue #35. In package mode (
-pkg), the object cache directory is unique to the process, so bestie, we genuinely do not need content-hashing to generate unique file names. A simple counter is enough and it's much faster. πββοΈπ¨
Heads up though: mode "compile & run" is not as blessed, and it still uses content-hashing with md5 to make sure the file names in its per-user object cache are unique. No shortcuts there.
- [3] β Fixed an issue where the
ccommandforgot to use its body as input for the UUID generation. That meant changes to it were being ignored in mode compile & run, and libraries were not rebuilt for changed sources. Bug and fix both reported by Peter Spjuth. π caught in 4k.
β¨ CHANGES FOR VERSION 3.1.9 β¨
- [1] β Fixed issue #27. Added the missing platform definitions for various alternate
linuxandOS Xtargets. π - [2] β Fixed issue #28. Added the missing
-mXXflags for linking at thelinux-{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. Slay. π - [4] β Fixed the issue behind the rejected pull request #30 by Andrew Shadura. Now it dynamically extracts the
stubsvariable declarations from the Tcl header files and generates 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. Obsessed with this consistency. β¨ - [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 a pull request by Andrew Shadura covering various typos in documentation and comments. The typo sweep, iconic. π§Ή
- [7] β Fixed issue #34. Files starting with a dot are now handled better. π΅οΈββοΈ
β¨ 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. Periodt. βοΈ
- [2] β Fixed issue #26, which brought up use-cases that had been forgotten while fixing bug #21 (see critcl 3.1.6). π
β¨ CHANGES FOR VERSION 3.1.7 β¨
- [1] β Fixed issue #24. Compiler warnings found in the build log are now extracted and displayed unconditionally. This stops users from missing warnings which, while they don't cause the build to fail, may still indicate real problems. π
- [2] β New feature: output hook. All non-messaging user output is now routed through the command
critcl::print, and users are allowed to override it when using the critcl application-as-package. π - [3] β New feature, by Ashok P. Nadkarni. Platform configurations can inherit values from configurations defined before them. Family tree but make it config. π³
β¨ CHANGES FOR VERSION 3.1.6 β¨
- [1] β Fixed issue #21. While the multi-definition of the stub-table pointer variables was ok with all the C linkers seen so far, C++ linkers did not like this at all π. Reworked the code to ensure that this set of variables is generated only once, in the wrapper around all the pieces to assemble.
- [2] β 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 the 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. π
- [3] β 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 works on german language systems. Note that this may have to be revisited in the future, for other Windows locales. π
- [2] β Fixed issue #20. Made option
-teawork on windows, at least in a unix emulation environment likemsys/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 simply not able to handle such a type. π - [2] β Fixed a typo which broke the
win64configuration. πͺ - [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::argtypesupportand::critcl::argsupportto 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::classandcritcl::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::cprocto be able to handle optional arguments, in a limited way. This is automatically available tocritcl::classcproc-based methods as well. π - [3] β Bugfix in
lassignemulation for Tcl 8.4. Properly set unused variables to the empty string. Bumped version of emulation packagelassign84to 1.0.1. π§Ή
β¨ CHANGES FOR VERSION 3.1.1 β¨
- [1] β Bugfixes all around. In detail:
- [2] β 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. π― - [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::classgenerated 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. 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.
- [2] β 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.
- [3] β Extended the API for handling TEApot metadata. Added the command
critcl::meta?to query the stored information. The 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.
- [4] β 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.
- [5] β 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. π° - [6] β 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.
- [7] β 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.
- [8] β 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 was out here handing a non-static string table toTcl_GetIndexFromObj, which is a whole contract violation bestie π β that function requires the table to have a fixed address. This was literally a memory smash waiting to happen. Thanks to Brian Griffin for alerting 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). no more lying to your CI, periodt π - 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. the docs ate, honestly π
π CHANGES FOR VERSION 3.0.4 π
- Fixed generation of the package's
initnamewhen the incoming code is read from stdin and 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. lowkey a lifesaver for figuring out where your config is actually coming from π - 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 π
- Fixed issue in compile-and-run mode where commands put into the
auto_indexare not found by Tcl's[unknown]command. - Fixed an array key mismatch breaking usage of client data and delete function for procedure. Reported by Jos DeCoster, with patch. ty for the patch bestie π«Ά
- Implemented a command line option
-L, an equivalent of option-I, just for library search paths. - Fixed github issues 5 and 8. 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.1 π
- Bugfixes all around. In detail:
- Fixed recording of Tcl version requirements. Keep package name and version together, unbreaking generated meta data and generated package load command.
- Fixed the build scripts: When installing, or wrapping for TEA, generate any missing directories.
- Modified the build scripts to properly exit the application when the window of their GUI is closed through the (X) button.
- Removed an 8.5-ism (
open wb) which had slipped into the main build script. - Modified the example build scripts to separate the output for the different examples (and packages) by adding empty lines.
stack::cexample bugfix: Include API declarations for use in the companion files.- Extended the documentation: Noted the need for a working installation of a C compiler. yeah you genuinely cannot skip this one π
- 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, environment using manifests, and (old(er)) environments without.
- 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.
π CHANGES FOR VERSION 3 π
- The command
critcl::platformwas deprecated in version 2.1, superceded bycritcl::targetplatform, yet kept for compatibility. Now it has been removed. gone, girl π - The command
critcl::compiledwas kept with in version 2.1 with semantics in contradiction to its, for compatibility. This contradiction has been removed, changing the visible semantics of the command to be in line with its name. - The change to version 3 became necessary because of the two incompatible visible changes above.
- 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 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::scantaking 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. - 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 one is a whole era, bestie β like, the glow-up was real. Twenty-six things got fixed, extended, added, or yeeted, and we're going through every single one, no skipping. π
- [1] β Fixed a bug where
critcl::tsourceswas interpreting relative paths as relative to the current working directory instead of relative to the.critclfile that used the command. Which, btw, is what every other command of this type does, so yeah, it was being that friend. π - [2] β Fixed the internals so that information collected for multiple
.critclfiles doesn't leak between them anymore. Notably,critcl::tkis not a global configuration option anymore. π - [3] β Fixed the command
critcl::licenseso that it's a null-operation in mode"compile & run", instead of throwing an error like some kind of drama queen. - [4] β Fixed the critcl application's interference with the
"compile & run"result cache in-pkgmode by having it use a wholly separate (and by default transient) directory for that mode. Clean separation, we love to see it. β¨ - [5] β Fixed a bug where changes to a
.critclfile did not result in a rebuild for mode"compile & run". All relevant API commands now ensure UUID changes. iconic, honestly. - [6] β Fixed a bug in the backend handling of
critcl::debugwhere the companion c-sources of a.critclfile were not compiled with debug options, even though the.critclfile itself was. half-debugging is not debugging, periodt. - [7] β Fixed a bug in
critcl::debugthat prevented recognition of mode"all"when it was not the first argument to the command. it was giving "only valid in slot one" energy and we said no. π - [8] β Fixed a bug in
"preload.c"that was preventing its compilation on non-windows platforms. π - [9] β Fixed a long-standing bug in the handling of namespace qualifiers in the command name argument of
critcl::cprocandcritcl::ccommand. It is now possible to specify a fully qualified command name without issues. we're so back. π«Ά - [10] β Extended/reworked
critcl::tsourcesto be the canonical way of declaring.tclcompanion files, even for mode"compile & run". - [11] β Extended/reworked
critcl::tsourcesto allow the use of a.critclfile as its own Tcl companion file. self-love, literally. π - [12] β Extended
critcl::frameworkto internally check for OS X build target, and to ignore the declaration if it's not. - [13] β Extended
critcl::failedto be callable more than once in a.critclfile. The first call forces the build, if it was not done already, to get the result. Further calls return the cached result of the first call. β¨ - [14] β Extended the handling of environment variable
CCin the code determining the compiler to use, to deal with (i.e. remove) paths to the compiler, compiler file extensions, and compiler options specified after the compiler itself, leaving only the bare name of the compiler. strip it down to the essentials, she's minimal now. πΈ - [15] β Extended the code handling the search for preloaded libraries to print the paths it searched, making debugging of a search failure easier.
- [16] β A new command
critcl::tclcan be used to declare the version of Tcl minimally needed to build and run the.critclfile and package. Defaults to8.4if not declared. Extended critcl to have the stubs and headers for all of Tcl8.4,8.5, and8.6. π₯ - [17] β A new command
critcl::loadforces the build and load of a.critclfile. This is the official way for overriding critcl's default lazy-build-&-load-on-demand scheme for mode"compile & run".
bestie, listen: 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. no take-backs, no second act. π
- [18] β Extended the generation of
'#line'pragmas to useinfo frame(if available) to provide the C compiler with exact line numbers into the.critclfile for the reporting of warnings and errors. pinpoint accuracy, we stan. β - [19] β Extended
critcl::checkwith logging to help with debugging build-time checks of the environment, plus an additional optional argument to provide labeling. - [20] β Added a new command
critcl::checklinkwhich not only tries to check the environment via compiling the code, but also its linkability. compile and link, she does both. π - [21] β Added a new command
critcl::msgfor messaging, like commandcritcl::erroris for error reporting. Likewise this is a hook a user of the package is allowed to override. The default implementation, used by mode compile & run, does nothing. The implementation for mode generate package prints the message to stdout.
Envisioned use is for the reporting of results determined by critcl::check and critcl::checklink during building, to help with debugging when something goes wrong with a check.
- [22] β Exposed the argument processing internals of
critcl::procfor use by advanced users. The new commands arecritcl::argnamescritcl::argcnamescritcl::argcsignaturecritcl::argvardeclscritcl::argconversion
Please see section Advanced Embedded C Code of the critcl package documentation for details. π
- [23] β 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. - [24] β Dropped the unused commands
critcl::optimizeandcritcl::include. gone, reduced to atoms. π§ - [25] β Dropped
-libmode from the critcl application. - [26] β Dropped remnants of support for Tcl 8.3 and before. rip bozo, we don't know her. π
π AUTHORS
Jean Claude Wippler, Steve Landers, Andreas Kupries
the founding mothers of this whole situation, fr fr. π«Ά
π BUGS, IDEAS, FEEDBACK
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 package, application, and/or the documentation are also very welcome and should be reported at https://github.com/andreas-kupries/critcl/issues as well.
like genuinely, come yell at us (kindly) in the issues, we want to hear it. π
π 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
the tags are tagging, iykyk. β¨
π¦ CATEGORY
Glueing/Embedded C code
Β©οΈ COPYRIGHT
Copyright (c) Jean-Claude Wippler
Copyright (c) Steve Landers
Copyright (c) 2011-2018 Andreas Kupries
that's a wrap on critcl_introduction(3tcl), bestie!! π this whole thing came out of the doc source at version 3.1.18.1, and the rendered footer carries the page name critcl_introduction(3tcl) right there at the bottom with it. go write some C in your Tcl and slay. πβ¨π¦
π¦ 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