summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author smf- <smf-@users.noreply.github.com>2020-02-09 11:53:37 +0000
committer smf- <smf-@users.noreply.github.com>2020-02-09 11:53:37 +0000
commitee504a81eda6767298222c6ccb871a8f7b15d320 (patch)
tree9f7aa299a5a78ed9f1986a9c7772406ee585c77a
parent3c2b7ffc27d2bfc61d09b5b862415a9b559ef02b (diff)
parentabc5492c176e1eedc5409809eecf03b1f446567f (diff)
Merge branch 'master' of https://github.com/mamedev/mame
-rw-r--r--src/lib/formats/flex_dsk.cpp9
-rw-r--r--src/lib/formats/flex_dsk.h1
-rw-r--r--src/lib/util/strformat.h85
3 files changed, 64 insertions, 31 deletions
diff --git a/src/lib/formats/flex_dsk.cpp b/src/lib/formats/flex_dsk.cpp
index 5944c1ca3bd..ee3750b6101 100644
--- a/src/lib/formats/flex_dsk.cpp
+++ b/src/lib/formats/flex_dsk.cpp
@@ -71,6 +71,15 @@ const char *flex_format::extensions() const
return "dsk";
}
+int flex_format::identify(io_generic *io, uint32_t form_factor)
+{
+ int type = find_size(io, form_factor);
+
+ if (type != -1)
+ return 75;
+ return 0;
+}
+
int flex_format::find_size(io_generic *io, uint32_t form_factor)
{
uint64_t size = io_generic_size(io);
diff --git a/src/lib/formats/flex_dsk.h b/src/lib/formats/flex_dsk.h
index 628da71178c..9df0d1b24b8 100644
--- a/src/lib/formats/flex_dsk.h
+++ b/src/lib/formats/flex_dsk.h
@@ -21,6 +21,7 @@ public:
virtual const char *name() const override;
virtual const char *description() const override;
virtual const char *extensions() const override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual int find_size(io_generic *io, uint32_t form_factor) override;
virtual const wd177x_format::format &get_track_format(const format &f, int head, int track) override;
diff --git a/src/lib/util/strformat.h b/src/lib/util/strformat.h
index db3666e448b..cfba977f69c 100644
--- a/src/lib/util/strformat.h
+++ b/src/lib/util/strformat.h
@@ -187,23 +187,10 @@
#include <type_traits>
#include <utility>
-#if defined(__GLIBCXX__)
-namespace std {
-namespace mame_cxx14_compat {
-template <typename T>
-inline constexpr auto cbegin(const T& cont) noexcept(noexcept(std::begin(cont))) -> decltype(std::begin(cont))
-{ return std::begin(cont); }
-
-template <typename T>
-inline constexpr auto cend(const T& cont) noexcept(noexcept(std::end(cont))) -> decltype(std::end(cont))
-{ return std::end(cont); }
-}
-using namespace mame_cxx14_compat;
-}
-#endif
-
namespace util {
+
namespace detail {
+
//**************************************************************************
// FORMAT CHARACTER DEFINITIONS
//**************************************************************************
@@ -595,6 +582,54 @@ private:
template <typename U> struct default_semantics
{ static constexpr bool value = !signed_integer_semantics<U>::value && !unsigned_integer_semantics<U>::value; };
+ static void apply_signed(Stream &str, char16_t const &value)
+ {
+ str << std::make_signed_t<std::uint_least16_t>(std::uint_least16_t(value));
+ }
+ static void apply_signed(Stream &str, char32_t const &value)
+ {
+ str << std::make_signed_t<std::uint_least32_t>(std::uint_least32_t(value));
+ }
+ template <typename U>
+ static std::enable_if_t<std::is_same<std::make_signed_t<U>, std::make_signed_t<char> >::value> apply_signed(Stream &str, U const &value)
+ {
+ str << int(std::make_signed_t<U>(value));
+ }
+ template <typename U>
+ static std::enable_if_t<!std::is_same<std::make_signed_t<U>, std::make_signed_t<char> >::value && signed_integer_semantics<U>::value> apply_signed(Stream &str, U const &value)
+ {
+ str << value;
+ }
+ template <typename U>
+ static std::enable_if_t<!std::is_same<std::make_signed_t<U>, std::make_signed_t<char> >::value && unsigned_integer_semantics<U>::value> apply_signed(Stream &str, U const &value)
+ {
+ str << std::make_signed_t<U>(value);
+ }
+
+ static void apply_unsigned(Stream &str, char16_t const &value)
+ {
+ str << std::uint_least16_t(value);
+ }
+ static void apply_unsigned(Stream &str, char32_t const &value)
+ {
+ str << std::uint_least32_t(value);
+ }
+ template <typename U>
+ static std::enable_if_t<std::is_same<std::make_unsigned_t<U>, std::make_unsigned_t<char> >::value> apply_unsigned(Stream &str, U const &value)
+ {
+ str << unsigned(std::make_unsigned_t<U>(value));
+ }
+ template <typename U>
+ static std::enable_if_t<!std::is_same<std::make_unsigned_t<U>, std::make_unsigned_t<char> >::value && signed_integer_semantics<U>::value> apply_unsigned(Stream &str, U const &value)
+ {
+ str << std::make_unsigned_t<U>(value);
+ }
+ template <typename U>
+ static std::enable_if_t<!std::is_same<std::make_unsigned_t<U>, std::make_unsigned_t<char> >::value && unsigned_integer_semantics<U>::value> apply_unsigned(Stream &str, U const &value)
+ {
+ str << value;
+ }
+
public:
template <typename U>
static void apply(std::enable_if_t<signed_integer_semantics<U>::value, Stream> &str, format_flags const &flags, U const &value)
@@ -632,10 +667,7 @@ public:
str << std::int64_t(value);
break;
default:
- if (std::is_same<std::make_signed_t<U>, std::make_signed_t<char> >::value)
- str << int(value);
- else
- str << value;
+ apply_signed(str, value);
}
break;
case format_flags::conversion::unsigned_decimal:
@@ -671,10 +703,7 @@ public:
str << std::uint64_t(std::int64_t(value));
break;
default:
- if (std::is_same<std::make_unsigned_t<U>, std::make_unsigned_t<char> >::value)
- str << unsigned(std::make_unsigned_t<U>(value));
- else
- str << std::make_unsigned_t<U>(value);
+ apply_unsigned(str, value);
}
break;
case format_flags::conversion::character:
@@ -726,10 +755,7 @@ public:
str << std::int64_t(std::uint64_t(value));
break;
default:
- if (std::is_same<std::make_signed_t<U>, std::make_signed_t<char> >::value)
- str << int(std::make_signed_t<U>(value));
- else
- str << std::make_signed_t<U>(value);
+ apply_signed(str, value);
}
break;
case format_flags::conversion::unsigned_decimal:
@@ -765,10 +791,7 @@ public:
str << std::int64_t(value);
break;
default:
- if (std::is_same<std::make_unsigned_t<U>, std::make_unsigned_t<char> >::value)
- str << unsigned(value);
- else
- str << value;
+ apply_unsigned(str, value);
}
break;
case format_flags::conversion::character: