* \author Giovanni Bajo <rasky@develer.com>
*/
-/*#*
- *#* $Log$
- *#* Revision 1.2 2006/07/19 12:56:28 bernie
- *#* Convert to new Doxygen style.
- *#*
- *#* Revision 1.1 2006/06/01 12:27:39 marco
- *#* Added utilities for protocols
- *#*
- *#*/
#ifndef MWARE_READLINE_H
#define MWARE_READLINE_H
typedef int (*getc_hook)(void* user_data);
typedef void (*putc_hook)(char ch, void* user_data);
typedef const char* (*match_hook)(void* user_data, const char* word, int word_len);
+typedef void (*clear_hook)(void* user_data);
struct RLContext
{
match_hook match;
void* match_param;
+ clear_hook clear;
+ void* clear_param;
+
const char* prompt;
char real_history[HISTORY_SIZE];
char* history;
size_t history_pos;
+ size_t line_pos;
};
INLINE void rl_init_ctx(struct RLContext *ctx)
INLINE void rl_sethook_match(struct RLContext* ctx, match_hook match, void* match_param)
{ ctx->match = match; ctx->match_param = match_param; }
+INLINE void rl_sethook_clear(struct RLContext* ctx, clear_hook clear, void* clear_param)
+{ ctx->clear = clear; ctx->clear_param = clear_param; }
+
INLINE void rl_setprompt(struct RLContext* ctx, const char* prompt)
{ ctx->prompt = prompt; }