This page gathers together in one place examples and desciptions of how to develop a [Starkit] application. If you are a first time Starkit user then go to the Starkit home page (see [http://www.equi4.com/starkit/]) for an overview of Starkit and information on what tools you will need and where to down load them. Feel free to add your own ''How To'' or improve an existing one. [Tom Krehbiel] ---- '''How to convert an application to a Starkit.''' Most tcl applications can be converted to a Starkit with little or no modifiction. The pimary requirement is that all code exist under one node in the file system directory structure. A recommended Starkit directory structure illustrated on the "Anatomy of a starkit" page (see [http://www.equi4.com/191]). This recommended sturcture should be used for all new application but when converting an application the only real requirement is that the file ''main.tcl'' exist at the top of the directory structure. Beyond this requirement you may what to put all packages in a ''lib'' directory at the top level because this directory is automaticlly added to the tcl auto_path by tclkit and doing this in the main.tcl script is a real pain. Once you have fixed the directory structure of your application you can proceed wrapping your application into a Starkit or Starpack. ---- '''How to wrap/unwarp a Starkit or Starpack.''' A starkit (or starpack) is wrapped using the '''sdx''' application (see [http://mini.net/tcl/3411]). This application implements a lot of command but the wrap command is used to convert a directory containing an application into a starkit or starpack. To recover the original directory from a wrapped starkit or starpack use the sdx ''unwrap'' command. The "How to assemble a starkit" page (see [http://www.equi4.com/188]) illustrates how to use the sdx wrap and unwrap commands. ---- '''How to write the ''main.tcl'' for a starkit.''' The following discription is paraphrased from comments made by [Jean-Claude Wippler]. These two lines should always be the first two in main.tcl: package require starkit if {[starkit::startup] eq "sourced"} return Usually, main.tcl contains just one more line after that (where "myapp" is replaced by whatever your app is called): package require app-myapp That way, you can run things 4 ways: 1. unwrapped: tclkit myapp.vfs/main.tcl 2. starkit: tclkit myapp.kit 3. starpack: myapp 4. sourced: source myapp.vfs/main.tcl 5. plugin: no, not yet, but who knows - one day? The string returned by startup is one of the above, and indicates to the main.tcl script how it was launched. The check and return on "sourced" is a convenience, it prevents main.tcl from actually starting anything up. The effect is that the starkit's lib/ directory will have been added to the path, so all packages are available to the context where "source" was called. This auto_path change is part of the logic in starkit::startup. The other thing startup does, is to set starkit::topdir to the directory where main.tcl resides, which I think is what you were looking for. To be complete, I have to mention that there's a "gotcha" in the current logic. If one starkit sources another, say a collection of packages such as kitten, then starkit::topdir will end up being set as pointing to kitten. That's usually not what you want, so you have to save topdir in your scripts before sourcing other starkits: set mytopdir $starkit::topdir source somepath/kitten.kit