orx  stable
Portable Game Engine
OrxCommand

Data Structures

struct  orxCOMMAND_VAR
 
struct  orxCOMMAND_VAR_DEF
 

Macros

#define orxCOMMAND_KC_BLOCK_MARKER   '"'
 
#define orxCOMMAND_KC_GUID_MARKER   '^'
 
#define orxCOMMAND_KC_POP_MARKER   '<'
 
#define orxCOMMAND_KC_PUSH_MARKER   '>'
 
#define orxCOMMAND_REGISTER_CORE_COMMAND(MODULE, COMMAND, RESULT_NAME, RESULT_TYPE, REQ_PARAM_NUMBER, OPT_PARAM_NUMBER, ...)
 
#define orxCOMMAND_UNREGISTER_CORE_COMMAND(MODULE, COMMAND)
 

Typedefs

typedef void(orxFASTCALL * orxCOMMAND_FUNCTION) (orxU32 _u32ArgNumber, const orxCOMMAND_VAR *_astArgList, orxCOMMAND_VAR *_pstResult)
 

Enumerations

enum  orxCOMMAND_VAR_TYPE {
  orxCOMMAND_VAR_TYPE_STRING = 0, orxCOMMAND_VAR_TYPE_FLOAT, orxCOMMAND_VAR_TYPE_S32, orxCOMMAND_VAR_TYPE_U32,
  orxCOMMAND_VAR_TYPE_S64, orxCOMMAND_VAR_TYPE_U64, orxCOMMAND_VAR_TYPE_BOOL, orxCOMMAND_VAR_TYPE_VECTOR,
  orxCOMMAND_VAR_TYPE_NUMERIC, orxCOMMAND_VAR_TYPE_NUMBER, orxCOMMAND_VAR_TYPE_NONE = orxENUM_NONE
}
 

Functions

orxDLLAPI orxSTATUS orxFASTCALL orxCommand_AddAlias (const orxSTRING _zAlias, const orxSTRING _zCommand, const orxSTRING _zArgs)
 
orxDLLAPI orxCOMMAND_VAR *orxFASTCALL orxCommand_Evaluate (const orxSTRING _zCommandLine, orxCOMMAND_VAR *_pstResult)
 
orxDLLAPI orxCOMMAND_VAR *orxFASTCALL orxCommand_Execute (const orxSTRING _zCommand, orxU32 _u32ArgNumber, const orxCOMMAND_VAR *_astArgList, orxCOMMAND_VAR *_pstResult)
 
orxDLLAPI void orxFASTCALL orxCommand_Exit ()
 
orxDLLAPI const orxSTRING orxFASTCALL orxCommand_GetNext (const orxSTRING _zBase, const orxSTRING _zPrevious, orxU32 *_pu32CommonLength)
 
orxDLLAPI const orxSTRING orxFASTCALL orxCommand_GetPrototype (const orxSTRING _zCommand)
 
orxDLLAPI orxSTATUS orxFASTCALL orxCommand_Init ()
 
orxDLLAPI orxBOOL orxFASTCALL orxCommand_IsAlias (const orxSTRING _zAlias)
 
orxDLLAPI orxBOOL orxFASTCALL orxCommand_IsRegistered (const orxSTRING _zCommand)
 
orxDLLAPI orxSTATUS orxFASTCALL orxCommand_ParseNumericalArguments (orxU32 _u32ArgNumber, const orxCOMMAND_VAR *_astArgList, orxCOMMAND_VAR *_astOperandList)
 
orxDLLAPI orxU32 orxFASTCALL orxCommand_PrintVar (orxSTRING _zDstString, orxU32 _u32Size, const orxCOMMAND_VAR *_pstVar)
 
orxDLLAPI orxSTATUS orxFASTCALL orxCommand_Register (const orxSTRING _zCommand, const orxCOMMAND_FUNCTION _pfnFunction, orxU32 _u32RequiredParamNumber, orxU32 _u32OptionalParamNumber, const orxCOMMAND_VAR_DEF *_astParamList, const orxCOMMAND_VAR_DEF *_pstResult)
 
orxDLLAPI orxSTATUS orxFASTCALL orxCommand_RemoveAlias (const orxSTRING _zAlias)
 
orxDLLAPI void orxFASTCALL orxCommand_Setup ()
 
orxDLLAPI orxSTATUS orxFASTCALL orxCommand_Unregister (const orxSTRING _zCommand)
 

Detailed Description

Command module Module that can execute custom registered commands.

Macro Definition Documentation

#define orxCOMMAND_KC_BLOCK_MARKER   '"'

MiscBlock marker character

Definition at line 50 of file orxCommand.h.

#define orxCOMMAND_KC_GUID_MARKER   '^'

GUID marker character

Definition at line 53 of file orxCommand.h.

#define orxCOMMAND_KC_POP_MARKER   '<'

Pop marker character

Definition at line 52 of file orxCommand.h.

#define orxCOMMAND_KC_PUSH_MARKER   '>'

Push marker character

Definition at line 51 of file orxCommand.h.

#define orxCOMMAND_REGISTER_CORE_COMMAND (   MODULE,
  COMMAND,
  RESULT_NAME,
  RESULT_TYPE,
  REQ_PARAM_NUMBER,
  OPT_PARAM_NUMBER,
  ... 
)
Value:
do \
{ \
orxCOMMAND_VAR_DEF stResult; \
orxCOMMAND_VAR_DEF astParamList[REQ_PARAM_NUMBER + OPT_PARAM_NUMBER + 1] = {{"Dummy", orxCOMMAND_VAR_TYPE_NONE}, __VA_ARGS__}; \
orxSTATUS eStatus; \
stResult.eType = RESULT_TYPE; \
stResult.zName = RESULT_NAME; \
eStatus = orxCommand_Register(#MODULE"."#COMMAND, &orx##MODULE##_Command##COMMAND, REQ_PARAM_NUMBER, OPT_PARAM_NUMBER, &astParamList[1], &stResult);\
} while(orxFALSE)
orxDLLAPI orxSTATUS orxFASTCALL orxCommand_Register(const orxSTRING _zCommand, const orxCOMMAND_FUNCTION _pfnFunction, orxU32 _u32RequiredParamNumber, orxU32 _u32OptionalParamNumber, const orxCOMMAND_VAR_DEF *_astParamList, const orxCOMMAND_VAR_DEF *_pstResult)
#define orxFALSE
Definition: orxType.h:185
#define orxASSERT(TEST,...)
Definition: orxDebug.h:298

Command registration helpers

Definition at line 111 of file orxCommand.h.

#define orxCOMMAND_UNREGISTER_CORE_COMMAND (   MODULE,
  COMMAND 
)
Value:
do \
{ \
orxCommand_Unregister(#MODULE"."#COMMAND); \
} while(orxFALSE)
#define orxFALSE
Definition: orxType.h:185
orxDLLAPI orxSTATUS orxFASTCALL orxCommand_Unregister(const orxSTRING _zCommand)

Definition at line 123 of file orxCommand.h.

Typedef Documentation

typedef void(orxFASTCALL * orxCOMMAND_FUNCTION) (orxU32 _u32ArgNumber, const orxCOMMAND_VAR *_astArgList, orxCOMMAND_VAR *_pstResult)

Command function type

Definition at line 106 of file orxCommand.h.

Enumeration Type Documentation

Variable type enum

Enumerator
orxCOMMAND_VAR_TYPE_STRING 
orxCOMMAND_VAR_TYPE_FLOAT 
orxCOMMAND_VAR_TYPE_S32 
orxCOMMAND_VAR_TYPE_U32 
orxCOMMAND_VAR_TYPE_S64 
orxCOMMAND_VAR_TYPE_U64 
orxCOMMAND_VAR_TYPE_BOOL 
orxCOMMAND_VAR_TYPE_VECTOR 
orxCOMMAND_VAR_TYPE_NUMERIC 
orxCOMMAND_VAR_TYPE_NUMBER 
orxCOMMAND_VAR_TYPE_NONE 

Definition at line 58 of file orxCommand.h.

Function Documentation

orxDLLAPI orxSTATUS orxFASTCALL orxCommand_AddAlias ( const orxSTRING  _zAlias,
const orxSTRING  _zCommand,
const orxSTRING  _zArgs 
)

Adds a command alias

Parameters
[in]_zAliasCommand alias
[in]_zCommandCommand name
[in]_zArgsCommand argument, orxNULL for none
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE
orxDLLAPI orxCOMMAND_VAR* orxFASTCALL orxCommand_Evaluate ( const orxSTRING  _zCommandLine,
orxCOMMAND_VAR _pstResult 
)

Evaluates a command

Parameters
[in]_zCommandLineCommand name + arguments
[out]_pstResultVariable that will contain the result
Returns
Command result if found, orxNULL otherwise
orxDLLAPI orxCOMMAND_VAR* orxFASTCALL orxCommand_Execute ( const orxSTRING  _zCommand,
orxU32  _u32ArgNumber,
const orxCOMMAND_VAR _astArgList,
orxCOMMAND_VAR _pstResult 
)

Executes a command

Parameters
[in]_zCommandCommand name
[in]_u32ArgNumberNumber of arguments sent to the command
[in]_astArgListList of arguments sent to the command
[out]_pstResultVariable that will contain the result
Returns
Command result if found, orxNULL otherwise
orxDLLAPI void orxFASTCALL orxCommand_Exit ( )

Exits from the command module

orxDLLAPI const orxSTRING orxFASTCALL orxCommand_GetNext ( const orxSTRING  _zBase,
const orxSTRING  _zPrevious,
orxU32 *  _pu32CommonLength 
)

Gets next command using an optional base

Parameters
[in]_zBaseBase name, can be set to orxNULL for no base
[in]_zPreviousPrevious command, orxNULL to get the first command
[out]_pu32CommonLengthLength of the common prefix of all potential results, orxNULL to ignore
Returns
Next command found, orxNULL if none
orxDLLAPI const orxSTRING orxFASTCALL orxCommand_GetPrototype ( const orxSTRING  _zCommand)

Gets a command's (text) prototype (beware: result won't persist from one call to the other)

Parameters
[in]_zCommandCommand name
Returns
Command prototype / orxSTRING_EMPTY
orxDLLAPI orxSTATUS orxFASTCALL orxCommand_Init ( )

Inits the command module

Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE
orxDLLAPI orxBOOL orxFASTCALL orxCommand_IsAlias ( const orxSTRING  _zAlias)

Is a command alias?

Parameters
[in]_zAliasCommand alias
Returns
orxTRUE / orxFALSE
orxDLLAPI orxBOOL orxFASTCALL orxCommand_IsRegistered ( const orxSTRING  _zCommand)

Is a command registered?

Parameters
[in]_zCommandCommand name
Returns
orxTRUE / orxFALSE
orxDLLAPI orxSTATUS orxFASTCALL orxCommand_ParseNumericalArguments ( orxU32  _u32ArgNumber,
const orxCOMMAND_VAR _astArgList,
orxCOMMAND_VAR _astOperandList 
)

Parses numerical arguments, string arguments will be evaluated to vectors or float when possible

Parameters
[in]_u32ArgNumberNumber of arguments to parse
[in]_astArgListList of arguments to parse
[out]_astOperandListList of parsed arguments
Returns
orxSTATUS_SUCCESS if all numerical arguments have been correctly interpreted, orxSTATUS_FAILURE otherwise
orxDLLAPI orxU32 orxFASTCALL orxCommand_PrintVar ( orxSTRING  _zDstString,
orxU32  _u32Size,
const orxCOMMAND_VAR _pstVar 
)

Prints a variable to a buffer, according to its type (and ignoring any bloc/special character)

Parameters
[out]_zDstStringDestination string
[in]_u32SizeString available size
[in]_pstVarVariable to print
Returns
Number of written characters (excluding trailing orxCHAR_NULL)
orxDLLAPI orxSTATUS orxFASTCALL orxCommand_Register ( const orxSTRING  _zCommand,
const orxCOMMAND_FUNCTION  _pfnFunction,
orxU32  _u32RequiredParamNumber,
orxU32  _u32OptionalParamNumber,
const orxCOMMAND_VAR_DEF _astParamList,
const orxCOMMAND_VAR_DEF _pstResult 
)

Registers a command

Parameters
[in]_zCommandCommand name
[in]_pfnFunctionAssociated function
[in]_u32RequiredParamNumberNumber of required parameters of the command
[in]_u32OptionalParamNumberNumber of optional parameters of the command
[in]_astParamListList of parameters of the command
[in]_pstResultResult
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE
orxDLLAPI orxSTATUS orxFASTCALL orxCommand_RemoveAlias ( const orxSTRING  _zAlias)

Removes a command alias

Parameters
[in]_zAliasCommand alias
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE
orxDLLAPI void orxFASTCALL orxCommand_Setup ( )

Command module setup

orxDLLAPI orxSTATUS orxFASTCALL orxCommand_Unregister ( const orxSTRING  _zCommand)

Unregisters a command

Parameters
[in]_zCommandCommand name
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

Generated for orx by doxygen 1.5.6