home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
042.lha
/
c
/
print.doc
< prev
next >
Wrap
Text File
|
1987-06-25
|
5KB
|
144 lines
C P r i n t R o u t i n e V1.1
SYNTAX
print <[-n] [-v]> <filename>
DESCRIPTION
This program is designed to paginate, and print C programs from
the raw C file. It may be used with any textual file, but the pagin-
ation string cannot be changed in this version. All page format sizes
are taken from the active Preferences structure. These sizes include
number of lines per page, left, and right margins. Output is sent to
the PRT: device, and may not be redirected. A banner is generated
with the internal clock, and the day, date, time, and page number is
printed at the top of each page. Currently, there are three lines
consumed at the top of each page for this header. Printing of the
file data begins on line 4 (if you number lines starting with 1).
Two flags are supported in this version:
-v verbose mode.
-n no print mode.
Verbose mode is used to print the name of the currently printing
file on the console. This is particularly useful if the files to be
printed are listed using wildcards (see below for info on using wild-
cards in your application).
No print mode is useful to suppress printing, but have the program
write to the console the names of all files that match the given file
string(s).
This program is free form input, and the flags may appear any-
place on the command line. All flags specified take effect on all files
to be printed. Files are printed in the order that they are specified
on the command line. Files that use wildcards are printed as names
from the source directory match. These are therefore printed in the
same order as they would appear in a "list" command.
--- Pagination ---
Pagination of the listing is possible by inserting the following
string anywhere in the C program:
/*E*/
This may appear in comments if the compiler you are using supports
nesting of comments, otherwise you will have a catastrophe (the compiler
barfs). Version 1.1 does not support changing this string, but later
versions may.
Whenever this string is found in the input file, a page break is
executed by sending a formfeed to the PRT: device. A new banner is
printed at the top of the page, and the page number is incremented.
--- Wildcards ---
The standard AmigaDOS wildcards may be used in specification of
the files to be printed. These wildcards are:
# - match zero or more of the following character.
? - match any character in this location.
These wildcards may be combined to match any number of characters
in the filename. Hence, the command:
print #?.c
will match any file in the current directory that has a ".c" extension.
There are several restrictions in the use of these wildcards in
combination with one another. An example valid file pattern is:
print ???x#?
This will print any file that has "x" as the 4th character. Notice that
the "?" wildcard acts as a placeholder, and matches anything. These
patterns will not do what you would think:
print #
print #??
print #?#?
Note that the appearance of a wildcard after the compound wildcard
is not interpreted correctly. Since these are nonsensical, I saw no
reason to program around them. Therefore, the following rules MUST be
adhered to for predictable operation:
RULE 1 : A valid filename character MUST appear after the compound wildcard
"#?", that is not a wildcard character.
RULE 2 : A valid filename character or "?" MUST appear after the "#"
wildcard character.
I have not seen the program hang or crash if the above rules are
not followed, but I do not recommend their use.
--- Stopping the Program ---
You may stop the printing at any point in the process by using
the CTRL-C combination. The program will stop printing the current
file, clean up, and exit. Due to printer buffering, the printer may
not stop immediately, but will eventually.
--- Notes ---
There may be a small delay after the banner is printed on the
first page of the first file, and before the first line is printed
from the file. This is due to the small inserted delay (approximately
0.5 seconds) at the end of each line. Since the Amiga can process
the characters out to the printer much faster than the printer can
print them, long listings could cause a request to stop printing take
a long time to implement (once again due to printer buffering). The
next version will implement a settable delay.
I hope you enjoy this program. Send me compuserve E-Mail if you
have any suggestions, or find any latent bugs. I would be happy to hear
from you. Source is not yet available, but if I get enough inquiries,
I would be willing to clean up the source, and distribute it also.
DISCLAIMER
This program may be freely distributed, and copied in any form. My
only request is that it is not sold, or incorporated as part of any
commercial product with prior written permission. This program must
remain as a single unit.
No warranty or liability is assumed by the author for any damage,
or loss incurred by the use (or misuse) of this program.
ENJOY,
Vincent M. Hopson
Compuserve : 71550,2754
108 Andrew Place
Sterling VA 22170