orx 1.16
Portable Game Engine
Loading...
Searching...
No Matches
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_KC_SEPARATOR   ','
#define orxCOMMAND_REGISTER(NAME, FUNCTION, RESULT_NAME, RESULT_TYPE, REQ_PARAM_NUMBER, OPT_PARAM_NUMBER, ...)
#define orxCOMMAND_REGISTER_CORE_COMMAND(MODULE, COMMAND, RESULT_NAME, RESULT_TYPE, REQ_PARAM_NUMBER, OPT_PARAM_NUMBER, ...)
#define orxCOMMAND_UNREGISTER(NAME)
#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_EvaluateWithGUID (const orxSTRING _zCommandLine, orxU64 _u64GUID, 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

◆ orxCOMMAND_KC_BLOCK_MARKER

#define orxCOMMAND_KC_BLOCK_MARKER   '"'

Misc Block marker character

Definition at line 50 of file orxCommand.h.

◆ orxCOMMAND_KC_GUID_MARKER

#define orxCOMMAND_KC_GUID_MARKER   '^'

GUID marker character

Definition at line 53 of file orxCommand.h.

◆ orxCOMMAND_KC_POP_MARKER

#define orxCOMMAND_KC_POP_MARKER   '<'

Pop marker character

Definition at line 52 of file orxCommand.h.

◆ orxCOMMAND_KC_PUSH_MARKER

#define orxCOMMAND_KC_PUSH_MARKER   '>'

Push marker character

Definition at line 51 of file orxCommand.h.

◆ orxCOMMAND_KC_SEPARATOR

#define orxCOMMAND_KC_SEPARATOR   ','

Command separator character

Definition at line 54 of file orxCommand.h.

◆ orxCOMMAND_REGISTER

#define orxCOMMAND_REGISTER ( NAME,
FUNCTION,
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(NAME, &FUNCTION, REQ_PARAM_NUMBER, OPT_PARAM_NUMBER, &astParamList[1], &stResult); \
orxASSERT(eStatus != orxSTATUS_FAILURE); \
} 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)
@ orxCOMMAND_VAR_TYPE_NONE
Definition orxCommand.h:73
orxSTATUS
Definition orxType.h:270
#define orxFALSE
Definition orxType.h:210
@ orxSTATUS_FAILURE
Definition orxType.h:271
orxCOMMAND_VAR_TYPE eType
Definition orxCommand.h:83
const orxSTRING zName
Definition orxCommand.h:82

Definition at line 130 of file orxCommand.h.

◆ orxCOMMAND_REGISTER_CORE_COMMAND

#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);\
orxASSERT(eStatus != orxSTATUS_FAILURE); \
} while(orxFALSE)

Command registration helpers

Definition at line 112 of file orxCommand.h.

◆ orxCOMMAND_UNREGISTER

#define orxCOMMAND_UNREGISTER ( NAME)
Value:
do \
{ \
orxCommand_Unregister(NAME); \
} while(orxFALSE)

Definition at line 142 of file orxCommand.h.

◆ orxCOMMAND_UNREGISTER_CORE_COMMAND

#define orxCOMMAND_UNREGISTER_CORE_COMMAND ( MODULE,
COMMAND )
Value:
do \
{ \
orxCommand_Unregister(#MODULE"."#COMMAND); \
} while(orxFALSE)

Definition at line 124 of file orxCommand.h.

Typedef Documentation

◆ orxCOMMAND_FUNCTION

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

Command function type

Definition at line 107 of file orxCommand.h.

Enumeration Type Documentation

◆ orxCOMMAND_VAR_TYPE

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 59 of file orxCommand.h.

Function Documentation

◆ orxCommand_AddAlias()

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

Adds a command alias

Parameters
[in]_zAliasCommand alias
[in]_zCommandCommand name
[in]_zArgsCommand argument, orxNULL for none
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

◆ orxCommand_Evaluate()

orxDLLAPI orxCOMMAND_VAR *orxFASTCALL orxCommand_Evaluate ( const orxSTRING _zCommandLine,
orxCOMMAND_VAR * _pstResult )
extern

Evaluates a command

Parameters
[in]_zCommandLineCommand name + arguments
[out]_pstResultVariable that will contain the result
Returns
Command result if found, orxNULL otherwise

◆ orxCommand_EvaluateWithGUID()

orxDLLAPI orxCOMMAND_VAR *orxFASTCALL orxCommand_EvaluateWithGUID ( const orxSTRING _zCommandLine,
orxU64 _u64GUID,
orxCOMMAND_VAR * _pstResult )
extern

Evaluates a command with a specific GUID

Parameters
[in]_zCommandLineCommand name + arguments
[in]_u64GUIDGUID to use in place of the GUID markers in the command
[out]_pstResultVariable that will contain the result
Returns
Command result if found, orxNULL otherwise

◆ orxCommand_Execute()

orxDLLAPI orxCOMMAND_VAR *orxFASTCALL orxCommand_Execute ( const orxSTRING _zCommand,
orxU32 _u32ArgNumber,
const orxCOMMAND_VAR * _astArgList,
orxCOMMAND_VAR * _pstResult )
extern

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

◆ orxCommand_Exit()

orxDLLAPI void orxFASTCALL orxCommand_Exit ( )
extern

Exits from the command module

◆ orxCommand_GetNext()

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

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

◆ orxCommand_GetPrototype()

orxDLLAPI const orxSTRING orxFASTCALL orxCommand_GetPrototype ( const orxSTRING _zCommand)
extern

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

◆ orxCommand_Init()

orxDLLAPI orxSTATUS orxFASTCALL orxCommand_Init ( )
extern

Inits the command module

Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

◆ orxCommand_IsAlias()

orxDLLAPI orxBOOL orxFASTCALL orxCommand_IsAlias ( const orxSTRING _zAlias)
extern

Is a command alias?

Parameters
[in]_zAliasCommand alias
Returns
orxTRUE / orxFALSE

◆ orxCommand_IsRegistered()

orxDLLAPI orxBOOL orxFASTCALL orxCommand_IsRegistered ( const orxSTRING _zCommand)
extern

Is a command registered?

Parameters
[in]_zCommandCommand name
Returns
orxTRUE / orxFALSE

◆ orxCommand_ParseNumericalArguments()

orxDLLAPI orxSTATUS orxFASTCALL orxCommand_ParseNumericalArguments ( orxU32 _u32ArgNumber,
const orxCOMMAND_VAR * _astArgList,
orxCOMMAND_VAR * _astOperandList )
extern

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

◆ orxCommand_PrintVar()

orxDLLAPI orxU32 orxFASTCALL orxCommand_PrintVar ( orxSTRING _zDstString,
orxU32 _u32Size,
const orxCOMMAND_VAR * _pstVar )
extern

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

Parameters
[out]_zDstStringDestination string
[in]_u32SizeAvailable string size, including terminating null character
[in]_pstVarVariable to print
Returns
Number of written characters, excluding terminating null character

◆ orxCommand_Register()

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 )
extern

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

◆ orxCommand_RemoveAlias()

orxDLLAPI orxSTATUS orxFASTCALL orxCommand_RemoveAlias ( const orxSTRING _zAlias)
extern

Removes a command alias

Parameters
[in]_zAliasCommand alias
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

◆ orxCommand_Setup()

orxDLLAPI void orxFASTCALL orxCommand_Setup ( )
extern

Command module setup

◆ orxCommand_Unregister()

orxDLLAPI orxSTATUS orxFASTCALL orxCommand_Unregister ( const orxSTRING _zCommand)
extern

Unregisters a command

Parameters
[in]_zCommandCommand name
Returns
orxSTATUS_SUCCESS / orxSTATUS_FAILURE

Generated for orx by doxygen 1.8.11