summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2016-12-11 18:15:41 +1100
committer Vas Crabb <vas@vastheman.com>2016-12-11 18:15:41 +1100
commitc8f19544676e2954bf2bb4ca03aa90d1d1148fc8 (patch)
treedd802a7f701c5ef7d3a5270a19f5a295a8ed8e7f /src/frontend
parentf38bc880f0fe3eb73740f8b5c00c359402afb3c4 (diff)
XML refactoring:
* move stuff to namespace util::xml * scope down some enums * split config load/save delegate types * make config load take const so it can't mangle data
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/mame/cheat.cpp42
-rw-r--r--src/frontend/mame/cheat.h18
-rw-r--r--src/frontend/mame/clifront.cpp16
-rw-r--r--src/frontend/mame/info.cpp82
-rw-r--r--src/frontend/mame/mame.cpp6
5 files changed, 82 insertions, 82 deletions
diff --git a/src/frontend/mame/cheat.cpp b/src/frontend/mame/cheat.cpp
index 3c2b2e1844b..2c758ed1020 100644
--- a/src/frontend/mame/cheat.cpp
+++ b/src/frontend/mame/cheat.cpp
@@ -108,16 +108,16 @@ inline std::string number_and_format::format() const
switch (m_format)
{
default:
- case xml_data_node::int_format::DECIMAL:
+ case util::xml::data_node::int_format::DECIMAL:
return string_format("%d", uint32_t(m_value));
- case xml_data_node::int_format::DECIMAL_HASH:
+ case util::xml::data_node::int_format::DECIMAL_HASH:
return string_format("#%d", uint32_t(m_value));
- case xml_data_node::int_format::HEX_DOLLAR:
+ case util::xml::data_node::int_format::HEX_DOLLAR:
return string_format("$%X", uint32_t(m_value));
- case xml_data_node::int_format::HEX_C:
+ case util::xml::data_node::int_format::HEX_C:
return string_format("0x%X", uint32_t(m_value));
}
}
@@ -132,7 +132,7 @@ inline std::string number_and_format::format() const
// cheat_parameter - constructor
//-------------------------------------------------
-cheat_parameter::cheat_parameter(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node const &paramnode)
+cheat_parameter::cheat_parameter(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &paramnode)
: m_value(0)
{
// read the core attributes
@@ -141,7 +141,7 @@ cheat_parameter::cheat_parameter(cheat_manager &manager, symbol_table &symbols,
m_stepval = number_and_format(paramnode.get_attribute_int("step", 1), paramnode.get_attribute_int_format("step"));
// iterate over items
- for (xml_data_node const *itemnode = paramnode.get_child("item"); itemnode != nullptr; itemnode = itemnode->get_next_sibling("item"))
+ for (util::xml::data_node const *itemnode = paramnode.get_child("item"); itemnode != nullptr; itemnode = itemnode->get_next_sibling("item"))
{
// check for nullptr text
if (itemnode->get_value() == nullptr || itemnode->get_value()[0] == 0)
@@ -153,7 +153,7 @@ cheat_parameter::cheat_parameter(cheat_manager &manager, symbol_table &symbols,
// extract the parameters
uint64_t const value = itemnode->get_attribute_int("value", 0);
- xml_data_node::int_format const format = itemnode->get_attribute_int_format("value");
+ util::xml::data_node::int_format const format = itemnode->get_attribute_int_format("value");
// allocate and append a new item
auto curitem = std::make_unique<item>(itemnode->get_value(), value, format);
@@ -317,7 +317,7 @@ bool cheat_parameter::set_next_state()
// cheat_script - constructor
//-------------------------------------------------
-cheat_script::cheat_script(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node const &scriptnode)
+cheat_script::cheat_script(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &scriptnode)
: m_state(SCRIPT_STATE_RUN)
{
// read the core attributes
@@ -332,7 +332,7 @@ cheat_script::cheat_script(cheat_manager &manager, symbol_table &symbols, const
throw emu_fatalerror("%s.xml(%d): invalid script state '%s'\n", filename, scriptnode.line, state);
// iterate over nodes within the script
- for (xml_data_node const *entrynode = scriptnode.get_first_child(); entrynode != nullptr; entrynode = entrynode->get_next_sibling())
+ for (util::xml::data_node const *entrynode = scriptnode.get_first_child(); entrynode != nullptr; entrynode = entrynode->get_next_sibling())
{
// handle action nodes
if (strcmp(entrynode->get_name(), "action") == 0)
@@ -399,7 +399,7 @@ void cheat_script::save(emu_file &cheatfile) const
// script_entry - constructor
//-------------------------------------------------
-cheat_script::script_entry::script_entry(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node const &entrynode, bool isaction)
+cheat_script::script_entry::script_entry(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &entrynode, bool isaction)
: m_condition(&symbols),
m_expression(&symbols)
{
@@ -442,7 +442,7 @@ cheat_script::script_entry::script_entry(cheat_manager &manager, symbol_table &s
// then parse arguments
int totalargs = 0;
- for (xml_data_node const *argnode = entrynode.get_child("argument"); argnode != nullptr; argnode = argnode->get_next_sibling("argument"))
+ for (util::xml::data_node const *argnode = entrynode.get_child("argument"); argnode != nullptr; argnode = argnode->get_next_sibling("argument"))
{
auto curarg = std::make_unique<output_argument>(manager, symbols, filename, *argnode);
// verify we didn't overrun the argument count
@@ -608,7 +608,7 @@ void cheat_script::script_entry::validate_format(const char *filename, int line)
// output_argument - constructor
//-------------------------------------------------
-cheat_script::script_entry::output_argument::output_argument(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node const &argnode)
+cheat_script::script_entry::output_argument::output_argument(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &argnode)
: m_expression(&symbols),
m_count(0)
{
@@ -676,7 +676,7 @@ void cheat_script::script_entry::output_argument::save(emu_file &cheatfile) cons
// cheat_entry - constructor
//-------------------------------------------------
-cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, const char *filename, xml_data_node const &cheatnode)
+cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, const char *filename, util::xml::data_node const &cheatnode)
: m_manager(manager)
, m_symbols(&manager.machine(), &globaltable)
, m_state(SCRIPT_STATE_OFF)
@@ -707,7 +707,7 @@ cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, cons
}
// read the first comment node
- xml_data_node const *commentnode = cheatnode.get_child("comment");
+ util::xml::data_node const *commentnode = cheatnode.get_child("comment");
if (commentnode != nullptr)
{
// set the value if not nullptr
@@ -721,7 +721,7 @@ cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, cons
}
// read the first parameter node
- xml_data_node const *paramnode = cheatnode.get_child("parameter");
+ util::xml::data_node const *paramnode = cheatnode.get_child("parameter");
if (paramnode != nullptr)
{
// load this parameter
@@ -734,7 +734,7 @@ cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, cons
}
// read the script nodes
- for (xml_data_node const *scriptnode = cheatnode.get_child("script"); scriptnode != nullptr; scriptnode = scriptnode->get_next_sibling("script"))
+ for (util::xml::data_node const *scriptnode = cheatnode.get_child("script"); scriptnode != nullptr; scriptnode = scriptnode->get_next_sibling("script"))
{
// load this entry
auto curscript = global_alloc(cheat_script(manager, m_symbols, filename, *scriptnode));
@@ -1397,17 +1397,17 @@ void cheat_manager::load_cheats(const char *filename)
osd_printf_verbose("Loading cheats file from %s\n", cheatfile.fullpath());
// read the XML file into internal data structures
- xml_parse_options options = { nullptr };
- xml_parse_error error;
+ util::xml::parse_options options = { nullptr };
+ util::xml::parse_error error;
options.error = &error;
- std::unique_ptr<xml_data_node, void (*)(xml_data_node *)> rootnode(xml_data_node::file_read(cheatfile, &options), [] (xml_data_node *node) { node->file_free(); });
+ std::unique_ptr<util::xml::data_node, void (*)(util::xml::data_node *)> rootnode(util::xml::data_node::file_read(cheatfile, &options), [] (util::xml::data_node *node) { node->file_free(); });
// if unable to parse the file, just bail
if (rootnode == nullptr)
throw emu_fatalerror("%s.xml(%d): error parsing XML (%s)\n", filename, error.error_line, error.error_message);
// find the layout node
- xml_data_node *mamecheatnode = rootnode->get_child("mamecheat");
+ util::xml::data_node const *const mamecheatnode = rootnode->get_child("mamecheat");
if (mamecheatnode == nullptr)
throw emu_fatalerror("%s.xml: missing mamecheatnode node", filename);
@@ -1417,7 +1417,7 @@ void cheat_manager::load_cheats(const char *filename)
throw emu_fatalerror("%s.xml(%d): Invalid cheat XML file: unsupported version", filename, mamecheatnode->line);
// parse all the elements
- for (xml_data_node const *cheatnode = mamecheatnode->get_child("cheat"); cheatnode != nullptr; cheatnode = cheatnode->get_next_sibling("cheat"))
+ for (util::xml::data_node const *cheatnode = mamecheatnode->get_child("cheat"); cheatnode != nullptr; cheatnode = cheatnode->get_next_sibling("cheat"))
{
// load this entry
auto curcheat = std::make_unique<cheat_entry>(*this, m_symtable, filename, *cheatnode);
diff --git a/src/frontend/mame/cheat.h b/src/frontend/mame/cheat.h
index bc983c160f1..eaba3650e7e 100644
--- a/src/frontend/mame/cheat.h
+++ b/src/frontend/mame/cheat.h
@@ -50,7 +50,7 @@ class number_and_format
{
public:
// construction/destruction
- number_and_format(uint64_t value = 0, xml_data_node::int_format format = xml_data_node::int_format::DECIMAL)
+ number_and_format(uint64_t value = 0, util::xml::data_node::int_format format = util::xml::data_node::int_format::DECIMAL)
: m_value(value)
, m_format(format)
{
@@ -65,8 +65,8 @@ public:
private:
// internal state
- uint64_t m_value;
- xml_data_node::int_format m_format;
+ uint64_t m_value;
+ util::xml::data_node::int_format m_format;
};
@@ -77,7 +77,7 @@ class cheat_parameter
{
public:
// construction/destruction
- cheat_parameter(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node const &paramnode);
+ cheat_parameter(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &paramnode);
// queries
const char *text();
@@ -99,7 +99,7 @@ private:
{
public:
// construction/destruction
- item(const char *text, uint64_t value, xml_data_node::int_format valformat)
+ item(const char *text, uint64_t value, util::xml::data_node::int_format valformat)
: m_text(text)
, m_value(value, valformat)
{ }
@@ -131,7 +131,7 @@ class cheat_script
{
public:
// construction/destruction
- cheat_script(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node const &scriptnode);
+ cheat_script(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &scriptnode);
// getters
script_state state() const { return m_state; }
@@ -146,7 +146,7 @@ private:
{
public:
// construction/destruction
- script_entry(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node const &entrynode, bool isaction);
+ script_entry(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &entrynode, bool isaction);
// actions
void execute(cheat_manager &manager, uint64_t &argindex);
@@ -158,7 +158,7 @@ private:
{
public:
// construction/destruction
- output_argument(cheat_manager &manager, symbol_table &symbols, const char *filename, xml_data_node const &argnode);
+ output_argument(cheat_manager &manager, symbol_table &symbols, const char *filename, util::xml::data_node const &argnode);
// getters
int count() const { return m_count; }
@@ -201,7 +201,7 @@ class cheat_entry
{
public:
// construction/destruction
- cheat_entry(cheat_manager &manager, symbol_table &globaltable, const char *filename, xml_data_node const &cheatnode);
+ cheat_entry(cheat_manager &manager, symbol_table &globaltable, const char *filename, util::xml::data_node const &cheatnode);
~cheat_entry();
// getters
diff --git a/src/frontend/mame/clifront.cpp b/src/frontend/mame/clifront.cpp
index 40775af09c9..ff7e371c438 100644
--- a/src/frontend/mame/clifront.cpp
+++ b/src/frontend/mame/clifront.cpp
@@ -1101,7 +1101,7 @@ void cli_frontend::verifysamples(const char *gamename)
void cli_frontend::output_single_softlist(FILE *out, software_list_device &swlistdev)
{
- fprintf(out, "\t<softwarelist name=\"%s\" description=\"%s\">\n", swlistdev.list_name().c_str(), xml_normalize_string(swlistdev.description().c_str()));
+ fprintf(out, "\t<softwarelist name=\"%s\" description=\"%s\">\n", swlistdev.list_name().c_str(), util::xml::normalize_string(swlistdev.description().c_str()));
for (const software_info &swinfo : swlistdev.get_info())
{
fprintf(out, "\t\t<software name=\"%s\"", swinfo.shortname().c_str());
@@ -1112,12 +1112,12 @@ void cli_frontend::output_single_softlist(FILE *out, software_list_device &swlis
if (swinfo.supported() == SOFTWARE_SUPPORTED_NO)
fprintf(out, " supported=\"no\"");
fprintf(out, ">\n" );
- fprintf(out, "\t\t\t<description>%s</description>\n", xml_normalize_string(swinfo.longname().c_str()));
- fprintf(out, "\t\t\t<year>%s</year>\n", xml_normalize_string(swinfo.year().c_str()));
- fprintf(out, "\t\t\t<publisher>%s</publisher>\n", xml_normalize_string(swinfo.publisher().c_str()));
+ fprintf(out, "\t\t\t<description>%s</description>\n", util::xml::normalize_string(swinfo.longname().c_str()));
+ fprintf(out, "\t\t\t<year>%s</year>\n", util::xml::normalize_string(swinfo.year().c_str()));
+ fprintf(out, "\t\t\t<publisher>%s</publisher>\n", util::xml::normalize_string(swinfo.publisher().c_str()));
for (const feature_list_item &flist : swinfo.other_info())
- fprintf( out, "\t\t\t<info name=\"%s\" value=\"%s\"/>\n", flist.name().c_str(), xml_normalize_string( flist.value().c_str()) );
+ fprintf( out, "\t\t\t<info name=\"%s\" value=\"%s\"/>\n", flist.name().c_str(), util::xml::normalize_string( flist.value().c_str()) );
for (const software_part &part : swinfo.parts())
{
@@ -1128,7 +1128,7 @@ void cli_frontend::output_single_softlist(FILE *out, software_list_device &swlis
fprintf(out, ">\n");
for (const feature_list_item &flist : part.featurelist())
- fprintf(out, "\t\t\t\t<feature name=\"%s\" value=\"%s\" />\n", flist.name().c_str(), xml_normalize_string(flist.value().c_str()));
+ fprintf(out, "\t\t\t\t<feature name=\"%s\" value=\"%s\" />\n", flist.name().c_str(), util::xml::normalize_string(flist.value().c_str()));
/* TODO: display rom region information */
for (const rom_entry *region = part.romdata().data(); region; region = rom_next_region(region))
@@ -1145,9 +1145,9 @@ void cli_frontend::output_single_softlist(FILE *out, software_list_device &swlis
if ( ROMENTRY_ISFILE(rom) )
{
if (!is_disk)
- fprintf( out, "\t\t\t\t\t<rom name=\"%s\" size=\"%d\"", xml_normalize_string(ROM_GETNAME(rom)), rom_file_size(rom) );
+ fprintf( out, "\t\t\t\t\t<rom name=\"%s\" size=\"%d\"", util::xml::normalize_string(ROM_GETNAME(rom)), rom_file_size(rom) );
else
- fprintf( out, "\t\t\t\t\t<disk name=\"%s\"", xml_normalize_string(ROM_GETNAME(rom)) );
+ fprintf( out, "\t\t\t\t\t<disk name=\"%s\"", util::xml::normalize_string(ROM_GETNAME(rom)) );
/* dump checksum information only if there is a known dump */
util::hash_collection hashes(ROM_GETHASHDATA(rom));
diff --git a/src/frontend/mame/info.cpp b/src/frontend/mame/info.cpp
index fe5ffad3468..0889dd7bd39 100644
--- a/src/frontend/mame/info.cpp
+++ b/src/frontend/mame/info.cpp
@@ -216,7 +216,7 @@ void info_xml_creator::output(FILE *out, bool nodevices)
#endif
"\" mameconfig=\"%d\">\n",
XML_ROOT,
- xml_normalize_string(emulator_info::get_build_version()),
+ util::xml::normalize_string(emulator_info::get_build_version()),
CONFIG_VERSION
);
@@ -283,7 +283,7 @@ void info_xml_creator::output_one()
// print the header and the game name
fprintf(m_output, "\t<%s",XML_TOP);
- fprintf(m_output, " name=\"%s\"", xml_normalize_string(driver.name));
+ fprintf(m_output, " name=\"%s\"", util::xml::normalize_string(driver.name));
// strip away any path information from the source_file and output it
const char *start = strrchr(driver.source_file, '/');
@@ -291,7 +291,7 @@ void info_xml_creator::output_one()
start = strrchr(driver.source_file, '\\');
if (start == nullptr)
start = driver.source_file - 1;
- fprintf(m_output, " sourcefile=\"%s\"", xml_normalize_string(start + 1));
+ fprintf(m_output, " sourcefile=\"%s\"", util::xml::normalize_string(start + 1));
// append bios and runnable flags
if (driver.flags & MACHINE_IS_BIOS_ROOT)
@@ -304,9 +304,9 @@ void info_xml_creator::output_one()
// display clone information
int clone_of = m_drivlist.find(driver.parent);
if (clone_of != -1 && !(m_drivlist.driver(clone_of).flags & MACHINE_IS_BIOS_ROOT))
- fprintf(m_output, " cloneof=\"%s\"", xml_normalize_string(m_drivlist.driver(clone_of).name));
+ fprintf(m_output, " cloneof=\"%s\"", util::xml::normalize_string(m_drivlist.driver(clone_of).name));
if (clone_of != -1)
- fprintf(m_output, " romof=\"%s\"", xml_normalize_string(m_drivlist.driver(clone_of).name));
+ fprintf(m_output, " romof=\"%s\"", util::xml::normalize_string(m_drivlist.driver(clone_of).name));
// display sample information and close the game tag
output_sampleof();
@@ -314,15 +314,15 @@ void info_xml_creator::output_one()
// output game description
if (driver.description != nullptr)
- fprintf(m_output, "\t\t<description>%s</description>\n", xml_normalize_string(driver.description));
+ fprintf(m_output, "\t\t<description>%s</description>\n", util::xml::normalize_string(driver.description));
// print the year only if is a number or another allowed character (? or +)
if (driver.year != nullptr && strspn(driver.year, "0123456789?+") == strlen(driver.year))
- fprintf(m_output, "\t\t<year>%s</year>\n", xml_normalize_string(driver.year));
+ fprintf(m_output, "\t\t<year>%s</year>\n", util::xml::normalize_string(driver.year));
// print the manufacturer information
if (driver.manufacturer != nullptr)
- fprintf(m_output, "\t\t<manufacturer>%s</manufacturer>\n", xml_normalize_string(driver.manufacturer));
+ fprintf(m_output, "\t\t<manufacturer>%s</manufacturer>\n", util::xml::normalize_string(driver.manufacturer));
// now print various additional information
output_bios();
@@ -376,15 +376,15 @@ void info_xml_creator::output_one_device(device_t &device, const char *devtag)
// start to output info
fprintf(m_output, "\t<%s", XML_TOP);
- fprintf(m_output, " name=\"%s\"", xml_normalize_string(device.shortname()));
+ fprintf(m_output, " name=\"%s\"", util::xml::normalize_string(device.shortname()));
std::string src(device.source());
strreplace(src,"../", "");
- fprintf(m_output, " sourcefile=\"%s\"", xml_normalize_string(src.c_str()));
+ fprintf(m_output, " sourcefile=\"%s\"", util::xml::normalize_string(src.c_str()));
fprintf(m_output, " isdevice=\"yes\"");
fprintf(m_output, " runnable=\"no\"");
output_sampleof();
fprintf(m_output, ">\n");
- fprintf(m_output, "\t\t<description>%s</description>\n", xml_normalize_string(device.name()));
+ fprintf(m_output, "\t\t<description>%s</description>\n", util::xml::normalize_string(device.name()));
output_rom(device);
@@ -478,7 +478,7 @@ void info_xml_creator::output_device_roms()
{
for (device_t &device : device_iterator(m_drivlist.config().root_device()))
if (device.owner() != nullptr && device.shortname() != nullptr && device.shortname()[0] != '\0')
- fprintf(m_output, "\t\t<device_ref name=\"%s\"/>\n", xml_normalize_string(device.shortname()));
+ fprintf(m_output, "\t\t<device_ref name=\"%s\"/>\n", util::xml::normalize_string(device.shortname()));
}
@@ -495,7 +495,7 @@ void info_xml_creator::output_sampleof()
samples_iterator sampiter(device);
if (sampiter.altbasename() != nullptr)
{
- fprintf(m_output, " sampleof=\"%s\"", xml_normalize_string(sampiter.altbasename()));
+ fprintf(m_output, " sampleof=\"%s\"", util::xml::normalize_string(sampiter.altbasename()));
// must stop here, as there can only be one attribute of the same name
return;
@@ -529,8 +529,8 @@ void info_xml_creator::output_bios()
{
// output extracted name and descriptions
fprintf(m_output, "\t\t<biosset");
- fprintf(m_output, " name=\"%s\"", xml_normalize_string(ROM_GETNAME(&rom)));
- fprintf(m_output, " description=\"%s\"", xml_normalize_string(ROM_GETHASHDATA(&rom)));
+ fprintf(m_output, " name=\"%s\"", util::xml::normalize_string(ROM_GETNAME(&rom)));
+ fprintf(m_output, " description=\"%s\"", util::xml::normalize_string(ROM_GETHASHDATA(&rom)));
if (defaultname == ROM_GETNAME(&rom))
fprintf(m_output, " default=\"yes\"");
fprintf(m_output, "/>\n");
@@ -597,11 +597,11 @@ void info_xml_creator::output_rom(device_t &device)
// add name, merge, bios, and size tags */
if (name != nullptr && name[0] != 0)
- util::stream_format(output, " name=\"%s\"", xml_normalize_string(name));
+ util::stream_format(output, " name=\"%s\"", util::xml::normalize_string(name));
if (merge_name != nullptr)
- util::stream_format(output, " merge=\"%s\"", xml_normalize_string(merge_name));
+ util::stream_format(output, " merge=\"%s\"", util::xml::normalize_string(merge_name));
if (bios_name[0] != 0)
- util::stream_format(output, " bios=\"%s\"", xml_normalize_string(bios_name));
+ util::stream_format(output, " bios=\"%s\"", util::xml::normalize_string(bios_name));
if (!is_disk)
util::stream_format(output, " size=\"%d\"", rom_file_size(rom));
@@ -659,7 +659,7 @@ void info_xml_creator::output_sample(device_t &device)
continue;
// output the sample name
- fprintf(m_output, "\t\t<sample name=\"%s\"/>\n", xml_normalize_string(samplename));
+ fprintf(m_output, "\t\t<sample name=\"%s\"/>\n", util::xml::normalize_string(samplename));
}
}
}
@@ -682,8 +682,8 @@ void info_xml_creator::output_chips(device_t &device, const char *root_tag)
fprintf(m_output, "\t\t<chip");
fprintf(m_output, " type=\"cpu\"");
- fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag.c_str()));
- fprintf(m_output, " name=\"%s\"", xml_normalize_string(exec.device().name()));
+ fprintf(m_output, " tag=\"%s\"", util::xml::normalize_string(newtag.c_str()));
+ fprintf(m_output, " name=\"%s\"", util::xml::normalize_string(exec.device().name()));
fprintf(m_output, " clock=\"%d\"", exec.device().clock());
fprintf(m_output, "/>\n");
}
@@ -699,8 +699,8 @@ void info_xml_creator::output_chips(device_t &device, const char *root_tag)
fprintf(m_output, "\t\t<chip");
fprintf(m_output, " type=\"audio\"");
- fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag.c_str()));
- fprintf(m_output, " name=\"%s\"", xml_normalize_string(sound.device().name()));
+ fprintf(m_output, " tag=\"%s\"", util::xml::normalize_string(newtag.c_str()));
+ fprintf(m_output, " name=\"%s\"", util::xml::normalize_string(sound.device().name()));
if (sound.device().clock() != 0)
fprintf(m_output, " clock=\"%d\"", sound.device().clock());
fprintf(m_output, "/>\n");
@@ -725,7 +725,7 @@ void info_xml_creator::output_display(device_t &device, const char *root_tag)
newtag = newtag.substr(newtag.find(oldtag.append(root_tag)) + oldtag.length());
fprintf(m_output, "\t\t<display");
- fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag.c_str()));
+ fprintf(m_output, " tag=\"%s\"", util::xml::normalize_string(newtag.c_str()));
switch (screendev.screen_type())
{
@@ -1230,7 +1230,7 @@ void info_xml_creator::output_input(const ioport_list &portlist)
//printf("type %s - player %d - buttons %d\n", elem.type, elem.player, elem.nbuttons);
if (elem.analog)
{
- fprintf(m_output, "\t\t\t<control type=\"%s\"", xml_normalize_string(elem.type));
+ fprintf(m_output, "\t\t\t<control type=\"%s\"", util::xml::normalize_string(elem.type));
if (nplayer > 1)
fprintf(m_output, " player=\"%d\"", elem.player);
if (elem.nbuttons > 0)
@@ -1259,7 +1259,7 @@ void info_xml_creator::output_input(const ioport_list &portlist)
if (elem.helper[0] == 0 && elem.helper[1] != 0) { elem.helper[0] = elem.helper[1]; elem.helper[1] = 0; }
if (elem.helper[1] == 0 && elem.helper[2] != 0) { elem.helper[1] = elem.helper[2]; elem.helper[2] = 0; }
const char *joys = (elem.helper[2] != 0) ? "triple" : (elem.helper[1] != 0) ? "double" : "";
- fprintf(m_output, "\t\t\t<control type=\"%s%s\"", joys, xml_normalize_string(elem.type));
+ fprintf(m_output, "\t\t\t<control type=\"%s%s\"", joys, util::xml::normalize_string(elem.type));
if (nplayer > 1)
fprintf(m_output, " player=\"%d\"", elem.player);
if (elem.nbuttons > 0)
@@ -1329,14 +1329,14 @@ void info_xml_creator::output_switches(const ioport_list &portlist, const char *
newtag = newtag.substr(newtag.find(oldtag.append(root_tag)) + oldtag.length());
// output the switch name information
- std::string normalized_field_name(xml_normalize_string(field.name()));
- std::string normalized_newtag(xml_normalize_string(newtag.c_str()));
+ std::string normalized_field_name(util::xml::normalize_string(field.name()));
+ std::string normalized_newtag(util::xml::normalize_string(newtag.c_str()));
util::stream_format(output,"\t\t<%s name=\"%s\" tag=\"%s\" mask=\"%u\">\n", outertag, normalized_field_name.c_str(), normalized_newtag.c_str(), field.mask());
// loop over settings
for (ioport_setting &setting : field.settings())
{
- util::stream_format(output,"\t\t\t<%s name=\"%s\" value=\"%u\"%s/>\n", innertag, xml_normalize_string(setting.name()), setting.value(), setting.value() == field.defvalue() ? " default=\"yes\"" : "");
+ util::stream_format(output,"\t\t\t<%s name=\"%s\" value=\"%u\"%s/>\n", innertag, util::xml::normalize_string(setting.name()), setting.value(), setting.value() == field.defvalue() ? " default=\"yes\"" : "");
}
// terminate the switch entry
@@ -1355,7 +1355,7 @@ void info_xml_creator::output_ports(const ioport_list &portlist)
// cycle through ports
for (auto &port : portlist)
{
- fprintf(m_output,"\t\t<port tag=\"%s\">\n", xml_normalize_string(port.second->tag()));
+ fprintf(m_output,"\t\t<port tag=\"%s\">\n", util::xml::normalize_string(port.second->tag()));
for (ioport_field &field : port.second->fields())
{
if(field.is_analog())
@@ -1378,7 +1378,7 @@ void info_xml_creator::output_adjusters(const ioport_list &portlist)
for (auto &port : portlist)
for (ioport_field &field : port.second->fields())
if (field.type() == IPT_ADJUSTER)
- fprintf(m_output, "\t\t<adjuster name=\"%s\" default=\"%d\"/>\n", xml_normalize_string(field.name()), field.defvalue());
+ fprintf(m_output, "\t\t<adjuster name=\"%s\" default=\"%d\"/>\n", util::xml::normalize_string(field.name()), field.defvalue());
}
@@ -1460,11 +1460,11 @@ void info_xml_creator::output_images(device_t &device, const char *root_tag)
newtag = newtag.substr(newtag.find(oldtag.append(root_tag)) + oldtag.length());
// print m_output device type
- fprintf(m_output, "\t\t<device type=\"%s\"", xml_normalize_string(imagedev.image_type_name()));
+ fprintf(m_output, "\t\t<device type=\"%s\"", util::xml::normalize_string(imagedev.image_type_name()));
// does this device have a tag?
if (imagedev.device().tag())
- fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag.c_str()));
+ fprintf(m_output, " tag=\"%s\"", util::xml::normalize_string(newtag.c_str()));
// is this device available as media switch?
if (!loadable)
@@ -1475,7 +1475,7 @@ void info_xml_creator::output_images(device_t &device, const char *root_tag)
fprintf(m_output, " mandatory=\"1\"");
if (imagedev.image_interface() && imagedev.image_interface()[0])
- fprintf(m_output, " interface=\"%s\"", xml_normalize_string(imagedev.image_interface()));
+ fprintf(m_output, " interface=\"%s\"", util::xml::normalize_string(imagedev.image_interface()));
// close the XML tag
fprintf(m_output, ">\n");
@@ -1486,8 +1486,8 @@ void info_xml_creator::output_images(device_t &device, const char *root_tag)
const char *shortname = imagedev.brief_instance_name();
fprintf(m_output, "\t\t\t<instance");
- fprintf(m_output, " name=\"%s\"", xml_normalize_string(name));
- fprintf(m_output, " briefname=\"%s\"", xml_normalize_string(shortname));
+ fprintf(m_output, " name=\"%s\"", util::xml::normalize_string(name));
+ fprintf(m_output, " briefname=\"%s\"", util::xml::normalize_string(shortname));
fprintf(m_output, "/>\n");
std::string extensions(imagedev.file_extensions());
@@ -1496,7 +1496,7 @@ void info_xml_creator::output_images(device_t &device, const char *root_tag)
while (ext != nullptr)
{
fprintf(m_output, "\t\t\t<extension");
- fprintf(m_output, " name=\"%s\"", xml_normalize_string(ext));
+ fprintf(m_output, " name=\"%s\"", util::xml::normalize_string(ext));
fprintf(m_output, "/>\n");
ext = strtok(nullptr, ",");
}
@@ -1523,11 +1523,11 @@ void info_xml_creator::output_slots(device_t &device, const char *root_tag)
newtag = newtag.substr(newtag.find(oldtag.append(root_tag)) + oldtag.length());
// print m_output device type
- fprintf(m_output, "\t\t<slot name=\"%s\">\n", xml_normalize_string(newtag.c_str()));
+ fprintf(m_output, "\t\t<slot name=\"%s\">\n", util::xml::normalize_string(newtag.c_str()));
/*
if (slot.slot_interface()[0])
- fprintf(m_output, " interface=\"%s\"", xml_normalize_string(slot.slot_interface()));
+ fprintf(m_output, " interface=\"%s\"", util::xml::normalize_string(slot.slot_interface()));
*/
for (auto &option : slot.option_list())
@@ -1539,8 +1539,8 @@ void info_xml_creator::output_slots(device_t &device, const char *root_tag)
dev->config_complete();
fprintf(m_output, "\t\t\t<slotoption");
- fprintf(m_output, " name=\"%s\"", xml_normalize_string(option.second->name()));
- fprintf(m_output, " devname=\"%s\"", xml_normalize_string(dev->shortname()));
+ fprintf(m_output, " name=\"%s\"", util::xml::normalize_string(option.second->name()));
+ fprintf(m_output, " devname=\"%s\"", util::xml::normalize_string(dev->shortname()));
if (slot.default_option() != nullptr && strcmp(slot.default_option(), option.second->name())==0)
fprintf(m_output, " default=\"yes\"");
fprintf(m_output, "/>\n");
diff --git a/src/frontend/mame/mame.cpp b/src/frontend/mame/mame.cpp
index 197194ceb3b..31d8fb447e0 100644
--- a/src/frontend/mame/mame.cpp
+++ b/src/frontend/mame/mame.cpp
@@ -339,12 +339,12 @@ bool emulator_info::frame_hook()
return mame_machine_manager::instance()->lua()->frame_hook();
}
-void emulator_info::layout_file_cb(xml_data_node &layout)
+void emulator_info::layout_file_cb(util::xml::data_node &layout)
{
- xml_data_node const *const mamelayout = layout.get_child("mamelayout");
+ util::xml::data_node const *const mamelayout = layout.get_child("mamelayout");
if (mamelayout)
{
- xml_data_node const *const script = mamelayout->get_child("script");
+ util::xml::data_node const *const script = mamelayout->get_child("script");
if(script)
mame_machine_manager::instance()->lua()->call_plugin_set("layout", script->get_value());
}