UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cmd.h File Reference

Command text buffering and command execution header. More...

#include "filesys.h"
#include "../shared/cxx.h"
#include "../shared/sharedptr.h"
#include <stdarg.h>
#include "ScopedCommand.h"

Go to the source code of this file.

Data Structures

struct  cmdList_s
 
class  CmdListener
 Listener for command changes. More...
 

Typedefs

typedef void(* xcommand_t )(void)
 
typedef struct cmdList_s cmdList_t
 
typedef SharedPtr< CmdListenerCmdListenerPtr
 

Functions

void Cbuf_Init (void)
 allocates an initial text buffer that will grow as needed More...
 
void Cbuf_Shutdown (void)
 
void Cbuf_AddText (const char *format,...) __attribute__((format(__printf__
 
void void Cbuf_InsertText (const char *text)
 when a command wants to issue other commands immediately, the text is More...
 
void Cbuf_AddEarlyCommands (bool clear)
 adds all the +set commands from the command line More...
 
bool Cbuf_AddLateCommands (void)
 adds all the remaining + commands from the command line More...
 
void Cbuf_Execute (void)
 Pulls off
terminated lines of text from the command buffer and sends them through Cmd_ExecuteString. Stops when the buffer is empty. Normally called once per frame, but may be explicitly invoked. Do not call inside a command function! More...
 
void Cbuf_CopyToDefer (void)
 These two functions are used to defer any pending commands while a map is being loaded. More...
 
void Cbuf_InsertFromDefer (void)
 Copies back any deferred commands. More...
 
void Cmd_Init (void)
 
void Cmd_Shutdown (void)
 
void Cmd_AddCommand (const char *cmd_name, xcommand_t function, const char *desc=nullptr)
 called by the init functions of other parts of the program to register commands and functions to call for them. The cmd_name is referenced later, so it should not be in temp memory if function is nullptr, the command will be forwarded to the server as a clc_stringcmd instead of executed locally More...
 
void Cmd_RemoveCommand (const char *cmd_name)
 Removes a command from script interface. More...
 
void Cmd_TableCheck (void)
 Check both the functiontable and the associated hashtable for invalid entries. More...
 
void Cmd_TableAddList (const cmdList_t *cmdList)
 
void Cmd_TableRemoveList (const cmdList_t *cmdList)
 
void Cmd_AddParamCompleteFunction (const char *cmd_name, int(*function)(const char *partial, const char **match))
 
void Cmd_AddUserdata (const char *cmd_name, void *userdata)
 Adds userdata to the console command. More...
 
voidCmd_GetUserdata (const char *cmd_name)
 Fetches the userdata for a console command. More...
 
bool Cmd_GenericCompleteFunction (char const *candidate, char const *partial, char const **match)
 
bool Cmd_Exists (const char *cmd_name)
 used by the cvar code to check for cvar / command name overlap More...
 
void Cmd_RegisterCmdListener (CmdListenerPtr listener)
 Registers a command listener. More...
 
void Cmd_UnRegisterCmdListener (CmdListenerPtr listener)
 Unregisters a command listener. More...
 
int Cmd_CompleteCommandParameters (const char *command, const char *partial, const char **match)
 attempts to match a partial command for automatic command line completion returns nullptr if nothing fits More...
 
int Cmd_CompleteCommand (const char *partial, const char **match)
 Unix like tab completion for console commands. More...
 
int Cmd_Argc (void)
 The functions that execute commands get their parameters with these functions. Cmd_Argv() will return an empty string, not a nullptr if arg > argc, so string operations are always safe. More...
 
const char * Cmd_Argv (int arg)
 Returns a given argument. More...
 
const char * Cmd_Args (void)
 Returns a single string containing argv(1) to argv(argc()-1) More...
 
voidCmd_Userdata (void)
 Return the userdata of the called command. More...
 
void Cmd_TokenizeString (const char *text, bool macroExpand, bool replaceWhitespaces=true)
 Parses the given string into command line tokens. More...
 
void Cmd_ExecuteString (const char *text,...) __attribute__((format(__printf__
 Parses a single line of text into arguments and tries to execute it as if it was typed at the console. More...
 
void void Cmd_vExecuteString (const char *fmt, va_list ap)
 
void Cmd_ForwardToServer (void)
 adds the current command line as a clc_stringcmd to the client message. things like godmode, noclip, etc, are commands directed to the server, so when they are typed in at the console, they will need to be forwarded. More...
 
const char * Cmd_GetCommandDesc (const char *command)
 Searches for the description of a given command. More...
 
void Cmd_BufClear (void)
 Clears the command execution buffer. More...
 
void Cmd_WriteAliases (qFILE *f)
 Writes the persistent aliases to the given filehandle. More...
 
void Cmd_Dummy_f (void)
 Dummy binding if you don't want unknown commands forwarded to the server. More...
 

Detailed Description

Command text buffering and command execution header.

Note
Any number of commands can be added in a frame, from several different sources. Most commands come from either keyBindings or console line input, but remote servers can also send across commands and entire text files can be executed.
The + command line options are also added to the command buffer.
Command execution takes a null terminated string, breaks it into tokens, then searches for a command or variable that matches the first token.

Definition in file cmd.h.

Typedef Documentation

typedef struct cmdList_s cmdList_t

Definition at line 103 of file cmd.h.

typedef void(* xcommand_t)(void)

Definition at line 84 of file cmd.h.

Function Documentation

void Cbuf_AddEarlyCommands ( bool  clear)

adds all the +set commands from the command line

adds all the +set commands from the command line

See also
Cbuf_AddLateCommands

Definition at line 275 of file cmd.cpp.

References Cbuf_AddText(), Com_Argc(), Com_Argv(), Com_ClearArgv(), i, and Q_streq.

Referenced by Qcommon_Init().

bool Cbuf_AddLateCommands ( void  )

adds all the remaining + commands from the command line

Returns
true if any late commands were added, which will keep the demoloop from immediately starting

adds all the remaining + commands from the command line

Note
Commands lead with a + and continue until another + or -
Returns
true if any late commands were added
See also
Cbuf_AddEarlyCommands

Definition at line 298 of file cmd.cpp.

References Cbuf_AddText(), Com_Argc(), Com_Argv(), i, Mem_AllocTypeN, Mem_Free, and Q_strcat().

Referenced by Qcommon_Init().

void Cbuf_AddText ( const char *  format,
  ... 
)
void Cbuf_CopyToDefer ( void  )

These two functions are used to defer any pending commands while a map is being loaded.

These two functions are used to defer any pending commands while a map is being loaded.

Used when loading a map, for example. Copies then clears the command buffer to a temporary area.

Definition at line 191 of file cmd.cpp.

References cmd_text_buf, sizebuf_s::cursize, and defer_text_buf.

Referenced by SV_Map().

void Cbuf_Execute ( void  )

Pulls off
terminated lines of text from the command buffer and sends them through Cmd_ExecuteString. Stops when the buffer is empty. Normally called once per frame, but may be explicitly invoked. Do not call inside a command function!

See also
Cmd_ExecuteString Pulls off \n terminated lines of text from the command buffer and sends them through Cmd_ExecuteString, stopping when the buffer is empty. Normally called once per frame, but may be explicitly invoked.
Note
Do not call inside a command function!

Definition at line 214 of file cmd.cpp.

References alias_count, Cmd_ExecuteString(), cmdWait, sizebuf_s::cursize, sizebuf_s::data, and i.

Referenced by Cbuf_Execute_timer(), CL_ParseServerMessage(), CL_SendCommand(), GAME_GetImportData(), Qcommon_Init(), and UFO_ExecuteTestWindow().

void Cbuf_Init ( void  )

allocates an initial text buffer that will grow as needed

Definition at line 109 of file cmd.cpp.

References cmd_text_buf, and SZ_Init().

Referenced by Qcommon_Init(), and TEST_Init().

void Cbuf_InsertFromDefer ( void  )

Copies back any deferred commands.

Definition at line 201 of file cmd.cpp.

References Cbuf_InsertText(), and defer_text_buf.

Referenced by SV_Begin_f(), and SV_StartMatch_f().

void void Cbuf_InsertText ( const char *  text)

when a command wants to issue other commands immediately, the text is

when a command wants to issue other commands immediately, the text is

Note
Adds a \n to the text
Todo:
actually change the command buffer to do less copying

Definition at line 157 of file cmd.cpp.

References Cbuf_AddText(), sizebuf_s::cursize, sizebuf_s::data, Mem_AllocTypeN, Mem_Free, Q_strnull(), SZ_Clear(), and SZ_Write().

Referenced by Cbuf_InsertFromDefer(), Cmd_Exec_f(), and Cmd_vExecuteString().

void Cbuf_Shutdown ( void  )
Note
Reset the Cbuf memory.

Definition at line 117 of file cmd.cpp.

References SZ_Init().

Referenced by TEST_Shutdown().

void Cmd_AddCommand ( const char *  cmdName,
xcommand_t  function,
const char *  desc 
)

called by the init functions of other parts of the program to register commands and functions to call for them. The cmd_name is referenced later, so it should not be in temp memory if function is nullptr, the command will be forwarded to the server as a clc_stringcmd instead of executed locally

called by the init functions of other parts of the program to register commands and functions to call for them. The cmd_name is referenced later, so it should not be in temp memory if function is nullptr, the command will be forwarded to the server as a clc_stringcmd instead of executed locally

Parameters
[in]cmdNameThe name the command is available via script interface
[in]functionThe function pointer
[in]descA short description of what the cmd does. It is shown for e.g. the tab completion or the command list.
See also
Cmd_RemoveCommand

Definition at line 744 of file cmd.cpp.

References cmd_functions, CMD_HASH_SIZE, Cmd_TableFind(), cmdListeners, com_cmdSysPool, Com_DPrintf(), Com_HashKey(), Com_Printf(), cmd_function_s::completeParam, Cvar_GetString(), DEBUG_COMMANDS, cmd_function_s::description, cmd_function_s::function, hash, HASH_Add, i, Mem_PoolAllocType, cmd_function_s::name, cmd_function_s::next, and Q_strvalid.

Referenced by ACTOR_InitStartup(), CL_BattlescapeRadarInit(), CL_CameraInit(), CL_InitLocal(), CL_ServerEventsInit(), CLMN_Init(), Cmd_Init(), Cmd_TableAddList(), Con_Init(), Cvar_Init(), GAME_GetImportData(), GAME_InitStartup(), HUD_InitCallbacks(), HUD_InitStartup(), IN_Init(), INV_InitCallbacks(), INV_InitStartup(), Irc_Init(), Key_Init(), Mem_Init(), NET_Init(), uiConFuncNode::onLoaded(), PTL_InitStartup(), Qcommon_Init(), S_Init(), SCR_Init(), CampaignTest::SetUpTestCase(), SV_InitOperatorCommands(), SV_MapcycleInit(), TEAM_InitStartup(), TEST_F(), TOTD_InitStartup(), TUT_InitStartup(), UI_Init(), UI_InitActions(), UI_InitData(), UI_InitWindows(), UI_RegisterAbstractNode(), UI_RegisterEditorNode(), UI_RegisterGeoscapeNode(), UI_RegisterMaterialEditorNode(), UI_RegisterModelNode(), VID_Init(), WEB_CGameCommands(), and WEB_InitStartup().

void Cmd_AddParamCompleteFunction ( const char *  cmdName,
int(*)(const char *partial, const char **match)  function 
)
Parameters
[in]cmdNameThe name the command we want to add the complete function
[in]functionThe complete function pointer
See also
Cmd_AddCommand
Cmd_CompleteCommandParameters

Definition at line 679 of file cmd.cpp.

References Cmd_TableFind(), and cmd_function_s::completeParam.

Referenced by Cmd_Init(), GAME_GetImportData(), Key_Init(), M_Init(), S_Init(), SV_InitOperatorCommands(), UI_InitWindows(), and UI_RegisterEditorNode().

void Cmd_AddUserdata ( const char *  cmdName,
void userdata 
)

Adds userdata to the console command.

Parameters
[in]cmdNameThe name the command we want to add edit
[in]userdatafor this function
See also
Cmd_AddCommand
Cmd_CompleteCommandParameters
Cmd_GetUserdata

Definition at line 724 of file cmd.cpp.

References Cmd_TableFind(), and cmd_function_s::userdata.

Referenced by uiConFuncNode::onLoaded().

int Cmd_Argc ( void  )

The functions that execute commands get their parameters with these functions. Cmd_Argv() will return an empty string, not a nullptr if arg > argc, so string operations are always safe.

The functions that execute commands get their parameters with these functions. Cmd_Argv() will return an empty string, not a nullptr if arg > argc, so string operations are always safe.

Returns
the number of arguments including the command itself.
See also
Cmd_Argv

Definition at line 505 of file cmd.cpp.

References cmd_argc.

Referenced by CL_ActorSelect_f(), CL_ActorTargetAlign_f(), CL_CamSetAngles_f(), CL_CamSetZoom_f(), CL_ConnectionlessPacket(), CL_Env_f(), CL_ForwardToServer_f(), CL_GetTipOfTheDay_f(), CL_OpenURL_f(), CL_PressKey_f(), CL_SetRatioFilter_f(), Cmd_Alias_f(), Cmd_Echo_f(), Cmd_Exec_f(), Cmd_ForwardToServer(), Cmd_List_f(), Cmd_vExecuteString(), Com_DeveloperSet_f(), Com_WriteConfig_f(), Cvar_Add_f(), Cvar_Command(), Cvar_Copy_f(), Cvar_Define_f(), Cvar_Del_f(), Cvar_List_f(), Cvar_Mod_f(), Cvar_Set_f(), Cvar_SetOld_f(), Cvar_Switch_f(), GAME_ActorSelect_f(), GAME_AutoTeam_f(), GAME_GetImportData(), GAME_LoadTeam_f(), GAME_SaveTeam_f(), GAME_SetMode_f(), GAME_TeamDelete_f(), GAME_ToggleActorForTeam_f(), HUD_DisplayActions_f(), HUD_DisplayFiremodes_f(), HUD_ExecuteAction_f(), HUD_FireWeapon_f(), HUD_PopupFiremodeReservation_f(), HUD_RemainingTUs_f(), HUD_SelectReactionFiremode_f(), HUD_ShotReserve_f(), INV_UpdateActorLoad_f(), INV_UpdateObject_f(), Irc_Client_Join_f(), Irc_Client_Kick_f(), Irc_Client_Mode_f(), Irc_Client_Msg_f(), Irc_Client_Part_f(), Irc_Client_PrivMsg_f(), Irc_Client_Topic_f(), Irc_Client_Who_f(), Irc_Client_Whois_f(), Irc_Client_Whowas_f(), Irc_Connect_f(), Irc_UserClick_f(), Irc_UserRightClick_f(), Key_Bind_f(), Key_Unbind_f(), Key_WriteBindings_f(), M_Change_f(), M_Play_f(), R_ScreenShot(), R_ScreenShot_f(), S_Play_f(), SCR_TimeRefresh_f(), SV_InitGameProgs(), SV_Kick_f(), SV_Map_f(), SV_MapcycleAdd_f(), SV_ServerCommand_f(), SV_UserInfo_f(), SVC_RemoteCommand(), TUT_ListClick_f(), UI_AddCvarListener_f(), UI_AddListener_f(), UI_CloseWindow_f(), UI_DebugTree_f(), UI_EditorNodeExtract_f(), UI_ExecuteLuaConFunc(), UI_GeoscapeNodeScroll_f(), UI_GeoscapeNodeZoom_f(), UI_GetParamNumber(), UI_InitStack_f(), UI_MaterialEditorChangeValue_f(), UI_MaterialEditorNewStage_f(), UI_MaterialEditorRemoveStage_f(), UI_MaterialEditorSelectStage_f(), UI_Popup_f(), UI_PopWindow_f(), UI_PushChildWindow_f(), UI_PushDropDownWindow_f(), UI_PushWindow_f(), UI_RemoveCvarListener_f(), UI_RemoveListener_f(), UI_RequestMapList_f(), UI_ResetData_f(), UI_SelectMap_f(), WEB_Auth_f(), WEB_DeleteCGame_f(), WEB_DownloadCGame_f(), WEB_ListCGame_f(), and WEB_UploadCGame_f().

const char* Cmd_Args ( void  )
const char* Cmd_Argv ( int  arg)

Returns a given argument.

Parameters
[in]argThe argument at position arg in cmd_argv. 0 will return the command name.
Returns
The argument from cmd_argv
See also
Cmd_Argc

Definition at line 516 of file cmd.cpp.

References cmd_argc, and cmd_argv.

Referenced by CL_ActorSelect_f(), CL_ActorTargetAlign_f(), CL_CamSetAngles_f(), CL_CamSetZoom_f(), CL_ConnectionlessPacket(), CL_Env_f(), CL_ForwardToServer_f(), CL_OpenURL_f(), CL_PressKey_f(), CL_SetRatioFilter_f(), Cmd_Alias_f(), Cmd_Echo_f(), Cmd_Exec_f(), Cmd_ForwardToServer(), Cmd_List_f(), Cmd_vExecuteString(), Com_DeveloperSet_f(), Com_WriteConfig_f(), Cvar_Add_f(), Cvar_Command(), Cvar_Copy_f(), Cvar_Define_f(), Cvar_Del_f(), Cvar_List_f(), Cvar_Mod_f(), Cvar_Set_f(), Cvar_SetOld_f(), Cvar_Switch_f(), GAME_ActorSelect_f(), GAME_AutoTeam_f(), GAME_GetImportData(), GAME_LoadTeam_f(), GAME_SaveTeam_f(), GAME_SetMode_f(), GAME_TeamDelete_f(), GAME_ToggleActorForTeam_f(), HUD_DisplayActions_f(), HUD_DisplayFiremodes_f(), HUD_ExecuteAction_f(), HUD_FireWeapon_f(), HUD_RemainingTUs_f(), HUD_SelectReactionFiremode_f(), HUD_ShotReserve_f(), IN_KeyDown(), IN_KeyUp(), INV_UpdateActorLoad_f(), INV_UpdateObject_f(), Irc_Client_Join_f(), Irc_Client_Kick_f(), Irc_Client_Mode_f(), Irc_Client_Part_f(), Irc_Client_PrivMsg_f(), Irc_Client_Topic_f(), Irc_Client_Who_f(), Irc_Client_Whois_f(), Irc_Client_Whowas_f(), Irc_Connect_f(), Irc_UserClick_f(), Irc_UserRightClick_f(), Key_Bind_f(), Key_Unbind_f(), Key_Unbindall_f(), Key_WriteBindings_f(), M_Change_f(), M_Play_f(), R_ScreenShot(), R_ScreenShot_f(), S_Play_f(), SV_ConnectionlessPacket(), SV_ExecuteUserCommand(), SV_GetPlayerClientStructure(), SV_InitGameProgs(), SV_Kick_f(), SV_Map_f(), SV_MapcycleAdd_f(), SV_ServerCommand_f(), SV_UserInfo_f(), SVC_DirectConnect(), SVC_Info(), SVC_RemoteCommand(), TEST_F(), TUT_ListClick_f(), UI_AddCvarListener_f(), UI_AddListener_f(), UI_CloseWindow_f(), UI_DebugTree_f(), UI_EditorNodeExtract_f(), UI_ExecuteLuaConFunc(), UI_GeoscapeNodeScroll_f(), UI_GeoscapeNodeZoom_f(), UI_GetParam(), UI_InitStack_f(), UI_MaterialEditorChangeValue_f(), UI_MaterialEditorNewStage_f(), UI_MaterialEditorRemoveStage_f(), UI_MaterialEditorSelectStage_f(), UI_Popup_f(), UI_PopWindow_f(), UI_PushChildWindow_f(), UI_PushDropDownWindow_f(), UI_PushWindow_f(), UI_RemoveCvarListener_f(), UI_RemoveListener(), UI_RemoveListener_f(), UI_RequestMapList_f(), UI_ResetData_f(), UI_SelectMap_f(), UI_TextScrollEnd(), WEB_Auth_f(), WEB_DeleteCGame_f(), WEB_DownloadCGame_f(), WEB_ListCGame_f(), and WEB_UploadCGame_f().

void Cmd_BufClear ( void  )

Clears the command execution buffer.

Clears the command execution buffer.

See also
Cmd_TokenizeString

Definition at line 543 of file cmd.cpp.

References cmd_argc, cmd_args, cmd_argv, cmd_userdata, i, and Mem_Free.

Referenced by Cmd_TokenizeString().

int Cmd_CompleteCommand ( const char *  partial,
const char **  match 
)

Unix like tab completion for console commands.

Parameters
[in]partialThe beginning of the command we try to complete
[out]matchThe found entry of the list we are searching, in case of more than one entry their common suffix is returned.
See also
Cvar_CompleteVariable
Key_CompleteCommand

Definition at line 924 of file cmd.cpp.

References Cmd_GenericCompleteFunction(), Com_Printf(), cmd_alias_s::next, cmd_function_s::next, and S_COLOR_GREEN.

Referenced by Com_ConsoleCompleteCommand().

int Cmd_CompleteCommandParameters ( const char *  command,
const char *  partial,
const char **  match 
)

attempts to match a partial command for automatic command line completion returns nullptr if nothing fits

attempts to match a partial command for automatic command line completion returns nullptr if nothing fits

Parameters
[in]commandThe command we try to complete the parameter for
[in]partialThe beginning of the parameter we try to complete
[out]matchThe command we are writing back (if something was found)
See also
Cvar_CompleteVariable
Key_CompleteCommand

Definition at line 903 of file cmd.cpp.

References CMD_HASH_SIZE, Com_HashKey(), hash, cmd_function_s::hash_next, and Q_strcasecmp.

Referenced by Com_ConsoleCompleteCommand().

void Cmd_Dummy_f ( void  )

Dummy binding if you don't want unknown commands forwarded to the server.

Definition at line 1083 of file cmd.cpp.

Referenced by S_Init(), and CampaignTest::SetUpTestCase().

void Cmd_ExecuteString ( const char *  text,
  ... 
)

Parses a single line of text into arguments and tries to execute it as if it was typed at the console.

bool Cmd_Exists ( const char *  cmdName)

used by the cvar code to check for cvar / command name overlap

used by the cvar code to check for cvar / command name overlap

Parameters
[in]cmdNameThe script interface function name to search for

Definition at line 887 of file cmd.cpp.

References Cmd_TableFind().

Referenced by uiConFuncNode::deleteNode(), M_Init(), uiConFuncNode::onLoaded(), and UI_Shutdown().

void Cmd_ForwardToServer ( void  )

adds the current command line as a clc_stringcmd to the client message. things like godmode, noclip, etc, are commands directed to the server, so when they are typed in at the console, they will need to be forwarded.

adds the current command line as a clc_stringcmd to the client message. things like godmode, noclip, etc, are commands directed to the server, so when they are typed in at the console, they will need to be forwarded.

Definition at line 98 of file cl_main.cpp.

References dbuffer::add(), ca_connected, clc_stringcmd, Cmd_Argc(), Cmd_Args(), Cmd_Argv(), Com_Printf(), NET_WriteByte(), NET_WriteMsg(), client_static_s::netStream, and client_static_s::state.

bool Cmd_GenericCompleteFunction ( char const *  candidate,
char const *  partial,
char const **  match 
)

Tests whether candidate has partial as prefix and determines the common prefix of all candidates passed to it.

See also
Cmd_AddParamCompleteFunction
Parameters
[out]matchThe found entry of the list we are searching, in case of more than one entry their common suffix is returned.
[in]candidateA completion candidate.
[in]partialThe prefix a candidate must have to be considered a match.
Returns
true if the candidate matches partial.

Definition at line 648 of file cmd.cpp.

References MAX_QPATH, Q_strncpyz(), and Q_strstart().

Referenced by Cmd_CompleteCommand(), Cmd_CompleteExecCommand(), Cvar_CompleteVariable(), GAME_GetImportData(), Key_CompleteKeyName(), M_CompleteMusic(), S_CompleteSounds(), SV_CompleteMapCommand(), SV_CompleteServerCommand(), and UI_CompleteWithWindow().

const char* Cmd_GetCommandDesc ( const char *  cmdName)

Searches for the description of a given command.

Searches for the description of a given command.

Parameters
[in]cmdNameCommand id in global command array
Note
never returns a nullptr pointer
Todo:
  • search alias, too

Definition at line 629 of file cmd.cpp.

References Cmd_TableFind(), cmd_function_s::description, MAX_VAR, and Q_strncpyz().

Referenced by CLMN_AddBindings().

void* Cmd_GetUserdata ( const char *  cmdName)

Fetches the userdata for a console command.

Parameters
[in]cmdNameThe name the command we want to add edit
Returns
nullptr if no userdata was set or the command wasn't found, the userdata pointer if it was found and set
See also
Cmd_AddCommand
Cmd_CompleteCommandParameters
Cmd_AddUserdata

Definition at line 700 of file cmd.cpp.

References Cmd_TableFind(), Com_Printf(), and cmd_function_s::userdata.

Referenced by uiConFuncNode::deleteNode(), uiConFuncNode::onWindowClosed(), uiConFuncNode::onWindowOpened(), and UI_ConFuncIsVirtual().

void Cmd_RegisterCmdListener ( CmdListenerPtr  listener)

Registers a command listener.

Parameters
listenerThe listener callback to register

Definition at line 869 of file cmd.cpp.

References cmdListeners.

Referenced by GAME_InitStartup().

void Cmd_RemoveCommand ( const char *  cmdName)
void Cmd_Shutdown ( void  )

Definition at line 1145 of file cmd.cpp.

References alias_count, cmd_argc, cmd_argv, cmdClosed, cmdWait, com_cmdSysPool, Mem_FreePool, and OBJZERO.

Referenced by Qcommon_Shutdown(), and TEST_Shutdown().

void Cmd_TableAddList ( const cmdList_t cmdList)

Definition at line 853 of file cmd.cpp.

References Cmd_AddCommand(), and cmdList_s::name.

Referenced by GAME_GetImportData(), M_Init(), and R_RegisterSystemVars().

void Cmd_TableCheck ( void  )

Check both the functiontable and the associated hashtable for invalid entries.

Definition at line 826 of file cmd.cpp.

References CMD_HASH_SIZE, Com_Printf(), cmd_function_s::hash_next, i, cmd_function_s::next, and Q_streq.

void Cmd_TableRemoveList ( const cmdList_t cmdList)

Definition at line 859 of file cmd.cpp.

References Cmd_RemoveCommand(), and cmdList_s::name.

Referenced by GAME_GetImportData(), M_Shutdown(), and R_Shutdown().

void Cmd_TokenizeString ( const char *  text,
bool  macroExpand,
bool  replaceWhitespaces 
)

Parses the given string into command line tokens.

Note
cmd_argv and cmd_argv are filled and set here
*cvars will be expanded unless they are in a quoted token
See also
Com_MacroExpandString
Parameters
[in]textThe text to parse and tokenize. Must be null terminated. Does not need to be "\n" terminated.
[in]macroExpandexpand cvar string with their values
[in]replaceWhitespacesReplace "\\t" and "\\n" to "\t" and "\n"

Definition at line 565 of file cmd.cpp.

References cmd_argc, cmd_args, cmd_argv, Cmd_BufClear(), Com_Chop(), com_cmdSysPool, Com_MacroExpandString(), Com_Parse(), com_token, Cvar_GetString(), MAX_STRING_TOKENS, Mem_PoolStrDup, and Q_strncpyz().

Referenced by CL_ConnectionlessPacket(), Cmd_vExecuteString(), SV_ConnectionlessPacket(), SV_ExecuteUserCommand(), and TEST_F().

void Cmd_UnRegisterCmdListener ( CmdListenerPtr  listener)

Unregisters a command listener.

Parameters
listenerThe listener callback to unregister

Definition at line 878 of file cmd.cpp.

References cmdListeners.

Referenced by GAME_Shutdown().

void* Cmd_Userdata ( void  )

Return the userdata of the called command.

Definition at line 534 of file cmd.cpp.

References cmd_userdata.

Referenced by UI_ConfuncCommand_f().

void Cmd_WriteAliases ( qFILE f)

Writes the persistent aliases to the given filehandle.

Parameters
fFilehandle to write the aliases to

Writes the persistent aliases to the given filehandle.

Parameters
fFilehandle to write the aliases to

Definition at line 454 of file cmd.cpp.

References FS_Printf(), i, qFILE_s::name, and cmd_alias_s::next.

Referenced by Com_WriteConfigToFile().