The program PF (short for PRINTFILES) is an utility written to print text files on an Hewlett-Packard DeskJet 500 printer connected to the parallel port of an Amiga personal computer, selecting in the same time the font and the printing style between the internal options of this printer. PF comes in two versions, PF1 and PF2, written for the SAS C-Compiler v5.10: the printing routines are the same. But PF1 is callable only from the CLI, and is structured to be easily modified for different computers (e.g. IBM (argh!) PC's); I did not try, but as I avoided all the Intuition facilities and computer dependent statements, it should compile and work with the only change of the output port name (from PAR: to e.g. LPT1: or maybe PRN:). For maximum portability PF1 writes to the printer fopening a file to PAR: and fwriting there; this can be not strictly kosher but works (on the Amiga). PF2 instead opens a device for output, and supports in addition CTRL-C handling and a Workbench interface, built using the Requester Library from Colin Fox and Bruce Dawson that can be found e.g. in the Fred Fish collection on disk 419, and that must be previuosly installed in order to run PF2 (from the Workbench; you can still run PF2 from the CLI without having Req.Library installed). The purpose of PF is to send the correct escape sequence that directs the printer to use an internal font, then to optionally print one or more files; the printer is reset to the default at the end, UNLESS when no file names are given: invoking PF this way you can manually initialise your DeskJet as you like. To initialise the printer from the Workbench interface, exit from the file requester without selections. Be careful: the first time that something is written on PRT:, Amiga sends the initialisation sequence looking at the existing preferences; to use an internal font not selectable from Preferences, you should first print something; then use PF; the copy to PRT: the wanted file(s). In PF I have foreseen also a "special" printing mode: 2 pages (55 lines and 80 columns each) on the same sheet of paper, in landscape mode with a small font and a nice border around. This printing mode is ssllloooowwwwww... so slow that you could see system requesters asking to check your printer, because a page cannot be printed before the printer timeout (just ignore these messages, and click RESUME; or use PF1 that, writing directly on the parallel device, does not have timeouts). Usage from the CLI: Command: PF [switches] [file [file [file ... ] ] ] Switches: -l : Landscape (default is portrait); -i : Italic (default is roman); -bN : insert N Blanks at the beginning of every line; -aN : expand tAbs every N-th column (default: N=8); -g : Letter-Gothic font (default is Courier); -t : Times font (default is Courier); -s : Small pitch (Courier: 16.67 cpi; Let.Got.: 24cpi); -x : eXtra-small pitch (20 cpi - for Courier only); -8 : 8 lpi (default is 6 lpi); -6 : 6 points high fonts (default is 12 points fonts); -d : Draft quality (default is letter quality); -2 : special mode (2 pages every side). The switches can be specified one by one: e.g. -g -8 -s if you need Letter-Gothic font, spaced at 8 lines per inch and with 24 characters per inch horizontally; or together, e.g. -g8s for the same layout. Only the -bN and the -aN switches must be specified alone, or specified as the last ones in a group of switches (e.g. you can write -g8s -b10; OR -g8sb10; but NOT -b10g8s). The switches can be either lower or uppercase; the default for tab expansion is every 8th column (i.e. at columns 9, 17, ...) and can be changed using the -aN option. If the input stream contains a non-printable character, it will not be sent to the printer: for "non-printable", here I essentially mean the "control" characters, having ASCII codes from 00 to 037 (octal), plus DEL (0177 octal); the characters corresponding to codes above 0177 are strictly implementation-dependent (and usually printables), and what I needed was to avoid escape sequences embedded in the text to interfere with the printer setting. The -s, -x, -l and -i switches are ignored when the request is not compatible with the selected font; the "normal" pitch is 10 cpi for Courier, and 12 cpi for Letter-Gothic (Times is a proportional font). All the switches different from -d and -aN will be ignored if the option -2 is selected. The program (PF2 only) can be interrupted with a CTRL-C; however, to flush the DeskJet internal buffer, you should switch it off then on again. Please - take care to switch on your printer before invoking PF; I check the parallel device properly, but if the printer is connected to the serial port I cannot detect its status. Giving PF with invalid switches (or PF without any argument) a short help screen will be printed on stdout. This program can be freely distributed and modified, provided that no money is charged for it; and that the original header is left at the beginning with my name and address. If someone will improve PF, I would like to hear about his/her modifications: please, send me your changes! In this same directory you will find a "quick & dirty" program named MAX: invoking MAX from the CLI will print on stdout some information about : number of lines, length of the longest line, non-printable characters in the file (if any); that could help you in choosing the right parameters for PF. Author: Maurizio Loreti, aka MLO or I3NOO. Address: University of Padova - Department of Physics Via F. Marzolo, 8 - 35131 PADOVA - Italy Phone: (39)(49) 844-313 FAX: (39)(49) 844-245 E-Mail: LORETI at IPDINFN (BITNET), or VAXFPD::LORETI (DECnet). VAXFPD is DECnet node 38.257 or 39169; INTERNET: LORETI@PADOVA.INFN.IT . All these addresses refer to the same computer, a VAX 8600 owned from the Italian Agency for Research in High Energy Physics (I.N.F.N.). Home: Via G. Donizetti 6 - 35010 CADONEGHE (PD) - Italy Home setup: Amiga 500, A501, A590 20MB Hard Disk, 3 MB total memory; of course an Hewlett-Packard Deskjet 500. Work setup: Amiga 3000 16 MHz, 50 MB Hard Disk, 6 MB total memory; and another Hewlett-Packard Deskjet 500. Software: CygnusEd Professional, SAS-C 5.10, FlexeLint for the Amiga. Have Fun! MLO =========================================================================== Changes since PF1 1.15 (Fred Fish disk 539): ------------------------------------------- 1.16: Added a version tag string, so you can give the command VERSION PF1. Removed SAS built-in Control-C handling routines. Changes since PF2 2.10 (Fred Fish disk 539): ------------------------------------------- 2.11: Corrected a nasty bug in Ask(); 'current' was changed then used, also if out of bounds, to erase last string. Added a version tag string, so you can give the command VERSION PF2. Another bug corrected: when the special mode was selected from the Workbench, SetSpecialMode() was called twice. Added all AmigaDOS prototypes (#include ), also if this implies more casting. Now, when called from the Workbench, the program opens its own window for I/O; ErrMes() has been deleted, and replaced from printf(). Removed SAS built-in Control-C handling routines. 2.12: I bought FlexeLint for the Amiga, from Gimpel software; no errors have been detected from Lint, but some stylistical cleanup has been done. Yow... on PF1 Lint has detected no style oddities at all :^) ! I recommend you FlexeLint: every serious C programmer needs it. By the way, I am not connected to Gimpel Software; I am only a satisfied customer. ------ Thanks to all people who sent bug reports! MLO