home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 6 File / 06-File.zip / nortutil.zip / spew.txt < prev    next >
Text File  |  1996-08-30  |  4KB  |  75 lines

  1. A while back, mark@pixar posted a program to generate random 'National
  2. Enquirer' headlines.  This program worked from a 'rules file' which was a text
  3. file describing how the headlines would be constructed.
  4.  
  5. Mark's program was, unfortunately, highly non-portable, and rather than
  6. try to salvage it I wrote a new interpreter for the same text file.
  7. Since then I have added several features, and thus greatly changed the
  8. format of the rules file. Credits go to mark for the original concept
  9. and much of the text in the supplied rulesfile ( which I have cleaned up
  10. and added to ).
  11.  
  12. This shar includes the National Enquirer rules-file 'headline', the source to
  13. the 'spew' interpreter, a 'manual' for the format of the control file, and
  14. this READ_ME file. I believe this program might actually be useful, for such
  15. tasks as generating huge quantities of input text for testing programs.  ( I
  16. may have a file which generates random syntactically-correct C code, but I
  17. won't admit to it!! :-). The format of the file allows a wide variety of text
  18. formats to be generated - it almost works like Yacc in reverse.
  19. Anyway, things like 'festoon' could certainly be coded as 'spew' rulesfiles,
  20. and could thus be sent to the net as a 'spew' source.
  21. Sorry I haven't written a proper manual page, but...
  22.  
  23. USAGE:
  24.     spew [n]        generate one [or n] random thing(s) from default
  25.             rulesfile. If the environment variable RULESFILE
  26.             is set, the file-name is taken from there; other-
  27.             wise a compiled-in name is used ( see Installation
  28.             instructions ).
  29.  
  30.     spew [n] file   Same, but use the given file as input.
  31.  
  32.     spew -c
  33. or    spew -c file    'Compress' the default or given file to the
  34.             standard output (the compressed format is unreadable
  35.             and must be redirected). 'Compress' is a misnomer
  36.             because the file gets about 20% larger. The
  37.             'compressed' format is more efficient for spew to
  38.             operate from, though. Spew automatically knows
  39.             whether it is reading a compressed or human-readable
  40.             rulesfile.  Examples:
  41.         spew headline            << make a headline
  42.         spew -c headline >headline.comp    << make compressed file
  43.         spew headline.comp        << make another headline
  44.  
  45.     spew -d
  46.     spew -d file    Read the default or given file, and dump the
  47.             resulting internal structure to the std output.
  48.             The format is pretty easy to figure out. It is
  49.             somewhat different when the input file is in
  50.             'compressed' format. DUMP must be #define'd
  51.             to enable this feeping creature.
  52.  
  53.  
  54. INSTALLATION INSTRUCTIONS:
  55. The file spew.c contains some clearly labeled #defines which you may
  56. want to play with. It should be possible to port to non-Un*x systems
  57. just by changing these. The most important ones to start with are:
  58.  
  59. DEFFILE which is the default rules file to use. Set this to the path
  60.     of your 'headline' file and then you can just put 'spew' in your
  61.     .login.
  62. ENVIRON which is set to "RULESFILE" in the release package. If this
  63.     environment variable is set, it is assumed to be a default file-name
  64.     over-riding the DEFFILE. You may want to change this.
  65.     Remove the #define if you don't have getenv().
  66. SETRAND    
  67. ROLL(n)    define the former to a STATEMENT (not an expression) which
  68.     initializes your random number generator. Define the latter as
  69.     an expression which gives a random integer in the range 0<=i<n.
  70.     'n' will be an integer from 1 to several hundred.
  71.     The supplied definitions may or may not work well, depending
  72.     on your machine (here we have a VAX 11/780 4.2BSD, works ok
  73.     on a Sun too ).
  74.  
  75.