diff options
author | Happy <markaizer@gmail.com> | 2014-08-21 04:50:46 +0800 |
---|---|---|
committer | Happy <markaizer@gmail.com> | 2014-08-21 04:50:46 +0800 |
commit | f52e1007fe08c67003c0bc4c78231904dd3fd5cc (patch) | |
tree | 99907d827264e501774e58ab4630e41fa7103c02 /src/common/console.h | |
parent | 2410110dece79b4598c12f1c953219f1d0d1904a (diff) | |
parent | 769b1d05aa5cfa8cddfe7d21b35d5c5e4da3bbd6 (diff) | |
download | hercules-f52e1007fe08c67003c0bc4c78231904dd3fd5cc.tar.gz hercules-f52e1007fe08c67003c0bc4c78231904dd3fd5cc.tar.bz2 hercules-f52e1007fe08c67003c0bc4c78231904dd3fd5cc.tar.xz hercules-f52e1007fe08c67003c0bc4c78231904dd3fd5cc.zip |
Merge pull request #1 from HerculesWS/master
Update from original
Diffstat (limited to 'src/common/console.h')
-rw-r--r-- | src/common/console.h | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/src/common/console.h b/src/common/console.h index ebce013f7..062d48bbe 100644 --- a/src/common/console.h +++ b/src/common/console.h @@ -1,13 +1,16 @@ // Copyright (c) Hercules Dev Team, licensed under GNU GPL. // See the LICENSE file -#ifndef _CONSOLE_H_ -#define _CONSOLE_H_ +#ifndef COMMON_CONSOLE_H +#define COMMON_CONSOLE_H -#include "../common/thread.h" +#include "../config/core.h" // MAX_CONSOLE_INPUT + +#include "../common/cbasetypes.h" #include "../common/mutex.h" #include "../common/spinlock.h" -#include "../config/core.h" +#include "../common/sql.h" +#include "../common/thread.h" /** * Queue Max @@ -15,9 +18,21 @@ **/ #define CONSOLE_PARSE_SIZE 10 +/** + * Default parsing function abstract prototype + **/ typedef void (*CParseFunc)(char *line); + +/** + * Console parsing function prototypes + * CPCMD: Console Parsing CoMmand + * x - command + * y - category + **/ #define CPCMD(x) void console_parse_ ##x (char *line) #define CPCMD_A(x) console_parse_ ##x +#define CPCMD_C(x,y) void console_parse_ ##y ##x (char *line) +#define CPCMD_C_A(x,y) console_parse_ ##y ##x #define CP_CMD_LENGTH 20 struct CParseEntry { @@ -34,26 +49,25 @@ struct { unsigned short count; } cinput; -struct console_interface { - void (*init) (void); - void (*final) (void); - void (*display_title) (void); #ifdef CONSOLE_INPUT +struct console_input_interface { /* vars */ SPIN_LOCK ptlock;/* parse thread lock */ - rAthread pthread;/* parse thread */ + rAthread *pthread;/* parse thread */ volatile int32 ptstate;/* parse thread state */ - ramutex ptmutex;/* parse thread mutex */ - racond ptcond;/* parse thread cond */ + ramutex *ptmutex;/* parse thread mutex */ + racond *ptcond;/* parse thread cond */ /* */ struct CParseEntry **cmd_list; struct CParseEntry **cmds; unsigned int cmd_count; unsigned int cmd_list_count; /* */ + Sql *SQL; + /* */ void (*parse_init) (void); void (*parse_final) (void); - int (*parse_timer) (int tid, unsigned int tick, int id, intptr_t data); + int (*parse_timer) (int tid, int64 tick, int id, intptr_t data); void *(*pthread_main) (void *x); void (*parse) (char* line); void (*parse_sub) (char* line); @@ -61,11 +75,22 @@ struct console_interface { void (*load_defaults) (void); void (*parse_list_subs) (struct CParseEntry *cmd, unsigned char depth); void (*addCommand) (char *name, CParseFunc func); + void (*setSQL) (Sql *SQL_handle); +}; +#else +struct console_input_interface; #endif + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); + + struct console_input_interface *input; }; struct console_interface *console; void console_defaults(void); -#endif /* _CONSOLE_H_ */ +#endif /* COMMON_CONSOLE_H */ |