orx  1.9
Portable Game Engine
orxCommand.h
Go to the documentation of this file.
1 /* Orx - Portable Game Engine
2  *
3  * Copyright (c) 2008-2018 Orx-Project
4  *
5  * This software is provided 'as-is', without any express or implied
6  * warranty. In no event will the authors be held liable for any damages
7  * arising from the use of this software.
8  *
9  * Permission is granted to anyone to use this software for any purpose,
10  * including commercial applications, and to alter it and redistribute it
11  * freely, subject to the following restrictions:
12  *
13  * 1. The origin of this software must not be misrepresented; you must not
14  * claim that you wrote the original software. If you use this software
15  * in a product, an acknowledgment in the product documentation would be
16  * appreciated but is not required.
17  *
18  * 2. Altered source versions must be plainly marked as such, and must not be
19  * misrepresented as being the original software.
20  *
21  * 3. This notice may not be removed or altered from any source
22  * distribution.
23  */
24 
40 #ifndef _orxCOMMAND_H_
41 #define _orxCOMMAND_H_
42 
43 
44 #include "orxInclude.h"
45 #include "math/orxVector.h"
46 
47 
50 #define orxCOMMAND_KC_BLOCK_MARKER '"'
51 #define orxCOMMAND_KC_PUSH_MARKER '>'
52 #define orxCOMMAND_KC_POP_MARKER '<'
53 #define orxCOMMAND_KC_GUID_MARKER '^'
54 #define orxCOMMAND_KC_SEPARATOR ','
59 typedef enum __orxCOMMAND_VAR_TYPE_t
60 {
70 
72 
73  orxCOMMAND_VAR_TYPE_NONE = orxENUM_NONE
74 
76 
77 
80 typedef struct __orxCOMMAND_VAR_DEF_t
81 {
82  const orxSTRING zName;
86 
88 typedef struct __orxCOMMAND_VAR_t
89 {
90  union
91  {
93  const orxSTRING zValue;
94  orxU32 u32Value;
95  orxS32 s32Value;
96  orxU64 u64Value;
97  orxS64 s64Value;
98  orxFLOAT fValue;
99  orxBOOL bValue;
100  };
101 
105 
107 typedef void (orxFASTCALL *orxCOMMAND_FUNCTION)(orxU32 _u32ArgNumber, const orxCOMMAND_VAR *_astArgList, orxCOMMAND_VAR *_pstResult);
108 
109 
112 #define orxCOMMAND_REGISTER_CORE_COMMAND(MODULE, COMMAND, RESULT_NAME, RESULT_TYPE, REQ_PARAM_NUMBER, OPT_PARAM_NUMBER, ...) \
113 do \
114 { \
115  orxCOMMAND_VAR_DEF stResult; \
116  orxCOMMAND_VAR_DEF astParamList[REQ_PARAM_NUMBER + OPT_PARAM_NUMBER + 1] = {{"Dummy", orxCOMMAND_VAR_TYPE_NONE}, __VA_ARGS__}; \
117  orxSTATUS eStatus; \
118  stResult.eType = RESULT_TYPE; \
119  stResult.zName = RESULT_NAME; \
120  eStatus = orxCommand_Register(#MODULE"."#COMMAND, &orx##MODULE##_Command##COMMAND, REQ_PARAM_NUMBER, OPT_PARAM_NUMBER, &astParamList[1], &stResult);\
121  orxASSERT(eStatus != orxSTATUS_FAILURE); \
122 } while(orxFALSE)
123 
124 #define orxCOMMAND_UNREGISTER_CORE_COMMAND(MODULE, COMMAND) \
125 do \
126 { \
127  orxCommand_Unregister(#MODULE"."#COMMAND); \
128 } while(orxFALSE)
129 
130 
133 extern orxDLLAPI void orxFASTCALL orxCommand_Setup();
134 
138 extern orxDLLAPI orxSTATUS orxFASTCALL orxCommand_Init();
139 
142 extern orxDLLAPI void orxFASTCALL orxCommand_Exit();
143 
144 
154 extern 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);
155 
160 extern orxDLLAPI orxSTATUS orxFASTCALL orxCommand_Unregister(const orxSTRING _zCommand);
161 
166 extern orxDLLAPI orxBOOL orxFASTCALL orxCommand_IsRegistered(const orxSTRING _zCommand);
167 
168 
175 extern orxDLLAPI orxSTATUS orxFASTCALL orxCommand_AddAlias(const orxSTRING _zAlias, const orxSTRING _zCommand, const orxSTRING _zArgs);
176 
181 extern orxDLLAPI orxSTATUS orxFASTCALL orxCommand_RemoveAlias(const orxSTRING _zAlias);
182 
187 extern orxDLLAPI orxBOOL orxFASTCALL orxCommand_IsAlias(const orxSTRING _zAlias);
188 
189 
194 extern orxDLLAPI const orxSTRING orxFASTCALL orxCommand_GetPrototype(const orxSTRING _zCommand);
195 
202 extern orxDLLAPI const orxSTRING orxFASTCALL orxCommand_GetNext(const orxSTRING _zBase, const orxSTRING _zPrevious, orxU32 *_pu32CommonLength);
203 
204 
210 extern orxDLLAPI orxCOMMAND_VAR *orxFASTCALL orxCommand_Evaluate(const orxSTRING _zCommandLine, orxCOMMAND_VAR *_pstResult);
211 
219 extern orxDLLAPI orxCOMMAND_VAR *orxFASTCALL orxCommand_Execute(const orxSTRING _zCommand, orxU32 _u32ArgNumber, const orxCOMMAND_VAR *_astArgList, orxCOMMAND_VAR *_pstResult);
220 
221 
228 extern orxDLLAPI orxSTATUS orxFASTCALL orxCommand_ParseNumericalArguments(orxU32 _u32ArgNumber, const orxCOMMAND_VAR *_astArgList, orxCOMMAND_VAR *_astOperandList);
229 
236 extern orxDLLAPI orxU32 orxFASTCALL orxCommand_PrintVar(orxSTRING _zDstString, orxU32 _u32Size, const orxCOMMAND_VAR *_pstVar);
237 
238 
239 #endif /* _orxCOMMAND_H_ */
240 
orxDLLAPI const orxSTRING orxFASTCALL orxCommand_GetPrototype(const orxSTRING _zCommand)
orxVECTOR vValue
Definition: orxCommand.h:92
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_AddAlias(const orxSTRING _zAlias, const orxSTRING _zCommand, const orxSTRING _zArgs)
orxDLLAPI void orxFASTCALL orxCommand_Exit()
orxDLLAPI orxSTATUS orxFASTCALL orxCommand_RemoveAlias(const orxSTRING _zAlias)
orxDLLAPI void orxFASTCALL orxCommand_Setup()
orxCOMMAND_VAR_TYPE eType
Definition: orxCommand.h:83
orxS64 s64Value
Definition: orxCommand.h:97
orxDLLAPI orxSTATUS orxFASTCALL orxCommand_ParseNumericalArguments(orxU32 _u32ArgNumber, const orxCOMMAND_VAR *_astArgList, orxCOMMAND_VAR *_astOperandList)
orxDLLAPI orxBOOL orxFASTCALL orxCommand_IsRegistered(const orxSTRING _zCommand)
orxDLLAPI orxSTATUS orxFASTCALL orxCommand_Init()
const orxSTRING zName
Definition: orxCommand.h:82
void(orxFASTCALL * orxCOMMAND_FUNCTION)(orxU32 _u32ArgNumber, const orxCOMMAND_VAR *_astArgList, orxCOMMAND_VAR *_pstResult)
Definition: orxCommand.h:107
orxDLLAPI orxCOMMAND_VAR *orxFASTCALL orxCommand_Evaluate(const orxSTRING _zCommandLine, orxCOMMAND_VAR *_pstResult)
orxS32 s32Value
Definition: orxCommand.h:95
orxDLLAPI orxU32 orxFASTCALL orxCommand_PrintVar(orxSTRING _zDstString, orxU32 _u32Size, const orxCOMMAND_VAR *_pstVar)
orxFLOAT fValue
Definition: orxCommand.h:98
orxSTATUS
Definition: orxType.h:243
orxDLLAPI orxBOOL orxFASTCALL orxCommand_IsAlias(const orxSTRING _zAlias)
orxU64 u64Value
Definition: orxCommand.h:96
typedef void(orxFASTCALL *orxMODULE_EXIT_FUNCTION)()
#define orxDLLAPI
Definition: orxDecl.h:394
orxDLLAPI orxCOMMAND_VAR *orxFASTCALL orxCommand_Execute(const orxSTRING _zCommand, orxU32 _u32ArgNumber, const orxCOMMAND_VAR *_astArgList, orxCOMMAND_VAR *_pstResult)
orxDLLAPI const orxSTRING orxFASTCALL orxCommand_GetNext(const orxSTRING _zBase, const orxSTRING _zPrevious, orxU32 *_pu32CommonLength)
orxCOMMAND_VAR_TYPE eType
Definition: orxCommand.h:102
orxDLLAPI orxSTATUS orxFASTCALL orxCommand_Unregister(const orxSTRING _zCommand)
const orxSTRING zValue
Definition: orxCommand.h:93
orxU32 u32Value
Definition: orxCommand.h:94
orxBOOL bValue
Definition: orxCommand.h:99
orxCOMMAND_VAR_TYPE
Definition: orxCommand.h:59

Generated for orx by doxygen 1.8.11