ScummVM API documentation
coroutine_protos.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef MTROPOLIS_COROUTINE_PROTOS_H
23 #define MTROPOLIS_COROUTINE_PROTOS_H
24 
25 #include <stddef.h>
26 
27 namespace MTropolis {
28 
29 struct ICoroutineCompiler;
30 struct CompiledCoroutine;
31 
32 struct CoroutineStackFrame2;
33 struct CoroutineParamsBase;
34 struct CoroutineReturnValueRefBase;
35 class CoroutineManager;
36 
37 typedef CoroutineStackFrame2 *(*CoroutineFrameConstructor_t)(void *ptr, const CompiledCoroutine *compiledCoro, const CoroutineParamsBase &params, const CoroutineReturnValueRefBase &returnValueRef);
38 typedef void (*CoroutineGetFrameParametersFunction_t)(size_t &outSize, size_t &outAlignment);
39 typedef void (*CoroutineCompileFunction_t)(ICoroutineCompiler *compiler);
40 
41 
43 };
44 
45 } // End of namespace MTropolis
46 
47 #define CORO_STUB \
48  static void compileCoroutine(ICoroutineCompiler *compiler); \
49  static CompiledCoroutine *ms_compiledCoro;
50 
51 #define CORO_DEFINE_PARAMS_0() \
52  CORO_STUB \
53  struct Params : public CoroutineParamsBase { \
54  }
55 
56 #define CORO_DEFINE_PARAMS_1(type1, name1) \
57  CORO_STUB \
58  struct Params : public CoroutineParamsBase { \
59  typedef type1 ParamType1_t; \
60  \
61  ParamType1_t name1; \
62  \
63  inline explicit Params(const ParamType1_t &p_##name1) \
64  : name1(p_##name1) { \
65  } \
66  \
67  private: \
68  Params() = delete; \
69  }
70 
71 #define CORO_DEFINE_PARAMS_2(type1, name1, type2, name2) \
72  CORO_STUB \
73  struct Params : public CoroutineParamsBase { \
74  typedef type1 ParamType1_t; \
75  typedef type2 ParamType2_t; \
76  \
77  ParamType1_t name1; \
78  ParamType2_t name2; \
79  \
80  explicit Params(const ParamType1_t &p_##name1, const ParamType2_t &p_##name2) \
81  : name1(p_##name1), name2(p_##name2) { \
82  } \
83  \
84  private: \
85  Params() = delete; \
86  }
87 
88 #define CORO_DEFINE_PARAMS_3(type1, name1, type2, name2, type3, name3) \
89  CORO_STUB \
90  struct Params : public CoroutineParamsBase { \
91  typedef type1 ParamType1_t; \
92  typedef type2 ParamType2_t; \
93  typedef type3 ParamType3_t; \
94  \
95  ParamType1_t name1; \
96  ParamType2_t name2; \
97  ParamType3_t name3; \
98  \
99  explicit Params(const ParamType1_t &p_##name1, const ParamType2_t &p_##name2, const ParamType3_t &p_##name3) \
100  : name1(p_##name1), name2(p_##name2), name3(p_##name3) { \
101  } \
102  \
103  private: \
104  Params() = delete; \
105  }
106 
107 #define CORO_DEFINE_PARAMS_4(type1, name1, type2, name2, type3, name3, type4, name4) \
108  CORO_STUB \
109  struct Params : public CoroutineParamsBase { \
110  typedef type1 ParamType1_t; \
111  typedef type2 ParamType2_t; \
112  typedef type3 ParamType3_t; \
113  typedef type4 ParamType4_t; \
114  \
115  ParamType1_t name1; \
116  ParamType2_t name2; \
117  ParamType3_t name3; \
118  ParamType4_t name4; \
119  \
120  explicit Params(const ParamType1_t &p_##name1, const ParamType2_t &p_##name2, const ParamType3_t &p_##name3, const ParamType4_t &p_##name4) \
121  : name1(p_##name1), name2(p_##name2), name3(p_##name3), name4(p_##name4) { \
122  } \
123  \
124  private: \
125  Params() = delete; \
126  }
127 
128 #define CORO_DEFINE_RETURN_TYPE(type) \
129  typedef type ReturnValue_t
130 
131 #endif
Definition: coroutine_protos.h:42
Definition: actions.h:25