.\"
.\" $XConsortium: p091,v 5.3 94/04/17 20:55:23 hersh Exp $
.\"
.\" 
$XMCOPY
.\" Copyright (c) 1990, 1991 by Sun Microsystems, Inc. and the X Consortium.
.\" 
.\"                         All Rights Reserved
.\" 
.\" Permission to use, copy, modify, and distribute this software and its 
.\" documentation for any purpose and without fee is hereby granted, 
.\" provided that the above copyright notice appear in all copies and that
.\" both that copyright notice and this permission notice appear in 
.\" supporting documentation, and that the names of Sun Microsystems,
.\" and the X Consortium not be used in advertising or publicity 
.\" pertaining to distribution of the software without specific, written 
.\" prior permission.  
.\" 
.\" SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
.\" EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
.\" CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
.\" USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
.\" OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
.\" PERFORMANCE OF THIS SOFTWARE.
.ds f \s-2INQUIRE CHOICE DEVICE STATE\s+2
.TH "INQUIRE CHOICE DEVICE STATE" 3P "29 February 1991"
.SH NAME
INQUIRE CHOICE DEVICE STATE \- inquire state of a choice device
.IX "Choice Input Devices" "INQUIRE CHOICE DEVICE STATE"
.SH SYNOPSIS
.SS C Syntax
.ft B
.ta 1.25i 3i
.nf
void
pinq_choice_st ( ws, dev, store, err, op_mode, echo_switch, init_status, init_choice, prompt_echo, 
     echo_area, choice_data )
Pint	ws;	\fIworkstation identifier\fP
Pint	dev;	\fIchoice device number\fP
Pstore	store;	\fI\s-2OUT\s+2 handle to Store object\fP
Pint	*err;	\fI\s-2OUT\s+2 error indicator\fP
Pop_mode	*op_mode;	\fI\s-2OUT\s+2 operating mode\fP
Pecho_switch	*echo_switch;	\fI\s-2OUT\s+2 echo switch\fP
Pin_status	*init_status;	\fI\s-2OUT\s+2 initial choice status\fP
Pint	*init_choice;	\fI\s-2OUT\s+2 initial choice\fP
Pint	*prompt_echo;	\fI\s-2OUT\s+2 prompt/echo type\fP
Plimit	*echo_area;	\fI\s-2OUT\s+2 echo area\fP
Pchoice_data	**choice_data;	\fI\s-2OUT\s+2 data record\fP
.fi
.ft R
.SS Required PHIGS Operating States
(PHOP, WSOP, *, *)
.SH DESCRIPTION
.SS Purpose
Use \*f to determine the current state of a choice device.
.SS C Input Parameters
.LP
Applications using the \s-2C\s+2 binding must create a buffer to be used by this
function as memory space for storing data associated with the device state.
This buffer is passed as the \fIstore\fP argument.
.LP 
The store buffer is a data area managed by \s-2PHIGS\s+2. While the 
application is responsible for creating the initial buffer through a call to 
\s-2CREATE STORE\s+2, \s-2PHIGS\s+2 manages this area such that there is
sufficient memory for the specific inquiry. The choice device data record
within the store buffer is accessed via the pointer pointed to by choice_data.
.IP \fIws\fP
Workstation identifier. An integer specifying the workstation with which
the specified choice device is associated.
.IP \fIdev\fP
The device number of the choice device.
See the \fIAvailable Devices\fP section of \s-2INITIALIZE CHOICE\s+2
for a description of the available devices.
.IP \fIstore\fP
The memory buffer \s-2PHIGS\s+2 is to use for storing the information
returned.  
This buffer must exist prior to calling this function (see
\s-2CREATE STORE (3P)\s+2).
.SS C Output Parameters
.IP \fIerr\fP
The error indicator.  See the \fIExecution\fP section below for a
description of its use.  See the \fIErrors\fP section below for the
possible values it may return.
.IP \fIop_mode\fP
A pointer to a variable of type Pop_mode, which contains the current
operating mode of the device.  Pop_mode is enumerated in phigs.h as follows:
.sp .4
.ta .5i
.nf
typedef enum {
.sp .2
	POP_REQ,
	POP_SAMPLE,
	POP_EVENT
.sp .2
} Pop_mode;
.fi
.IP \fIecho_switch\fP
A pointer to a variable of type Pecho_switch, which contains the state of
the device's echo switch. The value returned for \fIecho_switch\fP will be either
PSWITCH_ECHO or PSWITCH_NO_ECHO.
.IP \fIinit_status\fP
A pointer to a variable of type Pin_status, which contains the 
initial choice status of the device. Possible values for 
\fIinit_status\fP are PIN_STATUS_OK or PIN_STATUS_NONE.
.IP \fIinit_choice\fP
A pointer to an integer that contains the value of the initial choice.
.IP \fIprompt_echo\fP
A pointer to an integer that contains the value of the prompt/echo type.
.IP \fIecho_area\fP
A pointer to a variable of type Plimit that contains the echo area of
the device. Plimit is defined in phigs.h as follows:
.sp .4
.nf
.ta .5i +1i +1i   
.sp .2
typedef struct {
.sp .2
	Pfloat	x_min;	/* x min */
	Pfloat	x_max;	/* x max */
	Pfloat	y_min;	/* y min */
	Pfloat	y_max;	/* y max */
.sp .2
} Plimit;
.fi
.IP \fIchoice_data\fP
A pointer to a Pchoice_data pointer.
\s-2PHIGS\s+2 assigns this pointer to the location in the Pstore
structure that contains the device's data record contents.
Pchoice_data is defined in phigs.h as follows:
.sp .4
.ta .5i +.5i +1i +1.25i
.nf
.sp .2
typedef struct {
.sp .2
      union {
	struct {
		Pint	unused;
	} pet_r1;
	struct {
		Pint	num_prompts;	/* number of alternatives */
		Ppr_switch	*prompts;	/* array of prompts */
	} pet_r2;
	struct {
		Pint	num_strings;	/* number of choice strings */
		char	**strings;	/* array of choice strings */
	} pet_r3;
	struct {
		Pint	num_strings;	/* number of alternatives */
		char	**strings;	/* array of strings  */
	} pet_r4;
	struct {
		Pint	struct_id;	/* struct identifier  */
		Pint	num_pick_ids;	/* number of alternatives */
		Pint	*pick_ids;	/* array of pick identifiers */
	} pet_r5;
      } pets; 
} Pchoice_data;
.fi
.IP
Ppr_switch is an enumerated type with the following values:
.ta .5i +1.5i +1.5i +1.25i
.nf
.sp .2
typedef enum {
.sp .2
	PPR_OFF
	PPR_ON
.sp .2
} Ppr_switch;
.fi
.SS Execution
\*f returns the current state of the
specified choice device, which is stored in the workstation
state list of the workstation associated with the device.  The
current state includes the operating mode, echo switch, initial choice,
prompt/echo type, echo area, and data record.
See \s-2SET CHOICE MODE\s+2 for a description of the operating mode and the
echo switch, and how to set these values.
See \s-2INITIALIZE CHOICE\s+2 for a description of the initial choice,
prompt/echo type, echo area, and data record contents, and how to set these
values.
.LP
In the event of an error, the \fIerror indicator\fR indicates the error
number of the error detected, and no other output data is returned.  
If no error is detected, the \fIerror indicator\fR is set to zero, and
the inquired information will be available in the output parameters.
Since this is an inquiry function, \s-2ERROR HANDLING\s+2 is not invoked when an
error is detected by this function.
.SH ERRORS
.IP 003
Ignoring function, function requires state (\s-2PHOP\s+2, \s-2WSOP\s+2, *, *)
.IP 054
Ignoring function, the specified workstation is not open
.IP 061
Ignoring function, specified workstation is neither of category \s-2INPUT\s+2
nor of category \s-2OUTIN\s+2
.IP 250
Ignoring function, the specified device is not available
on the specified workstation
Buffer overflow in input or inquiry function
.SH SEE ALSO
.nf
.IP
.ta 0.5i
.SM "SET CHOICE MODE (3P)"
.SM "INITIALIZE CHOICE (3P)"
.SM "INQUIRE CHOICE DEVICE STATE 3 (3P)"
.SM "CREATE STORE (3P)"
.SM "DELETE STORE (3P)"
.fi
