home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 19 Printer
/
19-Printer.zip
/
cprint1.zip
/
CPRINT.DOC
next >
Wrap
Text File
|
1989-08-02
|
14KB
|
353 lines
CPRINT.EXE IS A PROGRAM SOURCE CODE AND ASCII FILE PRINTING UTILITY.
CPRINT can INTELLIGENTLY handle a print request for MULTIPLE files such
that the files are CORRECTLY printed on BOTH sides (optional) of the
paper. This is great for printing hardcopy of large documents (eg.
PROCOMM.DOC) or many small files (eg. source code for your 200
function C lib). The resulting output is arranged just like a book -
page 1 & 2 of the first file are on opposite sides of the same piece of
paper.
CPRINT will page break when the default line count is reached (/L
switch) or when it encounters an ASCII form feed in the file. You can
add a top margin (great for EPSON printers). You can print or not
print the files date & time info as a page header. You can add a left
margin to all lines of the file (allows 3 hole punch without punching
through text).
File List
---------
The distribution files are:
CPRINT.DOC - this documentation file.
CPRINT.EXE - the executable program.
Program Usage
-------------
cprint [filespec] [switches]
OPTIONAL COMMAND LINE SWITCHES: ( where "xx" equals a number)
/Ixxx[,xxx,xxx....] decimal printer initialization code(s).
(ex: /I027,013,070 -or- /I027,064 etc.)
/Mxx defines left margin to add to every print line (default=0).
/Wxx defines total maximum line width (default=80).
/Cxx defines number of copies to print (default=1).
/H do NOT print file's date/time info as page header.
useful for printing pre-formatted documents.
/Txx defines top margin to add (default=0).
/Lxx defines maximum print lines per page in addition to
the top margin (default=54 (66 if /H used)).
/Ofile send output to a file rather than the printer
(Ex: /Ostuff will send the output to the file STUFF)
/1 print pages which go on front side of paper (see NOTES).
/2 print pages which go on back side of paper (see NOTES).
/S split such that each file is on a unique set of pages.
(do NOT print the first page of a new file on the back
of the last page of the previous file.)
NOTES:
Filespec may contain pathnames & wildcards.
To print on both sides of paper:
print with /1, turn the paper over, re-print with /2.
/S only applies to /1 and /2.
/C is disabled by /1 and /2.
/O output is appended to the file if it already exists, otherwise
the file is created.
WARNING:
--------
If the /O option is used to re-route the output to a file for the
purpose of editing or viewing the output prior to printing, some
cautions are in order. Because of the way some printers handle the
formfeed character, CPRINT always follows a formfeed character with a
carriage return character. Be sure your edit or view program will
retain/display this character combination or you may get/see incorrect
results. Also ensure that your editor will not change or discard any
other printer control codes which might be in the text or you may get
incorrect results when the output is printed. For example, the control
code sequence to put my printer into Diablo 630 emulation mode is ESC
CR P (27 13 80 decimal). When my editor reads a file starting with
this sequence it interprets the CR as a command and immediately
backspaces - erasing the ESC and leaving only the P. Another example
would be a line which ENDS with a formfeed. CPRINT puts this line out
terminated with a single CR (no linefeed). Some editors will execute
the CR upon reading the file and effectively delete the line. Also
some file view programs will execute the CR and then display the
following line over the top of the line ending with the formfeed-CR
(effectively preventing it from being displayed). BE CAREFUL.
Some Examples
-------------
Print files with file date & time info as page heading, 54
text lines per page, using front of paper only (all defaults).
CPRINT D:\LC\USER\SRC\*.C
Same as above but add an 8 character left margin and print on both
sides of the paper (put your printer in 12 CPI mode first).
CPRINT D:\LC\USER\SRC\*.C /M8 /W88 /1
when 1st pass printout is completed flip paper over then
enter:
CPRINT D:\LC\USER\SRC\*.C /M8 /W88 /2
Notice in the second example I told CPRINT to use an 88 character line
width. The default width is 80. If the total print width (left margin
+ text) is greater than the /W parameter CPRINT will break the line,
linefeed, space over by the left margin amount, then print the balance
of the line. Since we put the printer in 12 CPI mode we needed to tell
CPRINT that 88 characters would fit on the print line so that input
lines longer than 72 characters would not be needlessly split. This
effectively centers an 80 character wide line on the 96 character wide
page with 8 character left and right margins.
The /I switch
-------------
This switch can be very useful when printing on both sides of the
paper. For instance, I use a text formatter which puts a string of
printer intialization codes at the beginning of the document to put
the printer in LETTER QUALITY mode. When the printer is turned off
in order to turn the paper over prior to printing the back side it
goes back into DRAFT mode. The /I switch can be used during the
second pass to put the printer back in LETTER QUALITY mode (since page
one and the control codes it contains won't be printed during the
second pass).
The /S switch
-------------
This switch can be used in conjunction with /1 and /2 to control the
interleaving of multiple files when printing on both sides of the
paper. Suppose we have two files - FILEA containing 3 pages of data and
FILEB containing 2 pages of data. If we wish to print on both sides of
the paper we can print the files with or without interleaving:
Without /S
----------
CPRINT FILE? /1
then
CPRINT FILE? /2
This will produce the following page layout:
sheet 1 front side - page 1 of FILEA
sheet 1 back side - page 2 of FILEA
sheet 2 front side - page 3 of FILEA <--- files
sheet 2 back side - page 1 of FILEB <--- interleaved
sheet 3 front side - page 2 of FILEB
sheet 3 back side - blank
Notice that page 3 of FILEA and page 1 of FILEB are printed on
opposite sides of the same piece of paper.
With /S
-------
CPRINT FILE? /S /1
then
CPRINT FILE? /S /2
This will produce the following page layout:
sheet 1 front side - page 1 of FILEA
sheet 1 back side - page 2 of FILEA
sheet 2 front side - page 3 of FILEA <--- files
sheet 2 back side - blank <--- split
sheet 3 front side - page 1 of FILEB
sheet 3 back side - page 2 of FILEB
Notice that each file is printed on a unique set of sheets when /S
is used.
Line Length
-----------
CPRINT will start a new print line whenever a Carriage Return/Line Feed
sequence is encountered in the input file OR the line length (as
set by the /W switch) is reached. The program attempts to account for
non-printing characters when making these decisions (embedded printer
control codes). This is critical only when an input line's length
exceeds the /W line length due to embedded control codes. CPRINT does
NOT count any of the following as printed characters when calculating
printed line length:
- Characters less than ASCII Space (32)
- ANY single character immediately following an
ASCII Escape (27)
For instance, if the physical line length is 84, the /W length is 80,
and the line contains two 2 character long printer control sequences -
the last four characters will NOT be printed on the next line because
CPRINT understands that 4 of the characters were control codes and did
not move the printhead. However, if the 84 character long line does
not contain any control codes then it will be split and the last 4
characters will be printed by themselves on the next line. There is
one situation where this falls flat - some printers have control
sequences composed of an ESCAPE CHARACTER FOLLOWED BY TWO OR MORE
NON-CONTROL CODE CHARACTERS. For example:
ESC A H
This will be considered TWO non-printed characters (ESC + single
character following it - A). Therefore CPRINT will think the printhead
has moved right one character more than it actually has (due to the H).
The /W switch can be used to compensate accordingly. I have found it
virtually impossible to build a program capable of interpreting all of
the various control code sequences used by all of the printer
manufacturers. I do not see this as a significant problem given the
programs intent - to print source code and on-line documentation files.
Programmers Example
-------------------
Given the following inputs:
CPRINT PTD*.C /M8 /W88 /1
then
CPRINT PTD*.C /M8 /W88 /2
CPRINT printed 40 some files encompassing 115 pages with page breaks,
left margins for 3 hole punch, descriptive file information as page
headers, and correctly interleaved on both sides of the 58 sheets of
paper. Just like a book. Need I say more?
Restrictions
------------
o MS-DOS Version 2.0 or later is required for versions thru 4.6.
o OS/2 Version 1.0 or later is required for version 5.0.
o MS-DOS Version 2.0 or later -OR- OS/2 Version 1.0 or later is
required for version 5.02 and above.
CPRINT is supplied for personal, private use. Feel free to
distribute CPRINT given these restrictions:
o the program shall be supplied in its original, unmodified
form, which includes this documentation and all other
files in the distribution list.
o no fee is charged.
o commmercial use is prohibited.
o the program may NOT be included - or bundled - with other
goods or services.
If you are using CPRINT and find it of value, any contribution
would be greatly appreciated ($10 suggested).
I would like to thank all of the users who have provided feedback
and bug reports. I never dreamed how many strange character and
format combinations appear in many of the text files floating around
out there. I am sure that we have not yet uncovered and addressed
all of them. Keep the feedback coming and I'll keep trying to
improve CPRINT.
Contributions and problem reports may be sent to:
Larry I. Smith
808 Shenandoah Dr.
Plano, Texas 75023
Revision History
----------------
o v3.9 - First public release.
o v4.0 - Added support for embedded printer codes.
o v4.1 - Corrected logic to handle lines containing an
embedded CR. Some formatters use this method
to emulate bold and underlining.
o v4.2 - Internal housekeeping.
o v4.3 - Corrected a bug associated with lines which
start with a CR and contain more than the CR.
o v4.4 - Replaced fopen/fprintf function calls with
open/write function calls. Some pc clones
running versions of MS-DOS 2.x do not always
write to the printer correctly using fopen/fprintf.
- Added CPRINTS.EXE to the archive. This is
CPRINT.EXE with the full screen editor input
feature for page layout info (/P switch) removed
so that users with non IBM compatible pc's won't
crash their system trying to use the full screen
mode.
o v4.5 - Corrected a logic error that caused the page
break for page 2 to be calculated incorrectly
for some files. This only affected files which
used CR's rather than FF's to space pages.
- Added the /O option to allow routing of output
to a file rather than the printer.
o v4.6 - Added the /I option to allow sending printer
initialization codes.
- Deleted CPRINT from the archive and renamed CPRINTS
to CPRINT. The full screen editor option (/P switch)
in the original CPRINT just caused too many problems
with too many PC clones.
o v5.0 - OS/2 Protected mode only version.
o v5.02 - Merged OS/2 and MS-DOS versions into one Family
API program which can run under either operating
system. Now requires Microsoft C v5.10 or higher
and the OS/2 Programmers Tool Kit to compile.