summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/clifront.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/clifront.c')
-rw-r--r--src/emu/clifront.c73
1 files changed, 37 insertions, 36 deletions
diff --git a/src/emu/clifront.c b/src/emu/clifront.c
index da44830a67c..bdb6988c0c6 100644
--- a/src/emu/clifront.c
+++ b/src/emu/clifront.c
@@ -107,7 +107,7 @@ int cli_frontend::execute(int argc, char **argv)
try
{
// first parse options to be able to get software from it
- astring option_errors;
+ std::string option_errors;
m_options.parse_command_line(argc, argv, option_errors);
if (*(m_options.software_name()) != 0)
@@ -149,8 +149,8 @@ int cli_frontend::execute(int argc, char **argv)
// mount only if not already mounted
if (*option == 0)
{
- astring val;
- val.printf("%s:%s:%s", swlistdev->list_name(), m_options.software_name(), swpart->name());
+ std::string val;
+ strprintf(val, "%s:%s:%s", swlistdev->list_name(), m_options.software_name(), swpart->name());
// call this in order to set slot devices according to mounting
m_options.parse_slot_devices(argc, argv, option_errors, image->instance_name(), val.c_str());
@@ -184,13 +184,13 @@ int cli_frontend::execute(int argc, char **argv)
throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.system_name());
// otherwise, error on the options
- throw emu_fatalerror(MAMERR_INVALID_CONFIG, "%s", option_errors.trimspace().c_str());
+ throw emu_fatalerror(MAMERR_INVALID_CONFIG, "%s", strtrimspace(option_errors).c_str());
}
- if (option_errors)
- osd_printf_error("Error in command line:\n%s\n", option_errors.trimspace().c_str());
+ if (!option_errors.empty())
+ osd_printf_error("Error in command line:\n%s\n", strtrimspace(option_errors).c_str());
// determine the base name of the EXE
- astring exename;
+ std::string exename;
core_filename_extract_base(exename, argv[0], true);
// if we have a command, execute that
@@ -207,8 +207,8 @@ int cli_frontend::execute(int argc, char **argv)
m_options.revert(OPTION_PRIORITY_INI);
m_options.parse_standard_inis(option_errors);
}
- if (option_errors)
- osd_printf_error("Error in command line:\n%s\n", option_errors.trimspace().c_str());
+ if (!option_errors.empty())
+ osd_printf_error("Error in command line:\n%s\n", strtrimspace(option_errors).c_str());
// if we can't find it, give an appropriate error
const game_driver *system = m_options.system();
@@ -225,8 +225,9 @@ int cli_frontend::execute(int argc, char **argv)
// handle exceptions of various types
catch (emu_fatalerror &fatal)
{
- astring str(fatal.string());
- osd_printf_error("%s\n", str.trimspace().c_str());
+ std::string str(fatal.string());
+ strtrimspace(str);
+ osd_printf_error("%s\n", str.c_str());
m_result = (fatal.exitcode() != 0) ? fatal.exitcode() : MAMERR_FATALERROR;
// if a game was specified, wasn't a wildcard, and our error indicates this was the
@@ -326,7 +327,7 @@ void cli_frontend::listsource(const char *gamename)
throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename);
// iterate through drivers and output the info
- astring filename;
+ std::string filename;
while (drivlist.next())
osd_printf_info("%-16s %s\n", drivlist.driver().name, core_filename_extract_base(filename, drivlist.driver().source_file).c_str());
}
@@ -414,7 +415,7 @@ void cli_frontend::listbrothers(const char *gamename)
// output the entries found
drivlist.reset();
- astring filename;
+ std::string filename;
while (drivlist.next())
{
int clone_of = drivlist.clone();
@@ -465,7 +466,7 @@ void cli_frontend::listroms(const char *gamename)
throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename);
// iterate through matches
- astring tempstr;
+ std::string tempstr;
bool first = true;
while (drivlist.next())
{
@@ -722,17 +723,17 @@ void cli_frontend::listmedia(const char *gamename)
for (const device_image_interface *imagedev = iter.first(); imagedev != NULL; imagedev = iter.next())
{
// extract the shortname with parentheses
- astring paren_shortname;
- paren_shortname.format("(%s)", imagedev->brief_instance_name());
+ std::string paren_shortname;
+ strprintf(paren_shortname,"(%s)", imagedev->brief_instance_name());
// output the line, up to the list of extensions
printf("%-13s%-12s%-8s ", first ? drivlist.driver().name : "", imagedev->instance_name(), paren_shortname.c_str());
// get the extensions and print them
- astring extensions(imagedev->file_extensions());
- for (int start = 0, end = extensions.chr(0, ','); ; start = end + 1, end = extensions.chr(start, ','))
+ std::string extensions(imagedev->file_extensions());
+ for (int start = 0, end = extensions.find_first_of(',');; start = end + 1, end = extensions.find_first_of(',', start))
{
- astring curext(extensions, start, (end == -1) ? extensions.len() - start : end - start);
+ std::string curext(extensions, start, (end == -1) ? extensions.length() - start : end - start);
printf(".%-5s", curext.c_str());
if (end == -1)
break;
@@ -780,7 +781,7 @@ void cli_frontend::verifyroms(const char *gamename)
else
{
// output the summary of the audit
- astring summary_string;
+ std::string summary_string;
auditor.summarize(drivlist.driver().name,&summary_string);
osd_printf_info("%s", summary_string.c_str());
@@ -840,7 +841,7 @@ void cli_frontend::verifyroms(const char *gamename)
else if (summary != media_auditor::NONE_NEEDED)
{
// output the summary of the audit
- astring summary_string;
+ std::string summary_string;
auditor.summarize(dev->shortname(),&summary_string);
osd_printf_info("%s", summary_string.c_str());
@@ -878,8 +879,8 @@ void cli_frontend::verifyroms(const char *gamename)
{
for (const device_slot_option *option = slot->first_option(); option != NULL; option = option->next())
{
- astring temptag("_");
- temptag.cat(option->name());
+ std::string temptag("_");
+ temptag.append(option->name());
device_t *dev = const_cast<machine_config &>(config).device_add(&config.root_device(), temptag.c_str(), option->devtype(), 0);
// notify this device and all its subdevices that they are now configured
@@ -905,7 +906,7 @@ void cli_frontend::verifyroms(const char *gamename)
else if(summary != media_auditor::NONE_NEEDED)
{
// output the summary of the audit
- astring summary_string;
+ std::string summary_string;
auditor.summarize(dev->shortname(),&summary_string);
osd_printf_info("%s", summary_string.c_str());
@@ -1002,7 +1003,7 @@ void cli_frontend::verifysamples(const char *gamename)
else if (summary != media_auditor::NONE_NEEDED)
{
// output the summary of the audit
- astring summary_string;
+ std::string summary_string;
auditor.summarize(drivlist.driver().name,&summary_string);
osd_printf_info("%s", summary_string.c_str());
@@ -1120,7 +1121,7 @@ void cli_frontend::verifysamples(const char *gamename)
void cli_frontend::output_single_softlist(FILE *out, software_list_device &swlistdev)
{
- astring tempstr;
+ std::string tempstr;
fprintf(out, "\t<softwarelist name=\"%s\" description=\"%s\">\n", swlistdev.list_name(), xml_normalize_string(swlistdev.description()));
for (software_info *swinfo = swlistdev.first_software_info(); swinfo != NULL; swinfo = swinfo->next())
@@ -1320,7 +1321,7 @@ void cli_frontend::verifysoftware(const char *gamename)
else if(summary != media_auditor::NONE_NEEDED)
{
// output the summary of the audit
- astring summary_string;
+ std::string summary_string;
auditor.summarize(swinfo->shortname(), &summary_string);
osd_printf_info("%s", summary_string.c_str());
@@ -1442,7 +1443,7 @@ void cli_frontend::verifysoftlist(const char *gamename)
else if (summary != media_auditor::NONE_NEEDED)
{
// output the summary of the audit
- astring summary_string;
+ std::string summary_string;
auditor.summarize(swinfo->shortname(), &summary_string);
osd_printf_info("%s", summary_string.c_str());
@@ -1538,7 +1539,7 @@ void cli_frontend::execute_commands(const char *exename)
// showusage?
if (strcmp(m_options.command(), CLICOMMAND_SHOWUSAGE) == 0)
{
- astring helpstring;
+ std::string helpstring;
emulator_info::printf_usage(exename, emulator_info::get_gamenoun());
osd_printf_info("\n\nOptions:\n%s", m_options.output_help(helpstring));
return;
@@ -1553,9 +1554,9 @@ void cli_frontend::execute_commands(const char *exename)
}
// other commands need the INIs parsed
- astring option_errors;
+ std::string option_errors;
m_options.parse_standard_inis(option_errors);
- if (option_errors)
+ if (!option_errors.empty())
osd_printf_error("%s\n", option_errors.c_str());
// createconfig?
@@ -1567,7 +1568,7 @@ void cli_frontend::execute_commands(const char *exename)
throw emu_fatalerror("Unable to create file %s.ini\n",emulator_info::get_configname());
// generate the updated INI
- astring initext;
+ std::string initext;
file.puts(m_options.output_ini(initext));
return;
}
@@ -1576,7 +1577,7 @@ void cli_frontend::execute_commands(const char *exename)
if (strcmp(m_options.command(), CLICOMMAND_SHOWCONFIG) == 0)
{
// print the INI text
- astring initext;
+ std::string initext;
printf("%s\n", m_options.output_ini(initext));
return;
}
@@ -1686,7 +1687,7 @@ void media_identifier::identify(const char *filename)
for (const osd_directory_entry *entry = osd_readdir(directory); entry != NULL; entry = osd_readdir(directory))
if (entry->type == ENTTYPE_FILE)
{
- astring curfile = astring(filename).cat(PATH_SEPARATOR).cat(entry->name);
+ std::string curfile = std::string(filename).append(PATH_SEPARATOR).append(entry->name);
identify(curfile.c_str());
}
@@ -1778,7 +1779,7 @@ void media_identifier::identify_file(const char *name)
if (core_filename_ends_with(name, ".chd"))
{
// output the name
- astring basename;
+ std::string basename;
osd_printf_info("%-20s", core_filename_extract_base(basename, name).c_str());
m_total++;
@@ -1854,7 +1855,7 @@ void media_identifier::identify_data(const char *name, const UINT8 *data, int le
// output the name
m_total++;
- astring basename;
+ std::string basename;
osd_printf_info("%-20s", core_filename_extract_base(basename, name).c_str());
// see if we can find a match in the ROMs