29 #include "../idlib/precompiled.h"
52 virtual void Init(
void );
136 if ( args.
Argc() > 1 ) {
137 match = args.
Args( 1, -1 );
144 if ( !( cmd->
flags & flags ) ) {
156 for ( i = 0; i < cmdList.
Num(); i++ ) {
229 if ( args.
Argc () != 2 ) {
230 common->
Printf(
"exec <filename> : execute a script file\n" );
234 filename = args.
Argv(1);
258 if ( args.
Argc () != 2 ) {
259 common->
Printf(
"vstr <variablename> : execute a variable command\n" );
278 for ( i = 1; i < args.
Argc(); i++ ) {
292 if ( args.
Argc() == 2 ) {
309 for ( i = 0; i < args.
Argc(); i++ ) {
371 common->
Printf(
"idCmdSystemLocal::AddCommand: %s already defined\n", cmdName );
395 for ( last = &
commands, cmd = *last; cmd; cmd = *last ) {
415 for ( last = &
commands, cmd = *last; cmd; cmd = *last ) {
416 if ( cmd->
flags & flags ) {
471 if ( !args.
Argc() ) {
486 common->
Printf(
"Command '%s' not valid in multiplayer mode.\n", cmd->
name );
530 len = strlen( text ) + 1;
532 common->
Printf(
"idCmdSystemLocal::InsertText: buffer overflow\n" );
542 memcpy(
textBuf, text, len - 1 );
563 common->
Printf(
"idCmdSystemLocal::AppendText: buffer overflow\n" );
641 if ( text[i] ==
'"' ) {
644 if ( !( quotes & 1 ) && text[
i] ==
';' ) {
647 if ( text[i] ==
'\n' || text[i] ==
'\r' ) {
654 if ( !
idStr::Cmp( text,
"_execTokenized" ) ) {
665 if ( i == textLength ) {
670 memmove( text, text+i, textLength );
686 const char *extension;
689 string = args.
Argv( 0 );
691 string += args.
Argv( 1 );
700 parm = args.
Argv( 1 );
702 if ( stripFolder || path.
Length() == 0 ) {
703 path = folder +
path;
712 name.
Strip( folder );
716 name = args.
Argv( 0 ) + (
" " +
name ) +
"/";
722 va_start( argPtr, stripFolder );
723 for ( extension = va_arg( argPtr,
const char * ); extension; extension = va_arg( argPtr,
const char * ) ) {
728 name.
Strip( folder );
732 name = args.
Argv( 0 ) + (
" " +
name );
756 for ( i = 0; i <
num; i++ ) {
virtual void BufferCommandText(cmdExecution_t exec, const char *text)
virtual idFileList * ListFiles(const char *relativePath, const char *extension, bool sort=false, bool fullRelativePath=false, const char *gamedir=NULL)=0
virtual bool Command(const idCmdArgs &args)=0
int Cmp(const char *text) const
idCVarSystem * cvarSystem
void(* argCompletion_t)(const idCmdArgs &args, void(*callback)(const char *s))
static void Wait_f(const idCmdArgs &args)
bool Filter(const char *filter, bool casesensitive) const
virtual int ReadFile(const char *relativePath, void **buffer, ID_TIME_T *timestamp=NULL)=0
int GetNumFiles(void) const
idCmdSystemLocal cmdSystemLocal
void StripTrailing(const char c)
void InsertCommandText(const char *text)
idFileSystem * fileSystem
virtual void BufferCommandArgs(cmdExecution_t exec, const idCmdArgs &args)
void ExecuteTokenizedString(const idCmdArgs &args)
const char * Args(int start=1, int end=-1, bool escapeArgs=false) const
const char * GetName(void) const
GLenum GLsizei const GLvoid * string
static void Parse_f(const idCmdArgs &args)
GLuint GLuint GLsizei GLenum type
static void Echo_f(const idCmdArgs &args)
virtual bool IsMultiplayer()=0
static void SoundList_f(const idCmdArgs &args)
idStr & DefaultFileExtension(const char *extension)
static void RendererList_f(const idCmdArgs &args)
virtual void FreeFile(void *buffer)=0
static void SystemList_f(const idCmdArgs &args)
int Icmp(const char *text) const
void ExtractFilePath(idStr &dest) const
virtual void SetupReloadEngine(const idCmdArgs &args)
virtual bool PostReloadEngine(void)
virtual void Shutdown(void)
void Sort(cmp_t *compare=(cmp_t *)&idListSortCompare< type >)
virtual void ArgCompletion_FolderExtension(const idCmdArgs &args, void(*callback)(const char *s), const char *folder, bool stripFolder,...)
idStrList completionParms
void ExecuteCommandText(const char *text)
virtual const char * GetCVarString(const char *name) const =0
virtual void CommandCompletion(void(*callback)(const char *s))
commandDef_t * GetCommands(void) const
argCompletion_t argCompletion
virtual void virtual void FatalError(const char *fmt,...) id_attribute((format(printf
const char * GetFile(int index) const
virtual void FreeFileList(idFileList *fileList)=0
virtual void RemoveCommand(const char *cmdName)
GLubyte GLubyte GLubyte a
virtual void Printf(const char *fmt,...) id_attribute((format(printf
static void List_f(const idCmdArgs &args)
void AppendCommandText(const char *text)
static void PrintMemInfo_f(const idCmdArgs &args)
static void GameList_f(const idCmdArgs &args)
idDeclManager * declManager
virtual int GetNumDecls(declType_t type)=0
void TokenizeString(const char *text, bool keepAsStrings)
static void ToolList_f(const idCmdArgs &args)
idList< idCmdArgs > tokenizedCmds
int Append(const type &obj)
void(* cmdFunction_t)(const idCmdArgs &args)
static void Vstr_f(const idCmdArgs &args)
virtual const idDecl * DeclByIndex(declType_t type, int index, bool forceParse=true)=0
virtual void ArgCompletion_DeclName(const idCmdArgs &args, void(*callback)(const char *s), int type)
static void ListByFlags(const idCmdArgs &args, cmdFlags_t flags)
byte textBuf[MAX_CMD_BUFFER]
bool RemoveIndex(int index)
virtual void ExecuteCommandBuffer(void)
static const int MAX_CMD_BUFFER
void SetWait(int numFrames)
virtual void AddCommand(const char *cmdName, cmdFunction_t function, int flags, const char *description, argCompletion_t argCompletion=NULL)
struct commandDef_s * next
virtual bool GetCVarBool(const char *name) const =0
static void ArgCompletion_ConfigName(const idCmdArgs &args, void(*callback)(const char *s))
virtual void RemoveFlaggedCommands(int flags)
const char * Argv(int arg) const
struct commandDef_s commandDef_t
virtual void ArgCompletion(const char *cmdString, void(*callback)(const char *s))
char * Mem_CopyString(const char *in)
char * va(const char *fmt,...)
void Replace(const char *old, const char *nw)
static void Exec_f(const idCmdArgs &args)
ID_INLINE int idListSortCompare(const commandDef_t *const *a, const commandDef_t *const *b)