Version 0 of How to make a Tcl application

Updated 2003-11-27 07:32:02

Arjen Markus (27 november 2003) This page is intended to hold (the draft version of) a Tcl user/programmer guide. I feel something like that is needed, as it will concentrate information that is now scattered all over the place in one single document - information that is needed by unexperienced programmers and is tough to find, due to the scattering.


Idea for a tutorial/user guide

  • Use the script to find files
  • Describe in detail how to do it: why use procedures?
  • Describe options to implement it:
       - by running the command on each file in turn
       - by having it return a list of files
  • Describe in detail how to deploy the script!
  • Second example: polynomials (ah maths!)
      - Similar set-up

Subjects/aspects - just a reminder:

  • GUI for finding files
  • #! magic
  • associations under Windows
  • tclkit and console
  • MacOSX: how to work on that platform?
  • difference between application and library - info script trick
  • Start menu under Windows
  • Typical installation under UNIX
  • Environment variables
  • Version numbers: Tcl, own application
  • package require Tk
  • version number and patchlevel Tcl/Tk

How to make a Tcl application

1. Introduction

Books on programming languages generally focus on the syntax and semantics of the language. They seldom explain in detail how to make an actual application, that is, a program or set of programs that you can give to a user and that he or she can start using then. Partly the reason is that many programmers already have some knowledge of how to do that (but how did they learn that in the first place?). Partly, especially for compiled languages (C, Fortran, Java, ...), the reason is that this is very platform-dependent. You can consult the manual for your compiler to find out what the command is for compiling a single source file, what options it supports. Such things are generally found in the programmer's guide.

The situation is different for an interpreted language like Tcl. As there is no compiler in the sense of a separate program that you need to run, the source code for your Tcl program is all that is needed: this is the application.

Well, if that were the full story, this guide could stop here. Of course it is not as simple as that. So you give your code to the unexpecting user. What then? How is he or she supposed to know how to start it? Or for that matter, if you know the basics of the language, but you do not have much (or any) experience with it, how do you as a programmer start?

This guide intends to help out: I will describe a few small applications from the beginning (the idea) to the end (the actual, deliverable application). By describing them in detail, I hope you will learn the following:

  • Basic programming skills in Tcl (if you do not have them already)
  • How to design a (small) application
  • How to organise your source code (use of main code, procedures, what to do with several source files, how script libraries work)
  • How to create a deliverable application (for various platforms)

2. Experimenting via the "shells"

3. Finding files

4. Adding a GUI

5. A library example

6. Platform issues

References


[ Category Tutorial ]