Assemble bundles multiple Tcl source code files into a single file. It also works as a preprocessor that understands #define and #ifdef/#ifndef. Assemble is developed as part of the Sqawk project.
Assemble can be compared to Perl's App::FatPacker .
Note that in most cases a Starpack is a more robust alternative to an "assembled" script. However, assembled scripts have the following advantages:
Assembling also works for Jim Tcl source code. Assemble itself can be run with Jim Tcl.
The following example comes from Sqawk v0.14.1:
# ... #define SQAWK interp alias {} ::source+ {} ::source source+ lib/tabulate.tcl source+ lib/utils.tcl source+ lib/parsers/awk.tcl source+ lib/parsers/csv.tcl source+ lib/serializers/awk.tcl source+ lib/serializers/csv.tcl source+ lib/serializers/table.tcl source+ lib/serializers/tcl.tcl source+ lib/classes/sqawk.tcl source+ lib/classes/table.tcl # ...
#! /usr/bin/env tclsh # Tabulate -- turn standard input into a table. # ... set data $updateData dict unset argv FS } puts [tabulate -data $data {*}$argv] } #ifndef SQAWK # If this is the main script... if {[info exists argv0] && ([file tail [info script]] eq [file tail $argv0])} { ::tabulate::main $argv0 $argv } #endif
# ... interp alias {} ::source+ {} ::source # ============================= lib/tabulate.tcl =============================== #! /usr/bin/env tclsh # Tabulate -- turn standard input into a table. # ... set data $updateData dict unset argv FS } puts [tabulate -data $data {*}$argv] } # =========================== end lib/tabulate.tcl ============================= # ...