mirror of
https://github.com/holub/mame
synced 2025-07-05 18:08:04 +03:00
Fix netlist issues. Forgot to commit pstring.[ch] in previous commit.
This commit is contained in:
parent
25534b4611
commit
a1c0a48e48
@ -552,9 +552,9 @@ ATTR_COLD void netlist_logic_output_t::set_levels(const double low, const double
|
|||||||
|
|
||||||
ATTR_COLD double netlist_param_multi_t::dValue(const pstring &entity, const double defval) const
|
ATTR_COLD double netlist_param_multi_t::dValue(const pstring &entity, const double defval) const
|
||||||
{
|
{
|
||||||
pstring tmp = this->Value(); //.ucase();
|
pstring tmp = this->Value().ucase();
|
||||||
// .model 1N914 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)
|
// .model 1N914 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)
|
||||||
int p = tmp.find(entity + "=");
|
int p = tmp.find(entity.ucase() + "=");
|
||||||
if (p>=0)
|
if (p>=0)
|
||||||
{
|
{
|
||||||
int pblank = tmp.find(" ", p);
|
int pblank = tmp.find(" ", p);
|
||||||
|
@ -59,6 +59,15 @@ pstring pstring::substr(unsigned int start, int count) const
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pstring pstring::ucase() const
|
||||||
|
{
|
||||||
|
pstring ret = *this;
|
||||||
|
ret.pcopy(cstr(), len());
|
||||||
|
for (int i=0; i<ret.len(); i++)
|
||||||
|
ret.m_ptr->m_str[i] = toupper((unsigned) ret.m_ptr->m_str[i]);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// pcmpi - compare a character array to an nstring
|
// pcmpi - compare a character array to an nstring
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
@ -101,7 +110,7 @@ void pstring::sfree(str_t *s)
|
|||||||
|
|
||||||
pstring::str_t *pstring::salloc(int n)
|
pstring::str_t *pstring::salloc(int n)
|
||||||
{
|
{
|
||||||
str_t *ret = new(m_pool, n) str_t(n);
|
str_t *ret = new(m_pool, n+1) str_t(n);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#define _PSTRING_H_
|
#define _PSTRING_H_
|
||||||
|
|
||||||
#include "nl_config.h"
|
#include "nl_config.h"
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
// pblockbool: allocate small memory more efficiently at the expense of some overhead
|
// pblockbool: allocate small memory more efficiently at the expense of some overhead
|
||||||
@ -50,6 +51,7 @@ struct pblockpool {
|
|||||||
inline void *operator new(std::size_t size, pblockpool &pool, int extra = 0) throw (std::bad_alloc)
|
inline void *operator new(std::size_t size, pblockpool &pool, int extra = 0) throw (std::bad_alloc)
|
||||||
{
|
{
|
||||||
void *result = pool.alloc(size + extra);
|
void *result = pool.alloc(size + extra);
|
||||||
|
//std::printf("allocating %ld + %d\n", size, extra);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
throw std::bad_alloc();
|
throw std::bad_alloc();
|
||||||
return result;
|
return result;
|
||||||
@ -133,6 +135,7 @@ public:
|
|||||||
|
|
||||||
pstring left(unsigned int count) const { return substr(0, count); }
|
pstring left(unsigned int count) const { return substr(0, count); }
|
||||||
pstring right(unsigned int count) const { return substr(len() - count, count); }
|
pstring right(unsigned int count) const { return substr(len() - count, count); }
|
||||||
|
pstring ucase() const;
|
||||||
|
|
||||||
// printf using string as format ...
|
// printf using string as format ...
|
||||||
|
|
||||||
@ -164,7 +167,9 @@ private:
|
|||||||
inline void init()
|
inline void init()
|
||||||
{
|
{
|
||||||
if (m_zero == NULL)
|
if (m_zero == NULL)
|
||||||
|
{
|
||||||
m_zero = new(pstring::m_pool, 0) pstring::str_t(0);
|
m_zero = new(pstring::m_pool, 0) pstring::str_t(0);
|
||||||
|
}
|
||||||
m_ptr = m_zero;
|
m_ptr = m_zero;
|
||||||
m_ptr->m_ref_count++;
|
m_ptr->m_ref_count++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user