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 bitwise ORed together:
SPOOLED Output is spooled to a file. Do not inquire from the device. If this bit is set, the path parameter should name a regular file or FIFO special file.
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.
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 transforms the primitives from modelling 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.
INT_XFORM Only Integer and common operations will be performed. All Floating point operations will cause an error.
FLOAT_XFORM Only Floating point and common operations will be performed. All Integer operations will cause an error.
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). If the SPOOLED bit is set, the file will be created or overwritten.
No process can have more than _NFILE file descriptors open simultaneously. _NFILE is an HP-UX system variable that defines the number of open files allowed per process at any given time. The value assigned to this variable is found in /usr/include/stdio.h.
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.
Integer operations are only available when using the INT_XFORM gopen mode. When in INT_XFORM mode Floating point operations are not available for that fildes. Floating point operations are available by the default, or can be specified with FLOAT_XFORM mode. For a list of Integer operations, Floating point operations and common operations see the starbase.3g manual page.
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 for spooled output 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 Manual.
Hewlett-Packard Company — May 11, 2021