-unidasm: Allow input piped from stdin by specifying a bare hyphen as the filename. [AJR, Vas Crabb]

-netlist: Give devices the C++17 namespace treatment.

-Tidied up compiler warning options for 3rdparty.

-emu/render.cpp: Exposed a few information view item properties.
This commit is contained in:
Vas Crabb 2020-11-18 00:58:30 +11:00
parent 95927464dd
commit 612b6472e7
70 changed files with 736 additions and 935 deletions

View File

@ -668,8 +668,8 @@ end
configuration { "vsllvm" }
buildoptions {
"-Wno-unused-function",
"-Wno-enum-conversion",
"-Wno-unused-function",
}
configuration { }
@ -738,8 +738,8 @@ project "7z"
configuration { "gmake or ninja" }
buildoptions_c {
"-Wno-undef",
"-Wno-strict-prototypes",
"-Wno-undef",
}
if _OPTIONS["gcc"]~=nil and string.find(_OPTIONS["gcc"], "clang") and str_to_version(_OPTIONS["gcc_version"]) >= 100000 then
buildoptions_c {
@ -1009,10 +1009,10 @@ project "sqlite3"
configuration { "gmake" }
buildoptions_c {
"-Wno-discarded-qualifiers",
"-Wno-unused-but-set-variable",
"-Wno-bad-function-cast",
"-Wno-discarded-qualifiers",
"-Wno-undef",
"-Wno-unused-but-set-variable",
}
if _OPTIONS["gcc"]~=nil and ((string.find(_OPTIONS["gcc"], "clang") or string.find(_OPTIONS["gcc"], "asmjs") or string.find(_OPTIONS["gcc"], "android"))) then
buildoptions_c {
@ -1359,10 +1359,9 @@ end
configuration { "gmake or ninja" }
buildoptions {
"-Wno-uninitialized",
"-Wno-unused-but-set-variable",
"-Wno-unused-function",
"-Wno-unused-variable",
"-Wno-unused-but-set-variable",
"-Wno-format-extra-args", -- temp for mingw 6.1 till update bgfx code
}
configuration { "rpi" }
buildoptions {
@ -1513,21 +1512,21 @@ project "portaudio"
buildoptions {
"-Wno-deprecated-declarations",
"-Wno-missing-braces",
"-Wno-unused-variable",
"-Wno-switch",
"-Wno-unused-function",
"-Wno-unused-variable",
}
configuration { "gmake or ninja" }
buildoptions_c {
"-Wno-strict-prototypes",
"-Wno-bad-function-cast",
"-Wno-undef",
"-Wno-missing-braces",
"-Wno-unused-variable",
"-Wno-unused-value",
"-Wno-unused-function",
"-Wno-strict-prototypes",
"-Wno-undef",
"-Wno-unknown-pragmas",
"-Wno-unused-function",
"-Wno-unused-value",
"-Wno-unused-variable",
}
local version = str_to_version(_OPTIONS["gcc_version"])
@ -1542,11 +1541,11 @@ project "portaudio"
}
else
buildoptions_c {
"-Wno-unused-but-set-variable",
"-Wno-maybe-uninitialized",
"-Wno-sometimes-uninitialized",
"-w",
"-Wno-unused-but-set-variable",
"-Wno-incompatible-pointer-types-discards-qualifiers",
"-w",
}
end
if string.find(_OPTIONS["gcc"], "clang") and version >= 100000 then
@ -2119,13 +2118,13 @@ end
MAME_DIR .. "3rdparty/bgfx/3rdparty/khronos",
}
buildoptions_c {
"-Wno-undef",
"-Wno-bad-function-cast",
"-Wno-discarded-qualifiers",
"-Wno-format",
"-Wno-format-security",
"-Wno-strict-prototypes",
"-Wno-bad-function-cast",
"-Wno-pointer-to-int-cast",
"-Wno-discarded-qualifiers",
"-Wno-strict-prototypes",
"-Wno-undef",
"-Wno-unused-but-set-variable",
}

View File

@ -1364,7 +1364,7 @@ render_primitive_list &render_target::get_primitives()
if (curitem.screen())
add_container_primitives(list, root_xform, item_xform, curitem.screen()->container(), curitem.blend_mode());
else
add_element_primitives(list, item_xform, *curitem.element(), curitem.state(), curitem.blend_mode());
add_element_primitives(list, item_xform, *curitem.element(), curitem.element_state(), curitem.blend_mode());
}
}
else

View File

@ -748,6 +748,8 @@ public:
// getters
layout_element *element() const { return m_element; }
screen_device *screen() { return m_screen; }
bool bounds_animated() const { return m_bounds.size() > 1U; }
bool color_animated() const { return m_color.size() > 1U; }
render_bounds bounds() const { return m_get_bounds(); }
render_color color() const { return m_get_color(); }
int blend_mode() const { return m_blend_mode; }
@ -761,7 +763,8 @@ public:
bool clickthrough() const { return m_clickthrough; }
// fetch state based on configured source
int state() const { return m_get_elem_state(); }
int element_state() const { return m_get_elem_state(); }
int animation_state() const { return m_get_anim_state(); }
// resolve tags, if any
void resolve_tags();

View File

@ -16,10 +16,7 @@
#define LIB_DECL(decl) factory.add( decl () );
#define LIB_ENTRY(nic) { NETLIB_DEVICE_DECL(nic); LIB_DECL(decl_ ## nic) }
namespace netlist
{
namespace devices
{
namespace netlist::devices {
void initialize_factory(factory::list_t &factory)
{
@ -32,6 +29,5 @@ namespace devices
}
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -26,10 +26,8 @@
#define ADDR2BYTE(a) ((a) >> 3)
#define ADDR2BIT(a) ((a) & 0x7)
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(2102A)
{
NETLIB_CONSTRUCTOR(2102A)
@ -90,5 +88,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(2102A, "RAM_2102A", "+CEQ,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,+A8,+A9,+RWQ,+DI,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -41,10 +41,7 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
// FIXME: optimize clock input
@ -114,5 +111,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(CD4006, "CD4006", "+CLOCK,+D1,+D2,+D3,+D4,+D1P4,+D1P4S,+D2P4,+D2P5,+D3P4,+D4P4,+D4P5,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -42,10 +42,7 @@
#include "nl_base.h"
#include "nl_factory.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(CD4013)
{
@ -122,5 +119,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(CD4013, "CD4013", "+CLOCK,+DATA,+RESET,+SET,@VDD,@VSS")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -40,10 +40,7 @@
#include "nl_base.h"
#include "nl_factory.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
template <std::size_t MaxCount>
NETLIB_OBJECT(CD4017_base)
@ -113,5 +110,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(CD4017, "CD4017", "")
NETLIB_DEVICE_IMPL(CD4022, "CD4022", "")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -40,10 +40,7 @@
#include "nl_base.h"
#include "nl_factory.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
template <unsigned TotalBits, unsigned LiveBitmask>
NETLIB_OBJECT(CD4020_sub)
@ -170,5 +167,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(CD4024, "CD4024", "")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -130,10 +130,7 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(CD4029)
{
@ -268,5 +265,4 @@ namespace devices
NETLIB_DEVICE_IMPL(CD4029, "CD4029", "+PE,+J1,+J2,+J3,+J4,+CI,+UD,+BD,+CLK,@VCC,@GND")
} // namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -38,10 +38,7 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(CD4042)
@ -116,5 +113,4 @@ namespace devices
NETLIB_DEVICE_IMPL(CD4042, "CD4042", "+D1,+D2,+D3,+D4,+POL,+CLK,@VCC,@GND")
} // namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -26,10 +26,8 @@
#include "analog/nlid_twoterm.h"
#include "solver/nld_solver.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(CD4053_GATE)
{
NETLIB_CONSTRUCTOR_MODEL(CD4053_GATE, "CD4XXX")
@ -140,5 +138,5 @@ namespace netlist
};
NETLIB_DEVICE_IMPL(CD4053_GATE, "CD4053_GATE", "")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -25,10 +25,8 @@
#include "solver/nld_solver.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(CD4066_GATE)
{
NETLIB_CONSTRUCTOR_MODEL(CD4066_GATE, "CD4XXX")
@ -81,5 +79,5 @@ namespace netlist
};
NETLIB_DEVICE_IMPL(CD4066_GATE, "CD4066_GATE", "")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -49,11 +49,7 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(CD4076)
{
@ -128,5 +124,4 @@ namespace devices
NETLIB_DEVICE_IMPL(CD4076, "CD4076", "+I1,+I2,+I3,+I4,+ID1,+ID2,+OD1,+OD2,@VCC,@GND")
} // namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -63,10 +63,7 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
template <typename D>
NETLIB_OBJECT(74107_base)
@ -153,5 +150,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(74107, "TTL_74107", "+CLK,+J,+K,+CLRQ,@VCC,@GND")
NETLIB_DEVICE_IMPL(74107A, "TTL_74107A", "+CLK,+J,+K,+CLRQ,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -62,10 +62,8 @@
// FIXME: this can probably be merged with nld_7473.cpp
// FIXME: timing, see 74107 for example, use template
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(74113)
{
NETLIB_CONSTRUCTOR(74113)
@ -145,5 +143,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(74113, "TTL_74113", "+CLK,+J,+K,+CLRQ,@VCC,@GND")
NETLIB_DEVICE_IMPL(74113A, "TTL_74113A", "+CLK,+J,+K,+CLRQ,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -49,10 +49,7 @@
#include "analog/nlid_twoterm.h"
#include "nlid_system.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
/// \brief Base monostable device
///
@ -290,5 +287,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(4538, "CD4538", "")
NETLIB_DEVICE_IMPL(9602, "TTL_9602", "")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -9,10 +9,7 @@
#include <type_traits>
namespace netlist
{
namespace devices
{
namespace netlist::devices {
template <typename D>
NETLIB_OBJECT(74125_base)
@ -77,5 +74,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(74125, "TTL_74125_GATE", "")
NETLIB_DEVICE_IMPL(74126, "TTL_74126_GATE", "")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -44,10 +44,7 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
// FIXME: timing is not 100% accurate, Strobe and Select inputs have a
// slightly longer timing .
@ -107,5 +104,4 @@ namespace devices
NETLIB_DEVICE_IMPL(74153, "TTL_74153", "+C0,+C1,+C2,+C3,+A,+B,+G,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -17,14 +17,10 @@
// FIXME: this file could be created programmatically
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_DEVICE_IMPL(74161, "TTL_74161", "+CLK,+ENP,+ENT,+CLRQ,+LOADQ,+A,+B,+C,+D,@VCC,@GND")
// FIXME: This happens on copy/paste
NETLIB_DEVICE_IMPL(74161_fixme, "TTL_74161_FIXME", "+A,+B,+C,+D,+CLRQ,+LOADQ,+CLK,+ENP,+ENT,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -17,12 +17,8 @@
// FIXME: this file could be created programmatically
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_DEVICE_IMPL(74163, "TTL_74163", "+CLK,+ENP,+ENT,+CLRQ,+LOADQ,+A,+B,+C,+D,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -50,10 +50,8 @@
// FIXME: clk input to be separated - only falling edge relevant
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(74164)
{
NETLIB_CONSTRUCTOR(74164)
@ -115,5 +113,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(74164, "TTL_74164", "+A,+B,+CLRQ,+CLK,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -26,10 +26,7 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(74165)
{
@ -97,5 +94,4 @@ namespace netlist
// FIXME: Timing
NETLIB_DEVICE_IMPL(74165, "TTL_74165", "+CLK,+CLKINH,+SH_LDQ,+SER,+A,+B,+C,+D,+E,+F,+G,+H,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -28,10 +28,8 @@
// FIXME: separate handlers for inputs
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(74166)
{
NETLIB_CONSTRUCTOR(74166)
@ -119,5 +117,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(74166, "TTL_74166", "+CLK,+CLKINH,+SH_LDQ,+SER,+A,+B,+C,+D,+E,+F,+G,+H,+CLRQ,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -35,10 +35,8 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(74174_GATE)
{
NETLIB_CONSTRUCTOR(74174_GATE)
@ -163,5 +161,4 @@ namespace devices
NETLIB_DEVICE_IMPL(74174, "TTL_74174", "+CLK,+D1,+D2,+D3,+D4,+D5,+D6,+CLRQ,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -37,10 +37,7 @@
// FIXME: optimize
namespace netlist
{
namespace devices
{
namespace netlist::devices {
static constexpr const std::array<netlist_time, 2> delay = { NLTIME_FROM_NS(25), NLTIME_FROM_NS(25) };
static constexpr const std::array<netlist_time, 2> delay_clear = { NLTIME_FROM_NS(40), NLTIME_FROM_NS(25) };
@ -115,5 +112,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(74175, "TTL_74175", "+CLK,+D1,+D2,+D3,+D4,+CLRQ,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -29,10 +29,7 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
static constexpr const unsigned MAXCNT = 9;
@ -153,5 +150,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(74192, "TTL_74192", "+A,+B,+C,+D,+CLEAR,+LOADQ,+CU,+CD,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -25,10 +25,7 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
static constexpr const unsigned MAXCNT = 15;
@ -137,5 +134,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(74193, "TTL_74193", "+A,+B,+C,+D,+CLEAR,+LOADQ,+CU,+CD,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -25,10 +25,7 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
// FIXME: Optimize
NETLIB_OBJECT(74194)
@ -113,5 +110,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(74194, "TTL_74194", "+CLK,+S0,+S1,+SRIN,+A,+B,+C,+D,+SLIN,+CLRQ,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -24,10 +24,7 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
/* FIXME: This should be a single device, i.e. one tristate buffer only.
*
@ -71,5 +68,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(74365, "TTL_74365", "+G1Q,+G2Q,+A1,+A2,+A3,+A4,+A5,+A6,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -50,10 +50,7 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
constexpr const std::array<netlist_time, 2> delay = { NLTIME_FROM_NS(25), NLTIME_FROM_NS(25) };
@ -101,5 +98,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(74377_GATE, "TTL_74377_GATE", "")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -21,10 +21,8 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
static constexpr const unsigned MAXCNT = 15;
NETLIB_OBJECT(74393)
@ -87,5 +85,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(74393, "TTL_74393", "+CP,+MR,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -26,10 +26,8 @@
#include <array>
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(7448)
{
NETLIB_CONSTRUCTOR(7448)
@ -136,5 +134,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(7448, "TTL_7448", "+A,+B,+C,+D,+LTQ,+BIQ,+RBIQ,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -23,10 +23,7 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
static constexpr const std::array<netlist_time, 2> times = { NLTIME_FROM_NS(15), NLTIME_FROM_NS(22) };
@ -90,5 +87,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(7450, "TTL_7450_ANDORINVERT", "+A,+B,+C,+D,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -59,10 +59,8 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(7473)
{
NETLIB_CONSTRUCTOR(7473)
@ -137,5 +135,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(7473, "TTL_7473", "+CLK,+J,+K,+CLRQ,@VCC,@GND")
NETLIB_DEVICE_IMPL(7473A, "TTL_7473A", "+CLK,+J,+K,+CLRQ,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -44,10 +44,7 @@
#include <array>
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(7474)
{
@ -117,5 +114,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(7474, "TTL_7474", "+CLK,+D,+CLRQ,+PREQ,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -36,10 +36,8 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
template<bool HasQQ>
NETLIB_OBJECT(7475_GATE_BASE)
{
@ -97,5 +95,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(7475_GATE, "TTL_7475_GATE", "")
NETLIB_DEVICE_IMPL(7477_GATE, "TTL_7477_GATE", "")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -26,10 +26,8 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(7483)
{
NETLIB_CONSTRUCTOR(7483)
@ -111,5 +109,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(7483, "TTL_7483", "+A1,+A2,+A3,+A4,+B1,+B2,+B3,+B4,+C0,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -24,10 +24,8 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(7485)
{
NETLIB_CONSTRUCTOR(7485)
@ -95,5 +93,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(7485, "TTL_7485", "+A0,+A1,+A2,+A3,+B0,+B1,+B2,+B3,+LTIN,+EQIN,+GTIN,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -54,10 +54,7 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
static constexpr const std::array<netlist_time, 4> delay =
{
@ -143,5 +140,4 @@ namespace devices
NETLIB_DEVICE_IMPL(7490, "TTL_7490", "+A,+B,+R1,+R2,+R91,+R92,@VCC,@GND")
} // namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -52,10 +52,7 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
static constexpr const std::array<netlist_time, 4> delay =
{
@ -135,5 +132,4 @@ namespace devices
NETLIB_DEVICE_IMPL(7492, "TTL_7492", "+A,+B,+R1,+R2,@VCC,@GND")
} // namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -57,10 +57,7 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
static constexpr std::array<netlist_time, 3> out_delay { NLTIME_FROM_NS(18), NLTIME_FROM_NS(36), NLTIME_FROM_NS(54) };
@ -133,5 +130,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(7493, "TTL_7493", "+CLKA,+CLKB,+R1,+R2,@VCC,@GND")
} // namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -39,10 +39,7 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
static constexpr const std::array<netlist_time, 2> out_delay_CLK_Y = { NLTIME_FROM_NS(20), NLTIME_FROM_NS(26) }; // tPHL, tPLH
static constexpr const std::array<netlist_time, 2> out_delay_CLK_Z = { NLTIME_FROM_NS(17), NLTIME_FROM_NS(12) };
@ -168,5 +165,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(7497, "TTL_7497", "+CLK,+STRBQ,+ENQ,+UNITYQ,+CLR,+B0,+B1,+B2,+B3,+B4,+B5,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -60,10 +60,7 @@
#include "analog/nlid_twoterm.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
struct SN74LS629clk
{
@ -207,5 +204,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(SN74LS629, "SN74LS629", "CAP,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -20,10 +20,8 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(8277_shifter)
{
NETLIB_CONSTRUCTOR(8277_shifter)
@ -165,5 +163,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(8277, "TTL_8277", "+RESET,+CLK,+CLKA,+D0A,+D1A,+DSA,+CLKB,+D0B,+D1B,+DSB,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -27,10 +27,8 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(82S115)
{
NETLIB_CONSTRUCTOR(82S115)
@ -93,5 +91,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(82S115, "PROM_82S115", "+CE1Q,+CE2,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,+A8,+STROBE,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -24,10 +24,8 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(82S16)
{
NETLIB_CONSTRUCTOR(82S16)
@ -123,5 +121,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(82S16, "TTL_82S16", "")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -17,12 +17,8 @@
// FIXME: this file could be created programmatically
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_DEVICE_IMPL(9310, "TTL_9310", "+CLK,+ENP,+ENT,+CLRQ,+LOADQ,+A,+B,+C,+D,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -93,12 +93,8 @@
// FIXME: this file could be created programmatically
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_DEVICE_IMPL(9316, "TTL_9316", "+CLK,+ENP,+ENT,+CLRQ,+LOADQ,+A,+B,+C,+D,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -20,10 +20,7 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
// FIXME: m_E should activate deactivate m_A
@ -66,5 +63,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(9321, "TTL_9321", "+E,+A0,+A1")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -20,10 +20,8 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
class NETLIB_NAME(9322);
NETLIB_OBJECT(9322_GATE)
@ -108,5 +106,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(9322, "TTL_9322", "+SELECT,+A1,+B1,+A2,+B2,+A3,+B3,+A4,+B4,+STROBE,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -20,10 +20,8 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(Am2847_shifter)
{
NETLIB_CONSTRUCTOR_MODEL(Am2847_shifter, "CD4XXX")
@ -128,5 +126,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(AM2847, "TTL_AM2847", "+CP,+INA,+INB,+INC,+IND,+RCA,+RCB,+RCC,+RCD,@VSS,@VDD")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -20,10 +20,8 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(9314)
{
NETLIB_CONSTRUCTOR(9314)
@ -98,5 +96,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(9314, "TTL_9314", "+EQ,+MRQ,+S0Q,+S1Q,+S2Q,+S3Q,+D0,+D1,+D2,+D3,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -64,10 +64,8 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(9334)
{
NETLIB_CONSTRUCTOR(9334)
@ -177,5 +175,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(9334, "TTL_9334", "+CQ,+EQ,+D,+A0,+A1,+A2,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -7,10 +7,8 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(nicRSFF)
{
NETLIB_CONSTRUCTOR(nicRSFF)
@ -96,5 +94,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(nicRSFF, "NETDEV_RSFF", "")
NETLIB_DEVICE_IMPL(nicDelay, "NETDEV_DELAY", "")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -28,10 +28,8 @@
#include <thread>
#include <vector>
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(log)
{
NETLIB_CONSTRUCTOR(log)
@ -187,5 +185,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(log, "LOG", "+I")
NETLIB_DEVICE_IMPL(logD, "LOGD", "+I,+I2")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -19,10 +19,8 @@
#include "analog/nlid_twoterm.h"
#include "solver/nld_matrix_solver.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(MM5837)
{
NETLIB_CONSTRUCTOR(MM5837)
@ -115,5 +113,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(MM5837, "MM5837", "")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -10,10 +10,8 @@
#define R_OFF (1E20)
#define R_ON (1)
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(NE555)
{
NETLIB_CONSTRUCTOR(NE555)
@ -161,5 +159,5 @@ namespace netlist
NETLIB_DEVICE_IMPL(NE555, "NE555", "")
NETLIB_DEVICE_IMPL_ALIAS(MC1455P, NE555, "MC1455P", "")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -47,10 +47,8 @@
#include "analog/nlid_twoterm.h"
#include "nl_factory.h"
namespace netlist
{
namespace analog
{
namespace netlist::analog {
NETLIB_OBJECT_DERIVED(r2r_dac, twoterm)
{
NETLIB_CONSTRUCTOR(r2r_dac)
@ -85,10 +83,11 @@ namespace netlist
}
);
}
} //namespace analog
namespace devices {
} // namespace netlist::analog
namespace netlist::devices {
NETLIB_DEVICE_IMPL_NS(analog, r2r_dac, "R2R_DAC", "VIN,R,N")
} // namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -11,7 +11,7 @@
template <typename N, typename T>
constexpr bool TOR(N n, T &a)
{
return (n == 0 ? false : TOR(n-1, a) || a[n-1]());
return (n == 0) ? false : (TOR(n - 1, a) || a[n - 1]());
}
template <typename T>
@ -20,10 +20,8 @@ constexpr bool TOR(T &a)
return TOR(a.size(), a);
}
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(mk28000_prom)
{
NETLIB_CONSTRUCTOR(mk28000_prom)
@ -304,5 +302,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(MK28000, "PROM_MK28000", "+OE1,+OE2,+ARQ,+A1,+A2,+A3,+A4,+A5,+A6,+A7,+A8,+A9,+A10,+A11,@VCC,@GND")
NETLIB_DEVICE_IMPL(MCM14524, "ROM_MCM14524", "+EN,+CLK,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -10,10 +10,7 @@
#include "nl_errstr.h"
#include "solver/nld_solver.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
/*
* Over-simplified TTL Schmitt trigger model
@ -122,5 +119,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(schmitt_trigger, "SCHMITT_TRIGGER", "STMODEL")
} // namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -11,10 +11,7 @@
#include "plib/pstrutil.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
// -----------------------------------------------------------------------------
// extclock
@ -140,5 +137,4 @@ namespace devices
NETLIB_DEVICE_IMPL(logic_input, "LOGIC_INPUT", "IN,MODEL")
NETLIB_DEVICE_IMPL_ALIAS(logic_input_ttl, logic_input, "TTL_INPUT", "IN")
} // namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -27,10 +27,8 @@
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(TMS4800)
{
NETLIB_CONSTRUCTOR(TMS4800)
@ -88,5 +86,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(TMS4800, "ROM_TMS4800", "+AR,+OE1,+OE2,+A0,+A1,+A2,+A3,+A4,+A5,+A6,+A7,+A8,+A9,+A10,@VCC,@GND")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -12,10 +12,8 @@
// FIXME: netlist now supports proper tristate outputs. All of this is legacy
// now and needs to be removed at some time.
namespace netlist
{
namespace devices
{
namespace netlist::devices {
NETLIB_OBJECT(tristate)
{
NETLIB_CONSTRUCTOR(tristate)
@ -73,5 +71,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(tristate, "TTL_TRISTATE", "+CEQ1,+D1,+CEQ2,+D2")
NETLIB_DEVICE_IMPL(tristate3, "TTL_TRISTATE3", "")
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -12,10 +12,7 @@
#include <array>
namespace netlist
{
namespace devices
{
namespace netlist::devices {
// -----------------------------------------------------------------------------
// nld_base_proxy
@ -184,6 +181,4 @@ namespace netlist
}
}
} //namespace devices
} // namespace netlist
} // namespace netlist::devices

View File

@ -14,10 +14,7 @@
#include "analog/nlid_twoterm.h"
#include "nl_base.h"
namespace netlist
{
namespace devices
{
namespace netlist::devices {
// -----------------------------------------------------------------------------
// nld_base_proxy
@ -121,7 +118,6 @@ namespace devices
state_var<netlist_sig_t> m_last_state;
};
} // namespace devices
} // namespace netlist
} // namespace netlist::devices
#endif /* NLD_PROXY_H_ */
#endif // NLD_PROXY_H_

View File

@ -16,10 +16,8 @@
#include <random>
namespace netlist
{
namespace devices
{
namespace netlist::devices {
// -----------------------------------------------------------------------------
// clock
// -----------------------------------------------------------------------------
@ -579,7 +577,6 @@ namespace devices
state_var<distribution> m_dis;
};
} // namespace devices
} // namespace netlist
} // namespace netlist::devices
#endif // NLD_SYSTEM_H_

View File

@ -12,10 +12,7 @@
#include <cstdint>
#include <vector>
namespace netlist
{
namespace devices
{
namespace netlist::devices {
template<std::size_t m_NI, std::size_t m_NO>
class NETLIB_NAME(truthtable_t) : public device_t
@ -657,10 +654,9 @@ void truthtable_parser::parse(const std::vector<pstring> &truthtable)
}
}
} // namespace devices
} // namespace netlist::devices
namespace factory
{
namespace netlist::factory {
truthtable_base_element_t::truthtable_base_element_t(const pstring &name,
properties &&props)
@ -708,5 +704,4 @@ namespace factory
return ret;
}
} // namespace factory
} // namespace netlist
} // namespace netlist::factory

View File

@ -13,10 +13,8 @@
#define USE_TT_ALTERNATIVE (0)
namespace netlist
{
namespace factory
{
namespace netlist::factory {
class truthtable_base_element_t : public factory::element_t
{
public:
@ -29,7 +27,6 @@ namespace netlist
host_arena::unique_ptr<truthtable_base_element_t> truthtable_create(tt_desc &desc,
properties &&props);
} // namespace factory
} // namespace netlist
} // namespace netlist::factory
#endif // NLID_TRUTHTABLE_H_

View File

@ -191,11 +191,19 @@ using util::BIT;
#include "eminline.h"
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <stdexcept>
#include <cctype>
#ifdef _WIN32
#include <fcntl.h>
#include <io.h>
#include <stdio.h>
#endif
using u8 = util::u8;
using u16 = util::u16;
@ -1057,7 +1065,7 @@ static int parse_options(int argc, char *argv[], options *opts)
char *curarg = argv[arg];
// is it a switch?
if(curarg[0] == '-') {
if(curarg[0] == '-' && curarg[1] != '\0') {
if(pending_base || pending_arch || pending_mode || pending_skip || pending_count)
goto usage;
@ -1083,11 +1091,9 @@ static int parse_options(int argc, char *argv[], options *opts)
opts->xchbytes = true;
else
goto usage;
}
} else if(pending_base) {
// base PC
else if(pending_base)
{
int result;
if(curarg[0] == '0' && curarg[1] == 'x')
result = sscanf(&curarg[2], "%x", &opts->basepc);
@ -1098,30 +1104,26 @@ static int parse_options(int argc, char *argv[], options *opts)
if(result != 1)
goto usage;
pending_base = false;
}
} else if(pending_mode) {
// mode
else if(pending_mode)
{
if(sscanf(curarg, "%d", &opts->mode) != 1)
goto usage;
pending_mode = false;
}
} else if(pending_arch) {
// architecture
else if(pending_arch) {
int curarch;
for(curarch = 0; curarch < ARRAY_LENGTH(dasm_table); curarch++)
if(core_stricmp(curarg, dasm_table[curarch].name) == 0)
break;
if(curarch == ARRAY_LENGTH(dasm_table))
auto const arch = std::find_if(
std::begin(dasm_table),
std::end(dasm_table),
[&curarg] (dasm_table_entry const &e) { return !core_stricmp(curarg, e.name); });
if (std::end(dasm_table) == arch)
goto usage;
opts->dasm = &dasm_table[curarch];
opts->dasm = &*arch;
pending_arch = false;
}
} else if(pending_skip) {
// skip bytes
else if(pending_skip) {
int result;
if(curarg[0] == '0' && curarg[1] == 'x')
result = sscanf(&curarg[2], "%x", &opts->skip);
@ -1130,23 +1132,22 @@ static int parse_options(int argc, char *argv[], options *opts)
if(result != 1)
goto usage;
pending_skip = false;
}
} else if(pending_count) {
// size
else if(pending_count) {
if(sscanf(curarg, "%d", &opts->count) != 1)
goto usage;
pending_count = false;
}
} else if(opts->filename == nullptr) {
// filename
else if(opts->filename == nullptr)
opts->filename = curarg;
} else {
// fail
else
goto usage;
}
}
// if we have a dangling option, error
if(pending_base || pending_arch || pending_mode || pending_skip || pending_count)
@ -1155,6 +1156,7 @@ static int parse_options(int argc, char *argv[], options *opts)
// if no file or no architecture, fail
if(opts->filename == nullptr || opts->dasm == nullptr)
goto usage;
return 0;
usage:
@ -1166,8 +1168,7 @@ usage:
const int colwidth = 1 + std::strlen(std::max_element(std::begin(dasm_table), std::end(dasm_table), [](const dasm_table_entry &a, const dasm_table_entry &b) { return std::strlen(a.name) < std::strlen(b.name); })->name);
const int columns = std::max(1, 80 / colwidth);
const int numrows = (ARRAY_LENGTH(dasm_table) + columns - 1) / columns;
for(unsigned curarch = 0; curarch < numrows * columns; curarch++)
{
for(unsigned curarch = 0; curarch < numrows * columns; curarch++) {
const int row = curarch / columns;
const int col = curarch % columns;
const int index = col * numrows + row;
@ -1188,14 +1189,44 @@ int main(int argc, char *argv[])
return 1;
// Load the file
void *data;
uint32_t length;
void *data = nullptr;
u32 length = 0;
if(std::strcmp(opts.filename, "-") != 0) {
osd_file::error filerr = util::core_file::load(opts.filename, &data, length);
if(filerr != osd_file::error::NONE)
{
fprintf(stderr, "Error opening file '%s'\n", opts.filename);
if(filerr != osd_file::error::NONE) {
std::fprintf(stderr, "Error opening file '%s'\n", opts.filename);
return 1;
}
}
else
{
#ifdef _WIN32
if (_setmode(_fileno(stdin), _O_BINARY) == -1) {
#else
if (!std::freopen(nullptr, "rb", stdin)) {
#endif
std::fprintf(stderr, "Error reopening stin in binary mode\n");
return 1;
}
std::size_t allocated = 0x1000;
data = std::malloc(allocated);
while(!std::ferror(stdin) && !std::feof(stdin)) {
if(length == allocated) {
allocated <<= 1;
data = std::realloc(data, allocated);
}
if(!data) {
std::fprintf(stderr, "Error allocating buffer\n");
return 1;
}
length += std::fread((u8 *)data + length, 1, allocated - length, stdin);
}
if(!length || (std::ferror(stdin) && !std::feof(stdin))) {
std::fprintf(stderr, "Error reading from stdin\n");
return 1;
}
}
// Build the disasm object
std::unique_ptr<util::disasm_interface> disasm(opts.dasm->alloc());