Previous 199869 Revisions Next

r26536 Sunday 8th December, 2013 at 11:29:30 UTC by Couriersud
Fix netlist issues. Forgot to commit pstring.[ch] in previous commit.
[src/emu/netlist]nl_base.c pstring.c pstring.h

trunk/src/emu/netlist/pstring.h
r26535r26536
88#define _PSTRING_H_
99
1010#include "nl_config.h"
11#include <cstdio>
1112
1213// ----------------------------------------------------------------------------------------
1314// pblockbool: allocate small memory more efficiently at the expense of some overhead
r26535r26536
5051inline void *operator new(std::size_t size, pblockpool &pool, int extra = 0) throw (std::bad_alloc)
5152{
5253    void *result = pool.alloc(size + extra);
54    //std::printf("allocating %ld + %d\n", size, extra);
5355    if (result == NULL)
5456        throw std::bad_alloc();
5557    return result;
r26535r26536
133135
134136    pstring left(unsigned int count) const { return substr(0, count); }
135137    pstring right(unsigned int count) const  { return substr(len() - count, count); }
138    pstring ucase() const;
136139
137140    // printf using string as format ...
138141
r26535r26536
164167    inline void init()
165168    {
166169        if (m_zero == NULL)
170        {
167171            m_zero = new(pstring::m_pool, 0) pstring::str_t(0);
172        }
168173        m_ptr = m_zero;
169174        m_ptr->m_ref_count++;
170175    }
trunk/src/emu/netlist/nl_base.c
r26535r26536
552552
553553ATTR_COLD double netlist_param_multi_t::dValue(const pstring &entity, const double defval) const
554554{
555    pstring tmp = this->Value(); //.ucase();
555    pstring tmp = this->Value().ucase();
556556    // .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)
557    int p = tmp.find(entity + "=");
557    int p = tmp.find(entity.ucase() + "=");
558558    if (p>=0)
559559    {
560560        int pblank = tmp.find(" ", p);
trunk/src/emu/netlist/pstring.c
r26535r26536
5959    return ret;
6060}
6161
62pstring pstring::ucase() const
63{
64    pstring ret = *this;
65    ret.pcopy(cstr(), len());
66    for (int i=0; i<ret.len(); i++)
67        ret.m_ptr->m_str[i] = toupper((unsigned) ret.m_ptr->m_str[i]);
68    return ret;
69}
70
6271//-------------------------------------------------
6372//  pcmpi - compare a character array to an nstring
6473//-------------------------------------------------
r26535r26536
101110
102111pstring::str_t *pstring::salloc(int n)
103112{
104    str_t *ret = new(m_pool, n) str_t(n);
113    str_t *ret = new(m_pool, n+1) str_t(n);
105114    return ret;
106115}
107116

Previous 199869 Revisions Next


© 1997-2024 The MAME Team