Installing Tcl/Tk and NAP

Table of Contents

  1. Introduction
  2. Installing Tcl/Tk
  3. Tcl/Tk Documentation
  4. Installing nap
  5. Nap User's Guide
  6. Nap Source Code
  7. Related Packages

Introduction

Tcl/Tk and nap are available without charge in both binary (compiled) and source-code form. The following instructions explain how to install Tcl/Tk and then nap. The nap installer for Linux on the (64-bit) Intel IA64 installs the total system since this platform is not supported by ActiveState.

Installing Tcl/Tk

ActiveState Corporation provides free binary distributions of Tcl/Tk with many extensions. There are versions for Windows, Linux (on Intel 386), SunOS (Solaris) and HP-UX. HTML documentation is also available. These can all be downloaded from ActiveState Tcl Downloads.

Read the installation instructions. Note that these explain how to uninstall any existing version of Tcl/Tk, which should be done before installing the new one. (If this method of uninstalling fails then it is usually best to delete the whole tcl root directory.)

The tcl root directory is the directory in which Tcl is installed. Tcl extensions (e.g. nap) are usually also installed in it. Note that it is denoted below by the variable tcl_root. A typical value for Windows is C:\Program Files\Tcl. Typical values for Unix (including Linux) are ~/tcl (personal installation) and /usr/local/tcl (system installation).

Unix users should include tcl_root/bin in the list defined by the standard environment variable PATH. If there are problems with dynamic loading then try including tcl_root/lib in the list defined by the standard environment variable LD_LIBRARY_PATH.

The following three executables will be installed in tcl_root/bin:

tclsh
This provides a bare-bones command-line Tcl shell without Tk. (Tk provides GUI facilities.) It is useful for non-interactive applications such as Unix shell scripts and automatically run (e.g. cron) jobs.
wish
This window shell provides a full Tcl shell including Tk.
tkcon
This provides all the facilities of wish, but in a better console. It is recommended as the normal way of running Tcl.

Each executable will execute a startup script file with the name listed in the following table, if this file is found in the home directory:
Operating System tclsh wish tkcon
Windows tclshrc.tcl wishrc.tcl tkcon.cfg
Unix .tclshrc .wishrc .tkconrc

If you are unsure of which directory is home, then enter the following two commands:
cd
pwd

Tcl/Tk Documentation

The CAPS/NAP Menu help menu includes the remote web Tcl Documentation.

The above installation process for Windows installs this documentation in the form of the compiled HTML help file ActiveTclHelp.chm. Under Windows, the above help menu does include this local copy of the documentation.

The standard installation for Unix installs man pages in the directory tcl_root/man. If you want to use these then include this directory in MANPATH.

It is also possible to create a local copy of this documentation in HTML form. Under Unix, this allows the CAPS/NAP Menu to provide a local copy of the Tcl Documentation (similar to that for Windows). To do this, download the the HTML documentation into the directory tcl_root/doc. Then unpack the tar file and create a symbolic link tcl_root/doc/html pointing to the root directory of the unpacked files.

For example, if the Tcl root directory is ~/tcl then download the version 8.4.9 file ActiveTcl8.4.9.0.121397-html.tar.gz into the directory ~/tcl/doc/.
Change to this directory and then unpack the file using a command such as
gtar zxf ActiveTcl8.4.9.0.121397-html.tar.gz
or
gunzip < gtar zxf ActiveTcl8.4.9.0.121397-html.tar.gz | tar xf -
Then create the symbolic link using
ln -s ActiveTcl8.4.9.0.121397-html html

Installing nap

Nap installers are available for:

The Mac OS X and Darwin platforms are supported via the Fink project, which has a nap page.

It is hoped to support HP-UX in the near future. The SGI Irix platform is no longer supported.

Note that the Linux IA64 installer installs a total tcl system as well as nap. This platform does not have an uninstaller, so it is suggested you install into a completely new directory rather than over an existing installation. For example, if your installation directory is ~/tcl you could do the following:

mv ~/tcl ~/tcl_old
mkdir ~/tcl

The above installers can be downloaded from Tcl-NAP Files. They are in the form of starpacks, which are self-contained binary executables which contain the files to be installed. Starpacks are themselves based on Tcl and are described in Beyond TclKit - Starkits, Starpacks and other *stuff.

Then you simply execute the installer. It will first prompt you for the directory in which to install nap, which is usually the Tcl root directory. Then it will check for existing nap files and offer to delete them (strongly recommended) if any are found.

Finally it will offer to install three standard nap startup script files (with the names in the above table) in your home directory. It is recommended that you install these unless you have alternative startup files. Such alternative files can include the following commands to facilitate use of nap:
package require nap
namespace import ::NAP::*

If there will be other users then copy the three startup files to their home directories.

The script files ~/my_tkcon.cfg and ~/my.tcl will be sourced if they exist. You can create ~/my_tkcon.cfg to tailor the tkcon console to your personal requirements. You can create ~/my.tcl to tailor other aspects of the Tcl system to your personal requirements. See Sample Startup Scripts for examples.

These scripts and the standard nap startup scripts are interrelated. The script tkcon.cfg (.tkconrc) sources ~/my_tkcon.cfg and initialises tkcon to source wishrc.tcl (.wishrc). The script wishrc.tcl (.wishrc) in turn sources tclshrc.tcl (.tclshrc), which sources ~/my.tcl.

On Unix systems it is possible to install nap in a directory (which we will denote by nap_root) other than the Tcl root directory. If nap_root ≠ tcl_root then nap_root/lib must be included in the lists defined by:

For example, assume nap is installed in ~/alt. The following two commands are included in tclshrc.tcl or .tclshrc:

lappend auto_path ~/alt/lib
set env(LD_LIBRARY_PATH) ":~/alt/lib:$env(LD_LIBRARY_PATH)"

Nap User's Guide

The above installation process installs a local copy of the HTML nap documention in nap_root/lib/nap?.?/html (where ?.? is the version number). The CAPS/NAP Menu help menu includes this local copy as well as the remote web copy Nap User's Guide.

A PDF version of this document can be downloaded from Tcl-NAP Files.

Nap Source Code

Source code for nap is maintained using CVS and can be accessed by:

Related Packages

Nap now provides the functionality previously provided by the (now obsolete) separate packages convert_date, inform and land_flag. However CAPS is still separate.

The Windows nap distribution now includes the ezprint utility, which provides access to printers. No such separate printing package is needed for Unix. Previous versions of nap used the printer package to provide access to printers on all platforms.

Previous versions of nap provided an interface to the vector facility in the package BLT. This allowed use of the BLT graph commmand, which was used at that time by the nap procedure plot_nao. NAP no longer provides an interface to BLT or uses it in any way.

Author: Harvey Davies       © 2002, CSIRO Australia.       Legal Notice and Disclaimer
CVS Version Details: $Id: install.html,v 1.22 2005/03/10 05:58:54 dav480 Exp $