The TADS Alternate Library
Version 2.0


Copyright 2000 by Kevin Forchione.
This is part of the TADS Alternate Library Authors Manual.

Introduction and Table of Contents



The alternate library adopts a component approach to its library files. This means that a file will contain a single function, class, or object definition, which are then stored in a corresponding directory (The exception to this are the grammar files, which contain both class and object definitions.) This allows an author to include only those files s/he requires, and add basic functionality by modifying header files.


A typical definition follows:




//  ALT Library File: Item 000318


//  Copyright (c) 2000 Kevin Forchione. All rights reserved.

//  Based on ADV.T (c) and STD.T (c) Michael Roberts.


//  This file is part of the ALT replacement library for ADV.T and

//  STD.T and requires TADS 2.5.1 or later.




#ifndef _ITEM_H_

#define _ITEM_H_


#include <thing.h>


#pragma C+



 *  Item: Thing


 *  A basic Item which can be picked up by the player.  It has no weight

 *  (0) and minimal bulk (1).  The weight property should be set

 *  to a non-zero value for heavy objects.  The bulk property

 *  should be set to a value greater than 1 for bulky objects, and to

 *  zero for objects that are very small and take essentially no effort

 *  to hold---or, more precisely, don't detract at all from the player's

 *  ability to hold other objects (for example, a piece of paper).


class Item: Thing

    weight = 0

    bulk = 1



#pragma C-


#endif /* _ITEM_H_ */


The comment box at the top contains the name of the definition as well as a serial number (in yymmdd format) for the file. Following that a check is made using precompiler symbols to determine if the file has been previously #included. If not then we #include it in our source.


Using Enforcing #includes


Following #ifndef and #define will be any #includes required by the file for compilation. Any class, object, or function referenced in the definition should be listed as an #include. This helps to insure that modules that work together are compiled together. In the example above, thing.h must be present in the compilation in order to compile item.h because Item inherits from Thing.


C-style operators


Alt uses TADS C-style operators. But Alt does not require an author to use C-style operators. Each file sets the compilation to use C-style operators via the #pragma C+ precompiler statement and then returns compilation to the TADS default via the #pragma C- precompiler statement.