48#define CF_CLIENT (1u<<0)
49#define CF_SERVER (1u<<1)
50#define CF_CLIENT_FROM_SERVER (1u<<2)
51#define CF_SERVER_FROM_CLIENT (1u<<3)
52#define CF_CHEAT (1u<<4)
53#define CF_ARCHIVE (1u<<5)
54#define CF_READONLY (1u<<6)
55#define CF_NOTIFY (1u<<7)
56#define CF_SERVERINFO (1u<<8)
57#define CF_USERINFO (1u<<9)
58#define CF_PERSISTENT (1u<<10)
59#define CF_PRIVATE (1u<<11)
60#define CF_MAXFLAGSVAL ((1u<<12) - 1)
62#define CF_REGISTERED (1u<<29)
63#define CF_DEFAULTSET (1u<<30)
64#define CF_ALLOCATED (1u<<31)
67#define CF_SHARED (CF_CLIENT | CF_SERVER)
71typedef enum cmd_source_s
78typedef struct cmd_alias_s
87typedef struct cmd_function_s
90 struct cmd_function_s *
next;
101typedef struct cmd_userdefined_s
111typedef struct cmd_buf_s
126typedef struct cmd_state_s
147 qbool (*Handle)(
struct cmd_state_s *,
struct cmd_function_s *,
const char *, size_t,
enum cmd_source_s);
155typedef struct cmd_input_s
256 if (arg >=
cmd->argc )
257 return cmd->null_string;
258 return cmd->argv[arg];
void Cbuf_Clear(cmd_buf_t *cbuf)
Clears all command buffers.
void Cmd_CompleteCommandPrint(cmd_state_t *cmd, const char *partial)
const char * Cmd_CompleteAlias(cmd_state_t *cmd, const char *partial)
void Cbuf_InsertText(cmd_state_t *cmd, const char *text)
@ src_client
came in over a net connection as a clc_stringcmd host_client will be valid during this state.
@ src_local
from the command buffer
void Cbuf_Unlock(cmd_buf_t *cbuf)
void Cmd_SaveInitState(void)
called by Host_Init, this marks cvars, commands and aliases with their init values
qbool Cmd_SV_Callback(cmd_state_t *cmd, cmd_function_t *func, const char *text, size_t textlen, cmd_source_t src)
const char ** Cmd_CompleteBuildList(cmd_state_t *cmd, const char *partial)
void Cbuf_AddText(cmd_state_t *cmd, const char *text)
cmd_userdefined_t cmd_userdefined_all
aliases and csqc functions
int Cmd_CheckParm(cmd_state_t *cmd, const char *parm)
Returns the position (1 to argc-1) in the command's argument list where the given parameter apears,...
void Cmd_RestoreInitState(void)
Restores cvars, commands and aliases to their init values and deletes any that were added since init.
int Cmd_CompleteCountPossible(cmd_state_t *cmd, const char *partial)
void Cmd_Init(void)
Command execution takes a null terminated string, breaks it into tokens, then searches for a command ...
void Cbuf_Frame(cmd_buf_t *cbuf)
void Cmd_AddCommand(unsigned flags, const char *cmd_name, xcommand_t function, const char *description)
called by the init functions of other parts of the program to register commands and functions to call...
void Cmd_ClearCSQCCommands(cmd_state_t *cmd)
const char * Cmd_CompleteCommand(cmd_state_t *cmd, const char *partial)
attempts to match a partial command for automatic command line completion returns NULL if nothing fit...
void Cmd_CompleteAliasPrint(cmd_state_t *cmd, const char *partial)
void Cmd_ExecuteString(cmd_state_t *cmd, const char *text, size_t textlen, cmd_source_t src, qbool lockmutex)
Parses a single line of text into arguments and tries to execute it.
qbool Cmd_QuoteString(char *out, size_t outlen, const char *in, const char *quoteset, qbool putquotes)
quotes a string so that it can be used as a command argument again; quoteset is a string that contain...
qbool Cmd_CL_Callback(cmd_state_t *cmd, cmd_function_t *func, const char *text, size_t textlen, cmd_source_t src)
cmd_state_t * cmd_local
command interpreter for local commands injected by SVQC, CSQC, MQC, server or client engine code uses...
static int Cmd_Argc(cmd_state_t *cmd)
int Cmd_CompleteAliasCountPossible(cmd_state_t *cmd, const char *partial)
static const char * Cmd_Argv(cmd_state_t *cmd, int arg)
Cmd_Argv(cmd, ) will return an empty string (not a NULL) if arg > argc, so string operations are alwa...
cmd_state_t * cmd_serverfromclient
command interpreter for server commands received over network from clients uses cmddefs_null
const char ** Cmd_CompleteAliasBuildList(cmd_state_t *cmd, const char *partial)
qbool Cmd_Exists(cmd_state_t *cmd, const char *cmd_name)
used by the cvar code to check for cvar / command name overlap
void Cmd_PreprocessAndExecuteString(cmd_state_t *cmd, const char *text, size_t textlen, cmd_source_t src, qbool lockmutex)
Like Cmd_ExecuteString, but with variable expansion.
void Cbuf_Lock(cmd_buf_t *cbuf)
void Cbuf_Execute(cmd_buf_t *cbuf)
cmd_userdefined_t cmd_userdefined_null
intentionally empty
static const char * Cmd_Args(cmd_state_t *cmd)
void Cmd_NoOperation_f(cmd_state_t *cmd)
void(* xcommand_t)(struct cmd_state_s *cmd)
qbool Cmd_Callback(cmd_state_t *cmd, cmd_function_t *func)
#define MAX_ARGS
maximum number of parameters to a console command or alias
#define CMD_TOKENIZELENGTH
maximum tokenizable commandline length (counting trailing 0)
qbool initstate
indicates this command existed at init
struct cmd_alias_s * next
char * initialvalue
backup copy of value at init
struct cmd_function_s * overridden
the engine cmd overriden by this QC cmd, if applicable
struct cmd_function_s * next
qbool initstate
indicates this command existed at init
command interpreter state - the tokenizing and execution of commands, as well as pointers to which cv...
unsigned cmd_flagsmask
cmd flags that identify this interpreter
cmd_userdefined_t * userdefined
possible csqc functions and aliases to execute
unsigned cvars_flagsmask
which CVAR_* flags should be visible to this interpreter? (CF_CLIENT | CF_SERVER, or just CF_SERVER)
cmd_function_t * engine_functions
struct cvar_state_s * cvars
which cvar system is this cmd state able to access? (&cvars_all or &cvars_null)
struct mempool_s * mempool
container for user-defined QC functions and aliases, shared between different command interpreters
cmd_function_t * qc_functions