acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
_.h
1#pragma once
2
3
4
5
6
7CLASS_DECL_ACME bool should_avoid_parsing_exception();
8CLASS_DECL_ACME bool throw_parsing_exception(const ::scoped_string & scopedstrMessage);
9
10
11
12
13CLASS_DECL_ACME bool throw_network_payload_parsing_exception(const ::scoped_string & scopedstrMessage);
14
15
16CLASS_DECL_ACME void get_call_stack_frames(void ** stack, ::i32 & c);
17
18
19#if MEMDLEAK
20
21::collection::count get_mem_info(::i32** ppiUse, const_char_pointer ** ppszFile, const_char_pointer ** ppszCallStack, ::u32** ppuiLine, memsize** ppsize);
22
23#endif
24
25
26#if defined(NNDEBUG) && !defined(___NO_DEBUG_CRT)
27
28
29
30#define __output_debug_string information
31
32// turn on/off tracking for a ::i16 while
33CLASS_DECL_ACME bool __enable_memory_tracking(bool bTrack);
34
35// Turn on/off the global flag gen_MemoryLeakOverride. if bEnable is true
36// then further calls to __enable_memory_tracking() wont machine the current
37// memory tracking state, until __enable_memory_leak_override(bool bEnable)
38// is called again with bEnable == false.
39CLASS_DECL_ACME bool __enable_memory_leak_override(bool bEnable);
40
41
42
43
44#else
45
46// non-DEBUG_ALLOC version that assume everything is OK
47#define __enable_memory_tracking(bTrack) false
48#define __enable_memory_leak_override(bEnable) true
49#define __output_debug_string(scopedstr) ::information(scopedstr)
50
51
52
53#endif // NNDEBUG
54
55
56
57
58#ifdef NNDEBUG
59
60
61#define DEBUG_NOTE __FILE__
62
63
64#define THREAD_NOTE __get_thread_note()
65#define SET_THREAD_NOTE(x) __set_thread_note(x);
66
67
68#else //NNDEBUG
69
70
71#define SET_THREAD_NOTE(x)
72
73
74#endif //NNDEBUG
75
76
77#define ENSURE_THROW(cond, exception) \
78 do { ::i32 _gen__condVal=!!(cond); ASSERT(_gen__condVal); if (!(_gen__condVal)){exception;} } while (false)
79#define ENSURE(cond) ENSURE_THROW(cond, throw_exception(error_bad_argument))
80#define ENSURE_ARG(cond) ENSURE_THROW(cond, throw_exception(error_bad_argument))
81
82// Debug ASSERT_OKs then throws. Retail throws if p is nullptr
83#define ENSURE_VALID_THROW(p, exception) \
84 do { ASSERT_OK(p); if (!(p)){exception;} } while (false)
85#define ENSURE_VALID(p) ENSURE_VALID_THROW(p, throw_exception(error_bad_argument))
86
87#define ASSERT_POINTER(p, type) \
88 ASSERT(((p) != nullptr) && is_memory_segment_ok((p), sizeof(type), false))
89
90#define ASSERT_NULL_OR_POINTER(p, type) \
91 ASSERT(((p) == nullptr) || is_memory_segment_ok((p), sizeof(type), false))
92
93
94//using c_errno = ::i32;
95
96//CLASS_DECL_ACME c_errno c_runtime_error_check(c_errno error);
97//CLASS_DECL_ACME void __clearerr_s(FILE *stream);
98
99
100
101CLASS_DECL_ACME bool __assert_failed_line(const_char_pointer pszFileName, ::i32 nLine);
102
103CLASS_DECL_ACME void __assert_particle_ok(const ::particle * pparticle, const_char_pointer pszFileName, ::i32 nLine);
104
105//CLASS_DECL_ACME void __dump(const ::particle * pparticle);
106
107
108
Definition stack.h:7