1 /* Command line library */
5 #define CMDL_BUFFER_SIZE 256
6 //#define CMDL_OUTPUT_SIZE 256
7 #define CMDL_PROMPT_SIZE 8
8 #define CMDL_MAX_TAB_COMPLETE_RESULT 256
10 typedef int (*cmdl_putchar_t
)(int);
11 typedef int (*cmdl_printf_t
)( const char *format
, ... );
12 typedef int (*cmdl_getchar_t
)();
15 #define NULL ((void *)0)
55 cmdl_putchar_t putchar
;
56 cmdl_getchar_t getchar
;
66 void cmdl_setputchar(cmd_line
* cmd
, cmdl_putchar_t in
);
67 void cmdl_setgetchar(cmd_line
* cmd
, cmdl_getchar_t in
);
68 void cmdl_setprintf(cmd_line
* cmd
, cmdl_printf_t in
);
70 //void cmdl_builtin_help(cmd_line* cmd, char* command);
72 void cmdl_parsechar(cmd_line
* cmd
, char in
);
74 void cmdl_addreplace(cmd_line
* cmd
, char in
);
75 void cmdl_addinsert(cmd_line
* cmd
, char in
);
76 void cmdl_enterloop(cmd_line
* cmd
);
77 void cmdl_exec(cmd_line
* cmd
);
78 void cmdl_setexit(cmd_line
* cmd
, int exit
);
79 int cmdl_getexit(cmd_line
* cmd
);
80 void cmdl_clearoutput(cmd_line
* cmd
);
81 void cmdl_clearbuffer(cmd_line
* cmd
);
82 int cmdl_printf(cmd_line
* cmd
, const char *format
, ...);
83 char* cmdl_getoutput(cmd_line
* cmd
);
84 //void cmdl_addoutput_str(cmd_line* cmd, char output[CMDL_OUTPUT_SIZE]);
85 void cmdl_addstr(cmd_line
* cmd
, char* str
);
86 int cmdl_movecursor(cmd_line
* cmd
, int direction
);
87 char* cmdl_getbuffer(cmd_line
* cmd
);
88 void cmdl_addchar(cmd_line
* cmd
, char in
);
89 int cmdl_check(cmd_line
* cmd
);
90 void cmdl_del(cmd_line
* cmd
);
91 cmd_line
* cmdl_create();
92 void cmdl_free(cmd_line
* cmd
);
93 char *cmdl_getprompt(cmd_line
* cmd
);
94 void cmdl_setpropmt(cmd_line
* cmd
, char prompt
[CMDL_PROMPT_SIZE
]);
95 cmdl_param_list
* cmdl_getparams(const char* command
);
96 void cmdl_tabcomplete(cmd_line
*cmd
);