GeezerVison is showing netlib.org — netlib.org Date: Mon, 24 Nov 86 12:05:09 est
From: David Krowitz
Below the dashed line you will find the bundled files for a print-server
for the Hewlitt-Packard 7550-A pen plotter which runs on the Apollo.
Complete instructions on compiling and installing the print-server are
included. An additional utility program which converts Apollo GMR
graphics output into HP graphic language commands is included in a
seperate message.
-- David Krowitz
-------------------------------------------------------------------
# To unbundle, sh this file
echo hp.config 1>&2
cat >hp.config <<'End of hp.config'
FILE_BANNERS OFF
DEVICE user1
SIO_LINE 1
SPEED 9600
PLOT_MODE OFF
PRINTER_NAME HP7550
End of hp.config
echo prf.hp7550.hlp 1>&2
cat >prf.hp7550.hlp <<'End of prf.hp7550.hlp'
9.04;prf (print_file), revision 9.04, 85/05/30
PRF (PRINT_FILE) -- Queue a file for printing.
usage: PRF pathname... [-INTER] [-COP n] [-PR name] [-SITE entry_dir]
[-USER name] [-SIG ALARM|OFF]
[-BAN [ON|OFF]]
[-CONFIG [pathname]|-NDB]
[-TEXT|-PLOT|-TRANSPARENT] [-NPAG]
[-MARGINS [ON|OFF]] [-TOP n] [-BOT n]
[-RIGHT n] [-LEFT n] [-HEADERS [ON|OFF]]
[-HEAD l-string/c-string/r-string]
[-FOOT l-string/c-string/r-string]
[-FTN [ON|OFF]] [-WRAP [ON|OFF]]
[-PITCH n] [-POINT n] [-WEIGHT value]
[-LQ [ON|OFF]] [-RES n] [-WHITE n]
[-BW [ON|OFF]] [-MAGN {-1..16}] {CL}
FORMAT
PRF [pathname...] [options]
PRF queues a file for printing. The file must be an ASCII stream (i.e., text)
file, a graphics metafile (GMF), or a GPR bitmap object. After successfully
queueing a file, PRF displays a message containing the full pathname of the
file that you queued.
You can execute PRF once for each file that you want to print (specifying all
the necessary options every time), or you can enter PRF's interactive mode and
hand files to the program continuously. See the examples below.
Files queued by PRF are physically printed using PRSVR (PRINT_SERVER).
When you invoke PRF, it first sets all options to their default states (as
described below). Next, it looks for a PRF configuration file called
~USER_DATA/PRF.DB unless you have invoked PRF with the -NDB option (described
below). If PRF locates a configuration file, it executes the options
contained in the file to configure the current session. Finally, it proceeds
to process any options on the command line or in the interactive session.
A menu-based version of the PRF command is also available. Type HELP PRFD for
more information.
ARGUMENTS
pathname
(optional) Specify the file to be printed. Multiple pathnames and
pathname wildcarding are permitted.
Default if omitted: read standard input.
OPTIONS
The following options may appear on the Shell command line or in PRF
interactive mode as noted below. In addition, you may place one or more
options in a configuration file (see -CONFIG). In that case, create the file
with one option per line without the prepended hyphens (-). See Example 3
below.
If no options are specified, the file(s) are printed using ASCII carriage
control, with pagination enabled, on the default printer (as established by
PRSVR).
___ _________ _______ _____ __ ___ ____ _____
The following options apply to all file types.
-INTER[ACTIVE]
Enter interactive mode.
-COP[IES] n Print multiple copies of the file, where 'n' is the
requested number of copies. If -COP[IES] is specified, 'n'
is required. If this option is omitted, one copy is
printed by default.
-PR[INTER] name
Specify the printer 'name' for printing the file. This
option is useful only if more than one printer is in use on
the network, or if a printer has been assigned a
nonstandard name with the "PRINTER_NAME" configuration
directive in the PRSVR command. If you omit this option,
PRF uses the default printer name, "P". Note that "P" is
also the default printer name used by the PRINT_SERVER.
-S[ITE] entry_dir
Specify print queue (/SYS/PRINT) on alternate node by
giving that node's entry directory name. This option allows
you to maintain more than one printer queue directory. You
may want to maintain separate queues for different
organizations, or you may want two queues to provide
redundancy in case of node failure.
-USER[_NAME] name
Specify user name that will appear on the banner page of
the printed file. The alarm facility of PRF also uses this
name to determine who should be notified when printing is
complete (see -SIG below). This means that this name must
be a valid login name (unless you don't care about sending
an alarm). If this option is omitted, the current login
name is used.
-SIG[NAL] ALARM|OFF
Request an alarm server signal when the file has finished
printing. The default is OFF.
-BAN[NER] [ON|OFF]
Enable/disable banner page. The default is specified in
the PRSVR configuration file. If neither ON nor OFF is
specified, ON is assumed.
-CONFIG[_FILE] [pathname]
Specify a file containing further PRF options, one per
line. Do not use prepended hyphens (-) with the option
names in the configuration file. If 'pathname' is omitted,
PRF will execute the configuration file ~USER_DATA/PRF.DB.
-NDB Suppress processing of the configuration file.
-TEXT Specify text mode for printing ASCII files. This is the
default print mode.
This mode is not valid for the HP7550-A plotter. Files sent
to the plotter in this mode are not output.
-PLOT Specify plot mode. Include this option to print bitmap
files created by a graphics metafile (GMF) manager or GPR
or the CPSCR (COPY_SCREEN) command.
This mode is not valid for the HP7550-A plotter. Files sent
to the plotter in this mode are not output.
-TRANSPARENT Specify that when the file is printed, the records of the
file are to be passed directly to the printer driver
routine with no processing by the PRINT_SERVER.
This is the only valid output mode for the HP7550-A plotter.
Files containing Hewlitt Packard Graphics Language commands
(HPGL commands) may be sent to the plotter with this
output mode.
___ _________ _______ _____ __ ____ _____ ____
The following options apply to text files only.
NOTE: all of these options are ignored by the HP7550-a plotter.
---------------------------------------------------------------
-NPAG Disable the headers and margins generated by PRF.
-MARGINS [ON|OFF]
Enable/disable margins generated by PRF. The default is
'ON'. If neither ON nor OFF is specified, ON is assumed.
-TOP n Specify page top margin, in inches. The default is a value
specified in the PRSVR configuration file.
-BOT[TOM] n Specify page bottom margin, in inches. The default is a
value specified in the PRSVR configuration file.
-RIGHT n Specify page right margin, in inches. The default is 0
inches.
-LEFT n Specify page left margin, in inches. The default is 0
inches.
-HEADERS [ON|OFF]
Enable/disable page headers and footers generated by PRF.
The default is specified in the PRSVR configuration file.
If neither ON nor OFF is specified, ON is assumed.
-HEAD[_STRING] l-string/c-string/r-string
Specify contents of left, center, and right components of
the page header generated by PRF. Components may be empty
strings. The following special characters return the
values indicated when they appear in the header strings.
@ = escape character
# = current page number with 1 leading and
1 trailing space
% = current date
! = filename
& = filename's last time,date modified
* = insert a space in text string (literal spaces
are not allowed)
Example: -HEAD !/Page#/% will produce a header with the
filename in the left component, the string "Page" followed
by the current page number in the center component, and the
current date in the right component. The default header is
a string specified in the PRSVR configuration file.
-FOOT[_STRING] l-string/c-string/r-string
Specify contents of page footers. The format is the same
as for -HEAD above. There is no default footer.
-FTN [ON|OFF]
Force use of FORTRAN carriage control. The -FTN option
causes the PRINT_SERVER to use FORTRAN forms control even
if the file does not have the FORTRAN carriage control
flag. Use of this option will cause PRF to interpret the
first character of each line as a FORTRAN carriage control
character (and not print it). This can be unfortunate if
the file has ASCII carriage control, so be careful. If
neither ON nor OFF is specified, ON is assumed. The
default state is OFF.
-WRAP [ON|OFF]
Enable/disable automatic line wrapping. When enabled, PRF
will wrap any lines that exceed the right margin onto the
next line. When disabled, PRF truncates lines that exceed
the right margin. If neither ON nor OFF is specified, ON
is assumed.
___ _________ _______ ___ ___ ___ ____ ________ __________ ________ ____ ___
The following options are for use with printers supporting variable font and
_____ _____
pitch sizes.
NOTE: all of these options are ignored by the HP7550-a plotter.
---------------------------------------------------------------
-PITCH n Set the pitch (characters/inch) at which you wish the
document to be printed. The following pitch settings are
available on the printers indicated.
Printronix 10
Spinwriter 12
Imagen 8.5, 10, 12, 15, 17.1
GE 10, 12, 13.1, 16.7
Versatec 12
Toshiba 1351 5, 6, 10, 12, 16.7, 20 draft mode
5, 6, 10, 12 letter quality mode
-POINT n Set the point size for the font to be used. This is a real
number in units of a point which is 1/72 inch.
-WEIGHT value
Set the weight of the font to be used. This option is only
valid for the GE printer type. Possible values are
'light', 'medium', and 'bold'. The default is 'medium'.
If this option is used with the Toshiba 1351 printer, each
character of the output will be printed once for the 'light'
and 'medium' values and twice for the 'bold' value, resulting
in a darker output when 'bold' is specified.
-LQ [ON|OFF] Specify that the document is to be printed in 'letter
quality' (ON) as opposed to 'draft' (OFF) mode. This
option is only valid for the GE printer type. If neither
ON nor OFF is specified, ON is assumed. The default state
is OFF.
If this option is given with the Toshiba 1351 printer, the
printer will use its high-quality Elite font (font #1) when
'letter quality' (ON) is specified. The printer will use its
default high-speed font (font #0) when 'draft mode' (OFF) is
specified.
___ _________ _______ _____ __ ____ _____
The following options apply to plot files.
NOTE: all of these options are ignored by the HP7550-a plotter.
---------------------------------------------------------------
-RES[OLUTION] n
Specify resolution of output plot in dots per inch. If you
specify a resolution not available on the particular
printer, the file is printed at the closest available
resolution. The default resolution is specified in the
PRSVR configuration file.
-WHITE[_SPACE] n
Specify amount of white space (in inches) to appear between
multiple plots in one file. The default is three inches.
-BW[_REV] [ON|OFF]
Enable/disable black and white reversal for bitmaps. If
neither ON nor OFF is specified, ON is assumed. The
default state is OFF.
-MAGN[IFICATION] n
Specify bitmap magnification value. 'n' is an integer in
the range -1 to 16.
-1 selects auto-scaling to magnify the bitmap
to fill the available page space.
0 selects 'one-to-one' scaling between the
display and the printer for GMF bitmaps.
(For GPR bitmaps, this translates to
magnification 1.)
1-16 selects magnification by that amount.
Portions of the magnified bitmap that
exceed the printer page boundaries are
clipped.
The default is 0.
For the Toshiba 1351 printer, the default magnification (0)
results in a one-to-two scaling between each pixel of the
display and the printer for GMF bitmaps (same result as
using a magnification value of 2). This will make the
picture on the printer roughly the same size as the picture
on the display.
This command uses the command line parser, and so also accepts the standard
command options listed in HELP CL.
COMMANDS
COMMANDS
COMMANDS
-INTER
-INTER
Once PRF has been invoked in interactive mode (see -INTER above), it accepts
the following interactive commands at the "PRF> " prompt (in addition to the
options already discussed).
P[RINT] pathname
P[RINT] pathname
P[RINT] pathname Queue the specified file for printing.
Q[UIT]
Q[UIT]
Q[UIT] Quit interactive mode and return to the Shell.
SH[ELL]
SH[ELL]
SH[ELL] Create a shell command line. This command allows you to
issue Shell commands without leaving PRF interactive mode.
When you have finished entering Shell commands, type
CTRL/Z. This will return you to PRF interactive mode.
Your previous PRF option settings remain undisturbed by
the intervening Shell commands.
INIT[IALIZE]
INIT[IALIZE]
INIT[IALIZE] Reset PRF parameters to their default values.
R[EAD] [printer]
R[EAD] [printer]
R[EAD] [printer] List entries in the queue for the specified printer at the
current site (as specified by -S). If 'printer' is
omitted, then the contents of the queue (determined by the
current setting of -PR) are listed.
WD [pathname]
WD [pathname]
WD [pathname] Execute the Shell command WD (WORKING_DIRECTORY) to set or
display the working directory.
GET option
GET option
GET option Display the value of the PRF option specified. Use this
command to show the settings of the various PRF
parameters.
CAN[CEL] [queued_filename]
CAN[CEL] [queued_filename]
CAN[CEL] [queued_filename]
Cancel printing of the specified file at the current site
(as specified by -S). Note that you must specify the
pathname which PRF assigns when the file is queued (which
may differ from the name of your original file). Use the
READ command to display the names of currently queued
files. If the filename is omitted, the last file to be
queued by this process is cancelled. This command is only
effective for files which have not yet physically begun to
print.
EXAMPLES
1. $ prf mary -npag -ftn Queue "mary"; suppress
"//NODE1/MY_DIR/MARY" queued for printing. pagination; force
$ FORTRAN carriage
2. $ prf filex -s //tape
"//NODE1/MY_DIR/TEST_FILE.PAS" queued for printing at site //TAPE.
$ Queue "filex" to the
printer queue on the
node called //tape.
3. Configuration File: the following commands might appear in the default
PRF configuration file ~USER_DATA/PRF.DB.
PR ge
SITE //rye
FOOT %/my_file/&
4. Sample interactive session:
$ PRF -INTER
PRF> get pr
pr = p
PRF> -pr cx
PRF> get pr
pr = cx
PRF> -pitch 20
PRF> print test_file.pas
"//NODE1/MY_DIR/TEST_FILE.PAS" queued for printing.
PRF> q
$
5. Running PRF from an icon:
If you would like to run PRF interactively in a process devoted to it,
you might place the following command in your ~USER_DATA/STARTUP_DM
file:
cp -i -c 'P' /com/prf -inter -n print_file
This will create a PRF process and turn its window into an icon using the
print icon character in (/SYS/DM/FONTS/ICONS). Issue the DM command ICON
to change the icon window into its full-size format.
RELATED TOPICS
More information is available. Type:
- HELP PRFD
for information on the menu-based version of this command.
- HELP PRINTER
for general information about printers supported in a DOMAIN network.
- HELP PRSVR
for details about the Print Server.
End of prf.hp7550.hlp
echo user1.hp.bld 1>&2
cat >user1.hp.bld <<'End of user1.hp.bld'
####################################################################################
### ###
### Command file for Compiling and Binding the HP7550 Print Server ###
### ###
####################################################################################
von
pas user1.hp.pas
bind -b prsvr.user1.hp /com/prsvr user1.hp.bin
voff
End of user1.hp.bld
echo user1.hp.doc 1>&2
cat >user1.hp.doc <<'End of user1.hp.doc'
*******************************************************************************
***** *****
***** USER1.HP.DOC *****
***** Version 4 *****
***** *****
***** Programming Notes for the Hewlitt Packard 7550 Print Server *****
***** *****
***** Copyright (c) 1986 *****
***** David M. Krowitz *****
***** Massachusetts Institute of Technology *****
***** Department of Earth, Atmospheric, and Planetary Sciences *****
*******************************************************************************
Interfacing the Plotter with the Apollo
---------------------------------------
We have interfaced our HP 7550 plotter to an Apollo DN320 using a 3-wire
RS232-C null modem cable. The wiring of the cable is: pin 2 - pin 3, pin 3 - pin 2,
and pin 7 - pin 7 (ie. cross the data receive and data transmit wires, and connect
the signal ground wires). We are using the X-ON/X-OFF protocal to control the flow
of data between the Apollo and the plotter rather than using the DTR and CTS signals
in the RS232-C cable. The SIO line characteristics necessary to run the plotter
using X-ON/X-OFF are set up in the routine USER1_INIT. Note that HP 7550 has two
RS232-C connectors. One labelled COMPUTER and the other labeled TERMINAL. Either
connector can be used, but when the TERMINAL connector is used, the plotter echos
all of the characters it receives on this line. Also, the TERMINAL connector does
not require a null modem cable. A regular straight through cable (pin 2 - pin 2,
pin 3 - pin 3, and pin 7 - pin 7) is used in this case.
The HP 7550 plotter must be set up through the font panel to operate with
the RS232-C line. The parameters which need to be selected from the front panel
are:
HP-IB MONITOR
STANDARD SERIAL ===> Select SERIAL to set up RS232-C line.
DATA FLOW
BYPASS HANDSHAKE ===> Select DATA FLOW to set up port selection.
The data flow menu should be set to the
REMOTE and STANDALONE selections. Use the
LOCAL and STANDALONE selections if using
the RS232-C port labelled TERMINAL rather
than the port labelled COMPUTER.
DATA FLOW
BYPASS HANDSHAKE ===> Select HANDSHAKE to set up flow-control protocal.
The handshake menu should be set to the
XON/XOFF and DIRECT selections.
DUPLEX PARITY
BAUD ===> Select DUPLEX to set up full/half duplex.
The duplex menu should be set to the
DUPLEX FULL selection.
DUPLEX PARITY
BAUD ===> Select PARITY to set up parity and bits/char.
The parity menu should be set to the
8-BITS and EVEN selections.
DUPLEX PARITY
BAUD ===> Select BAUD to set up baud rate to the value
specified in the plotter configuration
file (HP.CONFIG).
Refer to the "HP 7550A Graphics Plotter Operation and Interconnection Manual"
for detailed information on how to use the plotter's front panel to set up the
parameters listed above.
Description of the Plot Server Routines
---------------------------------------
The HP7550 print server program consists of six main subroutines (procedures)
which are compiled and then bound to the standard print server program (/COM/PRSVR)
supplied by Apollo. The subroutines are: USER1_INIT, USER1_WRITE, USER1_FLUSH,
USER1_CLOSE, USER1_SET_MODE, and USER1_RETURN_INFO. Section 6.5 of The DOMAIN System
Administrator's Guide gives a general description of the standard print server
supplied by Apollo and the steps needed to generate a print server for a printer
(or plotter) other than those supported by Apollo. The arguments to the
user-supplied subroutines and the format of the data passed to the subroutines
are defined in the Apollo supplied insert files /SYS/INS/PRSVR.INS.PAS or
/SYS/INS/PRSVR.INS.C which, while defining the options and data types doesn't
really tell you what these various options are supposed to do. To get that
information, you either have to call Apollo or you just have to play with the
print (plot) server for awhile and see how it responds to your poking and prying.
Unfortunately for those of you who program in Fortran, there is no insert file for
that language - you just have to learn Pascal.
The USER1_INIT subroutine is called once by the plot server when it starts up.
The subroutine is given the line number of the SIO line to which the plotter is
connected and the baud rate of that SIO line. Both of these numbers are read from
the plotter configuration file (HP.CONFIG) by the plot server at startup time.
The USER1_INIT subroutine opens the specified SIO line for stream output and then
sets the necessary SIO line characteristics. These include the use of X-ON/X-OFF
by both the Apollo node and the printer (input_sync and host_sync), turning off
the echoing of characters which the plotter may send to the host (something which
is never really done except for X-ON and X-OFF), disabling the quit character on
the SIO line (so if the plotter accidentally glitches it can't kill the plot
server process), and the parity, number of bits per character, and number of
stop bits of the characters being transmitted. After defining the SIO line for
the plotter, USER1_INIT also initializes several strings of control characters
for the plotter, resets various output-mode and warning message flags. Finally,
USER1_INIT sends the plotter-init command to the HP 7550 to make sure the plotter
is correctly initialized.
The USER1_WRITE subroutine does most of the work of the plot server. This
subroutine is called from the plot server to perform the actual output of the
data to the HP7550 plotter. The subroutine is given a buffer of up to 2048
characters and a buffer length. In practice, I have never seen the buffer length
exceed 256 bytes. The USER1_WRITE subroutine checks the current plotter output
mode and then outputs the contents of the buffer according to the mode. The mode
is set by the plot server calling the USER1_SET_MODE subroutine prior to the
first call to USER1_WRITE for the current output file. There are three possible
output modes: 'text', 'transparent', and 'plot'.
If the current output mode is 'text' (ie. a PRF command with no switches),
the print server outputs an error message warning that the plotter is unable
to print text files and throws away the output buffer. The warning message is
only printed once at the beginning of a new file being output in text-mode, not
during each line of output. The warning message is also suppressed when the
print server tries to send a form-feed character (to eject the current page) to
the plotter in text-mode after finishing the output of a plot-mode or
transparent-mode file.
If the current output mode is 'transparent' (ie. a PRF -TRANSPARENT command),
the print server sends the contents of the output file to the printer with no
modifications. USER1_WRITE is called once for each line in the file (same as with
'text' mode), but no page headers are inserted into the output stream. In this
output mode USER1_WRITE does nothing except to dump the buffer to the HP7550's
output stream.
If the current output mode is 'plot' (ie. a PRF -PLOT command), the print
server checks that the output file is a GMF bitmap file, calls USER1_SET_MODE
twice to set the vertical and horizontal sizes of the bitmap, and then calls
USER1_WRITE once for each horizontal scan line in the bitmap. The print server
will not attempt to print bitmap files unless the PLOT_MODE switch in the
printer's configuration file (ie. HP.CONFIG -- which is specified on the
command line which started the print server) is set to ON. If the PLOT_MODE
switch is on, then USER1_WRITE will output an error message warning that the
plotter is unable to print bitmap files and will throw away the output buffer.
The warning message is only output once at the beginning of the file, not during
each buffer of output.
The USER1_SET_MODE subroutine is called by the plot server prior to the
output of each file being printed to set the proper plotter output mode and to set
such things as the bitmap size (for plot mode files). The plot server may also
call USER1_SET_MODE after the end of an output file to reset the plotter mode or
to change the plotter mode to 'text' so it can output a top-of-page command
(ie. a form feed) after finishing the printing of a bitmap or text-mode file.
The USER1_FLUSH subroutine is called once at the end of each file output by
the plot server and also in between changing plotter output modes. This routine
checks if the output mode is 'transparent' and if it is, USER1_FLUSH sends the
plotter the DF and PG commands to reset the HP 7550 to its default status (clearing
any special plotter modes which the output file may have set up) and to unload the
current page and to load a new piece of paper. Note that the PG command will
eject the current page only if the plotter has actually written something on the
paper.
The USER1_CLOSE subroutine is only called when the plot server is stopping
permanently (as opposed to waiting between files). All that it does is to close
the plotter's output stream.
Changes Since Version 2
-----------------------
Version 4 of the HP7550 USER1 routines is compatible with the AEGIS
SR9.0 version of PRSVR. It should also be backwards compatible with the
SR8.0 version of the print server.
The USER1_INIT routine now reports any errors which it encounters while
attempting to set up the SIO line for the printer. Seperate error messages are
generated for each SIO line parameter to aid in locating any problems with the
SIO line.
Files Needed to Build the Plot Server
-------------------------------------
The files which are provided for the HP 7550A plot server are:
USER1.HP.DOC - This file.
USER1.HP.DOC.INSTALL - Notes on how to install the plot server.
PRF.HP7550.HLP - An edited version of the standard Apollo
help file for the PRF command (/SYS/HELP/PRF.HLP)
with notes included for the HP7550-A plotter.
USER1.HP.PAS - The Pascal sources for the plot server.
USER1.INS.PAS - An edited version of the standard Apollo
insert file, /SYS/INS/PRSVR.INS.PAS, which
is used by USER1.HP.PAS to define the data
types and structures used by the plot server.
USER1.HP.BLD - A shell script file for compiling the USER1
routines (and their subroutines) and binding
them with the Apollo supplied print server.
HP.CONFIG - The configuration file for the HP 7550A
to be given as an argument to the plot server
when it is started.
PRSVR.USER1.HP - A ready to run HP 7550 plot server. Just in
case you don't have a Pascal compiler. This is
the file which is produced by USER1.BLD.
You will also need the following standard Apollo-supplied files:
/SYS/INS/BASE.INS.PAS - These are all standard insert files which
/SYS/INS/SIO.INS.PAS are used by USER1.HP.PAS.
/SYS/INS/STREAMS.INS.PAS
/SYS/INS/PGM.INS.PAS
/COM/PRSVR - The standard Apollo print server which must
be bound with the Toshiba routines to produce
a working print server. Used in USER1.BLD to
produce PRSVR.USER1.HP.
Bugs, Questions, and Improvements
---------------------------------
If you find a bugs in the print server, have questions on how to install or
use it, or have a good idea for improving the program please feel free to contact
me at the address below.
David M. Krowitz
MIT dept. of Earth, Atmospheric, and Planetary Sciences
Room 54-527
Cambridge, MA 02139
(617) 253-6180
ARPA net mailing adress: [email protected]
or
KROWITZ%[email protected]
End of user1.hp.doc
echo user1.hp.doc.install 1>&2
cat >user1.hp.doc.install <<'End of user1.hp.doc.install'
*******************************************************************************
***** *****
***** USER1.HP.DOC.INSTALL *****
***** Version 4 *****
***** Installing the HP7550 Print Server *****
***** *****
***** Copyright (c) 1986 *****
***** David M. Krowitz *****
***** Massachusetts Institute of Technology *****
***** Department of Earth, Atmospheric, and Planetary Sciences *****
*******************************************************************************
Read the general installation and documentation notes in USER1.HP.DOC if
you have not already done so. The use the shell script file USER1.HP.BLD to
compile the Hewlitt Packard device-driver routines and to bind them to the
standard Apollo printer server located in /COM/PRSVR. This will create the
HP7550 version of the print server (PRSVR.USER1.HP) in you working directory.
Then edit the print server configuration file (HP.CONFIG) and make sure it
contains the proper SIO line number and baud rate for your installation. Next
copy the new print server (PRSVR.USER1.HP) and the print server configuration
file (HP.CONFIG) to the system directory from which you normally run the
print server on your system. /COM or /SYS/NODE_DATA are two common directories
which we use. You can then run the print server using the command:
/COM/PRSVR.USER1.HP /COM/HP.CONFIG
(assuming the files are stored in /COM). This will run the server in the current
window. The server will be stopped when you log out. If you want to run the print
server automatically when the system is brought up, add the following command line
to your installation's startup file in /SYS/NODE_DATA:
###
### To startup user-defined print server for the HP7550 plotter
###
CPS /COM/PRSVR.USER1.HP -N PLOTTER_SERVER /COM/HP.CONFIG
(again, assuming the files are kept in /COM). This will run the print server
automatically when the node is brought up and will give it the process a server
status so that you can logout and leave the print server running for other users
on the network. Apollo's standard print server (and the Hewlitt Packard version)
looks for files to be plotted in the /SYS/PRINT directory of the node on which
the print server is running. If you want files from other nodes on the network
to be automatically plotted on the HP7550 you should delete the /SYS/PRINT
directories on those nodes and replace them with links to the /SYS/PRINT
directory on the node running the print server. Otherwise, users can use the
command:
PRF -S //NODE_NAME
to have the PRF command send the file to the node which has the plotter attached
to it.
More information on the installation and use of print servers can be found in
The Domain System Administrator's Guide, section 6.5 (Peripheral Servers).
End of user1.hp.doc.install
echo user1.hp.pas 1>&2
cat >user1.hp.pas <<'End of user1.hp.pas'
{*****************************************************************************
***** *****
***** USER1.HP.PAS *****
***** *****
***** Serial Plotter Driver for the Hewlitt Packard 7550A pen plotter *****
***** Version 4 *****
***** David M. Krowitz January 22, 1986. *****
***** *****
***** Copyright (c) 1986 *****
***** David M. Krowitz *****
***** Massachusetts Institute of Technology *****
***** Department of Earth, Atmospheric, and Planetary Sciences *****
*****************************************************************************
}
MODULE USER1_HP;
%NOLIST;
%INSERT '/sys/ins/base.ins.pas';
%INSERT '/sys/ins/sio.ins.pas';
%INSERT '/sys/ins/streams.ins.pas';
%INSERT '/sys/ins/pgm.ins.pas';
%INSERT 'user1.ins.pas';
%LIST;
CONST
{Definitions of standard ascii control characters}
nul = chr(0); {null character}
etx = chr(3); {etx (control-C) character}
bs = chr(8); {backspace (control-H)}
tab = chr(9); {tab (control-I)}
lf = chr(10); {line feed (control-J)}
vt = chr(11); {vertical tab (control-K)}
ff = chr(12); {form feed (control-L)}
cr = chr(13); {carriage return (control-M)}
sub = chr(26); {sub (control-Z)}
esc = chr(27); {escape}
rs = chr(30); {rs}
TYPE
str1_t = packed array[1..1] of char;
str2_t = packed array[1..2] of char;
str3_t = packed array[1..3] of char;
str4_t = packed array[1..4] of char;
str5_t = packed array[1..5] of char;
str6_t = packed array[1..6] of char;
str7_t = packed array[1..7] of char;
str8_t = packed array[1..8] of char;
str9_t = packed array[1..9] of char;
str10_t = packed array[1..10] of char;
str11_t = packed array[1..11] of char;
str12_t = packed array[1..12] of char;
command_buffer_t = packed array[1..4096] of char;
VAR
{Definitions of control sequences for the HP7550 plotter}
init_plotter: str3_t; {initialize plotter characteristics}
reset_plotter: str9_t; {reset plotter after finishing a plot}
enable_flush_mode: str3_t; {enable the ESCAPE key on plotter's front panel}
reset_flush_mode: str3_t; {reset flush mode after finishing each plot}
new_page: str3_t; {eject current page (if plotted on) and load new page}
store_pen: str3_t; {put pen back into carosel}
crlf: str2_t; {carriage-return, line-feed sequence}
{Defintions of global variables}
text_flag: boolean; {Flags text-mode output being ignored}
transparent_flag: boolean; {Flags transparent-mode output in progress}
bitmap_flag: boolean; {Flags GMF bitmap plot-mode output being ignored}
output_done_flag: boolean; {Flags output of file completed (all output modes)}
flush_flag: boolean; {True if USER1_FLUSH routine called at least once}
abort_flag: boolean; {True if user has aborted the plot by pressing ESCAPE key on plotter}
x_plot_size: pinteger; {x dimension of GMR vector file being plotted}
y_plot_size: pinteger; {y dimension of GMR vector file being plotted}
output_mode: pr_$data_format_t; {output mode: text, transparent, or bitmap plot}
server_ptr: server_db_ptr_t; {pointer to database set up by server}
driver_ptr: driver_db_ptr_t; {pointer to database of Toshiba's abilities}
stream_id: stream_$id_t; {stream id returned by STREAM_$OPEN}
status: status_$t; {status returned by SIO and STREAM calls}
seek_key: stream_$SK_t; {seek_key returned by STREAM calls}
plotter_response: UNIV_PTR; {pointer to response of plotter to the OG command}
response_length: linteger; {number of bytes read from plotter}
PROCEDURE USER1_INIT (
IN sio_line: integer;
IN sio_speed: UNIV sio_$value_t
);
VAR
sioname: array[1..3] of str9_t; {names of SIO lines for STREAM_$OPEN call}
i,j: pinteger; {counters}
BEGIN
{Open I/O stream and set SIO line characteristics}
sioname[1] := '/dev/sio1';
sioname[2] := '/dev/sio2';
sioname[3] := '/dev/sio3';
stream_$open (sioname[sio_line],9,stream_$append,stream_$no_conc_write,
stream_id,status);
IF (status.fail = TRUE) THEN BEGIN
WRITELN ('**** USER1_INIT: Error - could not open output stream: ',
sioname[sio_line],' ****');
PGM_$EXIT;
END;
sio_$control (stream_id,sio_$speed,sio_speed,status);
IF (status.fail = TRUE) THEN BEGIN
WRITELN ('**** USER1_INIT: Error - could not set SIO_$SPEED: ',
sioname[sio_line],' ****');
PGM_$EXIT;
END;
sio_$control (stream_id,sio_$nlc_delay,0,status);
IF (status.fail = TRUE) THEN BEGIN
WRITELN ('**** USER1_INIT: Error - could not set SIO_$NLC_DELAY to 0: ',
sioname[sio_line],' ****');
PGM_$EXIT;
END;
sio_$control (stream_id,sio_$input_sync,true,status);
IF (status.fail = TRUE) THEN BEGIN
WRITELN ('**** USER1_INIT: Error - could not set SIO_$INPUT_SYNC on: ',
sioname[sio_line],' ****');
PGM_$EXIT;
END;
sio_$control (stream_id,sio_$host_sync,true,status);
IF (status.fail = TRUE) THEN BEGIN
WRITELN ('**** USER1_INIT: Error - could not set SIO_$HOST_SYNC on: ',
sioname[sio_line],' ****');
PGM_$EXIT;
END;
sio_$control (stream_id,sio_$no_echo,true,status);
IF (status.fail = TRUE) THEN BEGIN
WRITELN ('**** USER1_INIT: Error - could not set SIO_$NO_ECHO on: ',
sioname[sio_line],' ****');
PGM_$EXIT;
END;
sio_$control (stream_id,sio_$cts_enable,false,status);
IF (status.fail = TRUE) THEN BEGIN
WRITELN ('**** USER1_INIT: Error - could not set SIO_$CTS_ENABLE off: ',
sioname[sio_line],' ****');
PGM_$EXIT;
END;
sio_$control (stream_id,sio_$quit_enable,false,status);
IF (status.fail = TRUE) THEN BEGIN
WRITELN ('**** USER1_INIT: Error - could not set SIO_$QUIT_ENABLE off: ',
sioname[sio_line],' ****');
PGM_$EXIT;
END;
sio_$control (stream_id,sio_$parity,sio_$even_parity,status);
IF (status.fail = TRUE) THEN BEGIN
WRITELN ('**** USER1_INIT: Error - could not set SIO_$PARITY even: ',
sioname[sio_line],' ****');
PGM_$EXIT;
END;
sio_$control (stream_id,sio_$bits_per_char,sio_$8bpc,status);
IF (status.fail = TRUE) THEN BEGIN
WRITELN ('**** USER1_INIT: Error - could not set SIO_$BPC to 8 bits/char: ',
sioname[sio_line],' ****');
PGM_$EXIT;
END;
sio_$control (stream_id,sio_$stop_bits,sio_$stop_1,status);
IF (status.fail = TRUE) THEN BEGIN
WRITELN ('**** USER1_INIT: Error - could not set SIO_$STOP to 1 stop bit: ',
sioname[sio_line],' ****');
PGM_$EXIT;
END;
{Initialize strings of control characters for printer}
init_plotter[1] := 'I';
init_plotter[2] := 'N';
init_plotter[3] := ';';
reset_plotter[1] := 'R';
reset_plotter[2] := 'O';
reset_plotter[3] := ';';
reset_plotter[4] := 'I';
reset_plotter[5] := 'P';
reset_plotter[6] := ';';
reset_plotter[7] := 'D';
reset_plotter[8] := 'F';
reset_plotter[9] := ';';
store_pen[1] := 'S';
store_pen[2] := 'P';
store_pen[3] := ';';
reset_flush_mode[1] := esc;
reset_flush_mode[2] := '.';
reset_flush_mode[3] := 'U';
enable_flush_mode[1] := 'O';
enable_flush_mode[2] := 'G';
enable_flush_mode[3] := ';';
new_page[1] := 'P';
new_page[2] := 'G';
new_page[3] := ';';
crlf[1] := cr;
crlf[2] := lf;
{Initialize output-mode flags}
text_flag := false;
transparent_flag := false;
bitmap_flag := false;
output_done_flag := true;
flush_flag := false;
abort_flag := false;
{Initialize the printer settings}
stream_$put_chr (stream_id,addr(reset_flush_mode),3,seek_key,status);
stream_$put_chr (stream_id,addr(init_plotter),3,seek_key,status);
stream_$put_chr (stream_id,addr(store_pen),3,seek_key,status);
output_mode := pr_$transparent;
END; {End of USER1_INIT}
PROCEDURE USER1_WRITE (
IN buffer: UNIV pr_$buf_t;
IN buffer_length: pinteger
);
PROCEDURE USER1_WRITE_TEXT (
IN buffer: UNIV pr_$buf_t;
IN buffer_length: pinteger
);
BEGIN
IF (text_flag = FALSE) AND (output_done_flag = TRUE) THEN BEGIN
WRITELN ('Text mode output not possible on plotter - file discarded');
END;
text_flag := TRUE;
output_done_flag := FALSE;
END; {End of USER1_WRITE_TEXT}
PROCEDURE USER1_WRITE_TRANSPARENT (
IN buffer: UNIV pr_$buf_t;
IN buffer_length: pinteger
);
BEGIN
{If USER1_FLUSH has not been called at least once then ignore the
output -- it is the printer configuration info which is printed
when PRSVR starts up. It is not legal plotter output.}
IF flush_flag = TRUE THEN BEGIN
IF transparent_flag = FALSE THEN BEGIN
WRITELN ('Sending TRANSPARENT mode output to plotter');
END;
IF (abort_flag = FALSE) THEN BEGIN
stream_$put_chr (stream_id,addr(buffer),buffer_length,
seek_key,status);
END;
transparent_flag := TRUE;
output_done_flag := FALSE;
END;
END; {End of USER1_WRITE_TRANSPARENT}
PROCEDURE USER1_WRITE_PLOT (
IN buffer: UNIV pr_$buf_t;
IN buffer_length: pinteger
);
BEGIN
IF (bitmap_flag = FALSE) AND (output_done_flag = TRUE) THEN BEGIN
WRITELN ('GMF bitmap mode output not possible on plotter - file discarded');
END;
bitmap_flag := TRUE;
output_done_flag := FALSE;
END; {End of USER1_WRITE_PLOT}
BEGIN {Beginning of actual USER1_WRITE code}
{Determine printer mode and dispatch for output of buffer}
CASE output_mode OF
pr_$text: user1_write_text (buffer,buffer_length);
pr_$transparent: user1_write_transparent (buffer,buffer_length);
pr_$plot: user1_write_plot (buffer,buffer_length)
END;
END; {End of USER1_WRITE}
PROCEDURE USER1_SET_MODE (
IN mode: pr_$set_op_t;
IN data: pr_$data_rec_t
);
BEGIN
CASE mode OF
pr_$font_weight: ;
pr_$font_size: ;
pr_$text_precision: ;
pr_$data_format: output_mode := data.data_format;
pr_$pitch: ;
pr_$x_dimension: ;
pr_$y_dimension: ;
pr_$rep_factor: ;
pr_$config: ;
pr_$copies: ;
pr_$server_db: BEGIN
server_ptr := data.server_db_ptr;
output_mode := server_ptr^.print_mode;
END;
END;
END; {End of USER1_SET_MODE}
PROCEDURE USER1_RETURN_INFO (
IN query: pr_$inq_op_t;
OUT data: pr_$data_rec_t
);
BEGIN
CASE query OF
pr_$bpi: BEGIN
data.bpi.x := 1016;
data.bpi.y := 1016;
END;
pr_$rep_ability: data.rep_ability := true;
pr_$driver_db: BEGIN
driver_ptr := data.driver_db_ptr;
WITH driver_ptr^ DO BEGIN
valid := TRUE;
copies := FALSE;
color_format := none;
bw_rev := FALSE;
END;
END;
END;
END; {End of USER1_RETURN_INFO}
PROCEDURE USER1_FLUSH;
BEGIN
{Reset output-mode flags, eject the current page if it has been plotted on,
and load a new piece of paper into the plotter (assuming auto-feed is on
and paper tray has not empty - otherwise plotter will wait for new paper
to be loaded). }
IF transparent_flag = true THEN BEGIN
stream_$put_chr (stream_id,addr(reset_flush_mode),3,seek_key,status);
stream_$put_chr (stream_id,addr(reset_plotter),9,seek_key,status);
stream_$put_chr (stream_id,addr(store_pen),3,seek_key,status);
stream_$put_chr (stream_id,addr(new_page),3,seek_key,status);
END;
{We have just finished output of some file (or just finished discarding
it) so we set flag to inhibit printing of error message when PRSVR
tries to send a form-feed in text-mode to move printer (plotter) to
a new piece of paper.}
IF (text_flag = true) THEN BEGIN
output_done_flag := true;
END;
{USER1_FLUSH has been called at least once, so transparent-mode
output can be enabled (first time around the output is the PRSVR
configuration info which is printed the program is started -- but
the output is not HP-GL commands so we quietly throw it away).
All output modes have been completed so we reset their flags.}
flush_flag := true; {enable transparent-mode output}
abort_flag := false; {flush-mode has been reset (if it was enabled by user)}
text_flag := false;
transparent_flag := false;
bitmap_flag := false;
END; {End of USER1_FLUSH}
PROCEDURE USER1_CLOSE;
BEGIN
stream_$close (stream_id,status);
END; {End of USER1_CLOSE}
{***** End of module USER1_HP *****}
End of user1.hp.pas
echo user1.ins.pas 1>&2
cat >user1.ins.pas <<'End of user1.ins.pas'
{ PRSVR.INS.PAS, us/com/print, gtr, 05/09/83
Print server routines and associated data types which
are exported for user supplied device drivers.
Changes:
03/30/85 jjm updated for sr9 release
04/09/84 jjm update to sr8
05/09/83 gtr original coding
--------------------------------------------------------------------------
| THE FOLLOWING PROGRAMS ARE THE SOLE PROPERTY OF APOLLO COMPUTER INC. |
| AND CONTAIN ITS PROPRIETARY AND CONFIDENTIAL INFORMATION. |
--------------------------------------------------------------------------
}
CONST pr_$bufsize = 2048 ;
TYPE pr_$buf_t = ARRAY [1..pr_$bufsize] OF char ;
pr_$t = (pr_$user1, pr_$user2, pr_$user3, pr_$user4) ;
pr_$set_op_t = (
pr_$font_weight,
pr_$font_size,
pr_$text_precision,
pr_$data_format,
pr_$pitch,
pr_$y_dimension,
pr_$x_dimension,
pr_$rep_factor,
pr_$config,
pr_$copies,
pr_$server_db
);
pr_$inq_op_t = (
pr_$bpi,
pr_$rep_ability,
pr_$driver_db
);
pr_$font_weight_t = (
pr_$light,
pr_$medium,
pr_$bold
);
pr_$text_precision_t = (
pr_$draft,
pr_$letter_quality
);
pr_$data_format_t = (
pr_$text,
pr_$plot,
pr_$transparent
);
prsvr_color_format_t = (none, {not a color printer}
pixel, {color map format}
scan_line_rgb,{3 plane formats}
scan_line_ymc,
plane_rgb,
plane_ymc
); {this tells the server how to send bitmap data}
pr_$interface_t = ( pr_$serial,
pr_$parallel,
pr_$external,
pr_$versatec,
pr_$multibus);
{This data base is set up by PRSVR based on PRF options specified by
the user and information the driver passes to PRSVR via the
driver database (driver_db_t). To use this database, set up a record
in your driver of type server_db_t. The setmode call will pass a pointer
to this database as it exists in PRSVR.}
server_db_t = RECORD
copies : binteger;
print_mode : pr_$data_format_t;
cpi : real; {characters per inch}
lpi : real; {lines per inch}
weight : pr_$font_weight_t;
lq : boolean;
resolution : pinteger; {set the printer to print at this resolution}
magnification : integer; {set the printer to magnify a bitmap by this amount}
bitmap_size : RECORD
x : integer; {the number of bits PRSVR will send}
y : integer;
planes : integer; {bits per pixel}
END;
color : boolean; {this file should be printed in color}
bw_rev : boolean; {set if user requests it and the printer can do it }
END;
server_db_ptr_t = ^server_db_t; {this points you to the PRSVR server_db}
{Use this database to pass PRSVR information about the driver and
printers capabilities. PRSVR will issue a return_info call at
startup, requesting this information. When the operation type of
this call = pr_$driver_db , pass the PRSVR program the pointer to
your driver database}
driver_db_t = RECORD {information about the printer that the driver supplies}
valid : boolean; { set this to true }
copies : boolean; {does the printer do multiple copies}
cpi : ARRAY [1..10] OF real; {an array of character spacings}
lpi : ARRAY [1..10] OF real;
resolution : ARRAY [1..4] OF pinteger;
{ the printer plots at these resolutions}
res_min : pinteger; {a range of resolutions from minimum ...}
res_max : pinteger; {... to maximum}
magnification : ARRAY [1..16] OF binteger;
color_format : prsvr_color_format_t; {tell prsvr how to send
color images}
bw_rev : boolean; {set if the printer can bw reverse image}
END;
driver_db_ptr_t = ^driver_db_t; {this tells PRSVR where to find
your driver database}
pr_$data_rec_t = packed RECORD
font_weight : pr_$font_weight_t ;
font_size : real ;
text_precision : pr_$text_precision_t ;
bpi : RECORD
x : integer ;
y : integer ;
END;
data_format: pr_$data_format_t;
pitch : real ;
x_dimension : pinteger ;
y_dimension : pinteger ;
rep_factor : pinteger;
rep_ability : boolean;
copies : pinteger;
interface: pr_$interface_t;
server_db_ptr : server_db_ptr_t;
driver_db_ptr : driver_db_ptr_t;
END ;
PROCEDURE user2_init (
IN sio_line: integer;
IN sio_speed: integer
) ; EXTERN ;
PROCEDURE user3_init (
IN sio_line: integer;
IN sio_speed: integer
) ; EXTERN ;
PROCEDURE user4_init (
IN sio_line: integer;
IN sio_speed: integer
) ; EXTERN ;
PROCEDURE user2_write (
IN str: UNIV pr_$buf_t ;
IN strlen: pinteger
) ; EXTERN ;
PROCEDURE user3_write (
IN str: UNIV pr_$buf_t ;
IN strlen: pinteger
) ; EXTERN ;
PROCEDURE user4_write (
IN str: UNIV pr_$buf_t ;
IN strlen: pinteger
) ; EXTERN ;
PROCEDURE user2_flush ; EXTERN ;
PROCEDURE user3_flush ; EXTERN ;
PROCEDURE user4_flush ; EXTERN ;
PROCEDURE user2_close ; EXTERN ;
PROCEDURE user3_close ; EXTERN ;
PROCEDURE user4_close ; EXTERN ;
PROCEDURE user2_set_mode (
IN operation : pr_$set_op_t;
IN datum : pr_$data_rec_t
); EXTERN ;
PROCEDURE user3_set_mode (
IN operation : pr_$set_op_t;
IN datum : pr_$data_rec_t
); EXTERN ;
PROCEDURE user4_set_mode (
IN operation : pr_$set_op_t;
IN datum : pr_$data_rec_t
); EXTERN ;
PROCEDURE user2_return_info (
IN operation : pr_$inq_op_t;
OUT datum : pr_$data_rec_t
); EXTERN ;
PROCEDURE user3_return_info (
IN operation : pr_$inq_op_t;
OUT datum : pr_$data_rec_t
); EXTERN ;
PROCEDURE user4_return_info (
IN operation : pr_$inq_op_t;
OUT datum : pr_$data_rec_t
); EXTERN ;
%eject ;
End of user1.ins.pas
|