home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 554b.lha / WFile_v1.10 / wfile.doc < prev    next >
Text File  |  1991-09-09  |  19KB  |  364 lines

  1.                                    WFILE 1.10
  2.  
  3.                          WorkFILE - process ASCII-files
  4.  
  5.                                   Amiga Version
  6.  
  7.                         (C) 1991 Joerg Fenin / Metalworx
  8.  
  9.           ------------------------------------------------------------
  10.  
  11.           WFile  is  Freeware.  That  means  it  can be used and distributed
  12.           freely as long as the following rules are obeyed:
  13.  
  14.           *    WFile may  not be  part of  a commercial  product without the
  15.                written permission of the author.
  16.           *    WFile may  not be distributed on (public domain-, shareware-,
  17.                freeware-) disks if more than DM 5,- / US $ 5,- is charged as
  18.                copying  and/or  distribution  fee for that disk. (exception:
  19.                Fred Fish, he may charge more).
  20.           *    The copyright message must remain UNCHANGED!
  21.           *    WFile MUST NEVER be distributed on own disk  series of Stefan
  22.                Ossowski PD-Versand,  Rainer Wolf PD-Versand, Markt & Technik
  23.                AG, Karstadt AG.
  24.  
  25.           USE THIS PROGRAM AT YOUR OWN RISK!!
  26.           There is no guarantee that WFile works properly.  The author takes
  27.           no responsibility for any damage that might result from the use of
  28.           WFile.
  29.  
  30.           ------------------------------------------------------------
  31.  
  32.  
  33.      1    Purpose
  34.  
  35.           Do you often interchange ASCII files  between the  Amgia, a  PC or
  36.           UNIX systems  ? Do  you look  for a  possibility to expand TABs in
  37.           ASCII files to SPACES or vice  versa ?  Do you  want to extinguish
  38.           certain characters from ASCII files ?
  39.  
  40.           If the  answers were  YES, you  may have  some advantages in using
  41.           WFile, if the answers were NO, you can leave here and try out some
  42.           other program on this disk.
  43.  
  44.           WFile  should  make  it  easy  for  you to interchange ASCII files
  45.           between different computer systems  (such  as  Amiga,  PC  or UNIX
  46.           systems). It  does all  character converting (foreign symbols etc)
  47.           and NEWLINE conversion for you.
  48.           WFile can also be used to expand TAB-codes (0x09) into  any number
  49.           (2 -  8 usually)  of SPACE-codes  (0x20) or vice versa, or you can
  50.           delete certain characters from your ASCII files (such as formfeeds
  51.           (0x0c) for example).
  52.  
  53.           WFile stands  for 'work  file', that  means do  specific things on
  54.           (ASCII) files.
  55.  
  56.  
  57.      2    Capabilities
  58.  
  59.           WFile can do the following things for you:
  60.  
  61.           *    Expand TABs to multiple spaces
  62.           *    Shrink multiple spaces to one TAB
  63.           *    Change foreign  symbols  to  different  (machines') character
  64.                sets
  65.           *    Add or  strip carriage  return codes  (0x0d) from  the end of
  66.                each line
  67.           *    Online help screens
  68.           *    Built-in templates for easy  file interchange  between Amiga,
  69.                PC and UNIX
  70.           *    Profiles for default settings.
  71.  
  72.  
  73.      3    Usage
  74.           WFile has  no (actually not yet) intuition interface, it has to be
  75.           invoked from a CLI or shell. If you simply type
  76.  
  77.                wfile
  78.  
  79.           you will get the following template:
  80.  
  81.           wfile 1.11/6 - 12-Aug-91  (C) 1991 Metalworx
  82.           Usage:wfile    < file| -? >    [<+|->CR]  [<+|->T[size]] [-ddd=ddd
  83.                          [...] [-0]] [-b] [-f[file]] [-AI] [-IA] [-AU] [-UA]
  84.                          [-UI] [-IU] [+ddd]
  85.  
  86.           Parameters in <>-brackets must  be specfied,  those in []-brackets
  87.           are optional.  If a  | (straight  slash) stands between parameters
  88.           exactly ONE of these parameters has to be specified. Example:
  89.  
  90.           [<+|->CR]
  91.  
  92.           ||||||| |
  93.           ||||||| |--------------- end of optional parameter
  94.           |||||||
  95.           ||||||------------------ command, see below
  96.           |||||| 
  97.           |||||------------------- end of unconditional parameter
  98.           |||||
  99.           ||||-------------------- command introduction #2
  100.           ||||
  101.           |||--------------------- command introduction seperator, use
  102.           |||                      either command introduction #1 (+) or
  103.           |||                      command introduction #2 (-)
  104.           |||
  105.           ||---------------------- command introduction #1
  106.           ||
  107.           |----------------------- beginning of unconditional parameter
  108.           |
  109.           ------------------------ beginning of optional parameter
  110.  
  111.           or literally: If you decide to use command CR, which is just up to
  112.           you, then  you have to give either +CR or -CR, not just CR and not
  113.           +-CR. 
  114.  
  115.           WFile needs at least one argument, the name of the file that is to
  116.           be processed. If you don't specify anything else, WFile just reads
  117.           the file, creates a backup file  of it  (by appending  .bak to the
  118.           filename, see below) and writes the file back to disk unchanged.
  119.  
  120.  
  121.      3.1  Commands
  122.  
  123.           -?        invokes builtin help function.
  124.                     Therefore on  Amiga systems the file wfile.hlp has to be
  125.                     located in the same directory as wfile. On other systems
  126.                     (MSDOS  and  UNIX)  it  has  to  exist  in  the  current
  127.                     directory.
  128.                     The Amiga version automatically calculates the number of
  129.                     lines  for  each  page  from the current, active window.
  130.                     After displaying this amount  of lines,  WFile waits for
  131.                     the RETURN key to be pressed. On other systems this line
  132.                     count is static and may be changed in the file wfile.h
  133.                     If you are familiar  in using  WFile you  can delete the
  134.                     help file.  Of course  you can't invoke the help fuction
  135.                     then!
  136.  
  137.           -|+CR     strips or adds CR codes ($0d) to the end of each line.
  138.                     On Amiga and UNIX machines, the  end of  a text  line is
  139.                     represented  with  a  single newline character ($0a), on
  140.                     MSDOS based machines therefore two characters are needed
  141.                     ($0d$0a, carriage return (CR), linefeed).
  142.                     If you  specify -CR  all CR  codes will be stripped off.
  143.                     Use this option if you convert text files  from MSDOS to
  144.                     the Amiga or to UNIX.
  145.                     Use +CR to convert it the other way round.
  146.           -|+T[tabsize]  In some text editors, such as vi, MicroEmacs or the
  147.                          TurboC editor you can change  the  size  of  a tab.
  148.                          Usually a tab consists of eight spaces, but for a C
  149.                          programmer this value often is too big, if  you use
  150.                          many  ifs,   fors  and   whiles.  So  most  of  the
  151.                          programmers  set  the  tabsize  to  2,  which  is a
  152.                          convenient value.  The above editors then still use
  153.                          tabcodes  but   expand   them   within   their  own
  154.                          environment to  just two spaces, no matter what the
  155.                          outside world say! If  you then  load up  this file
  156.                          with a  'clever' editor,  such as  dme, tabs appear
  157.                          again as eight  spaces.  To  convert  files between
  158.                          'clever'  editors  and  'dumb'  ones  (no  offense,
  159.                          really, they got other advantages, at least I think
  160.                          so... :-) you can use this command.
  161.                          -T exchanges  tabcodes against multiple spaces. You
  162.                          can enter the number  of  spaces  by  specifing the
  163.                          optional  tabsize  parameter  right  after the 'T',
  164.                          e.g. -T2, this will  expand one  tab code  ($09) to
  165.                          two spaces ($20). If you don't specify the tabsize,
  166.                          WFILE assumes a value of eight.
  167.                          +T  shrinks  multiple  spaces  into  one  tab.  The
  168.                          tabsize parameter  serves as  a maximum value. This
  169.                          is a bit complicated: If you say for  example +T5 a
  170.                          tabstop will  be set  every fifth  column in a file
  171.                          (column 0,  5,  10,  15...).  This  means,  that at
  172.                          maximum  5  spaces  will  be converted into on tab,
  173.                          saving you 4 bytes. But it might be  possible, that
  174.                          the first three columns are filled up with text:
  175.  
  176.                          Column: 01234567890
  177.                                  /**  Text
  178.                                  |  | |
  179.                                  |  | ----- following text
  180.                                  |  |
  181.                                  |  ------- two spaces
  182.                                  |
  183.                                  ---------- beginning of line
  184.  
  185.                          In this  and in  similar cases just two spaces will
  186.                          be  converted  into   one   tabcode,   setting  the
  187.                          textcounter up  to the next tabstop. In my language
  188.                          I would call this a fixed  tab. As  far as  I know,
  189.                          all  text  editors  and  word  processors  use this
  190.                          system of handling tabs. However the source code is
  191.                          provided for  those who  wish to change this (but I
  192.                          wouldn't  dare,  this  part  of  the  code  is very
  193.                          cryptic I must say!).
  194.  
  195.           -ddd=ddd  change decimal values.
  196.                     With this  powerful option  you can change any character
  197.                     of your file into another. This gives you the possibilty
  198.                     of transfering  files from one system to another without
  199.                     having to  fix  all  the  special  characters  (like the
  200.                     German Umlaute  etc.) on  the new  system. We in Germany
  201.                     have a letter that is made of an o and an e together. We
  202.                     call this  an "ö" (<- probably not displayed, if you use
  203.                     different keymaps). This letter has the ASCII value 246.
  204.                     On MSDOS  systems it has the ASCII value 148. To convert
  205.                     all these letters automatically you just have to say 
  206.                     -246=148.
  207.                     You can alse remove all these letters if you say
  208.                     -246=0. In this case all oes will be removed.
  209.                     If you would like to exchange  the oe  against a  \0 you
  210.                     have to  specify -0 as an additional option (see below).
  211.                     This tells WFile to treat the 0 as decimal value, not as
  212.                     a remove command.
  213.                     In this  release you have to use decimal ASCII values. I
  214.                     plan to allow the use of hexadecimal and octal numbers.
  215.           -0        treat 0 as an ASCII value
  216.                     As default the 0 will act like a remove command.  If you
  217.                     say for example -246=0, each letter with the ASCII value
  218.                     246 will be removed. If  you  say  -246=0  -0,  then all
  219.                     letters with  ASCII value  246 will be exchanged by '\0'
  220.                     characters. I didn't use this myself,  but may  be there
  221.                     is a situation where it might be needed.
  222.  
  223.           -b        do not create backup file.
  224.                     By default  WFile creates a backup of the original file,
  225.                     just in case anything  goes  wrong.  On  Amiga  and UNIX
  226.                     systems .bak  will be appended to the filename, on MSDOS
  227.                     machines the file's extension  will be  changed to .bak.
  228.                     With  -b  you  can  suppress  the creation of the backup
  229.                     file, for example if you don't have space on your disk.
  230.  
  231.           -f[filename]   read profile with WFile commands.
  232.                          Yet another very  powerful  option.  You  can stack
  233.                          multiple commands  in a  file that may be processed
  234.                          when invoking WFile. This gives you  the possibilty
  235.                          to create several profiles for different tasks, for
  236.                          example one profile  to  handle  conversion between
  237.                          MSDOS and  Amiga, another on to handle the opposite
  238.                          (though there are also  bultin templates  for these
  239.                          special cases,  see below).  If you don't specify a
  240.                          filename the file wfile.pro  will be  loaded, if it
  241.                          exists. See below for information on how to build a
  242.                          profile. 
  243.  
  244.           -AI       Amiga to IBM conversion template
  245.                     This template changes foreign symbols (German Umlaute in
  246.                     the  current  version)  from  the Amiga to  the enhanced
  247.                     IBM-ASCII set used in  IBM PCs  and its  clones. It also
  248.                     adds an  CR code to the end of each line and removes the
  249.                     end-of-file character ($1a).
  250.  
  251.           -IA       IBM to Amiga conversion template
  252.                     This templete changes foreign symbols (German Umlaute in
  253.                     the current  version) from the enhanced IBM-ASCII set to
  254.                     MSDOS compatible systems to  the  character  set  of the
  255.                     Amiga.  The  CR  code  at  the ende of each line will be
  256.                     stripped,  an   end-of-file  character   ($1a)  will  be
  257.                     appended to the file.
  258.  
  259.           -AU       Amiga to UNIX conversion template
  260.                     changes Amiga foreign symbols to their UNIX (HP 9000/825
  261.                     HP-UX 7.0 SysV) equivalents (see above).
  262.  
  263.           -UA       UNIX to Amiga conversion template
  264.                     changes UNIX  (HP 9000/825  HP-UX 7.0  SysV) foreign    
  265.                     symbols to their Amiga equivalents (see above).
  266.  
  267.           -UI       UNIX to IBM conversion template
  268.                     changes foreign  symbols from  UNIX to  the enhanced    
  269.                     IBM- ASCII set used in IBM  PCs and  its clones.  It    
  270.                     also adds an CR code to the end of each line. An end-of-
  271.                     file character ($1a) will be appended to the file.
  272.  
  273.           -IU       IBM to UNIX conversion templete
  274.                     changes foreign symbols from the enhanced  IBM-ASCII    
  275.                     set  on  MSDOS  compatible  systems their equivalents in
  276.                     UNIX.The CR code at  the end  of each  line will  be    
  277.                     stripped, the end-of-file-code will be deleted.
  278.  
  279.           +ddd      append character at end of file.
  280.                     On MSDOS  systems all  files end  with a special end-of-
  281.                     file character ($1a). UNIX and Amiga  systems don't need
  282.                     these characters.  To add such character you can specify
  283.                     +26 as an option and a character with the ASCII value 26
  284.                     ($1a) will be appended at the end of the file
  285.  
  286.      3.2  Templates
  287.  
  288.           WFile  has  currently  six  builtin templates (see above) for easy
  289.           text interchange between Amiga,  MSDOS and  UNIX systems. Whenever
  290.           you specify  a template  as an  option to  WFile, all its commands
  291.           will be printed to SDTOUT, to let you see what is going on.
  292.  
  293.  
  294.      3.3  Profiles
  295.  
  296.           Generally: All options within a profile  are written  to STDOUT to
  297.           let you see what's going on.
  298.  
  299.           In a  profile you  can specify  the options that WFile should use.
  300.           You can keep any number of profiles, according  to your  needs. If
  301.           you want  to use  a profile  you must  specify the  -f option (see
  302.           above) to let WFile  know your  commands come  from a  file. If no
  303.           filename after  the -f option is specified, WFile looks for a file
  304.           named 'wfile.pro' in the current directory to read from.
  305.  
  306.           A profile can contain any number of options as long as the general
  307.           maximum  for  WFile  commands  is not exceeded. All templates (see
  308.           above) may be used!
  309.           You should not specify  the  options  within  a  template  also by
  310.           yourself.  WFile  might  get  confused  if  an  option  has  to be
  311.           processed twice.
  312.  
  313.           Each option must stand  in  a  single  line.  Each  line  MUST NOT
  314.           contain  more  than  79  characters (currently there is no option,
  315.           that is that long). Each line  MUST end  with a  newline character
  316.           ($0a on  UNIX and Amiga, $0d$0a on MSDOS). Comment lines MUST have
  317.           a # character as their first sign.
  318.  
  319.           Example:
  320.  
  321.           # don't enter the <newline> literally, just press return
  322.           -t2  <newline>
  323.           -UI  <newline>
  324.           -b   <newline>
  325.  
  326.  
  327.      4    Technical information
  328.  
  329.           WFile was written in C and has been  compiled, optimized  for time
  330.           and made  resident with  the SAS/Lattice C Compiler 5.10a. See the
  331.           source readme file for information concerning the source  code. It
  332.           does not need any libraries, handlers or devices.
  333.  
  334.           Files are  read in  in one piece, usually the allocated space will
  335.           be 2-3 times larger than the  orignal file.  This limits  the file
  336.           size of  the worked  file. In  a future  release I will include an
  337.           option, that reads in a file part by part.
  338.  
  339.           I work with a stack frame of 4000 bytes, actually  I think  it can
  340.           be lower, WFile does not work recursivley.
  341.  
  342.  
  343.           The number  of change options (-ddd=ddd) is limited to 26, that is
  344.           because the alphabet consists of 26 characters, and  I don't think
  345.           that more changes are needed. If there is a need, well, change the
  346.           source code  and recompile.  The total  number of  options must be
  347.           below 100,  this really  should do,  by the  way, all options in a
  348.           template count!
  349.  
  350.  
  351.      5    Future directions
  352.  
  353.           There are certain things I'd like to do in future versions:
  354.  
  355.           -    split option, option that  splits read-in  of files  in small
  356.                parts, so that even large files can be handled
  357.           -    Intuition based user interface
  358.  
  359.           -    expand templates to handle ALL characters
  360.  
  361.         *****************************************************************
  362.  
  363.           last manual update: 08 13,1991
  364.