Dec 232017
A Turbo Pascal preprocessor, like C's!.
File TSHELL10.ZIP from The Programmer’s Corner in
Category Pascal Source Code
A Turbo Pascal preprocessor, like C’s!.
File Name File Size Zip Size Zip Type
EXAMPLE.PAS 1627 699 deflated
TPP.COM 18566 12643 deflated
TSHELL.COM 22593 14836 deflated
TSHELL.DOC 7662 2463 deflated

Download File TSHELL10.ZIP Here

Contents of the TSHELL.DOC file


Turbo Pascal Preprocessor Shell

Version 1.0 (14-Mar-87)

Copyright (C) 1987 by Samuel H. Smith; All Rights Reserved.

You may copy and distribute this program freely, provided that:
1) No fee is charged for such copying and distribution, and
2) It is distributed ONLY in its original, unmodified state.

if you like this program, and find it of use, then your
contribution of $10 will be appreciated.

Please refer all inquiries to:
S. H. Smith
5119 N. 11th Ave 332
Phoenix, AZ 85013

This program allows you to use a number of C-like preprocessor
statements in a Turbo Pascal source file. It interprets the
statements and passes the processed text on to the Turbo compiler
for further processing.

The TSHELL program will load TURBO.COM into memory, install the
preprocessor shell, and enter the Turbo main menu. At this point,
Turbo Pascal can be used as always, except that the new
preprocessor commands can be used in any source file.

To start a Turbo Pascal session with the preprocessor shell, enter:
on the DOS command line.

A stand-alone (batch) version of the preprocessor is also
available. A single turbo source file can be preprocessed and
written to another file with this command:
TPP >file.out
This command reads, preprocesses it and writes the result
to file.out. This command is useful when you want to convert a
file that uses the TSHELL preprocessor back into a normal Turbo
Pascal source.


The following C preprocessor directives are understood:

#define NAME STRING ;replace all instances of NAME with STRING

#undef NAME ;delete definition of NAME

#ifdef NAME ;compile only if NAME is defined

#ifndef NAME ;compile if NAME is not defined

#else ;compile otherwise

#endif ;resume normal compilation

#pragma NOEXPAND ;do not expand #defines in following lines

#pragma EXPAND ;resume #define expansion

#pragma LIST ;list preprocessed lines to screen

#pragma NOLIST ;stop listing

#include ;include another file

The following special keywords are predefined:

SYSTEM_DATE ;the time/date when compile was started

LAST_UPDATE ;last modification time of current file

CURRENT_FILE ;name of current file

Note that keyword replacement takes place only when the keyword in
the source is surrounded by delimiters. A replacement will not
take place if the keyword is preceeded or followed by a number or a
letter. This preprocessor WILL make replacements within literals
and comments - beware!

Preprocessor commands

Preprocessor commands must be alone on a line. Indentation is
allowed, but there cannot be a space between the '#' and the
command keyword.

This command arranges for any future instances of NAME to be
replaced by REPLACEMENT.

This command has two main uses:
1. to provide a simple macro replacement facility, and
2. to control conditional compilation (in conjunction with
the #ifdef and #ifndef commands).

#undef NAME
Remove any definition of NAME.

#ifdef NAME
If NAME has been defined with #define, the following code will
compile as normal. Otherwise, the following code will be
excluded from the compilation. Normal compilation resumes with
an #endif statement. For example:

fast_display(x,y,'display data');
writeln(con,'display data');

#ifndef NAME
Like #ifdef but compiles code if the NAME has NOT been defined.

Used with #ifdef to provide alternative code for cases where
the keyword is not defined.

Terminates a #ifdef block of code and resumes normal

#pragma NOEXPAND
This command stops macro expansion. It is used in cases where
macro expansion is not desired. This also speeds up
compilation by eliminating the need to scan each line for

#pragma EXPAND
This command resumes normal expansion of macros.

#pragma LIST
This command causes the source code to be listed to the screen
after macro expansion had taken place.

#pragma NOLIST
This command disables the source listing.

This command is passed on to turbo pascal as
{$I file}
where it is processed as usual. A future version of TSHELL
might implement nested include files through this command.

Predefined keywords

This keyword will be replaced with the time and date when the
compile was started. It has the form: dd-mmm-yy hh:mm:ss.

This keyword will be replaced with the last update date of the
current source file.

This keyword will be replaced with the full pathname of the
current source file.

Program requirements and limitations

Version 1.0 of TSHELL works only with Turbo Pascal version 3.01a.
Future releases will work with more versions of Turbo. Note that
since TPP does not use TURBO.COM, it works with any version of
Turbo Pascal.

Memory used: About 50k of RAM, in addition to
that normally used by TURBO.COM.

Number of #define's: 100 different keywords can be

Maximum keyword length: Keywords can be up to 30 characters
in length. Keywords must follow
the same conventions as Turbo
Pascal identifiers.

Maximum replacement length: Replacement strings can be up to 70
characters long. Note that the
line length after macro expansion
cannot exceed 128 characters. This
limit is imposed by Turbo Pascal.

#ifdef nesting: #ifdef and #ifndef statements can
be nested up to 10 levels.

#include nesting: #include statements are still
handled by Turbo Pascal and cannot
be nested. A future version of
TSHELL will allow include file

 December 23, 2017  Add comments

Leave a Reply