Fix netlist issues. Forgot to commit pstring.[ch] in previous commit.

This commit is contained in:
Couriersud 2013-12-08 11:29:30 +00:00
parent 25534b4611
commit a1c0a48e48
3 changed files with 17 additions and 3 deletions

View File

@ -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
{
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)
int p = tmp.find(entity + "=");
int p = tmp.find(entity.ucase() + "=");
if (p>=0)
{
int pblank = tmp.find(" ", p);

View File

@ -59,6 +59,15 @@ pstring pstring::substr(unsigned int start, int count) const
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
//-------------------------------------------------
@ -101,7 +110,7 @@ void pstring::sfree(str_t *s)
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;
}

View File

@ -8,6 +8,7 @@
#define _PSTRING_H_
#include "nl_config.h"
#include <cstdio>
// ----------------------------------------------------------------------------------------
// 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)
{
void *result = pool.alloc(size + extra);
//std::printf("allocating %ld + %d\n", size, extra);
if (result == NULL)
throw std::bad_alloc();
return result;
@ -133,6 +135,7 @@ public:
pstring left(unsigned int count) const { return substr(0, count); }
pstring right(unsigned int count) const { return substr(len() - count, count); }
pstring ucase() const;
// printf using string as format ...
@ -164,7 +167,9 @@ private:
inline void init()
{
if (m_zero == NULL)
{
m_zero = new(pstring::m_pool, 0) pstring::str_t(0);
}
m_ptr = m_zero;
m_ptr->m_ref_count++;
}