2001-02-21 19:35:06 +00:00
|
|
|
/*
|
|
|
|
cmd.h
|
|
|
|
|
|
|
|
Command buffer and command execution
|
|
|
|
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
*/
|
|
|
|
|
2002-07-31 05:19:03 +00:00
|
|
|
#ifndef __QF_cmd_h
|
|
|
|
#define __QF_cmd_h
|
2002-03-03 23:28:57 +00:00
|
|
|
|
2004-11-08 23:27:00 +00:00
|
|
|
/** \defgroup cmd Command management.
|
2006-12-05 11:40:00 +00:00
|
|
|
\ingroup utils
|
2004-11-08 23:27:00 +00:00
|
|
|
*/
|
|
|
|
//@{
|
|
|
|
|
2001-03-27 23:36:02 +00:00
|
|
|
#include "QF/qtypes.h"
|
2007-03-18 03:48:09 +00:00
|
|
|
#include "QF/cbuf.h"
|
2001-02-21 19:35:06 +00:00
|
|
|
|
|
|
|
typedef void (*xcommand_t) (void);
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
src_client, // came in over a net connection as a clc_stringcmd
|
2002-07-31 05:19:03 +00:00
|
|
|
// host_client will be valid during this state.
|
2002-05-11 03:00:14 +00:00
|
|
|
src_command, // from a command buffer
|
2001-02-21 19:35:06 +00:00
|
|
|
} cmd_source_t;
|
|
|
|
|
2007-03-20 21:31:07 +00:00
|
|
|
typedef struct cmd_function_s {
|
|
|
|
struct cmd_function_s *next;
|
|
|
|
const char *name;
|
|
|
|
xcommand_t function;
|
|
|
|
const char *description;
|
|
|
|
qboolean pure;
|
|
|
|
} cmd_function_t;
|
|
|
|
|
2001-02-21 19:35:06 +00:00
|
|
|
extern cmd_source_t cmd_source;
|
|
|
|
|
|
|
|
void Cmd_Init_Hash (void);
|
|
|
|
void Cmd_Init (void);
|
|
|
|
|
2002-04-12 17:19:49 +00:00
|
|
|
int Cmd_AddCommand (const char *cmd_name, xcommand_t function, const char *description);
|
|
|
|
int Cmd_RemoveCommand (const char *cmd_name);
|
2002-05-11 03:00:14 +00:00
|
|
|
|
2001-07-15 07:04:17 +00:00
|
|
|
qboolean Cmd_Exists (const char *cmd_name);
|
|
|
|
const char *Cmd_CompleteCommand (const char *partial);
|
|
|
|
int Cmd_CompleteCountPossible (const char *partial);
|
|
|
|
const char **Cmd_CompleteBuildList (const char *partial);
|
2001-02-21 19:35:06 +00:00
|
|
|
|
|
|
|
|
2002-07-31 05:19:03 +00:00
|
|
|
int Cmd_Argc (void);
|
|
|
|
const char *Cmd_Argv (int arg);
|
|
|
|
const char *Cmd_Args (int start);
|
|
|
|
struct cbuf_args_s;
|
2003-02-14 08:06:01 +00:00
|
|
|
int Cmd_Command (struct cbuf_args_s *args);
|
2002-07-31 05:19:03 +00:00
|
|
|
int Cmd_ExecuteString (const char *text, cmd_source_t src);
|
|
|
|
struct cbuf_s;
|
|
|
|
void Cmd_StuffCmds (struct cbuf_s *cbuf);
|
2002-11-08 16:39:28 +00:00
|
|
|
void Cmd_Exec_File (struct cbuf_s *cbuf, const char *path, int qfs);
|
2007-03-18 03:48:09 +00:00
|
|
|
void Cmd_AddProvider(const char *name, struct cbuf_interpreter_s *interp);
|
|
|
|
struct cbuf_interpreter_s *Cmd_GetProvider(const char *name);
|
|
|
|
|
2002-04-14 01:12:19 +00:00
|
|
|
|
2002-07-31 05:19:03 +00:00
|
|
|
extern struct cbuf_args_s *cmd_args;
|
2001-10-03 21:25:43 +00:00
|
|
|
extern struct cvar_s *cmd_warncmd;
|
2007-03-20 21:31:07 +00:00
|
|
|
extern cmd_function_t *cmd_functions; // possible commands to execute
|
2002-03-03 23:28:57 +00:00
|
|
|
|
2004-11-08 23:27:00 +00:00
|
|
|
//@}
|
|
|
|
|
2002-07-31 05:19:03 +00:00
|
|
|
#endif//__QF_cmd_h
|