home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume38 / par / part03 < prev    next >
Encoding:
Text File  |  1993-08-12  |  29.3 KB  |  1,115 lines

  1. Newsgroups: comp.sources.misc
  2. From: amc@wuecl.wustl.edu (Adam Costello)
  3. Subject: v38i116:  par - paragraph reformatter, v1.20, Part03/03
  4. Message-ID: <1993Aug12.140716.8078@sparky.sterling.com>
  5. X-Md4-Signature: c69d33279cfa417133a6572245b0287f
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Thu, 12 Aug 1993 14:07:16 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: amc@wuecl.wustl.edu (Adam Costello)
  12. Posting-number: Volume 38, Issue 116
  13. Archive-name: par/part03
  14. Environment: ANSI-C
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then unpack
  18. # it by saving it into a file and typing "sh file".  To overwrite existing
  19. # files, type "sh file -c".  You can also feed this as standard input via
  20. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  21. # will see the following message at the end:
  22. #        "End of shell archive."
  23. # Contents:  Par120 Par120/par.1 Par120/protoMakefile
  24. # Wrapped by amc@wuecl on Mon Aug  9 11:01:34 1993
  25. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  26. if test ! -d 'Par120' ; then
  27.     echo shar: Creating directory \"'Par120'\"
  28.     mkdir 'Par120'
  29. fi
  30. if test -f 'Par120/par.1' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'Par120/par.1'\"
  32. else
  33. echo shar: Extracting \"'Par120/par.1'\" \(25639 characters\)
  34. sed "s/^X//" >'Par120/par.1' <<'END_OF_FILE'
  35. X.\"*********************
  36. X.\"* par.1             *
  37. X.\"* for Par 1.20      *
  38. X.\"* Copyright 1993 by *
  39. X.\"* Adam M. Costello  *
  40. X.\"*********************
  41. X.\"
  42. X.\" This is nroff -man (or troff -man) code.
  43. X.\"
  44. X.TH par 1 "10 August 1993" "Par 1.20" "USER COMMANDS"
  45. X.SH NAME
  46. Xpar \- filter for reformatting paragraphs
  47. X.SH SYNOPSIS
  48. X.ds O \fR[\fP
  49. X.ds C \fR]\fP
  50. X.de OP
  51. X.BI \*O\ \\$1 \\$2\ \*C
  52. X..
  53. X.TP .5i
  54. X.B par
  55. X.na
  56. X.OP version
  57. X.OP h \*Ohang\*C
  58. X.OP p prefix
  59. X.OP s suffix
  60. X.OP w width
  61. X.OP d \*Odiv\*C
  62. X.OP f \*Ofit\*C
  63. X.OP j \*Ojust\*C
  64. X.OP l \*Olast\*C
  65. X.OP t \*Otouch\*C
  66. X.br
  67. X.ad
  68. X.SH DESCRIPTION
  69. X.ie t .ds Q ``
  70. X.el .ds Q ""
  71. X.ie t .ds U ''
  72. X.el .ds U ""
  73. X.de IT
  74. X.LP
  75. X\h'-\w"\\$1\ "u'\\$1\ \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
  76. X..
  77. X.LP
  78. X.B par
  79. Xis a filter which copies its input to its output, changing
  80. Xall white characters (except newlines) to spaces, and
  81. Xreformatting each paragraph. Paragraphs are delimited
  82. Xby vacant lines, which are lines containing no more
  83. Xthan a prefix, suffix, and intervening spaces (see the
  84. X.SM DETAILS
  85. Xsection for a precise definition).
  86. X.LP
  87. XEach output paragraph is generated from
  88. Xthe corresponding input lines as follows:
  89. X.RS
  90. X.LP
  91. X.IT 1. An optional prefix and/or suffix
  92. Xis removed from each input line.
  93. X.IT 2. The remainder is divided into
  94. Xwords (delimited by spaces).
  95. X.IT 3. The words are joined into lines
  96. Xto make an eye-pleasing paragraph.
  97. X.IT 4. The prefixes and suffixes are reattached.
  98. X.RE
  99. X.LP
  100. XIf there are suffixes, spaces are inserted before
  101. Xthem so that they all end in the same column.
  102. X.SH TERMS
  103. X.TP 1i
  104. Xbody character
  105. XA member of the set of characters defined by the
  106. X.SM PARBODY
  107. Xenvironment variable (see the
  108. X.SM ENVIRONMENT
  109. Xsection).
  110. X.TP
  111. Xcomprelen
  112. XThe comprelen of a non-empty set of lines is the
  113. Xlength of the longest string of non-body characters
  114. Xappearing at the beginning of every line in the set.
  115. X.TP
  116. Xcomsuflen
  117. XGiven a non-empty set
  118. X.I S
  119. Xof lines, let
  120. X.I p
  121. Xbe the comprelen of
  122. X.IR S .
  123. XLet
  124. X.I T
  125. Xbe the set of lines which result from stripping the first
  126. X.I p
  127. Xcharacters from each line in
  128. X.IR S .
  129. XLet
  130. X.I c
  131. Xbe the longest string of non-body characters
  132. Xappearing at the end of every line in
  133. X.IR T .
  134. XStrip
  135. X.I c
  136. Xof all initial spaces except the last. The length of
  137. X.I c
  138. Xis the comsuflen of
  139. X.IR S .
  140. X.TP
  141. XIP
  142. XInput paragraph.
  143. X.TP
  144. XOP
  145. XOutput paragraph.
  146. X.TP
  147. Xwhite character
  148. XA space, formfeed, newline, carriage
  149. Xreturn, tab, or vertical tab.
  150. X.SH OPTIONS
  151. X.LP
  152. XAny command line argument may begin with one
  153. Xminus sign (\-) which is ignored. Generally, more
  154. Xthan one option may appear in a single command
  155. Xline argument, but there is one exception: the
  156. X.B version
  157. Xoption must have a whole argument all to itself.
  158. X.TP 1i
  159. X.B version
  160. XCauses all remaining arguments to be ignored. No input
  161. Xis read. \*Qpar 1.20\*U is printed on the output. Of
  162. Xcourse, this will change in future releases of Par.
  163. X.LP
  164. XAll remaining options are used to set values of variables.
  165. XValues set by command line options hold for all paragraphs
  166. Xin the input. Unset variables are given default values.
  167. XAny unset variables whose default values depend on
  168. Xthe IP are recomputed separately for each paragraph.
  169. X.LP
  170. XThe approximate role of each
  171. Xvariable is described here. See the
  172. X.SM DETAILS
  173. Xsection for a much more complete and precise description.
  174. X.LP
  175. XThe first four variables,
  176. X.IR hang ,
  177. X.IR prefix ,
  178. X.IR suffix ,
  179. Xand
  180. X.IR width ,
  181. Xmay be set to any unsigned decimal integer less than 10000.
  182. X.TP 1i
  183. X.BI h\fR[ hang\fR]
  184. XMainly affects the default values of
  185. X.I prefix
  186. Xand
  187. X.IR suffix .
  188. XDefaults to 0. If the
  189. X.B h
  190. Xoption is given without a number, the
  191. Xvalue 1 is inferred. (See also the
  192. X.B p
  193. Xand
  194. X.B s
  195. Xoptions.)
  196. X.TP
  197. X.BI p prefix
  198. XThe first
  199. X.I prefix
  200. Xcharacters of each line of the OP are copied from the first
  201. X.I prefix
  202. Xcharacters of the corresponding line
  203. Xof the IP. Defaults to 0 if there are
  204. Xless than
  205. X.IR hang \ +\ 2
  206. Xlines in the IP. Otherwise, defaults to the comprelen
  207. Xof all the lines in the IP except the first
  208. X.I hang
  209. Xof them. (See also the
  210. X.B h
  211. Xoption.)
  212. X.TP
  213. X.BI s suffix
  214. XThe last
  215. X.I suffix
  216. Xcharacters of each line of the OP are copied from the last
  217. X.I suffix
  218. Xcharacters of the corresponding line of the
  219. XIP. Defaults to 0 if there are less than
  220. X.IR hang \ +\ 2
  221. Xlines in the IP.
  222. XOtherwise, defaults to the comsuflen of
  223. Xall the lines of the IP except the first
  224. X.I hang
  225. Xof them. (See also the
  226. X.B h
  227. Xoption.)
  228. X.TP
  229. X.BI w width
  230. XNo line in the OP will contain more than
  231. X.I width
  232. Xcharacters, not including the
  233. Xtrailing newlines. Defaults to 72.
  234. X.LP
  235. XThe remaining five variables,
  236. X.IR div,
  237. X.IR fit,
  238. X.IR just,
  239. X.IR last,
  240. Xand
  241. X.IR touch,
  242. Xmay be set to either 0 or 1. If the number is
  243. Xabsent in the option, the value 1 is inferred.
  244. X.TP 1i
  245. X.BI d\fR[ div\fR]
  246. XIf
  247. X.I div
  248. Xis 1, then each block of text that would normally count
  249. Xas a paragraph (delimited by vacant lines) will be
  250. Xfurther subdivided into paragraphs as follows. Let
  251. X.I p
  252. Xbe the comprelen of all the lines in the
  253. Xblock. Let a line's status be 1 if its
  254. X.RI ( p \ +\ 1)st
  255. Xcharacter is a space, 0 otherwise. Every line in the
  256. Xblock whose status is the same as the status of the
  257. Xfirst line will begin a new paragraph. Defaults to 0.
  258. X.TP
  259. X.BI f\fR[ fit\fR]
  260. XIf
  261. X.I fit
  262. Xis 1 and
  263. X.I just
  264. Xis 0,
  265. X.B par
  266. Xwill try to make the lines in the OP as nearly the
  267. Xsame length as possible, even if it means making
  268. Xthe OP narrower. Defaults to 0. (See also the
  269. X.B j
  270. Xoption.)
  271. X.TP
  272. X.BI j\fR[ just\fR]
  273. XIf
  274. X.I just
  275. Xis 1,
  276. X.B par
  277. Xjustifies the OP, inserting spaces between words
  278. Xso that all lines in the OP have length
  279. X.I width
  280. X(except the last, if
  281. X.I last
  282. Xis 0).
  283. X.I fit
  284. Xhas no effect if
  285. X.I just
  286. Xis 1. Defaults to 0. (See also the
  287. X.BR w ,
  288. X.BR l ,
  289. Xand
  290. X.B f
  291. Xoptions.)
  292. X.TP
  293. X.BI l\fR[ last\fR]
  294. XIf
  295. X.I last
  296. Xis 1,
  297. X.B par
  298. Xtries to make the last line of the OP about
  299. Xthe same length as the others. Defaults to 0.
  300. X.TP
  301. X.BI t\fR[ touch\fR]
  302. XHas no effect if
  303. X.I suffix
  304. Xis 0 or
  305. X.I just
  306. Xis 1. Otherwise, if
  307. X.I touch
  308. Xis 0, all lines in the OP have length
  309. X.IR width .
  310. XIf
  311. X.I touch
  312. Xis 1, then the length of the lines is decreased until the
  313. Xsuffixes touch the body of the OP. Defaults to the logical
  314. X.SM OR
  315. Xof
  316. X.I fit
  317. Xand
  318. X.IR last .
  319. X(See also the
  320. X.BR s ,
  321. X.BR j ,
  322. X.BR w ,
  323. X.BR f ,
  324. Xand
  325. X.B l
  326. Xoptions.)
  327. X.LP
  328. XIf the value of any variable is set more
  329. Xthan once, the last value is used. When
  330. Xunset variables are assigned default values,
  331. X.I hang
  332. Xis assigned before
  333. X.IR prefix ,
  334. Xand
  335. X.I fit
  336. Xand
  337. X.I last
  338. Xare assigned before
  339. X.I touch
  340. X(because of the dependencies).
  341. X.LP
  342. XIt is an error if
  343. X.I width
  344. X<=
  345. X.I prefix
  346. X+
  347. X.IR suffix .
  348. X.SH ENVIRONMENT
  349. X.TP 1i
  350. X.SM PARINIT
  351. XIf set,
  352. X.B par
  353. Xwill read command line options from
  354. X.SM PARINIT
  355. Xbefore it reads them from the command line.
  356. X.TP
  357. X.SM PARBODY
  358. XAll and only the characters appearing in the value of
  359. X.SM PARBODY
  360. Xcount as body characters (which are used for determining
  361. Xcomprelens and comsuflens). The underscore is an escape
  362. Xcharacter, which may begin the following escape sequences:
  363. X.RS 2i
  364. X.IT __\ = an underscore
  365. X.IT _s\ = a space
  366. X.IT _A\ = all upper case characters
  367. X.IT _a\ = all lower case characters
  368. X.IT _0\ = all decimal digits
  369. X.IT _x\fIhh\fP\ = the character represented
  370. Xby the two hexadecimal digits
  371. X.I hh
  372. X(which may be upper or lower case)
  373. X.RE
  374. X.RS 1i
  375. X.LP
  376. XIf
  377. X.SM PARBODY
  378. Xis not set, there are no body characters.
  379. X.LP
  380. XA good value for
  381. X.SM PARBODY
  382. Xmight be \*Q_a_A.\*U, but it depends on the application.
  383. X.RE
  384. X.LP
  385. XIf a
  386. X.SM NUL
  387. Xcharacter appears in the value of an environment variable,
  388. Xit and the rest of the string will not be seen by
  389. X.BR par .
  390. X.SH DETAILS
  391. X.LP
  392. XEvery white
  393. Xcharacter in the input (unless it is a newline)
  394. Xis changed into a space immediately after it
  395. Xhas been read. NUL characters in the input are
  396. Xinvisible, just as if they weren't there at all.
  397. X.LP
  398. XLines are terminated by newline characters, but the
  399. Xnewlines are not considered to be included in the lines.
  400. XIf the last character of the input is a non-newline,
  401. Xthen a newline will be inferred immediately after
  402. Xit (but if the input is empty, no newline will be
  403. Xinferred; the number of input lines will be 0). Thus,
  404. Xthe input can always be viewed as a sequence of lines.
  405. X.LP
  406. XVacant lines in the input are defined
  407. Xrecursively by the following rules:
  408. X.RS
  409. X.IT 1) Any line which is empty or
  410. Xcontains only spaces is vacant.
  411. X.IT 2) Suppose
  412. X.I A
  413. Xand
  414. X.I B
  415. Xare two vacant lines with at
  416. Xleast two lines between them. Let
  417. X.I p
  418. Xand
  419. X.I s
  420. Xbe the comprelen and comsuflen of the intervening
  421. Xlines. Any intervening line which, if stripped of
  422. Xits first
  423. X.I p
  424. Xcharacters and last
  425. X.I s
  426. Xcharacters, would be empty, or would
  427. Xcontain only spaces, is vacant.
  428. X.IT 3) If a line cannot be shown to
  429. Xbe vacant by repeated application of
  430. Xrules 1 and 2, then it is not vacant.
  431. X.RE
  432. X.LP
  433. XA subsequence of non-vacant lines in the input is called
  434. Xa block if there is no non-vacant line immediately
  435. Xabove or below it (i.e., if it is maximal). If
  436. X.I div
  437. Xis 0, then the IPs are exactly the blocks. If
  438. X.I div
  439. Xis 1, then the IPs are the subdivisions
  440. Xof the blocks as described in the
  441. X.SM OPTIONS
  442. Xsection in the entry for
  443. X.IR div .
  444. X.LP
  445. XEach vacant line of the input is copied to the
  446. Xoutput unchanged except that any trailing spaces
  447. Xare stripped. The remainder of this section
  448. Xdescribes the process which is applied independently
  449. Xto each IP to construct the corresponding OP.
  450. X.LP
  451. XAfter the values of the variables are determined (see the
  452. X.SM OPTIONS
  453. Xsection), the first
  454. X.I prefix
  455. Xcharacters and the last
  456. X.I suffix
  457. Xcharacters of each input line are removed and remembered.
  458. XIt is an error for any line to contain fewer than
  459. X.IR prefix \ +\  suffix
  460. Xcharacters.
  461. X.LP
  462. XThe remaining text is treated as a sequence of
  463. Xcharacters, not lines. The text is broken into
  464. Xwords, which are delimited by spaces. That is, a
  465. X.I word
  466. Xis a maximal sub-sequence of non-spaces. If
  467. Xthere is at least one word, and the first word
  468. Xis preceeded only by spaces, then the first
  469. Xword is expanded to include those spaces.
  470. X.LP
  471. XLet
  472. X.I L
  473. X=
  474. X.I width
  475. X\-
  476. X.I prefix
  477. X\-
  478. X.IR suffix .
  479. X.LP
  480. XEvery word which contains more than
  481. X.I L
  482. Xcharacters is broken, after each
  483. X.IR L th
  484. Xcharacter, into multiple words.
  485. X.LP
  486. XThese words are reassembled, preserving their
  487. Xorder, into lines. If
  488. X.I just
  489. Xis 0, adjacent words within a line are separated by
  490. Xa single space, and line breaks are chosen so that
  491. Xthe paragraph satisfies the following properties:
  492. X.RS 1i
  493. X.IT 1) No line contains more than
  494. X.I L
  495. Xcharacters.
  496. X.IT 2) If
  497. X.I fit
  498. Xis 1, the difference between the lengths of the
  499. Xshortest and longest lines is as small as possible.
  500. X.IT 3) The shortest line is as long as
  501. Xpossible, subject to properties 1 and 2.
  502. X.IT 4) Let
  503. X.I target
  504. Xbe
  505. X.I L
  506. Xif
  507. X.I fit
  508. Xis 0, or the length of the longest line if
  509. X.I fit
  510. Xis 1. The sum of the squares of the differences between
  511. X.I target
  512. Xand the lengths of the lines is as small as
  513. Xpossible, subject to properties 1, 2, and 3.
  514. X.RE
  515. X.RS .5i
  516. X.LP
  517. XIf
  518. X.I last
  519. Xis 0, then the last line does not count as a line
  520. Xfor the purposes of properties 2, 3, and 4 above.
  521. X.LP
  522. XIf all the words fit on a single line, then
  523. Xthe properties as worded above don't make much
  524. Xsense. In that case, no line breaks are inserted.
  525. X.RE
  526. X.LP
  527. XIf
  528. X.I just
  529. Xis 1, then adjacent words within a line are separated by
  530. Xone space plus zero or more extra spaces, the value of
  531. X.I fit
  532. Xis disregarded, and line breaks are chosen so that
  533. Xthe paragraph satisfies the following properties:
  534. X.RS 1i
  535. X.IT 1) Every line contains exactly
  536. X.I L
  537. Xcharacters.
  538. X.IT 2) The largest inter-word gap is as
  539. Xsmall as possible, subject to property 1.
  540. X.IT 3) The sum of the squares of the numbers
  541. Xof extra spaces required in each inter-word gap is
  542. Xas small as possible, subject to properties 1 and 2.
  543. X.RE
  544. X.RS .5i
  545. X.LP
  546. XIf
  547. X.I last
  548. Xis 0, then the last line does not count as a
  549. Xline for the purposes of property 1, and it
  550. Xdoes not require or contain any extra spaces.
  551. X.LP
  552. XExtra spaces are distributed as uniformly as
  553. Xpossible among the inter-word gaps in each line.
  554. X.LP
  555. XSome paragraphs are impossible to justify,
  556. Xbecause they contain words too long relative to
  557. X.IR L .
  558. XIf this is the case, it is considered an error (see the
  559. X.SM DIAGNOSTICS
  560. Xsection).
  561. X.RE
  562. X.LP
  563. XIf the number of lines in the
  564. Xresulting paragraph is less than
  565. X.IR hang ,
  566. Xthen empty lines are added at the end
  567. Xto bring the number of lines up to
  568. X.IR hang .
  569. X.LP
  570. XIf
  571. X.I just
  572. Xis 0 and
  573. X.I touch
  574. Xis 1, then
  575. X.I L
  576. Xis changed to be the length of the longest line.
  577. X.LP
  578. XIf
  579. X.I suffix
  580. Xis not 0, then each line is padded at the
  581. Xend with spaces to bring its length up to
  582. X.IR L .
  583. X.LP
  584. XTo each line is prepended
  585. X.I prefix
  586. Xcharacters. Let
  587. X.I n
  588. Xbe the number of lines in the IP. The
  589. Xcharacters which are prepended to the
  590. X.IR i th
  591. Xline are chosen as follows:
  592. X.RS
  593. X.LP
  594. X.IT 1) If
  595. X.I i
  596. X<=
  597. X.IR n ,
  598. Xthen the characters are copied from the ones
  599. Xthat were removed from the beginning of the
  600. X.IR n th
  601. Xinput line.
  602. X.IT 2) If
  603. X.I i
  604. X>
  605. X.I n
  606. X>
  607. X.IR hang ,
  608. Xthen the characters are copied from the ones that were
  609. Xremoved from the beginning of the last input line.
  610. X.IT 3) If
  611. X.I i
  612. X>
  613. X.I n
  614. Xand
  615. X.I n
  616. X<=
  617. X.IR hang ,
  618. Xthen the characters are all spaces.
  619. X.RE
  620. X.LP
  621. XThen to each line is appended
  622. X.I suffix
  623. Xcharacters. The characters which are appended to the
  624. X.IR i th
  625. Xline are chosen as follows:
  626. X.RS
  627. X.LP
  628. X.IT 1) If
  629. X.I i
  630. X<=
  631. X.IR n ,
  632. Xthen the characters are copied from the
  633. Xones that were removed from the end of the
  634. X.IR n th
  635. Xinput line.
  636. X.IT 2) If
  637. X.I i
  638. X>
  639. X.I n
  640. X> 0, then the characters are copied from the ones that
  641. Xwere removed from the end of the last input line.
  642. X.IT 3) If
  643. X.I n
  644. X= 0, then the characters are all spaces.
  645. X.RE
  646. X.LP
  647. XFinally, the lines are printed to the output as the OP.
  648. X.SH DIAGNOSTICS
  649. X.LP
  650. XIf there are no errors,
  651. X.B par
  652. Xreturns
  653. X.SM EXIT_SUCCESS
  654. X(see
  655. X.BR <stdlib.h> ).
  656. X.LP
  657. XIf there is an error, then an error
  658. Xmessage will be printed to the output, and
  659. X.B par
  660. Xwill return
  661. X.SM EXIT_FAILURE\s0\.
  662. XIf the error is local to a single paragraph, then the
  663. Xpreceeding paragraphs will have been output before the
  664. Xerror was detected. Line numbers in error messages are
  665. Xlocal to the IP in which the error occurred. All error
  666. Xmessages begin with "par error:" on a line by itself.
  667. X.LP
  668. XOf course, trying to print an error message would be
  669. Xfutile if an error resulted from an output function, so
  670. X.B par
  671. Xdoesn't bother doing any error checking on output functions.
  672. X.SH EXAMPLES
  673. X.de VS
  674. X.RS -.5i
  675. X.LP
  676. X.nf
  677. X.ps -1p
  678. X.vs -2p
  679. X.cs R 20
  680. X..
  681. X.de VE
  682. X.cs R
  683. X.vs
  684. X.ps
  685. X.fi
  686. X.RE
  687. X..
  688. X.de CM
  689. X\&\*Q\fB\\$1\fP\\*U:
  690. X..
  691. X.LP
  692. XThe superiority of
  693. X.BR par 's
  694. Xdynamic programming algorithm over a
  695. Xgreedy algorithm (such as the one used by
  696. X.BR fmt )
  697. Xcan be seen in the following example:
  698. X.LP
  699. XOriginal paragraph (note that
  700. Xeach line begins with 8 spaces):
  701. X.VS
  702. X        We the people of the United States,
  703. X        in order to form a more perfect union,
  704. X        establish justice,
  705. X        insure domestic tranquility,
  706. X        provide for the common defense,
  707. X        promote the general welfare,
  708. X        and secure the blessing of liberty
  709. X        to ourselves and our posterity,
  710. X        do ordain and establish the Constitution
  711. X        of the United States of America.
  712. X.VE
  713. X.LP
  714. XAfter a greedy algorithm with width = 39:
  715. X.VS
  716. X        We the people of the United
  717. X        States, in order to form a more
  718. X        perfect union, establish
  719. X        establish justice, insure
  720. X        domestic tranquility, provide
  721. X        for the common defense, promote
  722. X        the general welfare, and secure
  723. X        the blessing of liberty to
  724. X        ourselves and our posterity, do
  725. X        ordain and establish the
  726. X        Constitution of the United
  727. X        States of America.
  728. X.VE
  729. X.LP
  730. XAfter
  731. X.CM "par 39"
  732. X.VS
  733. X        We the people of the United
  734. X        States, in order to form a
  735. X        more perfect union, establish
  736. X        justice, insure domestic
  737. X        tranquility, provide for the
  738. X        common defense, promote the
  739. X        general welfare, and secure
  740. X        the blessing of liberty to
  741. X        ourselves and our posterity,
  742. X        do ordain and establish the
  743. X        Constitution of the United
  744. X        States of America.
  745. X.VE
  746. X.LP
  747. XThe line breaks chosen by
  748. X.B par
  749. Xare clearly more eye-pleasing.
  750. X.LP
  751. X.B par
  752. Xis most useful in conjunction with the text-filtering
  753. Xfeatures of an editor, such as the ! commands of
  754. X.BR vi.
  755. X.LP
  756. XThe rest of this section is a series of
  757. Xbefore-and-after pictures showing some typical uses of
  758. X.BR par .
  759. X.LP
  760. XBefore:
  761. X.VS
  762. X        /*   We the people of the United States, */
  763. X        /* in order to form a more perfect union, */
  764. X        /* establish justice, */
  765. X        /* insure domestic tranquility, */
  766. X        /* provide for the common defense, */
  767. X        /* promote the general welfare, */
  768. X        /* and secure the blessing of liberty */
  769. X        /* to ourselves and our posterity, */
  770. X        /* do ordain and establish the Constitution */
  771. X        /* of the United States of America. */
  772. X.VE
  773. X.LP
  774. XAfter
  775. X.CM "par 59"
  776. X.VS
  777. X        /*   We the people of the United States, in      */
  778. X        /* order to form a more perfect union, establish */
  779. X        /* justice, insure domestic tranquility, provide */
  780. X        /* for the common defense, promote the general   */
  781. X        /* welfare, and secure the blessing of liberty   */
  782. X        /* to ourselves and our posterity, do ordain     */
  783. X        /* and establish the Constitution of the United  */
  784. X        /* States of America.                            */
  785. X.VE
  786. X.LP
  787. XOr after
  788. X.CM "par 59f"
  789. X.VS
  790. X        /*   We the people of the United States,  */
  791. X        /* in order to form a more perfect union, */
  792. X        /* establish justice, insure domestic     */
  793. X        /* tranquility, provide for the common    */
  794. X        /* defense, promote the general welfare,  */
  795. X        /* and secure the blessing of liberty to  */
  796. X        /* ourselves and our posterity, do ordain */
  797. X        /* and establish the Constitution of the  */
  798. X        /* United States of America.              */
  799. X.VE
  800. X.LP
  801. XOr after
  802. X.CM "par 59l"
  803. X.VS
  804. X        /*   We the people of the United States, in      */
  805. X        /* order to form a more perfect union, establish */
  806. X        /* justice, insure domestic tranquility,         */
  807. X        /* provide for the common defense, promote       */
  808. X        /* the general welfare, and secure the           */
  809. X        /* blessing of liberty to ourselves and our      */
  810. X        /* posterity, do ordain and establish the        */
  811. X        /* Constitution of the United States of America. */
  812. X.VE
  813. X.LP
  814. XOr after
  815. X.CM "par 59lf"
  816. X.VS
  817. X        /*   We the people of the United States,  */
  818. X        /* in order to form a more perfect union, */
  819. X        /* establish justice, insure domestic     */
  820. X        /* tranquility, provide for the common    */
  821. X        /* defense, promote the general welfare,  */
  822. X        /* and secure the blessing of liberty     */
  823. X        /* to ourselves and our posterity, do     */
  824. X        /* ordain and establish the Constitution  */
  825. X        /* of the United States of America.       */
  826. X.VE
  827. X.LP
  828. XOr after
  829. X.CM "par 59lft0"
  830. X.VS
  831. X        /*   We the people of the United States,         */
  832. X        /* in order to form a more perfect union,        */
  833. X        /* establish justice, insure domestic            */
  834. X        /* tranquility, provide for the common           */
  835. X        /* defense, promote the general welfare,         */
  836. X        /* and secure the blessing of liberty            */
  837. X        /* to ourselves and our posterity, do            */
  838. X        /* ordain and establish the Constitution         */
  839. X        /* of the United States of America.              */
  840. X.VE
  841. X.LP
  842. XOr after
  843. X.CM "par 59j"
  844. X.VS
  845. X        /*   We  the people  of  the  United States,  in */
  846. X        /* order to form a more perfect union, establish */
  847. X        /* justice, insure domestic tranquility, provide */
  848. X        /* for the  common defense, promote  the general */
  849. X        /* welfare, and  secure the blessing  of liberty */
  850. X        /* to ourselves and our posterity, do ordain and */
  851. X        /* establish  the  Constitution  of  the  United */
  852. X        /* States of America.                            */
  853. X.VE
  854. X.LP
  855. XOr after
  856. X.CM "par 59jl"
  857. X.VS
  858. X        /*   We  the   people  of  the   United  States, */
  859. X        /* in   order    to   form   a    more   perfect */
  860. X        /* union,  establish  justice,  insure  domestic */
  861. X        /* tranquility, provide for  the common defense, */
  862. X        /* promote  the  general   welfare,  and  secure */
  863. X        /* the  blessing  of  liberty to  ourselves  and */
  864. X        /* our  posterity, do  ordain and  establish the */
  865. X        /* Constitution of the United States of America. */
  866. X.VE
  867. X.LP
  868. XBefore:
  869. X.VS
  870. X        Preamble      We the people of the United States,
  871. X        to the US     in order to form
  872. X        Constitution  a more perfect union,
  873. X                      establish justice,
  874. X                      insure domestic tranquility,
  875. X                      provide for the common defense,
  876. X                      promote the general welfare,
  877. X                      and secure the blessing of liberty
  878. X                      to ourselves and our posterity,
  879. X                      do ordain and establish
  880. X                      the Constitution
  881. X                      of the United States of America.
  882. X.VE
  883. X.LP
  884. XAfter
  885. X.CM "par 52h3"
  886. X.VS
  887. X        Preamble      We the people of the United
  888. X        to the US     States, in order to form a
  889. X        Constitution  more perfect union, establish
  890. X                      justice, insure domestic
  891. X                      tranquility, provide for the
  892. X                      common defense, promote the
  893. X                      general welfare, and secure
  894. X                      the blessing of liberty to
  895. X                      ourselves and our posterity,
  896. X                      do ordain and establish the
  897. X                      Constitution of the United
  898. X                      States of America.
  899. X.VE
  900. X.LP
  901. XBefore:
  902. X.VS
  903. X         1  We the people of the United States,
  904. X         2  in order to form a more perfect union,
  905. X         3  establish justice,
  906. X         4  insure domestic tranquility,
  907. X         5  provide for the common defense,
  908. X         6  promote the general welfare,
  909. X         7  and secure the blessing of liberty
  910. X         8  to ourselves and our posterity,
  911. X         9  do ordain and establish the Constitution
  912. X        10  of the United States of America.
  913. X.VE
  914. X.LP
  915. XAfter
  916. X.CM "par 59p12l"
  917. X.VS
  918. X         1  We the people of the United States, in order to
  919. X         2  form a more perfect union, establish justice,
  920. X         3  insure domestic tranquility, provide for the
  921. X         4  common defense, promote the general welfare,
  922. X         5  and secure the blessing of liberty to ourselves
  923. X         6  and our posterity, do ordain and establish the
  924. X         7  Constitution of the United States of America.
  925. X.VE
  926. X.LP
  927. XBefore:
  928. X.VS
  929. X        > >   We the people of the United States, in
  930. X        > > order to form a more perfect union,
  931. X        > >   Establish justice, ensure domestic
  932. X        > > tranquility, provide for the common defense,
  933. X        >
  934. X        >   Promote the general welfare, and secure
  935. X        > the blessing of liberty to ourselves and
  936. X        > our posterity,
  937. X        >   Do ordain and establish the Constitution
  938. X        > of the United States of America.
  939. X.VE
  940. X.LP
  941. XAfter
  942. X.CM "par 42d"
  943. X.VS
  944. X        > >   We the people of the United
  945. X        > > States, in order to form a
  946. X        > > more perfect union,
  947. X        > >   Establish justice, ensure
  948. X        > > domestic tranquility, provide
  949. X        > > for the common defense,
  950. X        >
  951. X        >   Promote the general welfare,
  952. X        > and secure the blessing of
  953. X        > liberty to ourselves and our
  954. X        > posterity,
  955. X        >   Do ordain and establish the
  956. X        > Constitution of the United
  957. X        > States of America.
  958. X.VE
  959. X.SH SEE ALSO
  960. X.LP
  961. X.B par.doc
  962. X.SH LIMITATIONS
  963. X.LP
  964. XIf you like two spaces between sentences, too
  965. Xbad. Differentiating between periods that end
  966. Xsentences and periods used in abbreviations
  967. Xis a complex problem beyond the scope of this
  968. Xsimple filter. Consider the following tough case:
  969. X.VS
  970. X        I calc'd the approx.
  971. X        Fermi level to 3 sig. digits.
  972. X.VE
  973. X.LP
  974. XSuppose that that should be reformatted to:
  975. X.VS
  976. X        I calc'd the approx. Fermi
  977. X        level to three sig. digits.
  978. X.VE
  979. X.LP
  980. XThe program has to decide whether to put 1 or 2 spaces
  981. Xbetween \*Qapprox.\*U and \*QFermi\*U. There is no obvious
  982. Xhint from the original paragraph because there was a line
  983. Xbreak between them, and \*QFermi\*U begins with a capital
  984. Xletter. The program would apparently have to understand
  985. XEnglish grammar to determine that the sentence does not
  986. Xend there (and then it would only work for English text).
  987. X.LP
  988. XIf you use tabs, you probably won't like the way
  989. X.B par
  990. Xhandles
  991. X(or doesn't handle) them. It turns them into spaces. I
  992. Xdidn't bother trying to make sense of tabs because they
  993. Xdon't make sense to begin with. Not everyone's terminal
  994. Xhas the same tab settings, so text files containing
  995. Xtabs are sometimes mangled. In fact, almost every text
  996. Xfile containing tabs gets mangled when something is
  997. Xinserted at the beginning of each line (when quoting
  998. Xe-mail or commenting out a section of a shell script, for
  999. Xexample), making them a pain to edit. In my opinion, the
  1000. Xworld would be a nicer place if everyone stopped using
  1001. Xtabs (so I'm doing my part by not supporting them in
  1002. X.BR par .)
  1003. X.LP
  1004. XThere is currently no way for the length of the
  1005. Xoutput prefix to differ from the length of the
  1006. Xinput prefix. Ditto for the suffix. I may consider
  1007. Xadding this capability in a future release, but
  1008. Xright now I'm not sure how I'd want it to work.
  1009. X.SH BUGS
  1010. X.LP
  1011. XIf I knew of any bugs, I wouldn't release the package. Of
  1012. Xcourse, there may be bugs that I haven't yet discovered.
  1013. X.LP
  1014. XIf you find any bugs, or if you have
  1015. Xany suggestions, please send e-mail to:
  1016. X.RS
  1017. X.LP
  1018. Xamc@ecl.wustl.edu
  1019. X.RE
  1020. X.LP
  1021. Xor send paper mail to:
  1022. X.RS
  1023. X.LP
  1024. X.nf
  1025. XAdam M. Costello
  1026. XCampus Box 1045
  1027. XWashington University
  1028. XOne Brookings Dr.
  1029. XSt. Louis, MO 63130
  1030. XUSA
  1031. X.fi
  1032. X.RE
  1033. X.LP
  1034. XNote that both addresses could
  1035. Xchange anytime after June 1994.
  1036. X.LP
  1037. XWhen reporting a bug, please include the exact input and
  1038. Xcommand line options used, and the version number of
  1039. X.BR par ,
  1040. Xso that I can reproduce it.
  1041. END_OF_FILE
  1042. if test 25639 -ne `wc -c <'Par120/par.1'`; then
  1043.     echo shar: \"'Par120/par.1'\" unpacked with wrong size!
  1044. fi
  1045. # end of 'Par120/par.1'
  1046. fi
  1047. if test -f 'Par120/protoMakefile' -a "${1}" != "-c" ; then 
  1048.   echo shar: Will not clobber existing file \"'Par120/protoMakefile'\"
  1049. else
  1050. echo shar: Extracting \"'Par120/protoMakefile'\" \(1285 characters\)
  1051. sed "s/^X//" >'Par120/protoMakefile' <<'END_OF_FILE'
  1052. X# *********************
  1053. X# * protoMakefile     *
  1054. X# * for Par 2.10      *
  1055. X# * Copyright 1993 by *
  1056. X# * Adam M. Costello  *
  1057. X# *********************
  1058. X
  1059. X
  1060. X# Define CC so that the command
  1061. X# $(CC) foo.c
  1062. X# compiles the ANSI C source file "foo.c" into the object file "foo.o".
  1063. X# You may assume that foo.c uses no floating point math.
  1064. X#
  1065. X# If your operating system or your compiler's exit() function automatically
  1066. X# frees all memory allocated by malloc() when a process terminates, then you
  1067. X# can choose to trade away space efficiency for time efficiency by defining
  1068. X# DONTFREE.
  1069. X#
  1070. X# Example (for Solaris 2.2):
  1071. X# CC = cc -c -O -s -Xc -DDONTFREE
  1072. X
  1073. XCC =
  1074. X
  1075. X# Define LINK1 and LINK2 so that the command
  1076. X# $(LINK1) foo1.o foo2.o foo3.o $(LINK2) foo
  1077. X# links the object files "foo1.o", "foo2.o", "foo3.o"
  1078. X# into the executable file "foo".
  1079. X# You may assume that none of the .o files use floating point math.
  1080. X#
  1081. X# Example (for Solaris 2.2):
  1082. X# LINK1 = cc -s
  1083. X# LINK2 = -o
  1084. X
  1085. XLINK1 =
  1086. XLINK2 =
  1087. X
  1088. X# You shouldn't need to modify anything below this line.
  1089. X
  1090. XOBJS = buffer.o errmsg.o par.o reformat.o
  1091. X
  1092. X.c.o:
  1093. X    $(CC) $<
  1094. X
  1095. Xpar: $(OBJS)
  1096. X    $(LINK1) $(OBJS) $(LINK2) par
  1097. X
  1098. Xbuffer.o: buffer.c buffer.h errmsg.h
  1099. X
  1100. Xerrmsg.o: errmsg.c errmsg.h
  1101. X
  1102. Xpar.o: par.c errmsg.h buffer.h reformat.h
  1103. X
  1104. Xreformat.o: reformat.c reformat.h buffer.h errmsg.h
  1105. END_OF_FILE
  1106. if test 1285 -ne `wc -c <'Par120/protoMakefile'`; then
  1107.     echo shar: \"'Par120/protoMakefile'\" unpacked with wrong size!
  1108. fi
  1109. # end of 'Par120/protoMakefile'
  1110. fi
  1111. echo shar: End of shell archive.
  1112. exit 0
  1113.  
  1114. exit 0 # Just in case...
  1115.