home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / utils / asmutl / id2id.lbr / ID2ID.DZC / ID2ID.DOC
Encoding:
Text File  |  1986-12-28  |  3.6 KB  |  73 lines

  1.     ID2ID - Rename identifiers in PASCAL, C, SPL and ASSEMBLY programs
  2.  
  3. ID2ID  (source,  target,  idpairs,  output) reads SOURCE and writes TARGET,
  4. replacing  all first identifiers listed in IDPAIRS with  the  corresponding
  5. second identifier.  An identifier begins with a letter, and continues until
  6. a  non-alphanumeric  character  is encountered.   The "_" is  considered  a
  7. letter for this purpose.  IDPAIRS contains lines consisting of
  8.  
  9. <original>,<new>
  10.                      identifiers.   When multiple identifier changes are to
  11. be made this is much faster than a long set of global editor  replacements,
  12. since  ID2ID  performs all changes in a single pass.   Suitable  choice  of
  13. names can convert an incomprehensible program into a meaningful one.
  14.  
  15. To execute, when the idpairs file has been prepared:
  16.  
  17.     d>ID2ID (source, target, idpairs)
  18.  
  19. using the parentheses as shown, and replacing the file names with those  to
  20. be used.  Any previous version of target will be destroyed. To use the .PCD
  21. version precede ID2ID by "RUNPCD ".
  22.  
  23. Upper  and lower case letters are treated as distinct.   Identifiers within
  24. Pascal (single) quoted strings, and within Pascal comments,  are unaltered.
  25. The double quote " also delimits comments, for use with code for Per Brinch
  26. Hansens Solo System.
  27.  
  28. If the first line in IDPAIRS is "$UPSHIFT" all identifiers are shifted into
  29. uppercase before use.  This has the side effect of translating the complete
  30. SOURCE file into upper case (outside of strings and  comments).   Similarly 
  31. an initial line of "$DOWNSHIFT" puts all identifiers in lower case.
  32.  
  33. An initial line of the form $ASM causes the string and comment  conventions
  34. to be suitable for Intel style assembly language (8080, Z80, 8086). In this
  35. case the characters "@" and "." are considered to be letters.   Strings are
  36. enclosed in double quotes " or single quotes ', and a ";" signals the start
  37. of a comment.
  38.  
  39. Similar language options are available with $C and $SPL, for C and SPL  (an
  40. algol like language for the HP3000).  For C comments are delimited by  "/*"
  41. and "*/", for SPL by "<<" and ">>", or from the word "comment" to  the next
  42. semicolon.
  43.  
  44. In  addition,  an  initial  line  of the form $FLIP  causes  the  following
  45. exchanges to be reversed, thus allowing any changes to be undone.
  46.  
  47.               Summary of $OPTIONS available (use only upper case)
  48.  
  49. $UPSHIFT      Upshift all identifiers
  50. $DOWNSHIFT    Downshift all identifiers
  51. $FLIP         Reverse sense of idpairs order (undo changes)
  52. $ASM          Input language is Assembly source
  53. $SPL          Input language is SPL source
  54. $C            Input language is C source
  55.  
  56. By default, the input language is Pascal and comments are delimited by "(*"
  57. and "*)", or by "{" and "}" (the two types nest,  unlike the ISO standard).
  58. Only a single language specifier may be used, and similarly only one of the
  59. shift options.  All options must precede the  actual idpairs in the idpairs
  60. file.
  61.  
  62. W A R N I N G - This system is case sensitive for id's.
  63.  
  64. ID2ID  reads  a file of IDPAIRS and builds an AVL-balanced binary  tree  of
  65. identifiers while checking for duplicates. It then reads the SOURCE program
  66. and  edits it to TARGET file by substituting identifiers found in the tree.
  67. A  final check is made for new identifiers which were already seen  in  the
  68. SOURCE, and a report may be generated on OUTPUT.
  69.  
  70. The system allows for the use of indentation codes in the source,  where an
  71. indentation code is the ascii DLE character,  followed  by chr(ord('  ')+n)
  72. where n is the number of spaces desired. 
  73. ║1