 |
» |
|
|
 |
Syntax Example |  |
For C programs[4]: fildes = gopen("〈dev〉/plt", OUTDEV, "CADplt", RESET_DEVICE); fildes = gopen("spoolfile", OUTDEV, "CADplt", RESET_DEVICE | SPOOLED); |
For FORTRAN 77
programs: fildes = gopen('〈dev〉/plt'//char(0), OUTDEV, + 'CADplt'//char(0), RESET_DEVICE) fildes = gopen('〈dev〉/plt'//char(0), OUTDEV, + 'CADplt'//char(0), RESET_DEVICE+SPOOLED) |
For Pascal
programs: fildes := gopen('〈dev〉/plt', OUTDEV, 'CADplt', RESET_DEVICE); fildes := gopen('spoolfile', OUTDEV, 'CADplt', RESET_DEVICE+SPOOLED); |
Parameters for gopen |  |
The gopen
procedure has four parameters: path,
kind, driver,
mode. path -
This is the name of the special device file created by the mknod command as specified
in the section "Special Device Files" such as 〈dev〉/plt. kind - This indicates
the I/O characteristics of the device. This parameter may only be
OUTDEV. driver - This is the
character representation of the driver type. This must be CADplt. mode - This is the mode
control word which consists of several flag bits which are or
ed together. Listed below are the flag bits and their device dependent
actions: SPOOLED
- Open the device for spooled operation. 0
(zero) - Open the device but do nothing else. INIT
- Open and initialize the device in a device dependent manner. For
this device driver the INIT
mode will send the HP-GL command DF
to the device. This DF
command will not change the following characteristics
of the plotter: pen speed, force and acceleration 90 degree rotation or axis alignment
RESET_DEVICE
- Open and completely initialize the device. For this device driver
the RESET_DEVICE
mode will send the HP-GL command IN
to the device. This command will reset the device's configuration
including P1 and P2. THREE_D
- Open the device for three-dimensional primitives.
Device Defaults |  |
The HP-GL default color table is the same as the Starbase
default color table. To read the current color table values, use
the inquire_color_table
procedure. The official color table is stored in the device driver
allowing different color tables to be used for different devices
in the same program. The default color map has eight entries as
shown in the following table. Table 1-2 Default
Color Map Pen | Color | Red | Green | Blue |
|---|
0 | white (pen up) | 0.0 | 0.0 | 0.0 | 1 | black | 1.0 | 1.0 | 1.0 | 2 | red | 1.0 | 0.0 | 0.0 | 3 | yellow | 1.0 | 1.0 | 0.0 | 4 | green | 0.0 | 1.0 | 0.0 | 5 | cyan | 0.0 | 1.0 | 1.0 | 6 | blue | 0.0 | 0.0 | 1.0 | 7 | magenta | 1.0 | 0.0 | 1.0 |
You can change the color table values with the define_color_table procedure. Red, Green and Blue Values Functions that pass red, green and blue values are supported.
The pen most closely corresponding in value to the red, green and
blue values is selected using the current color table entries. A
"square root of sum of squares" algorithm is used to identify the
pen. The default number of millimeters per device coordinates is
0.025. If the gopen
mode is not SPOOLED,
the device driver will inquire the device and use the value returned. The device coordinate origin (0, 0) is device dependent. You
should consult your device hardware manual to get the origin. In
general, the origin is normally centered between the P1 and P2 extent
so that there are an equal number of negative and positive device
coordinates on each side of the origin. One known exception is the
HP 7550 plotter which places the origin in the lower left corner
of the paper. If the device is not in SPOOLED mode, then the device
driver will send the HP-GL command OI
and use the returned string as the device ID. If the device is spooled,
the device ID will be CADplt. The following table shows the default line types that are
available. Table 1-3 Line
Types Index | Type |
|---|
0 | SOLID | 1 | DASH | 2 | DOT | 3 | DASH_DOT | 4 | CENTER_DASH_DASH | 5 | LONG_DASH | 6 | CENTER_DASH | 7 | CENTER_DASH_DASH |
The default number of pens is 8. The number of pens may be
specified using the HPGL_SET_PEN_NUMBER
gescape. The values for P1 and P2 are device dependent and will vary
depending on the gopen
mode that was used when accessing the device as below: INIT
or 0 mode The values of P1 and P2 will be equal to the current values
set for the device. The device driver will inquire these values
and use them unmodified. When a device is opened in this mode, it
is the your responsibility to insure that appropriate P1 and P2
values are currently established. RESET_DEVICE
mode The HP-GL command IN
will be sent to the plotter. This will cause the device to reset
P1 and P2 to take advantage of the full size of the paper that is
currently loaded. The device driver will then inquire these values
and use them. This mode insures that the current values of P1 and
P2 will match the paper size that is loaded. SPOOLED
mode Since the device driver cannot inquire the P1 and P2 values
from the device, the driver assumes the limits are as below: P1 x: -23144, P1 y: -17048 P2 x: 23144, P2 y: 17048 |
which are the limits for HP 7596A 36-inch roll paper. The
device driver will then put the HP-GL command SC in the spool file. This
will cause the device to scale the assumed P1 and P2 values to the
actual P1 and P2 values in effect when the spooled file is dumped
to the device. The affect of the scaling command is to cause the
entire drawing to be expanded or compressed so that it will fill
the P1 and P2 extent that the device currently has. In order to
turn off the scaling function, the Starbase procedure set_p1_p2 with METRIC units must be called.
 |  |  |  |  | NOTE: Some devices will not guarantee isotropic scaling when
you spool to them. Check your device hardware manual to see if the
HP-GL command SC
supports the fifth parameter for isotropic scaling. If it does not,
then the P1, P2 aspect ratio must match the default P1, P2 ratio
above, or the drawing will be distorted. |  |  |  |  |
An initial timeout of 10 seconds is used when the procedure
gopen is called.
If the device is accessed correctly by the gopen call within the timeout,
then the timeout is removed completely for all further action. Should
the device be taken off line or fail after a successful gopen call, the device driver
can "hang" for an indefinite period of time.
|