summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/emucore.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/emucore.h')
-rw-r--r--src/emu/emucore.h121
1 files changed, 37 insertions, 84 deletions
diff --git a/src/emu/emucore.h b/src/emu/emucore.h
index 768fa8c7280..ca54f5208cd 100644
--- a/src/emu/emucore.h
+++ b/src/emu/emucore.h
@@ -13,35 +13,38 @@
#pragma once
-// standard C includes
-#include <cassert>
-#include <cmath>
-#include <cstdio>
-#include <cstring>
-#include <cstdlib>
-#include <cstdarg>
-
// some cleanups for Solaris for things defined in stdlib.h
#if defined(__sun__) && defined(__svr4__)
#undef si_status
#undef WWORD
#endif
-// standard C++ includes
-#include <exception>
-#include <string>
-#include <type_traits>
-#include <typeinfo>
+// centralised forward declarations
+#include "emufwd.h"
-// core system includes
-#include "osdcomm.h"
+// common stuff from lib/util
+#include "corealloc.h"
#include "coretmpl.h"
#include "bitmap.h"
#include "endianness.h"
#include "strformat.h"
#include "vecstream.h"
-#include "emufwd.h"
+// common stuff from osd
+#include "osdcomm.h"
+
+// standard C++ includes
+#include <exception>
+#include <string>
+#include <type_traits>
+#include <typeinfo>
+
+// standard C includes
+#include <cassert>
+#include <cmath>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
//**************************************************************************
@@ -95,6 +98,9 @@ using util::DWORD_XOR_BE;
using util::DWORD_XOR_LE;
+// input ports support up to 32 bits each
+typedef u32 ioport_value;
+
// pen_t is used to represent pixel values in bitmaps
typedef u32 pen_t;
@@ -193,73 +199,11 @@ constexpr int ROT270 = ORIENTATION_SWAP_XY | ORIENTATION_FLIP_Y;
/// \}
-// these are UTF-8 encoded strings for common characters
-#define UTF8_NBSP "\xc2\xa0" /* non-breaking space */
-
-#define UTF8_MULTIPLY "\xc3\x97" /* multiplication sign */
-#define UTF8_DIVIDE "\xc3\xb7" /* division sign */
-#define UTF8_SQUAREROOT "\xe2\x88\x9a" /* square root symbol */
-#define UTF8_PLUSMINUS "\xc2\xb1" /* plusminus symbol */
-
-#define UTF8_POW_2 "\xc2\xb2" /* superscript 2 */
-#define UTF8_POW_X "\xcb\xa3" /* superscript x */
-#define UTF8_POW_Y "\xca\xb8" /* superscript y */
-#define UTF8_PRIME "\xca\xb9" /* prime symbol */
-#define UTF8_DEGREES "\xc2\xb0" /* degrees symbol */
-
-#define UTF8_SMALL_PI "\xcf\x80" /* Greek small letter pi */
-#define UTF8_CAPITAL_SIGMA "\xce\xa3" /* Greek capital letter sigma */
-#define UTF8_CAPITAL_DELTA "\xce\x94" /* Greek capital letter delta */
-
-#define UTF8_MACRON "\xc2\xaf" /* macron symbol */
-#define UTF8_NONSPACE_MACRON "\xcc\x84" /* nonspace macron, use after another char */
-
-#define a_RING "\xc3\xa5" /* small a with a ring */
-#define a_UMLAUT "\xc3\xa4" /* small a with an umlaut */
-#define o_UMLAUT "\xc3\xb6" /* small o with an umlaut */
-#define u_UMLAUT "\xc3\xbc" /* small u with an umlaut */
-#define e_ACUTE "\xc3\xa9" /* small e with an acute */
-#define n_TILDE "\xc3\xb1" /* small n with a tilde */
-
-#define A_RING "\xc3\x85" /* capital A with a ring */
-#define A_UMLAUT "\xc3\x84" /* capital A with an umlaut */
-#define O_UMLAUT "\xc3\x96" /* capital O with an umlaut */
-#define U_UMLAUT "\xc3\x9c" /* capital U with an umlaut */
-#define E_ACUTE "\xc3\x89" /* capital E with an acute */
-#define N_TILDE "\xc3\x91" /* capital N with a tilde */
-
-#define UTF8_LEFT "\xe2\x86\x90" /* cursor left */
-#define UTF8_RIGHT "\xe2\x86\x92" /* cursor right */
-#define UTF8_UP "\xe2\x86\x91" /* cursor up */
-#define UTF8_DOWN "\xe2\x86\x93" /* cursor down */
-
-
//**************************************************************************
// COMMON MACROS
//**************************************************************************
-// macro for defining a copy constructor and assignment operator to prevent copying
-#define DISABLE_COPYING(TYPE) \
- TYPE(const TYPE &) = delete; \
- TYPE &operator=(const TYPE &) = delete
-
-// macro for declaring enumeration operators that increment/decrement like plain old C
-#define DECLARE_ENUM_INCDEC_OPERATORS(TYPE) \
-inline TYPE &operator++(TYPE &value) { return value = TYPE(std::underlying_type_t<TYPE>(value) + 1); } \
-inline TYPE &operator--(TYPE &value) { return value = TYPE(std::underlying_type_t<TYPE>(value) - 1); } \
-inline TYPE operator++(TYPE &value, int) { TYPE const old(value); ++value; return old; } \
-inline TYPE operator--(TYPE &value, int) { TYPE const old(value); --value; return old; }
-
-// macro for declaring bitwise operators for an enumerated type
-#define DECLARE_ENUM_BITWISE_OPERATORS(TYPE) \
-constexpr TYPE operator~(TYPE value) { return TYPE(~std::underlying_type_t<TYPE>(value)); } \
-constexpr TYPE operator&(TYPE a, TYPE b) { return TYPE(std::underlying_type_t<TYPE>(a) & std::underlying_type_t<TYPE>(b)); } \
-constexpr TYPE operator|(TYPE a, TYPE b) { return TYPE(std::underlying_type_t<TYPE>(a) | std::underlying_type_t<TYPE>(b)); } \
-inline TYPE &operator&=(TYPE &a, TYPE b) { return a = a & b; } \
-inline TYPE &operator|=(TYPE &a, TYPE b) { return a = a | b; }
-
-
// this macro passes an item followed by a string version of itself as two consecutive parameters
#define NAME(x) x, #x
@@ -284,17 +228,19 @@ class emu_exception : public std::exception { };
class emu_fatalerror : public emu_exception
{
public:
- emu_fatalerror(util::format_argument_pack<std::ostream> const &args);
- emu_fatalerror(int _exitcode, util::format_argument_pack<std::ostream> const &args);
+ emu_fatalerror(emu_fatalerror const &) = default;
+ emu_fatalerror(emu_fatalerror &&) = default;
+ emu_fatalerror(util::format_argument_pack<char> const &args);
+ emu_fatalerror(int _exitcode, util::format_argument_pack<char> const &args);
template <typename Format, typename... Params>
- emu_fatalerror(Format const &fmt, Params &&... args)
- : emu_fatalerror(static_cast<util::format_argument_pack<std::ostream> const &>(util::make_format_argument_pack(fmt, std::forward<Params>(args)...)))
+ emu_fatalerror(Format &&fmt, Params &&... args)
+ : emu_fatalerror(static_cast<util::format_argument_pack<char> const &>(util::make_format_argument_pack(std::forward<Format>(fmt), std::forward<Params>(args)...)))
{
}
template <typename Format, typename... Params>
- emu_fatalerror(int _exitcode, Format const &fmt, Params &&... args)
- : emu_fatalerror(_exitcode, static_cast<util::format_argument_pack<std::ostream> const &>(util::make_format_argument_pack(fmt, std::forward<Params>(args)...)))
+ emu_fatalerror(int _exitcode, Format &&fmt, Params &&... args)
+ : emu_fatalerror(_exitcode, static_cast<util::format_argument_pack<char> const &>(util::make_format_argument_pack(std::forward<Format>(fmt), std::forward<Params>(args)...)))
{
}
@@ -421,4 +367,11 @@ inline u64 d2u(double d)
return u.vv;
}
+
+//**************************************************************************
+// USEFUL UTILITIES
+//**************************************************************************
+
+using util::make_unique_clear;
+
#endif // MAME_EMU_EMUCORE_H