1 |
/* input.h - The interface to an input driver. |
/* input.h - Interface to the input component of a virtual console. |
2 |
Copyright (C) 2002 Free Software Foundation, Inc. |
Copyright (C) 2002 Free Software Foundation, Inc. |
3 |
Written by Marcus Brinkmann. |
Written by Marcus Brinkmann. |
4 |
|
|
18 |
along with this program; if not, write to the Free Software |
along with this program; if not, write to the Free Software |
19 |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ |
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ |
20 |
|
|
21 |
#ifndef _INPUT_H_ |
#ifndef INPUT_H |
22 |
#define _INPUT_H_ 1 |
#define INPUT_H |
23 |
|
|
24 |
#include <errno.h> |
#include <errno.h> |
|
#include <argp.h> |
|
25 |
|
|
26 |
#include "focus.h" |
struct input; |
27 |
|
typedef struct input *input_t; |
28 |
|
|
29 |
|
/* Create a new virtual console input queue, with the system encoding |
30 |
struct input_ops |
being ENCODING. */ |
31 |
{ |
error_t input_create (input_t *r_input, const char *encoding); |
32 |
const char *name; |
|
33 |
|
/* Destroy the input queue INPUT. */ |
34 |
/* Fill in ARGP with the argp_child structure for this display. */ |
void input_destroy (input_t input); |
35 |
error_t (*argp) (struct argp_child *argp); |
|
36 |
|
/* Enter DATALEN characters from the buffer DATA into the input queue |
37 |
/* Initialize the subsystem. */ |
INPUT. The DATA must be supplied in UTF-8 encoding (XXX UCS-4 |
38 |
error_t (*init) (void); |
would be nice, too, but it requires knowledge of endianess). The |
39 |
|
function returns the amount of bytes written (might be smaller than |
40 |
/* Assign the input device to the focus group FOCUS. */ |
DATALEN) or -1 and the error number in errno. If NONBLOCK is not |
41 |
error_t (*set_focus) (focus_t *focus); |
zero, return with -1 and set errno to EWOULDBLOCK if operation |
42 |
|
would block for a long time. */ |
43 |
/* Output LENGTH bytes starting from BUFFER in the system encoding. |
ssize_t input_enqueue (input_t input, int nonblock, char *data, |
44 |
Set BUFFER and LENGTH to the new values. The exact semantics are |
size_t datalen); |
45 |
just as in the iconv interface. */ |
|
46 |
error_t (*input) (char **buffer, size_t *length); |
/* Remove DATALEN characters from the input queue and put them in the |
47 |
}; |
buffer DATA. The data will be supplied in the local encoding. The |
48 |
typedef struct input_ops *input_ops_t; |
function returns the amount of bytes removed (might be smaller than |
49 |
|
DATALEN) or -1 and the error number in errno. If NONBLOCK is not |
50 |
extern struct input_ops pckbd_input_ops; |
zero, return with -1 and set errno to EWOULDBLOCK if operation |
51 |
extern struct input_ops mach_input_ops; |
would block for a long time. */ |
52 |
|
ssize_t input_dequeue (input_t input, int nonblock, char *data, |
53 |
input_ops_t input_driver[] = |
size_t datalen); |
|
{ |
|
|
#if defined (__i386__) |
|
|
&pckbd_input_ops, |
|
|
#endif |
|
|
&mach_input_ops, |
|
|
0 |
|
|
}; |
|
54 |
|
|
55 |
#endif |
/* Flush the input buffer, discarding all pending data. */ |
56 |
|
void input_flush (input_t input); |
57 |
|
|
58 |
|
#endif /* INPUT_H */ |