Chapter 5 - Input 85 0 typedef struct { Ccoor *xypt; /*LOCATOR*/ Ccoorlist *points; /* STROKE devices*/ Cfloat val; /* VALUATOR device*/ · Cint choice; /* CHOICE devices*/ Cchar *string; /* STRING device*/ Cpick *pick; /* PICK devices (unsupported) */ Cinrep; For example, in a LOCATOR device initialization, the .xyptfield of Cinrep must be set to the address of a Ccoor allocated by the application program before the x and y elements can be set See the example program in Figure 5-2. Notice that whenever a device is initialized, no associations with triggers are made. This must be done by having the application program call the appropriate functions.
An error is generated by initialize lid if the device does not" exist, if it is already initialized, or if the initial value is out of range. Errors ENOTVSAC [4] CGI not in proper state: CGI shall be in state VSAC. EINDNOEX [80] Input device does not exist EINDALIN [82] Input device already initialized. 15 EBADDATA [95] Contents of input data record are invalid. 0 ES TRS I ZE [96] Length of initial string is greater than the implementation defined maximum.
Release Input Device Cerror release_input_device(devclass, devnwn) Cdevoff devclass; /* device type*/ Cint devnwn; /* device number */ release_input_device releases all associations between a device and its triggers, and removes all pending events for the device from the event queue. release_input_device changes the state of the specified input device from NO_ EVENTS to RELEASED. An error is produced if devclass and devnum does not refer to an existing and initialized device. Errors ENOTVSAC [4] CGI not in proper state: CGI shall be in state VSAC. EINDNOEX [80] Input device does not exist Input device not initialized.
EINDINIT [81] Associate Cerror associate(trigger, devclass, devnwn) Cint trigger; /* trigger number*/ Cdevoff devclass; /* device type*/ Cint devnwn; /* device number*/ 15 1be ANSI lltaDdard allO'WI initialized input devices to be re-initialized. SunCGI does not because it is felt that re-initializ.atioa is usually a miltak.e. 0 Version C of 17 March 1986