libGimbal 0.1.0
C17-Based Extended Standard Library and Cross-Language Runtime Framework
Loading...
Searching...
No Matches
gimbal_ctx.h File Reference

Go to the source code of this file.

Macros

#define GBL_CTX_FRAME_DECLARE
 
#define GBL_CTX_FRAME()
 
#define GBL_CTX_CONTEXT()
 
#define GBL_CTX_OBJECT()
 
#define GBL_CTX_RECORD()
 
#define GBL_CTX_RESULT()
 
#define GBL_CTX_SOURCE()
 
#define GBL_CTX_LAST_RECORD()
 
#define GBL_CTX_LAST_RESULT()
 
#define GBL_SRC_FILE
 
#define GBL_SRC_FN
 
#define GBL_SRC_LN
 
#define GBL_SRC_LOC
 
#define GblSrcLoc
 
#define GBL_SOURCE_LOCATION(FILE, FUNCTION, LINE)
 
#define GBL_CTX_STACK_FRAME_SOURCE_PUSH(pStackFrame, current)
 
#define GBL_CTX_STACK_FRAME_SOURCE_POP(pStackFrame)
 
#define GBL_CTX_SOURCE_LOC_PUSH(srcLoc)
 
#define GBL_CTX_SOURCE_PUSH(FILE, FUNCTION, LINE)
 
#define GBL_CTX_SOURCE_POP()
 
#define GBL_CTX_SOURCE_SCOPED(CALL, loc, ...)
 
#define GBL_CTX_RECORD_SET_JMP_CND_(expr, result, label, srcLoc, ...)
 
#define GBL_CTX_RECORD_SET_JMP_CND(expr, result, label, ...)
 
#define GBL_CTX_VERIFY_(expr, result, srcLoc, ...)
 
#define GBL_CTX_VERIFY_N(srcLoc, expr, result, ...)
 
#define GBL_CTX_VERIFY_3(srcLoc, expr, result)
 
#define GBL_CTX_VERIFY(...)
 
#define GBL_CTX_VERIFY_EXPRESSION_N(srcLoc, expr, ...)
 
#define GBL_CTX_VERIFY_EXPRESSION_2(src, expr)
 
#define GBL_CTX_VERIFY_EXPRESSION(...)
 
#define GBL_CTX_VERIFY_POINTER_N(srcLoc, expr, ...)
 
#define GBL_CTX_VERIFY_POINTER_2(src, expr)
 
#define GBL_CTX_VERIFY_POINTER(...)
 
#define GBL_CTX_VERIFY_ARG_N(srcLoc, expr, ...)
 
#define GBL_CTX_VERIFY_ARG_2(src, expr)
 
#define GBL_CTX_VERIFY_ARG(...)
 
#define GBL_CTX_VERIFY_TYPE_N(srcLoc, actualType, expectedType, ...)
 
#define GBL_CTX_VERIFY_TYPE_3(srcLoc, actualType, expectedType)
 
#define GBL_CTX_VERIFY_TYPE_2(srcLoc, actualType)
 
#define GBL_CTX_VERIFY_TYPE(...)
 
#define GBL_CTX_VERIFY_LAST_RECORD()
 
#define GBL_CTX_CLEAR_LAST_RECORD()
 
#define GBL_CTX_ERRNO_CLEAR()
 
#define GBL_CTX_PERROR(...)
 
#define GBL_CTX_INLINE_RETVAL()
 
#define GBL_CTX_INLINE(MethodPrefix, ReturnType, ...)
 
#define GBL_CTX_INLINE_BEGIN(InitialRetValue)
 
#define GBL_CTX_INLINE_END()
 
#define GBL_CTX_INLINE_RETURN()
 
#define GBL_CTX_INLINE_CALL_(MethodPrefix, srcLoc, ...)
 
#define GBL_CTX_INLINE_CALL(MethodPrefix, ...)
 
#define GBL_CTX_EXT(prefix, ...)
 
#define GBL_CTX_MALLOC_4(src, size, align, dbgStr)
 
#define GBL_CTX_MALLOC_3(src, size, align)
 
#define GBL_CTX_MALLOC_2(src, size)
 
#define GBL_CTX_MALLOC(...)
 
#define GBL_CTX_NEW_4(src, type, count, dbgStr)
 
#define GBL_CTX_NEW_3(src, type, count)
 
#define GBL_CTX_NEW_2(src, type)
 
#define GBL_CTX_NEW(...)
 
#define GBL_CTX_REALLOC_4(src, pData, newSize, newAlign)
 
#define GBL_CTX_REALLOC_3(src, pData, newSize)
 
#define GBL_CTX_REALLOC(...)
 
#define GBL_CTX_RENEW_5(src, ptr, type, count, dbgStr)
 
#define GBL_CTX_RENEW_4(src, ptr, type, count)
 
#define GBL_CTX_RENEW_3(src, ptr, type)
 
#define GBL_CTX_RENEW(...)
 
#define GBL_CTX_FREE(pData)
 
#define GBL_CTX_PUSH_(srcLoc, ...)
 
#define GBL_CTX_PUSH()
 
#define GBL_CTX_PUSH_VERBOSE_N(srcLoc, pFmt, ...)
 
#define GBL_CTX_PUSH_VERBOSE(...)
 
#define GBL_CTX_POP_2(srcLoc, count)
 
#define GBL_CTX_POP_1(srcLoc)
 
#define GBL_CTX_POP(...)
 
#define GBL_CTX_LOG_(src, level, pFmt, ...)
 
#define GBL_CTX_LOG(level, pFmt, ...)
 
#define GBL_CTX_DEBUG(pFmt, ...)
 
#define GBL_CTX_VERBOSE(pFmt, ...)
 
#define GBL_CTX_INFO(pFmt, ...)
 
#define GBL_CTX_WARN(pFmt, ...)
 
#define GBL_CTX_ERROR(pFmt, ...)
 
#define GBL_CTX_EVENT(event)
 
#define GBL_CTX_RECORD_ASSERT_(record, test)
 
#define GBL_CTX_RECORD_ASSERT_CONDITIONAL_(enabled, record, test)
 
#define GBL_CTX_RECORD_ASSERT_PARTIAL(record)
 
#define GBL_CTX_RECORD_ASSERT_ERROR(record)
 
#define GBL_CTX_RECORD_ASSERT_UNKNOWN(record)
 
#define GBL_CTX_RECORD_ASSERT(record)
 
#define GBL_CTX_RECORD_LOG_(prefix, record)
 
#define GBL_CTX_RECORD_LOG_CONDITIONAL_(prefix, record)
 
#define GBL_CTX_RECORD_LOG_PARTIAL(record)
 
#define GBL_CTX_RECORD_LOG_ERROR(record)
 
#define GBL_CTX_RECORD_LOG_UNKNOWN(record)
 
#define GBL_CTX_RECORD_LOG(record)
 
#define GBL_CTX_RECORD_LAST_RECORD_(prefix, record)
 
#define GBL_CTX_RECORD_LAST_RECORD_PARTIAL(record)
 
#define GBL_CTX_RECORD_LAST_RECORD_ERROR(record)
 
#define GBL_CTX_RECORD_LAST_RECORD_UNKNOWN(record)
 
#define GBL_CTX_RECORD_LAST_RECORD(record)
 
#define GBL_CTX_RECORD_HANDLER(record)
 
#define GBL_CTX_RECORD_SET_N(file, func, line, result, ...)
 
#define GBL_CTX_RECORD_SET_5(file, func, line, result, pFmt)
 
#define GBL_CTX_RECORD_SET_4(file, func, line, result)
 
#define GBL_CTX_RECORD_SET(...)
 
#define GBL_CTX_CALL_N(src, funcCall, ...)
 
#define GBL_CTX_CALL_2(src, funcCall)
 
#define GBL_CTX_CALL(...)
 
#define GBL_CTX_VERIFY_CALL(...)
 
#define GBL_CTX_BEGIN_FRAME(file, func, line, pObject, frame)
 
#define GBL_CTX_BEGIN_LOG_4(file, func, line, hHandle)
 
#define GBL_CTX_BEGIN_LOG_N(file, func, line, hHandle, ...)
 
#define GBL_CTX_BEGIN(...)
 
#define GBL_CTX_DONE()
 
#define GBL_CTX_END_BLOCK()
 
#define GBL_CTX_END()
 
#define GBL_CTX_END_EMPTY()
 
#define GBL_CTX_BLOCK_6(file, func, line, hHandle, frame, block)
 
#define GBL_CTX_BLOCK_5(file, func, line, hHandle, block)
 
#define GBL_CTX_BLOCK_4(file, func, line, block)
 
#define GBL_CTX_BLOCK(...)
 

Functions

static GBL_RESULT GBL_ERRNO_RESULT (int ernum)
 
static void * GBL_CTX_INLINE_MALLOC_ (GblStackFrame *GBL_CTX_FRAME_NAME, size_t size, size_t align, const char *pDebugStr)
 
static void * GBL_CTX_INLINE_REALLOC_ (GblStackFrame *GBL_CTX_FRAME_NAME, void *pData, size_t newSize, size_t newAlign)
 
static GBL_RESULT GBL_CTX_INLINE_LOG_ (GblStackFrame *GBL_CTX_FRAME_NAME, GblFlags level, const char *pFmt,...)
 

Detailed Description

GblContext top-level debug and control-flow macros.

Author
Falco Girgis

Definition in file gimbal_ctx.h.

Macro Definition Documentation

◆ GBL_CTX_FRAME_DECLARE

#define GBL_CTX_FRAME_DECLARE

Definition at line 21 of file gimbal_ctx.h.

◆ GBL_CTX_FRAME

#define GBL_CTX_FRAME ( )

Definition at line 22 of file gimbal_ctx.h.

◆ GBL_CTX_CONTEXT

#define GBL_CTX_CONTEXT ( )

Definition at line 23 of file gimbal_ctx.h.

◆ GBL_CTX_OBJECT

#define GBL_CTX_OBJECT ( )

Definition at line 24 of file gimbal_ctx.h.

◆ GBL_CTX_RECORD

#define GBL_CTX_RECORD ( )

Definition at line 25 of file gimbal_ctx.h.

◆ GBL_CTX_RESULT

#define GBL_CTX_RESULT ( )

Definition at line 26 of file gimbal_ctx.h.

◆ GBL_CTX_SOURCE

#define GBL_CTX_SOURCE ( )

Definition at line 27 of file gimbal_ctx.h.

◆ GBL_CTX_LAST_RECORD

#define GBL_CTX_LAST_RECORD ( )

Definition at line 28 of file gimbal_ctx.h.

◆ GBL_CTX_LAST_RESULT

#define GBL_CTX_LAST_RESULT ( )

Definition at line 29 of file gimbal_ctx.h.

◆ GBL_SRC_FILE

#define GBL_SRC_FILE

Definition at line 33 of file gimbal_ctx.h.

◆ GBL_SRC_FN

#define GBL_SRC_FN

Definition at line 34 of file gimbal_ctx.h.

◆ GBL_SRC_LN

#define GBL_SRC_LN

Definition at line 35 of file gimbal_ctx.h.

◆ GBL_SRC_LOC

#define GBL_SRC_LOC

Definition at line 36 of file gimbal_ctx.h.

◆ GblSrcLoc

#define GblSrcLoc

Definition at line 37 of file gimbal_ctx.h.

◆ GBL_SOURCE_LOCATION

#define GBL_SOURCE_LOCATION (   FILE,
  FUNCTION,
  LINE 
)

Definition at line 39 of file gimbal_ctx.h.

◆ GBL_CTX_STACK_FRAME_SOURCE_PUSH

#define GBL_CTX_STACK_FRAME_SOURCE_PUSH (   pStackFrame,
  current 
)

Definition at line 41 of file gimbal_ctx.h.

44 { \
45 GBL_ASSERT(pStackFrame->sourceCurrentCaptureDepth); \
46 --pStackFrame->sourceCurrentCaptureDepth; \
47 } GBL_STMT_END
48
49#define GBL_CTX_SOURCE_LOC_PUSH(srcLoc) \
50 GBL_CTX_STACK_FRAME_SOURCE_PUSH(GBL_CTX_FRAME_NAME, srcLoc)
51
52#define GBL_CTX_SOURCE_PUSH(FILE, FUNCTION, LINE) \
53 GBL_CTX_SOURCE_LOC_PUSH(GBL_SOURCE_LOCATION(FILE, FUNCTION, LINE))
54
55#define GBL_CTX_SOURCE_POP() \
56 GBL_CTX_STACK_FRAME_SOURCE_POP(GBL_CTX_FRAME_NAME)
57
58#define GBL_CTX_SOURCE_SCOPED(CALL, loc, ...) \
59 GBL_STMT_START { \
60 GBL_CTX_SOURCE_LOC_PUSH((loc)); \
61 GBL_IDENTITY(CALL)(__VA_ARGS__); \
62 GBL_CTX_SOURCE_POP(); \
63 } GBL_STMT_END
64
65// ====== BOTTOM-LEVEL ERROR HANDLING + CONTROL FLOW =====
66
67#define GBL_CTX_RECORD_SET_JMP_CND_(expr, result, label, srcLoc, ...) \
68 GBL_STMT_START { \
69 GBL_CTX_SOURCE_LOC_PUSH(srcLoc); \
70 if(!(expr)) GBL_UNLIKELY { \
71 GBL_CTX_RECORD_SET(result, __VA_ARGS__); \
72 GBL_CTX_SOURCE_POP(); \
73 label; \
74 } else GBL_LIKELY { \
75 GBL_CTX_SOURCE_POP(); \
76 } \
77 } GBL_STMT_END
78
79#define GBL_CTX_RECORD_SET_JMP_CND(expr, result, label, ...) \
80 GBL_CTX_RECORD_SET_JMP_CND_(expr, result, goto label, GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN), __VA_ARGS__);
81
82//====== VERIFY =========
83
84#define GBL_CTX_VERIFY_(expr, result, srcLoc, ...) \
85 GBL_CTX_RECORD_SET_JMP_CND_((expr), \
86 result, \
87 goto GBL_CTX_END_LABEL, \
88 srcLoc, __VA_ARGS__)
89
90#define GBL_CTX_VERIFY_N(srcLoc, expr, result, ...) \
91 GBL_CTX_VERIFY_(expr, result, srcLoc, __VA_ARGS__)
92
93#define GBL_CTX_VERIFY_3(srcLoc, expr, result) \
94 GBL_CTX_VERIFY_N(srcLoc, expr, result, gblResultString(result))
95
96#define GBL_CTX_VERIFY(...) \
97 GBL_STMT_START { \
98 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
99 GBL_VA_OVERLOAD_SELECT(GBL_CTX_VERIFY, GBL_VA_OVERLOAD_SUFFIXER_3_N, src_, __VA_ARGS__)(src_, __VA_ARGS__); \
100 } GBL_STMT_END
101
102//====== VERIFY_EXPRESSION =========
103
104#define GBL_CTX_VERIFY_EXPRESSION_N(srcLoc, expr, ...) \
105 GBL_CTX_VERIFY_(expr, GBL_RESULT_ERROR_INVALID_EXPRESSION, srcLoc, __VA_ARGS__)
106
107#define GBL_CTX_VERIFY_EXPRESSION_2(src, expr) \
108 GBL_CTX_VERIFY_EXPRESSION_N(src, expr, "Invalid Expression: "#expr)
109
110#define GBL_CTX_VERIFY_EXPRESSION(...) \
111 GBL_STMT_START { \
112 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
113 GBL_VA_OVERLOAD_SELECT(GBL_CTX_VERIFY_EXPRESSION, GBL_VA_OVERLOAD_SUFFIXER_2_N, src_, __VA_ARGS__)(src_, __VA_ARGS__); \
114 } GBL_STMT_END
115
116//====== VERIFY_POINTER =========
117#define GBL_CTX_VERIFY_POINTER_N(srcLoc, expr, ...) \
118 GBL_CTX_VERIFY_(expr, GBL_RESULT_ERROR_INVALID_POINTER, srcLoc, __VA_ARGS__)
119
120#define GBL_CTX_VERIFY_POINTER_2(src, expr) \
121 GBL_CTX_VERIFY_POINTER_N(src, expr, "Invalid Pointer")
122
123#define GBL_CTX_VERIFY_POINTER(...) \
124 GBL_STMT_START { \
125 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
126 GBL_VA_OVERLOAD_SELECT(GBL_CTX_VERIFY_POINTER, GBL_VA_OVERLOAD_SUFFIXER_2_N, src_, __VA_ARGS__)(src_, __VA_ARGS__); \
127 } GBL_STMT_END
128
129//====== VERIFY_ARG =========
130#define GBL_CTX_VERIFY_ARG_N(srcLoc, expr, ...) \
131 GBL_CTX_VERIFY_(expr, GBL_RESULT_ERROR_INVALID_ARG, srcLoc, __VA_ARGS__)
132
133#define GBL_CTX_VERIFY_ARG_2(src, expr) \
134 GBL_CTX_VERIFY_ARG_N(src, expr, "Invalid Arg: "#expr);
135
136#define GBL_CTX_VERIFY_ARG(...) \
137 GBL_STMT_START { \
138 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
139 GBL_VA_OVERLOAD_SELECT(GBL_CTX_VERIFY_ARG, GBL_VA_OVERLOAD_SUFFIXER_2_N, src_, __VA_ARGS__)(src_, __VA_ARGS__); \
140 } GBL_STMT_END
141
142//===== VERIFY_TYPE =======
143#define GBL_CTX_VERIFY_TYPE_N(srcLoc, actualType, expectedType, ...) \
144 GBL_CTX_VERIFY_(GblType_check(actualType, expectedType), GBL_RESULT_ERROR_TYPE_MISMATCH, srcLoc, __VA_ARGS__)
145
146#define GBL_CTX_VERIFY_TYPE_3(srcLoc, actualType, expectedType) \
147 GBL_CTX_VERIFY_TYPE_N(srcLoc, actualType, expectedType, "Type mismatch [Actual: %s, Expected: %s]", GblType_name(actualType), GblType_name(expectedType))
148
149#define GBL_CTX_VERIFY_TYPE_2(srcLoc, actualType) \
150 GBL_CTX_VERIFY_(actualType != GBL_INVALID_TYPE, GBL_RESULT_ERROR_INVALID_TYPE, srcLoc, "Invalid Type");
151
152#define GBL_CTX_VERIFY_TYPE(...) \
153 GBL_STMT_START { \
154 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
155 GBL_VA_OVERLOAD_SELECT(GBL_CTX_VERIFY_TYPE, GBL_VA_OVERLOAD_SUFFIXER_3_N, src_, __VA_ARGS__)(src_, __VA_ARGS__); \
156 } GBL_STMT_END
157
158//==== LAST RECORD =====
159#define GBL_CTX_VERIFY_LAST_RECORD() \
160 GBL_STMT_START { \
161 const GblCallRecord* pRecord = \
162 GblThd_callRecord(NULL); \
163 if(pRecord && GBL_RESULT_ERROR(pRecord->result)) { \
164 GBL_CTX_RESULT() = pRecord->result; \
165 GBL_CTX_DONE(); \
166 } \
167 } GBL_STMT_END
168
169#define GBL_CTX_CLEAR_LAST_RECORD() \
170 GblThd_setCallRecord(NULL, NULL)
171
172//===== C STD ERRNO =====
173
174#ifdef GBL_CONFIG_ERRNO_CHECKS
175#define GBL_CTX_ERRNO_CLEAR() errno = 0
176#else
177#define GBL_CTX_ERRNO_CLEAR()
178#endif
179
180#ifdef GBL_CONFIG_ERRNO_CHECKS
181# define GBL_CTX_PERROR(...) \
182 GBL_STMT_START { \
183 if(errno) GBL_UNLIKELY { \
184 const GBL_RESULT code = \
185 GBL_ERRNO_RESULT(errno); \
186 GBL_CTX_VERIFY( \
187 GBL_RESULT_SUCCESS(code), \
188 code, \
189 "ERRNO: %s", strerror(errno)); \
190 } \
191 } GBL_STMT_END
192#else
193# define GBL_CTX_PERROR(...)
194#endif
195
196GBL_MAYBE_UNUSED GBL_INLINE GBL_RESULT GBL_ERRNO_RESULT(int ernum) {
197 switch(ernum) {
198 case 0: return GBL_RESULT_SUCCESS;
199 default: return GBL_RESULT_ERROR;
200 }
201}
202
203// ======= API ======
204#define GBL_CTX_INLINE_RETVAL() GBL_CTX_INLINE_RETURN_VALUE_NAME
205
206#define GBL_CTX_INLINE(MethodPrefix, ReturnType, ...) \
207 GBL_INLINE ReturnType GBL_CTX_INLINE_##MethodPrefix##_(GBL_CTX_FRAME_DECLARE, ##__VA_ARGS__) { \
208 ReturnType GBL_CTX_INLINE_RETURN_VALUE_NAME;
209
210#define GBL_CTX_INLINE_BEGIN(InitialRetValue) \
211 GBL_CTX_INLINE_RETVAL() = InitialRetValue;
212
213
214#define GBL_CTX_INLINE_END() \
215 goto GBL_CTX_END_LABEL; \
216 GBL_CTX_END_LABEL: GBL_STMT_START {;} GBL_STMT_END; \
217 }
218
219#define GBL_CTX_INLINE_RETURN() \
220 return GBL_CTX_INLINE_RETVAL()
221
222
223#define GBL_CTX_INLINE_CALL_(MethodPrefix, srcLoc, ...) \
224 GBL_CTX_INLINE_##MethodPrefix##_(GBL_CTX_FRAME() GBL_VA_ARGS(__VA_ARGS__))
225
226#define GBL_CTX_INLINE_CALL(MethodPrefix, ...) \
227 GBL_CTX_INLINE_CALL_(MethodPrefix, GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN) GBL_VA_ARG)
228
229// ============== GBL EXT USERMETHODS ==========
230
231#define GBL_CTX_EXT(prefix, ...) \
232 GBL_STMT_START { \
233 const GBL_RESULT localResult = GblContext_##prefix(GBL_CTX_CONTEXT(), \
234 GBL_CTX_FRAME_NAME, \
235 ##__VA_ARGS__); \
236 GBL_ASSERT(!(GBL_CONFIG_ASSERT_ERROR_ENABLED && \
237 GBL_RESULT_ERROR(localResult)), \
238 "Ext["#prefix"]: ERROR"); \
239 GBL_ASSERT(!(GBL_CONFIG_ASSERT_PARTIAL_ENABLED && \
240 GBL_RESULT_PARTIAL(localResult)), \
241 "Ext["#prefix"]: ERROR"); \
242 GBL_UNUSED(localResult); \
243 } GBL_STMT_END
244
245
246GBL_MAYBE_UNUSED GBL_CTX_INLINE(MALLOC, void*, size_t size, size_t align, const char* pDebugStr) {
247 GBL_CTX_INLINE_BEGIN(GBL_NULL);
248 if(align == 0) {
249 align = GBL_ALIGNOF(GBL_MAX_ALIGN_T);
250 size = gblAlignedAllocSizeDefault(size);
251 }
252 GBL_ASSERT(size % align == 0);
253 GBL_CTX_EXT(memAlloc_, size, align, pDebugStr, &GBL_CTX_INLINE_RETVAL());
254 GBL_CTX_INLINE_END();
255 // modify/set return value based on result
256 GBL_CTX_INLINE_RETURN();
257}
258
259#define GBL_CTX_MALLOC_4(src, size, align, dbgStr) \
260 GBL_CTX_INLINE_CALL_(MALLOC, src, size, align, dbgStr)
261
262#define GBL_CTX_MALLOC_3(src, size, align) \
263 GBL_CTX_MALLOC_4(src, size, align, GBL_NULL)
264
265#define GBL_CTX_MALLOC_2(src, size) \
266 GBL_CTX_MALLOC_3(src, gblAlignedAllocSizeDefault(size), GBL_ALIGNOF(GBL_MAX_ALIGN_T))
267
268#define GBL_CTX_MALLOC(...) \
269 GBL_VA_OVERLOAD_SELECT(GBL_CTX_MALLOC, GBL_VA_OVERLOAD_SUFFIXER_ARGC, 1, __VA_ARGS__)(GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN), __VA_ARGS__)
270
271#define GBL_CTX_NEW_4(src, type, count, dbgStr) \
272 (type*)GBL_CTX_INLINE_CALL_(MALLOC, src, gblAlignedAllocSizeDefault(sizeof(type)*count), 0, dbgStr)
273
274#define GBL_CTX_NEW_3(src, type, count) \
275 GBL_CTX_NEW_4(src, type, count, GBL_NULL)
276
277#define GBL_CTX_NEW_2(src, type) \
278 GBL_CTX_NEW_3(src, type, 1)
279
280#define GBL_CTX_NEW(...) \
281 GBL_VA_OVERLOAD_SELECT(GBL_CTX_NEW, GBL_VA_OVERLOAD_SUFFIXER_ARGC, 1, __VA_ARGS__)(GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN), __VA_ARGS__)
282
283GBL_MAYBE_UNUSED GBL_CTX_INLINE(REALLOC, void*, void* pData, size_t newSize, size_t newAlign) {
284 GBL_CTX_INLINE_BEGIN(NULL);
285
286 GBL_CTX_EXT(memRealloc_, pData, newSize, newAlign, &GBL_CTX_INLINE_RETVAL());
287 GBL_CTX_INLINE_END();
288 // modify/set return value based on result
289 GBL_CTX_INLINE_RETURN();
290}
291
292#define GBL_CTX_REALLOC_4(src, pData, newSize, newAlign) \
293 GBL_CTX_INLINE_CALL_(REALLOC, src, pData, newSize, newAlign)
294
295#define GBL_CTX_REALLOC_3(src, pData, newSize) \
296 GBL_CTX_REALLOC_4(src, pData, newSize, 1)
297
298#define GBL_CTX_REALLOC(...) \
299 GBL_VA_OVERLOAD_SELECT(GBL_CTX_REALLOC, GBL_VA_OVERLOAD_SUFFIXER_ARGC, 1, __VA_ARGS__)(GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN), __VA_ARGS__)
300
301#define GBL_CTX_RENEW_5(src, ptr, type, count, dbgStr) \
302 GBL_CTX_INLINE_CALL(REALLOC, src, ptr, sizeof(type)*count, dbgStr)
303
304#define GBL_CTX_RENEW_4(src, ptr, type, count) \
305 GBL_CTX_RENEW_5(src, ptr, type, count, GBL_NULL)
306
307#define GBL_CTX_RENEW_3(src, ptr, type) \
308 GBL_CTX_RENEW_4(src, ptr, type, 1)
309
310#define GBL_CTX_RENEW(...) \
311 GBL_VA_OVERLOAD_SELECT(GBL_CTX_REALLOC, GBL_VA_OVERLOAD_SUFFIXER_ARGC, 1, __VA_ARGS__)(GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN), __VA_ARGS__)
312
313#define GBL_CTX_FREE(pData) \
314 GBL_CTX_SOURCE_SCOPED(GBL_CTX_EXT, (GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN)), memFree_, pData)
315
316#define GBL_CTX_PUSH_(srcLoc, ...) \
317 GBL_STMT_START { \
318 GBL_CTX_SOURCE_LOC_PUSH(srcLoc); \
319 GblThd_logPush(NULL); \
320 GBL_CTX_EXT(logPush_); \
321 GBL_CTX_SOURCE_POP(); \
322 ++GBL_CTX_FRAME()->stackDepth; \
323 } GBL_STMT_END
324
325#define GBL_CTX_PUSH() \
326 GBL_STMT_START { \
327 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
328 GBL_CTX_PUSH_(src_); \
329 } GBL_STMT_END
330
331#define GBL_CTX_PUSH_VERBOSE_N(srcLoc, pFmt, ...) \
332 GBL_STMT_START { \
333 GBL_CTX_SOURCE_SCOPED(GBL_CTX_VERBOSE, srcLoc, pFmt, ##__VA_ARGS__); \
334 GBL_CTX_PUSH_(srcLoc); \
335 } GBL_STMT_END
336
337#define GBL_CTX_PUSH_VERBOSE(...) \
338 GBL_STMT_START { \
339 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
340 GBL_VA_OVERLOAD_SELECT(GBL_CTX_PUSH_VERBOSE, GBL_VA_OVERLOAD_SUFFIXER_1_N, src_, ##__VA_ARGS__)(src_, ##__VA_ARGS__); \
341 } GBL_STMT_END
342
343#define GBL_CTX_POP_2(srcLoc, count) \
344 GblThd_logPop(NULL, count); \
345 GBL_CTX_SOURCE_SCOPED(GBL_CTX_EXT, srcLoc, logPop_, count); \
346 GBL_CTX_FRAME()->stackDepth -= count;
347
348#define GBL_CTX_POP_1(srcLoc) \
349 GBL_CTX_POP_2(srcLoc, 1)
350
351#define GBL_CTX_POP(...) \
352 GBL_STMT_START { \
353 const GblSrcLoc loc = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
354 GBL_VA_OVERLOAD_CALL(GBL_CTX_POP, GBL_VA_OVERLOAD_SUFFIXER_ARGC, loc, __VA_ARGS__); \
355 } GBL_STMT_END
356
357GBL_MAYBE_UNUSED GBL_CTX_INLINE(LOG, GBL_RESULT, GblFlags level, const char* pFmt, ...) {
358 GBL_CTX_INLINE_BEGIN(GBL_RESULT_SUCCESS);
359 va_list varArgs;
360 va_start(varArgs, pFmt);
361
362 GBL_CTX_EXT(logWrite_, level, pFmt, varArgs);
363 va_end(varArgs);
364 GBL_CTX_INLINE_END();
365 GBL_CTX_INLINE_RETURN();
366}
367
368#define GBL_CTX_LOG_(src, level, pFmt, ...) \
369 GBL_CTX_INLINE_CALL_(LOG, src, level, pFmt, ##__VA_ARGS__)
370#define GBL_CTX_LOG(level, pFmt, ...) \
371 GBL_CTX_LOG_(GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN), level, pFmt, ##__VA_ARGS__)
372
373#define GBL_CTX_DEBUG(pFmt, ...) \
374 GBL_CTX_LOG_(GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN), GBL_LOG_LEVEL_DEBUG, pFmt, ##__VA_ARGS__)
375
376#define GBL_CTX_VERBOSE(pFmt, ...) \
377 GBL_CTX_LOG_(GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN), GBL_LOG_LEVEL_VERBOSE, pFmt, ##__VA_ARGS__)
378
379#define GBL_CTX_INFO(pFmt, ...) \
380 GBL_CTX_LOG_(GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN), GBL_LOG_LEVEL_INFO, pFmt, ##__VA_ARGS__)
381
382#define GBL_CTX_WARN(pFmt, ...) \
383 GBL_CTX_LOG_(GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN), GBL_LOG_LEVEL_WARNING, pFmt, ##__VA_ARGS__)
384
385#define GBL_CTX_ERROR(pFmt, ...) \
386 GBL_CTX_LOG_(GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN), GBL_LOG_LEVEL_ERROR, pFmt, ##__VA_ARGS__)
387
388#define GBL_CTX_EVENT(event) \
389 GBL_STMT_START { \
390 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
391 GBL_UNUSED(src_); \
392 GblObject_sendEvent(GBL_CTX_OBJECT(), (GblEvent*)event); \
393 } GBL_STMT_END
394
395
396// ===================== RECORD = > ASSERT =========================
397
398// Base Enabled Logic
399#define GBL_CTX_RECORD_ASSERT_(record, test) \
400 GBL_STMT_START { \
401 GBL_ASSERT(!test(record->result), record->message); \
402 } GBL_STMT_END
403
404// Base Conditional Logic
405#define GBL_CTX_RECORD_ASSERT_CONDITIONAL_(enabled, record, test) \
406 GBL_MACRO_CONDITIONAL_CALL(enabled, GBL_CTX_RECORD_ASSERT_, record, test)
407
408// Partial Success
409#define GBL_CTX_RECORD_ASSERT_PARTIAL(record) \
410 GBL_CTX_RECORD_ASSERT_CONDITIONAL_(GBL_CONFIG_ASSERT_PARTIAL_ENABLED, \
411 record, GBL_RESULT_PARTIAL)
412// Error
413#define GBL_CTX_RECORD_ASSERT_ERROR(record) \
414 GBL_CTX_RECORD_ASSERT_CONDITIONAL_(GBL_CONFIG_ASSERT_ERROR_ENABLED, \
415 record, GBL_RESULT_ERROR)
416
417// Unknown
418#define GBL_CTX_RECORD_ASSERT_UNKNOWN(record) \
419 GBL_CTX_RECORD_ASSERT_CONDITIONAL_(GBL_CONFIG_ASSERT_UNKNOWN_ENABLED, \
420 record, GBL_RESULT_UNKNOWN)
421// Both Together
422#define GBL_CTX_RECORD_ASSERT(record) \
423 GBL_STMT_START { \
424 GBL_CTX_RECORD_ASSERT_ERROR(record); \
425 GBL_CTX_RECORD_ASSERT_PARTIAL(record); \
426 GBL_CTX_RECORD_ASSERT_UNKNOWN(record); \
427 } GBL_STMT_END
428
429
430// ========================== RECORD = > LOG ========================
431
432// Base Enabled Logic (uses a prefix prefix for all magic)
433#define GBL_CTX_RECORD_LOG_(prefix, record) \
434 GBL_STMT_START { \
435 if(GBL_RESULT_##prefix(record->result)) GBL_UNLIKELY { \
436 GBL_CTX_LOG(GBL_CONFIG_LOG_##prefix##_LEVEL, \
437 "%s: %s", \
438 gblResultString(record->result), record->message); \
439 } \
440 } GBL_STMT_END
441
442
443// Base Conditional Logic
444#define GBL_CTX_RECORD_LOG_CONDITIONAL_(prefix, record) \
445 GBL_MACRO_CONDITIONAL_CALL(GBL_CONFIG_LOG_##prefix##_ENABLED, \
446 GBL_CTX_RECORD_LOG_, prefix, record)
447
448// Partial Success
449#define GBL_CTX_RECORD_LOG_PARTIAL(record) \
450 GBL_CTX_RECORD_LOG_CONDITIONAL_(PARTIAL, record)
451
452// Error
453#define GBL_CTX_RECORD_LOG_ERROR(record) \
454 GBL_CTX_RECORD_LOG_CONDITIONAL_(ERROR, record)
455
456// Unknown
457#define GBL_CTX_RECORD_LOG_UNKNOWN(record) \
458 GBL_CTX_RECORD_LOG_CONDITIONAL_(UNKNOWN, record)
459
460// Combined
461#define GBL_CTX_RECORD_LOG(record) \
462 GBL_STMT_START { \
463 GBL_CTX_RECORD_LOG_ERROR(record); \
464 GBL_CTX_RECORD_LOG_PARTIAL(record); \
465 GBL_CTX_RECORD_LOG_UNKNOWN(record); \
466 } GBL_STMT_END
467
468
469// ================= RECORD => HANDLE::LAST_ERROR ==============
470#define GBL_CTX_RECORD_LAST_RECORD_(prefix, record) \
471 GBL_STMT_START { \
472 if(GBL_RESULT_##prefix(record->result)) { \
473 GblContext_callRecordSet_(GBL_CTX_CONTEXT(), GBL_CTX_FRAME_NAME, record); \
474 GblThd_setCallRecord(NULL, record); \
475 } \
476 } GBL_STMT_END
477
478#define GBL_CTX_RECORD_LAST_RECORD_PARTIAL(record) \
479 GBL_CTX_RECORD_LAST_RECORD_(PARTIAL, record)
480
481#define GBL_CTX_RECORD_LAST_RECORD_ERROR(record) \
482 GBL_CTX_RECORD_LAST_RECORD_(ERROR, record)
483
484#define GBL_CTX_RECORD_LAST_RECORD_UNKNOWN(record) \
485 GBL_CTX_RECORD_LAST_RECORD_(UNKNOWN, record)
486
487#define GBL_CTX_RECORD_LAST_RECORD(record) \
488 GBL_STMT_START { \
489 GBL_CTX_RECORD_LAST_RECORD_ERROR(record); \
490 GBL_CTX_RECORD_LAST_RECORD_PARTIAL(record); \
491 GBL_CTX_RECORD_LAST_RECORD_UNKNOWN(record); \
492 } GBL_STMT_END
493
494// ================= RECORD => TOP-LEVEL DISPATCH ==============
495#define GBL_CTX_RECORD_HANDLER(record) \
496 GBL_STMT_START { \
497 GBL_CTX_RECORD_LOG((record)); \
498 GBL_CTX_RECORD_LAST_RECORD((record)); \
499 GBL_CTX_RECORD_ASSERT((record)); \
500 } GBL_STMT_END
501
502#define GBL_CTX_RECORD_SET_N(file, func, line, result, ...) \
503 GBL_STMT_START { \
504 GBL_CTX_SOURCE_LOC_PUSH(GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN)); \
505 GblCallRecord_construct(&GBL_CTX_RECORD(), result, GBL_CTX_SOURCE(), __VA_ARGS__); \
506 GBL_CTX_RECORD_HANDLER(&GBL_CTX_RECORD()); \
507 GBL_CTX_SOURCE_POP(); \
508 } GBL_STMT_END
509
510#define GBL_CTX_RECORD_SET_5(file, func, line, result, pFmt) \
511 GBL_CTX_RECORD_SET_N(file, func, line, result, "%s", pFmt)
512
513#define GBL_CTX_RECORD_SET_4(file, func, line, result) \
514 GBL_CTX_RECORD_SET_5(file, func, line, result, gblResultString(result))
515
516#define GBL_CTX_RECORD_SET(...) \
517 GBL_VA_OVERLOAD_CALL(GBL_CTX_RECORD_SET, GBL_VA_OVERLOAD_SUFFIXER_5_N, GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN, __VA_ARGS__)
518
519#define GBL_CTX_CALL_N(src, funcCall, ...) \
520 GBL_STMT_START { \
521 GBL_CTX_SOURCE_LOC_PUSH(src); \
522 GBL_MAYBE_UNUSED const GBL_RESULT localResult = (funcCall); \
523 if(!GBL_RESULT_SUCCESS(localResult)) GBL_UNLIKELY { \
524 GBL_CTX_RESULT() = localResult; \
525 } \
526 GBL_CTX_SOURCE_POP(); \
527 } GBL_STMT_END
528
529#define GBL_CTX_CALL_2(src, funcCall) \
530 GBL_CTX_CALL_N(src, funcCall, #funcCall);
531
532#define GBL_CTX_CALL(...) \
533 GBL_STMT_START { \
534 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
535 GBL_VA_OVERLOAD_SELECT(GBL_CTX_CALL, GBL_VA_OVERLOAD_SUFFIXER_2_N, src_, __VA_ARGS__)(src_, __VA_ARGS__); \
536 } GBL_STMT_END
537
538#define GBL_CTX_VERIFY_CALL(...) \
539 GBL_STMT_START { \
540 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
541 GBL_VA_OVERLOAD_SELECT(GBL_CTX_CALL, GBL_VA_OVERLOAD_SUFFIXER_2_N, src_, __VA_ARGS__)(src_, __VA_ARGS__); \
542 if(!GBL_RESULT_SUCCESS(GBL_CTX_RESULT())) goto GBL_CTX_END_LABEL; \
543 } GBL_STMT_END
544
545
546// ================= TOP-LEVEL API UTILITIES ==============
547
548#define GBL_CTX_BEGIN_FRAME(file, func, line, pObject, frame) \
549 GBL_CTX_FRAME_DECLARE = frame; \
550 GblStackFrame_construct(GBL_CTX_FRAME_NAME, (GblObject*)pObject, GBL_RESULT_SUCCESS); \
551 GblThd_stackFramePush(NULL, GBL_CTX_FRAME_NAME)
552
553#define GBL_CTX_BEGIN_LOG_4(file, func, line, hHandle) \
554 GBL_CTX_BEGIN_FRAME(file, func, line, hHandle, ((GblStackFrame*)GBL_ALLOCA(sizeof(GblStackFrame))))
555
556#define GBL_CTX_BEGIN_LOG_N(file, func, line, hHandle, ...) \
557 GBL_CTX_BEGIN_LOG_5(file, func, line, hHandle); \
558 GBL_CTX_PUSH_VERBOSE(__VA_ARGS__);
559
560#define GBL_CTX_BEGIN(...) \
561 GBL_VA_OVERLOAD_CALL(GBL_CTX_BEGIN_LOG, GBL_VA_OVERLOAD_SUFFIXER_4_N, GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN, __VA_ARGS__)
562
563#define GBL_CTX_DONE() \
564 goto GBL_CTX_END_LABEL
565
566#define GBL_CTX_END_BLOCK() \
567 goto GBL_CTX_END_LABEL; \
568 GBL_LABEL_EMPTY(GBL_CTX_END_LABEL); \
569 if(GBL_CTX_FRAME_NAME->stackDepth) \
570 GBL_CTX_POP(GBL_CTX_FRAME_NAME->stackDepth); \
571 GblThd_stackFramePop(NULL)
572
573#define GBL_CTX_END() \
574 GBL_CTX_END_BLOCK(); \
575 return GBL_CTX_FRAME_NAME->record.result
576
577#define GBL_CTX_END_EMPTY() \
578 GBL_LABEL_EMPTY(GBL_CTX_END_LABEL)
579
580#define GBL_CTX_BLOCK_6(file, func, line, hHandle, frame, block) \
581 GBL_CTX_BEGIN_FRAME(file, func, line, hHandle, frame); \
582 block; \
583 GBL_CTX_END_BLOCK()
584
585#define GBL_CTX_BLOCK_5(file, func, line, hHandle, block) \
586 GBL_CTX_BLOCK_7(file, func, line, hHandle, ((GblStackFrame*)GBL_ALLOCA(sizeof(GblStackFrame))), block)
587
588#define GBL_CTX_BLOCK_4(file, func, line, block) \
589 GBL_CTX_BLOCK_6(file, func, line, NULL, block)
590
591#define GBL_CTX_BLOCK(...) \
592 GBL_VA_OVERLOAD_SELECT(GBL_CTX_BLOCK, GBL_VA_OVERLOAD_SUFFIXER_ARGC, GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN, __VA_ARGS__)(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN, __VA_ARGS__)
593
594GBL_DECLS_END
595
596#endif // GIMBAL_API_H
GBL_RESULT
uint32_t GblFlags
Standard-sized flags type, 32-bits across platforms.

◆ GBL_CTX_STACK_FRAME_SOURCE_POP

#define GBL_CTX_STACK_FRAME_SOURCE_POP (   pStackFrame)

Definition at line 44 of file gimbal_ctx.h.

45 { \
46 GBL_ASSERT(pStackFrame->sourceCurrentCaptureDepth); \
47 --pStackFrame->sourceCurrentCaptureDepth; \
48 } GBL_STMT_END

◆ GBL_CTX_SOURCE_LOC_PUSH

#define GBL_CTX_SOURCE_LOC_PUSH (   srcLoc)

Definition at line 50 of file gimbal_ctx.h.

◆ GBL_CTX_SOURCE_PUSH

#define GBL_CTX_SOURCE_PUSH (   FILE,
  FUNCTION,
  LINE 
)

Definition at line 53 of file gimbal_ctx.h.

◆ GBL_CTX_SOURCE_POP

#define GBL_CTX_SOURCE_POP ( )

Definition at line 56 of file gimbal_ctx.h.

◆ GBL_CTX_SOURCE_SCOPED

#define GBL_CTX_SOURCE_SCOPED (   CALL,
  loc,
  ... 
)

Definition at line 59 of file gimbal_ctx.h.

60 { \
61 GBL_CTX_SOURCE_LOC_PUSH((loc)); \
62 GBL_IDENTITY(CALL)(__VA_ARGS__); \
63 GBL_CTX_SOURCE_POP(); \
64 } GBL_STMT_END

◆ GBL_CTX_RECORD_SET_JMP_CND_

#define GBL_CTX_RECORD_SET_JMP_CND_ (   expr,
  result,
  label,
  srcLoc,
  ... 
)

Definition at line 68 of file gimbal_ctx.h.

69 { \
70 GBL_CTX_SOURCE_LOC_PUSH(srcLoc); \
71 if(!(expr)) GBL_UNLIKELY { \
72 GBL_CTX_RECORD_SET(result, __VA_ARGS__); \
73 GBL_CTX_SOURCE_POP(); \
74 label; \
75 } else GBL_LIKELY { \
76 GBL_CTX_SOURCE_POP(); \
77 } \
78 } GBL_STMT_END

◆ GBL_CTX_RECORD_SET_JMP_CND

#define GBL_CTX_RECORD_SET_JMP_CND (   expr,
  result,
  label,
  ... 
)

Definition at line 80 of file gimbal_ctx.h.

◆ GBL_CTX_VERIFY_

#define GBL_CTX_VERIFY_ (   expr,
  result,
  srcLoc,
  ... 
)

Definition at line 85 of file gimbal_ctx.h.

◆ GBL_CTX_VERIFY_N

#define GBL_CTX_VERIFY_N (   srcLoc,
  expr,
  result,
  ... 
)

Definition at line 91 of file gimbal_ctx.h.

◆ GBL_CTX_VERIFY_3

#define GBL_CTX_VERIFY_3 (   srcLoc,
  expr,
  result 
)

Definition at line 94 of file gimbal_ctx.h.

◆ GBL_CTX_VERIFY

#define GBL_CTX_VERIFY (   ...)

Definition at line 97 of file gimbal_ctx.h.

98 { \
99 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
100 GBL_VA_OVERLOAD_SELECT(GBL_CTX_VERIFY, GBL_VA_OVERLOAD_SUFFIXER_3_N, src_, __VA_ARGS__)(src_, __VA_ARGS__); \
101 } GBL_STMT_END

◆ GBL_CTX_VERIFY_EXPRESSION_N

#define GBL_CTX_VERIFY_EXPRESSION_N (   srcLoc,
  expr,
  ... 
)

Definition at line 105 of file gimbal_ctx.h.

◆ GBL_CTX_VERIFY_EXPRESSION_2

#define GBL_CTX_VERIFY_EXPRESSION_2 (   src,
  expr 
)

Definition at line 108 of file gimbal_ctx.h.

109 : "#expr)

◆ GBL_CTX_VERIFY_EXPRESSION

#define GBL_CTX_VERIFY_EXPRESSION (   ...)

Definition at line 111 of file gimbal_ctx.h.

112 { \
113 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
114 GBL_VA_OVERLOAD_SELECT(GBL_CTX_VERIFY_EXPRESSION, GBL_VA_OVERLOAD_SUFFIXER_2_N, src_, __VA_ARGS__)(src_, __VA_ARGS__); \
115 } GBL_STMT_END

◆ GBL_CTX_VERIFY_POINTER_N

#define GBL_CTX_VERIFY_POINTER_N (   srcLoc,
  expr,
  ... 
)

Definition at line 118 of file gimbal_ctx.h.

◆ GBL_CTX_VERIFY_POINTER_2

#define GBL_CTX_VERIFY_POINTER_2 (   src,
  expr 
)

Definition at line 121 of file gimbal_ctx.h.

◆ GBL_CTX_VERIFY_POINTER

#define GBL_CTX_VERIFY_POINTER (   ...)

Definition at line 124 of file gimbal_ctx.h.

125 { \
126 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
127 GBL_VA_OVERLOAD_SELECT(GBL_CTX_VERIFY_POINTER, GBL_VA_OVERLOAD_SUFFIXER_2_N, src_, __VA_ARGS__)(src_, __VA_ARGS__); \
128 } GBL_STMT_END

◆ GBL_CTX_VERIFY_ARG_N

#define GBL_CTX_VERIFY_ARG_N (   srcLoc,
  expr,
  ... 
)

Definition at line 131 of file gimbal_ctx.h.

◆ GBL_CTX_VERIFY_ARG_2

#define GBL_CTX_VERIFY_ARG_2 (   src,
  expr 
)

Definition at line 134 of file gimbal_ctx.h.

135 : "#expr);

◆ GBL_CTX_VERIFY_ARG

#define GBL_CTX_VERIFY_ARG (   ...)

Definition at line 137 of file gimbal_ctx.h.

138 { \
139 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
140 GBL_VA_OVERLOAD_SELECT(GBL_CTX_VERIFY_ARG, GBL_VA_OVERLOAD_SUFFIXER_2_N, src_, __VA_ARGS__)(src_, __VA_ARGS__); \
141 } GBL_STMT_END

◆ GBL_CTX_VERIFY_TYPE_N

#define GBL_CTX_VERIFY_TYPE_N (   srcLoc,
  actualType,
  expectedType,
  ... 
)

Definition at line 144 of file gimbal_ctx.h.

◆ GBL_CTX_VERIFY_TYPE_3

#define GBL_CTX_VERIFY_TYPE_3 (   srcLoc,
  actualType,
  expectedType 
)

Definition at line 147 of file gimbal_ctx.h.

148 : %s, Expected: %s]", GblType_name(actualType), GblType_name(expectedType))

◆ GBL_CTX_VERIFY_TYPE_2

#define GBL_CTX_VERIFY_TYPE_2 (   srcLoc,
  actualType 
)

Definition at line 150 of file gimbal_ctx.h.

◆ GBL_CTX_VERIFY_TYPE

#define GBL_CTX_VERIFY_TYPE (   ...)

Definition at line 153 of file gimbal_ctx.h.

154 { \
155 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
156 GBL_VA_OVERLOAD_SELECT(GBL_CTX_VERIFY_TYPE, GBL_VA_OVERLOAD_SUFFIXER_3_N, src_, __VA_ARGS__)(src_, __VA_ARGS__); \
157 } GBL_STMT_END

◆ GBL_CTX_VERIFY_LAST_RECORD

#define GBL_CTX_VERIFY_LAST_RECORD ( )

Definition at line 160 of file gimbal_ctx.h.

161 { \
162 const GblCallRecord* pRecord = \
163 GblThd_callRecord(NULL); \
164 if(pRecord && GBL_RESULT_ERROR(pRecord->result)) { \
165 GBL_CTX_RESULT() = pRecord->result; \
166 GBL_CTX_DONE(); \
167 } \
168 } GBL_STMT_END
Captures a result, its stringified message, and a source context.
GBL_RESULT result
Result code from a previous stack frame.

◆ GBL_CTX_CLEAR_LAST_RECORD

#define GBL_CTX_CLEAR_LAST_RECORD ( )

Definition at line 170 of file gimbal_ctx.h.

◆ GBL_CTX_ERRNO_CLEAR

#define GBL_CTX_ERRNO_CLEAR ( )

Definition at line 178 of file gimbal_ctx.h.

◆ GBL_CTX_PERROR

#define GBL_CTX_PERROR (   ...)

Definition at line 194 of file gimbal_ctx.h.

◆ GBL_CTX_INLINE_RETVAL

#define GBL_CTX_INLINE_RETVAL ( )

Definition at line 205 of file gimbal_ctx.h.

◆ GBL_CTX_INLINE

#define GBL_CTX_INLINE (   MethodPrefix,
  ReturnType,
  ... 
)

Definition at line 207 of file gimbal_ctx.h.

208 { \
209 ReturnType GBL_CTX_INLINE_RETURN_VALUE_NAME;

◆ GBL_CTX_INLINE_BEGIN

#define GBL_CTX_INLINE_BEGIN (   InitialRetValue)

Definition at line 211 of file gimbal_ctx.h.

◆ GBL_CTX_INLINE_END

#define GBL_CTX_INLINE_END ( )

Definition at line 215 of file gimbal_ctx.h.

217 : GBL_STMT_START {;} GBL_STMT_END; \
218 }

◆ GBL_CTX_INLINE_RETURN

#define GBL_CTX_INLINE_RETURN ( )

Definition at line 220 of file gimbal_ctx.h.

◆ GBL_CTX_INLINE_CALL_

#define GBL_CTX_INLINE_CALL_ (   MethodPrefix,
  srcLoc,
  ... 
)

Definition at line 224 of file gimbal_ctx.h.

◆ GBL_CTX_INLINE_CALL

#define GBL_CTX_INLINE_CALL (   MethodPrefix,
  ... 
)

Definition at line 227 of file gimbal_ctx.h.

◆ GBL_CTX_EXT

#define GBL_CTX_EXT (   prefix,
  ... 
)

Definition at line 232 of file gimbal_ctx.h.

233 { \
234 const GBL_RESULT localResult = GblContext_##prefix(GBL_CTX_CONTEXT(), \
235 GBL_CTX_FRAME_NAME, \
236 ##__VA_ARGS__); \
237 GBL_ASSERT(!(GBL_CONFIG_ASSERT_ERROR_ENABLED && \
238 GBL_RESULT_ERROR(localResult)), \
239 "Ext["#prefix"]: ERROR"); \
240 GBL_ASSERT(!(GBL_CONFIG_ASSERT_PARTIAL_ENABLED && \
241 GBL_RESULT_PARTIAL(localResult)), \
242 "Ext["#prefix"]: ERROR"); \
243 GBL_UNUSED(localResult); \
244 } GBL_STMT_END

◆ GBL_CTX_MALLOC_4

#define GBL_CTX_MALLOC_4 (   src,
  size,
  align,
  dbgStr 
)

Definition at line 260 of file gimbal_ctx.h.

◆ GBL_CTX_MALLOC_3

#define GBL_CTX_MALLOC_3 (   src,
  size,
  align 
)

Definition at line 263 of file gimbal_ctx.h.

◆ GBL_CTX_MALLOC_2

#define GBL_CTX_MALLOC_2 (   src,
  size 
)

Definition at line 266 of file gimbal_ctx.h.

◆ GBL_CTX_MALLOC

#define GBL_CTX_MALLOC (   ...)

Definition at line 269 of file gimbal_ctx.h.

◆ GBL_CTX_NEW_4

#define GBL_CTX_NEW_4 (   src,
  type,
  count,
  dbgStr 
)

Definition at line 272 of file gimbal_ctx.h.

◆ GBL_CTX_NEW_3

#define GBL_CTX_NEW_3 (   src,
  type,
  count 
)

Definition at line 275 of file gimbal_ctx.h.

◆ GBL_CTX_NEW_2

#define GBL_CTX_NEW_2 (   src,
  type 
)

Definition at line 278 of file gimbal_ctx.h.

◆ GBL_CTX_NEW

#define GBL_CTX_NEW (   ...)

Definition at line 281 of file gimbal_ctx.h.

◆ GBL_CTX_REALLOC_4

#define GBL_CTX_REALLOC_4 (   src,
  pData,
  newSize,
  newAlign 
)

Definition at line 293 of file gimbal_ctx.h.

◆ GBL_CTX_REALLOC_3

#define GBL_CTX_REALLOC_3 (   src,
  pData,
  newSize 
)

Definition at line 296 of file gimbal_ctx.h.

◆ GBL_CTX_REALLOC

#define GBL_CTX_REALLOC (   ...)

Definition at line 299 of file gimbal_ctx.h.

◆ GBL_CTX_RENEW_5

#define GBL_CTX_RENEW_5 (   src,
  ptr,
  type,
  count,
  dbgStr 
)

Definition at line 302 of file gimbal_ctx.h.

◆ GBL_CTX_RENEW_4

#define GBL_CTX_RENEW_4 (   src,
  ptr,
  type,
  count 
)

Definition at line 305 of file gimbal_ctx.h.

◆ GBL_CTX_RENEW_3

#define GBL_CTX_RENEW_3 (   src,
  ptr,
  type 
)

Definition at line 308 of file gimbal_ctx.h.

◆ GBL_CTX_RENEW

#define GBL_CTX_RENEW (   ...)

Definition at line 311 of file gimbal_ctx.h.

◆ GBL_CTX_FREE

#define GBL_CTX_FREE (   pData)

Definition at line 314 of file gimbal_ctx.h.

◆ GBL_CTX_PUSH_

#define GBL_CTX_PUSH_ (   srcLoc,
  ... 
)

Definition at line 317 of file gimbal_ctx.h.

318 { \
319 GBL_CTX_SOURCE_LOC_PUSH(srcLoc); \
320 GblThd_logPush(NULL); \
321 GBL_CTX_EXT(logPush_); \
322 GBL_CTX_SOURCE_POP(); \
323 ++GBL_CTX_FRAME()->stackDepth; \
324 } GBL_STMT_END

◆ GBL_CTX_PUSH

#define GBL_CTX_PUSH ( )

Definition at line 326 of file gimbal_ctx.h.

327 { \
328 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
329 GBL_CTX_PUSH_(src_); \
330 } GBL_STMT_END

◆ GBL_CTX_PUSH_VERBOSE_N

#define GBL_CTX_PUSH_VERBOSE_N (   srcLoc,
  pFmt,
  ... 
)

Definition at line 332 of file gimbal_ctx.h.

333 { \
334 GBL_CTX_SOURCE_SCOPED(GBL_CTX_VERBOSE, srcLoc, pFmt, ##__VA_ARGS__); \
335 GBL_CTX_PUSH_(srcLoc); \
336 } GBL_STMT_END

◆ GBL_CTX_PUSH_VERBOSE

#define GBL_CTX_PUSH_VERBOSE (   ...)

Definition at line 338 of file gimbal_ctx.h.

339 { \
340 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
341 GBL_VA_OVERLOAD_SELECT(GBL_CTX_PUSH_VERBOSE, GBL_VA_OVERLOAD_SUFFIXER_1_N, src_, ##__VA_ARGS__)(src_, ##__VA_ARGS__); \
342 } GBL_STMT_END

◆ GBL_CTX_POP_2

#define GBL_CTX_POP_2 (   srcLoc,
  count 
)

Definition at line 344 of file gimbal_ctx.h.

◆ GBL_CTX_POP_1

#define GBL_CTX_POP_1 (   srcLoc)

Definition at line 349 of file gimbal_ctx.h.

◆ GBL_CTX_POP

#define GBL_CTX_POP (   ...)

Definition at line 352 of file gimbal_ctx.h.

353 { \
354 const GblSrcLoc loc = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
355 GBL_VA_OVERLOAD_CALL(GBL_CTX_POP, GBL_VA_OVERLOAD_SUFFIXER_ARGC, loc, __VA_ARGS__); \
356 } GBL_STMT_END

◆ GBL_CTX_LOG_

#define GBL_CTX_LOG_ (   src,
  level,
  pFmt,
  ... 
)

Definition at line 369 of file gimbal_ctx.h.

◆ GBL_CTX_LOG

#define GBL_CTX_LOG (   level,
  pFmt,
  ... 
)

Definition at line 371 of file gimbal_ctx.h.

◆ GBL_CTX_DEBUG

#define GBL_CTX_DEBUG (   pFmt,
  ... 
)

Definition at line 374 of file gimbal_ctx.h.

◆ GBL_CTX_VERBOSE

#define GBL_CTX_VERBOSE (   pFmt,
  ... 
)

Definition at line 377 of file gimbal_ctx.h.

◆ GBL_CTX_INFO

#define GBL_CTX_INFO (   pFmt,
  ... 
)

Definition at line 380 of file gimbal_ctx.h.

◆ GBL_CTX_WARN

#define GBL_CTX_WARN (   pFmt,
  ... 
)

Definition at line 383 of file gimbal_ctx.h.

◆ GBL_CTX_ERROR

#define GBL_CTX_ERROR (   pFmt,
  ... 
)

Definition at line 386 of file gimbal_ctx.h.

◆ GBL_CTX_EVENT

#define GBL_CTX_EVENT (   event)

Definition at line 389 of file gimbal_ctx.h.

390 { \
391 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
392 GBL_UNUSED(src_); \
393 GblObject_sendEvent(GBL_CTX_OBJECT(), (GblEvent*)event); \
394 } GBL_STMT_END
Event base class for use with the event system.

◆ GBL_CTX_RECORD_ASSERT_

#define GBL_CTX_RECORD_ASSERT_ (   record,
  test 
)

Definition at line 400 of file gimbal_ctx.h.

401 { \
402 GBL_ASSERT(!test(record->result), record->message); \
403 } GBL_STMT_END

◆ GBL_CTX_RECORD_ASSERT_CONDITIONAL_

#define GBL_CTX_RECORD_ASSERT_CONDITIONAL_ (   enabled,
  record,
  test 
)

Definition at line 406 of file gimbal_ctx.h.

◆ GBL_CTX_RECORD_ASSERT_PARTIAL

#define GBL_CTX_RECORD_ASSERT_PARTIAL (   record)

Definition at line 410 of file gimbal_ctx.h.

◆ GBL_CTX_RECORD_ASSERT_ERROR

#define GBL_CTX_RECORD_ASSERT_ERROR (   record)

Definition at line 414 of file gimbal_ctx.h.

◆ GBL_CTX_RECORD_ASSERT_UNKNOWN

#define GBL_CTX_RECORD_ASSERT_UNKNOWN (   record)

Definition at line 419 of file gimbal_ctx.h.

◆ GBL_CTX_RECORD_ASSERT

#define GBL_CTX_RECORD_ASSERT (   record)

Definition at line 423 of file gimbal_ctx.h.

424 { \
425 GBL_CTX_RECORD_ASSERT_ERROR(record); \
426 GBL_CTX_RECORD_ASSERT_PARTIAL(record); \
427 GBL_CTX_RECORD_ASSERT_UNKNOWN(record); \
428 } GBL_STMT_END

◆ GBL_CTX_RECORD_LOG_

#define GBL_CTX_RECORD_LOG_ (   prefix,
  record 
)

Definition at line 434 of file gimbal_ctx.h.

435 { \
436 if(GBL_RESULT_##prefix(record->result)) GBL_UNLIKELY { \
437 GBL_CTX_LOG(GBL_CONFIG_LOG_##prefix##_LEVEL, \
438 "%s: %s", \
439 gblResultString(record->result), record->message); \
440 } \
441 } GBL_STMT_END

◆ GBL_CTX_RECORD_LOG_CONDITIONAL_

#define GBL_CTX_RECORD_LOG_CONDITIONAL_ (   prefix,
  record 
)

Definition at line 445 of file gimbal_ctx.h.

◆ GBL_CTX_RECORD_LOG_PARTIAL

#define GBL_CTX_RECORD_LOG_PARTIAL (   record)

Definition at line 450 of file gimbal_ctx.h.

◆ GBL_CTX_RECORD_LOG_ERROR

#define GBL_CTX_RECORD_LOG_ERROR (   record)

Definition at line 454 of file gimbal_ctx.h.

◆ GBL_CTX_RECORD_LOG_UNKNOWN

#define GBL_CTX_RECORD_LOG_UNKNOWN (   record)

Definition at line 458 of file gimbal_ctx.h.

◆ GBL_CTX_RECORD_LOG

#define GBL_CTX_RECORD_LOG (   record)

Definition at line 462 of file gimbal_ctx.h.

463 { \
464 GBL_CTX_RECORD_LOG_ERROR(record); \
465 GBL_CTX_RECORD_LOG_PARTIAL(record); \
466 GBL_CTX_RECORD_LOG_UNKNOWN(record); \
467 } GBL_STMT_END

◆ GBL_CTX_RECORD_LAST_RECORD_

#define GBL_CTX_RECORD_LAST_RECORD_ (   prefix,
  record 
)

Definition at line 471 of file gimbal_ctx.h.

472 { \
473 if(GBL_RESULT_##prefix(record->result)) { \
474 GblContext_callRecordSet_(GBL_CTX_CONTEXT(), GBL_CTX_FRAME_NAME, record); \
475 GblThd_setCallRecord(NULL, record); \
476 } \
477 } GBL_STMT_END

◆ GBL_CTX_RECORD_LAST_RECORD_PARTIAL

#define GBL_CTX_RECORD_LAST_RECORD_PARTIAL (   record)

Definition at line 479 of file gimbal_ctx.h.

◆ GBL_CTX_RECORD_LAST_RECORD_ERROR

#define GBL_CTX_RECORD_LAST_RECORD_ERROR (   record)

Definition at line 482 of file gimbal_ctx.h.

◆ GBL_CTX_RECORD_LAST_RECORD_UNKNOWN

#define GBL_CTX_RECORD_LAST_RECORD_UNKNOWN (   record)

Definition at line 485 of file gimbal_ctx.h.

◆ GBL_CTX_RECORD_LAST_RECORD

#define GBL_CTX_RECORD_LAST_RECORD (   record)

Definition at line 488 of file gimbal_ctx.h.

489 { \
490 GBL_CTX_RECORD_LAST_RECORD_ERROR(record); \
491 GBL_CTX_RECORD_LAST_RECORD_PARTIAL(record); \
492 GBL_CTX_RECORD_LAST_RECORD_UNKNOWN(record); \
493 } GBL_STMT_END

◆ GBL_CTX_RECORD_HANDLER

#define GBL_CTX_RECORD_HANDLER (   record)

Definition at line 496 of file gimbal_ctx.h.

497 { \
498 GBL_CTX_RECORD_LOG((record)); \
499 GBL_CTX_RECORD_LAST_RECORD((record)); \
500 GBL_CTX_RECORD_ASSERT((record)); \
501 } GBL_STMT_END

◆ GBL_CTX_RECORD_SET_N

#define GBL_CTX_RECORD_SET_N (   file,
  func,
  line,
  result,
  ... 
)

Definition at line 503 of file gimbal_ctx.h.

504 { \
505 GBL_CTX_SOURCE_LOC_PUSH(GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN)); \
506 GblCallRecord_construct(&GBL_CTX_RECORD(), result, GBL_CTX_SOURCE(), __VA_ARGS__); \
507 GBL_CTX_RECORD_HANDLER(&GBL_CTX_RECORD()); \
508 GBL_CTX_SOURCE_POP(); \
509 } GBL_STMT_END

◆ GBL_CTX_RECORD_SET_5

#define GBL_CTX_RECORD_SET_5 (   file,
  func,
  line,
  result,
  pFmt 
)

Definition at line 511 of file gimbal_ctx.h.

◆ GBL_CTX_RECORD_SET_4

#define GBL_CTX_RECORD_SET_4 (   file,
  func,
  line,
  result 
)

Definition at line 514 of file gimbal_ctx.h.

◆ GBL_CTX_RECORD_SET

#define GBL_CTX_RECORD_SET (   ...)

Definition at line 517 of file gimbal_ctx.h.

◆ GBL_CTX_CALL_N

#define GBL_CTX_CALL_N (   src,
  funcCall,
  ... 
)

Definition at line 520 of file gimbal_ctx.h.

521 { \
522 GBL_CTX_SOURCE_LOC_PUSH(src); \
523 GBL_MAYBE_UNUSED const GBL_RESULT localResult = (funcCall); \
524 if(!GBL_RESULT_SUCCESS(localResult)) GBL_UNLIKELY { \
525 GBL_CTX_RESULT() = localResult; \
526 } \
527 GBL_CTX_SOURCE_POP(); \
528 } GBL_STMT_END

◆ GBL_CTX_CALL_2

#define GBL_CTX_CALL_2 (   src,
  funcCall 
)

Definition at line 530 of file gimbal_ctx.h.

◆ GBL_CTX_CALL

#define GBL_CTX_CALL (   ...)

Definition at line 533 of file gimbal_ctx.h.

534 { \
535 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
536 GBL_VA_OVERLOAD_SELECT(GBL_CTX_CALL, GBL_VA_OVERLOAD_SUFFIXER_2_N, src_, __VA_ARGS__)(src_, __VA_ARGS__); \
537 } GBL_STMT_END

◆ GBL_CTX_VERIFY_CALL

#define GBL_CTX_VERIFY_CALL (   ...)

Definition at line 539 of file gimbal_ctx.h.

540 { \
541 const GblSrcLoc src_ = GBL_SRC_LOC(GBL_SRC_FILE, GBL_SRC_FN, GBL_SRC_LN); \
542 GBL_VA_OVERLOAD_SELECT(GBL_CTX_CALL, GBL_VA_OVERLOAD_SUFFIXER_2_N, src_, __VA_ARGS__)(src_, __VA_ARGS__); \
543 if(!GBL_RESULT_SUCCESS(GBL_CTX_RESULT())) goto GBL_CTX_END_LABEL; \
544 } GBL_STMT_END

◆ GBL_CTX_BEGIN_FRAME

#define GBL_CTX_BEGIN_FRAME (   file,
  func,
  line,
  pObject,
  frame 
)

Definition at line 549 of file gimbal_ctx.h.

◆ GBL_CTX_BEGIN_LOG_4

#define GBL_CTX_BEGIN_LOG_4 (   file,
  func,
  line,
  hHandle 
)

Definition at line 554 of file gimbal_ctx.h.

◆ GBL_CTX_BEGIN_LOG_N

#define GBL_CTX_BEGIN_LOG_N (   file,
  func,
  line,
  hHandle,
  ... 
)

Definition at line 557 of file gimbal_ctx.h.

◆ GBL_CTX_BEGIN

#define GBL_CTX_BEGIN (   ...)

Definition at line 561 of file gimbal_ctx.h.

◆ GBL_CTX_DONE

#define GBL_CTX_DONE ( )

Definition at line 564 of file gimbal_ctx.h.

◆ GBL_CTX_END_BLOCK

#define GBL_CTX_END_BLOCK ( )

Definition at line 567 of file gimbal_ctx.h.

◆ GBL_CTX_END

#define GBL_CTX_END ( )

Definition at line 574 of file gimbal_ctx.h.

◆ GBL_CTX_END_EMPTY

#define GBL_CTX_END_EMPTY ( )

Definition at line 578 of file gimbal_ctx.h.

◆ GBL_CTX_BLOCK_6

#define GBL_CTX_BLOCK_6 (   file,
  func,
  line,
  hHandle,
  frame,
  block 
)

Definition at line 581 of file gimbal_ctx.h.

◆ GBL_CTX_BLOCK_5

#define GBL_CTX_BLOCK_5 (   file,
  func,
  line,
  hHandle,
  block 
)

Definition at line 586 of file gimbal_ctx.h.

◆ GBL_CTX_BLOCK_4

#define GBL_CTX_BLOCK_4 (   file,
  func,
  line,
  block 
)

Definition at line 589 of file gimbal_ctx.h.

◆ GBL_CTX_BLOCK

#define GBL_CTX_BLOCK (   ...)

Definition at line 592 of file gimbal_ctx.h.

Function Documentation

◆ GBL_ERRNO_RESULT()

static GBL_RESULT GBL_ERRNO_RESULT ( int  ernum)
inlinestatic

Definition at line 197 of file gimbal_ctx.h.

197 {
198 switch(ernum) {
199 case 0: return GBL_RESULT_SUCCESS;
200 default: return GBL_RESULT_ERROR;
201 }
202}

◆ GBL_CTX_INLINE_MALLOC_()

static void * GBL_CTX_INLINE_MALLOC_ ( GblStackFrame GBL_CTX_FRAME_NAME,
size_t  size,
size_t  align,
const char *  pDebugStr 
)
inlinestatic

Definition at line 247 of file gimbal_ctx.h.

247 {
248 GBL_CTX_INLINE_BEGIN(GBL_NULL);
249 if(align == 0) {
250 align = GBL_ALIGNOF(GBL_MAX_ALIGN_T);
251 size = gblAlignedAllocSizeDefault(size);
252 }
253 GBL_ASSERT(size % align == 0);
254 GBL_CTX_EXT(memAlloc_, size, align, pDebugStr, &GBL_CTX_INLINE_RETVAL());
255 GBL_CTX_INLINE_END();
256 // modify/set return value based on result
257 GBL_CTX_INLINE_RETURN();
258}

◆ GBL_CTX_INLINE_REALLOC_()

static void * GBL_CTX_INLINE_REALLOC_ ( GblStackFrame GBL_CTX_FRAME_NAME,
void *  pData,
size_t  newSize,
size_t  newAlign 
)
inlinestatic

Definition at line 284 of file gimbal_ctx.h.

284 {
285 GBL_CTX_INLINE_BEGIN(NULL);
286
287 GBL_CTX_EXT(memRealloc_, pData, newSize, newAlign, &GBL_CTX_INLINE_RETVAL());
288 GBL_CTX_INLINE_END();
289 // modify/set return value based on result
290 GBL_CTX_INLINE_RETURN();
291}

◆ GBL_CTX_INLINE_LOG_()

static GBL_RESULT GBL_CTX_INLINE_LOG_ ( GblStackFrame GBL_CTX_FRAME_NAME,
GblFlags  level,
const char *  pFmt,
  ... 
)
inlinestatic

Definition at line 358 of file gimbal_ctx.h.

358 {
359 GBL_CTX_INLINE_BEGIN(GBL_RESULT_SUCCESS);
360 va_list varArgs;
361 va_start(varArgs, pFmt);
362
363 GBL_CTX_EXT(logWrite_, level, pFmt, varArgs);
364 va_end(varArgs);
365 GBL_CTX_INLINE_END();
366 GBL_CTX_INLINE_RETURN();
367}