home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 103_01 / roff.doc < prev    next >
Text File  |  1985-03-10  |  7KB  |  233 lines

  1. May 7, 1981
  2.  
  3.             ROFF
  4.  
  5.     This version of ROFF, based on the formatter  in  Kernighan
  6. and Plauger's book SOFTWARE TOOLS, is written in BDS C, and employs
  7. the  directed  i/o functions that go along with that package. Well,
  8. half of the directed I/O anyway - it doesn't use  redirected  input
  9. because  I wanted to be able to format more than one file at a run.
  10. Please ignore any "odd" comments to myself in ROFF1.C and  ROFF2.C;
  11. I tried to find them all but there may be a few extra silly remarks
  12. around.
  13.  
  14.     For more details on the directed I/O (NDIO in our version)
  15. see NDIO.C
  16.  
  17.  
  18. Sample calls:
  19.  
  20. A>roff filename1 filename2 filename3 +}
  21.  
  22.     this would send the formatted version of these three files
  23.     to the console and to the printer
  24.  
  25.  
  26. A>roff filename1 +}]>filename1
  27.  
  28.     this would format filename1 and send it to the printer,
  29.     console, robot-typewriter, and back to filename1.
  30.  
  31.  
  32.  
  33. For more details on using the directed I/O, see NDIO.C
  34.  
  35.  
  36.  
  37.         Using  ROFF,  you  can  make nice printouts of a file, with as
  38. little  or as much help from the program as you want, depending on the
  39. commands.  There  are  default  values  for  all parameters, so if you
  40. don't put any commands in at all, your file will come out with filled,
  41. right-justified  lines.   The  default line-length is  80  characters;
  42. the  default  page-length  is  66 lines per page. "Filled lines" means
  43. that  as many input words as possible are packed onto a line before it
  44. is   printed;   "non-filled"   lines  go  through  the  formatter  w/o
  45. rearrangement.  "Right-justified"  simply  means that spaces are added
  46. between words to make all the right margins line up nicely. 
  47.         To  set  a  parameter, use the appropriate commands below. All
  48. commands  have the form of a period followed by two letters. A command
  49. line  should  have nothing on it but the command and its arguments (if
  50. any); any text would be lost. 
  51.  
  52.         A command argument can be either ABSOLUTE or RELATIVE : 
  53.  
  54. .in    5    sets the indent value to 5 spaces
  55.  
  56. .in    +5    sets the indent value to the CURRENT value plus 5
  57.  
  58. .ls     -1    sets the line spacing value to the current value 
  59.                         minus one
  60.  
  61.         Also,  all commands have a minimum and maximum value that will
  62. weed out any odd command settings (like setting the line spacing to 
  63. zero, for example. It won't let you do that, but it could be changed 
  64. if you REALLY have a burning desire to do so).
  65.  
  66.         Some  commands  cause  a  "break", which is noted in the table
  67. below.  Before  such  a  command goes into effect, the current line of
  68. text  is  put  out,  whether  it is completely filled or not. (this is
  69. what  happens  at  the  end  of  a  paragraph,  for  example.)  A line
  70. beginning  with  spaces  or  a  tab  will  cause  a break, and will be
  71. indented  by that many spaces (or tabs) regardless of the indent value
  72. at  that  time  (this  is  a "temporary indent", which can also be set
  73. explicitly).  An all blank line also causes a break.  If you find that
  74. seem  to  have  some  lines that are indented strangely,  and it's not
  75. obvious WHY,  look  at which commands  are causing a break,  and which 
  76. aren't. For instance:
  77.  
  78. .fi
  79. .ti 0
  80. this is a line of text
  81. .in 8
  82.                     <- blank line
  83. more text for the machine to play with
  84.  
  85.  
  86. At first glance it seems obvious that the line "this is a line of text"
  87. will   be indented zero spaces,  but it won't - it will be indented  8.
  88. The indent  command  does  NOT cause a break   (although the .ti  does)
  89. so it will not cause the line to  be put out before  setting the indent
  90. value to 8.  Then,  when the  blank line is encountered,  it will cause
  91. a break - and "this is a line of text" will be indented incorrectly.
  92.  
  93.  
  94. *********************** Table of Commands *****************************
  95.  
  96. Command          Break?    Default        Function
  97. -------       ------    -------         ---------
  98. .bp n        yes    n =  +1        begin page numbered n
  99.  
  100. .br        yes            cause a break
  101.  
  102. .ce n        yes    n = 1        center next n lines
  103.  
  104. .fi        yes            start filling lines
  105.  
  106. .fo string    no    empty        sets footer to string
  107.  
  108. .he string    no    empty        sets header to string
  109.  
  110. .in n        no    n = 0        sets indent value to n
  111.  
  112. .ls n        no    n = 1        sets line spacing to n
  113.  
  114. .m1        no    n = 2        sets topmost margin to n
  115.  
  116. .m2        no    n = 2        sets 2nd top margin to n lines
  117.  
  118. .m3        no     n = 2        1st bottom margin to n lines
  119.  
  120. .m4        no    n = 2        bottom-most margin to n lines
  121.  
  122. .nf        yes            stop filling lines
  123.  
  124. .pl n        no     n = 66        sets page length to n
  125.  
  126. .rm n        no    n = 80        sets right margin to n
  127.  
  128. .sp n        yes    n = 1        space down n lines
  129.  
  130. .ti n        yes    n = 0        sets temporary indent of n
  131.  
  132. .ul n        no    n = 1        underline next n lines
  133.  
  134. ----------------------------------------------------------------------
  135.  
  136.  
  137.  
  138. Here's what the page parameters look like:
  139.  
  140. _    _________________________________________________
  141. |    |    top margin - (includes header)        |
  142. |    |-----------------------------------------------|
  143. |    |        top margin 2            |
  144. |    |-----------------------------------------------|
  145. P    |    :                :    |
  146. A    |    :<-indent            :    |
  147. G    |    :                :    |
  148. E    |    :lots and lots of silly text and:    |
  149. L    |    :other garbage. Get the picture?:    |
  150. E    |       :This is a temp.  indentation:    |
  151. N    |    :                :    |
  152. G    |    :        right margin -> :    |
  153. T    |    :                :    |
  154. H    |    :                :    |
  155. |    |-----------------------------------------------|
  156. |    |        margin 3            |
  157. |    |-----------------------------------------------|
  158. |    |    margin 4 - (includes footer)        |
  159. -    -------------------------------------------------
  160.  
  161.  
  162. To change the default for any parameter, simply alter ROFFGLOB
  163. recompile ROFF1.c and ROFF2.c, and re-clink them with NDIO.CRL
  164. (you can use DIO.CRL, but it doesn't have all the features of
  165. NDIO )
  166.  
  167.  
  168.  
  169. ************************************************************
  170. A Few Extra Comments on Some of the Commands:
  171. ************************************************************
  172.  
  173.                 If you want to center lots of lines, but don't
  174.         want to count them, do something like this:
  175.  
  176. .ce    1000
  177. lots and
  178. lots of words to
  179. be centered
  180. .ce 0
  181.  
  182.         --------------------------------------
  183.  
  184.         To underline a few words on a line:
  185.  
  186. .fi
  187. .ul
  188. Some
  189. of the words in
  190. .ul
  191. this
  192. sentence are 
  193. .ul
  194. underlined
  195. .nf
  196.  
  197.         WOULD PRODUCE:
  198.  
  199. Some of the words in this sentence are underlined.
  200. ----                 ----              -----------
  201.  
  202. (obviously you don't have to turn the fill on and off if it's
  203.  already on )
  204.  
  205.         ------------------------------------
  206.  
  207. A new paragrah may be caused by using the temporary indent
  208. command, like
  209.  
  210. .ti +5
  211.  
  212. or by simply beginning the paragraph with a tab, as you would if
  213. you were just typing.
  214.  
  215.         ------------------------------------
  216.  
  217. Headers and Footers.
  218.  
  219.         A page number can be incorporated into any header or
  220. footer by putting a "#" in the title where you want the number
  221. to go:
  222.  
  223. .he    This is a witty header title for page #
  224.  
  225. Each time this is printed at the top of a page, the current
  226. page number will be substituted for the "#".
  227.  
  228.         ------------------------------------
  229. If you want to send the output to a file, and don't want the page
  230. breaks in there ( that's what I did for this ) set margins 1-4 to
  231. zero.
  232.  send the output to a file, and don't want the page
  233. breaks in there ( that's what I d