summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/machine
diff options
context:
space:
mode:
author couriersud <couriersud@arcor.de>2015-08-10 21:50:08 +0200
committer couriersud <couriersud@arcor.de>2015-08-10 22:35:19 +0200
commit6cc506594d0bf74047b9f95269720f9fbce5b7dc (patch)
treecf4f34d41a695d972cdde8f4af9383754791ec9d /src/emu/machine
parent7b15a99c4b9ee44264a4cb9d719dc0ef3736ce85 (diff)
Make netlist more typesafe. Added a pformat class to reduce sprintf
usage. The approach is also suitable for translated strings with arbitrary positioning of parameters. (nw)
Diffstat (limited to 'src/emu/machine')
-rw-r--r--src/emu/machine/netlist.c8
-rw-r--r--src/emu/machine/netlist.h6
2 files changed, 7 insertions, 7 deletions
diff --git a/src/emu/machine/netlist.c b/src/emu/machine/netlist.c
index bccb11bb4f0..79d3b4e6943 100644
--- a/src/emu/machine/netlist.c
+++ b/src/emu/machine/netlist.c
@@ -175,11 +175,11 @@ void netlist_mame_stream_input_t::custom_netlist_additions(netlist::setup_t &set
if (snd_in == NULL)
snd_in = dynamic_cast<NETLIB_NAME(sound_in) *>(setup.register_dev("NETDEV_SOUND_IN", "STREAM_INPUT"));
- pstring sparam = pstring::sprintf("STREAM_INPUT.CHAN%d", m_channel);
+ pstring sparam = pformat("STREAM_INPUT.CHAN%1")(m_channel);
setup.register_param(sparam, m_param_name);
- sparam = pstring::sprintf("STREAM_INPUT.MULT%d", m_channel);
+ sparam = pformat("STREAM_INPUT.MULT%1")(m_channel);
setup.register_param(sparam, m_mult);
- sparam = pstring::sprintf("STREAM_INPUT.OFFSET%d", m_channel);
+ sparam = pformat("STREAM_INPUT.OFFSET%1")(m_channel);
setup.register_param(sparam, m_offset);
}
@@ -210,7 +210,7 @@ void netlist_mame_stream_output_t::device_start()
void netlist_mame_stream_output_t::custom_netlist_additions(netlist::setup_t &setup)
{
//NETLIB_NAME(sound_out) *snd_out;
- pstring sname = pstring::sprintf("STREAM_OUT_%d", m_channel);
+ pstring sname = pformat("STREAM_OUT_%1")(m_channel);
//snd_out = dynamic_cast<NETLIB_NAME(sound_out) *>(setup.register_dev("nld_sound_out", sname));
setup.register_dev("NETDEV_SOUND_OUT", sname);
diff --git a/src/emu/machine/netlist.h b/src/emu/machine/netlist.h
index 423919badec..73ad52b0ddd 100644
--- a/src/emu/machine/netlist.h
+++ b/src/emu/machine/netlist.h
@@ -648,9 +648,9 @@ public:
for (int i = 0; i < MAX_INPUT_CHANNELS; i++)
{
- register_param(pstring::sprintf("CHAN%d", i), m_param_name[i], "");
- register_param(pstring::sprintf("MULT%d", i), m_param_mult[i], 1.0);
- register_param(pstring::sprintf("OFFSET%d", i), m_param_offset[i], 0.0);
+ register_param(pformat("CHAN%1")(i), m_param_name[i], "");
+ register_param(pformat("MULT%1")(i), m_param_mult[i], 1.0);
+ register_param(pformat("OFFSET%1")(i), m_param_offset[i], 0.0);
}
m_num_channel = 0;
}