Previous Next Up Title Contents General Index Functions Index Bookshelf

INITIALIZE CHOICE 3

pinit_choice3


CALL SEQUENCE

void pinit_choice3 (ws_id, choice_dev, init_status, init_choice, pet, echo_volume, choice_data_rec)

INPUT PARAMETERS

Pint	ws_id,
Pint	choice_dev,
Pin_status	init_status,
Pint	init_choice,
Pint 	pet,
const Plimit3	*echo_volume,
const Pchoice_data3	*choice_data_rec

ARGUMENTS

ws_id,
Workstation identifier
choice_dev,
Choice device number
init_status,
Initial choice status
init_choice,
Initial choice
pet,
Prompt and echo type
echo_volume,
Echo volume
choice_data_rec
Data record

TYPES

typedef enum {
	PIN_STATUS_NONE, 
	PIN_STATUS_OK, 
	PIN_STATUS_NO_IN
} Pin_status;

typedef struct {
	Pfloat	x_min;	/* minimum x 	*/
	Pfloat	x_max;	/* maximum x 	*/
	Pfloat	y_min;	/* minimum y 	*/
	Pfloat	y_max;	/* maximum y 	*/
	Pfloat	z_min;	/* minimum z 	*/
	Pfloat	z_max;	/* maximum z 	*/
} Plimit3;
typedef struct {
	union Pchoice3_pets {
		struct Pchoice3_pet_r1 {
			Pint	num_prompts;	/* number of prompts	*/
			Ppr_switch	prompts[P_NBCHOICE-1];
			char	*strings[P_NBCHOICE];
		} pet_r1;
		struct Pchoice3_pet_r2 {
			Pint	num_prompts;	/* number of prompts	*/
			char	*prompts;	/* array of prompts	*/
		} pet_r2;
		struct Pchoice3_pet_r3 {
			Pint	num_strings;	/* number of choice strings	*/
			char	**strings;	/* array of choice strings	*/
		} pet_r3;
		struct Pchoice3_pet_r4 {
			Pint	num_strings;	/* number of choice strings	*/
			char	**strings;	/* array of choice strings	*/
		} pet_r4;
		struct Pchoice3_pet_r5 {
			Pint	struct_id;	/* structure identifier	*/
			Pint	struct_id;	/* number of pick identifiers	*/
			Pint	*pick_ids;	/* array of pick identifiers	*/
		} pet_r5;
	} pets;
} Pchoice_data3;

typedef enum {
	PPR_OFF, 
	PPR_ON
} Ppr_switch;

PHIGS STATE

(PHOP, WSOP, *, *).

EFFECT

This function initializes the CHOICE input device (input of a integer value, selection) number choice_dev for workstation ws_id.

The following devices are available:

The following echo types are available for devices 40 to 49:

Echo volume is defined in Device Coordinates (DC) if echo type is positive or as a percentage of RootWindow size if echo type is negative.

Choice data record contains additional information depending on the echo type,

For echo type 1, -1, 4 and -4 the following fields of Pchoice_data structure are to be initialized:

For echo type 2, -2, 5 and -5 the following fields of a Pchoice_data structure are to be initialized: For echo number 3 and -3 the following fields of a Pchoice_data structure are to be initialized: Example:

/* Sample program for choice initialization */

#include <phigs.h>

main()
{
	int i;
	Pint ws_id,choice_dev,init_choice,pet;
	Pin_status init_status;
	Plimit echo_area;
	Pchoice_data choice_data_rec;
	static char *strings[5] = 
			{"Choice1","Choice2","Choice3","Choice4","Choice5"};

/* Open PHIGS session */
	popen_phigs(PDEF_ERR_FILE,PDEF_MEM_SIZE);

/* Open workstation */
	ws_id = 1;
	popen_ws(ws_id,"/dev/tty",8887);

/* Initialize choice device number 41 with pet -4 */
	init_status = PIN_STATUS_NONE;
	init_choice = 0;
	echo_area.y_min = 0.5;
	echo_area.y_max = 1.0;
	echo_area.x_min = 0.0;
	echo_area.x_max = 0.1;
	choice_dev = 41;
	pet = -4;
	choice_data_rec.pets.pet_r1.num_prompts = 32; 
	for (i = 0;i < 3;i++) {
		choice_data_rec.pets.pet_r1.prompts[i] = PPR_ON; 
		choice_data_rec.pets.pet_r1.strings[i] = strings[i];
	}
	for (i = 3;i < 5;i++) {
		choice_data_rec.pets.pet_r1.prompts[i] = PPR_ACT;
		choice_data_rec.pets.pet_r1.strings[i] = strings[i];
	for (i = 5;i < 32;i++) {
		choice_data_rec.pets.pet_r1.prompts[i] = PPR_OFF;
	}
	choice_data_rec.pets.pet_r1.strings[32] = "@Echo4";
	pinit_choice(ws_id,choice_dev,init_status,init_choice,
			pet,&echo_area,&choice_data_rec);

/* Close workstation */
	pclose_ws(ws_id);

/* Close PHIGS */
	pclose_phigs();
}

ERRORS

3
Ignoring function, function requires state (PHOP, WSOP,*,*)
54
Ignoring function, the specified workstation is not open
61
Ignoring function, specified workstation is neither of category INPUT nor of category OUTIN
250
Ignoring function, the specified device is not available on the specified workstation
251
Ignoring function, the function requires the input device to be in REQUEST mode
254
Ignoring function, invalid echo area volume: XMIN>>=XMAX, YMIN>>=YMAX or ZMIN>>ZMAX
255
Ignoring function, one of the echo area volume boundary points is outside the range of the device
253
Ignoring function, the specified prompt echo type is not available on the specified workstation
260
Ignoring function, one of the fields within the input device data record is in error
261
Ignoring function, initial value is invalid

SEE ALSO

initialize choice, set choice mode, request choice 3, sample choice 3, get choice 3, inquire choice device state 3, inquire default choice device state 3, inquire number of available logical input devices


Previous Next Up Title Contents General Index Functions Index Bookshelf