Containers 1.2

The Containers 1.2 package is a small extension to the Tcl programming language that implements a number of container objects. Container objects can hold native Tcl objects like strings, lists, arrays and procs and provide some functions that allow the manipulation of the objects in the container.

This package implements the bag, stack, queue, tree, priority queue and random queue and structure containers. A bag is just an unordered list of items that is indexed according to the number of items in the container. A stack is a container that implements a LIFO queue. A queue is a container that implements a FIFO queue.

Tree, priority queue and random queue containers are implemented using binary tree structures. The tree container can be used to maintain a set of items in a sorted list, either in ascending collating sequence or descending collating sequence order. Optionally, the list may contain duplicate items, or be limited to items that have a unique string representation. You can also specify your own collating sequence for special sorting applications.

A priority queue is a list that is sorted by a value associated with the item termed its priority. Priority queues are useful when processing lists whose items can be associated with a value that indicates the order in which the items should be processed. In this implementation, priorities can be either strings or numerical values, and the order of sorting can be specified as either forward or reverse.

A random queue is a queue that orders new entries in a random fashion. This type of queue has use in simplifying the generation of data for transaction simulations, generating the order of certain types of search processing, and for implementing games.

A structure is a labelled list of data items. Structures are implemented by the creation of templates that contain the list of labels for elements of the structure. An instance of the structure template can then be initialized with data that may then be accessed by label. Since structures can contain structures, the hierarchical organization of information, and the creation of things like linked lists and transfer tables is made quite convenient.

In addition to the basic container objects, parameters for the individual commands allow the creation of things like circular buffers and fixed length service queues.

Requirements

This package makes use of the stubs interface to the Tcl programming language. To use the binary distributions you need to have Tcl/Tk 8.1 or later installed on your computer.

For UNIX users, the source distribution may be compiled for use with Tcl 8.0 and later releases. If you intend to use the extension with a release prior to 8.1 you will have to modify the make file.

Installing the package

For Windows environments, download the Containers 1.2 archive. Unpack the archive using an appropriate utility (such as unzip.exe) into your Tcl library directory. This will create a sub-directory named contain.12 that holds the Windows dynamic link library and the package index file for the extension. You can now use the extension by starting the Tcl shell and issuing the command:

package require Containers 1.2

There is a small Windows help file included with the distribution that explains how to use the package commands.

For UNIX use, download the source distribution archive. Unpack the archive using the command:

tar xvfz Containers-1.2-src.tgz

This will create the sub-directory Containers-1.2 that contains the source code for the extension. Read the file INSTALL.txt that is in this directory and follow the installation instructions.

Copyright and License

The entire contents of the Containers 1.2 distribution are Copyright(C) I.B.Findleton, 2001.

Permission is granted to use the package for private, non-commercial purposes. The resale of the package, or its use for any commercial purpose without the written permission of the author is prohibited. Redistribution of the package for any commercial purpose without the written permission of the author is prohibited.

Warranty

This software is provided without warranty of any kind. Use the package entirely at your own risk and expense. This software is developmental in nature and could possibly cause the loss of or damage to information on the computer on which it is installed. The author accepts no responsibility whatsoever for any loss or damage to you or your interests that may be caused by the use of this software. USE AT YOUR OWN RISK AND EXPENSE.