home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
PASCAL
/
UPCONV22.ZIP
/
UPCONV.DOC
< prev
next >
Wrap
Text File
|
1991-09-06
|
15KB
|
290 lines
█ █ ▄▀▀▀▀▀▀▀▄ Turbo Pascal case converter version 2.2
█ █ █ (c) Copyright 1991 by J.W. Pluimers
█ █ █
█ █ █▀▀▀▀▀▀▀▄ █ ▄▀▀▀▀▀▀▀▄ █▀▀▀▀▀▀▀▄ █ █
█ █ █ █ █ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █
█ █ █ █ █ ▄ █ █ █ █ █ █
▀▀▀▀▀▀▀ █▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀ ▀ ▀ ▀
█
█ For information on other products : P.S.O.
█ P.O. Box 266
█ 2170 AG Sassenheim
The Netherlands
Introduction
------------
UpConv is a case conversion program designed for Turbo Pascal
versions 3.0 to 6.0 and TPW 1.0, which can easilly be adapted to
newer versions of Turbo Pascal.
Case conversion is the process of reformatting identifiers in
pascal source code to some predefined way. Borland international is
very consistent in their manuals, all the identifiers are lower case,
all other identifiers have some predefined case convention (mostly
lower case with the first letters of words to upper case).
Because is is very likely that you have your own style of case
convention (for example, use all upper case) and you want to have other
source code in that format as well, UpConv has been developed. It reads
pascal files (not only Turbo Pascal) and writes new reformatted files
with all identifiers according to the case convention you desire.
Options
-------
The usage of UpConv has been kept very simple, and a summary is
shown when you type UpConv without any parameters or with the -? or
-h switch.
UpConv can read any text file (you can even specify wildcards to
specify many files at once), but output files have the extension .FMT.
Just like the Turbo Pascal compiler only outputs .EXE files.
You can choose whether or not the output files will be overwritten
when they exist already, the default is to skip those files.
Reformatting actions on input files consists of two main areas;
case conversion and comment parsing.
Case conversion can be done on four catagories of words :
- reserved words
- compiler directives
- Borland identifiers
- user identifiers
For each you can select what to :
- convert to upper case
- convert to lower case
- convert the first character to uppercase
- do not convert
- convert according to identifier table
Combinations of the above are allowed, and are summarized in a
table below for reference.
A very nice feature of UpConv is the possiblity not to ignore
comment tokens (these { } and (* *) tokens are ways to add comments
or disable source text). It is possible to temporarily comment out
source text, which will still be reformatted. The default setting is
to parse source text between (* and *) tokens, but the exact way can
be selected from the command line. Comments between braces { and }
can be processed too, but this option is left off by default. Be
warned if you reformat a file that contains real comments between (*
and *), some text may look pretty weird afterward!
Usage
-----
The command line usage is kept very simple, and the default
settings are convenient for most people. Above all, you can
reconfigure the identifier table and command line options with
UpConfig (see below).
The command line can consists of file names and switches,
the switches come before file names on which they act. File names
can consist of wildcards (both * and ? are allowed) which means that
a whole bunch of files can be processed at once. Each file name is
being converted into the same file with the extension .FMT (ForMaT).
The syntax then is as follows :
┌────────────────────────────────────────────────────────────────────┐
│ │
│ UpConv [switch...] sourcefile [[switch...] [sourcefile]...] │
│ │
└────────────────────────────────────────────────────────────────────┘
Each switch can consist of actions (optionally followed with the
object on which they apply) and options. Both are case insensitive
and can start either with - or /.
┌─────────────────────────────────────────────────────────────────────┐
│ │
│ switch = [action[apply...]] [option...] │
│ │
└─────────────────────────────────────────────────────────────────────┘
There are two kinds of actions. The first kind determines what
to do with identifiers, the second kind tells the program if and how
comments are parsed.
┌────────────────────────────────────────────────────────────────────┐
│ Identifier actions/applies : │
│ │
│ action apply │
│ │
│ -u Convert to upperCase. r Reserved words. │
│ -l Convert to lowerCase. b Borland identifiers. │
│ -f UpperCase first character. u User identifiers. │
│ -n Do not convert. d Compiler directives. │
│ -x Default settings. none Apply to all above. │
└────────────────────────────────────────────────────────────────────┘
┌────────────────────────────────────────────────────────────────────┐
│ Comment actions/applies : │
│ │
│ action apply │
│ │
│ -e Enable comment parsing. p Parenthese comments. │
│ -d Disable comment parsing. b Brace comments. │
│ none Both comments. │
└────────────────────────────────────────────────────────────────────┘
Last, but not least, there are two options that determine the
behavior of UpConv if a destination file exists.
┌────────────────────────────────────────────────────────────────────┐
│ Options : │
│ │
│ -o Overwrite destination files. │
│ -s Skip existing destination files. │
└────────────────────────────────────────────────────────────────────┘
For actions and applies it is possible to combine one or more
applies of an action, just type in the action letter followed with
the applie letters. For example :
┌────────────────────────────────────────────────────────────────────┐
│ UpConv -urb IOLIB.PAS │
│ │
│ - converts IOLIB.PAs into IOLIB.FMT │
│ - changes reserved words and Borland identifiers to uppercase │
│ - changes the compiler directives to the form in the table │
│ - changes user identifiers to the first identifier found │
└────────────────────────────────────────────────────────────────────┘
It is also possible to specifie more actions on the same
identifier, just type two action switches with the same applies :
┌────────────────────────────────────────────────────────────────────┐
│ UpConv -ld -fd GRDEMO.PAS │
│ │
│ - converts GRDEMO.PAS into GRDEMO.FMT │
│ - changes compiler directives to lowercase with the first letter │
│ uppercased │
│ - changes reserved words and Borland identifiers to the format │
│ of the conversion table │
│ - changes user identifiers to the first identifier found │
└────────────────────────────────────────────────────────────────────┘
As a reference the next table comes in handy, it describes what
combination of actions gives what results on the source code.
Note that the actions are not reset to default values when a new
group of files is being converted!
┌───────────────────────────────────────────────────────────────────┐
│ Combined action result table : │
│ │
│ State now │ New action │
│ ──────────┼──────────────────────────────────────────────────── │
│ │ Table UpCase LoCase First Nothing │
│ ──────────┼──────────────────────────────────────────────────── │
│ Table │ Table UpCase LoCase FTable Nothing │
│ LoCase │ Table UpCase LoCase FLoCase Nothing │
│ UpCase │ Table UpCase LoCase UpCase Nothing │
│ First │ Table UpCase FLoCase First Nothing │
│ FLoCase │ Table UpCase FLoCase FLoCase Nothing │
│ FTable │ Table UpCase FLoCase FTable Nothing │
│ Nothing │ Table UpCase LoCase First Nothing │
│ │
│ Legenda: │
│ │
│ State │ Conversion │
│ ──────────┼──────────────────────────────────────────────────── │
│ Table │ according to table │
│ LoCase │ to lowercase │
│ UpCase │ to uppercase │
│ First │ first letter to uppercase │
│ FLoCase │ to lowercase, then uppercase first character │
│ FTable │ according to table, then uppercase first character │
│ Nothing │ do not convert │
└───────────────────────────────────────────────────────────────────┘
Inspection of the above table reveals that some options can't be
set at once by command line switches. FLoCase and FTable need two
switches to bee set.
UpConfig
--------
Real programms mean nothing without configuration
possibillities, so even UpConv has it's own configuration program :
UpConfig.
UpConfig can configure the UpConv utilitie at two sides; it can
modifie the built-in identifier table and it can change the default
command-line switches. Both processes are done at the same time, so
you can't change one without the other.
The syntax of UpConfig is essentially the same, except that no
file names can be issued, it always reads the identifier table from
UPCONV.TXT and configures UPCONV.EXE. Perhaps this changes in a
future release, but configuration won't be issued very much, so this
is all it can at this moment.
Because you must have access to the default identifier table in
order to extent it, the original file - the file with which UpConv
has been compiled - is in the file UPCONV.TXT. Many efforts have
been made to keep this table up to date, and it contains all
identifiers found in the MS-DOS versions of Turbo Pascal 3.0 to
Turbo Pascal 5.5. All compiler files and Turbo Pascal units have
been checked to make this table as complete as possible, but there
is still a chance that a few are missing. When you find such an
identifier, please contact the address above so a new update can be
made.
Note that no CP/M identifiers (like BDOS) are contained as this
version of UpConv only works on MS-DOS machines.
Disclaimer & License
--------------------
This software and documentation is supplied to you "AS IS"
without any representation or warranty of any kind, either expressed
or implied, including, but not limited to, the implied warranties of
quality, performance, merchantabilty and fitness for a particular
purpose.
In no event will Jeroen W. Pluimers be liable for any damages,
either direct, indirect, special, incidental or consequential,
caused by the use, or inability to use, these programms, even if
Jeroen W. Pluimers has been advised of the possibility of such
damages. In particular, Jeroen W. Pluimers shall have no liablility
for any files manipulated with this software, including costs for
receovering damage possibly caused by it.
You, the licensee agree with the statements in the disclaimer
and license section of this document by reading any part of it or
using the product and you are assuming the entire risk as to quality
and performance of software or documentation.
With this software and documentation, you may :
- use the program on only one machine at any one time
- make copies of the software and dosumentation only for backup
or modifiaction purposes ONLY in support of your authorized use
- modify and/or merge the software and or documentation only in
suppoert of you authorized use.
but you may not :
- use, copy, modify, merge or transfer copies of the software
or documentation except as noted in this section
- reverse assemble, reverse engineer, or reverse compile the
software without prior permission of Jeroen W. Pluimers
- sublicense, rent, lease or assign the software or
documentation or any copy of it.
For any questions, site-licenses, custom-versions, please contact
the address at the top of this document.