home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
printer
/
pcroff.arc
/
PCROFF.DOC
next >
Wrap
Text File
|
1988-08-28
|
11KB
|
514 lines
.po 8
.in 5
.na
.ta
.he 'PCROFF'- % -'PCROFF'
.fo 'Dave Tutelman''August 28, 1988'
.bo
.ti 0
NAME
PCroff - format text
.bo
.ti 0
SYNOPSIS
PCroff
[+
.it
n
] [-
.it
n
] [-s] [-h] [-d] [-t] [-pPRINTER] file ...
.bo
.ti 0
DESCRIPTION
.ul
PCroff
formats text according to control lines embedded
in the text in the given files.
Encountering a nonexistent file terminates printing.
The optional flag arguments mean:
.br
.in +8
.ti -6
+n
Start printing at the first page with number
.it
n.
.br
.ti -6
-n
Stop printing at the first page numbered higher
than
.it
n.
.br
.ti -6
-s
Stop before each page (including the first)
to allow paper manipulation;
resume on receipt of a keyboard input.
.br
.ti -6
-h
Insert tabs in the output stream to replace
spaces whenever appropriate.
.br
.ti -6
-d
The output is sent directly to the screen,
not the standard output.
The screen attributes approximate the fonts chosen
(bold & underlining are done,
italic is blinking).
.br
.ti -6
-t
Format the output for a "typewriter" type of printer,
which can achieve font control only by overstriking.
(In the absence of a -t or a PRINTCAP file,
the default is to insert font control appropriate to
the IBM, Epson, AT&T 473, and Gemini printers.)
.br
.ti -6
-pXXX
Format the output for printer XXX (as described in the PRINTCAP file)
rather than the default printer (named and described in the PRINTCAP file).
The preparation of a PRINTCAP file is an appendix to this manual.
.in -8
Input consists of intermixed
.ul
text lines,
which contain information to be formatted, and
.ul
request lines,
which contain instructions about how to format
it.
Request lines begin with a distinguished
.ul
control character,
normally a period.
Output lines may be
.ul
filled
as nearly as possible with words without regard to
input lineation.
Line
.ul
breaks
may be caused at specified places by
certain commands, or by the appearance of an
empty input line or an input line beginning with a space.
The capabilities of
.ul
PCroff
are specified in the attached Request Summary.
Numerical values are denoted there by n or +n,
titles by t, and single characters by c.
Numbers denoted +n may be signed + or -,
in which case they signify relative changes to
a quantity, otherwise they signify
an absolute resetting.
Missing n fields are ordinarily taken to be 1,
missing t fields to be empty,
and missing c fields to shut off
the appropriate special interpretation.
Running titles usually appear at top and bottom of every
page.
They are set by requests like
.in +10
.li
.he 'part1'part2'part3'
.in -10
Part1 is left justified, part2 is centered,
and part3 is right justified on the page.
Any % sign in a title is replaced by the current
page number.
Any $ sign in a title is replaced by the current
date (an enhancement not in
.ul
Roff.)
Any nonblank may serve as a quote.
ASCII tab characters are replaced in the input by a
.ul
replacement character,
normally a space,
according to the
column settings given by a .ta command.
(See .tr for how to convert this character on output.)
Automatic hyphenation of filled output is done
under control of .hy.
When a word contains a designated
.ul
hyphenation character,
that character disappears from the output and
hyphens can be introduced into
the word at the marked places only.
.bo
.ti 0
FILES
.br
.ul
PRINTCAP
allows the definition of other printers' font control.
A set of instructions for preparing PRINTCAP files is
in an appendix to this manual.
.ul
MACWRITE.TMP
is created when macros are defined,
and deleted at the end of the program run.
.bo
.ti 0
BUGS
.br
.ul
Roff
is the simplest of the text formatting
programs, and is utterly frozen.
The philosophy in
.ul
PCroff
was to preserve the spirit of this freeze
and not be tempted to add enhancements.
The temptation was resisted for everything but font control
and dates in titles.
This is a home-brewed C version of a V7 assembly-language program.
It comes with no guarantees.
.bp
.tr |
.in 0
.ce
.bo
.ul
REQUEST SUMMARY
.sp 3
.br
.ta 12 20 30
.in 29
.ul
.ti 0
Request Break Initial Meaning
.na
.ti 0
.li
.ad yes yes Begin adjusting right margins.
.ti 0
.li
.ar no arabic Arabic page numbers.
.ti0
.li
.bo|n no - Use bold font
.bo
(example)
for the next n input lines.
.ti 0
.li
.br yes - Causes a line break \*- the filling of
the current line is stopped.
.ti 0
.li
.bl|n yes - Insert of n blank lines, on new page if necessary.
.ti 0
.li
.bp|+n yes n=1 Begin new page and number it n; no n means `+1'.
.ti 0
.li
.cc|c no c=. Control character becomes `c'.
.ti 0
.li
.ce|n yes - Center the next n input lines,
without filling.
.ti 0
.li
.de|xx no - Define parameterless macro
to be invoked by request `.xx'
(definition ends on line beginning `..').
Note that, while macro definitions can contain calls to other macros,
they may not contain definitions of other macros.
.ti 0
.li
.ds yes no Double space; same as `.ls 2'.
.ti 0
.li
.ef|t no t= Even foot title becomes t.
.ti 0
.li
.eh|t no t= Even head title becomes t.
.ti 0
.li
.fi yes yes Begin filling output lines.
.ti 0
.li
.fo no t= All foot titles are t.
.ti 0
.li
.hc|c no none Hyphenation character becomes `c'.
.ti 0
.li
.he|t no t= All head titles are t.
.ti 0
.li
.hx no - Title lines are suppressed.
.ti 0
.li
.hy|n no n=1 Hyphenation is done, if n=1;
and is not done, if n=0.
.ti 0
.li
.ig no - Ignore input lines through
a line beginning with `..'.
.ti 0
.li
.in|+n yes - Indent n spaces from left margin.
.ti0
.li
.it|n no - Use italic font
.it
(example)
for the next n input lines.
.ti 0
.li
.ix +n no - Same as `.in' but without break.
.ti 0
.li
.li|n no - Literal, treat next n lines as text rather
than as formatting requests.
(Note that this does not turn off fill or adjust.
That must be done explicitly with .nf and .na respectively.)
.ti 0
.li
.ll|+n no n=65 Line length including indent is n characters.
.ti 0
.li
.ls|+n yes n=1 Line spacing set to n lines per output line.
.ti 0
.li
.m1|n no n=2 Put n blank lines between the top
of page and head title.
.ti 0
.li
.m2|n no n=2 n blank lines put between head title
and beginning of text on page.
.ti 0
.li
.m3|n no n=1 n blank lines put between end of
text and foot title.
.ti 0
.li
.m4|n no n=3 n blank lines put between the foot title
and the bottom of page.
.ti 0
.li
.na yes no Stop adjusting the right margin.
.ti 0
.li
.ne|n no - Begin new page, if n output lines
cannot fit on present page.
.ti 0
.li
.nn|+n no - The next n output lines are not numbered.
.ti 0
.li
.n1 no no Add 5 to page offset;
number lines in margin from 1 on each page.
.ti 0
.li
.n2|n no no Add 5 to page offset;
number lines from n;
stop if n=0.
.ti 0
.li
.ni|+n no n=0 Line numbers are indented n.
.ti 0
.li
.nf yes no Stop filling output lines.
(This also stops right-adjustment when in effect,
and prevents the folding of oversize lines.)
.ti 0
.li
.nx|file ? - Switch input to `file'.
.ti 0
.li
.of|t no t= Odd foot title becomes t.
.ti 0
.li
.oh|t no t= Odd head title becomes t.
.ti 0
.li
.pa|+n yes n=1 Same as `.bp'.
.ti 0
.li
.pl|+n no n=66 Total paper length taken to be n lines.
.ti 0
.li
.po|+n no n=0 Page offset.
All lines are preceded by n spaces.
.ti 0
.li
.ro no arabic Roman page numbers.
.ti 0
.li
.sk|n no - Produce n blank pages starting next page.
.ti 0
.li
.sp|n yes - Insert block of n blank lines,
except at top of page.
.ti 0
.li
.ss yes yes Single space output lines,
equivalent to `.ls 1'.
.ti 0
.li
.ta|n|n.. ? - Pseudotab settings.
Initial tab settings are columns 9 17 25 ...
.ti 0
.li
.tc|c no space Tab replacement character becomes `c'.
.ti 0
.li
.ti|+n yes - Temporarily indent next output
line n spaces.
.ti0
.li
.tr|cdef.. no - Translate c into d, e into f, etc.
.ti0
.li
.ul|n no - Underline the letters and numbers
.ul
(example)
in the next n input lines.
.br
.tr ||
.bp
.in 0
.ce
.bo
.ul
PRINTCAP FILES
.sp 3
.fi
A file named
.ul
PRINTCAP
(no qualifier)
is consulted by PCroff for definition of font control strings
for the printer.
It also contains a statement of the default printer.
The
.ul
PRINTCAP
file consists of a default printer statement,
followed by an arbitrary number of printer specifications.
The grammar will be described after we see a sample
.ul
PRINTCAP
file.
.in +3
.nf
default = epson.
epson | 473 | gemini | ibm: us="\033-\001", ue="\033-\000";
bs="\033E", be="\033F", is="\0334",ie="\0335".
citoh | itoh | 475 : us="\033X", ue="\033Y,
bs="\033!", be="\033\042", is="\033X", ie="\033Y".
test: us="*us*", ue="*ue*", bs="*bs*",be="*be*",
is="*is*", ie="*ie*".
.fi
.in -3
This file names the default printer as the Epson
supplied by IBM with its PC
(and its look-alikes).
The next two lines are a specification of the escape sequences
used by the Epson for font control.
(Note that the Epson could also be referred to as the
473 (for the AT&T 473 printer), IBM, or Gemini, and PCroff would find it.)
The following lines are specifications for the C.Itoh
Prowriter 8510 (supplied by AT&T as the 475 printer),
and a fictitious "test" printer that will plant readable
sequences in the output so you can see what's happening
to your font control commands.
(Try formatting a document with the
.it
-pTEST
option.)
.bp
The specification that follows is an informal BNF
description.
.in +4
.nf
<p-cap> ::= <default> <p-spec>*
<default> ::= default = <name> .
<p-spec> ::= <name part> : <spec part> .
<name part> ::= <name> [ | <name> ]*
<spec part> ::= <spec> [ , <spec> ]*
<spec> ::= <f-name> = " <byte>* "
<name> ::= [A-Z,a-z,0-9]*
<byte> ::= <character> | \[0-7][0-7][0-7]
<f-name> ::= us | ue | is | ie | bs | be
.fi
.ul
.ti -3
Notes:
.ti -3
Names of printers must be unique in the first three characters,
which are all that the program uses to identify them.
.ti -3
The characters "," ";" and ":" are treated identically as separators,
so minor errors in their use will be ignored.
.ti -3
Bytes in font-control strings are sometimes not easily created
by a single keystroke of the ASCII character.
In such cases, the octal representation preceded by a backslash
will suffice.
A few particularly useful octal numbers are:
.in +6
\033 = ESC
.br
\042 = " (can't use within a string of bytes)
.br
\134 = \ (can't use within a string of bytes)
.in -6
Sorry for octal rather than hex,
but since roff comes from a C culture,
I thought it best to retain the original conventions of C.
.ti -3
The font-control sequence names (f-names)
are chosen in the spirit of
.ul
TERMCAP.
For instance, "us" means underscore start and "ie" means italics end.