diff options
Diffstat (limited to 'src/emu/netlist/nl_config.h')
-rw-r--r-- | src/emu/netlist/nl_config.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/emu/netlist/nl_config.h b/src/emu/netlist/nl_config.h index 32ca799da43..3977c703073 100644 --- a/src/emu/netlist/nl_config.h +++ b/src/emu/netlist/nl_config.h @@ -109,6 +109,10 @@ // this macro passes an item followed by a string version of itself as two consecutive parameters #define NLNAME(x) x, #x +//============================================================ +// Exceptions +//============================================================ + // emu_fatalerror is a generic fatal exception that provides an error string class nl_fatalerror : public std::exception { @@ -130,6 +134,21 @@ public: } }; +//============================================================ +// Memory allocation +//============================================================ + +#define nl_alloc(T, ...) global_alloc(T(__VA_ARGS__)) +#define nl_alloc_array(T, N) global_alloc_array(T, N) + +#define nl_free(_ptr) global_free(_ptr) +#define nl_free_array(_ptr) global_free_array(_ptr) + + +//============================================================ +// Asserts +//============================================================ + #ifdef MAME_DEBUG #define nl_assert(x) do { if (!(x)) throw nl_fatalerror("assert: %s:%d: %s", __FILE__, __LINE__, #x); } while (0) #define nl_assert_always(x, msg) do { if (!(x)) throw nl_fatalerror("Fatal error: %s\nCaused by assert: %s:%d: %s", msg, __FILE__, __LINE__, #x); } while (0) |