home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / NGAWK1.ZIP / README2.DOC < prev    next >
Text File  |  1988-07-17  |  5KB  |  104 lines

  1. This is the first step in upgrading GAWK to AWK as described in the "AWK
  2. Programming Language" (Aho, Kernighan, Weinberger; Addison Wesley 1988).
  3.  
  4.   The major differences between previous versions of GAWK and New GAWK include
  5.  
  6.     1. New math functions
  7.         a. atan2(y,x)  - arctangent of y/x in radians
  8.         b. cos(x) - cosine of x (angle in radians)
  9.         c. sin(x) - sine of x
  10.         d. rand() - generate random number
  11.         e. srand(x) - set new seed for random number generator;
  12.                      uses time of day if no x given
  13.  
  14.     2. New string functions
  15.         a. match(s,r) - index of where s matches r or 0 if no match;
  16.                         set RSTART and RLENGTH variables
  17.         b. gsub(r,s,t) - globally substitute s for each substring of t
  18.                         matched by r, returns number of substitutions;
  19.                         if t is omitted $0 is used
  20.         c. sub(r,s,t) - like gsub but only the first match is substituted
  21.  
  22.     3. New input/output functions
  23.         a. close(expr) - closed file expr
  24.         b. system(cmd-line) - executes command cmd-line at OS level
  25.         c. getline - set fields, NF, NR, FNR from next input record
  26.         d. getline <file - set fields, NF from next record of file
  27.         e. getline var - set var, NR, FNR from next input record
  28.         f. getline var <file - set var from next record of file
  29.  
  30.     4. New variables
  31.         a. ARGC - number of command line args
  32.         b. ARGV - array of command line args. (ARGV[0..ARGC-1])
  33.         c. FNR - input record number of current file
  34.         d. RLENGTH - length of string matched by RE in match()
  35.         e. RSTART - position of string matched by RE in match()
  36.     5. Regular expressions will now work properly on MSDOS (16 bit) machines
  37.     6. Obstack stuff cleaned up to work with Large model compiles
  38.     7. %f format in printf now seems to work (maybe %e too, but not tested)
  39.     8. A ';' will parse as a statement terminator.
  40.     9. Will no longer open input files if no patterns or actions to perform
  41.    10. FS is treated as a regular expression if longer than 1 character
  42.    11. Expressions will be translated into regular expressions (as needed)
  43.          in patterns
  44.    12. Conditional expressions (cond ? exp : exp) have been added
  45.    13. A '-' will be accepted as stdin for program (i.e. awk -f - file; will
  46.          read program from stdin.  This helps work around the MSDOS-OS/2
  47.          command line length limitation)
  48.    14.
  49.  
  50.  
  51. NOTES
  52.     1. Comments have been added to source files for all changes.
  53.     2. I am including both the original grammar file as well as the new
  54.          grammar.  I had to redo parts of the grammar and didn't feel
  55.          like trying to annotate the changes.  (I am not sure how this
  56.          fits in with the FSF software license).
  57.     3. If you use the BISON from CONSULT in protected mode to recompile
  58.          the grammar, note that it does not unlink temporary files.  There
  59.          was a recent thread in MSSYS on unlink not functioning on open
  60.          files in protected mode.
  61.     4. The grammar still generates 20-odd shift/reduce conflicts.  This
  62.          should be cleaned up some but it doesn't seem to do the unexpected
  63.          so maybe it is ok.
  64.  
  65. FUTURE PLANS
  66.     1. The major addition will have to be user-defined functions.  I have
  67.          a few ideas on how to do this, but if anyone else wants to try or
  68.          simply advise, feel free.
  69.     2. Pseudo-multidimensional arrays are not yet available (and the SUBSEP
  70.          variable).  I haven't even looked at this yet.
  71.     3. Output to a pipe hasn't been implemented yet.  This should is trivial
  72.          under UN*X (simply #define UNIX).    It might be easy under OS/2 (just
  73.          write a popen function using DosMakePipe).  It may not be worth doing
  74.          under MSDOS (maybe using temprorary files with some code to close the
  75.          the files and system() the command with redirection from the file).
  76.     4. Input from a pipe (to getline) has not been implemented yet.  This may
  77.          or may not be easy (see above).
  78.     5. Multi-record input may or may not work.    It has not been tested at all.
  79.          [Actually, they do partially work; need to add code to use '\n' as a
  80.          field seperator when RS = "" -ade 07/18/88-].
  81.  
  82. FILES
  83.     awk.y        - grammar for awk
  84.     awk1.c        - expression tree constructors and main program
  85.     awk2.c        - parse tree interpreter
  86.     awk3.c        - builtin functions and utility procedures
  87.     debug.c     - debugging routines
  88.     obstack.c    - object stack functions
  89.     regex.c     - regular expression functions (except regsub)
  90.     awk.h        - awk header file
  91.     obstack.h    - obstack header file
  92.     regex.h     - regular expressions header file
  93.     ogawk.y     - original gawk grammar
  94.     awk.exe     - large model bound awk program
  95.     copying     - Free Software Foundation licensing stuff
  96.     readme.doc    - Steve Liberty's readme file
  97.     readme2.doc - this file
  98.     gawk        - awk makefile (I don't use Microsoft's make so you may have
  99.                     to modify this file slightly)
  100.  
  101.  
  102. Please send any problems or comments to:
  103.   Andy Estes 73076,2737
  104.