home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 344_02 / xitab.txt < prev    next >
Text File  |  1989-06-06  |  3KB  |  94 lines

  1. /* HEADER:       (cat #);
  2.    FILENAME:     XITAB.TXT;
  3.    SEE-ALSO:     itab.c, xtab.c;
  4.    AUTHOR:       Eric Horner;
  5. */
  6.  
  7. TEXT FILTERS FOR EXTRACTING AND REMOVING TAB CHARACTERS
  8. -------------------------------------------------------
  9.  
  10. INTRODUCTION
  11.         XTAB.COM was originally designed because I kept forgetting to
  12.     set the default tab setting to 8 when I was using AEDIT! There is a
  13.      facility within AEDIT to replace tabs with spaces (macro <detab>), but 
  14.     if you forget to use this before exiting AEDIT it's too late. XTAB will
  15.     replace tabs of a known width, so as to keep the format of the text 
  16.     the same as it was in the original editor.
  17.          The next problem was that my files grew considerably in size 
  18.     after "spacing out" the tabs, so I designed ITAB.COM to re-replace the 
  19.     spaces with tab characters of required width.
  20.         The two programs can conveniently be used together, called by
  21.     a batch file, to change a file from one tab setting to another, as 
  22.     shown in one of the examples below.
  23.  
  24.  
  25. COMMAND LINE - XTAB.COM
  26.  
  27.         xtab <input filename> <output filename> <tab width>
  28.  
  29.     <input filename> is the name of the original file, which will remain 
  30.     intact.
  31.  
  32.     <output filename> is the name of the new file to be created with no 
  33.     tab characters. NOTE: DO NOT USE THE SAME NAME AS THE INPUT FILE, 
  34.     instead, produce a new file, check it, then delete the original file 
  35.     and rename the new file.
  36.  
  37.     <tab width> is a number (1 to 20) which is the tab width that the 
  38.     original file was written under, which of course must be known, or can 
  39.     be found by intelligent guesswork, by filtering at different width 
  40.     settings until the file format looks good!
  41.  
  42.  
  43. COMMAND LINE - ITAB.COM
  44.  
  45.         itab <input filename> <output filename> <tab width>
  46.  
  47.     <input filename> is the name of the original file, which will remain 
  48.     intact.
  49.  
  50.     <output filename> is the name of the new file to be created, with 
  51.     spaces replaced by the optimum combination of spaces and tabs.  
  52.     NOTE: DO NOT USE THE SAME NAME FOR BOTH FILES.
  53.  
  54.     <tab width> is the setting desired for the new tab width (1 to 20), 
  55.     which in most cases will probably be 8!
  56.  
  57.  
  58. EXAMPLES
  59.  
  60.         xtab short.c long.c 4
  61.  
  62.     This would read file <short.c> and write it back out to file <long.c>,
  63.     after removing all tab characters, and replacing them with the correct
  64.     number of spaces to retain the original formatting, as produced with
  65.     tab width of 4. 
  66.         Note that this is not the same as just replacing tab
  67.     characters with 4 spaces, as the number of spaces written each time
  68.     depends on where each tab character falls relative to the ORIGINAL tab
  69.     fields! 
  70.  
  71.         itab long.c shorter.c 8
  72.  
  73.     This would read file <long.c> and write it back out to file <shorter.c>,
  74.     after replacing as many spaces as possible with tab characters, to give
  75.     a required tab field width of 8.
  76.  
  77.     The following sequence, which could be part of a batch file, would 
  78.     change the tab field width in the file <myfile.ext> from the original
  79.     setting of 4 to a new setting of 7 (???)
  80.  
  81.         xtab myfile.ext temp1.ext 4
  82.         itab temp1.ext temp2.ext 7
  83.         del myfile.ext 
  84.         del temp1.ext
  85.         rename temp2.ext myfile.ext
  86.  
  87.     Of course if a batch file were being used here, the filename 
  88.     <myfile.ext> would be passed as a replaceable parameter, and checks 
  89.     would have to be done to verify that each new file had been written,
  90.     before proceeding!
  91.  
  92. END OF XITAB.TXT                    ERIC HORNER, 6/6/89
  93.  
  94.