home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1654 / readme < prev    next >
Text File  |  1990-12-28  |  5KB  |  96 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 
  13. MAD rock concert rulesfile 'madrock.sp', the Sci-Fi plot rulesfile 
  14. 'sifi.sp', the source to the 'spew' interpreter, a 'manual' for the 
  15. format of the control file, and this READ_ME file. I believe this 
  16. program might actually be useful, for such tasks as generating huge 
  17. quantities of input text for testing programs.  ( I may have a 
  18. file which generates random syntactically-correct C code, but I
  19. won't admit to it!! :-). The format of the file allows a wide variety of text
  20. formats to be generated - it almost works like Yacc in reverse.
  21. Anyway, things like 'festoon' could certainly be coded as 'spew' rulesfiles,
  22. and could thus be sent to the net as a 'spew' source.
  23. Sorry I haven't written a proper manual page, but...
  24.  
  25. USAGE:
  26.     spew [n]        generate one [or n] random thing(s) from default
  27.             rulesfile. If the environment variable RULESFILE
  28.             is set, the file-name is taken from there; other-
  29.             wise a compiled-in name is used ( see Installation
  30.             instructions ).
  31.  
  32.     spew [n] file   Same, but use the given file as input.
  33.  
  34.     spew -c
  35. or    spew -c file    'Compress' the default or given file to the
  36.             standard output (the compressed format is unreadable
  37.             and must be redirected). 'Compress' is a misnomer
  38.             because the file gets about 20% larger. The
  39.             'compressed' format is more efficient for spew to
  40.             operate from, though. Spew automatically knows
  41.             whether it is reading a compressed or human-readable
  42.             rulesfile.  Examples:
  43.         spew headline            << make a headline
  44.         spew -c headline >headline.comp    << make compressed file
  45.         spew headline.comp        << make another headline
  46.  
  47.     spew -d
  48.     spew -d file    Read the default or given file, and dump the
  49.             resulting internal structure to the std output.
  50.             The format is pretty easy to figure out. It is
  51.             somewhat different when the input file is in
  52.             'compressed' format. DUMP must be #define'd
  53.             to enable this feeping creature.
  54.  
  55.  
  56. INSTALLATION INSTRUCTIONS:
  57. The file spew.c contains some clearly labeled #defines which you may
  58. want to play with. It should be possible to port to non-Un*x systems
  59. just by changing these. The most important ones to start with are:
  60.  
  61. DEFFILE which is the default rules file to use. Set this to the path
  62.     of your 'headline' file and then you can just put 'spew' in your
  63.     .login.
  64. ENVIRON which is set to "RULESFILE" in the release package. If this
  65.     environment variable is set, it is assumed to be a default file-name
  66.     over-riding the DEFFILE. You may want to change this.
  67.     Remove the #define if you don't have getenv().
  68. SETRAND    
  69. ROLL(n)    define the former to a STATEMENT (not an expression) which
  70.     initializes your random number generator. Define the latter as
  71.     an expression which gives a random integer in the range 0<=i<n.
  72.     'n' will be an integer from 1 to several hundred.
  73.     The supplied definitions may or may not work well, depending
  74.     on your machine (here we have a VAX 11/780 4.2BSD, works ok
  75.     on a Sun too ).
  76.  
  77. -------------------------------------------------------------------------
  78. Notes of modification:
  79.  
  80. I have modified the source to make it compilable under DOS on an IBM-PC
  81. with Borland Turbo C.  It is still compilable under UNIX,  just make sure
  82. the #define DOS is commented out.  It should compile just fine with
  83. Microsoft C v4.0/v5.x, but I have not tried it.
  84.     -- Ti Kan --
  85. -------------------------------------------------------------------------
  86. I modified Ti Kan's version to include the \PRUNE pseudoclass (described
  87. above) and to break output lines on word boundaries (which could 
  88. concievably hurt some uses, but I've never seen a spewfile for
  89. anything but humor text). It should still compile everywhere it used
  90. to ( :-) ); if setjmp/longjmp is not available then #define PRUNE can
  91. be commented out.
  92.         William Lewis (phelliax)
  93.         wiml@milton.u.washington.edu
  94. -------------------------------------------------------------------------
  95. echo shar: "a missing newline was added to 'readme'"
  96.