diff options
author | shennetsind <ind@henn.et> | 2013-03-17 01:12:33 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-03-17 01:12:33 -0300 |
commit | 3b89a135dcde9779bd0537cd136a7c34cfadbe3f (patch) | |
tree | e963c1cf1f5e0168e7cd0b415d2e5963b229cb3d /src/common/console.h | |
parent | 5b1fee9ef54dbfc27fef5f6125a678fa88eba1be (diff) | |
download | hercules-3b89a135dcde9779bd0537cd136a7c34cfadbe3f.tar.gz hercules-3b89a135dcde9779bd0537cd136a7c34cfadbe3f.tar.bz2 hercules-3b89a135dcde9779bd0537cd136a7c34cfadbe3f.tar.xz hercules-3b89a135dcde9779bd0537cd136a7c34cfadbe3f.zip |
Re-Introducing Console Input
It's back. It's efficient. It's awesome.
http://hercules.ws/board/topic/272-re-introducing-console-input/
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/common/console.h')
-rw-r--r-- | src/common/console.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/common/console.h b/src/common/console.h new file mode 100644 index 000000000..d0b9e8bb1 --- /dev/null +++ b/src/common/console.h @@ -0,0 +1,48 @@ +// Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// See the LICENSE file + +#ifndef _CONSOLE_H_ +#define _CONSOLE_H_ + +#include "../common/atomic.h" +#include "../common/thread.h" +#include "../common/mutex.h" +#include "../common/spinlock.h" +#include "../config/core.h" + +/** + * Queue Max + * why is there a limit, why not make it dynamic? - I'm playing it safe, I'd rather not play with memory management between threads + **/ +#define CONSOLE_PARSE_SIZE 10 +struct { + char queue[CONSOLE_PARSE_SIZE][MAX_CONSOLE_INPUT]; + unsigned short count; +} cinput; + +struct console_interface { + void (*init) (void); + void (*final) (void); + void (*display_title) (void); +#ifdef CONSOLE_INPUT + /* vars */ + SPIN_LOCK ptlock;/* parse thread lock */ + rAthread pthread;/* parse thread */ + volatile int32 ptstate;/* parse thread state */ + ramutex ptmutex;/* parse thread mutex */ + racond ptcond;/* parse thread cond */ + /* */ + void (*parse_init) (void); + void (*parse_final) (void); + int (*parse_timer) (int tid, unsigned int tick, int id, intptr_t data); + void *(*pthread_main) (void *x); + void (*parse) (char* line); + int (*key_pressed) (void); +#endif +} console_s; + +struct console_interface *console; + +void console_defaults(void); + +#endif /* _CONSOLE_H_ */ |