home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 2 / FFMCD02.bin / new / dev / misc / cweb / examples / readme < prev    next >
Encoding:
Text File  |  1993-12-21  |  4.1 KB  |  80 lines

  1. This directory contains several files for programs that are tutorial
  2. and/or useful.  If you are new to CWEB, read "wc.w" first; it's a
  3. typical example of CWEB applied to system programming.
  4.  
  5. The MAKEFILE in this directory is a generic way to build applications
  6. written in CWEB.  The SMAKEFILE in this directory is a complete example
  7. makefile for the SAS/C compiler for the Commodore Amiga, written by
  8. Andreas Scherer.  Say, for example, "smake all" to get all the executable
  9. programs from their sources.  Say "smake docs" to get a printable listing
  10. of their documentations.
  11.  
  12. The WC program is a slight improvement over UNIX's standard word-count
  13. utility.  To use it, say "make wc" to get an executable program "wc"
  14. from wc.w.  Say "make wc.dvi" to get a printable listing of its documentation.
  15.  
  16. The TREEPRINT program, by Norman Ramsey, generates tree-structured
  17. representations of file hierarchies.  To use it, say "make treeprint"
  18. and then
  19.    find dir -type p -print | sort | treeprint
  20. (on a UNIX system), where dir is a directory with interesting subdirectories.
  21.  
  22. The WMERGE program, by Silvio Levy, produces a single CWEB file from a
  23. given CWEB file and a change file.  It expands any "include" specifications
  24. in the original CWEB file.  To use it, say "make wmerge" and then, e.g.,
  25. "wmerge foo.w bar.ch > foobar.w".  Both CTANGLE and CWEAVE already accept
  26. change files, so you need not merge anything yourself in normal day-to-day
  27. operations; but wmerge can be useful in connection with the spelling checker
  28. described below.
  29.  
  30. If you intend to read the source code of CTANGLE and CWEAVE, you may
  31. well wish to read wmerge.w first, or the hardcopy version obtained from
  32. "make wmerge.dvi"; it is similar but much simpler.
  33.  
  34. The files XVIEW_TYPES.W and XLIB_TYPES.W are examples of @i (include) files
  35. that can be used when writing XView programs.  They are based on the header
  36. files in OpenWindows Version 3.0.
  37.  
  38. An examples XVIEW application appears in Knuth's program OEMACS.W, which
  39. he uses for heavy emacsing.  It's not very portable, but if you have
  40. OpenWindows3 and a Sun Type-4 keyboard you may like it as much as he does.
  41. (It replaces "emacstool".)  The file OEMACS.EL goes with it.
  42.  
  43. The EXTEX and WORDTEST programs, by Don Knuth, are useful spellcheckers.
  44. After "make extex" say also "ln extex excweb"; this gives
  45. you two filter programs, extex and excweb, that remove extraneous
  46. material from TeX and CWEB source files, respectively. To use them,
  47. you can say for example
  48.    cat foo.w | excweb | spell
  49. (or replace "cat foo.w" with "wmerge foo.w bar.ch"). A similar pipeline
  50. for TeX files would be
  51.    cat foo.tex | extex | spell
  52. Even better is to replace "spell" by "wordtest /usr/local/lib/dict/words",
  53. if you have a suitable dictionary.  One such dictionary in the public domain
  54. can be found in directory ~ftp/pub/dict at labrea.stanford.edu, available
  55. via anonymous ftp.  To make your own dictionary from given ones,
  56.    cat dict1 dict2 dict3 dict4 | wordtest > words
  57. is quick and effective.  See the documentation of wordtest for more info.
  58.  
  59. A file KSPELL.EL that provides an emacs user interface to extex+excweb+wordtest
  60. also appears in this directory.  (Somebody should write ELWEB...)
  61.  
  62. All the CWEB example programs listed above are provided with change files
  63. for full ANSI-C compliance (prototypes, #include files, etc.), so they
  64. should be compilable with any decent C compiler, although they may not be
  65. operational on every machine.
  66.  
  67. The COMMONWORDS program, by Andreas Scherer, is based on the WEB program of
  68. the same name by Don Knuth.  It counts the frequencies of the most common
  69. words in a given text file.  To use it, say "make commonwords" and then
  70. "commonwords < commonwords.w".
  71.  
  72. The PRIMES program, by Andreas Scherer, is based on the WEB program of the
  73. same name by Don Knuth.  It generates the first thousand prime numbers.
  74. To use it, say "make primes" and then simply "primes".
  75.  
  76. The SAMPLE program, by Andreas Scherer, is based on the WEB program of the
  77. same name by Don Knuth.  It generates samples of random numbers.  To use
  78. it, say "make sample" and then simply "sample".  Answer the input questions
  79. with positive integers and see the results.
  80.