123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
-
- #ifndef _tinyrl_vt100_h
- #define _tinyrl_vt100_h
- #include <stdio.h>
- #include <stdarg.h>
- #include "lub/c_decl.h"
- #include "lub/types.h"
- _BEGIN_C_DECL
- typedef struct _tinyrl_vt100 tinyrl_vt100_t;
- #define KEY_NUL 0
- #define KEY_SOH 1
- #define KEY_STX 2
- #define KEY_ETX 3
- #define KEY_EOT 4
- #define KEY_ENQ 5
- #define KEY_ACK 6
- #define KEY_BEL 7
- #define KEY_BS 8
- #define KEY_HT 9
- #define KEY_LF 10
- #define KEY_VT 11
- #define KEY_FF 12
- #define KEY_CR 13
- #define KEY_SO 14
- #define KEY_SI 15
- #define KEY_DLE 16
- #define KEY_DC1 17
- #define KEY_DC2 18
- #define KEY_DC3 19
- #define KEY_DC4 20
- #define KEY_NAK 21
- #define KEY_SYN 22
- #define KEY_ETB 23
- #define KEY_CAN 24
- #define KEY_EM 25
- #define KEY_SUB 26
- #define KEY_ESC 27
- #define KEY_FS 28
- #define KEY_GS 29
- #define KEY_RS 30
- #define KEY_US 31
- #define KEY_DEL 127
- typedef enum
- {
- tinyrl_vt100_UNKNOWN,
- tinyrl_vt100_CURSOR_UP,
- tinyrl_vt100_CURSOR_DOWN,
- tinyrl_vt100_CURSOR_LEFT,
- tinyrl_vt100_CURSOR_RIGHT
- } tinyrl_vt100_escape_t;
- extern tinyrl_vt100_t *
- tinyrl_vt100_new(
- FILE *instream,
- FILE *outstream
- );
- extern void
- tinyrl_vt100_delete(tinyrl_vt100_t *instance);
- extern int
- tinyrl_vt100_printf(
- const tinyrl_vt100_t *instance,
- const char *fmt,
- ...
- );
- extern int
- tinyrl_vt100_vprintf(
- const tinyrl_vt100_t *instance,
- const char *fmt,
- va_list args
- );
- extern int
- tinyrl_vt100_oflush(
- const tinyrl_vt100_t *instance
- );
- extern int
- tinyrl_vt100_ierror(
- const tinyrl_vt100_t *instance
- );
- extern int
- tinyrl_vt100_oerror(
- const tinyrl_vt100_t *instance
- );
- extern int
- tinyrl_vt100_ieof(
- const tinyrl_vt100_t *instance
- );
- extern int
- tinyrl_vt100_getchar(
- const tinyrl_vt100_t *instance
- );
- extern unsigned
- tinyrl_vt100__get_width(
- const tinyrl_vt100_t *instance
- );
- extern unsigned
- tinyrl_vt100__get_height(
- const tinyrl_vt100_t *instance
- );
- extern void
- tinyrl_vt100__set_istream(
- tinyrl_vt100_t *instance,
- FILE *istream
- );
- extern FILE *
- tinyrl_vt100__get_istream(
- const tinyrl_vt100_t *instance
- );
- extern FILE *
- tinyrl_vt100__get_ostream(
- const tinyrl_vt100_t *instance
- );
- extern tinyrl_vt100_escape_t
- tinyrl_vt100_escape_decode(
- const tinyrl_vt100_t *instance
- );
- extern void
- tinyrl_vt100_ding(
- const tinyrl_vt100_t *instance
- );
- extern void
- tinyrl_vt100_attribute_reset(
- const tinyrl_vt100_t *instance
- );
- extern void
- tinyrl_vt100_attribute_bright(
- const tinyrl_vt100_t *instance
- );
- extern void
- tinyrl_vt100_attribute_dim(
- const tinyrl_vt100_t *instance
- );
- extern void
- tinyrl_vt100_attribute_underscore(
- const tinyrl_vt100_t *instance
- );
- extern void
- tinyrl_vt100_attribute_blink(
- const tinyrl_vt100_t *instance
- );
- extern void
- tinyrl_vt100_attribute_reverse(
- const tinyrl_vt100_t *instance
- );
- extern void
- tinyrl_vt100_attribute_hidden(
- const tinyrl_vt100_t *instance
- );
- extern void
- tinyrl_vt100_erase_line(
- const tinyrl_vt100_t *instance
- );
- extern void
- tinyrl_vt100_clear_screen(
- const tinyrl_vt100_t *instance
- );
- extern void
- tinyrl_vt100_cursor_back(
- const tinyrl_vt100_t *instance,
- unsigned count
- );
- extern void
- tinyrl_vt100_cursor_forward(
- const tinyrl_vt100_t *instance,
- unsigned count
- );
- extern void
- tinyrl_vt100_cursor_up(
- const tinyrl_vt100_t *instance,
- unsigned count
- );
- extern void
- tinyrl_vt100_cursor_down(
- const tinyrl_vt100_t *instance,
- unsigned count
- );
- extern void
- tinyrl_vt100_cursor_home(
- const tinyrl_vt100_t *instance
- );
- extern void
- tinyrl_vt100_cursor_save(
- const tinyrl_vt100_t *instance
- );
- extern void
- tinyrl_vt100_cursor_restore(
- const tinyrl_vt100_t *instance
- );
- extern void
- tinyrl_vt100_erase(
- const tinyrl_vt100_t *instance,
- unsigned count
- );
- _END_C_DECL
- #endif
|