home · contact · privacy
MAJOR re-write. Split plomrogue into a server and a client. Re-wrote large parts
[plomrogue] / src / client / command_db.h
1 /* src/client/command_db.h
2  *
3  * The Command DB collects identifiers and verbal descriptions of all commands
4  * the user can give.
5  */
6
7 #ifndef COMMAND_DB_H
8 #define COMMAND_DB_H
9
10 #include <stdint.h> /* uint8_t */
11
12
13
14 struct Command
15 {
16     char * dsc_short; /* short string name of command to be used internally */
17     char * dsc_long;  /* long string description of command for the user */
18     uint8_t id;       /* unique identifier of command */
19 };
20
21 struct CommandDB
22 {
23     struct Command * cmds; /* memory area for sequence of all Command structs */
24     uint8_t n;             /* number of Command structs in database */
25 };
26
27
28
29 /* Is "id" the ID of command whose dsc_short is "shortdsc"? Answer in binary. */
30 extern uint8_t is_command_id_shortdsc(uint8_t id, char * shortdsc);
31
32 /* Give short description of command ("dsc_short"), get its ID. */
33 extern uint8_t get_command_id(char * dsc_short);
34
35 /* Give short description of command ("dsc_short"), get long description. */
36 extern char * get_command_longdsc(char * dsc_short);
37
38 /* Reads CommandDB from CommandDB file, line by line, until first empty line. */
39 extern void init_command_db();
40
41 /* Free all memory allocated with init_command_db. */
42 extern void free_command_db();
43
44
45
46 #endif