diff options
author | 2016-07-01 02:09:14 +0200 | |
---|---|---|
committer | 2016-07-01 02:09:14 +0200 | |
commit | caafc0f7823054c21a67f096650b2f4a333469c3 (patch) | |
tree | bff4849aa0c539fa0cc06ed630f83fd949e37ebc /src/lib/netlist/plib/pstring.cpp | |
parent | 1f0dc8903f8b865107af2e74758b0ad042c2a8b5 (diff) |
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]
Diffstat (limited to 'src/lib/netlist/plib/pstring.cpp')
-rw-r--r-- | src/lib/netlist/plib/pstring.cpp | 59 |
1 files changed, 14 insertions, 45 deletions
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<putf8_traits>::m_zero = pstr_t(0); template<> pstr_t pstring_t<pu8_traits>::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<typename F> pstring_t<F>::~pstring_t() { @@ -117,29 +93,22 @@ void pstring_t<F>::pcopy(const mem_t *from, int size) } template<typename F> -const pstring_t<F> pstring_t<F>::substr(int start, int count) const +const pstring_t<F> pstring_t<F>::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<start; i++) - p += F::codelen(p); - const char *e = p; - for (int i=0; i<count; i++) - e += F::codelen(e); - ret.pcopy(p, e-p); - } + const mem_t *p = cstr(); + // find start + for (unsigned i=0; i<start; i++) + p += F::codelen(p); + const char *e = p; + for (unsigned i=0; i<count; i++) + e += F::codelen(e); + ret.pcopy(p, e-p); return ret; } @@ -446,9 +415,9 @@ int pstring_t<F>::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<startt; i++) t += F::codelen(t); for (int i=0; i <= (int) tlen - (int) startt - (int) slen; i++) |