home *** CD-ROM | disk | FTP | other *** search
/ The Don Maslin Archive / maslin_archive.zip / AARDVARK_Tape_Backups / maslin_c_d_3oct95 / ddrive / dw / xlate.doc < prev    next >
Text File  |  1991-05-24  |  6KB  |  140 lines

  1.  
  2.  
  3.  
  4.  
  5.            Sydex
  6.            ___________________________________________________________
  7.            P.O. Box 5700
  8.            Eugene, OR  97405
  9.            (503) 683-6033
  10.  
  11.  
  12.                          Xlate - A Simple Character Converter
  13.  
  14.  
  15.                                      January, 1991
  16.  
  17.                    Xlate and this document, Copyright 1991 by Sydex.
  18.                                   All Rights Reserved.
  19.  
  20.  
  21.            Synopsis
  22.  
  23.            Xlate is a simple utility used to convert data  on  a  character-
  24.            by-character basis.  Xlate can--
  25.  
  26.                 1.   Change every occurrence of one character to a different
  27.                      character. (Character Translation)
  28.                 2.   Delete every occurrence of a character. (Filtering)
  29.                 3.   Insert  a  character  after every occurrence of a given
  30.                      character (Addition)
  31.  
  32.            The transformations to be performed may be specified  in  one  of
  33.            two ways:
  34.  
  35.                 1.    In the DOS command line.
  36.                 2.    In a separate file.
  37.  
  38.  
  39.            Application
  40.  
  41.            For  most  simple conversions,  the DOS command line form will be
  42.            found to be the most useful.   The general form of the Xlate com-
  43.            mand is:
  44.  
  45.                 XLATE IN=infile OUT=outfile FROM=string1 TO=string2
  46.                      TABLE=tfile INSERT DELETE RAW
  47.  
  48.            FROM=Infile  specifies  the file containing the data to be trans-
  49.            lated.  If this specification is omitted, input is taken from the
  50.            standard input device, usually the keyboard.
  51.  
  52.            TO=outfile specifies the file to receive the converted data.   If
  53.            this specification is omitted,  output is written to the standard
  54.            output device, usually the video display.
  55.  
  56.            FROM=string1 and TO=string2 specify the translation  that  is  to
  57.            take  place.    Each character in string1 is paired with its cor-
  58.            responding character in string2.   Every time a character is read
  59.            from  the  input  (IN)  file,  it  is checked against the list of
  60.  
  61.  
  62.  
  63.  
  64.            characters in string1.   If a character occurs  in  string1,  the
  65.            character  which  occurs  in the same position in string2 is sub-
  66.            stituted for it when the output (OUT) file is written.
  67.  
  68.            Any printing character may occur in string1 and string2, with the
  69.            exception of the blank or space.   If a non-printing character is
  70.            to  be  specified,  it  may  be represented by its decimal value,
  71.            prefixed by a backslash (\).   A backslash is represented by  two
  72.            backslash characters.  Thus,
  73.  
  74.                      \10 represents a line-feed, and
  75.                      \32 represents a space.
  76.  
  77.            If large numbers of translations are to be performed,  it is most
  78.            convenient to specify them by means of a  table  contained  in  a
  79.            file. TABLE=tfile specifies this file.  The "table" file consists
  80.            of  any number of entries,  one entry per line in one of the fol-
  81.            lowing forms:
  82.  
  83.                      value1=value2
  84.                      value1-
  85.                      value1+value2
  86.  
  87.            Value1 and Value2 are character values and  may  be  quoted  with
  88.            double  quotes (") or specified as a numeric quantity if preceded
  89.            with a backslash.  For example,
  90.  
  91.                      A
  92.                      "w"
  93.                      \233
  94.  
  95.            all are valid character specifiers.
  96.  
  97.            The form value1=value2 specifies that every occurrence of  value1
  98.            in  the input file will be replaced by value2.   The form value1-
  99.            specifies that every occurrence of value1 in the input file  will
  100.            be  deleted  from  the  output  file.    The  form  value1+value2
  101.            specifies that every occurrence of value1 in the input file  will
  102.            have value2 inserted immediately after it in the output file.
  103.  
  104.            The  keywords INSERT and DELETE have relevance only if a transla-
  105.            tion table file (TABLE) has not been specified.    If  INSERT  is
  106.            specified,  characters  in the TO= string are not substituted for
  107.            those in the FROM= string,  but rather inserted immediately after
  108.            each  occurrence.    DELETE  specifies that every occurrence of a
  109.            character in the FROM= string will be  deleted  from  the  output
  110.            file.
  111.  
  112.            RAW specifies how end-of-line characters are to be handled.  Nor-
  113.            mally,  a  CR-LF pair in the input file is translated to a single
  114.            LF character on input,  and translated back to CR-LF  on  output.
  115.            This  allows  treatment of the end-of-line as a single character,
  116.            rather than tow characters.   If RAW is specified,  this transla-
  117.            tion is disabled,  and the end-of-line is given no special treat-
  118.            ment.
  119.  
  120.  
  121.  
  122.  
  123.  
  124.            Here are some examples of XLATE commands:
  125.  
  126.                 XLATE IN=THISFILE OUT=THATFILE FROM=ABCDE TO=WVXYZ
  127.  
  128.            translates THISFILE, converting every "A" to "W", "B" to "V", "C"
  129.            to "X" and so on.  The translated output is written to THATFILE.
  130.  
  131.                 XLATE IN=FILE1 OUT=FILE2 FROM=\0 DELETE
  132.  
  133.            removes all nulls (zero values) when copying FILE1 to FILE2.
  134.  
  135.                 XLATE IN=ALPHA OUT=BETA TABLE=MYTABLE
  136.  
  137.            translates the file ALPHA,  using the translations  specified  in
  138.            the file MYTABLE, and writes it to BETA.
  139.  
  140.