PRACTCL(3tcl)
π NAME π
practcl β The Proper Rational API for C to Tool Command Language. Manual page in section 3tcl. (Yes bestie, practcl(3tcl), that's the one π«Ά)
β¨ SYNOPSIS β¨
okay so first things first: you gotta have TclOO, and you gotta have at least version 1.0. No negotiating on that one π
package require TclOO 1.0
then the free-floating procs, the whole little toolbox:
proc practcl::cat fname
proc practcl::docstrip text
proc putb ?map? text
proc Proc name arglist body
proc noop ?args?
proc practcl::debug ?args?
proc practcl::doexec ?args?
proc practcl::doexec_in path ?args?
proc practcl::dotclexec ?args?
proc practcl::domake path ?args?
proc practcl::domake.tcl path ?args?
proc practcl::fossil path ?args?
proc practcl::fossil_status dir
proc practcl::os
proc practcl::mkzip exename barekit vfspath
proc practcl::sort_dict list
proc practcl::local_os
proc practcl::config.tcl path
proc practcl::read_configuration path
proc practcl::tcllib_require pkg ?args?
proc practcl::platform::tcl_core_options os
proc practcl::platform::tk_core_options os
proc practcl::read_rc_file filename ?localdat ?
proc practcl::read_sh_subst line info
proc practcl::read_sh_file filename ?localdat ?
proc practcl::read_Config.sh filename
proc practcl::read_Makefile filename
proc practcl::cputs varname ?args?
proc practcl::tcl_to_c body
proc practcl::_tagblock text ?style tcl? ?note ?
proc practcl::de_shell data
proc practcl::grep pattern ?files ?
proc practcl::file_lexnormalize sp
proc practcl::file_relative base dst
proc practcl::findByPattern basedir patterns
proc practcl::log fname comment
proc practcl::_pkgindex_simpleIndex path
proc practcl::_pkgindex_directory path
proc practcl::_pkgindex_path_subdir path
proc practcl::pkgindex_path ?args?
proc practcl::installDir d1 d2
proc practcl::copyDir d1 d2 ?toplevel 1?
proc practcl::buildModule modpath
proc practcl::installModule modpath DEST
proc practcl::trigger ?args?
proc practcl::depends ?args?
proc practcl::target name info ?action ?
then we get into the object methods, and there areβ¦ a lot of them. Like, a lot a lot. Not me listing every single one but also, like, literally every single one, because that's the whole point of a synopsis π here's the documentation-scanner / manpage-flavored crew:
method constructor
method argspec argspec
method comment block
method keyword.Annotation resultvar commentblock type name body
method keyword.Class resultvar commentblock name body
method keyword.class resultvar commentblock name body
method keyword.Class_Method resultvar commentblock name ?args?
method keyword.method resultvar commentblock name ?args?
method keyword.proc commentblock name argspec
method reset
method Main
method section.method keyword method minfo
method section.annotation type name iinfo
method section.class class_name class_info
method section.command procinfo
method manpage ?header value? ?footer value? ?authors list?
method scan_text text
method scan_file filename
method _MorphPatterns
method define submethod ?args?
method graft ?args?
method initialize
method link command ?args?
method morph classname
method script script
method select
method source filename
classmethod select object
next up: the build-system-y, configuration-y, makefile-y energy π οΈ
method config.sh
method BuildDir PWD
method MakeDir srcdir
method read_configuration
method build-cflags PROJECT DEFS namevar versionvar defsvar
method critcl ?args?
method Autoconf
method BuildDir PWD
method ConfigureOpts
method MakeDir srcdir
method make {} autodetect
method make {} clean
method make {} compile
method make {} install DEST
method build-compile-sources PROJECT COMPILE CPPCOMPILE INCLUDES
method build-Makefile path PROJECT
method build-library outfile PROJECT
method build-tclsh outfile PROJECT ?path auto?
method BuildDir PWD
method make {} autodetect
method make {} clean
method make {} compile
method make {} install DEST
method MakeDir srcdir
method NmakeOpts
and here come the C-codegen methods, where practcl lowkey becomes a whole compiler pipeline π
method constructor module_object name info ?action_body ?
method do
method check
method output
method reset
method triggers
method constructor parent ?args?
method child method
method go
method cstructure name definition ?argdat ?
method include header
method include_dir ?args?
method include_directory ?args?
method c_header body
method c_code body
method c_function header body ?info ?
method c_tcloomethod name body ?arginfo ?
method cmethod name body ?arginfo ?
method c_tclproc_nspace nspace
method c_tclcmd name body ?arginfo ?
method c_tclproc_raw name body ?arginfo ?
method tcltype name argdat
method project-compile-products
method implement path
method initialize
method linktype
method generate-cfile-constant
method generate-cfile-header
method generate-cfile-tclapi
method generate-loader-module
method Collate_Source CWD
method select
classmethod select object
more generator methods, because the file generation never ends (affectionate):
method code section body
method Collate_Source CWD
method project-compile-products
method generate-debug ?spaces ?
method generate-cfile-constant
method generate-cfile-public-structure
method generate-cfile-header
method generate-cfile-global
method generate-cfile-private-typedef
method generate-cfile-private-structure
method generate-cfile-functions
method generate-cfile-tclapi
method generate-hfile-public-define
method generate-hfile-public-macro
method generate-hfile-public-typedef
method generate-hfile-public-structure
method generate-hfile-public-headers
method generate-hfile-public-function
method generate-hfile-public-includes
method generate-hfile-public-verbatim
method generate-loader-external
method generate-loader-module
method generate-stub-function
method IncludeAdd headervar ?args?
method generate-tcl-loader
method generate-tcl-pre
method generate-tcl-post
method linktype
method Ofile filename
method project-static-packages
method toolset-include-directory
method target method ?args?
method project-compile-products
method generate-loader-module
method project-compile-products
method linker-products configdict
method initialize
variable make_object
method _MorphPatterns
method add ?args?
method install-headers ?args?
method make {} _preamble
method make {} pkginfo
method make {} objects
method make {} object name
method make {} reset
method make {} trigger ?args?
method make {} depends ?args?
method make {} filename name
method make {} target name Info body
method make {} todo
method make {} do
method child which
method generate-c
method generate-h
method generate-loader
method initialize
method implement path
method linktype
method _MorphPatterns
method constructor ?args?
method add_object object
method add_project pkg info ?oodefine ?
method add_tool pkg info ?oodefine ?
method build-tclcore
method child which
method linktype
method project pkg ?args?
method tclcore
method tkcore
method tool pkg ?args?
method clean PATH
method project-compile-products
method go
method generate-decls pkgname path
method implement path
method generate-make path
method linktype
method package-ifneeded ?args?
method shared_library ?filename ?
method static_library ?filename ?
method build-tclkit_main PROJECT PKG_OBJS
method Collate_Source CWD
method wrap PWD exename vfspath ?args?
and finally the source-control / sandbox / installer crowd, aka the ones that go out and touch the filesystem π«£
classmethod Sandbox object
classmethod select object
classmethod claim_option
classmethod claim_object object
classmethod claim_path path
method scm_info
method DistroMixIn
method Sandbox
method SrcDir
method ScmTag
method ScmClone
method ScmUnpack
method ScmUpdate
method Unpack
classmethod claim_object object
classmethod claim_option
classmethod claim_path path
method ScmUnpack
classmethod claim_object obj
classmethod claim_option
classmethod claim_path path
method scm_info
method ScmClone
method ScmTag
method ScmUnpack
method ScmUpdate
classmethod claim_object obj
classmethod claim_option
classmethod claim_path path
method ScmTag
method ScmUnpack
method ScmUpdate
method _MorphPatterns
method BuildDir PWD
method child which
method compile
method go
method install ?args?
method linktype
method linker-products configdict
method linker-external configdict
method linker-extra configdict
method env-bootstrap
method env-exec
method env-install
method env-load
method env-present
method sources
method update
method unpack
method env-bootstrap
method env-present
method linktype
method env-bootstrap
method env-install
method env-present
method install DEST
method kettle path ?args?
method install DEST
method install DEST
method env-bootstrap
method env-install
method env-present
method install DEST
method install-module DEST ?args?
method env-bootstrap
method env-install
method install DEST
method install-module DEST ?args?
method clean
method env-install
method project-compile-products
method ComputeInstall
method go
method linker-products configdict
method project-static-packages
method BuildDir PWD
method compile
method Configure
method install DEST
method install DEST
method install DEST
method env-bootstrap
method env-present
method env-install
method go
method linktype
ngl bestie, that synopsis is giving "phone book" and I respect it. Every name up there is real, so don't go renaming anything, okay? Copy-paste responsibly π
πΈ DESCRIPTION πΈ
So what is practcl? The Practcl module is a tool for integrating large modules for C API Tcl code that requires custom Tcl types and TclOO objects. That's the whole assignment, periodt.
The concept with Practcl is that it's a single file package that can assist any tcl based project with distribution, compilation, linking, VFS preparation, executable assembly, and installation. Six whole jobs. It's giving "one girl, six majors" π
Practcl also lets one project invoke the build system from another project, which means complex projects β like a statically linked basekit β can be assembled with relative ease. Yeah, it said relative ease, don't come for me π«Ά
And the best part? Practcl ships as a single file, and aside from a Tcl 8.6 interpreter, it has no external dependencies. Not one. Zero. Iconic behaviour fr fr β¨
π§ Making a practcl project π§
(okay this is where it gets good, but the how-to is coming in the next chunk β we're not done yet bestie, keep scrolling π)
β¨ COMMANDS β¨
okay bestie, here's the full roster of practcl commands, in exactly the order she wrote them π
some of these have zero blurb attached β and I'm not about to make up lore, so for those you just get the signature and the vibe. no cap.
proc practcl::cat fname
Glues a file together β concatenates it. π
proc practcl::docstrip text
Strips the global comments out of tcl code. Why? So the documentation-markup comments don't clog up files you're shipping in a machine-readable format. A lil cleanup before the glow-up β¨
proc putb ?map? text
Appends a line of text onto a variable. Hand her a map and she'll apply a string mapping on the way in. π
proc Proc name arglist body
Makes you a proc β but only if no command already exists under that name. Name's taken? She's not touching it. π
proc noop ?args?
The do-nothing command. Iconic. Perfect for negating an instruction without commenting it completely out, and also a handy attachment point for an object that gets named later. π
proc practcl::debug ?args?
proc practcl::doexec ?args?
Drops in a static copy of Tcl. π§
proc practcl::doexec_in path ?args?
proc practcl::dotclexec ?args?
proc practcl::domake path ?args?
proc practcl::domake.tcl path ?args?
proc practcl::fossil path ?args?
proc practcl::fossil_status dir
proc practcl::os
proc practcl::mkzip exename barekit vfspath
Builds a zipfile. On tcl8.6 she calls the native Zip implementation; on older interpreters she shells out to zip via exec. ποΈ
proc practcl::sort_dict list
Dictionary-sorts a key/value list. Needed because pre-tcl8.6 doesn't have lsort -stride 2 β so she hand-rolls the slay. π
proc practcl::local_os
Hands you back a dictionary describing the local operating system. The fields she returns include:
downloadβ filesystem path where fossil repositories and source tarballs are downloaded for the current userEXEEXTβ the extension to give to executables (i.e..exeon windows)fossil_mirrorβ a URI for a local network web server who acts as a fossil repository mirrorlocal_installβ filesystem path where packages for local consumption by the current user are installedprefixβ the prefix as given to the Tcl core/TEA for installation tolocal_installin./configuresandboxβ the file location where this project unpacks external projectsTEACUP_PROFILEβ the ActiveState/Teacup canonical name for this platform (i.e.win32-ix86 macosx10.5-i386-x86_84)TEACUP_OSβ the local operating system (windows,macosx,openbsd, etc). Gives the same answer astcl.m4, except that macosx is given asmacosxinstead ofDarwin.TEA_PLATFORMβ the platform returned byuname -s-uname -r(on Unix), or"windows"on WindowsTEACUP_ARCHβ the processor architecture for the local os (i.e.ix86,x86_64)TEACUP_ARCHβ the processor architecture for the local os (i.e.ix86,x86_64) β¦ yes, she's in the list twice in the original. She said what she said π«Άteapotβ filesystem path where teapot package files are downloaded for the current useruserhomeβ file path to store localized preferences, cache download files, etc for the current user
This command uses a combination of local checks with Exec, any tclConfig.sh file that is resident, autoconf data where already computed, and data gleaned from a file named practcl.rc in userhome. The location for userhome varies by platform and operating system:
- Windows:
::env(LOCALAPPDATA)/Tcl - Macos:
~/Library/Application Support/Tcl - Other:
~/tcl
proc practcl::config.tcl path
A transparent call straight through to ::practcl::read_configuration, kept around to preserve backward compadibility with older copies of Practcl. π°οΈ
proc practcl::read_configuration path
Detects the local platform. She looks for data gleaned by autoconf or autosetup in the path you specified, or runs her own logic tests if neither of those has been run. A file named config.site present in the location is the signal that this project is cross compiling, and the data stored in that file gets used for the compiler and linker.
She looks for information from the following files, in the following order:
config.tclβ a file generated by autoconf/configure in newer editions of TEA, encoded as a Tcl script.config.siteβ a file containing cross compiler information, encoded as a SH script::env(VisualStudioVersion)β on Windows, an environmental value that indicates MS Visual Studio is installed
This command returns a dictionary containing all of the data cleaned from the sources above. In the absence of any guidance this command returns the same output as ::practcl::local_os. In this mode, if the environmental variable VisualStudioVersion exists, this command will provide a template of fields that are appropriate for compiling on Windows under Microsoft Visual Studio. The USEMSVC flag in the dictionary is a boolean flag to indicate if this is indeed the case. β
proc practcl::tcllib_require pkg ?args?
Tries to load a package, and failing that, retrieves tcllib. Fallback queen π§
proc practcl::platform::tcl_core_options os
Returns the string to pass to ./configure to compile the Tcl core for the given OS.
windows:--with-tzdata --with-encoding utf-8macosx:--enable-corefoundation=yes --enable-framework=no --with-tzdata --with-encoding utf-8other:--with-tzdata --with-encoding utf-8
proc practcl::platform::tk_core_options os
proc practcl::read_rc_file filename ?localdat ?
Reads a stylized key/value list stored in a file. π
proc practcl::read_sh_subst line info
Converts a XXX.sh file into a series of Tcl variables. πͺ
proc practcl::read_sh_file filename ?localdat ?
proc practcl::read_Config.sh filename
A simpler form of read_sh_file, tailored to pulling data from (tcl|tk)Config.sh. π―
proc practcl::read_Makefile filename
A simpler form of read_sh_file, tailored to pulling data from a Makefile. π―
proc practcl::cputs varname ?args?
Appends arguments to a buffer. The command works like puts in that each call will also insert a line feed. Unlike puts, blank lines in the interstitial are suppressed. π«§
proc practcl::tcl_to_c body
proc practcl::_tagblock text ?style tcl? ?note ?
proc practcl::de_shell data
proc practcl::grep pattern ?files ?
Searches for the pattern pattern amongst $files. π
proc practcl::file_lexnormalize sp
proc practcl::file_relative base dst
Calculates a relative path between base and dst. π§
Example:
::practcl::file_relative ~/build/tcl/unix ~/build/tcl/library
> ../library
proc practcl::findByPattern basedir patterns
proc practcl::log fname comment
Records an event in the practcl log. π
proc practcl::_pkgindex_simpleIndex path
proc practcl::_pkgindex_directory path
Returns true if the pkgindex file contains any statement other than package ifneeded and/or if any package ifneeded loads a DLL. π§
proc practcl::_pkgindex_path_subdir path
Helper function for ::practcl::pkgindex_path. π«Ά
proc practcl::pkgindex_path ?args?
Indexes all paths given, as though they're going to end up in the same virtual file system. π
proc practcl::installDir d1 d2
Deletes the contents of d2, then recursively copies the contents of d1 to d2. π§Ή
proc practcl::copyDir d1 d2 ?toplevel 1?
Recursively copies the contents of d1 to d2. π
proc practcl::buildModule modpath
proc practcl::installModule modpath DEST
Installs a module from MODPATH to the directory specified. dpath is assumed to be the fully qualified path where the module is to be placed. Any existing files at that path will be deleted. If the path is a symlink, the process will return with no error and no action. If the module has contents in the build/ directory that are newer than the .tcl files in the module source directory, and a build/build.tcl file exists, the build/build.tcl file is run. If the source directory includes a file named index.tcl, the directory is assumed to be in the tao style of modules, and the entire directory (and all subdirectories) is copied verbatim. If no index.tcl file is present, all .tcl files are copied from the module source directory, and a pkgIndex.tcl file is generated if none exists yet. If a folder named htdocs exists in the source directory, that directory is copied verbatim to the destination. π¦
proc practcl::trigger ?args?
Triggers build targets, and recomputes dependencies. π¬
Internals:
::practcl::LOCAL make trigger {*}$args
foreach {name obj} [::practcl::LOCAL make objects] {
set ::make($name) [$obj do]
}
proc practcl::depends ?args?
Calculates if a dependency for any of the arguments needs to be fulfilled or rebuilt. π€
Internals:
::practcl::LOCAL make depends {*}$args
proc practcl::target name info ?action ?
Declares a build product. This proc is just a shorthand for ::practcl::LOCAL make task $name $info $action.
Registering a build product with this command will create an entry in the global array, and populate a value in the global array.
Internals:
set obj [::practcl::LOCAL make task $name $info $action]
set ::make($name) 0
set filename [$obj define get filename]
if {$filename ne {}} {
set ::target($name) $filename
}
β¨ CLASSES β¨
Okay bestie, this is where it gets juicy β the actual classes. Buckle up π
πΈ CLASS PRACTCL::DOCTOOL
Real talk, the whole point of this icon: it's a tool for build scripts to dynamically generate manual files from comments in source code files. Like, it reads your comments and turns them into a whole man page. Obsessed fr fr π
Here's the vibe in action:
set authors {
{John Doe} {jdoe@illustrious.edu}
{Tom RichardHarry} {tomdickharry@illustrius.edu}
}
# Create the object
::practcl::doctool create AutoDoc
set fout [open [file join $moddir module.tcl] w]
foreach file [glob [file join $srcdir *.tcl]] {
set content [::practcl::cat [file join $srcdir $file]]
# Scan the file
AutoDoc scan_text $content
# Strip the comments from the distribution
puts $fout [::practcl::docstrip $content]
}
# Write out the manual page
set manout [open [file join $moddir module.man] w]
dict set args header [string map $modmap [::practcl::cat [file join $srcdir manual.txt]]]
dict set args footer [string map $modmap [::practcl::cat [file join $srcdir footer.txt]]]
dict set args authors $authors
puts $manout [AutoDoc manpage {*}$args]
close $manout
}
Methods
method constructorβ does the construction thing, no notes given. Iconic mystery πmethod argspec argspecβ Process an argument list into an informational dict. This method also understands non-positional arguments expressed in the notation of Tip 471 https://core.tcl-lang.org/tips/doc/trunk/tip/479.md.
The output will be a dictionary of all of the fields and whether the fields are positional, mandatory, and whether they have a default value.
Example, slay:
my argspec {a b {c 10}}
> a {positional 1 mandatory 1} b {positional 1 mandatory 1} c {positional 1 mandatory 0 default 10}
method comment blockβ Convert a block of comments into an informational dictionary. If lines in the comment start with a single word ending in a colon, all subsequent lines are appended to a dictionary field of that name. If no fields are given, all of the text is appended to the description field. So smart π§
Example:
my comment {Does something cool}
> description {Does something cool}
my comment {
title : Something really cool
author : Sean Woods
author : John Doe
description :
This does something really cool!
}
> description {This does something really cool!}
title {Something really cool}
author {Sean Woods
John Doe}
method keyword.Annotation resultvar commentblock type name bodyβ no description, it just is β¨method keyword.Class resultvar commentblock name bodyβ Process anoo::objdefinecall that modifies the class object itself.method keyword.class resultvar commentblock name bodyβ Process anoo::define,clay::define, etc statement.method keyword.Class_Method resultvar commentblock name ?args?β Process a statement for a clay style class method.method keyword.method resultvar commentblock name ?args?β Process a statement for a tcloo style object method.method keyword.proc commentblock name argspecβ Process a proc statement.method resetβ Reset the state of the object and its embedded coroutine. Fresh start energy π¦method Mainβ Main body of the embedded coroutine for the object.method section.method keyword method minfoβ Generate the manual page text for a method or proc.method section.annotation type name iinfoβ generates manual text, no extra deets given πmethod section.class class_name class_infoβ Generate the manual page text for a class.method section.command procinfoβ Generate the manual page text for the commands section.method manpage ?header value? ?footer value? ?authors list?β Generate the manual page. Returns the completed text suitable for saving in.manfile. The header argument is a block of doctools text to go in before the machine generated section. footer is a block of doctools text to go in after the machine generated section. authors is a list of individual authors and emails in the form ofAUTHOR EMAIL ?AUTHOR EMAIL?.... This is the moment πmethod scan_text textβ Scan a block of text.method scan_file filenameβ Scan a file of text.
π¦ CLASS PRACTCL::METACLASS
The metaclass for all practcl objects. Mother of the whole family π
Methods
method _MorphPatternsβ no description, it's just built different.method define submethod ?args?β defines the submethod, periodt.method graft ?args?β grafting, as one does πΈmethod initializeβ sets itself up.method link command ?args?β makes the link.method morph classnameβ morphs into classname. Main character transformation πmethod script scriptβ script stuff.method selectβ selection time.method source filenameβ sources filename.
π CLASS PRACTCL::TOOLSET
Ancestor-less class intended to be a mixin which defines a family of build related behaviors that are modified when targetting either gcc or msvc. Not like other classes β literally no ancestors π«Ά
Class Methods
classmethod select objectβ Perform the selection for the toolset mixin.
Methods
method config.shβ find or fake a key/value list describing this project.method BuildDir PWDβ Compute the location where the product will be built.method MakeDir srcdirβ Return where the Makefile is located relative to srcdir. For this implementation the MakeDir is always srcdir.method read_configurationβ Read information about the build process for this package. For this implementation, data is sought in the following locations in the following order:config.tcl(generated by practcl.),PKGConfig.sh, and theMakefile.
Heads up: If the Makefile needs to be consulted, but does not exist, the Configure method is invoked. It's giving "we'll figure it out" energy π
method build-cflags PROJECT DEFS namevar versionvar defsvarβ method DEFS. This method populates 4 variables:nameβ The name of the package;versionβ The version of the package;defsβ C flags passed to the compiler;includedirβ A list of paths to feed to the compiler for finding headers.method critcl ?args?β Invokecritclin an external process. Outsourcing, we love to see it β¨
β CLASS PRACTCL::TOOLSET.GCC
ancestors: practcl::toolset
Methods
method Autoconfβ autoconf things π₯method BuildDir PWDβ computes the build dir.method ConfigureOptsβ the configure options.method MakeDir srcdirβ Detect what directory contains the Makefile template.method make {} autodetectβ the autodetect flavor of make.method make {} cleanβ clean it up π§Όmethod make {} compileβ compile time.method make {} install DESTβ install into DEST.method build-compile-sources PROJECT COMPILE CPPCOMPILE INCLUDESβ builds the compile sources.method build-Makefile path PROJECTβ builds the Makefile at path for PROJECT.method build-library outfile PROJECTβ Produce a static or dynamic library. The moment we've all been waiting for πmethod build-tclsh outfile PROJECT ?path auto?β Produce a static executable.
π CLASS PRACTCL::TOOLSET.MSVC
ancestors: practcl::toolset
Methods
method BuildDir PWDβ MSVC always builds in the source directory. No thoughts, head empty, source dir it is.method make {} autodetectβ Do nothing. Literally. Napping π΄method make {} cleanβ clean it.method make {} compileβ compile it.method make {} install DESTβ install to DEST.method MakeDir srcdirβ Detect what directory contains the Makefile template.method NmakeOptsβ the nmake options, bestie.
π CLASS PRACTCL::MAKE_OBJ
ancestors: practcl::metaclass
A build deliverable object. Normally an object file, header, or tcl script which must be compiled or generated in some way.
Methods
method constructor module_object name info ?action_body ?β the constructor, doing constructor things.method doβ do the thing.method checkβ check the thing.method outputβ output the thing.method resetβ reset the thing.method triggersβ trigger the thing.
πΈ CLASS PRACTCL::OBJECT
ancestors: practcl::metaclass
A generic Practcl object.
Methods
method constructor parent ?args?β constructor with a parent, cute π«Άmethod child methodβ the child method.method goβ go. That's it. That's the method. Periodt π
π₯ CLASS PRACTCL::DYNAMIC
Dynamic blocks do not generate their own .c files, instead they contribute to the amalgamation of the main library file. Sneaky little icon π§
Methods
method cstructure name definition ?argdat ?β Parser functions.method include headerβ includes header.method include_dir ?args?β the include dir.method include_directory ?args?β also the include directory.method c_header bodyβ the C header body.method c_code bodyβ the C code body.method c_function header body ?info ?β the C function.method c_tcloomethod name body ?arginfo ?β tcloo method generation.method cmethod name body ?arginfo ?β Alias to classic name.method c_tclproc_nspace nspaceβ the tcl proc namespace.method c_tclcmd name body ?arginfo ?β the tcl command.method c_tclproc_raw name body ?arginfo ?β Alias to classic name.method tcltype name argdatβ the tcl type.method project-compile-productsβ Module interactions.method implement pathβ implements at path.method initializeβ Practcl internals.method linktypeβ the link type.method generate-cfile-constantβ generates the constant C file bits.method generate-cfile-headerβ generates the C file header.method generate-cfile-tclapiβ Generate code that provides implements Tcl API calls.method generate-loader-moduleβ Generate code that runs when the package/module is initialized into the interpreter.method Collate_Source CWDβ collates the source.method selectβ Once an object marks itself as some flavor of dynamic, stop trying to morph it into something else. Boundaries, established π«
π CLASS PRACTCL::PRODUCT
A deliverable for the build system. The main event, honestly π
Class Methods
classmethod select objectβ performs the selection for the product.
Methods
method code section bodyβ code for section with body.method Collate_Source CWDβ collates the source from CWD.method project-compile-productsβ compiles the products.method generate-debug ?spaces ?β generates debug output.method generate-cfile-constantβ generates the constant.method generate-cfile-public-structureβ Populate const static data structures.method generate-cfile-headerβ generates the C file header.method generate-cfile-globalβ generates the global.method generate-cfile-private-typedefβ generates the private typedef.method generate-cfile-private-structureβ generates the private structure.method generate-cfile-functionsβ Generate code that provides subroutines called by Tcl API methods.method generate-cfile-tclapiβ Generate code that provides implements Tcl API calls.method generate-hfile-public-defineβ generates the public define.method generate-hfile-public-macroβ generates the public macro.method generate-hfile-public-typedefβ generates the public typedef.method generate-hfile-public-structureβ generates the public structure.method generate-hfile-public-headersβ generates the public headers.method generate-hfile-public-functionβ generates the public function.method generate-hfile-public-includesβ generates the public includes.method generate-hfile-public-verbatimβ generates the public verbatim block.method generate-loader-externalβ generates the external loader.method generate-loader-moduleβ generates the module loader.method generate-stub-functionβ generates the stub function.method IncludeAdd headervar ?args?β adds an include to headervar.method generate-tcl-loaderβ generates the tcl loader.method generate-tcl-preβ This methods generates any Tcl script file which is required to pre-initialize the C library.method generate-tcl-postβ generates the tcl post bits.method linktypeβ the link type.method Ofile filenameβ the output file for filename.method project-static-packagesβ Methods called by the master project.method toolset-include-directoryβ Methods called by the toolset.method target method ?args?β target method with args.
π CLASS PRACTCL::PRODUCT.CHEADER
ancestors: practcl::product
A product which generated from a C header file. Which is to say, nothing. That's the whole bit π
Methods
method project-compile-productsβ compiles the products.method generate-loader-module
CLASS PRACTCL::PRODUCT.CSOURCE
ancestors: practcl::product
A product that gets generated from a C source file. Normally an object (.o) file. iconic little build-unit behavior tbh
Methods
method project-compile-products
CLASS PRACTCL::PRODUCT.CLIBRARY
ancestors: practcl::product
A product generated from a compiled C library. Usually a .a or a .dylib file β but in the complex cases it might lowkey just be a conduit letting one project integrate the source code of another. we love a flexible middleman
Methods
method linker-products configdict
CLASS PRACTCL::PRODUCT.DYNAMIC
ancestors: practcl::dynamic practcl::product
A product generated from C code that is itself generated by practcl or by some other means. This C file may or may not produce its own .o file, depending on whether it's eligible to become part of an amalgamation. mysterious, glamorous, conditional β¨
Methods
method initialize
CLASS PRACTCL::PRODUCT.CRITCL
ancestors: practcl::dynamic practcl::product
A binary product produced by critcl.
β οΈ Note: the implementation is not written yet β this class does nothing. it's giving placeholder energy fr fr π
CLASS PRACTCL::MODULE
ancestors: practcl::object practcl::product.dynamic
In the end, all C code must be loaded into a module. That module will either be a dynamically loaded library implementing a Tcl extension, or a compiled-in segment of a custom shell/app. the final boss of code delivery π
Variable
variable make_object
Methods
method _MorphPatternsmethod add ?args?method install-headers ?args?method make {} _preamblemethod make {} pkginfomethod make {} objectsβ returns a dictionary of all handles and their associated objects a whole little rostermethod make {} object nameβ returns the object associated with the handle namemethod make {} resetβ resets all deputy objectsmethod make {} trigger ?args?β exercises the triggers method for all handles listedmethod make {} depends ?args?β exercises the check method for all handles listedmethod make {} filename nameβ returns the file name of the build product for the listed handlemethod make {} target name Info bodymethod make {} todoβ returns a list of handles for objects that return true for thedomethodmethod make {} doβ for each target, exercises the action specified in the action definition if thedomethod returns truemethod child whichmethod generate-cβ this method generates the contents of an amalgamated.cfile which implements the loader for a batch of tools amalgamation slaymethod generate-hβ this method generates the contents of an amalgamated.hfile which describes the public API of this modulemethod generate-loadermethod initializemethod implement pathmethod linktype
CLASS PRACTCL::PROJECT
ancestors: practcl::module
A toplevel project that is a collection of other projects. a project of projects, very main character
Methods
method _MorphPatternsmethod constructor ?args?method add_object objectmethod add_project pkg info ?oodefine ?method add_tool pkg info ?oodefine ?method build-tclcoreβ compiles the Tcl core. If the definetkis true, compiles the Tk core as well β¨method child whichmethod linktypemethod project pkg ?args?β exercises the methods of a sub-objectmethod tclcoremethod tkcoremethod tool pkg ?args?
CLASS PRACTCL::LIBRARY
ancestors: practcl::project
A toplevel project that produces a library. build a whole library, no biggie π
Methods
method clean PATHmethod project-compile-productsmethod gomethod generate-decls pkgname pathmethod implement pathmethod generate-make pathβ backward compatible call (yes it's a legacy vibe, we keep it)method linktypemethod package-ifneeded ?args?β creates a"package ifneeded". The args are a list of aliases for which this package will answer tomethod shared_library ?filename ?method static_library ?filename ?
CLASS PRACTCL::TCLKIT
ancestors: practcl::library
A toplevel project that produces a self-contained executable. a whole standalone binary, periodt
Methods
method build-tclkit_main PROJECT PKG_OBJSmethod Collate_Source CWDmethod wrap PWD exename vfspath ?args?β wraps an executable
CLASS PRACTCL::DISTRIBUTION
Standalone class for managing code distribution. This class is intended to be mixed into another class β thus the lack of ancestors. a mixin with no parents, living its own truth π¦
Class Methods
classmethod Sandbox objectclassmethod select objectclassmethod claim_optionclassmethod claim_object objectclassmethod claim_path path
Methods
method scm_infomethod DistroMixInmethod Sandboxmethod SrcDirmethod ScmTagmethod ScmClonemethod ScmUnpackmethod ScmUpdatemethod Unpack
CLASS PRACTCL::DISTRIBUTION.SNAPSHOT
ancestors: practcl::distribution
A file distribution from zip, tarball, or other non-scm archive format. good old-fashioned zip energy π¦
Class Methods
classmethod claim_object objectclassmethod claim_optionclassmethod claim_path path
Methods
method ScmUnpack
CLASS PRACTCL::DISTRIBUTION.FOSSIL
ancestors: practcl::distribution
A file distribution based on fossil. fossil stans rise up π¦΄
Class Methods
classmethod claim_object objβ check for markers in the metadataclassmethod claim_optionclassmethod claim_path pathβ check for markers in the source root
Methods
method scm_infomethod ScmCloneβ clone the sourcemethod ScmTagmethod ScmUnpackmethod ScmUpdate
CLASS PRACTCL::DISTRIBUTION.GIT
ancestors: practcl::distribution
A file distribution based on git. the people's scm π
Class Methods
classmethod claim_object objclassmethod claim_optionclassmethod claim_path path
Methods
method ScmTagmethod ScmUnpackmethod ScmUpdate
CLASS PRACTCL::SUBPROJECT
ancestors: practcl::module
A subordinate project. supporting cast but still serving looks
Methods
method _MorphPatternsmethod BuildDir PWDmethod child whichmethod compilemethod gomethod install ?args?β install project into the local build systemmethod linktypemethod linker-products configdictmethod linker-external configdictmethod linker-extra configdictmethod env-bootstrapβ methods for packages/tools that can be downloaded, possibly built, and used internally by this Practcl process. Loads the facility into the interpretermethod env-execβ returns a file path thatexeccan callmethod env-installβ install the tool into the local environmentmethod env-loadβ do whatever is necessary to get the tool into the local environmentmethod env-presentβ check if the tool is available for load / already loadedmethod sourcesmethod updatemethod unpack
CLASS PRACTCL::SUBPROJECT.SOURCE
ancestors: practcl::subproject practcl::library
A project for which the kit compiles and integrates the source itself. bringing its own source to the function β¨
Methods
method env-bootstrapmethod env-presentmethod linktype
CLASS PRACTCL::SUBPROJECT.TEAPOT
ancestors: practcl::subproject
A copy from the teapot. π«
Methods
method env-bootstrapmethod env-installmethod env-presentmethod install DEST
CLASS PRACTCL::SUBPROJECT.KETTLE
ancestors: practcl::subproject
Methods
method kettle path ?args?method install DEST
CLASS PRACTCL::SUBPROJECT.CRITCL
ancestors: practcl::subproject
Methods
method install DEST
CLASS PRACTCL::SUBPROJECT.SAK
ancestors: practcl::subproject
Methods
method env-bootstrapmethod env-installmethod env-presentmethod install DESTmethod install-module DEST ?args?
CLASS PRACTCL::SUBPROJECT.PRACTCL
ancestors: practcl::subproject
Methods
method env-bootstrapmethod env-installmethod install DESTmethod install-module DEST ?args?
CLASS PRACTCL::SUBPROJECT.BINARY
ancestors: practcl::subproject
A subordinate binary package. compiled goods, delivered π
Methods
method cleanmethod env-installmethod project-compile-productsmethod ComputeInstallmethod gomethod linker-products configdictmethod project-static-packagesmethod BuildDir PWDmethod compilemethod Configuremethod install DEST
CLASS PRACTCL::SUBPROJECT.TEA
ancestors: practcl::subproject.binary
A subordinate TEA based binary package. π΅
CLASS PRACTCL::SUBPROJECT.LIBRARY
ancestors: practcl::subproject.binary practcl::library
A subordinate C library built by this project. a library inside a library, inception but make it cute
Methods
method install DEST
CLASS PRACTCL::SUBPROJECT.EXTERNAL
ancestors: practcl::subproject.binary
A subordinate external C library.
Methods
method install DEST
CLASS PRACTCL::SUBPROJECT.CORE
ancestors: practcl::subproject.binary
Methods
method env-bootstrapmethod env-presentmethod env-installmethod gomethod linktype
π BUGS, IDEAS, FEEDBACK π
Okay bestie, real talk: this document, and the package it describes, will undoubtedly contain bugs and other problems. no cap, that's just how docs are π
Please report such in the category practcl of the Tcllib Trackers: http://core.tcl.tk/tcllib/reportlist. And please also report any ideas for enhancements you may have for either the package and/or the documentation. we want the glow-up ideas too π«Ά
When proposing code changes, please provide unified diffs, i.e. the output of diff -u.
Also note: attachments are strongly preferred over inlined patches. You can make an attachment by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. iykyk π
π KEYWORDS
practcl
π CATEGORY
TclOO
Β©οΈ COPYRIGHT
Copyright (c) 2016-2018 Sean Woods <yoda@etoyoc.com>
and that's the whole page, babe β this one came from tcllib, version 0.16.6, dated back when this whole thing got written down, and it lives under the practcl(3tcl) name. tysm for reading to the end, you ate that π
β¨π¦
π¦ where this page comes from
- debian trixie: tcllib 2.0+dfsg-4 Β· Tcl
- ubuntu questing: tcllib 2.0+dfsg-4
- ubuntu resolute: tcllib 2.0+dfsg-5 Β· Tcl
- ubuntu stonking: tcllib 2.0+dfsg-6 Β· Tcl
- Copyright (c) 2016-2018 Sean Woods <yoda@etoyoc\&.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms