home *** CD-ROM | disk | FTP | other *** search
- ID2ID - Rename identifiers in PASCAL, C, SPL and ASSEMBLY programs
-
- ID2ID (source, target, idpairs, output) reads SOURCE and writes TARGET,
- replacing all first identifiers listed in IDPAIRS with the corresponding
- second identifier. An identifier begins with a letter, and continues until
- a non-alphanumeric character is encountered. The "_" is considered a
- letter for this purpose. IDPAIRS contains lines consisting of
-
- <original>,<new>
- identifiers. When multiple identifier changes are to
- be made this is much faster than a long set of global editor replacements,
- since ID2ID performs all changes in a single pass. Suitable choice of
- names can convert an incomprehensible program into a meaningful one.
-
- To execute, when the idpairs file has been prepared:
-
- d>ID2ID (source, target, idpairs)
-
- using the parentheses as shown, and replacing the file names with those to
- be used. Any previous version of target will be destroyed. To use the .PCD
- version precede ID2ID by "RUNPCD ".
-
- Upper and lower case letters are treated as distinct. Identifiers within
- Pascal (single) quoted strings, and within Pascal comments, are unaltered.
- The double quote " also delimits comments, for use with code for Per Brinch
- Hansens Solo System.
-
- If the first line in IDPAIRS is "$UPSHIFT" all identifiers are shifted into
- uppercase before use. This has the side effect of translating the complete
- SOURCE file into upper case (outside of strings and comments). Similarly
- an initial line of "$DOWNSHIFT" puts all identifiers in lower case.
-
- An initial line of the form $ASM causes the string and comment conventions
- to be suitable for Intel style assembly language (8080, Z80, 8086). In this
- case the characters "@" and "." are considered to be letters. Strings are
- enclosed in double quotes " or single quotes ', and a ";" signals the start
- of a comment.
-
- Similar language options are available with $C and $SPL, for C and SPL (an
- algol like language for the HP3000). For C comments are delimited by "/*"
- and "*/", for SPL by "<<" and ">>", or from the word "comment" to the next
- semicolon.
-
- In addition, an initial line of the form $FLIP causes the following
- exchanges to be reversed, thus allowing any changes to be undone.
-
- Summary of $OPTIONS available (use only upper case)
-
- $UPSHIFT Upshift all identifiers
- $DOWNSHIFT Downshift all identifiers
- $FLIP Reverse sense of idpairs order (undo changes)
- $ASM Input language is Assembly source
- $SPL Input language is SPL source
- $C Input language is C source
-
- By default, the input language is Pascal and comments are delimited by "(*"
- and "*)", or by "{" and "}" (the two types nest, unlike the ISO standard).
- Only a single language specifier may be used, and similarly only one of the
- shift options. All options must precede the actual idpairs in the idpairs
- file.
-
- W A R N I N G - This system is case sensitive for id's.
-
- ID2ID reads a file of IDPAIRS and builds an AVL-balanced binary tree of
- identifiers while checking for duplicates. It then reads the SOURCE program
- and edits it to TARGET file by substituting identifiers found in the tree.
- A final check is made for new identifiers which were already seen in the
- SOURCE, and a report may be generated on OUTPUT.
-
- The system allows for the use of indentation codes in the source, where an
- indentation code is the ascii DLE character, followed by chr(ord(' ')+n)
- where n is the number of spaces desired.
- ║1