home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / tools / tooldrv / namechng.doc < prev    next >
Text File  |  1992-09-30  |  17KB  |  463 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8. N a m e C h a n g e r
  9. Version 2.0
  10. ───────────────────────────────────────
  11. User's Guide
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.                                 ┌───────┐
  23.                            ┌───────┐    │                (R)
  24.                          ──│       │    │───────────────────
  25.                            │  ┌───────┐ │  Association of
  26. ConVal Software, Inc.      │  │       │─┘  Shareware
  27.                            └──│   o   │    Professionals
  28.                          ─────│   |   │─────────────────────
  29.                               └───┴───┘    MEMBER
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42. N a m e C h a n g e r
  43. Version 2.0
  44. ───────────────────────────────────────
  45. User's Guide
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.                                 ┌───────┐
  57.                            ┌───────┐    │                (R)
  58.                          ──│       │    │───────────────────
  59.                            │  ┌───────┐ │  Association of
  60. ConVal Software, Inc.      │  │       │─┘  Shareware
  61.                            └──│   o   │    Professionals
  62.                          ─────│   |   │─────────────────────
  63.                               └───┴───┘    MEMBER
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74. Copyright 1991, 1992  ConVal Software, Inc.
  75. All rights reserved.
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84. This program is produced by a member of the Association of Shareware
  85. Professionals (ASP).  ASP wants to make sure that the shareware principle
  86. works for you. If you are unable to resolve a shareware-related problem with
  87. an ASP member by contacting the member directly, ASP may be able to help.
  88. The ASP Ombudsman can help you resolve a dispute or problem with an ASP
  89. member, but does not provide technical support for members' products.
  90.  
  91. Please write to the ASP Ombudsman at:
  92.  
  93.    ASP Ombudsman
  94.    545 Grover Road
  95.    Muskegon, MI  49442-9427
  96.    U.S.A.
  97.  
  98. or send a CompuServe message via CompuServe MAIL to ASP Ombudsman
  99. 70007,3536.
  100.  
  101. The ombudsman may be contacted by FAX by sending to the ASP FAX number:
  102. (616) 788-2765. In communication with the ombudsman please include a
  103. telephone number and/or FAX if available.
  104. TABLE OF CONTENTS
  105.  
  106.  
  107. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  6
  108.  
  109. Features of NameChanger  . . . . . . . . . . . . . . . . . . . . . . . .  7
  110.  
  111. Specifying the Files to be Examined. . . . . . . . . . . . . . . . . . .  8
  112.  
  113. Specifying the Naming Transform. . . . . . . . . . . . . . . . . . . . .  9
  114.  
  115. Getting Started. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
  116.  
  117. Notes and Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . 11
  118.  
  119.  
  120.                                                                     Page   6
  121.  
  122. Introduction
  123.  ──────────────────────────────────────
  124. ConVal Software supports software developers. It provides tools and services
  125. to assist throughout the life cycle of a software project.
  126.  
  127. NameChanger is a tool for changing names -
  128.  ■   to enable the porting of code that would not otherwise run on the
  129.      target platform (because of naming rules or collisions with existing
  130.      applications )
  131.  
  132.  ■   to allow easy conversion to one's current naming preference
  133.  
  134.  ■   to make source code naming style more compatible with Microsoft
  135.      Windows conventions
  136.  
  137.  ■   to make source code naming style more compatible with IBM's
  138.      OS/2 PM conventions
  139.  
  140. NameChanger changes filenames and other symbols, throughout an application -
  141. source code and documentation files as well. It intelligently scans a
  142. variety of languages to incorporate the renaming so you merely need to
  143. recompile.
  144.  
  145. The following discussion demonstrates the need for much more than just a
  146. global replacement tool to perform these tasks:
  147.  ■   On one platform long file names using mixed upper and lower case may be
  148.      OK, while the target platform may require shorter, all-uppercase. Thus
  149.      filenames themselves may require renaming.
  150.  
  151.  ■   The filename "BONUS.COB" probably contains a COBOL subroutine named
  152.      "BONUS".  Other files probably contain references to the subroutine,
  153.      for example, CALL 'BONUS' USING and also documentation about the
  154.      "BONUS" subroutine. So internal references must obviously be changed
  155.      too.
  156.  
  157.  ■   If the filename "ART" is to be changed to XXXART then an occurrence of
  158.      PART-TYPE in a COBOL file could become PXXXART-TYPE. This change is
  159.      definately not desired!
  160.  
  161.  ■   If the filename "ADDIT" is to be changed to XXXADDIT then Start Addit
  162.      in a SQL file could be missed because of the case mismatch.
  163.  
  164.  ■   If the lengths of the source-text and replacement-text are different,
  165.      then text could be shifted. This matters when we're already at the line
  166.      length limit or in files with a fixed format. E.G.  the "free-form"
  167.      area of COBOL or FORTRAN and the sequence (or identification) area in
  168.      columns 73-80.
  169.  
  170. NameChanger meets these needs!
  171.  
  172.                                                                     Page   7
  173.  
  174. You may wish to use NameChanger to allow you to change your internal naming
  175. conventions to, say, the Hungarian notation, coined by Charles Simonyi of
  176. Microsoft. The notation requires a lower case prefix that describes data
  177. type, followed by a variable name whose first letter is capitalized. Some
  178. prefix examples are:
  179.  
  180. ───────────────────────────────────────────────
  181.  b    -    boolean (0 or 1, usually an int)
  182.  c    -    character
  183.  i    -    int
  184.  l    -    long
  185. ───────────────────────────────────────────────
  186.  
  187. For example: iHeapStatus is an integer variable whose name is HeapStatus.
  188. This convention is used widely by MS-Windows and OS/2 programmers. The
  189. NameChanger utility will enable you to readily change your naming
  190. convention.
  191.  
  192. On mainframes where many applications share a production environment like
  193. CICS and IMS, naming collisions must be avoided. Use NameChanger on your
  194. product to make it conform to your potential client's needs. It could give
  195. you a sale you'd miss otherwise!
  196.  
  197. Features of NameChanger
  198.  ──────────────────────────────────────
  199. NameChanger reads a list of text files and makes a copy of each with its
  200. symbols altered according to a symbol rename list. This version has special
  201. processing logic for supporting the syntax of the following file types:
  202.  
  203. Table 1: File types automatically supported
  204.  
  205.  FILE
  206.  EXTENSION      CATEGORY
  207.  ──────────────────────────────────────
  208.  .BAS           BASIC
  209.  .BAT           Batch Files
  210.  .C   .CPP      C and
  211.  .H   .HPP        C++ source
  212.  .CBL .COB      COBOL
  213.  .FOR           FORTRAN
  214.  .ASM           Macro Assembler
  215.  .MAK           Make files
  216.  .SQL .INP      Oracle
  217.  .PAS           Pascal
  218.  .PLI           PL/I
  219.  .REX           REXX
  220.  .DOC .TXT      Text (ASCII)
  221.  .PRG           xBASE
  222.  ──────────────────────────────────────
  223.       All other types are processed as if they were ASCII text files.
  224.  
  225. So NameChanger is a language and context-sensitive tool for changing naming
  226. conventions.
  227.                                                                     Page   8
  228.  
  229. You will prepare a control file, called the file specification list,
  230. containing a list of files to be processed. Or, you may use a utility,
  231. CRE8FSL (see Page 9), to create a list of all files on a directory
  232. matching one of the file types in Table 1.
  233.  
  234. You'll prepare a second control file, called the symbol rename list, with
  235. each line containing an "old name" a "new name" and a flag to tell whether
  236. the search for the old name is to be case sensitive.
  237.  
  238. When you invoke the NameChanger program, you will specify a directory where
  239. the files containing the transformed symbols will be written. (Your files
  240. will not be changed in place!)
  241.  
  242. Specifying the Files to be Examined
  243.  ─────────────────────────────────────
  244. A File Specification List (FSL) file identifies to NameChanger the files to
  245. be read. It is a text file and may be created with any text editor. Each
  246. line must start in column one and contain exactly three columns - Line
  247. format, Maximum line length, and File specification. Place one or more
  248. spaces between the three columns.
  249.  
  250.  line format -       F    "Fixed length lines" Each line of the file is
  251.                            the same length.
  252.  
  253.                      V    "Variable length lines" The length of the lines
  254.                           may be different.
  255.  
  256.  Maximum line length -    For fixed length lines, this is the actual
  257.                           length of each input line in this file.
  258.  
  259.                      For variable length lines this is the maximum length
  260.                      to be written for any given input line after
  261.                      transforming symbols.
  262.  
  263.                      The maximum line length must be <= 256.
  264.  
  265.  File specification -          A DOS file specification.
  266.  
  267. Examples:
  268.  
  269.      V 100 C:\SOURCE\MAINPGM.C
  270.      V 100 C:\SOURCE\INCLUDE\INFILE.H
  271.      V 120 D:\SAMPLES\DEMO01.TXT
  272.      F 80  C:\COBOL\TEST1.COB
  273.      F 80  C:\FORTRAN\MYPROG.FOR
  274.  
  275. By listing all files in the File Specification List you will insure that the
  276. renaming is complete.  
  277.                                                                     Page   9
  278.  
  279. To ease the effort in preparing this file, a utility called CRE8FSL is
  280. provided for you. Given a directory, it will read all files in that
  281. directory, writing each filename matching a file type in Table 1.
  282.  
  283. Example 1:     This causes CRE8FSL to create a list of all files in
  284.                directory C:\SOURCE with file extensions in Table 1 and write
  285.                them to NAMEC.FSL.
  286.  
  287.       CRE8FSL C:\SOURCE NAMEC.FSL
  288.  
  289. Example 2: This causes CRE8FSL to create a list of files on the C root
  290.            directory.
  291.  
  292.       CRE8FSL C: NAMEC.FSL
  293.  
  294. Example 3: This causes CRE8FSL to create a list of all files on three
  295.            different directories (and different drives)
  296.  
  297.       CRE8FSL C:\BASELINE     C.LST
  298.       CRE8FSL D:\CHANGES1     D1.LST
  299.       CRE8FSL D:\CHANGES2     D2.LST
  300.       COPY C.LST+D1.LST+D2.LST     NAMEC.FSL
  301.  
  302. Specifying the Naming Transform
  303.  ──────────────────────────────────────
  304. We need to define the renaming rules.  This input to NameChanger is a Symbol
  305. Rename List (SRL) file. It contains the rules to be followed in changing
  306. "old symbols" to "new symbols".
  307.  
  308. Use a text editor to create this file. Start each entry in column one and
  309. place exactly three columns on each line - Case code, Old symbol and New
  310. symbol.
  311.  
  312. Case code      - I  when your want NameChanger to look for the Old symbol
  313.                     regardless of the case of each letter. (both comparands
  314.                     are raised to upper case before the comparison)
  315.  
  316.                - S  when you want NameChanger to have an exact match on the
  317.                     Old symbol before it will replace it with New symbol.
  318.  
  319. Old symbol     One to 31 characters. A valid symbol for the language being
  320.                scanned. For case code I, this may be entered without regard
  321.                to case. (It doesn't matter how you enter this.) For case
  322.                code S, enter the old symbol in upper/lower case.  The
  323.                symbol will be replaced only when matched exactly.
  324.  
  325. New symbol     One to 31 characters. A valid symbol for the language being
  326.                examined. The case of this entry is important, since this
  327.                will be used as-is when making replacements.
  328.                                                                     Page  10
  329.  
  330. Example:  Change "CALCDIST" to "Calculate_distance" regardless of case.
  331.           (So Calcdist, CaLcDisT, and CALCDIST would all be transformed)
  332.           Change "Help_A" to "HelpEditError" but perform case-sensitive
  333.           matching. Change "RNDVAL", to "RandomNumber" performing
  334.           case-sensitive matching.
  335.  
  336.           I  CALCDIST              Calculate_distance
  337.           S  Help_A                HelpEditError
  338.           S  RNDVAL                RandomNumber
  339.  
  340. Getting Started
  341.  ──────────────────────────────────────
  342. Prior to running NameChanger, create the list of files to be examined (see
  343. Page 8) and the symbol rename list (see Page 9). The program requires
  344. CONFIG.SYS to contain FILES=20, or more.
  345.  
  346. The general command line syntax for running NameChanger is:
  347.        NAMEC  [?] /OUTDIR=xxx  [fsl  srl  msg]
  348.  
  349. where
  350.  
  351.      ?         is used to request help with using NameChanger.
  352.      xxx       is a path identifying where to put the output files after
  353.                the renaming.  Note: The output files from the processing
  354.                must not already exist in this directory.
  355.  
  356.      fsl       is a file specification for the input file containing file
  357.                specifications for each source to be processed. If omitted,
  358.                this defaults to NAMEC.FSL.
  359.  
  360.      srl       is a file specification for the input file containing the
  361.                symbol rename list.  If omitted, this defaults to NAMEC.SRL.
  362.  
  363.      msg       is a file specification for the output file of run
  364.                statistics. If omitted, this defaults to NAMEC.MSG.
  365.  
  366. Example 1: Take all the defaults.
  367.  
  368.       NAMEC /OUTDIR=C:\TEMP
  369.  
  370.    The two control files (NAMEC.FSL and NAMEC.SRL) must be in the current
  371.    directory. This will read file specifications from NAMEC.FSL and will
  372.    get the symbol rename list from NAMEC.SRL. Messages will be output to
  373.    NAMEC.MSG.  The copies of the renamed files will be generated to the
  374.    C:\TEMP directory. This directory must already exist and none of the
  375.    files to be generated must exist (as a safety precaution).
  376.                                                                     Page  11
  377.  
  378.  
  379. Example 2: Override the location and naming of the control and message
  380.            files.
  381.  
  382.       NAMEC  /OUTDIR=D:\NEWNAMES  C:\FILESPEC.LST  OLDNEW.CTL
  383.           MESSAGE.LST
  384.  
  385.      Here files will be written to the D: drive in the NEWNAMES directory.
  386.      Also, the standard file names and locations have been overridden.
  387.  
  388.      Although the above is shown as two separate lines, you would type it
  389.      all in at the DOS prompt and press enter once.
  390.  
  391. NOTE: All parameters are positional. So, to override the last one, you must
  392. supply the defaults for the others. That is, none may be omitted prior to
  393. the one you wish to override.
  394.  
  395. Notes and Restrictions
  396.  ──────────────────────────────────────
  397.  1.   The input files must be text files with each line terminated by a line
  398.       feed alone or a carriage return and line feed.
  399.  
  400.  2.   COBOL, FORTRAN, and PL/I are assumed to be fixed length, 80 character
  401.       lines.
  402.  
  403.       Data in columns 1-7 and 73-80 of CBL and COB, 1-6 and 73-80 of FOR,
  404.       and 73-80 of PLI file types is copied as is. No symbol translation is
  405.       used for these ID, sequence and comment columns.
  406.  
  407.  3.   If you get the message "Insufficient memory", try reducing the scope
  408.       of the processing.  This may mean limiting the file specification list
  409.       (FSL) entries to only those files used by your application and/or
  410.       limiting the symbol rename lists (SRL) entries and making multiple
  411.       passes to rename all symbols.
  412.  
  413.  4.   Only the first 31 characters of a symbol are retained.
  414.  
  415.  5.   Filenames and symbols must be consistent with the symbol naming
  416.       convention for each source file type.
  417.  
  418.       So the restriction means that if the following is a fragment from a .C
  419.       file, a renaming would not be performed for items c and d below, even
  420.       though these are valid DOS file names. This is because the names are
  421.       not valid C symbols.
  422.  
  423.       a.   avg_value = get_avg ( list );           OK
  424.       b.   fp = fopen ( "C:\\TEST.dat", "r" );     OK
  425.       c.   fp = fopen ( "87tax.dat", "w" );        starts with a digit
  426.       d.   strcpy ( fspec, "A:$budget.trn" );      starts with $
  427.  
  428.                                                                     Page  12
  429.  
  430.  6.   If a filename to be processed is also a language keyword you use (like
  431.       extern.bat if you use C) then all occurrences of that symbol
  432.       (extern in this case) will become uppercase in all the C files
  433.       processed. So exclude files like this from NameChanger processing or
  434.       rename them first.
  435.  
  436.  7.   String literals may contain tokens of no more than 99 characters each.
  437.  
  438.  8.   Whenever a symbol is replaced by a longer symbol and there are
  439.       sufficient trailing blanks on a statement, then the replacement will
  440.       occur on the same statement. But when no more space is available on
  441.       the current statement, a new statement will be created. You will be
  442.       notified of this by a message that "statement number nnn had to be
  443.       split". Since this process duplicates the sequence number field of the
  444.       original statement, you may need to make manual changes in these
  445.       cases.
  446.  
  447.  9.   In a single invocation of NameChanger, the filenames in the file
  448.       specification list (FSL) must be unique. Thus MYPGM.C and MYPGM.TXT
  449.       cannot be processed in the same run.
  450.  
  451.  10.  For variable length file types, trailing blanks on lines are not copied
  452.       to the output.
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.           End of NameChanger Documentation.
  461.  
  462.  
  463.