about summary refs log tree commit diff
path: root/src/engine/e_console.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/e_console.h')
-rw-r--r--src/engine/e_console.h45
1 files changed, 9 insertions, 36 deletions
diff --git a/src/engine/e_console.h b/src/engine/e_console.h
index 77057df3..10d77a3a 100644
--- a/src/engine/e_console.h
+++ b/src/engine/e_console.h
@@ -5,46 +5,15 @@
 extern "C"{
 #endif
 
-#define CONSOLE_MAX_STR_LENGTH 255
-/* the maximum number of tokens occurs in a string of length CONSOLE_MAX_STR_LENGTH with tokens size 1 separated by single spaces */
-#define MAX_TOKENS (CONSOLE_MAX_STR_LENGTH+1)/2
- 
-enum 
-{ 
-    TOKEN_INT, 
-    TOKEN_FLOAT, 
-    TOKEN_STRING 
-}; 
- 
-struct token 
-{ 
-    int type; 
-	const char *stored_string;
-}; 
- 
-struct lexer_result 
-{ 
-	char string_storage[CONSOLE_MAX_STR_LENGTH+1];
-	char *next_string;
-
-    struct token tokens[MAX_TOKENS]; 
-    unsigned int num_tokens; 
-}; 
-
-int extract_result_string(struct lexer_result *result, int index, const char **str);
-int extract_result_int(struct lexer_result *result, int index, int *i);
-int extract_result_float(struct lexer_result *result, int index, float *f);
-
-typedef void (*console_callback)(struct lexer_result *result, void *user_data);
-
-typedef struct COMMAND
+typedef void (*CONSOLE_CALLBACK)(void *result, void *user_data);
+
+typedef struct COMMAND_t
 {
 	const char *name;
 	const char *params;
-	console_callback callback;
+	CONSOLE_CALLBACK callback;
 	void *user_data;
-	struct COMMAND *next;
-	
+	struct COMMAND_t *next;
 } COMMAND;
 
 void console_init();
@@ -53,6 +22,10 @@ void console_execute(const char *str);
 void console_print(const char *str);
 void console_register_print_callback(void (*callback)(const char *));
 
+int console_result_string(void *result, int index, const char **str);
+int console_result_int(void *result, int index, int *i);
+int console_result_float(void *result, int index, float *f);
+
 #define MACRO_REGISTER_COMMAND(name, params, func, ptr) { static COMMAND cmd = { name, params, func, ptr, 0x0 }; console_register(&cmd); }
 
 #ifdef __cplusplus