Crossfire Client, Branches  R11627
p_cmd.h
Go to the documentation of this file.
1 /*
2  Crossfire client, a client program for the crossfire program.
3 
4  Copyright (C) 2005 Mark Wedel & Crossfire Development Team
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 
20  The author can be reached via e-mail to crossfire-devel@real-time.com
21 */
22 
23 
24 /*
25  * Includes and prototypes for p_cmd.c.
26  *
27  * p_cmd.c has player-commands like '/magicmap'.
28  */
29 
30 
31 /* Basically stolen piecemeal from the server branch. */
32 
33 #ifndef PCMD_H
34 #define PCMD_H
35 
36 /*
37  * List of commands.
38  */
39 
40 typedef void (*CommFunc)(const char *params);
41 
42 /* Cargo-cult from the above. Every entry in the table
43  * complains about a type mismatch, too. :(
44  */
45 typedef const char * (*CommHelpFunc)(void);
46 
47 /* This is used for displaying lists of commands. */
48 typedef enum {
49  COMM_CAT_MISC = 0, /* Commands which can't be better sorted. */
51  COMM_CAT_INFO = 2, /* A tad general. */
52  COMM_CAT_SETUP = 3, /* showicon, showweight, bind, commandkey... */
53  COMM_CAT_SCRIPT = 4, /* The four commands for the nifty-scripts. */
54  COMM_CAT_DEBUG = 5, /* Debugging commands - hide these? */
55 } CommCat;
56 
57 /* Retrieves a Title Cased name for the above categories. */
58 const char * get_category_name(CommCat cat);
59 
60 
61 typedef struct { /* global list's structure */
62  const char * name; /* Name of command - parsed against this. */
63  CommCat cat; /* What category the command is in. Used for sorting on display. */
64  CommFunc dofunc; /* If name is matched, this is called. */
65  /* TODO Too specific? *sigh* Resolving *that* issue gives me a headache. */
66  CommHelpFunc helpfunc;/* Returns a string documenting the command. - the *really* long desc. */
67  const char * desc; /* One-liner describing command. (Man page subtitle, anyone?) */
69 
70 extern const ConsoleCommand * find_command(const char * cmd);
71 
72 /* Define this to let the toolkit give an array of toolkit-specific commands. */
73 #undef TOOLKIT_COMMANDS
74 #ifdef TOOLKIT_COMMANDS
75 extern ConsoleCommand ToolkitCommands[];
76 extern const int ToolkitCommandsSize;
77 
78 /* Not defined in common, called at the very top of init_commands()
79  so a toolkit can fill ToolkitCommands and ToolkitCommandsSize in.
80 */
81 extern void init_toolkit_commands(void);
82 #endif
83 
88 extern void init_commands(void);
89 
90 extern int get_num_commands(void);
98 
99 /* Used only for searching the commands list for help, er. ... Oh, well. */
100 extern const ConsoleCommand * find_command(const char * cmd);
101 
102 /* This searches ClientCommands; if there's nothing in there, it goes to the server.
103  * With some exceptions. :(
104  */
105 extern void extended_command(const char *ocommand);
106 
107 extern const char * complete_command(const char * ocommand);
108 
109 extern int handle_local_command(const char* cp, const char * cpnext);
110 
111 
112 #endif
const char * get_category_name(CommCat cat)
Definition: p_cmd.c:335
int get_num_commands(void)
Definition: p_cmd.c:727
CommFunc dofunc
Definition: p_cmd.h:64
const char *(* CommHelpFunc)(void)
Definition: p_cmd.h:45
snd_pcm_hw_params_t * params
Definition: alsa9.c:111
CommCat cat
Definition: p_cmd.h:63
CommCat
Definition: p_cmd.h:48
void extended_command(const char *ocommand)
Definition: p_cmd.c:890
const char * desc
Definition: p_cmd.h:67
const char * name
Definition: p_cmd.h:62
int handle_local_command(const char *cp, const char *cpnext)
Definition: p_cmd.c:858
void(* CommFunc)(const char *params)
Definition: p_cmd.h:40
const ConsoleCommand * find_command(const char *cmd)
Definition: p_cmd.c:802
CommHelpFunc helpfunc
Definition: p_cmd.h:66
const char * complete_command(const char *ocommand)
Definition: p_cmd.c:972
void init_commands(void)
Definition: p_cmd.c:755
ConsoleCommand ** get_cat_sorted_commands(void)
Definition: p_cmd.c:846