2008-01-16 22:14:06 +00:00
|
|
|
#ifndef _CONSOLE_H
|
|
|
|
#define _CONSOLE_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"{
|
|
|
|
#endif
|
|
|
|
|
2008-02-02 12:38:36 +00:00
|
|
|
typedef void (*CONSOLE_CALLBACK)(void *result, void *user_data);
|
|
|
|
|
|
|
|
typedef struct COMMAND_t
|
2008-01-16 22:14:06 +00:00
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
const char *params;
|
2008-02-02 12:38:36 +00:00
|
|
|
CONSOLE_CALLBACK callback;
|
2008-01-16 22:14:06 +00:00
|
|
|
void *user_data;
|
2008-02-02 12:38:36 +00:00
|
|
|
struct COMMAND_t *next;
|
2008-01-16 22:14:06 +00:00
|
|
|
} COMMAND;
|
|
|
|
|
|
|
|
void console_init();
|
|
|
|
void console_register(COMMAND *cmd);
|
2008-03-01 14:36:36 +00:00
|
|
|
void console_execute_line(const char *str);
|
2008-03-01 20:03:04 +00:00
|
|
|
void console_execute_line_stroked(int stroke, const char *str);
|
2008-03-01 14:36:36 +00:00
|
|
|
void console_execute_file(const char *filename);
|
2008-01-16 22:14:06 +00:00
|
|
|
void console_print(const char *str);
|
|
|
|
void console_register_print_callback(void (*callback)(const char *));
|
|
|
|
|
2008-03-14 23:39:52 +00:00
|
|
|
/*int console_result_string(void *result, int index, const char **str);
|
2008-02-02 12:38:36 +00:00
|
|
|
int console_result_int(void *result, int index, int *i);
|
2008-03-14 23:39:52 +00:00
|
|
|
int console_result_float(void *result, int index, float *f);*/
|
|
|
|
|
|
|
|
const char *console_arg_string(void *result, int index);
|
|
|
|
int console_arg_int(void *result, int index);
|
|
|
|
float console_arg_float(void *result, int index);
|
|
|
|
int console_arg_num(void *result);
|
2008-02-02 12:38:36 +00:00
|
|
|
|
2008-01-16 22:14:06 +00:00
|
|
|
#define MACRO_REGISTER_COMMAND(name, params, func, ptr) { static COMMAND cmd = { name, params, func, ptr, 0x0 }; console_register(&cmd); }
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|