home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 June / SIMTEL_0692.cdr / msdos / txtutl / dgarbage.arc / DGARBAGE.DOC next >
Encoding:
Text File  |  1988-05-10  |  15.8 KB  |  358 lines

  1.                              DGARBAGE VERSION 1.1
  2.                              -------------------- 
  3.  
  4.  
  5.                                   DISCLAIMER 
  6.                                   ---------- 
  7.  
  8.          This program is provided as is and I accept no responsibility 
  9.          for  any  loss  or damage of any files or data  that  may  be 
  10.          caused  by  using  this  program.  I  have  performed  fairly 
  11.          extensive testing of the program, but it is not possible  for 
  12.          me  to  exhaustively test every potential situation.  If  the 
  13.          data in the file you wish to process is important to you then 
  14.          make  a copy of the file and process that. I have  never  had 
  15.          any  problems  with  the input file during  my  testing,  but 
  16.          anything is possible. 
  17.  
  18.          Once again, I AM NOT RESPONSIBLE IN ANY WAY FOR ANYTHING. 
  19.          (Or as my mother always says, I am totally irresponsible). 
  20.  
  21.  
  22.  
  23.  
  24.                                  INTRODUCTION
  25.                                  ------------
  26.  
  27.          This  utility program removes all non - printable  characters 
  28.          from  an ASCII text file and restricts the line length  to  a 
  29.          specified  maximum number of characters. It was  designed  to 
  30.          remove the "line noise" characters from capture files made by 
  31.          a communications program on line to a bulletin board. 
  32.  
  33.          The  text is read from a file specified on the  command  line 
  34.          and the resulting text after processing is output to a second 
  35.          file,  the  name of which is also specified  on  the  command 
  36.          line.  The  original  file is  left  untouched  which  allows 
  37.          multiple  processing  with different options  set  until  the 
  38.          desired result is achieved. 
  39.  
  40.          All  characters with an ASCII value less than  32,  excepting 
  41.          ASCII  10  (Line  Feed) and ASCII 13  (Carriage  Return)  are 
  42.          removed  from  the text. By default, all characters  with  an 
  43.          ASCII  value of greater than 127 are also  removed,  although 
  44.          this  can be changed by command line options so  that  either 
  45.          the  character  is  converted to a  seven  bit  character  by 
  46.          stripping the eighth bit, or is left entirely unchanged. 
  47.  
  48.  
  49.  
  50.  
  51.                                      USAGE
  52.                                      -----
  53.  
  54.  
  55.          The syntax for the command is:- 
  56.  
  57.          DGARBAGE infile outfile (options) 
  58.  
  59.          Infile   and   outfile  MUST  be  specified   -   they   are, 
  60.          respectively,  the  file  containing  the  raw  text  to   be 
  61.          processed  and  the  file  that  will  hold  the  text  after 
  62.          processing.  
  63.  
  64.          Infile  must exist and must either be present in the  current 
  65.          directory  or must have an appropriate path prefixed to  it's 
  66.          name; e.g.:- 
  67.  
  68.          DGARBAGE  file1  file2  
  69.          (if the file is in the current directory) 
  70.  
  71.          DGARBAGE  \dir1\dir2\file1  file2  
  72.          (if the file is in the directory \dir1\dir2). 
  73.  
  74.          Outfile  need not exist and will be created if necessary.  If  
  75.          it  DOES exist you will be prompted as to whether or not  you  
  76.          wish  to overwrite it. For example if "file2" already  exists  
  77.          and you enter the following command (in the root directory):- 
  78.  
  79.          DGARBAGE file1 file2 
  80.  
  81.          then the following prompt will be displayed:- 
  82.  
  83.          File C:\FILE2 Already Exists 
  84.          Overwrite it (Y/N) ?
  85.                  
  86.          If you then press Y, the file will be over written and   it's 
  87.          current  contents will be lost. However, if you press N  then 
  88.          the program will terminate.
  89.  
  90.          If less than  two parameters are specified after DGARBAGE, or 
  91.          if  the same file name is given for infile and outfile,   the  
  92.          program  will  display  it's help screen  and  terminate.  If  
  93.          infile does not exist, or if outfile can not be opened  (e.g.  
  94.          if it is set to READ ONLY), then an appropriate error message  
  95.          will be displayed and the program will terminate. 
  96.  
  97.  
  98.  
  99.  
  100.                                     OPTIONS 
  101.                                     ------- 
  102.  
  103.          The  options  listed  below  may be  entered  in  any  order, 
  104.          separated  by a space. They may be entered in upper or  lower 
  105.          case.  Note the comments for each option on the  restrictions 
  106.          (if any) in using that option with other options. 
  107.  
  108.  
  109.  
  110.          B     Use BIOS screen writing method. 
  111.  
  112.                The  default  is to use direct screen  memory  writing, 
  113.                however, this method doesn't work on all types of video 
  114.                adapter.  If you have problems with the  display,  then 
  115.                use the B option. 
  116.  
  117.  
  118.  
  119.          D     Display the text on the screen as it is processed. 
  120.  
  121.                The default is that the text is not displayed as it  is 
  122.                processed,  just an information box at the top  of  the 
  123.                screen which shows the progress of the processing. This 
  124.                is  the  fastest method,  allowing  approximately  9000 
  125.                characters to be processed per second. However, because 
  126.                the program uses very large buffers (30k for infile and 
  127.                31k for outfile) a seemingly long time can pass between 
  128.                updates  to the information box, which only take  place 
  129.                as each 30k block of text is read from disk.  Therefore 
  130.                the  D  option has been included for those  people  who 
  131.                like to be sure that something is happening. 
  132.  
  133.                The  effect of the D option depends on whether  or  not 
  134.                the B option is also specified. If the B option is  not 
  135.                specified then the text is displayed in a window at the 
  136.                bottom  of  the  screen using  the  fast  screen  write 
  137.                method.  This  slows  the  processing  speed  down   to 
  138.                approximately 1200  characters  per second.  If  the  B 
  139.                option  is specified in addition to the D  option  then 
  140.                the  text  is displayed using the  entire  screen  (the 
  141.                information  box is not displayed) and  the  processing 
  142.                speed  slows down to approximately 300  characters  per 
  143.                second. 
  144.  
  145.  
  146.          K/S   The  K  and S options control what action  the  program 
  147.                takes  when it encounters a character with the 8th  bit 
  148.                set - i.e. a character with an ASCII value greater than 
  149.                127. By default, these characters are removed from  the 
  150.                text stream entirely and do not appear in outfile. This 
  151.                was done because most "line noise" characters appear to 
  152.                be  in this range. However, these characters  are  also 
  153.                the  IBM  graphics  characters, so there  may  be  some 
  154.                occasions when it is not desirable to remove them. 
  155.  
  156.                The K option tells the program to pass these characters 
  157.                through  unchanged (Keep them) so they will  appear  in 
  158.                Outfile exactly as they appeared in infile. 
  159.  
  160.                The  S  option tells the program to strip the  8th  bit 
  161.                from these characters converting them to a character in 
  162.                the range 0-127. For example, the IBM horizontal double 
  163.                line character (═) which has an ASCII value of 205 will 
  164.                be  converted to a character with an ASCII value of  78 
  165.                which is the letter M. 
  166.  
  167.                These options only control what processing (if any)  is 
  168.                performed  on  characters with an ASCII  value  greater 
  169.                than  127. Characters with an ASCII value less than  32 
  170.                (excluding  CR/LF)  are ALWAYS removed  from  the  text 
  171.                stream. 
  172.  
  173.                Note  that the K and S options are mutually  exclusive, 
  174.                so  if both options are specified on the  command  line 
  175.                the program will display the help screen and terminate. 
  176.  
  177.  
  178.          Lnnn  The  L option control the number of characters  allowed 
  179.                between successive Carriage Return/Line Feeds (CR/LF). 
  180.  
  181.                The default Line length is 72 characters as this is the 
  182.                standard  length  used by most bulletin  board  message 
  183.                systems.  If  it is desired to have  a  different  line 
  184.                length,  the required value should be  specified  after 
  185.                the L, without any intervening spaces. For example  L80 
  186.                will allow a line length of 80 characters before a  new 
  187.                line is forced. 
  188.  
  189.                Note that this option only controls the MAXIMUM  number 
  190.                of  characters  allowed  between CR/LFs,  it  does  NOT 
  191.                expand short lines to the specified length. If a  CR/LF 
  192.                is  encountered  in infile before  the  specified  line 
  193.                length  is  reached,  the counter is  reset  to  0  and 
  194.                counting begins again. Only if more characters than the 
  195.                specified  line  length  have  been  read  from  infile 
  196.                without  encountering  a CR/LF is one inserted  by  the 
  197.                program. 
  198.  
  199.                The  acceptable range for this option is 1 -  255.  Any 
  200.                values  outside  this range will cause the  program  to 
  201.                abort with an "Out of Range" error message. 
  202.  
  203.  
  204.          The  above parameters are the only ones currently  recognised 
  205.          by  the program. Any other characters entered on the  command 
  206.          line will be ignored. 
  207.  
  208.  
  209.  
  210.  
  211.  
  212.                                 ERROR MESSAGES 
  213.                                 -------------- 
  214.  
  215.          If  less  than two parameters are specified  on  the  command 
  216.          line,  if both the K and S options are specified, or  if  the 
  217.          same  file  name is given for both infile  and  outfile,  the 
  218.          program  will display it's help screen, followed by  a  short 
  219.          descriptive message and terminate. 
  220.  
  221.          In  all  other cases where an error is  encountered  a  short 
  222.          descriptive message is displayed, preceded by the  characters 
  223.          "***  ERROR:" and followed by a line giving the  error  code, 
  224.          program location and module in which the error occurred.  The 
  225.          program will then terminate. 
  226.  
  227.          For  example  if you specify a file that does  not  exist  as 
  228.          infile the following might be displayed:- 
  229.  
  230.          *** ERROR: File Not Found 
  231.  
  232.          Error 2 at Program Location 0000:0316 in Module < Open Files> 
  233.  
  234.  
  235.          Other error messages that you may encounter are "File  Access 
  236.          Denied" if the access permission for infile or outfile is not 
  237.          such  as to allow the files to be accessed correctly  by  the 
  238.          program,  and "Out Of Range" if a value outside the range  of 
  239.          1-255 is specified for the L option. 
  240.  
  241.          There  is  also the possibility that the program  will  abort 
  242.          with  a  "Range Check Error" (error 201) in  module  "Process 
  243.          Data"  This is caused by specifying a line length  less  than 
  244.          the  length  all  the lines in infile. For  example,  if  the 
  245.          length  of  all the lines in infile is 80 and you  specify  a 
  246.          line  length  of 79 (L79) then the program will add  a  CR/LF 
  247.          after the 79th character of EACH line. Eventually, this  will 
  248.          overflow  the output buffer and the program will  abort.  The 
  249.          output buffer has been made 1k greater than the input  buffer 
  250.          to  allow  for  some  lines being  a  different  length  than 
  251.          specified,   but  it  can  not  handle  the  situation   just 
  252.          described.  If you encounter this situation, adjust the  line 
  253.          length value until the program works satisfactorily. 
  254.  
  255.  
  256.                                  OTHER ERRORS 
  257.                                  ------------ 
  258.  
  259.          The  program  has  been fairly extensively  tested,  but,  no 
  260.          doubt, there are errors in there that I haven't found. If you
  261.          come across something that can't be solved in any of the ways
  262.          described   above,  please either leave  a message   for   me  
  263.          on  the Salt Air Bulletin Board or write to me at the address 
  264.          below,  giving  the error message that  was  displayed  (BOTH 
  265.          lines please) and, if possible, a sample of the file that was 
  266.          being processed. 
  267.  
  268.          I  will  also  welcome any suggestions  for  improvements  or 
  269.          upgrades  although  I do not promise to  implement  any  such 
  270.          suggestions. 
  271.  
  272.  
  273.  
  274.  
  275.                                    KNOWN BUG
  276.                                    ---------
  277.  
  278.          The  program adds one (or sometimes two) spurious  characters 
  279.          to the end of outfile after processing. I haven't figured out 
  280.          why yet, but it doesn't cause any real problems (just  delete 
  281.          the character if you don't want it).
  282.  
  283.  
  284.  
  285.                                     HISTORY
  286.                                     -------
  287.  
  288.  
  289.          Version 1.1     Added  code to detect if the same  file  name 
  290.                          had  been  specified  for  both  infile   and 
  291.                          outfile and abort with an appropriate message 
  292.                          in this case.
  293.  
  294.                          Added  code  to  detect  if  outfile  already 
  295.                          existed  and,  if so, prompt the user  as  to 
  296.                          whether or not to overwrite the file.
  297.  
  298.                          (Thanks  to Jerry Clark for finding  both  of 
  299.                          these).
  300.  
  301.  
  302.                          Filenames  are  now  converted  to  uppercase 
  303.                          characters  within  the  program.  This   was 
  304.                          necessary to permit the comparison of  infile 
  305.                          and outfile, and also makes the display  look 
  306.                          a bit neater.
  307.  
  308.                          The  program will prefix the drive  specifier 
  309.                          to  the  filenames  if  it  is  not   already 
  310.                          provided.  Previously,  only  the  path   was 
  311.                          prefixed.
  312.  
  313.                          Messages  were  added  to  explain  why   the 
  314.                          program  has  terminated  in  the  event   of 
  315.                          incorrect or missing command line parameters.
  316.  
  317.                          The operation of the program has been speeded
  318.                          up substantially,  especially in  the default  
  319.                          mode where the throughput has been  increased
  320.                          from  around  2000  characters  per second to 
  321.                          9000 characters per second. The throughput in
  322.                          the fast display mode has  increased from 900
  323.                          to  1200  cps.  The  throughput  for the slow
  324.                          display mode remains at around 300 cps.
  325.                          
  326.                          Tidied up the documentation a bit.
  327.  
  328.  
  329.  
  330.  
  331.          Version 1.0     Initial Release.
  332.  
  333.  
  334.  
  335.  
  336.          Address until mid-June 1988:-
  337.                  
  338.          Peter Byrne,
  339.          Exchange Operations Computer Centre,
  340.          Room 103,
  341.          Saudi Telecom Headquarters,
  342.          Riyadh 11132,
  343.          Kingdom of Saudi Arabia. 
  344.  
  345.          Address after mid-June 1988:-
  346.                  
  347.                  Peter Byrne,
  348.                  Winthrop
  349.                  North Heath Lane
  350.                  Horsham
  351.                  Sussex
  352.                  England.
  353.                  
  354.          
  355.                  
  356.                  09 Ramadhan 1408.
  357.          (25 April 1988)
  358.