inq_ele(3G)
NAME
inq_ele_size, inq_ele − inquire the size and contents of the current element
SYNOPSIS
C Syntax:
void inq_ele_size ( fildes, size )
int fildes, *size;
void inq_ele ( fildes, ele )
int fildes, *ele;
FORTRAN77 Syntax:
subroutine inq_ele_size ( fildes, size )
integer*4 fildes, size
subroutine inq_ele ( fildes, ele )
integer*4 fildes, ele (*)
Pascal Syntax:
procedure inq_ele_size ( fildes:integer; var size:integer );
procedure inq_ele ( fildes:integer;
var ele[lo..hi:integer] of integer );
DESCRIPTION
Input Parameters
fildes Integer file descriptor returned by gopen when an I/O path to a graphics device is opened.
Output Parameters
size Size of array (number of integers) needed to hold the current element contents.
ele Buffer within which the integers that make up the element are returned. The ele array must be able to hold at least size integers.
Discussion
Inq_ele_size returns the size of the array needed to hold the contents of the current element in the currently open segment of the specified graphics device. The size is specified in the number of array elements (integers) needed. If the current element is element 0, 0 will be returned in size.
Inq_ele returns the contents of the current element. The contents are copied into the array ele. The size of the array must be at least size elements. If the current element is element 0, the contents of the array ele will not be changed.
Inq_ele is useful for storing elements in an application data structure or file. Subsequently, the elements can be displayed or added to a display list using interpret_ele(3G).
EXAMPLE
Assuming fd contains a gopen’ed file descriptor, the following C code fragment inquires an element, deletes it, then reinterprets the element, thus restoring it into the display list. For further examples, see the <starbase>/examples/dl directory (the actual path name of the directory given in angle brackets depends on the file system structure; see the Graphics Administration Guide for details).
#define MAX_SIZE 100
int ele[MAX_SIZE];
int size;
.
.
.
/* Assume a segment is open, and the current element is not element 0. */
inq_ele_size(fd, &size);
if (size > MAX_SIZE) {
printf("Size too large.\n");
}
else {
inq_ele(fd, ele); /* store the element in the array */
delete_eles(fd, 1); /* delete it */
.
.
.
interpret_ele(fd, ele); /* and restore it from the array */
}
}
ERRORS
1 Graphics device not initialized for this operation.
24 Segment not open.
SEE ALSO
interpret_ele(3G), inq_ele_control(3G), inq_content(3G), print_element(3G),
set_ele_ptr(3G), set_ele_ptr_at_end(3G), set_ele_ptr_relative(3G),
set_ele_ptr_relative_to_label(3G).
Hewlett-Packard Company — HP-UX Release 10.0