orx  stable
Portable Game Engine
orxCommand.h
Go to the documentation of this file.
1 /* Orx - Portable Game Engine
2  *
3  * Copyright (c) 2008-2017 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 '^'
58 typedef enum __orxCOMMAND_VAR_TYPE_t
59 {
69 
71 
72  orxCOMMAND_VAR_TYPE_NONE = orxENUM_NONE
73 
75 
76 
79 typedef struct __orxCOMMAND_VAR_DEF_t
80 {
81  const orxSTRING zName;
85 
87 typedef struct __orxCOMMAND_VAR_t
88 {
89  union
90  {
92  const orxSTRING zValue;
93  orxU32 u32Value;
94  orxS32 s32Value;
95  orxU64 u64Value;
96  orxS64 s64Value;
97  orxFLOAT fValue;
98  orxBOOL bValue;
99  };
100 
104 
106 typedef void (orxFASTCALL *orxCOMMAND_FUNCTION)(orxU32 _u32ArgNumber, const orxCOMMAND_VAR *_astArgList, orxCOMMAND_VAR *_pstResult);
107 
108 
111 #define orxCOMMAND_REGISTER_CORE_COMMAND(MODULE, COMMAND, RESULT_NAME, RESULT_TYPE, REQ_PARAM_NUMBER, OPT_PARAM_NUMBER, ...) \
112 do \
113 { \
114  orxCOMMAND_VAR_DEF stResult; \
115  orxCOMMAND_VAR_DEF astParamList[REQ_PARAM_NUMBER + OPT_PARAM_NUMBER + 1] = {{"Dummy", orxCOMMAND_VAR_TYPE_NONE}, __VA_ARGS__}; \
116  orxSTATUS eStatus; \
117  stResult.eType = RESULT_TYPE; \
118  stResult.zName = RESULT_NAME; \
119  eStatus = orxCommand_Register(#MODULE"."#COMMAND, &orx##MODULE##_Command##COMMAND, REQ_PARAM_NUMBER, OPT_PARAM_NUMBER, &astParamList[1], &stResult);\
120  orxASSERT(eStatus != orxSTATUS_FAILURE); \
121 } while(orxFALSE)
122 
123 #define orxCOMMAND_UNREGISTER_CORE_COMMAND(MODULE, COMMAND) \
124 do \
125 { \
126  orxCommand_Unregister(#MODULE"."#COMMAND); \
127 } while(orxFALSE)
128 
129 
132 extern orxDLLAPI void orxFASTCALL orxCommand_Setup();
133 
137 extern orxDLLAPI orxSTATUS orxFASTCALL orxCommand_Init();
138 
141 extern orxDLLAPI void orxFASTCALL orxCommand_Exit();
142 
143 
153 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);
154 
159 extern orxDLLAPI orxSTATUS orxFASTCALL orxCommand_Unregister(const orxSTRING _zCommand);
160 
165 extern orxDLLAPI orxBOOL orxFASTCALL orxCommand_IsRegistered(const orxSTRING _zCommand);
166 
167 
174 extern orxDLLAPI orxSTATUS orxFASTCALL orxCommand_AddAlias(const orxSTRING _zAlias, const orxSTRING _zCommand, const orxSTRING _zArgs);
175 
180 extern orxDLLAPI orxSTATUS orxFASTCALL orxCommand_RemoveAlias(const orxSTRING _zAlias);
181 
186 extern orxDLLAPI orxBOOL orxFASTCALL orxCommand_IsAlias(const orxSTRING _zAlias);
187 
188 
193 extern orxDLLAPI const orxSTRING orxFASTCALL orxCommand_GetPrototype(const orxSTRING _zCommand);
194 
201 extern orxDLLAPI const orxSTRING orxFASTCALL orxCommand_GetNext(const orxSTRING _zBase, const orxSTRING _zPrevious, orxU32 *_pu32CommonLength);
202 
203 
209 extern orxDLLAPI orxCOMMAND_VAR *orxFASTCALL orxCommand_Evaluate(const orxSTRING _zCommandLine, orxCOMMAND_VAR *_pstResult);
210 
218 extern orxDLLAPI orxCOMMAND_VAR *orxFASTCALL orxCommand_Execute(const orxSTRING _zCommand, orxU32 _u32ArgNumber, const orxCOMMAND_VAR *_astArgList, orxCOMMAND_VAR *_pstResult);
219 
220 
227 extern orxDLLAPI orxSTATUS orxFASTCALL orxCommand_ParseNumericalArguments(orxU32 _u32ArgNumber, const orxCOMMAND_VAR *_astArgList, orxCOMMAND_VAR *_astOperandList);
228 
235 extern orxDLLAPI orxU32 orxFASTCALL orxCommand_PrintVar(orxSTRING _zDstString, orxU32 _u32Size, const orxCOMMAND_VAR *_pstVar);
236 
237 
238 #endif /* _orxCOMMAND_H_ */
239 
orxDLLAPI const orxSTRING orxFASTCALL orxCommand_GetPrototype(const orxSTRING _zCommand)
orxVECTOR vValue
Definition: orxCommand.h:91
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:82
orxS64 s64Value
Definition: orxCommand.h:96
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:81
void(orxFASTCALL * orxCOMMAND_FUNCTION)(orxU32 _u32ArgNumber, const orxCOMMAND_VAR *_astArgList, orxCOMMAND_VAR *_pstResult)
Definition: orxCommand.h:106
orxDLLAPI orxCOMMAND_VAR *orxFASTCALL orxCommand_Evaluate(const orxSTRING _zCommandLine, orxCOMMAND_VAR *_pstResult)
orxS32 s32Value
Definition: orxCommand.h:94
orxDLLAPI orxU32 orxFASTCALL orxCommand_PrintVar(orxSTRING _zDstString, orxU32 _u32Size, const orxCOMMAND_VAR *_pstVar)
orxFLOAT fValue
Definition: orxCommand.h:97
orxSTATUS
Definition: orxType.h:243
orxDLLAPI orxBOOL orxFASTCALL orxCommand_IsAlias(const orxSTRING _zAlias)
orxU64 u64Value
Definition: orxCommand.h:95
typedef void(orxFASTCALL *orxMODULE_EXIT_FUNCTION)()
#define orxDLLAPI
Definition: orxDecl.h:387
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:101
orxDLLAPI orxSTATUS orxFASTCALL orxCommand_Unregister(const orxSTRING _zCommand)
const orxSTRING zValue
Definition: orxCommand.h:92
orxU32 u32Value
Definition: orxCommand.h:93
orxBOOL bValue
Definition: orxCommand.h:98
orxCOMMAND_VAR_TYPE
Definition: orxCommand.h:58

Generated for orx by doxygen 1.5.6