GOPEN(3G)
NAME
gopen − open I/O path to, create environment for, and initialize graphics device
SYNOPSIS
C Syntax:
int gopen (path,kind,driver,mode);
char *path,*driver;
int kind,mode;
FORTRAN77 Syntax:
integer*4 function gopen(path,kind,driver,mode)
character*(*) path,driver
integer*4 kind,mode
Pascal Syntax:
function gopen(path:string255;kind:integer;
driver:string255;mode:integer):integer;
DESCRIPTION
Input Parameters
path Device file name for the device to be opened. This file is usually found in the /dev directory.
kind One of the constants:
INDEV Device is to be used for input only.
OUTDEV Device is to be used for output only.
OUTINDEV Device is to be used for both input and output.
driver Character representation of the hardware device type. See Starbase Device Drivers Library for details.
mode Word containing flags used at open time to specify control. The following flags can be ORed together:
SPOOLED Output is spooled to a file. Do not inquire from the device
RESET_DEVICE Device is completely initialized, including color map initialization and clearing the view surface.
INIT Device is initialized in a device-dependent manner.
THREE_D All transformations are three dimensional, including point, line, and polygon transformations as well as matrix concatenations.
(list continued next page)
MODEL_XFORM As part of the opening, the device is prepared for shading of output primitives and/or removal of back-facing polygons. This means that output primitives must be transformed in two stages:
1. All output primitives are transformed by the top matrix on the matrix stack (if any matrices have been pushed onto the stack). This tranforms the primitives from modeling coordinates to world coordinates. At this stage rendering calculations can be made.
2. Primitives are transformed from world coordinates to device coordinates by the current viewing and vdc-to-device units transformations. If the device is not opened in this mode, all transformations can be concatenated and performed simultaneously.
Discussion
This function returns a non-negative integer upon a successful device opening. This integer is called the file descriptor and is referred to by the name fildes in this manual.
The file descriptor remains open across exec system calls. See fcntl(2).
No process can have more than _NFILE file descriptors open simultaneously. _NFILE is an HP-UX system variable that defines the number of open processes allowed at any given time. The value assigned to this variable is found in /usr/include/stdio.h. A given single process can have only one raster output device open at any given time, although that device can be opened more than once.
When a graphics device is opened, many defaults are set. They are described more fully in the file /usr/lib/starbase/defaults.
The device file name path is created by the mknod command. For information about creating the device file, consult the Starbase Device Drivers Library manual in the chapter describing the device of interest.
RETURN VALUE
Upon successful completion, a non-negative integer called the file descriptor (fildes) is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.
EXAMPLES
The following example opens an HP 98720 display device and performs device initialization:
fildes=gopen("/dev/crt",OUTDEV,"hp98720",INIT|THREE_D|MODEL_XFORM);
SEE ALSO
errno(2), gclose(3G), Starbase Device Drivers Library.
Hewlett-Packard Company — May 11, 2021