123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- #ifndef MICRORL_H_
- #define MICRORL_H_
- #include "config.h"
- #define true 1
- #define false 0
-
- #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
- #define IS_CONTROL_CHAR(x) ((x)<=31)
- #define _HIST_UP 0
- #define _HIST_DOWN 1
- #define _ESC_BRACKET 1
- #define _ESC_HOME 2
- #define _ESC_END 3
- #ifdef _USE_HISTORY
- typedef struct {
- char ring_buf [_RING_HISTORY_LEN];
- int begin;
- int end;
- int cur;
- } ring_history_t;
- #endif
- typedef struct {
- #ifdef _USE_ESC_SEQ
- char escape_seq;
- char escape;
- #endif
- #if (defined(_ENDL_CRLF) || defined(_ENDL_LFCR))
- char tmpch;
- #endif
- #ifdef _USE_HISTORY
- ring_history_t ring_hist;
- #endif
- char * prompt_str;
- char cmdline [_COMMAND_LINE_LEN];
- int cmdlen;
- int cursor;
- int (*execute) (int argc, const char * const * argv );
- char ** (*get_completion) (int argc, const char * const * argv );
- void (*print) (const char *);
- #ifdef _USE_CTLR_C
- void (*sigint) (void);
- #endif
- } microrl_t;
- void microrl_init (microrl_t * pThis, void (*print)(const char*));
- void microrl_set_echo (int);
- void microrl_set_complete_callback (microrl_t * pThis, char ** (*get_completion)(int, const char* const*));
- void microrl_set_execute_callback (microrl_t * pThis, int (*execute)(int, const char* const*));
- #ifdef _USE_CTLR_C
- void microrl_set_sigint_callback (microrl_t * pThis, void (*sigintf)(void));
- #endif
- void microrl_insert_char (microrl_t * pThis, int ch);
- #endif
|