mirror of
https://github.com/holub/mame
synced 2025-04-19 23:12:11 +03:00
netlist: optimize headers.
* where possible rely on forward declarations to optimiuze compile time.
This commit is contained in:
parent
c127811083
commit
e62e2d759b
@ -9,7 +9,6 @@
|
||||
///
|
||||
|
||||
#include "nl_base.h"
|
||||
//#include "../nl_setup.h"
|
||||
|
||||
//
|
||||
// Set to 0 to use a linearized diode model in the range exceeding
|
||||
|
@ -340,25 +340,6 @@ namespace netlist
|
||||
pstring m_setup_func_name;
|
||||
};
|
||||
|
||||
class source_token_t : public source_netlist_t
|
||||
{
|
||||
public:
|
||||
source_token_t(const pstring &name, const parser_t::token_store &store)
|
||||
: m_store(store)
|
||||
, m_name(name)
|
||||
{
|
||||
}
|
||||
|
||||
bool parse(nlparse_t &setup, const pstring &name) override;
|
||||
|
||||
protected:
|
||||
plib::istream_uptr stream(const pstring &name) override;
|
||||
|
||||
private:
|
||||
parser_t::token_store m_store;
|
||||
pstring m_name;
|
||||
};
|
||||
|
||||
} // namespace netlist
|
||||
|
||||
|
||||
|
@ -28,8 +28,6 @@
|
||||
#define IND_P(ind) ((ind) * 1e-12)
|
||||
#endif
|
||||
|
||||
NETLIST_EXTERNAL(base_lib)
|
||||
|
||||
#include "../generated/nld_devinc.h"
|
||||
|
||||
|
||||
|
@ -16,10 +16,10 @@
|
||||
|
||||
#include "nl_errstr.h"
|
||||
|
||||
#include "devices/net_lib.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
NETLIST_EXTERNAL(base_lib)
|
||||
|
||||
namespace netlist
|
||||
{
|
||||
|
||||
|
@ -561,4 +561,26 @@ pstring parser_t::stringify_expression(token_t &tok)
|
||||
return ret;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
// source_token_t
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
bool source_token_t::parse(nlparse_t &setup, const pstring &name)
|
||||
{
|
||||
if (name == m_name)
|
||||
{
|
||||
auto ret = setup.parse_tokens(m_store, name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
plib::istream_uptr source_token_t::stream(const pstring &name)
|
||||
{
|
||||
plib::unused_var(name);
|
||||
return plib::istream_uptr();
|
||||
}
|
||||
|
||||
|
||||
} // namespace netlist
|
||||
|
@ -9,6 +9,7 @@
|
||||
#define NL_PARSER_H_
|
||||
|
||||
#include "nltypes.h" // for setup_t
|
||||
#include "core/setup.h"
|
||||
#include "plib/ptokenizer.h"
|
||||
|
||||
#include <unordered_map>
|
||||
@ -89,7 +90,27 @@ namespace netlist
|
||||
|
||||
std::unordered_map<pstring, token_store> m_local;
|
||||
token_store *m_cur_local;
|
||||
};
|
||||
};
|
||||
|
||||
class source_token_t : public source_netlist_t
|
||||
{
|
||||
public:
|
||||
source_token_t(const pstring &name, const parser_t::token_store &store)
|
||||
: m_store(store)
|
||||
, m_name(name)
|
||||
{
|
||||
}
|
||||
|
||||
bool parse(nlparse_t &setup, const pstring &name) override;
|
||||
|
||||
protected:
|
||||
plib::istream_uptr stream(const pstring &name) override;
|
||||
|
||||
private:
|
||||
parser_t::token_store m_store;
|
||||
pstring m_name;
|
||||
};
|
||||
|
||||
|
||||
} // namespace netlist
|
||||
|
||||
|
@ -352,7 +352,7 @@ namespace netlist
|
||||
return false;
|
||||
}
|
||||
|
||||
bool nlparse_t::parse_tokens(const parser_t::token_store &tokens, const pstring &name)
|
||||
bool nlparse_t::parse_tokens(const plib::detail::token_store &tokens, const pstring &name)
|
||||
{
|
||||
parser_t parser(*this);
|
||||
return parser.parse(tokens, name);
|
||||
@ -1762,22 +1762,5 @@ plib::istream_uptr source_proc_t::stream(const pstring &name)
|
||||
return plib::istream_uptr();
|
||||
}
|
||||
|
||||
bool source_token_t::parse(nlparse_t &setup, const pstring &name)
|
||||
{
|
||||
if (name == m_name)
|
||||
{
|
||||
auto ret = setup.parse_tokens(m_store, name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
plib::istream_uptr source_token_t::stream(const pstring &name)
|
||||
{
|
||||
plib::unused_var(name);
|
||||
return plib::istream_uptr();
|
||||
}
|
||||
|
||||
} // namespace netlist
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "plib/pstring.h"
|
||||
|
||||
#include "nl_config.h"
|
||||
#include "nl_parser.h"
|
||||
#include "nltypes.h"
|
||||
|
||||
#include <initializer_list>
|
||||
@ -229,7 +228,7 @@ namespace netlist
|
||||
|
||||
// FIXME: used by source_t - need a different approach at some time
|
||||
bool parse_stream(plib::istream_uptr &&istrm, const pstring &name);
|
||||
bool parse_tokens(const parser_t::token_store &tokens, const pstring &name);
|
||||
bool parse_tokens(const plib::detail::token_store &tokens, const pstring &name);
|
||||
|
||||
template <typename S, typename... Args>
|
||||
void add_include(Args&&... args)
|
||||
|
@ -22,22 +22,6 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
// FIXME: Move to ptypes
|
||||
namespace plib
|
||||
{
|
||||
// FORWARD declarations
|
||||
template <typename BASEARENA, std::size_t MINALIGN>
|
||||
class mempool_arena;
|
||||
|
||||
struct aligned_arena;
|
||||
class dynlib_base;
|
||||
|
||||
template<bool debug_enabled>
|
||||
class plog_base;
|
||||
|
||||
struct plog_level;
|
||||
} // namespace plib
|
||||
|
||||
namespace netlist
|
||||
{
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -19,22 +19,7 @@
|
||||
|
||||
namespace plib {
|
||||
|
||||
class ptokenizer
|
||||
{
|
||||
public:
|
||||
explicit ptokenizer() // NOLINT(misc-forwarding-reference-overload, bugprone-forwarding-reference-overload)
|
||||
: m_strm(nullptr)
|
||||
, m_unget(0)
|
||||
, m_string('"')
|
||||
, m_support_line_markers(true) // FIXME
|
||||
, m_token_queue(nullptr)
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
PCOPYASSIGNMOVE(ptokenizer, delete)
|
||||
|
||||
virtual ~ptokenizer() = default;
|
||||
namespace detail {
|
||||
|
||||
PENUM(token_type,
|
||||
IDENTIFIER,
|
||||
@ -109,7 +94,34 @@ namespace plib {
|
||||
pstring m_token;
|
||||
};
|
||||
|
||||
using token_store = std::vector<token_t>;
|
||||
class token_store : public std::vector<token_t>
|
||||
{
|
||||
using std::vector<token_t>::vector;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
class ptokenizer
|
||||
{
|
||||
public:
|
||||
explicit ptokenizer() // NOLINT(misc-forwarding-reference-overload, bugprone-forwarding-reference-overload)
|
||||
: m_strm(nullptr)
|
||||
, m_unget(0)
|
||||
, m_string('"')
|
||||
, m_support_line_markers(true) // FIXME
|
||||
, m_token_queue(nullptr)
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
PCOPYASSIGNMOVE(ptokenizer, delete)
|
||||
|
||||
virtual ~ptokenizer() = default;
|
||||
|
||||
using token_type = detail::token_type;
|
||||
using token_id_t = detail::token_id_t;
|
||||
using token_t = detail::token_t;
|
||||
using token_store = detail::token_store;
|
||||
|
||||
// tokenizer stuff follows ...
|
||||
|
||||
|
@ -39,6 +39,30 @@
|
||||
#undef EMSCRIPTEN
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// forward definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
namespace plib
|
||||
{
|
||||
template <typename BASEARENA, std::size_t MINALIGN>
|
||||
class mempool_arena;
|
||||
|
||||
struct aligned_arena;
|
||||
class dynlib_base;
|
||||
|
||||
template<bool debug_enabled>
|
||||
class plog_base;
|
||||
|
||||
struct plog_level;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
class token_store;
|
||||
} // namespace detail
|
||||
|
||||
} // namespace plib
|
||||
|
||||
namespace plib
|
||||
{
|
||||
//============================================================
|
||||
|
Loading…
Reference in New Issue
Block a user