123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- #ifndef _tinyrl_tinyrl_h
- #define _tinyrl_tinyrl_h
- #include <stdio.h>
- #include <faux/faux.h>
- #include "tinyrl/vt100.h"
- C_DECL_BEGIN
- typedef struct tinyrl_s tinyrl_t;
- typedef enum {
-
- TINYRL_NO_MATCH = 0,
-
- TINYRL_MATCH,
-
- TINYRL_AMBIGUOUS,
-
- TINYRL_COMPLETED_MATCH,
-
- TINYRL_COMPLETED_AMBIGUOUS,
-
- TINYRL_MATCH_WITH_EXTENSIONS
- } tinyrl_match_e;
- typedef char *tinyrl_compentry_func_t(tinyrl_t * instance,
- const char *text, unsigned offset, unsigned state);
- typedef int tinyrl_hook_func_t(tinyrl_t * instance);
- typedef char **tinyrl_completion_func_t(tinyrl_t * instance,
- const char *text, unsigned start, unsigned end);
- typedef int tinyrl_timeout_fn_t(tinyrl_t *instance);
- typedef bool_t tinyrl_key_func_t(tinyrl_t *instance, unsigned char key);
- tinyrl_t *tinyrl_new(FILE *istream, FILE *ostream,
- const char *hist_fname, size_t hist_stifle);
- void tinyrl_free(tinyrl_t *tinyrl);
- bool_t tinyrl_bind_key(tinyrl_t *tinyrl, int key, tinyrl_key_func_t *fn);
- void tinyrl_set_hotkey_fn(tinyrl_t *tinyrl, tinyrl_key_func_t *fn);
- void tinyrl_set_istream(tinyrl_t *tinyrl, FILE *istream);
- FILE *tinyrl_istream(const tinyrl_t *tinyrl);
- void tinyrl_set_ostream(tinyrl_t *tinyrl, FILE *ostream);
- FILE *tinyrl_ostream(const tinyrl_t *tinyrl);
- void tinyrl_set_utf8(tinyrl_t *tinyrl, bool_t utf8);
- bool_t tinyrl_utf8(const tinyrl_t *tinyrl);
- bool_t tinyrl_busy(const tinyrl_t *tinyrl);
- void tinyrl_set_busy(tinyrl_t *tinyrl, bool_t busy);
- void tinyrl_set_prompt(tinyrl_t *tinyrl, const char *prompt);
- const char *tinyrl_prompt(const tinyrl_t *tinyrl);
- const char *tinyrl_line(const tinyrl_t *tinyrl);
- bool_t tinyrl_hist_save(const tinyrl_t *tinyrl);
- bool_t tinyrl_hist_restore(tinyrl_t *tinyrl);
- void tinyrl_line_to_hist(tinyrl_t *tinyrl);
- void tinyrl_reset_hist_pos(tinyrl_t *tinyrl);
- void *tinyrl_udata(const tinyrl_t *tinyrl);
- void tinyrl_set_udata(tinyrl_t *tinyrl, void *udata);
- void tty_raw_mode(tinyrl_t *tinyrl);
- void tty_restore_mode(tinyrl_t *tinyrl);
- int tinyrl_read(tinyrl_t *tinyrl);
- void tinyrl_redisplay(tinyrl_t *tinyrl);
- void tinyrl_save_last(tinyrl_t *tinyrl);
- void tinyrl_reset_line_state(tinyrl_t *tinyrl);
- void tinyrl_reset_line(tinyrl_t *tinyrl);
- void tinyrl_crlf(const tinyrl_t *tinyrl);
- void tinyrl_multi_crlf(const tinyrl_t *tinyrl);
- void tinyrl_winsize(const tinyrl_t *tinyrl, size_t *width, size_t *height);
- size_t tinyrl_width(const tinyrl_t *tinyrl);
- size_t tinyrl_height(const tinyrl_t *tinyrl);
- int tinyrl_printf(const tinyrl_t *tinyrl, const char *fmt, ...);
- size_t tinyrl_equal_part(const tinyrl_t *tinyrl,
- const char *s1, const char *s2);
- bool_t tinyrl_line_insert(tinyrl_t *tinyrl, const char *text, size_t len);
- bool_t tinyrl_line_delete(tinyrl_t *tinyrl, size_t start, size_t len);
- bool_t tinyrl_line_replace(tinyrl_t *tinyrl, const char *text);
- extern void tinyrl_done(tinyrl_t * instance);
- extern void tinyrl_completion_over(tinyrl_t * instance);
- extern void tinyrl_completion_error_over(tinyrl_t * instance);
- extern bool_t tinyrl_is_completion_error_over(const tinyrl_t * instance);
- extern void tinyrl_delete_matches(char **instance);
- extern char **tinyrl_completion(tinyrl_t *instance,
- const char *line, unsigned start, unsigned end,
- tinyrl_compentry_func_t *generator);
- extern void tinyrl_ding(const tinyrl_t * instance);
- extern void
- tinyrl_replace_line(tinyrl_t * instance, const char *text, int clear_undo);
- extern tinyrl_match_e tinyrl_complete(tinyrl_t * instance);
- extern tinyrl_match_e tinyrl_complete_with_extensions(tinyrl_t * instance);
- extern void tinyrl_disable_echo(
-
- tinyrl_t * instance,
-
- char echo_char);
- extern void tinyrl_enable_echo(
-
- tinyrl_t * instance);
- extern bool_t tinyrl_is_quoting(
-
- const tinyrl_t * instance);
- extern bool_t
- tinyrl_is_empty(
-
- const tinyrl_t *instance
- );
- extern void tinyrl_limit_line_length(
-
- tinyrl_t * instance,
-
- unsigned length);
- C_DECL_END
- #endif
|