00001
00002
00003
00004
00005
00019 #ifndef _tinyrl_vt100_h
00020 #define _tinyrl_vt100_h
00021
00022 #include <stdio.h>
00023 #include <stdarg.h>
00024
00025 #include "lub/c_decl.h"
00026 #include "lub/types.h"
00027
00028 _BEGIN_C_DECL
00029
00030 typedef struct _tinyrl_vt100 tinyrl_vt100_t;
00031
00032
00033 #define KEY_NUL 0
00034 #define KEY_SOH 1
00035 #define KEY_STX 2
00036 #define KEY_ETX 3
00037 #define KEY_EOT 4
00038 #define KEY_ENQ 5
00039 #define KEY_ACK 6
00040 #define KEY_BEL 7
00041 #define KEY_BS 8
00042 #define KEY_HT 9
00043 #define KEY_LF 10
00044 #define KEY_VT 11
00045 #define KEY_FF 12
00046 #define KEY_CR 13
00047 #define KEY_SO 14
00048 #define KEY_SI 15
00049 #define KEY_DLE 16
00050 #define KEY_DC1 17
00051 #define KEY_DC2 18
00052 #define KEY_DC3 19
00053 #define KEY_DC4 20
00054 #define KEY_NAK 21
00055 #define KEY_SYN 22
00056 #define KEY_ETB 23
00057 #define KEY_CAN 24
00058 #define KEY_EM 25
00059 #define KEY_SUB 26
00060 #define KEY_ESC 27
00061 #define KEY_FS 28
00062 #define KEY_GS 29
00063 #define KEY_RS 30
00064 #define KEY_US 31
00066 #define KEY_DEL 127
00071 typedef enum
00072 {
00073 tinyrl_vt100_UNKNOWN,
00074 tinyrl_vt100_CURSOR_UP,
00075 tinyrl_vt100_CURSOR_DOWN,
00076 tinyrl_vt100_CURSOR_LEFT,
00077 tinyrl_vt100_CURSOR_RIGHT
00078 } tinyrl_vt100_escape_t;
00079
00080 extern tinyrl_vt100_t *
00081 tinyrl_vt100_new(
00082 FILE *instream,
00083 FILE *outstream
00084 );
00085 extern void
00086 tinyrl_vt100_delete(tinyrl_vt100_t *instance);
00087
00088
00089 extern int
00090 tinyrl_vt100_printf(
00091 const tinyrl_vt100_t *instance,
00092 const char *fmt,
00093 ...
00094 );
00095 extern int
00096 tinyrl_vt100_vprintf(
00097 const tinyrl_vt100_t *instance,
00098 const char *fmt,
00099 va_list args
00100 );
00101
00102 extern int
00103 tinyrl_vt100_oflush(
00104 const tinyrl_vt100_t *instance
00105 );
00106 extern int
00107 tinyrl_vt100_ierror(
00108 const tinyrl_vt100_t *instance
00109 );
00110 extern int
00111 tinyrl_vt100_oerror(
00112 const tinyrl_vt100_t *instance
00113 );
00114 extern int
00115 tinyrl_vt100_ieof(
00116 const tinyrl_vt100_t *instance
00117 );
00118 extern int
00119 tinyrl_vt100_getchar(
00120 const tinyrl_vt100_t *instance
00121 );
00122 extern unsigned
00123 tinyrl_vt100__get_width(
00124 const tinyrl_vt100_t *instance
00125 );
00126 extern unsigned
00127 tinyrl_vt100__get_height(
00128 const tinyrl_vt100_t *instance
00129 );
00130 extern void
00131 tinyrl_vt100__set_istream(
00132 tinyrl_vt100_t *instance,
00133 FILE *istream
00134 );
00135 extern FILE *
00136 tinyrl_vt100__get_istream(
00137 const tinyrl_vt100_t *instance
00138 );
00139 extern FILE *
00140 tinyrl_vt100__get_ostream(
00141 const tinyrl_vt100_t *instance
00142 );
00143
00144 extern tinyrl_vt100_escape_t
00145 tinyrl_vt100_escape_decode(
00146 const tinyrl_vt100_t *instance
00147 );
00148 extern void
00149 tinyrl_vt100_ding(
00150 const tinyrl_vt100_t *instance
00151 );
00152 extern void
00153 tinyrl_vt100_attribute_reset(
00154 const tinyrl_vt100_t *instance
00155 );
00156 extern void
00157 tinyrl_vt100_attribute_bright(
00158 const tinyrl_vt100_t *instance
00159 );
00160 extern void
00161 tinyrl_vt100_attribute_dim(
00162 const tinyrl_vt100_t *instance
00163 );
00164 extern void
00165 tinyrl_vt100_attribute_underscore(
00166 const tinyrl_vt100_t *instance
00167 );
00168 extern void
00169 tinyrl_vt100_attribute_blink(
00170 const tinyrl_vt100_t *instance
00171 );
00172 extern void
00173 tinyrl_vt100_attribute_reverse(
00174 const tinyrl_vt100_t *instance
00175 );
00176 extern void
00177 tinyrl_vt100_attribute_hidden(
00178 const tinyrl_vt100_t *instance
00179 );
00180 extern void
00181 tinyrl_vt100_erase_line(
00182 const tinyrl_vt100_t *instance
00183 );
00184 extern void
00185 tinyrl_vt100_clear_screen(
00186 const tinyrl_vt100_t *instance
00187 );
00188 extern void
00189 tinyrl_vt100_cursor_back(
00190 const tinyrl_vt100_t *instance,
00191 unsigned count
00192 );
00193 extern void
00194 tinyrl_vt100_cursor_forward(
00195 const tinyrl_vt100_t *instance,
00196 unsigned count
00197 );
00198 extern void
00199 tinyrl_vt100_cursor_up(
00200 const tinyrl_vt100_t *instance,
00201 unsigned count
00202 );
00203 extern void
00204 tinyrl_vt100_cursor_down(
00205 const tinyrl_vt100_t *instance,
00206 unsigned count
00207 );
00208 extern void
00209 tinyrl_vt100_cursor_home(
00210 const tinyrl_vt100_t *instance
00211 );
00212 extern void
00213 tinyrl_vt100_cursor_save(
00214 const tinyrl_vt100_t *instance
00215 );
00216 extern void
00217 tinyrl_vt100_cursor_restore(
00218 const tinyrl_vt100_t *instance
00219 );
00220 extern void
00221 tinyrl_vt100_erase(
00222 const tinyrl_vt100_t *instance,
00223 unsigned count
00224 );
00225 _END_C_DECL
00226
00227 #endif
00228