2005-09-20 13:26:39 +00:00
|
|
|
/** \file input_common.h
|
2012-11-18 10:23:22 +00:00
|
|
|
|
2005-09-20 13:26:39 +00:00
|
|
|
Header file for the low level input library
|
|
|
|
|
|
|
|
*/
|
2005-10-04 15:11:39 +00:00
|
|
|
#ifndef INPUT_COMMON_H
|
|
|
|
#define INPUT_COMMON_H
|
|
|
|
|
|
|
|
#include <wchar.h>
|
2005-09-20 13:26:39 +00:00
|
|
|
|
2006-01-23 20:40:14 +00:00
|
|
|
/**
|
2005-10-20 11:27:54 +00:00
|
|
|
Use unencoded private-use keycodes for internal characters
|
|
|
|
*/
|
|
|
|
#define INPUT_COMMON_RESERVED 0xe000
|
2005-09-20 13:26:39 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
2012-11-19 00:30:30 +00:00
|
|
|
/**
|
|
|
|
R_NULL is sometimes returned by the input when a character was
|
|
|
|
requested but none could be delivered, or when an exception
|
|
|
|
happened.
|
|
|
|
*/
|
|
|
|
R_NULL = INPUT_COMMON_RESERVED,
|
|
|
|
R_EOF
|
2005-09-20 13:26:39 +00:00
|
|
|
}
|
2012-11-19 00:30:30 +00:00
|
|
|
;
|
2005-09-20 13:26:39 +00:00
|
|
|
|
2006-01-23 20:40:14 +00:00
|
|
|
/**
|
|
|
|
Init the library
|
|
|
|
*/
|
2012-11-19 00:30:30 +00:00
|
|
|
void input_common_init(int (*ih)());
|
2005-09-20 13:26:39 +00:00
|
|
|
|
2012-03-25 10:00:38 +00:00
|
|
|
/* Sets a callback to be invoked every time a byte is read */
|
|
|
|
void input_common_set_poll_callback(void (*handler)(void));
|
|
|
|
|
2006-01-23 20:40:14 +00:00
|
|
|
/**
|
|
|
|
Free memory used by the library
|
|
|
|
*/
|
2005-09-20 13:26:39 +00:00
|
|
|
void input_common_destroy();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function used by input_readch to read bytes from stdin until enough
|
|
|
|
bytes have been read to convert them to a wchar_t. Conversion is
|
|
|
|
done using mbrtowc. If a character has previously been read and
|
|
|
|
then 'unread' using \c input_common_unreadch, that character is
|
|
|
|
returned. If timed is true, readch2 will wait at most
|
|
|
|
WAIT_ON_ESCAPE milliseconds for a character to be available for
|
|
|
|
reading before returning with the value WEOF.
|
|
|
|
*/
|
2012-11-19 00:30:30 +00:00
|
|
|
wchar_t input_common_readch(int timed);
|
2005-09-20 13:26:39 +00:00
|
|
|
|
2006-01-23 20:40:14 +00:00
|
|
|
/**
|
|
|
|
Push a character or a readline function onto the stack of unread
|
|
|
|
characters that input_readch will return before actually reading from fd
|
|
|
|
0.
|
|
|
|
*/
|
2012-11-19 00:30:30 +00:00
|
|
|
void input_common_unreadch(wint_t ch);
|
2005-09-20 13:26:39 +00:00
|
|
|
|
|
|
|
#endif
|