tclmerge home page

maintained by
Agnar Renolen (agnar@organizer.net)

[What is tclmerge?] [Running tclmerge] [Merge time vs. runtime inclusion] [Downloads]

What is tclmerge?

Whenever you are developing software using tcl, your project normally includes several source files, and a main file.  Now, consider you would like to distribute this program as one single script, rather than as a bunch of files "source'd" into each other.  This is where tclmerge might give you a hand.

tclmerge will scan through your main file looking for statements like

source "filename".
If the file filename exists, tclmerge will recursively insert the contents of the file into the main script, otherwise it will leave the statement unchanged. The result is one single script which you can distribute more easilly.

Moreover, tclmerge also:

Running tclmerge

Tclmerge is run as follows:
tclmerge -i interp [-o targetfile] mainfile
where:
-i interp
Specifies the interpreter to use.  Typical values are "tclsh83" and "wish83" but you might just as well use other interpreters, for example if the script requires [incr tcl] or any other named compilation of the Tcl interpreters.  This option can be omitted if tclmerge is run as a script in a unix environment. In that case, tclmerge will use the same interpreter as the one running tclmerge itself.
-o targetfile
Specifies the name of the output script.  If this option is ommited, tclmege will generate a filename from the name of the main file by stripping off the extension.
mainfile
Specifies the name of main tcl file.

Merge time vs. runtime inclusion

tclmerge is rather dumb when it encounters the source command in a script.  If the argument to source, verbatim identifes an existing file, it is included into into the main script at merge time.


However, if you want "myfile.tcl" to be included at run time, then you must do something like this in your script:


This is useful sometimes.  For example, if yuo have a directory containing add-on extensions, yuo can source them in at run time using the following statements:


Or, if the user can personalize his application by sourcing an init file, named ".myrc":

Downloads

Current release of tclmerge is version 1.1, released November 27, 2002.  Three downloads are available: