Open Design and Integration Environment

Anatomy of a Toadkit project
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2018 Conference, Houston/TX, US, Oct 15-19
Send your abstracts to tclconference@googlegroups.com or submit via the online form
by Aug 20.

Toadkits are essentially a specially formatted zip file. The nice thing about the zip file format is that the table of contents is located at the back of the file. What we do for toadkits is to use a parlor trick to tack a zipfile to the end of an application binary. But we do it in a way that the executable portion isn't listed in the table of contents. This the operating system treats the file as an executable. And the zip file format treats it as a fully functioning zip file.

To be able to load the zip file we have to include a little extra code into Tcl/Tk. This code allows Tcl to mount the executable as a zip virtual file system. We also include a little bootloader that tells the system to kick of a file called "main.tcl" at the root of that file system.

Toadkit projects are a directory, and here are the major players:

MakefileA script compatible with the make system. It's what allows us to call make from the command line and magically create things.
src/The directory to be populated with your custom code.
src/main.tclThis file is called by the toadkit after Tcl/Tk initializes and mounts the vfs. Any directory structure is preserved in the final kit, and accessible from the /zvfs mountpoint. This file can and should be modified to suit your application.

During the process other files are created:

PROJECTNAME.vfs/A directory structure that combines your /src directory with ~/odie/zipdir (which contains all of the binary packages that are bundled with the toadkit.)
PROJECTNAME.vfs/packages.tclA manifest of all of the packages included with this kit. It should be sourced by your main.tcl:
source /zvfs/packages.tcl
PROJECTNAME(.exe)The final executable.
PROJECTNAME.zkitA version of your package which can be loaded by a VFS enabled TclSh/Wish using the source command