Annotation of quake1/cmd.h, revision 1.1

1.1     ! root        1: 
        !             2: // cmd.h -- Command buffer and command execution
        !             3: 
        !             4: //===========================================================================
        !             5: 
        !             6: /*
        !             7: 
        !             8: Any number of commands can be added in a frame, from several different sources.
        !             9: Most commands come from either keybindings or console line input, but remote
        !            10: servers can also send across commands and entire text files can be execed.
        !            11: 
        !            12: The + command line options are also added to the command buffer.
        !            13: 
        !            14: The game starts with a Cbuf_AddText ("exec quake.rc\n"); Cbuf_Execute ();
        !            15: 
        !            16: */
        !            17: 
        !            18: 
        !            19: void Cbuf_Init (void);
        !            20: // allocates an initial text buffer that will grow as needed
        !            21: 
        !            22: void Cbuf_AddText (char *text);
        !            23: // as new commands are generated from the console or keybindings,
        !            24: // the text is added to the end of the command buffer.
        !            25: 
        !            26: void Cbuf_InsertText (char *text);
        !            27: // when a command wants to issue other commands immediately, the text is
        !            28: // inserted at the beginning of the buffer, before any remaining unexecuted
        !            29: // commands.
        !            30: 
        !            31: void Cbuf_Execute (void);
        !            32: // Pulls off \n terminated lines of text from the command buffer and sends
        !            33: // them through Cmd_ExecuteString.  Stops when the buffer is empty.
        !            34: // Normally called once per frame, but may be explicitly invoked.
        !            35: // Do not call inside a command function!
        !            36: 
        !            37: //===========================================================================
        !            38: 
        !            39: /*
        !            40: 
        !            41: Command execution takes a null terminated string, breaks it into tokens,
        !            42: then searches for a command or variable that matches the first token.
        !            43: 
        !            44: Commands can come from three sources, but the handler functions may choose
        !            45: to dissallow the action or forward it to a remote server if the source is
        !            46: not apropriate.
        !            47: 
        !            48: */
        !            49: 
        !            50: typedef void (*xcommand_t) (void);
        !            51: 
        !            52: typedef enum
        !            53: {
        !            54:        src_client,             // came in over a net connection as a clc_stringcmd
        !            55:                                        // host_client will be valid during this state.
        !            56:        src_command             // from the command buffer
        !            57: } cmd_source_t;
        !            58: 
        !            59: extern cmd_source_t    cmd_source;
        !            60: 
        !            61: void   Cmd_Init (void);
        !            62: 
        !            63: void   Cmd_AddCommand (char *cmd_name, xcommand_t function);
        !            64: // called by the init functions of other parts of the program to
        !            65: // register commands and functions to call for them.
        !            66: // The cmd_name is referenced later, so it should not be in temp memory
        !            67: 
        !            68: qboolean Cmd_Exists (char *cmd_name);
        !            69: // used by the cvar code to check for cvar / command name overlap
        !            70: 
        !            71: char   *Cmd_CompleteCommand (char *partial);
        !            72: // attempts to match a partial command for automatic command line completion
        !            73: // returns NULL if nothing fits
        !            74: 
        !            75: int            Cmd_Argc (void);
        !            76: char   *Cmd_Argv (int arg);
        !            77: char   *Cmd_Args (void);
        !            78: // The functions that execute commands get their parameters with these
        !            79: // functions. Cmd_Argv () will return an empty string, not a NULL
        !            80: // if arg > argc, so string operations are allways safe.
        !            81: 
        !            82: int Cmd_CheckParm (char *parm);
        !            83: // Returns the position (1 to argc-1) in the command's argument list
        !            84: // where the given parameter apears, or 0 if not present
        !            85: 
        !            86: void Cmd_TokenizeString (char *text);
        !            87: // Takes a null terminated string.  Does not need to be /n terminated.
        !            88: // breaks the string up into arg tokens.
        !            89: 
        !            90: void   Cmd_ExecuteString (char *text, cmd_source_t src);
        !            91: // Parses a single line of text into arguments and tries to execute it.
        !            92: // The text can come from the command buffer, a remote client, or stdin.
        !            93: 
        !            94: void   Cmd_ForwardToServer (void);
        !            95: // adds the current command line as a clc_stringcmd to the client message.
        !            96: // things like godmode, noclip, etc, are commands directed to the server,
        !            97: // so when they are typed in at the console, they will need to be forwarded.
        !            98: 
        !            99: void   Cmd_Print (char *text);
        !           100: // used by command functions to send output to either the graphics console or
        !           101: // passed as a print message to the client
        !           102: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.