From caafc0f7823054c21a67f096650b2f4a333469c3 Mon Sep 17 00:00:00 2001 From: couriersud Date: Fri, 1 Jul 2016 02:09:14 +0200 Subject: Netlist improvements: - nltool now accepts -Ddefine=value to pass on to netlists - improved option handling and added "dummy" options to add grouping and examples in help output. - improved --cmd=listdevices output - Fix dynamic timestepping. This will work with breakout using real capacitor modelling instead of delay devices. Really slow, but very useful to calibrate timings. - Fix an awful bug in timing for delay devices. - Switched to clang 3.8 and made code compile with -Weverything -Werror -Wno-old-style-cast -Wno-padded -Wno-weak-vtables -Wno-missing-variable-declarations -Wno-conversion -Wno-c++98-compat -Wno-float-equal -Wno-cast-align -Wno-global-constructors -Wno-c++98-compat-pedantic -Wno-exit-time-destructors -Wno-format-nonliteral -Wno-weak-template-vtables This was a helpful exercise since it brought forward some serious issues with implicit constructors. [Couriersud] --- src/lib/netlist/plib/pstring.cpp | 59 ++++++++++------------------------------ 1 file changed, 14 insertions(+), 45 deletions(-) (limited to 'src/lib/netlist/plib/pstring.cpp') diff --git a/src/lib/netlist/plib/pstring.cpp b/src/lib/netlist/plib/pstring.cpp index 20573f5bfa5..c85f18c260a 100644 --- a/src/lib/netlist/plib/pstring.cpp +++ b/src/lib/netlist/plib/pstring.cpp @@ -22,30 +22,6 @@ pstr_t pstring_t::m_zero = pstr_t(0); template<> pstr_t pstring_t::m_zero = pstr_t(0); - -/* - * Uncomment the following to override defaults - */ - -#define IMMEDIATE_MODE (1) -//#define DEBUG_MODE (0) - -#ifdef MAME_DEBUG - #ifndef IMMEDIATE_MODE - #define IMMEDIATE_MODE (1) - #endif - #ifndef DEBUG_MODE - #define DEBUG_MODE (0) - #endif -#else - #ifndef IMMEDIATE_MODE - #define IMMEDIATE_MODE (1) - #endif - #ifndef DEBUG_MODE - #define DEBUG_MODE (0) - #endif -#endif - template pstring_t::~pstring_t() { @@ -117,29 +93,22 @@ void pstring_t::pcopy(const mem_t *from, int size) } template -const pstring_t pstring_t::substr(int start, int count) const +const pstring_t pstring_t::substr(unsigned start, unsigned count) const { pstring_t ret; - int alen = (int) len(); - if (start < 0) - start = 0; - if (start >= alen) + unsigned alen = len(); + if (start >= alen || count == 0) return ret; - if (count <0 || start + count > alen) + if (start + count > alen) count = alen - start; - const char *p = cstr(); - if (count <= 0) - ret.pcopy(p, 0); - else - { - // find start - for (int i=0; i::find(const pstring_t &search, unsigned start) const { const unsigned tlen = len(); const unsigned slen = search.len(); - const char *s = search.cstr(); + const mem_t *s = search.cstr(); const unsigned startt = std::min(start, tlen); - const char *t = cstr(); + const mem_t *t = cstr(); for (std::size_t i=0; i