/* * misc.h * doom * * Created by John Carmack on 4/13/09. * Copyright 2009 idSoftware. All rights reserved. * */ char *va( const char *format, ... ); void Com_Printf( const char *fmt, ... ); void Com_Error( const char *fmt, ... ); int HashString( const char *string ); /* Command execution takes a NUL-terminated string, breaks it into tokens, then searches for a command or variable that matches the first token. */ typedef void (*xcommand_t) (void); // 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 NULL, the command will be forwarded to the server // as a clc_stringcmd instead of executed locally void Cmd_AddCommand( const char *cmd_name, xcommand_t function ); // print all the added commands void Cmd_ListCommands_f(); // attempts to match a partial command for automatic command line completion // returns NULL if nothing fits char *Cmd_CompleteCommand( const char *partial ); // The functions that execute commands get their parameters with these // functions. Cmd_Argv () will return an empty string, not a NULL // if arg > argc, so string operations are always safe. int Cmd_Argc( void ); const char *Cmd_Argv( int arg ); // Takes a NUL-terminated string. Does not need to be /n terminated. // breaks the string up into argc / argv tokens. void Cmd_TokenizeString( const char *text ); // Parses a single line of text into arguments and tries to execute it // as if it was typed at the console void Cmd_ExecuteString( const char *text ); // execute each line of the config file void Cmd_ExecuteFile( const char *fullPathName );