home *** CD-ROM | disk | FTP | other *** search
- epr.doc V1.10-A 12/12/84
-
-
- A SIMPLE LISTING PROGRAM FOR THE EPSON PRINTER
-
- Robert W. Sjoberg
- hacked by Craig Milo Rogers
-
-
- It is customary in the course of program development to output many
- pages of program listings. Although typical microcomputer printers
- offer a wide range of format control, it is usually available only when
- using sophisticated editing and formatting programs (word processors).
- It would be useful to have a program that offers simplified if limited
- control when printing ordinary Ascii text files. To this end, a program
- called epr has been written. It takes advantage of many of the features
- of the Epson MX-80 and FX-80 printers, as well as allowing the user to
- specify the format of the output. The following features are supported.
-
- * Pagination according to a fix but settable number of lines per
- page. For sheet-fed tasks, printing will pause between pages.
-
- * Selection of a user-specified heading, including insertion of file
- name, date, time, and page number, or no header at all, or no header
- on just the initial page.
-
- * Choice of top and left margins, line spacing, length and width of
- page.
-
- * Choice of international character set, including whether the Epson
- special characters (occupying some control codes) should be
- recognized.
-
- * Choice of printing style (condensed, enlarged, pica, elite, etc.).
-
- * Control over formatting features:
- - whether overflow lines are truncated or wrapped to the next
- line;
- - whether random control characters are printed or converted
- to "^X" form;
- - whether form feeds or additional blank lines separate pages;
- - how tabs are to be expanded;
-
- * Selection of printing options through an indirect file.
-
- The command line to invoke epr is as follows. Switch options are
- specified as single-characters, while options requiring values are
- given as keyword=value, with single-character keywords. All options
- are detailed below. The syntax was suggested by conventional Unix
- usage. The brackets indicate that all options are just that, optional,
- and any may be omitted.
-
- epr [-acfhiops18] [l=leng] [w=wid] [t=topmar] [m=leftmar] [p=pmode]
- [q=qmode] [c=country] [b=tabn] [h="header"] [f=optfile] [o=output]
- [files...]
-
- All options must come before the names of any files to be printed.
-
-
- Switch Options
- _____________
-
- These single-letter options may be specified individually, each with
- its own dash command, as "-a -c -8", or in groups, as "-ac8". They may
- appear in any order in arbitrary groupings. Multiple occurrences of a
- switch are equivalent to a single occurrence.
-
- -a Select alternate (usually italic) character set.
-
- -c Convert control chars (other than CR, LF, FF) to ^X form.
-
- -f Use form feeds instead of blank lines to separate pages.
-
- -h Suppress printing of any header, even if specified with
- the h= option (below). Does not suppress top margin.
-
- -i Allow international characters (these occupy some control codes).
-
- -o Overflow lines are truncated (by default, they are wrapped to
- next line of output).
-
- -p Pause at beginning of each page and wait for CR to be typed.
- Intended to allow forms change or sheet-fed use. Disables
- out-of-paper detector.
-
- -s Suppress output of printer control codes (only those that set
- printer format, charcter set, and special features; ordinary
- Ascii control codes are unaffected).
-
- -1 Don't print header on first page; does not print blank lines
- instead of header, just doesn't print anything).
-
- -8 Use vertical spacing of 8 lines per inch (default is 6).
-
- Keyword Options
- ________________
-
- Keyword options take the form "keyword=value", where "keyword" is a
- single-character keyword and "value" depends on the keyword. These
- options may be intermingled with the dash option switches above and may
- appear in any order, as long as they all come before the names of the
- files to be printed.
-
- l=leng
- Use text page length of "leng" lines (default is 56 for normal
- 6 lines/inch spacing, 78 for 8 lines/inch spacing). Does
- not include top or bottom margins or the header.
-
- w=wid
- Use text page width of "wid" columns (default for normal Pica
- print is 80; the default for other text styles varies from 40 to
- 137). Does not include the left margin.
-
- t=topmar
- Set top margin to "topmar" lines. Default is 0.
-
- m=leftmar
- Set left margin to "leftmar" characters. Default is 0.
-
- b=tabn
- Causes implicit tab stops every "tabn" columns relative to the
- left margin of the page. A tab character (Ascii octal 011) will
- skip to the next tab stop. The default is 8.
-
- p=pmode
- Set printer mode. The default mode is pica (10 characters
- per inch). String "pmode" (not enclosed in quotation marks)
- contains any collection of the following letters (any combination
- may be specified, although not all combinations are effective):
- b bold (emphasized) characters
- c condensed characters, 17.16 per inch
- d double-strike characters
- i italic characters
- l elite characters, 12 per inch
- p proportional spacing
- s subscript characters
- t top (ie, superscript) characters
- u underlined characters
- Example: p=bdl causes bold (emphasized), double-struck, elite
- characters to be used.
-
- q=qmode
- Set the printer mode for the header line. The values for "qmode"
- are the same as for "pmode" in "p=pmode".
-
- c=country
- Selects the country character set. Value "country" is a two-letter
- abbreviation for the country:
- us for U.S.A. sw for Sweden
- fr for France it for Italy
- ge for Germany sp for Spain
- uk for U.K. ja for Japan
- de for Denmark
- See the Epson manual for the actual character code mapping.
- The default is c=us for U.S.A.
-
- h="header"
- Use the given header. The specified header is contained in quotes
- and appears as the first thing typed on every page. The header
- string is interpreted as in the C programming language. Thus,
- certain combinations of characters have special meaning:
- \n means newline, \t means tab, \r means return (without
- advancing to a new line), \b means backspace, and \\ means
- backslash. A \ followed by one to three octal digits encodes
- the specified ASCII character; this may be used to insert
- Epson control sequences (italics, etc) in the header. A \ followed
- by any other character is left as is.
-
- In addition, certain other character combinations have special
- meanings:
- %d substitutes date in the form dd mmm yyyy, as 23 Jul 1983
- %t substitutes time in the form hh:mm, as 14:37
- %f substitutes file name as given on command line
- %p substitutes page number
- %% substitutes %
- % (% followed by a space) substitutes a single space
- Any other %<char> combination is ignored (deleted). The default
- header is the string "%d %t %f Page %p\n\n", that is, the date,
- the time, the current file name, "Page", the page number, and two
- blank lines (another \n is supplied after the header is typed).
- The quotes surrounding the header string in the command line may
- be any single character delimiter that does not appear in the
- header string itself; double quote (") was used here as an example.
- Note that the specification h="" still results in a single \n as
- the header. This can be inhibited with the -h switch.
-
- f=optfile
- Specifies that more options are to be read from file optfile.
- The format of optfile should be the same as that of the command
- line except that options may be spread over several lines (that
- is, newlines in optfile are turned into spaces, as are tabs).
- The resulting options are spliced into the epr command line at
- the point the f= is given. This option is provided to allow
- often-used formats to be easily invoked, and to allow CP/M users
- a method of defining headers with both upper and lower case
- characters, since CP/M converts its command lines to all upper
- case.
-
- For example, the following file (called "listform") is the
- author's favorite for listing programs:
- -f8 t=0 p=c l=80
- To format and print files foo.c and bar.c, the command line is
- simply
- epr f=listform foo.c bar.c
-
- A more complicated option file is "invnform":
- -f t=1 -1 p=l m=10
- h="Equipment Inventory,% %d\t\t\tPage% %p"
- Notice the "% " is used to quote the spaces, since PC-DOS and
- the C86 _main service routine will cause the command line to be
- broken into the following tokens:
- h="Equipment
- Inventory,%
- %d\t\t\tPage%
- %p"
- Epr interpolates a space after the % in the second and third
- tokens.
-
- o=output
- Specifies that output is to be written to the named file instead
- of directly to the printer. If no "output" string is given,
- that is, if only o= appears, then output is to standard output.
-
- File specifications must come after any and all options. If no file
- specifications are present on the command line, epr reads from standard
- input. epr does not expand wildcard characters (* or ?) in file
- specifications.
-
- Notes
- _____
-
- (1) The printer modes set by epr remain in effect after epr exits:
- - printer typestyle and character size;
- - international character set;
- - line spacing;
- - normal/alternate character set;
- - out-of-paper detection is disabled (if -p used);
- - automatic skip over perforation is cancelled.
-
- (2) This program was developed on a Compaq computer using Computer
- Innovations C86 compiler, V1.3.3. It has not been tested on later
- releases of C86, but should exhibit no pathologic behavior.
- CMR: This version was hacked on an IBM-PC/AT using Lattice C 2.12.
- It should still work on with CI C86.
-
- (3) The following files are required to build epr:
- epr.c C source file
- timestmp.c contains time and date functions
- timestmp.h include file for above
-
- (4) This program is furnished to the public domain for non-commercial
- use. It may not be sold or otherwise commercially distributed for
- profit, in its original form or in any derivational form. It may
- be copied and distributed freely, without charge to recipients.
- If you see fit to improve this program, you are welcome to do so
- PROVIDED (1) you clearly indicate the changes in the Revision History
- section of the source code, (2) you include your name and handle
- (network or U.S. Mail address is sufficient), and (3) you provide
- an original source copy of this program to anyone who receives the
- modified copy.
-
- (5) The epr and timestmp programs are provided "as is" with no promise
- of support. However, the author will gladly entertain reports of
- bugs and misfeatures, as well as commentary on it use and performance.
-