diff options
395 files changed, 3443 insertions, 3896 deletions
diff --git a/src/emu/audit.c b/src/emu/audit.c index fe207522c02..b8ab208d6a0 100644 --- a/src/emu/audit.c +++ b/src/emu/audit.c @@ -64,9 +64,9 @@ const char *driverpath = m_enumerator.config().root_device().searchpath(); for (const rom_entry *region = rom_first_region(*device); region != NULL; region = rom_next_region(region)) { // temporary hack: add the driver path & region name -astring combinedpath = astring(device->searchpath()).cat(";").cat(driverpath); +std::string combinedpath = std::string(device->searchpath()).append(";").append(driverpath); if (device->shortname()) - combinedpath.cat(";").cat(device->shortname()); + combinedpath.append(";").append(device->shortname()); m_searchpath = combinedpath.c_str(); for (const rom_entry *rom = rom_first_file(region); rom; rom = rom_next_file(rom)) @@ -188,19 +188,19 @@ media_auditor::summary media_auditor::audit_software(const char *list_name, soft // store validation for later m_validation = validation; - astring combinedpath(swinfo->shortname()); - combinedpath.cat(";"); - combinedpath.cat(list_name); - combinedpath.cat(PATH_SEPARATOR); - combinedpath.cat(swinfo->shortname()); - astring locationtag(list_name); - locationtag.cat("%"); - locationtag.cat(swinfo->shortname()); - locationtag.cat("%"); + std::string combinedpath(swinfo->shortname()); + combinedpath.append(";"); + combinedpath.append(list_name); + combinedpath.append(PATH_SEPARATOR); + combinedpath.append(swinfo->shortname()); + std::string locationtag(list_name); + locationtag.append("%"); + locationtag.append(swinfo->shortname()); + locationtag.append("%"); if (swinfo->parentname() != NULL) { - locationtag.cat(swinfo->parentname()); - combinedpath.cat(";").cat(swinfo->parentname()).cat(";").cat(list_name).cat(PATH_SEPARATOR).cat(swinfo->parentname()); + locationtag.append(swinfo->parentname()); + combinedpath.append(";").append(swinfo->parentname()).append(";").append(list_name).append(PATH_SEPARATOR).append(swinfo->parentname()); } m_searchpath = combinedpath.c_str(); @@ -274,12 +274,12 @@ media_auditor::summary media_auditor::audit_samples() for (samples_device *device = iter.first(); device != NULL; device = iter.next()) { // by default we just search using the driver name - astring searchpath(m_enumerator.driver().name); + std::string searchpath(m_enumerator.driver().name); // add the alternate path if present samples_iterator iter(*device); if (iter.altbasename() != NULL) - searchpath.cat(";").cat(iter.altbasename()); + searchpath.append(";").append(iter.altbasename()); // iterate over samples in this entry for (const char *samplename = iter.first(); samplename != NULL; samplename = iter.next()) @@ -292,7 +292,7 @@ media_auditor::summary media_auditor::audit_samples() // look for the files emu_file file(m_enumerator.options().sample_path(), OPEN_FLAG_READ | OPEN_FLAG_NO_PRELOAD); path_iterator path(searchpath.c_str()); - astring curpath; + std::string curpath; while (path.next(curpath, samplename)) { // attempt to access the file (.flac) or (.wav) @@ -327,7 +327,7 @@ media_auditor::summary media_auditor::audit_samples() // string format //------------------------------------------------- -media_auditor::summary media_auditor::summarize(const char *name, astring *output) +media_auditor::summary media_auditor::summarize(const char *name, std::string *output) { if (m_record_list.count() == 0) { @@ -347,37 +347,37 @@ media_auditor::summary media_auditor::summarize(const char *name, astring *outpu // output the game name, file name, and length (if applicable) if (output != NULL) { - output->catprintf("%-12s: %s", name, record->name()); + strcatprintf(*output,"%-12s: %s", name, record->name()); if (record->expected_length() > 0) - output->catprintf(" (%" I64FMT "d bytes)", record->expected_length()); - output->catprintf(" - "); + strcatprintf(*output," (%" I64FMT "d bytes)", record->expected_length()); + strcatprintf(*output," - "); } // use the substatus for finer details switch (record->substatus()) { case audit_record::SUBSTATUS_GOOD_NEEDS_REDUMP: - if (output != NULL) output->catprintf("NEEDS REDUMP\n"); + if (output != NULL) strcatprintf(*output,"NEEDS REDUMP\n"); best_new_status = BEST_AVAILABLE; break; case audit_record::SUBSTATUS_FOUND_NODUMP: - if (output != NULL) output->catprintf("NO GOOD DUMP KNOWN\n"); + if (output != NULL) strcatprintf(*output,"NO GOOD DUMP KNOWN\n"); best_new_status = BEST_AVAILABLE; break; case audit_record::SUBSTATUS_FOUND_BAD_CHECKSUM: if (output != NULL) { - astring tempstr; - output->catprintf("INCORRECT CHECKSUM:\n"); - output->catprintf("EXPECTED: %s\n", record->expected_hashes().macro_string(tempstr)); - output->catprintf(" FOUND: %s\n", record->actual_hashes().macro_string(tempstr)); + std::string tempstr; + strcatprintf(*output,"INCORRECT CHECKSUM:\n"); + strcatprintf(*output,"EXPECTED: %s\n", record->expected_hashes().macro_string(tempstr)); + strcatprintf(*output," FOUND: %s\n", record->actual_hashes().macro_string(tempstr)); } break; case audit_record::SUBSTATUS_FOUND_WRONG_LENGTH: - if (output != NULL) output->catprintf("INCORRECT LENGTH: %" I64FMT "d bytes\n", record->actual_length()); + if (output != NULL) strcatprintf(*output,"INCORRECT LENGTH: %" I64FMT "d bytes\n", record->actual_length()); break; case audit_record::SUBSTATUS_NOT_FOUND: @@ -385,20 +385,20 @@ media_auditor::summary media_auditor::summarize(const char *name, astring *outpu { device_t *shared_device = record->shared_device(); if (shared_device == NULL) - output->catprintf("NOT FOUND\n"); + strcatprintf(*output,"NOT FOUND\n"); else - output->catprintf("NOT FOUND (%s)\n", shared_device->shortname()); + strcatprintf(*output,"NOT FOUND (%s)\n", shared_device->shortname()); } best_new_status = NOTFOUND; break; case audit_record::SUBSTATUS_NOT_FOUND_NODUMP: - if (output != NULL) output->catprintf("NOT FOUND - NO GOOD DUMP KNOWN\n"); + if (output != NULL) strcatprintf(*output,"NOT FOUND - NO GOOD DUMP KNOWN\n"); best_new_status = BEST_AVAILABLE; break; case audit_record::SUBSTATUS_NOT_FOUND_OPTIONAL: - if (output != NULL) output->catprintf("NOT FOUND BUT OPTIONAL\n"); + if (output != NULL) strcatprintf(*output,"NOT FOUND BUT OPTIONAL\n"); best_new_status = BEST_AVAILABLE; break; @@ -430,7 +430,7 @@ audit_record *media_auditor::audit_one_rom(const rom_entry *rom) emu_file file(m_enumerator.options().media_path(), OPEN_FLAG_READ | OPEN_FLAG_NO_PRELOAD); file.set_restrict_to_mediapath(true); path_iterator path(m_searchpath); - astring curpath; + std::string curpath; while (path.next(curpath, record.name())) { // open the file if we can diff --git a/src/emu/audit.h b/src/emu/audit.h index f769cbb22b1..5989fe5a10e 100644 --- a/src/emu/audit.h +++ b/src/emu/audit.h @@ -149,7 +149,7 @@ public: summary audit_device(device_t *device, const char *validation = AUDIT_VALIDATE_FULL); summary audit_software(const char *list_name, software_info *swinfo, const char *validation = AUDIT_VALIDATE_FULL); summary audit_samples(); - summary summarize(const char *name,astring *output = NULL); + summary summarize(const char *name,std::string *output = NULL); private: // internal helpers diff --git a/src/emu/bus/gba/gba_slot.c b/src/emu/bus/gba/gba_slot.c index 1122958a4b5..bc2ccd88f66 100644 --- a/src/emu/bus/gba/gba_slot.c +++ b/src/emu/bus/gba/gba_slot.c @@ -256,9 +256,9 @@ bool gba_cart_slot_device::call_softlist_load(software_list_device &swlist, cons fullpath -------------------------------------------------*/ -INLINE astring gba_chip_string( UINT32 chip ) +INLINE std::string gba_chip_string( UINT32 chip ) { - astring str; + std::string str; if (chip == 0) str += "NONE "; if (chip & GBA_CHIP_EEPROM) str += "EEPROM "; if (chip & GBA_CHIP_EEPROM_64K) str += "EEPROM_64K "; @@ -268,7 +268,8 @@ INLINE astring gba_chip_string( UINT32 chip ) if (chip & GBA_CHIP_FLASH_512) str += "FLASH_512 "; if (chip & GBA_CHIP_SRAM) str += "SRAM "; if (chip & GBA_CHIP_RTC) str += "RTC "; - return str.trimspace(); + strtrimspace(str); + return str; } diff --git a/src/emu/cheat.c b/src/emu/cheat.c index 39cd2074073..fc19df4e83c 100644 --- a/src/emu/cheat.c +++ b/src/emu/cheat.c @@ -101,25 +101,25 @@ // the format //------------------------------------------------- -inline const char *number_and_format::format(astring &str) const +inline const char *number_and_format::format(std::string &str) const { switch (m_format) { default: case XML_INT_FORMAT_DECIMAL: - str.printf("%d", (UINT32)m_value); + strprintf(str, "%d", (UINT32)m_value); break; case XML_INT_FORMAT_DECIMAL_POUND: - str.printf("#%d", (UINT32)m_value); + strprintf(str, "#%d", (UINT32)m_value); break; case XML_INT_FORMAT_HEX_DOLLAR: - str.printf("$%X", (UINT32)m_value); + strprintf(str, "$%X", (UINT32)m_value); break; case XML_INT_FORMAT_HEX_C: - str.printf("0x%X", (UINT32)m_value); + strprintf(str, "0x%X", (UINT32)m_value); break; } return str.c_str(); @@ -178,16 +178,16 @@ const char *cheat_parameter::text() { // are we a value cheat? if (!has_itemlist()) - m_curtext.format("%d (0x%X)", UINT32(m_value), UINT32(m_value)); + strprintf(m_curtext,"%d (0x%X)", UINT32(m_value), UINT32(m_value)); // if not, we're an item cheat else { - m_curtext.format("??? (%d)", UINT32(m_value)); + strprintf(m_curtext, "??? (%d)", UINT32(m_value)); for (item *curitem = m_itemlist.first(); curitem != NULL; curitem = curitem->next()) if (curitem->value() == m_value) { - m_curtext.cpy(curitem->text()); + m_curtext.assign(curitem->text()); break; } } @@ -205,7 +205,7 @@ void cheat_parameter::save(emu_file &cheatfile) const cheatfile.printf("\t\t<parameter"); // if no items, just output min/max/step - astring str; + std::string str; if (!has_itemlist()) { if (m_minval != 0) @@ -426,7 +426,7 @@ cheat_script::script_entry::script_entry(cheat_manager &manager, symbol_table &s const char *format = xml_get_attribute_string(&entrynode, "format", NULL); if (format == NULL || format[0] == 0) throw emu_fatalerror("%s.xml(%d): missing format in output tag\n", filename, entrynode.line); - m_format.cpy(format); + m_format.assign(format); // extract other attributes m_line = xml_get_attribute_int(&entrynode, "line", 0); @@ -507,7 +507,7 @@ void cheat_script::script_entry::execute(cheat_manager &manager, UINT64 &arginde curarg += arg->values(argindex, ¶ms[curarg]); // generate the astring - manager.get_output_astring(m_line, m_justify).printf(m_format.c_str(), + strprintf(manager.get_output_astring(m_line, m_justify), m_format.c_str(), (UINT32)params[0], (UINT32)params[1], (UINT32)params[2], (UINT32)params[3], (UINT32)params[4], (UINT32)params[5], (UINT32)params[6], (UINT32)params[7], (UINT32)params[8], (UINT32)params[9], (UINT32)params[10], (UINT32)params[11], @@ -526,7 +526,7 @@ void cheat_script::script_entry::execute(cheat_manager &manager, UINT64 &arginde void cheat_script::script_entry::save(emu_file &cheatfile) const { - astring tempstring; + std::string tempstring; // output an action if (m_format.empty()) @@ -660,7 +660,7 @@ int cheat_script::script_entry::output_argument::values(UINT64 &argindex, UINT64 void cheat_script::script_entry::output_argument::save(emu_file &cheatfile) const { - astring tempstring; + std::string tempstring; cheatfile.printf("\t\t\t\t<argument"); if (m_count != 1) @@ -709,9 +709,11 @@ cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, cons // create the symbol table m_symbols.add("argindex", symbol_table::READ_ONLY, &m_argindex); - astring tempname; - for (int curtemp = 0; curtemp < tempcount; curtemp++) - m_symbols.add(tempname.format("temp%d", curtemp).c_str(), symbol_table::READ_WRITE); + std::string tempname; + for (int curtemp = 0; curtemp < tempcount; curtemp++) { + strprintf(tempname,"temp%d", curtemp); + m_symbols.add(tempname.c_str(), symbol_table::READ_WRITE); + } // read the first comment node xml_data_node *commentnode = xml_get_sibling(cheatnode.child, "comment"); @@ -719,7 +721,7 @@ cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, cons { // set the value if not NULL if (commentnode->value != NULL && commentnode->value[0] != 0) - m_comment.cpy(commentnode->value); + m_comment.assign(commentnode->value); // only one comment is kept commentnode = xml_get_sibling(commentnode->next, "comment"); @@ -951,11 +953,11 @@ bool cheat_entry::select_next_state() // this cheat in a menu item //------------------------------------------------- -void cheat_entry::menu_text(astring &description, astring &state, UINT32 &flags) +void cheat_entry::menu_text(std::string &description, std::string &state, UINT32 &flags) { // description is standard - description.cpy(m_description); - state.reset(); + description.assign(m_description); + state.clear(); flags = 0; // some cheat entries are just text for display @@ -963,21 +965,21 @@ void cheat_entry::menu_text(astring &description, astring &state, UINT32 &flags) { if (!description.empty()) { - description.trimspace(); + strtrimspace(description); if (description.empty()) - description.cpy(MENU_SEPARATOR_ITEM); + description.assign(MENU_SEPARATOR_ITEM); } flags = MENU_FLAG_DISABLE; } // if we have no parameter and no run or off script, it's a oneshot cheat else if (is_oneshot()) - state.cpy("Set"); + state.assign("Set"); // if we have no parameter, it's just on/off else if (is_onoff()) { - state.cpy((m_state == SCRIPT_STATE_RUN) ? "On" : "Off"); + state.assign((m_state == SCRIPT_STATE_RUN) ? "On" : "Off"); flags = (m_state != 0) ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW; } @@ -986,12 +988,12 @@ void cheat_entry::menu_text(astring &description, astring &state, UINT32 &flags) { if (m_state == SCRIPT_STATE_OFF) { - state.cpy(is_oneshot_parameter() ? "Set" : "Off"); + state.assign(is_oneshot_parameter() ? "Set" : "Off"); flags = MENU_FLAG_RIGHT_ARROW; } else { - state.cpy(m_parameter->text()); + state.assign(m_parameter->text()); flags = MENU_FLAG_LEFT_ARROW; if (!m_parameter->is_maximum()) flags |= MENU_FLAG_RIGHT_ARROW; @@ -1149,8 +1151,8 @@ void cheat_manager::reload() UINT32 crc = image->crc(); if (crc != 0) { - astring filename; - filename.printf("%08X", crc); + std::string filename; + strprintf(filename,"%08X", crc); load_cheats(filename.c_str()); break; } @@ -1235,7 +1237,7 @@ void cheat_manager::render_text(render_container &container) // justification //------------------------------------------------- -astring &cheat_manager::get_output_astring(int row, int justify) +std::string &cheat_manager::get_output_astring(int row, int justify) { // if the row is not specified, grab the next one if (row == 0) @@ -1263,34 +1265,34 @@ astring &cheat_manager::get_output_astring(int row, int justify) // document //------------------------------------------------- -const char *cheat_manager::quote_expression(astring &str, const parsed_expression &expression) +const char *cheat_manager::quote_expression(std::string &str, const parsed_expression &expression) { - str.cpy(expression.original_string()); + str.assign(expression.original_string()); - str.replace(0, " && ", " and "); - str.replace(0, " &&", " and "); - str.replace(0, "&& ", " and "); - str.replace(0, "&&", " and "); + strreplace(str, " && ", " and "); + strreplace(str, " &&", " and "); + strreplace(str, "&& ", " and "); + strreplace(str, "&&", " and "); - str.replace(0, " & ", " band "); - str.replace(0, " &", " band "); - str.replace(0, "& ", " band "); - str.replace(0, "&", " band "); + strreplace(str, " & ", " band "); + strreplace(str, " &", " band "); + strreplace(str, "& ", " band "); + strreplace(str, "&", " band "); - str.replace(0, " <= ", " le "); - str.replace(0, " <=", " le "); - str.replace(0, "<= ", " le "); - str.replace(0, "<=", " le "); + strreplace(str, " <= ", " le "); + strreplace(str, " <=", " le "); + strreplace(str, "<= ", " le "); + strreplace(str, "<=", " le "); - str.replace(0, " < ", " lt "); - str.replace(0, " <", " lt "); - str.replace(0, "< ", " lt "); - str.replace(0, "<", " lt "); + strreplace(str, " < ", " lt "); + strreplace(str, " <", " lt "); + strreplace(str, "< ", " lt "); + strreplace(str, "<", " lt "); - str.replace(0, " << ", " lshift "); - str.replace(0, " <<", " lshift "); - str.replace(0, "<< ", " lshift "); - str.replace(0, "<<", " lshift "); + strreplace(str, " << ", " lshift "); + strreplace(str, " <<", " lshift "); + strreplace(str, "<< ", " lshift "); + strreplace(str, "<<", " lshift "); return str.c_str(); } @@ -1347,7 +1349,7 @@ void cheat_manager::frame_update() m_numlines = floor(1.0f / machine().ui().get_line_height()); m_numlines = MIN(m_numlines, ARRAY_LENGTH(m_output)); for (int linenum = 0; linenum < ARRAY_LENGTH(m_output); linenum++) - m_output[linenum].reset(); + m_output[linenum].clear(); // iterate over running cheats and execute them for (cheat_entry *cheat = m_cheatlist.first(); cheat != NULL; cheat = cheat->next()) diff --git a/src/emu/cheat.h b/src/emu/cheat.h index 9e80b6c6bb1..816781a461d 100644 --- a/src/emu/cheat.h +++ b/src/emu/cheat.h @@ -56,7 +56,7 @@ public: operator const UINT64 &() const { return m_value; } // format the number according to its format - const char *format(astring &str) const; + const char *format(std::string &str) const; private: // internal state @@ -109,7 +109,7 @@ private: private: // internal state item * m_next; // next item in list - astring m_text; // name of the item + std::string m_text; // name of the item number_and_format m_value; // value of the item }; @@ -118,7 +118,7 @@ private: number_and_format m_maxval; // maximum value number_and_format m_stepval; // step value UINT64 m_value; // live value of the parameter - astring m_curtext; // holding for a value string + std::string m_curtext; // holding for a value string simple_list<item> m_itemlist; // list of items }; @@ -190,7 +190,7 @@ private: script_entry * m_next; // link to next entry parsed_expression m_condition; // condition under which this is executed parsed_expression m_expression; // expression to execute - astring m_format; // string format to print + std::string m_format; // string format to print simple_list<output_argument> m_arglist; // list of arguments INT8 m_line; // which line to print on UINT8 m_justify; // justification when printing @@ -252,7 +252,7 @@ public: void save(emu_file &cheatfile) const; // UI helpers - void menu_text(astring &description, astring &state, UINT32 &flags); + void menu_text(std::string &description, std::string &state, UINT32 &flags); // per-frame update void frame_update() { if (m_state == SCRIPT_STATE_RUN) execute_run_script(); } @@ -265,8 +265,8 @@ private: // internal state cheat_manager & m_manager; // reference to our manager cheat_entry * m_next; // next cheat entry - astring m_description; // string description/menu title - astring m_comment; // comment data + std::string m_description; // string description/menu title + std::string m_comment; // comment data auto_pointer<cheat_parameter> m_parameter; // parameter auto_pointer<cheat_script> m_on_script; // script to run when turning on auto_pointer<cheat_script> m_off_script; // script to run when turning off @@ -305,10 +305,10 @@ public: void render_text(render_container &container); // output helpers - astring &get_output_astring(int row, int justify); + std::string &get_output_astring(int row, int justify); // global helpers - static const char *quote_expression(astring &str, const parsed_expression &expression); + static const char *quote_expression(std::string &str, const parsed_expression &expression); static UINT64 execute_frombcd(symbol_table &table, void *ref, int params, const UINT64 *param); static UINT64 execute_tobcd(symbol_table &table, void *ref, int params, const UINT64 *param); @@ -321,7 +321,7 @@ private: running_machine & m_machine; // reference to our machine simple_list<cheat_entry> m_cheatlist; // cheat list UINT64 m_framecount; // frame count - astring m_output[UI_TARGET_FONT_ROWS*2]; // array of output strings + std::string m_output[UI_TARGET_FONT_ROWS * 2]; // array of output strings UINT8 m_justify[UI_TARGET_FONT_ROWS*2]; // justification for each string UINT8 m_numlines; // number of lines available for output INT8 m_lastline; // last line used for output diff --git a/src/emu/clifront.c b/src/emu/clifront.c index 4c5f11a4585..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.empty()) - osd_printf_error("Error in command line:\n%s\n", option_errors.trimspace().c_str()); + 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 @@ -208,7 +208,7 @@ int cli_frontend::execute(int argc, char **argv) m_options.parse_standard_inis(option_errors); } if (!option_errors.empty()) - osd_printf_error("Error in command line:\n%s\n", option_errors.trimspace().c_str()); + 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,7 +1554,7 @@ 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.empty()) osd_printf_error("%s\n", option_errors.c_str()); @@ -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 diff --git a/src/emu/cpu/8x300/8x300.c b/src/emu/cpu/8x300/8x300.c index fab5f9f9ab4..517e205c5a2 100644 --- a/src/emu/cpu/8x300/8x300.c +++ b/src/emu/cpu/8x300/8x300.c @@ -143,7 +143,7 @@ void n8x300_cpu_device::device_start() m_icountptr = &m_icount; } -void n8x300_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void n8x300_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { diff --git a/src/emu/cpu/8x300/8x300.h b/src/emu/cpu/8x300/8x300.h index 151d4fd49fc..116fef0119e 100644 --- a/src/emu/cpu/8x300/8x300.h +++ b/src/emu/cpu/8x300/8x300.h @@ -64,7 +64,7 @@ protected: } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 2; } diff --git a/src/emu/cpu/adsp2100/adsp2100.c b/src/emu/cpu/adsp2100/adsp2100.c index 0a521b7898f..3c3a5e7049c 100644 --- a/src/emu/cpu/adsp2100/adsp2100.c +++ b/src/emu/cpu/adsp2100/adsp2100.c @@ -544,15 +544,15 @@ void adsp21xx_device::device_start() state_add(ADSP2100_SR0_SEC, "SR0_SEC", m_alt.sr.srx.sr0.u); state_add(ADSP2100_SR1_SEC, "SR1_SEC", m_alt.sr.srx.sr1.u); - astring tempstring; + std::string tempstring; for (int ireg = 0; ireg < 8; ireg++) - state_add(ADSP2100_I0 + ireg, tempstring.format("I%d", ireg).c_str(), m_i[ireg]).mask(0x3fff).callimport(); + state_add(ADSP2100_I0 + ireg, strformat(tempstring, "I%d", ireg).c_str(), m_i[ireg]).mask(0x3fff).callimport(); for (int lreg = 0; lreg < 8; lreg++) - state_add(ADSP2100_L0 + lreg, tempstring.format("L%d", lreg).c_str(), m_l[lreg]).mask(0x3fff).callimport(); + state_add(ADSP2100_L0 + lreg, strformat(tempstring, "L%d", lreg).c_str(), m_l[lreg]).mask(0x3fff).callimport(); for (int mreg = 0; mreg < 8; mreg++) - state_add(ADSP2100_M0 + mreg, tempstring.format("M%d", mreg).c_str(), m_m[mreg]).signed_mask(0x3fff); + state_add(ADSP2100_M0 + mreg, strformat(tempstring, "M%d", mreg).c_str(), m_m[mreg]).signed_mask(0x3fff); state_add(ADSP2100_PX, "PX", m_px); state_add(ADSP2100_CNTR, "CNTR", m_cntr).mask(0x3fff); @@ -571,7 +571,7 @@ void adsp21xx_device::device_start() for (int irqnum = 0; irqnum < 4; irqnum++) if (irqnum < 4 || m_chip_type == CHIP_TYPE_ADSP2100) - state_add(ADSP2100_IRQSTATE0 + irqnum, tempstring.format("IRQ%d", irqnum).c_str(), m_irq_state[irqnum]).mask(1).callimport(); + state_add(ADSP2100_IRQSTATE0 + irqnum, strformat(tempstring, "IRQ%d", irqnum).c_str(), m_irq_state[irqnum]).mask(1).callimport(); state_add(ADSP2100_FLAGIN, "FLAGIN", m_flagin).mask(1); state_add(ADSP2100_FLAGOUT, "FLAGOUT", m_flagout).mask(1); @@ -720,12 +720,12 @@ void adsp21xx_device::state_import(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void adsp21xx_device::state_string_export(const device_state_entry &entry, astring &str) +void adsp21xx_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", m_astat & 0x80 ? 'X':'.', m_astat & 0x40 ? 'M':'.', m_astat & 0x20 ? 'Q':'.', diff --git a/src/emu/cpu/adsp2100/adsp2100.h b/src/emu/cpu/adsp2100/adsp2100.h index 81a938d2c46..ee5e6b23871 100644 --- a/src/emu/cpu/adsp2100/adsp2100.h +++ b/src/emu/cpu/adsp2100/adsp2100.h @@ -237,7 +237,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const; diff --git a/src/emu/cpu/alph8201/alph8201.c b/src/emu/cpu/alph8201/alph8201.c index 922309c1fe6..6fb73a1eb4a 100644 --- a/src/emu/cpu/alph8201/alph8201.c +++ b/src/emu/cpu/alph8201/alph8201.c @@ -513,12 +513,12 @@ void alpha8201_cpu_device::state_export(const device_state_entry &entry) } -void alpha8201_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void alpha8201_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c", m_cf ? 'C' : '.', m_zf ? 'Z' : '.'); + strprintf(str, "%c%c", m_cf ? 'C' : '.', m_zf ? 'Z' : '.'); break; } } diff --git a/src/emu/cpu/alph8201/alph8201.h b/src/emu/cpu/alph8201/alph8201.h index 07544c29406..48f0f284a6a 100644 --- a/src/emu/cpu/alph8201/alph8201.h +++ b/src/emu/cpu/alph8201/alph8201.h @@ -61,7 +61,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/alto2/alto2cpu.c b/src/emu/cpu/alto2/alto2cpu.c index 02808d81115..a0299d95ec8 100644 --- a/src/emu/cpu/alto2/alto2cpu.c +++ b/src/emu/cpu/alto2/alto2cpu.c @@ -1004,15 +1004,15 @@ void alto2_cpu_device::device_start() // for the debugger //------------------------------------------------- -void alto2_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void alto2_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case A2_TASK: - str.printf("%s", task_name(m_task)); + strprintf(str, "%s", task_name(m_task)); break; case STATE_GENFLAGS: - str.printf("%s%s%s%s", + strprintf(str, "%s%s%s%s", m_aluc0 ? "C":"-", m_laluc0 ? "c":"-", m_shifter == 0 ? "0":"-", diff --git a/src/emu/cpu/alto2/alto2cpu.h b/src/emu/cpu/alto2/alto2cpu.h index fa1512e18e1..464ac5a594a 100644 --- a/src/emu/cpu/alto2/alto2cpu.h +++ b/src/emu/cpu/alto2/alto2cpu.h @@ -215,7 +215,7 @@ protected: //! device (P)ROMs virtual const rom_entry *device_rom_region() const; //! device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); //! device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 4; } diff --git a/src/emu/cpu/am29000/am29000.c b/src/emu/cpu/am29000/am29000.c index 8ebb37c014f..d100f44c351 100644 --- a/src/emu/cpu/am29000/am29000.c +++ b/src/emu/cpu/am29000/am29000.c @@ -402,12 +402,12 @@ void am29000_cpu_device::device_start() } -void am29000_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void am29000_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c%c|%3d", m_alu & ALU_V ? 'V' : '.', + strprintf(str, "%c%c%c%c%c%c%c%c%c|%3d", m_alu & ALU_V ? 'V' : '.', m_alu & ALU_Z ? 'Z' : '.', m_alu & ALU_N ? 'N' : '.', m_alu & ALU_C ? 'C' : '.', diff --git a/src/emu/cpu/am29000/am29000.h b/src/emu/cpu/am29000/am29000.h index 88662a71a5b..7e9d691fe91 100644 --- a/src/emu/cpu/am29000/am29000.h +++ b/src/emu/cpu/am29000/am29000.h @@ -460,7 +460,7 @@ protected: } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 4; } diff --git a/src/emu/cpu/amis2000/amis2000.c b/src/emu/cpu/amis2000/amis2000.c index 44062fae621..1d3c198952f 100644 --- a/src/emu/cpu/amis2000/amis2000.c +++ b/src/emu/cpu/amis2000/amis2000.c @@ -72,12 +72,12 @@ amis2152_cpu_device::amis2152_cpu_device(const machine_config &mconfig, const ch // disasm -void amis2000_base_device::state_string_export(const device_state_entry &entry, astring &str) +void amis2000_base_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c", m_f & 0x20 ? '6':'.', m_f & 0x10 ? '5':'.', m_f & 0x08 ? '4':'.', diff --git a/src/emu/cpu/amis2000/amis2000.h b/src/emu/cpu/amis2000/amis2000.h index a80a2b11c4b..ba565205b21 100644 --- a/src/emu/cpu/amis2000/amis2000.h +++ b/src/emu/cpu/amis2000/amis2000.h @@ -89,7 +89,7 @@ protected: virtual UINT32 disasm_min_opcode_bytes() const { return 1; } virtual UINT32 disasm_max_opcode_bytes() const { return 1; } virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); address_space_config m_program_config; address_space_config m_data_config; diff --git a/src/emu/cpu/apexc/apexc.c b/src/emu/cpu/apexc/apexc.c index 35a47c36463..218fd05404f 100644 --- a/src/emu/cpu/apexc/apexc.c +++ b/src/emu/cpu/apexc/apexc.c @@ -812,12 +812,12 @@ void apexc_cpu_device::state_export(const device_state_entry &entry) } -void apexc_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void apexc_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c", m_running ? 'R' : 'S'); + strprintf(str, "%c", m_running ? 'R' : 'S'); break; } } diff --git a/src/emu/cpu/apexc/apexc.h b/src/emu/cpu/apexc/apexc.h index f691ec1fa60..8142246c486 100644 --- a/src/emu/cpu/apexc/apexc.h +++ b/src/emu/cpu/apexc/apexc.h @@ -42,7 +42,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 4; } diff --git a/src/emu/cpu/arm/arm.c b/src/emu/cpu/arm/arm.c index 8de2e2471c1..77f1927f3e3 100644 --- a/src/emu/cpu/arm/arm.c +++ b/src/emu/cpu/arm/arm.c @@ -550,14 +550,14 @@ void arm_cpu_device::device_start() } -void arm_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void arm_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { static const char *s[4] = { "USER", "FIRQ", "IRQ ", "SVC " }; switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c %s", + strprintf(str, "%c%c%c%c%c%c %s", (m_sArmRegister[15] & N_MASK) ? 'N' : '-', (m_sArmRegister[15] & Z_MASK) ? 'Z' : '-', (m_sArmRegister[15] & C_MASK) ? 'C' : '-', diff --git a/src/emu/cpu/arm/arm.h b/src/emu/cpu/arm/arm.h index 490fe41b6b6..8a5cd9057fe 100644 --- a/src/emu/cpu/arm/arm.h +++ b/src/emu/cpu/arm/arm.h @@ -59,7 +59,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 4; } diff --git a/src/emu/cpu/arm7/arm7.c b/src/emu/cpu/arm7/arm7.c index dfc8cb7e035..2f32785e62f 100644 --- a/src/emu/cpu/arm7/arm7.c +++ b/src/emu/cpu/arm7/arm7.c @@ -574,12 +574,12 @@ void arm7_cpu_device::state_export(const device_state_entry &entry) } -void arm7_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void arm7_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c %s", + strprintf(str, "%c%c%c%c%c%c%c%c %s", (ARM7REG(eCPSR) & N_MASK) ? 'N' : '-', (ARM7REG(eCPSR) & Z_MASK) ? 'Z' : '-', (ARM7REG(eCPSR) & C_MASK) ? 'C' : '-', diff --git a/src/emu/cpu/arm7/arm7.h b/src/emu/cpu/arm7/arm7.h index ce78d0b6407..08fa9902ed9 100644 --- a/src/emu/cpu/arm7/arm7.h +++ b/src/emu/cpu/arm7/arm7.h @@ -97,7 +97,7 @@ protected: // device_state_interface overrides virtual void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 2; } diff --git a/src/emu/cpu/asap/asap.c b/src/emu/cpu/asap/asap.c index b80398d421e..1402ef8e442 100644 --- a/src/emu/cpu/asap/asap.c +++ b/src/emu/cpu/asap/asap.c @@ -186,7 +186,7 @@ void asap_device::device_start() m_direct = &m_program->direct(); // register our state for the debugger - astring tempstr; + std::string tempstr; state_add(STATE_GENPC, "GENPC", m_pc).noshow(); state_add(STATE_GENPCBASE, "GENPCBASE", m_ppc).noshow(); state_add(STATE_GENSP, "GENSP", m_src2val[REGBASE + 31]).noshow(); @@ -194,7 +194,7 @@ void asap_device::device_start() state_add(ASAP_PC, "PC", m_pc); state_add(ASAP_PS, "PS", m_flagsio).callimport().callexport(); for (int regnum = 0; regnum < 32; regnum++) - state_add(ASAP_R0 + regnum, tempstr.format("R%d", regnum).c_str(), m_src2val[REGBASE + regnum]); + state_add(ASAP_R0 + regnum, strformat(tempstr, "R%d", regnum).c_str(), m_src2val[REGBASE + regnum]); // register our state for saving save_item(NAME(m_pc)); @@ -281,12 +281,12 @@ void asap_device::state_export(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void asap_device::state_string_export(const device_state_entry &entry, astring &str) +void asap_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c", m_pflag ? 'P' : '.', m_iflag ? 'I' : '.', ((INT32)m_znflag < 0) ? 'N' : '.', diff --git a/src/emu/cpu/asap/asap.h b/src/emu/cpu/asap/asap.h index fc7bfadae48..6cac9ee4c36 100644 --- a/src/emu/cpu/asap/asap.h +++ b/src/emu/cpu/asap/asap.h @@ -48,7 +48,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const; diff --git a/src/emu/cpu/avr8/avr8.c b/src/emu/cpu/avr8/avr8.c index ad61eeae266..b8dc5ffd1d2 100644 --- a/src/emu/cpu/avr8/avr8.c +++ b/src/emu/cpu/avr8/avr8.c @@ -749,7 +749,7 @@ void avr8_device::device_start() m_io = &space(AS_IO); // register our state for the debugger - astring tempstr; + std::string tempstr; state_add(STATE_GENPC, "GENPC", m_shifted_pc).noshow(); state_add(STATE_GENFLAGS, "GENFLAGS", m_r[AVR8_REGIDX_SREG]).callimport().callexport().formatstr("%8s").noshow(); state_add(AVR8_SREG, "STATUS", m_r[AVR8_REGIDX_SREG]).mask(0xff); @@ -902,12 +902,12 @@ const address_space_config *avr8_device::memory_space_config(address_spacenum sp // for the debugger //------------------------------------------------- -void avr8_device::state_string_export(const device_state_entry &entry, astring &str) +void avr8_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", (m_r[AVR8_REGIDX_SREG] & 0x80) ? 'I' : '-', (m_r[AVR8_REGIDX_SREG] & 0x40) ? 'T' : '-', (m_r[AVR8_REGIDX_SREG] & 0x20) ? 'H' : '-', diff --git a/src/emu/cpu/avr8/avr8.h b/src/emu/cpu/avr8/avr8.h index 7ae7417279f..1d42d081ada 100644 --- a/src/emu/cpu/avr8/avr8.h +++ b/src/emu/cpu/avr8/avr8.h @@ -132,7 +132,7 @@ protected: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // address spaces const address_space_config m_program_config; diff --git a/src/emu/cpu/ccpu/ccpu.c b/src/emu/cpu/ccpu/ccpu.c index 1f31a8d3525..a06ac8e003e 100644 --- a/src/emu/cpu/ccpu/ccpu.c +++ b/src/emu/cpu/ccpu/ccpu.c @@ -139,12 +139,12 @@ void ccpu_cpu_device::device_start() } -void ccpu_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void ccpu_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c", TEST_A0 ? '0' : 'o', TEST_NC ? 'N' : 'n', TEST_LT ? 'L' : 'l', diff --git a/src/emu/cpu/ccpu/ccpu.h b/src/emu/cpu/ccpu/ccpu.h index b7dffc7a44d..96a0fac344a 100644 --- a/src/emu/cpu/ccpu/ccpu.h +++ b/src/emu/cpu/ccpu/ccpu.h @@ -82,7 +82,7 @@ protected: } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/cop400/cop400.c b/src/emu/cpu/cop400/cop400.c index 26fbd8e21ef..1d5eaf785fe 100644 --- a/src/emu/cpu/cop400/cop400.c +++ b/src/emu/cpu/cop400/cop400.c @@ -1239,12 +1239,12 @@ void cop400_cpu_device::state_export(const device_state_entry &entry) } } -void cop400_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void cop400_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c", + strprintf(str, "%c%c%c", m_c ? 'C' : '.', m_skl ? 'S' : '.', m_skt_latch ? 'T' : '.'); diff --git a/src/emu/cpu/cop400/cop400.h b/src/emu/cpu/cop400/cop400.h index ada3d7d9e1a..f98f9df44ce 100644 --- a/src/emu/cpu/cop400/cop400.h +++ b/src/emu/cpu/cop400/cop400.h @@ -139,7 +139,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/cosmac/cosmac.c b/src/emu/cpu/cosmac/cosmac.c index 5afa7ec3e14..63747781f07 100644 --- a/src/emu/cpu/cosmac/cosmac.c +++ b/src/emu/cpu/cosmac/cosmac.c @@ -356,9 +356,9 @@ void cosmac_device::device_start() state_add(COSMAC_I, "I", m_i).mask(0xf); state_add(COSMAC_N, "N", m_n).mask(0xf); - astring tempstr; + std::string tempstr; for (int regnum = 0; regnum < 16; regnum++) - state_add(COSMAC_R0 + regnum, tempstr.format("R%x", regnum).c_str(), m_r[regnum]); + state_add(COSMAC_R0 + regnum, strformat(tempstr, "R%x", regnum).c_str(), m_r[regnum]); state_add(COSMAC_DF, "DF", m_df).mask(0x1).noshow(); state_add(COSMAC_IE, "IE", m_ie).mask(0x1).noshow(); @@ -472,12 +472,12 @@ void cosmac_device::state_export(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void cosmac_device::state_string_export(const device_state_entry &entry, astring &str) +void cosmac_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c", + strprintf(str, "%c%c%c", m_df ? 'D' : '.', m_ie ? 'I' : '.', m_q ? 'Q' : '.'); diff --git a/src/emu/cpu/cosmac/cosmac.h b/src/emu/cpu/cosmac/cosmac.h index f0b601dce02..897c4f027ed 100644 --- a/src/emu/cpu/cosmac/cosmac.h +++ b/src/emu/cpu/cosmac/cosmac.h @@ -235,7 +235,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const; diff --git a/src/emu/cpu/cp1610/cp1610.c b/src/emu/cpu/cp1610/cp1610.c index c2e905bb6fa..a52c795ede9 100644 --- a/src/emu/cpu/cp1610/cp1610.c +++ b/src/emu/cpu/cp1610/cp1610.c @@ -3427,12 +3427,12 @@ cp1610_cpu_device::cp1610_cpu_device(const machine_config &mconfig, const char * } -void cp1610_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void cp1610_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c", + strprintf(str, "%c%c%c%c", m_flags & 0x80 ? 'S':'.', m_flags & 0x40 ? 'Z':'.', m_flags & 0x20 ? 'V':'.', diff --git a/src/emu/cpu/cp1610/cp1610.h b/src/emu/cpu/cp1610/cp1610.h index 97a85fb86da..712378a20d3 100644 --- a/src/emu/cpu/cp1610/cp1610.h +++ b/src/emu/cpu/cp1610/cp1610.h @@ -64,7 +64,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 2; } diff --git a/src/emu/cpu/cubeqcpu/cubeqcpu.c b/src/emu/cpu/cubeqcpu/cubeqcpu.c index 10b21ec6c6e..d0bbe856df5 100644 --- a/src/emu/cpu/cubeqcpu/cubeqcpu.c +++ b/src/emu/cpu/cubeqcpu/cubeqcpu.c @@ -345,12 +345,12 @@ void cquestrot_cpu_device::device_reset() } -void cquestrot_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void cquestrot_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c", m_cflag ? 'C' : '.', + strprintf(str, "%c%c%c", m_cflag ? 'C' : '.', m_vflag ? 'V' : '.', m_f ? '.' : 'Z'); break; @@ -469,12 +469,12 @@ void cquestlin_cpu_device::device_reset() } -void cquestlin_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void cquestlin_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c|%cG", m_cflag ? 'C' : '.', + strprintf(str, "%c%c%c|%cG", m_cflag ? 'C' : '.', m_vflag ? 'V' : '.', m_f ? '.' : 'Z', ( m_clkcnt & 3 ) ? 'B' : 'F'); diff --git a/src/emu/cpu/cubeqcpu/cubeqcpu.h b/src/emu/cpu/cubeqcpu/cubeqcpu.h index 677be9a4d43..ce19b86f559 100644 --- a/src/emu/cpu/cubeqcpu/cubeqcpu.h +++ b/src/emu/cpu/cubeqcpu/cubeqcpu.h @@ -230,7 +230,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 8; } @@ -314,7 +314,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 8; } diff --git a/src/emu/cpu/drcbex64.c b/src/emu/cpu/drcbex64.c index eb51d667b5e..64f2dd89bf0 100644 --- a/src/emu/cpu/drcbex64.c +++ b/src/emu/cpu/drcbex64.c @@ -654,7 +654,7 @@ drcbe_x64::drcbe_x64(drcuml_state &drcuml, device_t &device, drc_cache &cache, U // create the log if (device.machine().options().drc_log_native()) { - astring filename = astring("drcbex64_").cat(device.shortname()).cat(".asm"); + std::string filename = std::string("drcbex64_").append(device.shortname()).append(".asm"); m_log = x86log_create_context(filename.c_str()); } } @@ -787,7 +787,7 @@ void drcbe_x64::generate(drcuml_block &block, const instruction *instlist, UINT3 x86code *dst = base; // generate code - astring tempstring; + std::string tempstring; const char *blockname = NULL; for (int inum = 0; inum < numinst; inum++) { @@ -797,7 +797,7 @@ void drcbe_x64::generate(drcuml_block &block, const instruction *instlist, UINT3 // add a comment if (m_log != NULL) { - astring dasm; + std::string dasm; inst.disasm(dasm, &m_drcuml); x86log_add_comment(m_log, dst, "%s", dasm.c_str()); } @@ -808,7 +808,7 @@ void drcbe_x64::generate(drcuml_block &block, const instruction *instlist, UINT3 if (inst.opcode() == OP_HANDLE) blockname = inst.param(0).handle().string(); else if (inst.opcode() == OP_HASH) - blockname = tempstring.format("Code: mode=%d PC=%08X", (UINT32)inst.param(0).immediate(), (offs_t)inst.param(1).immediate()).c_str(); + blockname = strformat(tempstring, "Code: mode=%d PC=%08X", (UINT32)inst.param(0).immediate(), (offs_t)inst.param(1).immediate()).c_str(); } // generate code diff --git a/src/emu/cpu/drcbex86.c b/src/emu/cpu/drcbex86.c index ca90329ac2d..b52ece2b0cc 100644 --- a/src/emu/cpu/drcbex86.c +++ b/src/emu/cpu/drcbex86.c @@ -568,7 +568,7 @@ drcbe_x86::drcbe_x86(drcuml_state &drcuml, device_t &device, drc_cache &cache, U // create the log if (device.machine().options().drc_log_native()) { - astring filename = astring("drcbex86_").cat(device.shortname()).cat(".asm"); + std::string filename = std::string("drcbex86_").append(device.shortname()).append(".asm"); m_log = x86log_create_context(filename.c_str()); } } @@ -770,7 +770,7 @@ void drcbe_x86::generate(drcuml_block &block, const instruction *instlist, UINT3 x86code *dst = base; // generate code - astring tempstring; + std::string tempstring; const char *blockname = NULL; for (int inum = 0; inum < numinst; inum++) { @@ -780,7 +780,7 @@ void drcbe_x86::generate(drcuml_block &block, const instruction *instlist, UINT3 // add a comment if (m_log != NULL) { - astring dasm; + std::string dasm; inst.disasm(dasm, &m_drcuml); x86log_add_comment(m_log, dst, "%s", dasm.c_str()); } @@ -791,7 +791,7 @@ void drcbe_x86::generate(drcuml_block &block, const instruction *instlist, UINT3 if (inst.opcode() == OP_HANDLE) blockname = inst.param(0).handle().string(); else if (inst.opcode() == OP_HASH) - blockname = tempstring.format("Code: mode=%d PC=%08X", (UINT32)inst.param(0).immediate(), (offs_t)inst.param(1).immediate()).c_str(); + blockname = strformat(tempstring, "Code: mode=%d PC=%08X", (UINT32)inst.param(0).immediate(), (offs_t)inst.param(1).immediate()).c_str(); } // generate code diff --git a/src/emu/cpu/drcuml.c b/src/emu/cpu/drcuml.c index 6d698e265b3..b7e3c3e0045 100644 --- a/src/emu/cpu/drcuml.c +++ b/src/emu/cpu/drcuml.c @@ -129,7 +129,7 @@ drcuml_state::drcuml_state(device_t &device, drc_cache &cache, UINT32 flags, int // if we're to log, create the logfile if (device.machine().options().drc_log_uml()) { - astring filename = astring("drcuml_").cat(m_device.shortname()).cat(".asm"); + std::string filename = std::string("drcuml_").append(m_device.shortname()).append(".asm"); m_umllog = fopen(filename.c_str(), "w"); } } @@ -386,14 +386,14 @@ uml::instruction &drcuml_block::append() void drcuml_block::append_comment(const char *format, ...) { // do the printf - astring temp; + std::string temp; va_list va; va_start(va, format); - temp.vprintf(format, va); + strvprintf(temp,format, va); va_end(va); // allocate space in the cache to hold the comment - char *comment = (char *)m_drcuml.cache().alloc_temporary(temp.len() + 1); + char *comment = (char *)m_drcuml.cache().alloc_temporary(temp.length() + 1); if (comment == NULL) return; strcpy(comment, temp.c_str()); @@ -457,8 +457,8 @@ void drcuml_block::optimize() void drcuml_block::disassemble() { - astring comment; - astring dasm; + std::string comment; + std::string dasm; // iterate over instructions and output int firstcomment = -1; @@ -520,15 +520,17 @@ void drcuml_block::disassemble() // associated with a comment or mapvar //------------------------------------------------- -const char *drcuml_block::get_comment_text(const instruction &inst, astring &comment) +const char *drcuml_block::get_comment_text(const instruction &inst, std::string &comment) { // comments return their strings if (inst.opcode() == OP_COMMENT) - return comment.cpy(inst.param(0).string()).c_str(); + return comment.assign(inst.param(0).string()).c_str(); // mapvars comment about their values - else if (inst.opcode() == OP_MAPVAR) - return comment.format("m%d = $%X", (int)inst.param(0).mapvar() - MAPVAR_M0, (UINT32)inst.param(1).immediate()).c_str(); + else if (inst.opcode() == OP_MAPVAR) { + strprintf(comment,"m%d = $%X", (int)inst.param(0).mapvar() - MAPVAR_M0, (UINT32)inst.param(1).immediate()); + return comment.c_str(); + } // everything else is NULL return NULL; diff --git a/src/emu/cpu/drcuml.h b/src/emu/cpu/drcuml.h index 98074e2424f..10652a224cc 100644 --- a/src/emu/cpu/drcuml.h +++ b/src/emu/cpu/drcuml.h @@ -121,7 +121,7 @@ private: // internal helpers void optimize(); void disassemble(); - const char *get_comment_text(const uml::instruction &inst, astring &comment); + const char *get_comment_text(const uml::instruction &inst, std::string &comment); // internal state drcuml_state & m_drcuml; // pointer back to the owning UML @@ -220,7 +220,7 @@ private: symbol * m_next; // link to the next symbol drccodeptr m_base; // base of the symbol UINT32 m_length; // length of the region covered - astring m_name; // name of the symbol + std::string m_name; // name of the symbol }; // internal state diff --git a/src/emu/cpu/dsp16/dsp16.c b/src/emu/cpu/dsp16/dsp16.c index 9520c125784..42913c5361d 100644 --- a/src/emu/cpu/dsp16/dsp16.c +++ b/src/emu/cpu/dsp16/dsp16.c @@ -212,26 +212,26 @@ const address_space_config *dsp16_device::memory_space_config(address_spacenum s // for the debugger //------------------------------------------------- -void dsp16_device::state_string_export(const device_state_entry &entry, astring &str) +void dsp16_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("(below)"); + strprintf(str, "(below)"); break; case DSP16_AUC: { - astring alignString; + std::string alignString; const UINT8 align = m_auc & 0x03; switch (align) { - case 0x00: alignString.printf("xy"); break; - case 0x01: alignString.printf("/4"); break; - case 0x02: alignString.printf("x4"); break; - case 0x03: alignString.printf(",,"); break; + case 0x00: strprintf(alignString,"xy"); break; + case 0x01: strprintf(alignString,"/4"); break; + case 0x02: strprintf(alignString,"x4"); break; + case 0x03: strprintf(alignString,",,"); break; } - str.printf("%c%c%c%c%c%s", + strprintf(str, "%c%c%c%c%c%s", m_auc & 0x40 ? 'Y':'.', m_auc & 0x20 ? '1':'.', m_auc & 0x10 ? '0':'.', @@ -242,7 +242,7 @@ void dsp16_device::state_string_export(const device_state_entry &entry, astring } case DSP16_PSW: - str.printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", m_psw & 0x8000 ? 'M':'.', m_psw & 0x4000 ? 'E':'.', m_psw & 0x2000 ? 'L':'.', @@ -263,16 +263,16 @@ void dsp16_device::state_string_export(const device_state_entry &entry, astring case DSP16_PIOC: { - astring strobeString; + std::string strobeString; const UINT8 strobe = (m_pioc & 0x6000) >> 13; switch (strobe) { - case 0x00: strobeString.printf("1T"); break; - case 0x01: strobeString.printf("2T"); break; - case 0x02: strobeString.printf("3T"); break; - case 0x03: strobeString.printf("4T"); break; + case 0x00: strprintf(strobeString, "1T"); break; + case 0x01: strprintf(strobeString, "2T"); break; + case 0x02: strprintf(strobeString, "3T"); break; + case 0x03: strprintf(strobeString, "4T"); break; } - str.printf("%c%s%c%c%c%c%c%c%c%c%c%c%c%c%c", + strprintf(str, "%c%s%c%c%c%c%c%c%c%c%c%c%c%c%c", m_pioc & 0x8000 ? 'I':'.', strobeString.c_str(), m_pioc & 0x1000 ? 'O':'I', @@ -294,16 +294,16 @@ void dsp16_device::state_string_export(const device_state_entry &entry, astring // Placeholder for a better view later (TODO) case DSP16_SIOC: { - astring clkString; + std::string clkString; const UINT8 clk = (m_sioc & 0x0180) >> 7; switch (clk) { - case 0x00: clkString.printf("/4"); break; - case 0x01: clkString.printf("12"); break; - case 0x02: clkString.printf("16"); break; - case 0x03: clkString.printf("20"); break; + case 0x00: strprintf(clkString, "/4"); break; + case 0x01: strprintf(clkString, "12"); break; + case 0x02: strprintf(clkString, "16"); break; + case 0x03: strprintf(clkString, "20"); break; } - str.printf("%c%s%c%c%c%c%c%c%c", + strprintf(str, "%c%s%c%c%c%c%c%c%c", m_sioc & 0x0200 ? 'I':'O', clkString.c_str(), m_sioc & 0x0040 ? 'L':'M', diff --git a/src/emu/cpu/dsp16/dsp16.h b/src/emu/cpu/dsp16/dsp16.h index 56f800f9d4c..4d093ef010e 100644 --- a/src/emu/cpu/dsp16/dsp16.h +++ b/src/emu/cpu/dsp16/dsp16.h @@ -44,7 +44,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const; diff --git a/src/emu/cpu/dsp16/dsp16dis.c b/src/emu/cpu/dsp16/dsp16dis.c index 7db21ec7bf6..2aed7e0f0b8 100644 --- a/src/emu/cpu/dsp16/dsp16dis.c +++ b/src/emu/cpu/dsp16/dsp16dis.c @@ -1,34 +1,34 @@ #include "emu.h" #include "dsp16.h" -astring disasmF1Field(const UINT8& F1, const UINT8& D, const UINT8& S) +std::string disasmF1Field(const UINT8& F1, const UINT8& D, const UINT8& S) { - astring ret = ""; + std::string ret = ""; switch (F1) { - case 0x00: ret.printf("a%d = p, p = x*y", D); break; - case 0x01: ret.printf("a%d = a%d + p, p = x*y", D, S); break; - case 0x02: ret.printf("p = x*y"); break; - case 0x03: ret.printf("a%d = a%d - p, p = x*y", D, S); break; - case 0x04: ret.printf("a%d = p", D); break; - case 0x05: ret.printf("a%d = a%d + p", D, S); break; - case 0x06: ret.printf("NOP"); break; - case 0x07: ret.printf("a%d = a%d - p", D, S); break; - case 0x08: ret.printf("a%d = a%d | y", D, S); break; - case 0x09: ret.printf("a%d = a%d ^ y", D, S); break; - case 0x0a: ret.printf("a%d & y", S); break; - case 0x0b: ret.printf("a%d - y", S); break; - case 0x0c: ret.printf("a%d = y", D); break; - case 0x0d: ret.printf("a%d = a%d + y", D, S); break; - case 0x0e: ret.printf("a%d = a%d & y", D, S); break; - case 0x0f: ret.printf("a%d = a%d - y", D, S); break; + case 0x00: strprintf(ret, "a%d = p, p = x*y", D); break; + case 0x01: strprintf(ret, "a%d = a%d + p, p = x*y", D, S); break; + case 0x02: strprintf(ret, "p = x*y"); break; + case 0x03: strprintf(ret, "a%d = a%d - p, p = x*y", D, S); break; + case 0x04: strprintf(ret, "a%d = p", D); break; + case 0x05: strprintf(ret, "a%d = a%d + p", D, S); break; + case 0x06: strprintf(ret, "NOP"); break; + case 0x07: strprintf(ret, "a%d = a%d - p", D, S); break; + case 0x08: strprintf(ret, "a%d = a%d | y", D, S); break; + case 0x09: strprintf(ret, "a%d = a%d ^ y", D, S); break; + case 0x0a: strprintf(ret, "a%d & y", S); break; + case 0x0b: strprintf(ret, "a%d - y", S); break; + case 0x0c: strprintf(ret, "a%d = y", D); break; + case 0x0d: strprintf(ret, "a%d = a%d + y", D, S); break; + case 0x0e: strprintf(ret, "a%d = a%d & y", D, S); break; + case 0x0f: strprintf(ret, "a%d = a%d - y", D, S); break; default: return "UNKNOWN"; } return ret; } -astring disasmYField(const UINT8& Y) +std::string disasmYField(const UINT8& Y) { switch (Y) { @@ -58,7 +58,7 @@ astring disasmYField(const UINT8& Y) //return ""; } -astring disasmZField(const UINT8& Z) +std::string disasmZField(const UINT8& Z) { switch (Z) { @@ -88,35 +88,35 @@ astring disasmZField(const UINT8& Z) //return ""; } -astring disasmF2Field(const UINT8& F2, const UINT8& D, const UINT8& S) +std::string disasmF2Field(const UINT8& F2, const UINT8& D, const UINT8& S) { - astring ret = ""; + std::string ret = ""; switch (F2) { - case 0x00: ret.printf("a%d = a%d >> 1", D, S); break; - case 0x01: ret.printf("a%d = a%d << 1", D, S); break; - case 0x02: ret.printf("a%d = a%d >> 4", D, S); break; - case 0x03: ret.printf("a%d = a%d << 4", D, S); break; - case 0x04: ret.printf("a%d = a%d >> 8", D, S); break; - case 0x05: ret.printf("a%d = a%d << 8", D, S); break; - case 0x06: ret.printf("a%d = a%d >> 16", D, S); break; - case 0x07: ret.printf("a%d = a%d << 16", D, S); break; - - case 0x08: ret.printf("a%d = p", D); break; - case 0x09: ret.printf("a%dh = a%dh + 1", D, S); break; - case 0x0a: ret.printf("RESERVED"); break; - case 0x0b: ret.printf("a%d = rnd(a%d)", D, S); break; - case 0x0c: ret.printf("a%d = y", D); break; - case 0x0d: ret.printf("a%d = a%d + 1", D, S); break; - case 0x0e: ret.printf("a%d = a%d", D, S); break; - case 0x0f: ret.printf("a%d = -a%d", D, S); break; + case 0x00: strprintf(ret, "a%d = a%d >> 1", D, S); break; + case 0x01: strprintf(ret, "a%d = a%d << 1", D, S); break; + case 0x02: strprintf(ret, "a%d = a%d >> 4", D, S); break; + case 0x03: strprintf(ret, "a%d = a%d << 4", D, S); break; + case 0x04: strprintf(ret, "a%d = a%d >> 8", D, S); break; + case 0x05: strprintf(ret, "a%d = a%d << 8", D, S); break; + case 0x06: strprintf(ret, "a%d = a%d >> 16", D, S); break; + case 0x07: strprintf(ret, "a%d = a%d << 16", D, S); break; + + case 0x08: strprintf(ret, "a%d = p", D); break; + case 0x09: strprintf(ret, "a%dh = a%dh + 1", D, S); break; + case 0x0a: strprintf(ret, "RESERVED"); break; + case 0x0b: strprintf(ret, "a%d = rnd(a%d)", D, S); break; + case 0x0c: strprintf(ret, "a%d = y", D); break; + case 0x0d: strprintf(ret, "a%d = a%d + 1", D, S); break; + case 0x0e: strprintf(ret, "a%d = a%d", D, S); break; + case 0x0f: strprintf(ret, "a%d = -a%d", D, S); break; default: return "UNKNOWN"; } return ret; } -astring disasmCONField(const UINT8& CON) +std::string disasmCONField(const UINT8& CON) { switch (CON) { @@ -145,7 +145,7 @@ astring disasmCONField(const UINT8& CON) //return ""; } -astring disasmBField(const UINT8& B) +std::string disasmBField(const UINT8& B) { switch (B) { @@ -164,7 +164,7 @@ astring disasmBField(const UINT8& B) //return ""; } -astring disasmRImmediateField(const UINT8& R) +std::string disasmRImmediateField(const UINT8& R) { switch (R) { @@ -183,7 +183,7 @@ astring disasmRImmediateField(const UINT8& R) //return ""; } -astring disasmRField(const UINT8& R) +std::string disasmRField(const UINT8& R) { switch (R) { @@ -222,7 +222,7 @@ astring disasmRField(const UINT8& R) //return ""; } -astring disasmIField(const UINT8& I) +std::string disasmIField(const UINT8& I) { switch (I) { @@ -268,8 +268,8 @@ CPU_DISASSEMBLE( dsp16a ) const UINT8 S = (op & 0x0200) >> 9; const UINT8 D = (op & 0x0400) >> 10; const UINT8 F1 = (op & 0x01e0) >> 5; - astring yString = disasmYField(Y); - astring fString = disasmF1Field(F1, D, S); + std::string yString = disasmYField(Y); + std::string fString = disasmF1Field(F1, D, S); sprintf(buffer, "%s, %s", fString.c_str(), yString.c_str()); break; } @@ -281,10 +281,10 @@ CPU_DISASSEMBLE( dsp16a ) const UINT8 S = (op & 0x0200) >> 9; const UINT8 D = (op & 0x0400) >> 10; const UINT8 F1 = (op & 0x01e0) >> 5; - astring yString = disasmYField(Y); - astring fString = disasmF1Field(F1, D, S); - astring aString = (opcode == 0x1c) ? "a0" : "a1"; - astring xString = (X) ? "" : "l"; + std::string yString = disasmYField(Y); + std::string fString = disasmF1Field(F1, D, S); + std::string aString = (opcode == 0x1c) ? "a0" : "a1"; + std::string xString = (X) ? "" : "l"; sprintf(buffer, "%s = %s%s, %s", yString.c_str(), aString.c_str(), xString.c_str(), fString.c_str()); break; } @@ -295,8 +295,8 @@ CPU_DISASSEMBLE( dsp16a ) const UINT8 S = (op & 0x0200) >> 9; const UINT8 D = (op & 0x0400) >> 10; const UINT8 F1 = (op & 0x01e0) >> 5; - astring yString = disasmYField(Y); - astring fString = disasmF1Field(F1, D, S); + std::string yString = disasmYField(Y); + std::string fString = disasmF1Field(F1, D, S); sprintf(buffer, "%s, x = %s", fString.c_str(), yString.c_str()); break; } @@ -308,9 +308,9 @@ CPU_DISASSEMBLE( dsp16a ) const UINT8 S = (op & 0x0200) >> 9; const UINT8 D = (op & 0x0400) >> 10; const UINT8 F1 = (op & 0x01e0) >> 5; - astring yString = disasmYField(Y); - astring fString = disasmF1Field(F1, D, S); - astring xString = (X ? "y" : "y1"); + std::string yString = disasmYField(Y); + std::string fString = disasmF1Field(F1, D, S); + std::string xString = (X ? "y" : "y1"); sprintf(buffer, "%s, %s = %s", fString.c_str(), xString.c_str(), yString.c_str()); break; } @@ -322,9 +322,9 @@ CPU_DISASSEMBLE( dsp16a ) const UINT8 S = (op & 0x0200) >> 9; const UINT8 D = (op & 0x0400) >> 10; const UINT8 F1 = (op & 0x01e0) >> 5; - astring yString = disasmYField(Y); - astring fString = disasmF1Field(F1, D, S); - astring xString = (X ? "*pt++i" : "*pt++"); + std::string yString = disasmYField(Y); + std::string fString = disasmF1Field(F1, D, S); + std::string xString = (X ? "*pt++i" : "*pt++"); sprintf(buffer, "%s, y = %s, x = %s", fString.c_str(), yString.c_str(), xString.c_str()); break; } @@ -336,9 +336,9 @@ CPU_DISASSEMBLE( dsp16a ) const UINT8 S = (op & 0x0200) >> 9; const UINT8 D = (op & 0x0400) >> 10; const UINT8 F1 = (op & 0x01e0) >> 5; - astring fString = disasmF1Field(F1, D, S); - astring xString = (X ? "*pt++i" : "*pt++"); - astring aString = (opcode == 0x19) ? "a0" : "a1"; + std::string fString = disasmF1Field(F1, D, S); + std::string xString = (X ? "*pt++i" : "*pt++"); + std::string aString = (opcode == 0x19) ? "a0" : "a1"; sprintf(buffer, "%s, y = %s, x = %s", fString.c_str(), aString.c_str(), xString.c_str()); if (Y != 0x00) sprintf(buffer, "UNKNOWN"); break; @@ -351,9 +351,9 @@ CPU_DISASSEMBLE( dsp16a ) const UINT8 S = (op & 0x0200) >> 9; const UINT8 D = (op & 0x0400) >> 10; const UINT8 F1 = (op & 0x01e0) >> 5; - astring yString = disasmYField(Y); - astring xString = (X ? "y" : "y1"); - astring fString = disasmF1Field(F1, D, S); + std::string yString = disasmYField(Y); + std::string xString = (X ? "y" : "y1"); + std::string fString = disasmF1Field(F1, D, S); sprintf(buffer, "%s, %s = %s", fString.c_str(), yString.c_str(), xString.c_str()); break; } @@ -366,9 +366,9 @@ CPU_DISASSEMBLE( dsp16a ) const UINT8 S = (op & 0x0200) >> 9; const UINT8 aT = (op & 0x0400) >> 10; const UINT8 F1 = (op & 0x01e0) >> 5; - astring yString = disasmYField(Y); - astring atString = (aT ? "a0" : "a1"); - astring fString = disasmF1Field(F1, aT, S); + std::string yString = disasmYField(Y); + std::string atString = (aT ? "a0" : "a1"); + std::string fString = disasmF1Field(F1, aT, S); sprintf(buffer, "%s, %s = %s", fString.c_str(), atString.c_str(), yString.c_str()); break; } @@ -382,9 +382,9 @@ CPU_DISASSEMBLE( dsp16a ) const UINT8 S = (op & 0x0200) >> 9; const UINT8 D = (op & 0x0400) >> 10; const UINT8 F1 = (op & 0x01e0) >> 5; - astring zString = disasmZField(Z); - astring xString = (X ? "y" : "y1"); - astring fString = disasmF1Field(F1, D, S); + std::string zString = disasmZField(Z); + std::string xString = (X ? "y" : "y1"); + std::string fString = disasmF1Field(F1, D, S); sprintf(buffer, "%s, %s <=> %s", fString.c_str(), xString.c_str(), zString.c_str()); break; } @@ -396,9 +396,9 @@ CPU_DISASSEMBLE( dsp16a ) const UINT8 S = (op & 0x0200) >> 9; const UINT8 D = (op & 0x0400) >> 10; const UINT8 F1 = (op & 0x01e0) >> 5; - astring zString = disasmZField(Z); - astring xString = (X ? "*pt++i" : "*pt++"); - astring fString = disasmF1Field(F1, D, S); + std::string zString = disasmZField(Z); + std::string xString = (X ? "*pt++i" : "*pt++"); + std::string fString = disasmF1Field(F1, D, S); sprintf(buffer, "%s, %s <=> y, x = %s", fString.c_str(), zString.c_str(), xString.c_str()); break; } @@ -412,10 +412,10 @@ CPU_DISASSEMBLE( dsp16a ) const UINT8 S = (op & 0x0200) >> 9; const UINT8 aT = (op & 0x0400) >> 10; const UINT8 F1 = (op & 0x01e0) >> 5; - astring zString = disasmZField(Z); - astring atString = (aT ? "a0" : "a1"); + std::string zString = disasmZField(Z); + std::string atString = (aT ? "a0" : "a1"); atString += X ? "" : "1"; // TODO: Figure out unclear wording. - astring fString = disasmF1Field(F1, aT, S); + std::string fString = disasmF1Field(F1, aT, S); sprintf(buffer, "%s, %s <=> %s", fString.c_str(), zString.c_str(), atString.c_str()); break; } @@ -429,8 +429,8 @@ CPU_DISASSEMBLE( dsp16a ) const UINT8 S = (op & 0x0200) >> 9; const UINT8 D = (op & 0x0400) >> 10; const UINT8 F2 = (op & 0x01e0) >> 5; - astring fString = disasmF2Field(F2, D, S); - astring conString = disasmCONField(CON); + std::string fString = disasmF2Field(F2, D, S); + std::string conString = disasmCONField(CON); if (op & 0x0800) sprintf(buffer, "if %s : %s", conString.c_str(), fString.c_str()); else sprintf(buffer, "ifc %s : %s", conString.c_str(), fString.c_str()); break; @@ -457,7 +457,7 @@ CPU_DISASSEMBLE( dsp16a ) { // goto B const UINT8 B = (op & 0x0700) >> 8; - astring bString = disasmBField(B); + std::string bString = disasmBField(B); sprintf(buffer, "%s", bString.c_str()); break; } @@ -467,7 +467,7 @@ CPU_DISASSEMBLE( dsp16a ) { // if CON [goto/call/return] const UINT8 CON = (op & 0x001f); - astring conString = disasmCONField(CON); + std::string conString = disasmCONField(CON); sprintf(buffer, "if %s:", conString.c_str()); // TODO: Test for invalid ops // icall @@ -481,7 +481,7 @@ CPU_DISASSEMBLE( dsp16a ) // R = aS const UINT8 R = (op & 0x03f0) >> 4; const UINT8 S = (op & 0x1000) >> 12; - astring rString = disasmRField(R); + std::string rString = disasmRField(R); sprintf(buffer, "%s = %s", rString.c_str(), (S ? "a1" : "a0")); break; } @@ -490,7 +490,7 @@ CPU_DISASSEMBLE( dsp16a ) // aT = R const UINT8 R = (op & 0x03f0) >> 4; const UINT8 aT = (op & 0x0400) >> 10; - astring rString = disasmRField(R); + std::string rString = disasmRField(R); sprintf(buffer, "%s = %s", (aT ? "a0" : "a1"), rString.c_str()); break; } @@ -499,8 +499,8 @@ CPU_DISASSEMBLE( dsp16a ) // R = Y const UINT8 Y = (op & 0x000f); const UINT8 R = (op & 0x03f0) >> 4; - astring yString = disasmYField(Y); - astring rString = disasmRField(R); + std::string yString = disasmYField(Y); + std::string rString = disasmRField(R); sprintf(buffer, "%s = %s", rString.c_str(), yString.c_str()); // TODO: Special case the R == [y, y1, or x] case break; @@ -510,8 +510,8 @@ CPU_DISASSEMBLE( dsp16a ) // Y = R const UINT8 Y = (op & 0x000f); const UINT8 R = (op & 0x03f0) >> 4; - astring yString = disasmYField(Y); - astring rString = disasmRField(R); + std::string yString = disasmYField(Y); + std::string rString = disasmRField(R); // TODO: page 3-31 "special function encoding" sprintf(buffer, "%s = %s", yString.c_str(), rString.c_str()); break; @@ -521,8 +521,8 @@ CPU_DISASSEMBLE( dsp16a ) // Z : R const UINT8 Z = (op & 0x000f); const UINT8 R = (op & 0x03f0) >> 4; - astring zString = disasmZField(Z); - astring rString = disasmRField(R); + std::string zString = disasmZField(Z); + std::string rString = disasmRField(R); sprintf(buffer, "%s <=> %s", zString.c_str(), rString.c_str()); break; } @@ -532,7 +532,7 @@ CPU_DISASSEMBLE( dsp16a ) { // R = N const UINT8 R = (op & 0x03f0) >> 4; - astring rString = disasmRField(R); + std::string rString = disasmRField(R); sprintf(buffer, "%s = 0x%04x", rString.c_str(), op2); opSize = 2; break; @@ -544,7 +544,7 @@ CPU_DISASSEMBLE( dsp16a ) // R = M const UINT16 M = (op & 0x01ff); const UINT8 R = (op & 0x0e00) >> 9; - astring rString = disasmRImmediateField(R); + std::string rString = disasmRImmediateField(R); sprintf(buffer, "%s = 0x%04x", rString.c_str(), M); break; } diff --git a/src/emu/cpu/dsp32/dsp32.c b/src/emu/cpu/dsp32/dsp32.c index b41c9031c06..2de5e6f50d6 100644 --- a/src/emu/cpu/dsp32/dsp32.c +++ b/src/emu/cpu/dsp32/dsp32.c @@ -194,14 +194,14 @@ void dsp32c_device::device_start() m_direct = &m_program->direct(); // register our state for the debugger - astring tempstr; + std::string tempstr; state_add(STATE_GENPC, "GENPC", m_r[15]).noshow(); state_add(STATE_GENPCBASE, "GENPCBASE", m_ppc).noshow(); state_add(STATE_GENSP, "GENSP", m_r[21]).noshow(); state_add(STATE_GENFLAGS, "GENFLAGS", m_iotemp).callimport().callexport().formatstr("%6s").noshow(); state_add(DSP32_PC, "PC", m_r[15]).mask(0xffffff); for (int regnum = 0; regnum <= 14; regnum++) - state_add(DSP32_R0 + regnum, tempstr.format("R%d", regnum).c_str(), m_r[regnum]).mask(0xffffff); + state_add(DSP32_R0 + regnum, strformat(tempstr, "R%d", regnum).c_str(), m_r[regnum]).mask(0xffffff); state_add(DSP32_R15, "R15", m_r[17]).mask(0xffffff); state_add(DSP32_R16, "R16", m_r[18]).mask(0xffffff); state_add(DSP32_R17, "R17", m_r[19]).mask(0xffffff); @@ -369,12 +369,12 @@ void dsp32c_device::state_export(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void dsp32c_device::state_string_export(const device_state_entry &entry, astring &str) +void dsp32c_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", NFLAG ? 'N':'.', ZFLAG ? 'Z':'.', UFLAG ? 'U':'.', @@ -389,7 +389,7 @@ void dsp32c_device::state_string_export(const device_state_entry &entry, astring case DSP32_A1: case DSP32_A2: case DSP32_A3: - str.printf("%8g", *(double *)entry.dataptr()); + strprintf(str, "%8g", *(double *)entry.dataptr()); break; } } diff --git a/src/emu/cpu/dsp32/dsp32.h b/src/emu/cpu/dsp32/dsp32.h index 643eef126b3..1ef1642f6c2 100644 --- a/src/emu/cpu/dsp32/dsp32.h +++ b/src/emu/cpu/dsp32/dsp32.h @@ -123,7 +123,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const; diff --git a/src/emu/cpu/dsp56k/dsp56k.c b/src/emu/cpu/dsp56k/dsp56k.c index bcdb2c85d32..2a5e94e135c 100644 --- a/src/emu/cpu/dsp56k/dsp56k.c +++ b/src/emu/cpu/dsp56k/dsp56k.c @@ -357,14 +357,14 @@ void dsp56k_device::device_start() } -void dsp56k_device::state_string_export(const device_state_entry &entry, astring &str) +void dsp56k_device::state_string_export(const device_state_entry &entry, std::string &str) { dsp56k_core *cpustate = &m_dsp56k_core; switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%s%s %s%s%s%s%s%s%s%s %s%s", + strprintf(str, "%s%s %s%s%s%s%s%s%s%s %s%s", /* Status Register */ LF_bit(cpustate) ? "L" : ".", FV_bit(cpustate) ? "F" : ".", @@ -384,19 +384,19 @@ void dsp56k_device::state_string_export(const device_state_entry &entry, astring break; case DSP56K_X: - str.printf("%04x %04x", X1, X0); + strprintf(str, "%04x %04x", X1, X0); break; case DSP56K_Y: - str.printf("%04x %04x", Y1, Y0); + strprintf(str, "%04x %04x", Y1, Y0); break; case DSP56K_A: - str.printf("%02x %04x %04x", A2, A1, A0); + strprintf(str, "%02x %04x %04x", A2, A1, A0); break; case DSP56K_B: - str.printf("%02x %04x %04x", B2, B1, B0); + strprintf(str, "%02x %04x %04x", B2, B1, B0); break; } } diff --git a/src/emu/cpu/dsp56k/dsp56k.h b/src/emu/cpu/dsp56k/dsp56k.h index cc2ea2b059f..c2fd831515d 100644 --- a/src/emu/cpu/dsp56k/dsp56k.h +++ b/src/emu/cpu/dsp56k/dsp56k.h @@ -232,7 +232,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ((spacenum == AS_DATA) ? &m_data_config : NULL ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 2; } diff --git a/src/emu/cpu/dsp56k/inst.h b/src/emu/cpu/dsp56k/inst.h index b4b5c3e1688..fb9c55f89ad 100644 --- a/src/emu/cpu/dsp56k/inst.h +++ b/src/emu/cpu/dsp56k/inst.h @@ -29,7 +29,7 @@ public: virtual ~Instruction() {} virtual bool decode(const UINT16 word0, const UINT16 word1) = 0; - virtual void disassemble(astring& retString) const = 0; + virtual void disassemble(std::string& retString) const = 0; virtual void evaluate(dsp56k_core* cpustate) = 0; virtual size_t size() const = 0; @@ -77,7 +77,7 @@ public: decode_F_table(BITSn(word0,0x08), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "abs " + regIdAsString(m_destination); } @@ -100,7 +100,7 @@ public: m_source, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "adc " + regIdAsString(m_source) + "," + regIdAsString(m_destination); } @@ -123,7 +123,7 @@ public: m_source, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "add " + regIdAsString(m_source) + "," + regIdAsString(m_destination); } @@ -150,7 +150,7 @@ public: // TODO: m_opcode = "add"; return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination); } @@ -159,8 +159,8 @@ public: size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } private: - astring m_opcode; - astring m_arg; // TODO: get rid of this Add|Sub thing. + std::string m_opcode; + std::string m_arg; // TODO: get rid of this Add|Sub thing. }; // AND : .... .... 0110 F1JJ : A-24 //////////////////////////////////////////// @@ -177,7 +177,7 @@ public: m_source, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "and " + regIdAsString(m_source) + "," + regIdAsString(m_destination); } @@ -201,11 +201,11 @@ public: decode_EE_table(BITSn(word0,0x0600), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { char temp[32]; sprintf(temp, "#$%x,%s", m_immediate, regIdAsString(m_destination).c_str()); - retString = "andi " + astring(temp); + retString = "andi " + std::string(temp); // NEW // sprintf(opcode_str, "and(i)"); } void evaluate(dsp56k_core* cpustate) {} @@ -229,7 +229,7 @@ public: decode_F_table(BITSn(word0,0x08), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "asl " + regIdAsString(m_destination); } @@ -251,7 +251,7 @@ public: decode_F_table(BITSn(word0,0x0008), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "asl4 " + regIdAsString(m_destination); } @@ -273,7 +273,7 @@ public: decode_F_table(BITSn(word0,0x08), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "asr " + regIdAsString(m_destination); } @@ -295,7 +295,7 @@ public: decode_F_table(BITSn(word0,0x0008), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "asr4 " + regIdAsString(m_destination); } @@ -317,7 +317,7 @@ public: decode_F_table(BITSn(word0,0x0008), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "asr16 " + regIdAsString(m_destination); } @@ -358,7 +358,7 @@ public: assemble_D_from_P_table(BITSn(word0,0x0020), BITSn(word0,0x001f), dString); - if (dString.cmp("!!")==0) + if (dString.compare("!!") == 0) return false; switch(BITSn(word1,0x1f00)) @@ -371,11 +371,11 @@ public: } return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { char temp[32]; sprintf(temp, "#$%x", m_iVal); - retString = m_opcode + " " + astring(temp) + "," + dString; + retString = m_opcode + " " + std::string(temp) + "," + dString; // NEW // sprintf(temp, "#$%04x", iVal); } void evaluate(dsp56k_core* cpustate) {} @@ -383,8 +383,8 @@ public: size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } private: UINT16 m_iVal; - astring m_opcode; - astring dString; + std::string m_opcode; + std::string dString; }; /* BFCHG : 0001 0100 101- --RR BBB1 0010 iiii iiii : A-38 */ @@ -432,14 +432,14 @@ public: } return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { char temp[32]; sprintf(temp, "#$%x", m_iVal); - astring source = temp; + std::string source = temp; sprintf(temp, "X:(%s)", regIdAsString(m_r).c_str()); - astring destination = temp; + std::string destination = temp; retString = m_opcode + " " + source + "," + destination; // NEW // sprintf(temp, "#$%04x", m_iVal); @@ -451,7 +451,7 @@ public: private: reg_id m_r; UINT16 m_iVal; - astring m_opcode; + std::string m_opcode; }; /* BFCHG : 0001 0100 100D DDDD BBB1 0010 iiii iiii : A-38 */ @@ -498,11 +498,11 @@ public: } return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { char temp[32]; sprintf(temp, "#$%x", m_iVal); - astring source = temp; + std::string source = temp; retString = m_opcode + " " + source + "," + regIdAsString(m_destination); // NEW // sprintf(temp, "#$%04x", m_iVal); @@ -513,7 +513,7 @@ public: private: UINT16 m_iVal; - astring m_opcode; + std::string m_opcode; }; // Bcc : 0000 0111 --11 cccc xxxx xxxx xxxx xxxx : A-48 //////////////////////// @@ -532,15 +532,15 @@ public: decode_cccc_table(BITSn(word0,0x000f), m_mnem); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring opcode = "b" + opMnemonicAsString(m_mnem); + std::string opcode = "b" + opMnemonicAsString(m_mnem); // NEW // sprintf(opcode_str, "b.%s", M); char temp[32]; sprintf(temp, ">*+$%x", 2 + m_immediate); // NEW // sprintf(temp, "$%04x (%d)", pc + 2 + (INT16)word1, (INT16)word1); - retString = opcode + " " + astring(temp); + retString = opcode + " " + std::string(temp); } void evaluate(dsp56k_core* cpustate) {} size_t size() const { return 2; } @@ -567,9 +567,9 @@ public: m_immediate = get_6_bit_signed_value(BITSn(word0,0x003f)); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring opcode = "b" + opMnemonicAsString(m_mnem); + std::string opcode = "b" + opMnemonicAsString(m_mnem); // NEW // sprintf(opcode_str, "b.%s", M); char temp[32]; @@ -577,7 +577,7 @@ public: else sprintf(temp, "<*-$%x", 1 - m_immediate - 2); // NEW // sprintf(temp, "$%04x (%d)", pc + 1 + relativeInt, relativeInt); - retString = opcode + " " + astring(temp); + retString = opcode + " " + std::string(temp); } void evaluate(dsp56k_core* cpustate) {} size_t size() const { return 1; } @@ -603,9 +603,9 @@ public: decode_cccc_table(BITSn(word0,0x000f), m_mnem); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring opcode = "b" + opMnemonicAsString(m_mnem); + std::string opcode = "b" + opMnemonicAsString(m_mnem); retString = opcode + " " + regIdAsString(m_destination); // NEW // sprintf(opcode_str, "b.%s", M); } @@ -631,12 +631,12 @@ public: m_immediate = (INT16)word1; return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { char temp[32]; sprintf(temp, ">*+$%x", 2 + m_immediate); // NEW // sprintf(temp, "$%04x (%d)", pc + 2 + word1, (INT16)word1); - retString = "bra " + astring(temp); + retString = "bra " + std::string(temp); } void evaluate(dsp56k_core* cpustate) {} size_t size() const { return 2; } @@ -660,13 +660,13 @@ public: m_immediate = (INT8)BITSn(word0,0x00ff); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { char temp[32]; if (m_immediate >= 0) sprintf(temp, "<*+$%x", 1 + m_immediate); else sprintf(temp, "<*-$%x", 1 - m_immediate - 2); // NEW // sprintf(temp, "$%04x (%d)", pc + 1 + iVal, iVal); - retString = "bra " + astring(temp); + retString = "bra " + std::string(temp); } void evaluate(dsp56k_core* cpustate) {} size_t size() const { return 1; } @@ -689,7 +689,7 @@ public: decode_RR_table(BITSn(word0,0x0003), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "bra " + regIdAsString(m_destination); } @@ -712,9 +712,9 @@ public: decode_cccc_table(BITSn(word0,0x000f), m_mnem); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring opcode = "brk" + opMnemonicAsString(m_mnem); + std::string opcode = "brk" + opMnemonicAsString(m_mnem); retString = opcode; // NEW // sprintf(opcode_str, "brk.%s", M); } @@ -742,9 +742,9 @@ public: decode_cccc_table(BITSn(word0,0x000f), m_mnem); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring opcode = "bs" + opMnemonicAsString(m_mnem); + std::string opcode = "bs" + opMnemonicAsString(m_mnem); // NEW // sprintf(opcode_str, "bs.%s", M); char temp[32]; @@ -752,7 +752,7 @@ public: else sprintf(temp, ">*-$%x", 1 - m_immediate - 1 - 2); //sprintf(temp, ">*+$%x", 2 + m_immediate); // NEW // sprintf(temp, "$%04x (%d)", pc + 2 + (INT16)word1, (INT16)word1); - retString = opcode + " " + astring(temp); + retString = opcode + " " + std::string(temp); } void evaluate(dsp56k_core* cpustate) {} size_t size() const { return 2; } @@ -779,9 +779,9 @@ public: decode_cccc_table(BITSn(word0,0x000f), m_mnem); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring opcode = "bs" + opMnemonicAsString(m_mnem); + std::string opcode = "bs" + opMnemonicAsString(m_mnem); retString = opcode + " " + regIdAsString(m_destination); // NEW // sprintf(opcode_str, "bs.%s", M); } @@ -808,13 +808,13 @@ public: m_immediate = (INT16)word1; return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { char temp[32]; if (m_immediate >= 0) sprintf(temp, ">*+$%x", 2 + m_immediate); else sprintf(temp, ">*-$%x", 1 - m_immediate - 1 - 2); // NEW // sprintf(temp, "$%04x (%d)", pc + 2 + (INT16)word1, (INT16)word1); - retString = "bsr " + astring(temp); + retString = "bsr " + std::string(temp); } void evaluate(dsp56k_core* cpustate) {} size_t size() const { return 2; } @@ -838,7 +838,7 @@ public: decode_RR_table(BITSn(word0,0x0003), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "bsr " + regIdAsString(m_destination); } @@ -860,7 +860,7 @@ public: { return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "chkaau"; } @@ -882,7 +882,7 @@ public: decode_F_table(BITSn(word0,0x08), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "clr " + regIdAsString(m_destination); } @@ -904,7 +904,7 @@ public: decode_F_table(BITSn(word0,0x08), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "clr24 " + regIdAsString(m_destination); } @@ -929,7 +929,7 @@ public: m_source, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "cmp " + regIdAsString(m_source) + "," + regIdAsString(m_destination); } @@ -954,7 +954,7 @@ public: m_source, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "cmpm " + regIdAsString(m_source) + "," + regIdAsString(m_destination); } @@ -975,7 +975,7 @@ public: { return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "debug"; } @@ -998,9 +998,9 @@ public: decode_cccc_table(BITSn(word0,0x000f), m_mnem); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring opcode = "debug" + opMnemonicAsString(m_mnem); + std::string opcode = "debug" + opMnemonicAsString(m_mnem); retString = opcode; // NEW // sprintf(opcode_str, "debug.%s", M); } @@ -1025,7 +1025,7 @@ public: decode_F_table(BITSn(word0,0x08), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "dec " + regIdAsString(m_destination); } @@ -1047,7 +1047,7 @@ public: decode_F_table(BITSn(word0,0x08), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "dec24 " + regIdAsString(m_destination); } @@ -1070,7 +1070,7 @@ public: m_source, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "div " + regIdAsString(m_source) + "," + regIdAsString(m_destination); } @@ -1098,9 +1098,9 @@ public: if (m_mnem == oINVALID) return false; return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring opcode = "dmac" + opMnemonicAsString(m_mnem); + std::string opcode = "dmac" + opMnemonicAsString(m_mnem); retString = opcode + " " + regIdAsString(m_source) + "," + @@ -1131,15 +1131,15 @@ public: decode_RR_table(BITSn(word0,0x0003), m_source); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { char temp[32]; sprintf(temp, "*+$%x", 2 + m_immediate); - astring destination = temp; + std::string destination = temp; // NEW // sprintf(temp, "X:(R%d),$%02x", Rnum, pc + 2 + word1); sprintf(temp, "X:(%s)", regIdAsString(m_source).c_str()); - astring source = temp; + std::string source = temp; retString = "do " + source + "," + destination; } @@ -1167,12 +1167,12 @@ public: m_displacement = word1; return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { char temp[32]; sprintf(temp, "#<$%x,*+$%x", m_immediate, 2 + m_displacement); // NEW // sprintf(temp, "#$%02x,$%04x", BITSn(word0,0x00ff), pc + 2 + word1); - retString = "do " + astring(temp); + retString = "do " + std::string(temp); } void evaluate(dsp56k_core* cpustate) {} size_t size() const { return 2; } @@ -1201,12 +1201,12 @@ public: if (m_source == iINVALID) return false; return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { char temp[32]; sprintf(temp, "*+$%x", 2 + m_displacement); // NEW // sprintf(temp, "%s,$%04x", S1, pc + 2 + word1); - retString = "do " + regIdAsString(m_source) + "," + astring(temp); + retString = "do " + regIdAsString(m_source) + "," + std::string(temp); } void evaluate(dsp56k_core* cpustate) {} size_t size() const { return 2; } @@ -1230,13 +1230,13 @@ public: m_displacement = word1; return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { char temp[32]; sprintf(temp, "*+$%x", m_displacement + 2); // NEW // sprintf(temp, "*+$%x", pc + word1); // NEW // sprintf(temp, "$%04x", pc + 2 + word1); - retString = "do forever, " + astring(temp); + retString = "do forever, " + std::string(temp); } void evaluate(dsp56k_core* cpustate) {} size_t size() const { return 2; } @@ -1258,7 +1258,7 @@ public: { return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "enddo"; } @@ -1281,7 +1281,7 @@ public: m_source, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "eor " + regIdAsString(m_source) + "," + regIdAsString(m_destination); } @@ -1303,7 +1303,7 @@ public: decode_F_table(BITSn(word0,0x0008), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "ext " + regIdAsString(m_destination); } @@ -1324,7 +1324,7 @@ public: { return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "illegal"; } @@ -1348,7 +1348,7 @@ public: m_source, m_source2, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "imac " + regIdAsString(m_source) + "," + @@ -1377,7 +1377,7 @@ public: m_source, m_source2, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "impy " + regIdAsString(m_source) + "," + @@ -1404,7 +1404,7 @@ public: decode_F_table(BITSn(word0,0x08), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "inc " + regIdAsString(m_destination); } @@ -1426,7 +1426,7 @@ public: decode_F_table(BITSn(word0,0x08), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "inc24 " + regIdAsString(m_destination); } @@ -1451,15 +1451,15 @@ public: decode_cccc_table(BITSn(word0,0x000f), m_mnem); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring opcode = "j" + opMnemonicAsString(m_mnem); + std::string opcode = "j" + opMnemonicAsString(m_mnem); // NEW // sprintf(opcode_str, "j.%s", M); char temp[32]; sprintf(temp, ">$%x", m_displacement); // NEW // sprintf(temp, "$%04x", word1); - retString = opcode + " " + astring(temp); + retString = opcode + " " + std::string(temp); } void evaluate(dsp56k_core* cpustate) {} size_t size() const { return 2; } @@ -1485,9 +1485,9 @@ public: decode_cccc_table(BITSn(word0,0x000f), m_mnem); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring opcode = "j" + opMnemonicAsString(m_mnem); + std::string opcode = "j" + opMnemonicAsString(m_mnem); retString = opcode + " " + regIdAsString(m_destination); // NEW // sprintf(opcode_str, "j.%s", M); } @@ -1513,12 +1513,12 @@ public: m_displacement = word1; return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { char temp[32]; sprintf(temp, ">$%x", m_displacement); // NEW // sprintf(temp, "$%04x", word1); - retString = "jmp " + astring(temp); + retString = "jmp " + std::string(temp); } void evaluate(dsp56k_core* cpustate) { @@ -1549,7 +1549,7 @@ public: decode_RR_table(BITSn(word0,0x0003), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "jmp " + regIdAsString(m_destination); } @@ -1584,15 +1584,15 @@ public: decode_cccc_table(BITSn(word0,0x000f), m_mnem); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring opcode = "js" + opMnemonicAsString(m_mnem); + std::string opcode = "js" + opMnemonicAsString(m_mnem); // NEW // sprintf(opcode_str, "js.%s", M); char temp[32]; sprintf(temp, ">$%x", m_displacement); // NEW // sprintf(temp, "$%04x", word1); - retString = opcode + " " + astring(temp); + retString = opcode + " " + std::string(temp); } void evaluate(dsp56k_core* cpustate) {} size_t size() const { return 2; } @@ -1619,9 +1619,9 @@ public: decode_cccc_table(BITSn(word0,0x000f), m_mnem); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring opcode = "js" + opMnemonicAsString(m_mnem); + std::string opcode = "js" + opMnemonicAsString(m_mnem); retString = opcode + " " + regIdAsString(m_destination); // NEW // sprintf(opcode_str, "js.%s", M); } @@ -1648,12 +1648,12 @@ public: m_displacement = word1; return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { char temp[32]; sprintf(temp, ">$%x", m_displacement); // NEW // sprintf(temp, "$%04x", word1); - retString = "jsr " + astring(temp); + retString = "jsr " + std::string(temp); } void evaluate(dsp56k_core* cpustate) {} size_t size() const { return 2; } @@ -1678,12 +1678,12 @@ public: m_bAddr = BITSn(word0,0x00ff); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { char temp[32]; sprintf(temp, "<$%x", m_bAddr); // NEW // sprintf(temp, "#$%02x", BITSn(word0,0x00ff)); - retString = "jsr " + astring(temp); + retString = "jsr " + std::string(temp); } void evaluate(dsp56k_core* cpustate) {} size_t size() const { return 1; } @@ -1707,7 +1707,7 @@ public: decode_RR_table(BITSn(word0,0x0003), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "jsr " + regIdAsString(m_destination); } @@ -1737,7 +1737,7 @@ public: return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { // HACK retString = "lea " + m_ea + "," + regIdAsString(m_destination); @@ -1747,7 +1747,7 @@ public: size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } private: - astring m_ea; + std::string m_ea; }; // LEA : 0000 0001 10NN MMRR : A-116 /////////////////////////////////////////// @@ -1769,7 +1769,7 @@ public: return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { // HACK retString = "lea " + m_ea + "," + regIdAsString(m_destination); @@ -1779,7 +1779,7 @@ public: size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } private: - astring m_ea; + std::string m_ea; }; // LSL : .... .... 0011 F011 : A-118 /////////////////////////////////////////// @@ -1795,7 +1795,7 @@ public: decode_F_table(BITSn(word0,0x08), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "lsl " + regIdAsString(m_destination); } @@ -1817,7 +1817,7 @@ public: decode_F_table(BITSn(word0,0x08), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "lsr " + regIdAsString(m_destination); } @@ -1844,10 +1844,10 @@ public: decode_kSign_table(BITSn(word0,0x40), m_sign); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring ts = m_sign; - if (ts.cmp("-") != 0) ts = ""; + std::string ts = m_sign; + if (ts.compare("-") != 0) ts = ""; retString = "mac " + ts + regIdAsString(m_source) + "," + @@ -1859,7 +1859,7 @@ public: private: reg_id m_source2; - astring m_sign; + std::string m_sign; }; // MAC : 011m mKKK 1xx0 F1QQ : A-122 /////////////////////////////////////////// @@ -1877,7 +1877,7 @@ public: m_source, m_source2, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "mac " + regIdAsString(m_source) + "," + @@ -1906,7 +1906,7 @@ public: m_source, m_source2, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "mac " + regIdAsString(m_source) + "," + @@ -1938,10 +1938,10 @@ public: decode_kSign_table(BITSn(word0,0x40), m_sign); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring ts = m_sign; - if (ts.cmp("-")!=0) ts = ""; + std::string ts = m_sign; + if (ts.compare("-") != 0) ts = ""; retString = "macr " + ts + regIdAsString(m_source) + "," + @@ -1952,7 +1952,7 @@ public: size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } private: - astring m_sign; + std::string m_sign; reg_id m_source2; }; @@ -1971,7 +1971,7 @@ public: m_source, m_source2, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "macr " + regIdAsString(m_source) + "," + @@ -2004,9 +2004,9 @@ public: decode_s_table(BITSn(word0,0x0004), m_mnem); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring opcode = "mac" + opMnemonicAsString(m_mnem); + std::string opcode = "mac" + opMnemonicAsString(m_mnem); retString = opcode + " " + regIdAsString(m_source) + "," + @@ -2049,7 +2049,7 @@ public: return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { if (m_isNop) retString = "nop"; @@ -2083,7 +2083,7 @@ public: return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "move"; } @@ -2110,10 +2110,10 @@ public: decode_HHH_table(BITSn(word1,0x0e00), m_SD); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring source; - astring destination; + std::string source; + std::string destination; assemble_reg_from_W_table(m_W, 'X', m_SD, m_b, source, destination); retString = "move " + source + "," + destination; } @@ -2148,10 +2148,10 @@ public: if (m_SD == iINVALID) return false; return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring source; - astring destination; + std::string source; + std::string destination; assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source, destination); retString = "move " + source + "," + destination; // NEW // sprintf(opcode_str, "move(c)"); @@ -2163,7 +2163,7 @@ public: private: INT8 m_W; reg_id m_SD; - astring m_ea; + std::string m_ea; }; // MOVE(C) : 0011 1WDD DDD1 q0RR : A-144 /////////////////////////////////////// @@ -2187,10 +2187,10 @@ public: if (m_SD == iINVALID) return false; return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring source; - astring destination; + std::string source; + std::string destination; assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source, destination); retString = "move " + source + "," + destination; // NEW // sprintf(opcode_str, "move(c)"); @@ -2202,7 +2202,7 @@ public: private: INT8 m_W; reg_id m_SD; - astring m_ea; + std::string m_ea; }; // MOVE(C) : 0011 1WDD DDD1 Z11- : A-144 /////////////////////////////////////// @@ -2225,10 +2225,10 @@ public: if (m_SD == iINVALID) return false; return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring source; - astring destination; + std::string source; + std::string destination; assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source, destination); retString = "move " + source + "," + destination; // NEW // sprintf(opcode_str, "move(c)"); @@ -2240,7 +2240,7 @@ public: private: INT8 m_W; reg_id m_SD; - astring m_ea; + std::string m_ea; }; // MOVE(C) : 0011 1WDD DDD1 t10- xxxx xxxx xxxx xxxx : A-144 /////////////////// @@ -2269,9 +2269,9 @@ public: return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring ea; + std::string ea; assemble_ea_from_t_table(m_t, m_value, ea); retString = "move "; @@ -2339,7 +2339,7 @@ public: if (m_source == iSSH && m_destination == iSSH) return false; return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "move " + regIdAsString(m_source) + "," + regIdAsString(m_destination); // NEW // sprintf(opcode_str, "move(c)"); @@ -2368,10 +2368,10 @@ public: decode_DDDDD_table(BITSn(word1,0x03e0), m_SD); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring source; - astring destination; + std::string source; + std::string destination; assemble_reg_from_W_table(m_W, 'X', m_SD, m_b, source, destination); retString = "move " + source + "," + destination; // NEW // opcode = "move(c)"; @@ -2402,7 +2402,7 @@ public: decode_DD_table(BITSn(word0,0x0300), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { char temp[32]; if (m_immediate >= 0) sprintf(temp, "#<+$%x", m_immediate); @@ -2410,7 +2410,7 @@ public: // NEW // sprintf(temp, "#$%02x,%s", BITSn(word0,0x00ff), D1); retString = "move " + - astring(temp) + "," + regIdAsString(m_destination); + std::string(temp) + "," + regIdAsString(m_destination); // NEW // sprintf(opcode_str, "move(i)"); } void evaluate(dsp56k_core* cpustate) {} @@ -2441,10 +2441,10 @@ public: m_W = BITSn(word0,0x0100); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring source; - astring destination; + std::string source; + std::string destination; assemble_arguments_from_W_table(m_W, 'P', m_SD, m_ea, source, destination); retString = "move " + source + "," + destination; // NEW // sprintf(opcode_str, "move(m)"); @@ -2456,7 +2456,7 @@ public: private: INT8 m_W; reg_id m_SD; - astring m_ea; + std::string m_ea; }; // MOVE(M) : 0000 001W RR11 mmRR : A-152 /////////////////////////////////////// @@ -2476,10 +2476,10 @@ public: assemble_eas_from_mm_table(BITSn(word0,0x000c), BITSn(word0,0x00c0), BITSn(word0,0x0003), m_ea, m_ea2); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring source; - astring destination; + std::string source; + std::string destination; if (m_W) { source = "X:" + m_ea; @@ -2499,8 +2499,8 @@ public: private: UINT8 m_W; - astring m_ea; - astring m_ea2; + std::string m_ea; + std::string m_ea2; }; // MOVE(M) : 0000 0101 BBBB BBBB 0000 001W --0- -HHH : A-152 /////////////////// @@ -2521,10 +2521,10 @@ public: decode_HHH_table(BITSn(word1,0x0007), m_SD); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring source; - astring destination; + std::string source; + std::string destination; assemble_reg_from_W_table(m_W, 'P', m_SD, m_b, source, destination); retString = "move " + source + "," + destination; // NEW // opcode = "move(m)"; @@ -2561,10 +2561,10 @@ public: m_W = BITSn(word0,0x0100); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring source; - astring destination; + std::string source; + std::string destination; assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source, destination); retString = "movep " + source + "," + destination; // NEW // sprintf(opcode_str, "move(p)"); @@ -2576,7 +2576,7 @@ public: private: INT8 m_W; reg_id m_SD; - astring m_ea; + std::string m_ea; }; // MOVE(P) : 0000 110W RRmp pppp : A-156 /////////////////////////////////////// @@ -2596,7 +2596,7 @@ public: assemble_ea_from_m_table(BITSn(word0,0x0020), rNum, m_ea); - astring fullAddy; /* Convert Short Absolute Address to full 16-bit */ + std::string fullAddy; /* Convert Short Absolute Address to full 16-bit */ assemble_address_from_IO_short_address(BITSn(word0,0x001f), fullAddy); m_W = BITSn(word0,0x0100); @@ -2604,10 +2604,10 @@ public: // NEW // sprintf(SD, "X:$%s", fullAddy); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring source; - astring destination; + std::string source; + std::string destination; assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source, destination); retString = "movep " + source + "," + destination; // NEW // sprintf(opcode_str, "move(p)*"); @@ -2618,8 +2618,8 @@ public: private: INT8 m_W; - astring m_SD; - astring m_ea; + std::string m_SD; + std::string m_ea; }; // MOVE(S) : 0001 100W HH0a aaaa : A-158 /////////////////////////////////////// @@ -2644,10 +2644,10 @@ public: m_W = BITSn(word0,0x0100); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring source; - astring destination; + std::string source; + std::string destination; assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source, destination); retString = "moves " + source + "," + destination; // NEW // sprintf(opcode_str, "move(s)"); @@ -2659,7 +2659,7 @@ public: private: INT8 m_W; reg_id m_SD; - astring m_ea; + std::string m_ea; }; // MPY : .... .... 1k00 FQQQ : A-160 /////////////////////////////////////////// @@ -2682,10 +2682,10 @@ public: decode_kSign_table(BITSn(word0,0x40), m_sign); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring ts = m_sign; - if (ts.cmp("-")!=0) ts = ""; + std::string ts = m_sign; + if (ts.compare("-")!=0) ts = ""; retString = "mpy " + ts + regIdAsString(m_source) + "," + @@ -2696,7 +2696,7 @@ public: size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } private: - astring m_sign; + std::string m_sign; reg_id m_source2; }; @@ -2715,7 +2715,7 @@ public: m_source, m_source2, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "mpy " + regIdAsString(m_source) + "," + @@ -2744,7 +2744,7 @@ public: m_source, m_source2, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "mpy " + regIdAsString(m_source) + "," + @@ -2778,10 +2778,10 @@ public: decode_kSign_table(BITSn(word0,0x40), m_sign); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring ts = m_sign; - if (ts.cmp("-") != 0) ts = ""; + std::string ts = m_sign; + if (ts.compare("-") != 0) ts = ""; retString = "mpyr " + ts + regIdAsString(m_source) + "," + @@ -2792,7 +2792,7 @@ public: size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } private: - astring m_sign; + std::string m_sign; reg_id m_source2; }; @@ -2811,7 +2811,7 @@ public: m_source, m_source2, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "mpyr " + regIdAsString(m_source) + "," + @@ -2843,9 +2843,9 @@ public: decode_s_table(BITSn(word0,0x0004), m_mnem); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring opcode = "mpy" + opMnemonicAsString(m_mnem); + std::string opcode = "mpy" + opMnemonicAsString(m_mnem); retString = opcode + " " + regIdAsString(m_source) + "," + @@ -2874,7 +2874,7 @@ public: decode_F_table(BITSn(word0,0x08), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "neg " + regIdAsString(m_destination); } @@ -2896,7 +2896,7 @@ public: decode_F_table(BITSn(word0,0x0008), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "negc " + regIdAsString(m_destination); } @@ -2917,7 +2917,7 @@ public: { return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "nop"; } @@ -2941,7 +2941,7 @@ public: decode_RR_table(BITSn(word0,0x0003), m_source); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "norm " + regIdAsString(m_source) + "," + regIdAsString(m_destination); } @@ -2963,7 +2963,7 @@ public: decode_F_table(BITSn(word0,0x08), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "not " + regIdAsString(m_destination); } @@ -2986,7 +2986,7 @@ public: m_source, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "or " + regIdAsString(m_source) + "," + regIdAsString(m_destination); } @@ -3010,12 +3010,12 @@ public: decode_EE_table(BITSn(word0,0x0600), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { char temp[32]; sprintf(temp, "#$%x", m_immediate); // NEW // sprintf(temp, "#$%02x", BITSn(word0,0x00ff)); - retString = "ori " + astring(temp) + "," + regIdAsString(m_destination); + retString = "ori " + std::string(temp) + "," + regIdAsString(m_destination); // NEW // sprintf(opcode_str, "or(i)"); } void evaluate(dsp56k_core* cpustate) {} @@ -3039,11 +3039,11 @@ public: decode_RR_table(BITSn(word0,0x0003), m_source); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { char temp[32]; sprintf(temp, "X:(%s)", regIdAsString(m_source).c_str()); - retString = "rep " + astring(temp); + retString = "rep " + std::string(temp); } void evaluate(dsp56k_core* cpustate) {} size_t size() const { return 1; } @@ -3064,12 +3064,12 @@ public: m_immediate = BITSn(word0,0x00ff); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { char temp[32]; sprintf(temp, "#$%x", m_immediate); // NEW // sprintf(temp, "#$%02x (%d)", BITSn(word0,0x00ff), BITSn(word0,0x00ff)); - retString = "rep " + astring(temp); + retString = "rep " + std::string(temp); } void evaluate(dsp56k_core* cpustate) {} size_t size() const { return 1; } @@ -3093,7 +3093,7 @@ public: if (m_source == iINVALID) return false; return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "rep " + regIdAsString(m_source); } @@ -3116,9 +3116,9 @@ public: decode_cccc_table(BITSn(word0,0x000f), m_mnem); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring opcode = "rep" + opMnemonicAsString(m_mnem); + std::string opcode = "rep" + opMnemonicAsString(m_mnem); retString = opcode; // NEW // sprintf(opcode_str, "rep.%s", M); } @@ -3142,7 +3142,7 @@ public: { return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "reset"; } @@ -3164,7 +3164,7 @@ public: decode_F_table(BITSn(word0,0x08), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "rnd " + regIdAsString(m_destination); } @@ -3186,7 +3186,7 @@ public: decode_F_table(BITSn(word0,0x08), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "rol " + regIdAsString(m_destination); } @@ -3208,7 +3208,7 @@ public: decode_F_table(BITSn(word0,0x08), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "ror " + regIdAsString(m_destination); } @@ -3229,7 +3229,7 @@ public: { return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "rti"; } @@ -3251,7 +3251,7 @@ public: { return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "rts"; } @@ -3275,7 +3275,7 @@ public: m_source, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "sbc " + regIdAsString(m_source) + "," + regIdAsString(m_destination); } @@ -3296,7 +3296,7 @@ public: { return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "stop"; } @@ -3319,7 +3319,7 @@ public: m_source, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "sub " + regIdAsString(m_source) + "," + regIdAsString(m_destination); } @@ -3345,7 +3345,7 @@ public: // TODO // m_opcode = "sub"; return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = m_opcode + " " + regIdAsString(m_source) + "," + regIdAsString(m_destination); } @@ -3354,7 +3354,7 @@ public: size_t accumulatorBitsModified() const { return BM_HIGH | BM_MIDDLE | BM_LOW; } private: - astring m_opcode; + std::string m_opcode; }; // SUBL : .... .... 0100 F001 : A-204 ////////////////////////////////////////// @@ -3380,7 +3380,7 @@ public: } return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "subl " + regIdAsString(m_source) + "," + regIdAsString(m_destination); } @@ -3402,7 +3402,7 @@ public: decode_F_table(BITSn(word0,0x0008), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "swap " + regIdAsString(m_destination); } @@ -3423,7 +3423,7 @@ public: { return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "swi"; } @@ -3457,17 +3457,17 @@ public: return false; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring opcode = "t" + opMnemonicAsString(m_mnem); + std::string opcode = "t" + opMnemonicAsString(m_mnem); // NEW // sprintf(opcode_str, "t.%s", M); retString = opcode; if (m_source != m_destination) - retString += astring(" ") + regIdAsString(m_source) + "," + regIdAsString(m_destination); + retString += std::string(" ") + regIdAsString(m_source) + "," + regIdAsString(m_destination); if (m_destination2 != iR0) - retString += astring(" R0,") + regIdAsString(m_destination2); + retString += std::string(" R0,") + regIdAsString(m_destination2); } void evaluate(dsp56k_core* cpustate) {} size_t size() const { return 1; } @@ -3492,7 +3492,7 @@ public: m_source, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "tfr " + regIdAsString(m_source) + "," + regIdAsString(m_destination); } @@ -3515,7 +3515,7 @@ public: m_source, m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "tfr " + regIdAsString(m_source) + "," + regIdAsString(m_destination); } @@ -3538,7 +3538,7 @@ public: m_destination, m_source); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "tfr2 " + regIdAsString(m_source) + "," + regIdAsString(m_destination); } @@ -3575,10 +3575,10 @@ public: m_W = BITSn(word0,0x0100); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { - astring source2; - astring destination2; + std::string source2; + std::string destination2; assemble_arguments_from_W_table(m_W, 'X', m_SD, m_ea, source2, destination2); retString = "tfr3 " + regIdAsString(m_source) + "," + regIdAsString(m_destination) + " " + @@ -3591,7 +3591,7 @@ public: private: INT8 m_W; reg_id m_SD; - astring m_ea; + std::string m_ea; reg_id m_source2; reg_id m_destination2; }; @@ -3609,7 +3609,7 @@ public: decode_F_table(BITSn(word0,0x08), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "tst " + regIdAsString(m_destination); } @@ -3631,7 +3631,7 @@ public: decode_DD_table(BITSn(word0,0x0003), m_source); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "tst2 " + regIdAsString(m_source); } @@ -3652,7 +3652,7 @@ public: { return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "wait"; } @@ -3674,7 +3674,7 @@ public: decode_F_table(BITSn(word0,0x0008), m_destination); return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "zero " + regIdAsString(m_destination); } @@ -3713,7 +3713,7 @@ public: } return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "shfl " + regIdAsString(m_source) + "," + @@ -3757,7 +3757,7 @@ public: } return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = "shfr " + regIdAsString(m_source) + "," + diff --git a/src/emu/cpu/dsp56k/opcode.c b/src/emu/cpu/dsp56k/opcode.c index 58ade2b7b30..7943736580c 100644 --- a/src/emu/cpu/dsp56k/opcode.c +++ b/src/emu/cpu/dsp56k/opcode.c @@ -16,7 +16,7 @@ Opcode::~Opcode() } -astring Opcode::disassemble() const +std::string Opcode::disassemble() const { // Duck out early if there isn't a valid op if (!m_instruction) @@ -29,8 +29,8 @@ astring Opcode::disassemble() const return dcString(); // Disassemble what you can. - astring opString = ""; - astring pmString = ""; + std::string opString = ""; + std::string pmString = ""; if (m_instruction) m_instruction->disassemble(opString); if (m_parallelMove) m_parallelMove->disassemble(pmString); @@ -68,11 +68,11 @@ const reg_id& Opcode::instSource() const { return m_instruction->source(); } const reg_id& Opcode::instDestination() const { return m_instruction->destination(); } const size_t Opcode::instAccumulatorBitsModified() const { return m_instruction->accumulatorBitsModified(); } -astring Opcode::dcString() const +std::string Opcode::dcString() const { char tempStr[1024]; sprintf(tempStr, "dc $%x", m_word0); - return astring(tempStr); + return std::string(tempStr); } } diff --git a/src/emu/cpu/dsp56k/opcode.h b/src/emu/cpu/dsp56k/opcode.h index da6a8a87d1b..b258c0241a6 100644 --- a/src/emu/cpu/dsp56k/opcode.h +++ b/src/emu/cpu/dsp56k/opcode.h @@ -21,7 +21,7 @@ public: Opcode(UINT16 w0, UINT16 w1); virtual ~Opcode(); - astring disassemble() const; + std::string disassemble() const; void evaluate(dsp56k_core* cpustate) const; size_t size() const; size_t evalSize() const; @@ -38,7 +38,7 @@ private: UINT16 m_word0; //UINT16 m_word1; - astring dcString() const; + std::string dcString() const; }; } diff --git a/src/emu/cpu/dsp56k/pmove.h b/src/emu/cpu/dsp56k/pmove.h index 2a475975542..16c9de1a555 100644 --- a/src/emu/cpu/dsp56k/pmove.h +++ b/src/emu/cpu/dsp56k/pmove.h @@ -19,7 +19,7 @@ public: virtual ~ParallelMove() {} virtual bool decode(const UINT16 word0, const UINT16 word1) = 0; - virtual void disassemble(astring& retString) const = 0; + virtual void disassemble(std::string& retString) const = 0; virtual void evaluate() = 0; static ParallelMove* decodeParallelMove(const Opcode* opc, const UINT16 word0, const UINT16 word1); @@ -57,7 +57,7 @@ public: reg_id SD; decode_HHH_table(BITSn(word0,0x0e00), SD); - astring ea; + std::string ea; assemble_ea_from_m_table(BITSn(word0,0x4000), regIDAsNum(r), ea); assemble_arguments_from_W_table(BITSn(word0,0x0100), 'X', SD, ea, @@ -69,15 +69,15 @@ public: return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = m_source + "," + m_destination; } void evaluate() {} private: - astring m_source; - astring m_destination; + std::string m_source; + std::string m_destination; }; @@ -91,7 +91,7 @@ public: } bool decode(const UINT16 word0, const UINT16 word1) { - astring ea; + std::string ea; if (opDestination() == iB) ea = "(A1)"; else if (opDestination() == iA) @@ -111,15 +111,15 @@ public: return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = m_source + "," + m_destination; } void evaluate() {} private: - astring m_source; - astring m_destination; + std::string m_source; + std::string m_destination; }; @@ -136,8 +136,8 @@ public: reg_id r; reg_id D1; reg_id D2; - astring ea1 = ""; - astring ea2 = ""; + std::string ea1 = ""; + std::string ea2 = ""; decode_rr_table(BITSn(word0,0x0060), r); decode_KKK_table(BITSn(word0,0x0700), D1, D2); @@ -165,15 +165,15 @@ public: return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = parallelMove + " " + parallelMove2; } void evaluate() {} private: - astring parallelMove; - astring parallelMove2; + std::string parallelMove; + std::string parallelMove2; }; @@ -212,7 +212,7 @@ public: return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { // (?,?) is a parallel nop if (m_source == iWEIRD && m_destination == iWEIRD) @@ -259,15 +259,15 @@ public: pms2 = parallel_move_str2; return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = pms + " " + pms2; } void evaluate() {} private: - astring pms; // TODO - astring pms2; + std::string pms; // TODO + std::string pms2; }; @@ -288,14 +288,14 @@ public: return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = m_ea; } void evaluate() {} private: - astring m_ea; + std::string m_ea; }; @@ -313,7 +313,7 @@ public: { INT8 b; reg_id SD; - astring args; + std::string args; b = (char)(word0 & 0x00ff); decode_HHH_table(BITSn(word1,0x0e00), SD); @@ -321,15 +321,15 @@ public: return true; } - void disassemble(astring& retString) const + void disassemble(std::string& retString) const { retString = m_source + "," + m_destination; } void evaluate() {} private: - astring m_source; - astring m_destination; + std::string m_source; + std::string m_destination; }; } diff --git a/src/emu/cpu/dsp56k/tables.c b/src/emu/cpu/dsp56k/tables.c index 727d7772d6e..a7db21acf44 100644 --- a/src/emu/cpu/dsp56k/tables.c +++ b/src/emu/cpu/dsp56k/tables.c @@ -283,7 +283,7 @@ void decode_JF_table(const UINT16 J, const UINT16 F, reg_id& S, reg_id& D) // NEW // } // NEW // } -void decode_kSign_table(const UINT16 k, astring& plusMinus) +void decode_kSign_table(const UINT16 k, std::string& plusMinus) { switch(k) { @@ -431,7 +431,7 @@ void decode_ss_table(const UINT16 ss, op_mnem& arithmetic) } } -void decode_uuuuF_table(const UINT16 uuuu, const UINT16 F, astring& arg, reg_id& S, reg_id& D) +void decode_uuuuF_table(const UINT16 uuuu, const UINT16 F, std::string& arg, reg_id& S, reg_id& D) { const UINT16 switchVal = (uuuu << 1) | F; @@ -473,7 +473,7 @@ void decode_uuuuF_table(const UINT16 uuuu, const UINT16 F, astring& arg, reg_id& } } -void decode_Z_table(const UINT16 Z, astring& ea) +void decode_Z_table(const UINT16 Z, std::string& ea) { /* This is fixed as per the Family Manual errata addendum */ switch(Z) @@ -483,7 +483,7 @@ void decode_Z_table(const UINT16 Z, astring& ea) } } -void assemble_ea_from_m_table(const UINT16 m, const int n, astring& ea) +void assemble_ea_from_m_table(const UINT16 m, const int n, std::string& ea) { char temp[32]; switch(m) @@ -494,7 +494,7 @@ void assemble_ea_from_m_table(const UINT16 m, const int n, astring& ea) ea = temp; } -void assemble_eas_from_mm_table(UINT16 mm, int n1, int n2, astring& ea1, astring& ea2) +void assemble_eas_from_mm_table(UINT16 mm, int n1, int n2, std::string& ea1, std::string& ea2) { char temp1[32]; char temp2[32]; @@ -513,7 +513,7 @@ void assemble_eas_from_mm_table(UINT16 mm, int n1, int n2, astring& ea1, astring ea2 = temp2; } -void assemble_ea_from_MM_table(UINT16 MM, int n, astring& ea) +void assemble_ea_from_MM_table(UINT16 MM, int n, std::string& ea) { char temp[32]; switch(MM) @@ -526,7 +526,7 @@ void assemble_ea_from_MM_table(UINT16 MM, int n, astring& ea) ea = temp; } -void assemble_ea_from_q_table(UINT16 q, int n, astring& ea) +void assemble_ea_from_q_table(UINT16 q, int n, std::string& ea) { char temp[32]; switch(q) @@ -537,7 +537,7 @@ void assemble_ea_from_q_table(UINT16 q, int n, astring& ea) ea = temp; } -void assemble_ea_from_t_table(UINT16 t, UINT16 val, astring& ea) +void assemble_ea_from_t_table(UINT16 t, UINT16 val, std::string& ea) { char temp[32]; switch(t) @@ -550,7 +550,7 @@ void assemble_ea_from_t_table(UINT16 t, UINT16 val, astring& ea) ea = temp; } -void assemble_ea_from_z_table(UINT16 z, int n, astring& ea) +void assemble_ea_from_z_table(UINT16 z, int n, std::string& ea) { char temp[32]; switch(z) @@ -561,10 +561,10 @@ void assemble_ea_from_z_table(UINT16 z, int n, astring& ea) ea = temp; } -void assemble_D_from_P_table(UINT16 P, UINT16 ppppp, astring& D) +void assemble_D_from_P_table(UINT16 P, UINT16 ppppp, std::string& D) { char temp[32]; - astring fullAddy; /* Convert Short Absolute Address to full 16-bit */ + std::string fullAddy; /* Convert Short Absolute Address to full 16-bit */ switch(P) { @@ -581,8 +581,8 @@ void assemble_D_from_P_table(UINT16 P, UINT16 ppppp, astring& D) D = temp; } -void assemble_arguments_from_W_table(UINT16 W, char ma, const reg_id& SD, const astring& ea, - astring& source, astring& destination) +void assemble_arguments_from_W_table(UINT16 W, char ma, const reg_id& SD, const std::string& ea, + std::string& source, std::string& destination) { char temp[32]; sprintf(temp, "%c:%s", ma, ea.c_str()); @@ -593,8 +593,8 @@ void assemble_arguments_from_W_table(UINT16 W, char ma, const reg_id& SD, const } } -void assemble_arguments_from_W_table(UINT16 W, char ma, const astring& SD, const astring& ea, - astring& source, astring& destination) +void assemble_arguments_from_W_table(UINT16 W, char ma, const std::string& SD, const std::string& ea, + std::string& source, std::string& destination) { char temp[32]; sprintf(temp, "%c:%s", ma, ea.c_str()); @@ -605,7 +605,7 @@ void assemble_arguments_from_W_table(UINT16 W, char ma, const astring& SD, const } } -void assemble_reg_from_W_table(UINT16 W, char ma, const reg_id& SD, const INT8 xx, astring& S, astring& D) +void assemble_reg_from_W_table(UINT16 W, char ma, const reg_id& SD, const INT8 xx, std::string& S, std::string& D) { UINT8 abs_xx; char temp[32]; @@ -627,7 +627,7 @@ void assemble_reg_from_W_table(UINT16 W, char ma, const reg_id& SD, const INT8 x } } -void assemble_address_from_IO_short_address(UINT16 pp, astring& ea) +void assemble_address_from_IO_short_address(UINT16 pp, std::string& ea) { char temp[32]; @@ -751,7 +751,7 @@ void setReg16(dsp56k_core* cpustate, const UINT16& value, const reg_id& reg) if (reg == iM3) M3 = value; } -astring regIdAsString(const reg_id& regId) +std::string regIdAsString(const reg_id& regId) { switch(regId) { @@ -799,7 +799,7 @@ astring regIdAsString(const reg_id& regId) return "INVALID_REG_ID"; } -astring opMnemonicAsString(const op_mnem& mnem) +std::string opMnemonicAsString(const op_mnem& mnem) { switch(mnem) { @@ -829,47 +829,47 @@ astring opMnemonicAsString(const op_mnem& mnem) return "INVALID_OPCODE_MNEMONIC"; } -reg_id stringAsRegID(const astring& str) -{ - if (str.cmp("X")==0) return iX; - if (str.cmp("X0") == 0) return iX0; - if (str.cmp("X1") == 0) return iX1; - if (str.cmp("Y") == 0) return iY; - if (str.cmp("Y0") == 0) return iY0; - if (str.cmp("Y1") == 0) return iY1; - if (str.cmp("A") == 0) return iA; - if (str.cmp("A0") == 0) return iA0; - if (str.cmp("A1") == 0) return iA1; - if (str.cmp("A2") == 0) return iA2; - if (str.cmp("B") == 0) return iB; - if (str.cmp("B0") == 0) return iB0; - if (str.cmp("B1") == 0) return iB1; - if (str.cmp("B2") == 0) return iB2; - if (str.cmp("R0") == 0) return iR0; - if (str.cmp("R1") == 0) return iR1; - if (str.cmp("R2") == 0) return iR2; - if (str.cmp("R3") == 0) return iR3; - if (str.cmp("N0") == 0) return iN0; - if (str.cmp("N1") == 0) return iN1; - if (str.cmp("N2") == 0) return iN2; - if (str.cmp("N3") == 0) return iN3; - if (str.cmp("M0") == 0) return iM0; - if (str.cmp("M1") == 0) return iM1; - if (str.cmp("M2") == 0) return iM2; - if (str.cmp("M3") == 0) return iM3; - if (str.cmp("LC") == 0) return iLC; - if (str.cmp("SR") == 0) return iSR; - if (str.cmp("OMR") == 0) return iOMR; - if (str.cmp("SP") == 0) return iSP; - if (str.cmp("SSH") == 0) return iSSH; - if (str.cmp("SSL") == 0) return iSSL; - if (str.cmp("LA") == 0) return iLA; - if (str.cmp("MR") == 0) return iMR; - if (str.cmp("CCR") == 0) return iCCR; - if (str.cmp("F") == 0) return iF; - if (str.cmp("^F") == 0) return iFHAT; - if (str.cmp("!!") == 0) return iINVALID; - if (str.cmp("?") == 0)return iWEIRD; +reg_id stringAsRegID(const std::string& str) +{ + if (str.compare("X")==0) return iX; + if (str.compare("X0") == 0) return iX0; + if (str.compare("X1") == 0) return iX1; + if (str.compare("Y") == 0) return iY; + if (str.compare("Y0") == 0) return iY0; + if (str.compare("Y1") == 0) return iY1; + if (str.compare("A") == 0) return iA; + if (str.compare("A0") == 0) return iA0; + if (str.compare("A1") == 0) return iA1; + if (str.compare("A2") == 0) return iA2; + if (str.compare("B") == 0) return iB; + if (str.compare("B0") == 0) return iB0; + if (str.compare("B1") == 0) return iB1; + if (str.compare("B2") == 0) return iB2; + if (str.compare("R0") == 0) return iR0; + if (str.compare("R1") == 0) return iR1; + if (str.compare("R2") == 0) return iR2; + if (str.compare("R3") == 0) return iR3; + if (str.compare("N0") == 0) return iN0; + if (str.compare("N1") == 0) return iN1; + if (str.compare("N2") == 0) return iN2; + if (str.compare("N3") == 0) return iN3; + if (str.compare("M0") == 0) return iM0; + if (str.compare("M1") == 0) return iM1; + if (str.compare("M2") == 0) return iM2; + if (str.compare("M3") == 0) return iM3; + if (str.compare("LC") == 0) return iLC; + if (str.compare("SR") == 0) return iSR; + if (str.compare("OMR") == 0) return iOMR; + if (str.compare("SP") == 0) return iSP; + if (str.compare("SSH") == 0) return iSSH; + if (str.compare("SSL") == 0) return iSSL; + if (str.compare("LA") == 0) return iLA; + if (str.compare("MR") == 0) return iMR; + if (str.compare("CCR") == 0) return iCCR; + if (str.compare("F") == 0) return iF; + if (str.compare("^F") == 0) return iFHAT; + if (str.compare("!!") == 0) return iINVALID; + if (str.compare("?") == 0)return iWEIRD; return iINVALID; } diff --git a/src/emu/cpu/dsp56k/tables.h b/src/emu/cpu/dsp56k/tables.h index 139d89403a0..dbe877f1431 100644 --- a/src/emu/cpu/dsp56k/tables.h +++ b/src/emu/cpu/dsp56k/tables.h @@ -46,7 +46,7 @@ void decode_IIIIx_table(const UINT16 IIII, const UINT16 x, reg_id& S, reg_id& D) void decode_JJJF_table(const UINT16 JJJ, const UINT16 F, reg_id& S, reg_id& D); void decode_JJF_table(const UINT16 JJ, const UINT16 F, reg_id& S, reg_id& D); void decode_JF_table(const UINT16 J, const UINT16 F, reg_id& S, reg_id& D); -void decode_kSign_table(const UINT16 k, astring& plusMinus); +void decode_kSign_table(const UINT16 k, std::string& plusMinus); void decode_KKK_table(const UINT16 KKK, reg_id& D1, reg_id& D2); void decode_NN_table(UINT16 NN, reg_id& ret); void decode_TT_table(UINT16 TT, reg_id& ret); @@ -57,20 +57,20 @@ void decode_RR_table(UINT16 RR, reg_id& ret); void decode_rr_table(UINT16 rr, reg_id& ret); void decode_s_table(const UINT16 s, op_mnem& arithmetic); void decode_ss_table(const UINT16 ss, op_mnem& arithmetic); -void decode_uuuuF_table(const UINT16 uuuu, const UINT16 F, astring& arg, reg_id& S, reg_id& D); -void decode_Z_table(const UINT16 Z, astring& ea); - -void assemble_ea_from_m_table(const UINT16 m, const int n, astring& ea); -void assemble_eas_from_mm_table(UINT16 mm, int n1, int n2, astring& ea1, astring& ea2); -void assemble_ea_from_MM_table(UINT16 MM, int n, astring& ea); -void assemble_ea_from_q_table(UINT16 q, int n, astring& ea); -void assemble_ea_from_t_table(UINT16 t, UINT16 val, astring& ea); -void assemble_ea_from_z_table(UINT16 z, int n, astring& ea); -void assemble_D_from_P_table(UINT16 P, UINT16 ppppp, astring& D); -void assemble_arguments_from_W_table(UINT16 W, char ma, const reg_id& SD, const astring& ea, astring& S, astring& D); -void assemble_arguments_from_W_table(UINT16 W, char ma, const astring& SD, const astring& ea, astring& S, astring& D); -void assemble_reg_from_W_table(UINT16 W, char ma, const reg_id& SD, const INT8 xx, astring& S, astring& D); -void assemble_address_from_IO_short_address(UINT16 pp, astring& ea); +void decode_uuuuF_table(const UINT16 uuuu, const UINT16 F, std::string& arg, reg_id& S, reg_id& D); +void decode_Z_table(const UINT16 Z, std::string& ea); + +void assemble_ea_from_m_table(const UINT16 m, const int n, std::string& ea); +void assemble_eas_from_mm_table(UINT16 mm, int n1, int n2, std::string& ea1, std::string& ea2); +void assemble_ea_from_MM_table(UINT16 MM, int n, std::string& ea); +void assemble_ea_from_q_table(UINT16 q, int n, std::string& ea); +void assemble_ea_from_t_table(UINT16 t, UINT16 val, std::string& ea); +void assemble_ea_from_z_table(UINT16 z, int n, std::string& ea); +void assemble_D_from_P_table(UINT16 P, UINT16 ppppp, std::string& D); +void assemble_arguments_from_W_table(UINT16 W, char ma, const reg_id& SD, const std::string& ea, std::string& S, std::string& D); +void assemble_arguments_from_W_table(UINT16 W, char ma, const std::string& SD, const std::string& ea, std::string& S, std::string& D); +void assemble_reg_from_W_table(UINT16 W, char ma, const reg_id& SD, const INT8 xx, std::string& S, std::string& D); +void assemble_address_from_IO_short_address(UINT16 pp, std::string& ea); INT8 get_6_bit_signed_value(UINT16 bits); @@ -82,9 +82,9 @@ bool registerOverlap(const reg_id& r0, const size_t bmd, const reg_id& r1); UINT16 regValue16(dsp56k_core* cpustate, const reg_id& reg); void setReg16(dsp56k_core* cpustate, const UINT16& value, const reg_id& reg); -astring regIdAsString(const reg_id& regId); -astring opMnemonicAsString(const op_mnem& mnem); -reg_id stringAsRegID(const astring& str); +std::string regIdAsString(const reg_id& regId); +std::string opMnemonicAsString(const op_mnem& mnem); +reg_id stringAsRegID(const std::string& str); UINT8 regIDAsNum(const reg_id& regId); diff --git a/src/emu/cpu/e132xs/e132xs.c b/src/emu/cpu/e132xs/e132xs.c index 258f0642673..613bc57a03f 100644 --- a/src/emu/cpu/e132xs/e132xs.c +++ b/src/emu/cpu/e132xs/e132xs.c @@ -1560,7 +1560,7 @@ void hyperstone_device::init(int scale_mask) m_clock_scale_mask = scale_mask; // register our state for the debugger - astring tempstr; + std::string tempstr; state_add(STATE_GENPC, "GENPC", m_global_regs[0]).noshow(); state_add(STATE_GENFLAGS, "GENFLAGS", m_global_regs[1]).callimport().callexport().formatstr("%40s").noshow(); state_add(E132XS_PC, "PC", m_global_regs[0]).mask(0xffffffff); @@ -1847,12 +1847,12 @@ const address_space_config *hyperstone_device::memory_space_config(address_space // for the debugger //------------------------------------------------- -void hyperstone_device::state_string_export(const device_state_entry &entry, astring &str) +void hyperstone_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c%c%c%c%c FTE:%X FRM:%X ILC:%d FL:%d FP:%d", + strprintf(str, "%c%c%c%c%c%c%c%c%c%c%c%c FTE:%X FRM:%X ILC:%d FL:%d FP:%d", GET_S ? 'S':'.', GET_P ? 'P':'.', GET_T ? 'T':'.', diff --git a/src/emu/cpu/e132xs/e132xs.h b/src/emu/cpu/e132xs/e132xs.h index 9ab10d1cec1..2d8bc976cf8 100644 --- a/src/emu/cpu/e132xs/e132xs.h +++ b/src/emu/cpu/e132xs/e132xs.h @@ -241,7 +241,7 @@ protected: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // address spaces const address_space_config m_program_config; diff --git a/src/emu/cpu/esrip/esrip.c b/src/emu/cpu/esrip/esrip.c index 8551a18c745..5bbcebeee08 100644 --- a/src/emu/cpu/esrip/esrip.c +++ b/src/emu/cpu/esrip/esrip.c @@ -191,7 +191,7 @@ void esrip_device::device_start() m_direct = &m_program->direct(); // register our state for the debugger - astring tempstr; + std::string tempstr; state_add(STATE_GENPC, "GENPC", m_rip_pc).noshow(); state_add(STATE_GENFLAGS, "GENFLAGS", m_status).callimport().callexport().formatstr("%8s").noshow(); state_add(ESRIP_PC, "PC:", m_rip_pc).mask(0xffff); @@ -349,12 +349,12 @@ const address_space_config *esrip_device::memory_space_config(address_spacenum s // for the debugger //------------------------------------------------- -void esrip_device::state_string_export(const device_state_entry &entry, astring &str) +void esrip_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c%c", (m_status & 0x80) ? '3' : '.', (m_status & 0x40) ? '2' : '.', (m_status & 0x20) ? '1' : '.', diff --git a/src/emu/cpu/esrip/esrip.h b/src/emu/cpu/esrip/esrip.h index d772d37b093..2cf5b335aad 100644 --- a/src/emu/cpu/esrip/esrip.h +++ b/src/emu/cpu/esrip/esrip.h @@ -150,7 +150,7 @@ protected: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // address spaces const address_space_config m_program_config; diff --git a/src/emu/cpu/f8/f8.c b/src/emu/cpu/f8/f8.c index 52ca9747911..6c5db98e721 100644 --- a/src/emu/cpu/f8/f8.c +++ b/src/emu/cpu/f8/f8.c @@ -2057,12 +2057,12 @@ void f8_cpu_device::device_start() } -void f8_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void f8_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c", m_w & 0x10 ? 'I':'.', m_w & 0x08 ? 'O':'.', m_w & 0x04 ? 'Z':'.', diff --git a/src/emu/cpu/f8/f8.h b/src/emu/cpu/f8/f8.h index e888fc29608..e2045e42ff9 100644 --- a/src/emu/cpu/f8/f8.h +++ b/src/emu/cpu/f8/f8.h @@ -63,7 +63,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : NULL ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/g65816/g65816.c b/src/emu/cpu/g65816/g65816.c index d8d6538c0fc..feedb58ef59 100644 --- a/src/emu/cpu/g65816/g65816.c +++ b/src/emu/cpu/g65816/g65816.c @@ -955,12 +955,12 @@ void g65816_device::state_export(const device_state_entry &entry) } } -void g65816_device::state_string_export(const device_state_entry &entry, astring &str) +void g65816_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", m_flag_n & NFLAG_SET ? 'N':'.', m_flag_v & VFLAG_SET ? 'V':'.', m_flag_m & MFLAG_SET ? 'M':'.', diff --git a/src/emu/cpu/g65816/g65816.h b/src/emu/cpu/g65816/g65816.h index 565269331b7..2f6973ab195 100644 --- a/src/emu/cpu/g65816/g65816.h +++ b/src/emu/cpu/g65816/g65816.h @@ -85,7 +85,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/h6280/h6280.c b/src/emu/cpu/h6280/h6280.c index 5f3fccf9e04..ec6a11f6775 100644 --- a/src/emu/cpu/h6280/h6280.c +++ b/src/emu/cpu/h6280/h6280.c @@ -2189,12 +2189,12 @@ OP(op,ff) { h6280_cycles(4); bbs(7, rd_zpg()); } // 6/8 BBS7 ZPG,REL // for the debugger //------------------------------------------------- -void h6280_device::state_string_export(const device_state_entry &entry, astring &str) +void h6280_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", (m_p & 0x80) ? 'N':'.', (m_p & 0x40) ? 'V':'.', (m_p & 0x20) ? 'R':'.', diff --git a/src/emu/cpu/h6280/h6280.h b/src/emu/cpu/h6280/h6280.h index decc1f20f01..892be50308c 100644 --- a/src/emu/cpu/h6280/h6280.h +++ b/src/emu/cpu/h6280/h6280.h @@ -96,7 +96,7 @@ protected: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // opcode accessors UINT8 program_read8(offs_t addr); diff --git a/src/emu/cpu/h8/h8.c b/src/emu/cpu/h8/h8.c index f9093e2b513..cd2f7ecd17f 100644 --- a/src/emu/cpu/h8/h8.c +++ b/src/emu/cpu/h8/h8.c @@ -243,12 +243,12 @@ void h8_device::state_export(const device_state_entry &entry) { } -void h8_device::state_string_export(const device_state_entry &entry, astring &str) +void h8_device::state_string_export(const device_state_entry &entry, std::string &str) { switch(entry.index()) { case STATE_GENFLAGS: if(has_exr) - str.printf("%c%c %c%c%c%c%c%c%c%c", + strprintf(str, "%c%c %c%c%c%c%c%c%c%c", (EXR & EXR_T) ? 'T' : '-', '0' + (EXR & EXR_I), (CCR & F_I) ? 'I' : '-', @@ -260,7 +260,7 @@ void h8_device::state_string_export(const device_state_entry &entry, astring &st (CCR & F_V) ? 'V' : '-', (CCR & F_C) ? 'C' : '-'); else - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", (CCR & F_I) ? 'I' : '-', (CCR & F_UI) ? 'u' : '-', (CCR & F_H) ? 'H' : '-', @@ -279,7 +279,7 @@ void h8_device::state_string_export(const device_state_entry &entry, astring &st case H8_R6: case H8_R7: { int r = entry.index() - H8_R0; - str.printf("%04x %04x", R[r + 8], R[r]); + strprintf(str, "%04x %04x", R[r + 8], R[r]); break; } } diff --git a/src/emu/cpu/h8/h8.h b/src/emu/cpu/h8/h8.h index 957ddc63296..b3a7a072ec9 100644 --- a/src/emu/cpu/h8/h8.h +++ b/src/emu/cpu/h8/h8.h @@ -185,7 +185,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const; diff --git a/src/emu/cpu/hcd62121/hcd62121.c b/src/emu/cpu/hcd62121/hcd62121.c index fdeebc36a21..f446b80f921 100644 --- a/src/emu/cpu/hcd62121/hcd62121.c +++ b/src/emu/cpu/hcd62121/hcd62121.c @@ -361,16 +361,16 @@ void hcd62121_cpu_device::device_start() } -void hcd62121_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void hcd62121_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENPC: - str.printf("%06X", (m_cseg << 16) | m_ip); + strprintf(str, "%06X", (m_cseg << 16) | m_ip); break; case STATE_GENFLAGS: - str.printf("%s-%s-%s-%c-%c", + strprintf(str, "%s-%s-%s-%c-%c", m_f & _FLAG_ZH ? "ZH":"__", m_f & _FLAG_CL ? "CL":"__", m_f & _FLAG_ZL ? "ZL":"__", @@ -381,100 +381,100 @@ void hcd62121_cpu_device::state_string_export(const device_state_entry &entry, a break; case HCD62121_R00: - str.printf("%02X%02X%02X%02X", m_reg[0x00], m_reg[0x01], m_reg[0x02], m_reg[0x03]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x00], m_reg[0x01], m_reg[0x02], m_reg[0x03]); break; case HCD62121_R04: - str.printf("%02X%02X%02X%02X", m_reg[0x04], m_reg[0x05], m_reg[0x06], m_reg[0x07]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x04], m_reg[0x05], m_reg[0x06], m_reg[0x07]); break; case HCD62121_R08: - str.printf("%02X%02X%02X%02X", m_reg[0x08], m_reg[0x09], m_reg[0x0A], m_reg[0x0B]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x08], m_reg[0x09], m_reg[0x0A], m_reg[0x0B]); break; case HCD62121_R0C: - str.printf("%02X%02X%02X%02X", m_reg[0x0C], m_reg[0x0D], m_reg[0x0E], m_reg[0x0F]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x0C], m_reg[0x0D], m_reg[0x0E], m_reg[0x0F]); break; case HCD62121_R10: - str.printf("%02X%02X%02X%02X", m_reg[0x10], m_reg[0x11], m_reg[0x12], m_reg[0x13]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x10], m_reg[0x11], m_reg[0x12], m_reg[0x13]); break; case HCD62121_R14: - str.printf("%02X%02X%02X%02X", m_reg[0x14], m_reg[0x15], m_reg[0x16], m_reg[0x17]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x14], m_reg[0x15], m_reg[0x16], m_reg[0x17]); break; case HCD62121_R18: - str.printf("%02X%02X%02X%02X", m_reg[0x18], m_reg[0x19], m_reg[0x1A], m_reg[0x1B]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x18], m_reg[0x19], m_reg[0x1A], m_reg[0x1B]); break; case HCD62121_R1C: - str.printf("%02X%02X%02X%02X", m_reg[0x1C], m_reg[0x1D], m_reg[0x1E], m_reg[0x1F]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x1C], m_reg[0x1D], m_reg[0x1E], m_reg[0x1F]); break; case HCD62121_R20: - str.printf("%02X%02X%02X%02X", m_reg[0x20], m_reg[0x21], m_reg[0x22], m_reg[0x23]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x20], m_reg[0x21], m_reg[0x22], m_reg[0x23]); break; case HCD62121_R24: - str.printf("%02X%02X%02X%02X", m_reg[0x24], m_reg[0x25], m_reg[0x26], m_reg[0x27]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x24], m_reg[0x25], m_reg[0x26], m_reg[0x27]); break; case HCD62121_R28: - str.printf("%02X%02X%02X%02X", m_reg[0x28], m_reg[0x29], m_reg[0x2A], m_reg[0x2B]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x28], m_reg[0x29], m_reg[0x2A], m_reg[0x2B]); break; case HCD62121_R2C: - str.printf("%02X%02X%02X%02X", m_reg[0x2C], m_reg[0x2D], m_reg[0x2E], m_reg[0x2F]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x2C], m_reg[0x2D], m_reg[0x2E], m_reg[0x2F]); break; case HCD62121_R30: - str.printf("%02X%02X%02X%02X", m_reg[0x30], m_reg[0x31], m_reg[0x32], m_reg[0x33]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x30], m_reg[0x31], m_reg[0x32], m_reg[0x33]); break; case HCD62121_R34: - str.printf("%02X%02X%02X%02X", m_reg[0x34], m_reg[0x35], m_reg[0x36], m_reg[0x37]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x34], m_reg[0x35], m_reg[0x36], m_reg[0x37]); break; case HCD62121_R38: - str.printf("%02X%02X%02X%02X", m_reg[0x38], m_reg[0x39], m_reg[0x3A], m_reg[0x3B]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x38], m_reg[0x39], m_reg[0x3A], m_reg[0x3B]); break; case HCD62121_R3C: - str.printf("%02X%02X%02X%02X", m_reg[0x3C], m_reg[0x3D], m_reg[0x3E], m_reg[0x3F]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x3C], m_reg[0x3D], m_reg[0x3E], m_reg[0x3F]); break; case HCD62121_R40: - str.printf("%02X%02X%02X%02X", m_reg[0x40], m_reg[0x41], m_reg[0x42], m_reg[0x43]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x40], m_reg[0x41], m_reg[0x42], m_reg[0x43]); break; case HCD62121_R44: - str.printf("%02X%02X%02X%02X", m_reg[0x44], m_reg[0x45], m_reg[0x46], m_reg[0x47]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x44], m_reg[0x45], m_reg[0x46], m_reg[0x47]); break; case HCD62121_R48: - str.printf("%02X%02X%02X%02X", m_reg[0x48], m_reg[0x49], m_reg[0x4A], m_reg[0x4B]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x48], m_reg[0x49], m_reg[0x4A], m_reg[0x4B]); break; case HCD62121_R4C: - str.printf("%02X%02X%02X%02X", m_reg[0x4C], m_reg[0x4D], m_reg[0x4E], m_reg[0x4F]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x4C], m_reg[0x4D], m_reg[0x4E], m_reg[0x4F]); break; case HCD62121_R50: - str.printf("%02X%02X%02X%02X", m_reg[0x50], m_reg[0x51], m_reg[0x52], m_reg[0x53]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x50], m_reg[0x51], m_reg[0x52], m_reg[0x53]); break; case HCD62121_R54: - str.printf("%02X%02X%02X%02X", m_reg[0x54], m_reg[0x55], m_reg[0x56], m_reg[0x57]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x54], m_reg[0x55], m_reg[0x56], m_reg[0x57]); break; case HCD62121_R58: - str.printf("%02X%02X%02X%02X", m_reg[0x58], m_reg[0x59], m_reg[0x5A], m_reg[0x5B]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x58], m_reg[0x59], m_reg[0x5A], m_reg[0x5B]); break; case HCD62121_R5C: - str.printf("%02X%02X%02X%02X", m_reg[0x5C], m_reg[0x5D], m_reg[0x5E], m_reg[0x5F]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x5C], m_reg[0x5D], m_reg[0x5E], m_reg[0x5F]); break; case HCD62121_R60: - str.printf("%02X%02X%02X%02X", m_reg[0x60], m_reg[0x61], m_reg[0x62], m_reg[0x63]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x60], m_reg[0x61], m_reg[0x62], m_reg[0x63]); break; case HCD62121_R64: - str.printf("%02X%02X%02X%02X", m_reg[0x64], m_reg[0x65], m_reg[0x66], m_reg[0x67]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x64], m_reg[0x65], m_reg[0x66], m_reg[0x67]); break; case HCD62121_R68: - str.printf("%02X%02X%02X%02X", m_reg[0x68], m_reg[0x69], m_reg[0x6A], m_reg[0x6B]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x68], m_reg[0x69], m_reg[0x6A], m_reg[0x6B]); break; case HCD62121_R6C: - str.printf("%02X%02X%02X%02X", m_reg[0x6C], m_reg[0x6D], m_reg[0x6E], m_reg[0x6F]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x6C], m_reg[0x6D], m_reg[0x6E], m_reg[0x6F]); break; case HCD62121_R70: - str.printf("%02X%02X%02X%02X", m_reg[0x70], m_reg[0x71], m_reg[0x72], m_reg[0x73]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x70], m_reg[0x71], m_reg[0x72], m_reg[0x73]); break; case HCD62121_R74: - str.printf("%02X%02X%02X%02X", m_reg[0x74], m_reg[0x75], m_reg[0x76], m_reg[0x77]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x74], m_reg[0x75], m_reg[0x76], m_reg[0x77]); break; case HCD62121_R78: - str.printf("%02X%02X%02X%02X", m_reg[0x78], m_reg[0x79], m_reg[0x7A], m_reg[0x7B]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x78], m_reg[0x79], m_reg[0x7A], m_reg[0x7B]); break; case HCD62121_R7C: - str.printf("%02X%02X%02X%02X", m_reg[0x7C], m_reg[0x7D], m_reg[0x7E], m_reg[0x7F]); + strprintf(str, "%02X%02X%02X%02X", m_reg[0x7C], m_reg[0x7D], m_reg[0x7E], m_reg[0x7F]); break; } } diff --git a/src/emu/cpu/hcd62121/hcd62121.h b/src/emu/cpu/hcd62121/hcd62121.h index 938ba53f4d9..60a5f35c101 100644 --- a/src/emu/cpu/hcd62121/hcd62121.h +++ b/src/emu/cpu/hcd62121/hcd62121.h @@ -52,7 +52,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : NULL ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/hd61700/hd61700.c b/src/emu/cpu/hd61700/hd61700.c index a9b83620f33..9e8276c6bc0 100644 --- a/src/emu/cpu/hd61700/hd61700.c +++ b/src/emu/cpu/hd61700/hd61700.c @@ -183,8 +183,8 @@ void hd61700_cpu_device::device_start() for (int ireg=0; ireg<32; ireg++) { - astring tmpstr; - state_add(HD61700_MAINREG + ireg, tmpstr.format("R%d", ireg).c_str(), m_regmain[ireg]).callimport().callexport().formatstr("%02X"); + std::string tmpstr; + state_add(HD61700_MAINREG + ireg, strformat(tmpstr, "R%d", ireg).c_str(), m_regmain[ireg]).callimport().callexport().formatstr("%02X"); } state_add(STATE_GENPC, "curpc", m_curpc).callimport().callexport().formatstr("%8s").noshow(); @@ -271,12 +271,12 @@ void hd61700_cpu_device::state_import(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void hd61700_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void hd61700_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c", m_flags & FLAG_Z ? '.' : 'Z', m_flags & FLAG_C ? 'C' : '.', m_flags & FLAG_LZ ? '.' : 'L', diff --git a/src/emu/cpu/hd61700/hd61700.h b/src/emu/cpu/hd61700/hd61700.h index 445ae13b951..1b928e57922 100644 --- a/src/emu/cpu/hd61700/hd61700.h +++ b/src/emu/cpu/hd61700/hd61700.h @@ -92,7 +92,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_memory_interface overrides virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; } diff --git a/src/emu/cpu/hmcs40/hmcs40.c b/src/emu/cpu/hmcs40/hmcs40.c index 16d85efd6ad..f6ad44ee73e 100644 --- a/src/emu/cpu/hmcs40/hmcs40.c +++ b/src/emu/cpu/hmcs40/hmcs40.c @@ -144,12 +144,12 @@ hd44828_device::hd44828_device(const machine_config &mconfig, const char *tag, d // disasm -void hmcs40_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void hmcs40_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c", + strprintf(str, "%c%c", m_c ? 'C':'c', m_s ? 'S':'s' ); diff --git a/src/emu/cpu/hmcs40/hmcs40.h b/src/emu/cpu/hmcs40/hmcs40.h index cb5399137f7..b5967a4d640 100644 --- a/src/emu/cpu/hmcs40/hmcs40.h +++ b/src/emu/cpu/hmcs40/hmcs40.h @@ -159,7 +159,7 @@ protected: virtual UINT32 disasm_min_opcode_bytes() const { return 2; } virtual UINT32 disasm_max_opcode_bytes() const { return 2; } virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); address_space_config m_program_config; address_space_config m_data_config; diff --git a/src/emu/cpu/i386/i386.c b/src/emu/cpu/i386/i386.c index c473c82fc3c..589941d29d2 100644 --- a/src/emu/cpu/i386/i386.c +++ b/src/emu/cpu/i386/i386.c @@ -3468,60 +3468,60 @@ void i386_device::state_export(const device_state_entry &entry) } } -void i386_device::state_string_export(const device_state_entry &entry, astring &str) +void i386_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%08X", get_flags()); + strprintf(str, "%08X", get_flags()); break; case X87_ST0: - str.printf("%f", fx80_to_double(ST(0))); + strprintf(str, "%f", fx80_to_double(ST(0))); break; case X87_ST1: - str.printf("%f", fx80_to_double(ST(1))); + strprintf(str, "%f", fx80_to_double(ST(1))); break; case X87_ST2: - str.printf("%f", fx80_to_double(ST(2))); + strprintf(str, "%f", fx80_to_double(ST(2))); break; case X87_ST3: - str.printf("%f", fx80_to_double(ST(3))); + strprintf(str, "%f", fx80_to_double(ST(3))); break; case X87_ST4: - str.printf("%f", fx80_to_double(ST(4))); + strprintf(str, "%f", fx80_to_double(ST(4))); break; case X87_ST5: - str.printf("%f", fx80_to_double(ST(5))); + strprintf(str, "%f", fx80_to_double(ST(5))); break; case X87_ST6: - str.printf("%f", fx80_to_double(ST(6))); + strprintf(str, "%f", fx80_to_double(ST(6))); break; case X87_ST7: - str.printf("%f", fx80_to_double(ST(7))); + strprintf(str, "%f", fx80_to_double(ST(7))); break; case SSE_XMM0: - str.printf("%08x%08x%08x%08x", XMM(0).d[3], XMM(0).d[2], XMM(0).d[1], XMM(0).d[0]); + strprintf(str, "%08x%08x%08x%08x", XMM(0).d[3], XMM(0).d[2], XMM(0).d[1], XMM(0).d[0]); break; case SSE_XMM1: - str.printf("%08x%08x%08x%08x", XMM(1).d[3], XMM(1).d[2], XMM(1).d[1], XMM(1).d[0]); + strprintf(str, "%08x%08x%08x%08x", XMM(1).d[3], XMM(1).d[2], XMM(1).d[1], XMM(1).d[0]); break; case SSE_XMM2: - str.printf("%08x%08x%08x%08x", XMM(2).d[3], XMM(2).d[2], XMM(2).d[1], XMM(2).d[0]); + strprintf(str, "%08x%08x%08x%08x", XMM(2).d[3], XMM(2).d[2], XMM(2).d[1], XMM(2).d[0]); break; case SSE_XMM3: - str.printf("%08x%08x%08x%08x", XMM(3).d[3], XMM(3).d[2], XMM(3).d[1], XMM(3).d[0]); + strprintf(str, "%08x%08x%08x%08x", XMM(3).d[3], XMM(3).d[2], XMM(3).d[1], XMM(3).d[0]); break; case SSE_XMM4: - str.printf("%08x%08x%08x%08x", XMM(4).d[3], XMM(4).d[2], XMM(4).d[1], XMM(4).d[0]); + strprintf(str, "%08x%08x%08x%08x", XMM(4).d[3], XMM(4).d[2], XMM(4).d[1], XMM(4).d[0]); break; case SSE_XMM5: - str.printf("%08x%08x%08x%08x", XMM(5).d[3], XMM(5).d[2], XMM(5).d[1], XMM(5).d[0]); + strprintf(str, "%08x%08x%08x%08x", XMM(5).d[3], XMM(5).d[2], XMM(5).d[1], XMM(5).d[0]); break; case SSE_XMM6: - str.printf("%08x%08x%08x%08x", XMM(6).d[3], XMM(6).d[2], XMM(6).d[1], XMM(6).d[0]); + strprintf(str, "%08x%08x%08x%08x", XMM(6).d[3], XMM(6).d[2], XMM(6).d[1], XMM(6).d[0]); break; case SSE_XMM7: - str.printf("%08x%08x%08x%08x", XMM(7).d[3], XMM(7).d[2], XMM(7).d[1], XMM(7).d[0]); + strprintf(str, "%08x%08x%08x%08x", XMM(7).d[3], XMM(7).d[2], XMM(7).d[1], XMM(7).d[0]); break; } } diff --git a/src/emu/cpu/i386/i386.h b/src/emu/cpu/i386/i386.h index 4a9a9cfb613..5b2ed036b2a 100644 --- a/src/emu/cpu/i386/i386.h +++ b/src/emu/cpu/i386/i386.h @@ -58,7 +58,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/i4004/i4004.c b/src/emu/cpu/i4004/i4004.c index c219b402f45..23b1721df3a 100644 --- a/src/emu/cpu/i4004/i4004.c +++ b/src/emu/cpu/i4004/i4004.c @@ -419,15 +419,15 @@ void i4004_cpu_device::device_start() state_add(STATE_GENFLAGS, "GENFLAGS", m_flags).mask(0x0f).callimport().callexport().noshow().formatstr("%4s"); state_add(I4004_A, "A", m_A).mask(0x0f); - astring tempstr; + std::string tempstr; for (int regnum = 0; regnum < 8; regnum++) { - state_add(I4004_R01 + regnum, tempstr.format("R%X%X", regnum * 2, regnum * 2 + 1).c_str(), m_R[regnum]); + state_add(I4004_R01 + regnum, strformat(tempstr, "R%X%X", regnum * 2, regnum * 2 + 1).c_str(), m_R[regnum]); } for (int addrnum = 0; addrnum < 4; addrnum++) { - state_add(I4004_ADDR1 + addrnum, tempstr.format("ADDR%d", addrnum + 1).c_str(), m_ADDR[addrnum].w.l).mask(0xfff); + state_add(I4004_ADDR1 + addrnum, strformat(tempstr, "ADDR%d", addrnum + 1).c_str(), m_ADDR[addrnum].w.l).mask(0xfff); } state_add(I4004_RAM, "RAM", m_RAM.w.l).mask(0x0fff); @@ -507,12 +507,12 @@ void i4004_cpu_device::state_export(const device_state_entry &entry) } } -void i4004_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void i4004_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf(".%c%c%c", + strprintf(str, ".%c%c%c", (m_A==0) ? 'Z':'.', m_C ? 'C':'.', m_TEST ? 'T':'.'); diff --git a/src/emu/cpu/i4004/i4004.h b/src/emu/cpu/i4004/i4004.h index 1050ac2997e..956218f3723 100644 --- a/src/emu/cpu/i4004/i4004.h +++ b/src/emu/cpu/i4004/i4004.h @@ -57,7 +57,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/i8008/i8008.c b/src/emu/cpu/i8008/i8008.c index 066fddb4fd4..2bb5b9cf4b7 100644 --- a/src/emu/cpu/i8008/i8008.c +++ b/src/emu/cpu/i8008/i8008.c @@ -92,9 +92,9 @@ void i8008_device::device_start() state_add(I8008_H, "H", m_H); state_add(I8008_L, "L", m_L); - astring tempstr; + std::string tempstr; for (int addrnum = 0; addrnum < 8; addrnum++) - state_add(I8008_ADDR1 + addrnum, tempstr.format("ADDR%d", addrnum + 1).c_str(), m_ADDR[addrnum].w.l).mask(0xfff); + state_add(I8008_ADDR1 + addrnum, strformat(tempstr, "ADDR%d", addrnum + 1).c_str(), m_ADDR[addrnum].w.l).mask(0xfff); init_tables(); } @@ -187,12 +187,12 @@ void i8008_device::state_export(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void i8008_device::state_string_export(const device_state_entry &entry, astring &str) +void i8008_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c", + strprintf(str, "%c%c%c%c", m_CF ? 'C':'.', m_ZF ? 'Z':'.', m_SF ? 'S':'.', diff --git a/src/emu/cpu/i8008/i8008.h b/src/emu/cpu/i8008/i8008.h index 8d75cc90957..c9cbecce7aa 100644 --- a/src/emu/cpu/i8008/i8008.h +++ b/src/emu/cpu/i8008/i8008.h @@ -48,7 +48,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides diff --git a/src/emu/cpu/i8085/i8085.c b/src/emu/cpu/i8085/i8085.c index f3a768dddc9..ef44db0284f 100644 --- a/src/emu/cpu/i8085/i8085.c +++ b/src/emu/cpu/i8085/i8085.c @@ -1081,12 +1081,12 @@ void i8085a_cpu_device::state_export(const device_state_entry &entry) } } -void i8085a_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void i8085a_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", m_AF.b.l & 0x80 ? 'S':'.', m_AF.b.l & 0x40 ? 'Z':'.', m_AF.b.l & 0x20 ? 'X':'.', // X5 diff --git a/src/emu/cpu/i8085/i8085.h b/src/emu/cpu/i8085/i8085.h index 437d085cb67..63b340ddadd 100644 --- a/src/emu/cpu/i8085/i8085.h +++ b/src/emu/cpu/i8085/i8085.h @@ -82,7 +82,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : NULL ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); void state_export(const device_state_entry &entry); void state_import(const device_state_entry &entry); diff --git a/src/emu/cpu/i8089/i8089.c b/src/emu/cpu/i8089/i8089.c index d318dc6ce6c..03d5d9d2856 100644 --- a/src/emu/cpu/i8089/i8089.c +++ b/src/emu/cpu/i8089/i8089.c @@ -159,7 +159,7 @@ offs_t i8089_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *op // for the debugger //------------------------------------------------- -void i8089_device::state_string_export(const device_state_entry &entry, astring &str) +void i8089_device::state_string_export(const device_state_entry &entry, std::string &str) { i8089_channel *ch = m_ch1; @@ -169,30 +169,30 @@ void i8089_device::state_string_export(const device_state_entry &entry, astring switch (entry.index()) { case SYSBUS: - str.printf("%c", sysbus_width() ? 'W' : '.'); + strprintf(str, "%c", sysbus_width() ? 'W' : '.'); break; case SOC: - str.printf("%c%c", remotebus_width() ? 'I' : '.', request_grant() ? 'R' : '.'); + strprintf(str, "%c%c", remotebus_width() ? 'I' : '.', request_grant() ? 'R' : '.'); break; case CH1_GA: case CH2_GA: - str.printf("%d %05X", ch->m_r[i8089_channel::GA].t & 1, ch->m_r[i8089_channel::GA].w); + strprintf(str, "%d %05X", ch->m_r[i8089_channel::GA].t & 1, ch->m_r[i8089_channel::GA].w); break; case CH1_GB: case CH2_GB: - str.printf("%d %05X", ch->m_r[i8089_channel::GB].t & 1, ch->m_r[i8089_channel::GB].w); + strprintf(str, "%d %05X", ch->m_r[i8089_channel::GB].t & 1, ch->m_r[i8089_channel::GB].w); break; case CH1_GC: case CH2_GC: - str.printf("%d %05X", ch->m_r[i8089_channel::GC].t & 1, ch->m_r[i8089_channel::GC].w); + strprintf(str, "%d %05X", ch->m_r[i8089_channel::GC].t & 1, ch->m_r[i8089_channel::GC].w); break; case CH1_TP: case CH2_TP: - str.printf("%d %05X", ch->m_r[i8089_channel::TP].t & 1, ch->m_r[i8089_channel::TP].w); + strprintf(str, "%d %05X", ch->m_r[i8089_channel::TP].t & 1, ch->m_r[i8089_channel::TP].w); break; case CH1_PSW: case CH2_PSW: - str.printf("%c%s%c%s%s%s%c%c", + strprintf(str, "%c%s%c%s%s%s%c%c", BIT(ch->m_r[i8089_channel::PSW].w, 7) ? 'P':'.', BIT(ch->m_r[i8089_channel::PSW].w, 6) ? "XF":"..", BIT(ch->m_r[i8089_channel::PSW].w, 5) ? 'B':'.', diff --git a/src/emu/cpu/i8089/i8089.h b/src/emu/cpu/i8089/i8089.h index 403550d173c..4f325a7ac4e 100644 --- a/src/emu/cpu/i8089/i8089.h +++ b/src/emu/cpu/i8089/i8089.h @@ -89,7 +89,7 @@ protected: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // optional information overrides virtual machine_config_constructor device_mconfig_additions() const; diff --git a/src/emu/cpu/i86/i286.c b/src/emu/cpu/i86/i286.c index d645ed2cad3..763794cb69a 100644 --- a/src/emu/cpu/i86/i286.c +++ b/src/emu/cpu/i86/i286.c @@ -275,18 +275,18 @@ void i80286_cpu_device::device_start() m_out_shutdown_func.resolve_safe(); } -void i80286_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void i80286_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENPC: - str.printf("%08X", pc()); + strprintf(str, "%08X", pc()); break; case STATE_GENFLAGS: { UINT16 flags = CompressFlags(); - str.printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", flags & 0x8000 ? '0':'.', flags & 0x4000 ? 'N':'.', flags & 0x2000 ? 'I':'.', diff --git a/src/emu/cpu/i86/i286.h b/src/emu/cpu/i86/i286.h index 8d9f19fbe00..466c672ac78 100644 --- a/src/emu/cpu/i86/i286.h +++ b/src/emu/cpu/i86/i286.h @@ -75,7 +75,7 @@ protected: virtual void execute_run(); virtual void device_reset(); virtual void device_start(); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); virtual UINT32 execute_input_lines() const { return 1; } virtual void execute_set_input(int inputnum, int state); bool memory_translate(address_spacenum spacenum, int intention, offs_t &address); diff --git a/src/emu/cpu/i86/i86.c b/src/emu/cpu/i86/i86.c index 50c0c970ba9..3809610d819 100644 --- a/src/emu/cpu/i86/i86.c +++ b/src/emu/cpu/i86/i86.c @@ -310,18 +310,18 @@ i8086_common_cpu_device::i8086_common_cpu_device(const machine_config &mconfig, memset(m_sregs, 0x00, sizeof(m_sregs)); } -void i8086_common_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void i8086_common_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENPC: - str.printf("%08X", pc()); + strprintf(str, "%08X", pc()); break; case STATE_GENFLAGS: { UINT16 flags = CompressFlags(); - str.printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", flags & 0x8000 ? '1':'.', flags & 0x4000 ? '1':'.', flags & 0x2000 ? '1':'.', diff --git a/src/emu/cpu/i86/i86.h b/src/emu/cpu/i86/i86.h index 7868d49de0e..8c0618e10d5 100644 --- a/src/emu/cpu/i86/i86.h +++ b/src/emu/cpu/i86/i86.h @@ -118,7 +118,7 @@ protected: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); virtual void interrupt(int int_num, int trap = 1); bool common_op(UINT8 op); diff --git a/src/emu/cpu/i960/i960.c b/src/emu/cpu/i960/i960.c index d8d6dac6434..a704a964cd9 100644 --- a/src/emu/cpu/i960/i960.c +++ b/src/emu/cpu/i960/i960.c @@ -2078,7 +2078,7 @@ void i960_cpu_device::device_start() m_icountptr = &m_icount; } -void i960_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void i960_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { static const char *const conditions[8] = { @@ -2088,7 +2088,7 @@ void i960_cpu_device::state_string_export(const device_state_entry &entry, astri switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%s", conditions[m_AC & 7]); + strprintf(str, "%s", conditions[m_AC & 7]); break; } } diff --git a/src/emu/cpu/i960/i960.h b/src/emu/cpu/i960/i960.h index b4e4cfc86f8..c8f791a73a7 100644 --- a/src/emu/cpu/i960/i960.h +++ b/src/emu/cpu/i960/i960.h @@ -93,7 +93,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 4; } diff --git a/src/emu/cpu/ie15/ie15.c b/src/emu/cpu/ie15/ie15.c index c41cffd223c..03e1f0a91ee 100644 --- a/src/emu/cpu/ie15/ie15.c +++ b/src/emu/cpu/ie15/ie15.c @@ -62,9 +62,9 @@ void ie15_device::device_start() state_add(STATE_GENFLAGS,"GENFLAGS", m_flags).mask(0x0f).callimport().callexport().noshow().formatstr("%4s"); state_add(IE15_A, "A", m_A); - astring tempstring; + std::string tempstring; for (int ireg = 0; ireg < 32; ireg++) - state_add(IE15_R0 + ireg, tempstring.format("R%d", ireg).c_str(), m_REGS[ireg]); + state_add(IE15_R0 + ireg, strformat(tempstring, "R%d", ireg).c_str(), m_REGS[ireg]); } //------------------------------------------------- @@ -131,12 +131,12 @@ void ie15_device::state_export(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void ie15_device::state_string_export(const device_state_entry &entry, astring &str) +void ie15_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c", + strprintf(str, "%c%c%c", m_CF ? 'C':'.', m_ZF ? 'Z':'.', m_RF ? 'R':'.'); diff --git a/src/emu/cpu/ie15/ie15.h b/src/emu/cpu/ie15/ie15.h index d4fa943418e..efaeb2bb167 100644 --- a/src/emu/cpu/ie15/ie15.h +++ b/src/emu/cpu/ie15/ie15.h @@ -46,7 +46,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const; diff --git a/src/emu/cpu/jaguar/jaguar.c b/src/emu/cpu/jaguar/jaguar.c index dc7f10a1531..6c1dd97b821 100644 --- a/src/emu/cpu/jaguar/jaguar.c +++ b/src/emu/cpu/jaguar/jaguar.c @@ -403,12 +403,12 @@ void jaguar_cpu_device::device_start() } -void jaguar_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void jaguar_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c%c%c%c", FLAGS & 0x8000 ? 'D':'.', FLAGS & 0x4000 ? 'A':'.', FLAGS & 0x0100 ? '4':'.', diff --git a/src/emu/cpu/jaguar/jaguar.h b/src/emu/cpu/jaguar/jaguar.h index 6e9a9c017aa..5139158861b 100644 --- a/src/emu/cpu/jaguar/jaguar.h +++ b/src/emu/cpu/jaguar/jaguar.h @@ -127,7 +127,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 2; } diff --git a/src/emu/cpu/lc8670/lc8670.c b/src/emu/cpu/lc8670/lc8670.c index 99f1119ae49..ac1fd1960d1 100644 --- a/src/emu/cpu/lc8670/lc8670.c +++ b/src/emu/cpu/lc8670/lc8670.c @@ -369,12 +369,12 @@ void lc8670_cpu_device::state_import(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void lc8670_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void lc8670_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%s%s%s%s", + strprintf(str, "%s%s%s%s", GET_CY ? "CY" : "..", GET_AC ? "AC" : "..", GET_OV ? "OV" : "..", diff --git a/src/emu/cpu/lc8670/lc8670.h b/src/emu/cpu/lc8670/lc8670.h index 4a27c871f03..e2668c1bacd 100644 --- a/src/emu/cpu/lc8670/lc8670.h +++ b/src/emu/cpu/lc8670/lc8670.h @@ -110,7 +110,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_memory_interface overrides virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; diff --git a/src/emu/cpu/lh5801/lh5801.c b/src/emu/cpu/lh5801/lh5801.c index c3dba6be253..de02d12e49d 100644 --- a/src/emu/cpu/lh5801/lh5801.c +++ b/src/emu/cpu/lh5801/lh5801.c @@ -154,12 +154,12 @@ void lh5801_cpu_device::device_start() m_icountptr = &m_icount; } -void lh5801_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void lh5801_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", m_t&0x80?'1':'0', m_t&0x40?'1':'0', m_t&0x20?'1':'0', diff --git a/src/emu/cpu/lh5801/lh5801.h b/src/emu/cpu/lh5801/lh5801.h index 303a0fd8c2a..9ad564b1bab 100644 --- a/src/emu/cpu/lh5801/lh5801.h +++ b/src/emu/cpu/lh5801/lh5801.h @@ -101,7 +101,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : NULL ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/lr35902/lr35902.c b/src/emu/cpu/lr35902/lr35902.c index d78a59a7344..4b34883c4b5 100644 --- a/src/emu/cpu/lr35902/lr35902.c +++ b/src/emu/cpu/lr35902/lr35902.c @@ -178,16 +178,16 @@ void lr35902_cpu_device::device_start() } -void lr35902_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void lr35902_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case LR35902_SPEED: - str.printf("%02X", 0x7E | ((m_gb_speed - 1) << 7) | m_gb_speed_change_pending); + strprintf(str, "%02X", 0x7E | ((m_gb_speed - 1) << 7) | m_gb_speed_change_pending); break; case STATE_GENFLAGS: - str.printf("%c%c%c%c", + strprintf(str, "%c%c%c%c", m_F & FLAG_Z ? 'Z' : '.', m_F & FLAG_N ? 'N' : '.', m_F & FLAG_H ? 'H' : '.', diff --git a/src/emu/cpu/lr35902/lr35902.h b/src/emu/cpu/lr35902/lr35902.h index e2592388627..6e466f58171 100644 --- a/src/emu/cpu/lr35902/lr35902.h +++ b/src/emu/cpu/lr35902/lr35902.h @@ -68,7 +68,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/m37710/m37710.c b/src/emu/cpu/m37710/m37710.c index 73d41bdd402..454ee2a435e 100644 --- a/src/emu/cpu/m37710/m37710.c +++ b/src/emu/cpu/m37710/m37710.c @@ -1134,12 +1134,12 @@ void m37710_cpu_device::state_export(const device_state_entry &entry) } -void m37710_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void m37710_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", m_flag_n & NFLAG_SET ? 'N':'.', m_flag_v & VFLAG_SET ? 'V':'.', m_flag_m & MFLAG_SET ? 'M':'.', diff --git a/src/emu/cpu/m37710/m37710.h b/src/emu/cpu/m37710/m37710.h index 58e7d6d1b0a..118ea8af909 100644 --- a/src/emu/cpu/m37710/m37710.h +++ b/src/emu/cpu/m37710/m37710.h @@ -115,7 +115,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/m6502/m6502.c b/src/emu/cpu/m6502/m6502.c index 90e738cf844..6368b6b991f 100644 --- a/src/emu/cpu/m6502/m6502.c +++ b/src/emu/cpu/m6502/m6502.c @@ -456,12 +456,12 @@ void m6502_device::state_export(const device_state_entry &entry) { } -void m6502_device::state_string_export(const device_state_entry &entry, astring &str) +void m6502_device::state_string_export(const device_state_entry &entry, std::string &str) { switch(entry.index()) { case STATE_GENFLAGS: case M6502_P: - str.printf("%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c", P & F_N ? 'N' : '.', P & F_V ? 'V' : '.', P & F_D ? 'D' : '.', diff --git a/src/emu/cpu/m6502/m6502.h b/src/emu/cpu/m6502/m6502.h index 2fe03782d29..db277522dc8 100644 --- a/src/emu/cpu/m6502/m6502.h +++ b/src/emu/cpu/m6502/m6502.h @@ -173,7 +173,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const; diff --git a/src/emu/cpu/m6502/m65ce02.c b/src/emu/cpu/m6502/m65ce02.c index cb3bb9a1651..0788683264a 100644 --- a/src/emu/cpu/m6502/m65ce02.c +++ b/src/emu/cpu/m6502/m65ce02.c @@ -104,12 +104,12 @@ void m65ce02_device::state_export(const device_state_entry &entry) { } -void m65ce02_device::state_string_export(const device_state_entry &entry, astring &str) +void m65ce02_device::state_string_export(const device_state_entry &entry, std::string &str) { switch(entry.index()) { case STATE_GENFLAGS: case M6502_P: - str.printf("%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c", P & F_N ? 'N' : '.', P & F_V ? 'V' : '.', P & F_E ? 'E' : '.', @@ -119,7 +119,7 @@ void m65ce02_device::state_string_export(const device_state_entry &entry, astrin P & F_C ? 'C' : '.'); break; case M65CE02_B: - str.printf("%02x", B >> 8); + strprintf(str, "%02x", B >> 8); break; } } diff --git a/src/emu/cpu/m6502/m65ce02.h b/src/emu/cpu/m6502/m65ce02.h index df715d72e9c..df0f1fbd996 100644 --- a/src/emu/cpu/m6502/m65ce02.h +++ b/src/emu/cpu/m6502/m65ce02.h @@ -63,7 +63,7 @@ protected: virtual void device_reset(); virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); inline void dec_SP_ce() { if(P & F_E) SP = set_l(SP, SP-1); else SP--; } inline void inc_SP_ce() { if(P & F_E) SP = set_l(SP, SP+1); else SP++; } diff --git a/src/emu/cpu/m6502/m740.c b/src/emu/cpu/m6502/m740.c index 330eff9f378..fc8b245b761 100644 --- a/src/emu/cpu/m6502/m740.c +++ b/src/emu/cpu/m6502/m740.c @@ -82,12 +82,12 @@ void m740_device::device_reset() SP = 0x00ff; } -void m740_device::state_string_export(const device_state_entry &entry, astring &str) +void m740_device::state_string_export(const device_state_entry &entry, std::string &str) { switch(entry.index()) { case STATE_GENFLAGS: case M6502_P: - str.printf("%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c", P & F_N ? 'N' : '.', P & F_V ? 'V' : '.', P & F_T ? 'T' : '.', diff --git a/src/emu/cpu/m6502/m740.h b/src/emu/cpu/m6502/m740.h index 29e690018db..232e661c755 100644 --- a/src/emu/cpu/m6502/m740.h +++ b/src/emu/cpu/m6502/m740.h @@ -73,7 +73,7 @@ public: static const disasm_entry disasm_entries[0x200]; - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); virtual void do_exec_full(); diff --git a/src/emu/cpu/m6800/m6800.c b/src/emu/cpu/m6800/m6800.c index e6d60ed56b8..56d456cfd81 100644 --- a/src/emu/cpu/m6800/m6800.c +++ b/src/emu/cpu/m6800/m6800.c @@ -1123,12 +1123,12 @@ void m6800_cpu_device::device_start() m_icountptr = &m_icount; } -void m6800_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void m6800_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", m_cc & 0x80 ? '?':'.', m_cc & 0x40 ? '?':'.', m_cc & 0x20 ? 'H':'.', diff --git a/src/emu/cpu/m6800/m6800.h b/src/emu/cpu/m6800/m6800.h index b3f458eb0a7..dcd343c19f4 100644 --- a/src/emu/cpu/m6800/m6800.h +++ b/src/emu/cpu/m6800/m6800.h @@ -85,7 +85,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO && m_has_io) ? &m_io_config : NULL ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/m68000/m68000.h b/src/emu/cpu/m68000/m68000.h index 39ec43d96e7..29665c107b5 100644 --- a/src/emu/cpu/m68000/m68000.h +++ b/src/emu/cpu/m68000/m68000.h @@ -398,7 +398,7 @@ public: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_memory_interface overrides virtual bool memory_translate(address_spacenum space, int intention, offs_t &address); diff --git a/src/emu/cpu/m68000/m68kcpu.c b/src/emu/cpu/m68000/m68kcpu.c index 269eae5b829..16af2ba8e1e 100644 --- a/src/emu/cpu/m68000/m68kcpu.c +++ b/src/emu/cpu/m68000/m68kcpu.c @@ -1173,47 +1173,47 @@ void m68000_base_device::state_export(const device_state_entry &entry) } } -void m68000_base_device::state_string_export(const device_state_entry &entry, astring &str) +void m68000_base_device::state_string_export(const device_state_entry &entry, std::string &str) { UINT16 sr; switch (entry.index()) { case M68K_FP0: - str.printf("%f", fx80_to_double(REG_FP(this)[0])); + strprintf(str,"%f", fx80_to_double(REG_FP(this)[0])); break; case M68K_FP1: - str.printf("%f", fx80_to_double(REG_FP(this)[1])); + strprintf(str,"%f", fx80_to_double(REG_FP(this)[1])); break; case M68K_FP2: - str.printf("%f", fx80_to_double(REG_FP(this)[2])); + strprintf(str,"%f", fx80_to_double(REG_FP(this)[2])); break; case M68K_FP3: - str.printf("%f", fx80_to_double(REG_FP(this)[3])); + strprintf(str,"%f", fx80_to_double(REG_FP(this)[3])); break; case M68K_FP4: - str.printf("%f", fx80_to_double(REG_FP(this)[4])); + strprintf(str,"%f", fx80_to_double(REG_FP(this)[4])); break; case M68K_FP5: - str.printf("%f", fx80_to_double(REG_FP(this)[5])); + strprintf(str,"%f", fx80_to_double(REG_FP(this)[5])); break; case M68K_FP6: - str.printf("%f", fx80_to_double(REG_FP(this)[6])); + strprintf(str,"%f", fx80_to_double(REG_FP(this)[6])); break; case M68K_FP7: - str.printf("%f", fx80_to_double(REG_FP(this)[7])); + strprintf(str,"%f", fx80_to_double(REG_FP(this)[7])); break; case STATE_GENFLAGS: sr = m68ki_get_sr(this); - str.printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", + strprintf(str,"%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", sr & 0x8000 ? 'T':'.', sr & 0x4000 ? 't':'.', sr & 0x2000 ? 'S':'.', @@ -1737,11 +1737,15 @@ void m68000_base_device::define_state(void) state_add(M68K_MSP, "MSP", iotemp).callimport().callexport(); state_add(M68K_ISP, "ISP", iotemp).callimport().callexport(); - astring tempstr; - for (int regnum = 0; regnum < 8; regnum++) - state_add(M68K_D0 + regnum, tempstr.format("D%d", regnum).c_str(), dar[regnum]); - for (int regnum = 0; regnum < 8; regnum++) - state_add(M68K_A0 + regnum, tempstr.format("A%d", regnum).c_str(), dar[8 + regnum]); + std::string tempstr; + for (int regnum = 0; regnum < 8; regnum++) { + strprintf(tempstr,"D%d", regnum); + state_add(M68K_D0 + regnum, tempstr.c_str(), dar[regnum]); + } + for (int regnum = 0; regnum < 8; regnum++) { + strprintf(tempstr,"A%d", regnum); + state_add(M68K_A0 + regnum, tempstr.c_str(), dar[8 + regnum]); + } state_add(M68K_PREF_ADDR, "PREF_ADDR", pref_addr).mask(addrmask); state_add(M68K_PREF_DATA, "PREF_DATA", pref_data); @@ -1761,8 +1765,10 @@ void m68000_base_device::define_state(void) if (cpu_type & MASK_030_OR_LATER) { - for (int regnum = 0; regnum < 8; regnum++) - state_add(M68K_FP0 + regnum, tempstr.format("FP%d", regnum).c_str(), iotemp).callimport().callexport().formatstr("%10s"); + for (int regnum = 0; regnum < 8; regnum++) { + strprintf(tempstr,"FP%d", regnum); + state_add(M68K_FP0 + regnum, tempstr.c_str(), iotemp).callimport().callexport().formatstr("%10s"); + } state_add(M68K_FPSR, "FPSR", fpsr); state_add(M68K_FPCR, "FPCR", fpcr); } diff --git a/src/emu/cpu/m6805/m6805.c b/src/emu/cpu/m6805/m6805.c index f02b2ca4f09..1c7ed46056c 100644 --- a/src/emu/cpu/m6805/m6805.c +++ b/src/emu/cpu/m6805/m6805.c @@ -422,7 +422,7 @@ void m6805_base_device::device_start() m_icountptr = &m_icount; // register our state for the debugger - astring tempstr; + std::string tempstr; state_add(STATE_GENPC, "GENPC", m_pc.w.l).noshow(); state_add(STATE_GENFLAGS, "GENFLAGS", m_cc).callimport().callexport().formatstr("%8s").noshow(); state_add(M6805_A, "A", m_a).mask(0xff); @@ -492,12 +492,12 @@ const address_space_config *m6805_base_device::memory_space_config(address_space // for the debugger //------------------------------------------------- -void m6805_base_device::state_string_export(const device_state_entry &entry, astring &str) +void m6805_base_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", (m_cc & 0x80) ? '?' : '.', (m_cc & 0x40) ? '?' : '.', (m_cc & 0x20) ? '?' : '.', diff --git a/src/emu/cpu/m6805/m6805.h b/src/emu/cpu/m6805/m6805.h index 49bd1f3cdea..8f40ed83c5b 100644 --- a/src/emu/cpu/m6805/m6805.h +++ b/src/emu/cpu/m6805/m6805.h @@ -49,7 +49,7 @@ protected: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); private: // opcode/condition tables diff --git a/src/emu/cpu/m6809/m6809.c b/src/emu/cpu/m6809/m6809.c index bca2f14aaad..df89f3951bb 100644 --- a/src/emu/cpu/m6809/m6809.c +++ b/src/emu/cpu/m6809/m6809.c @@ -127,7 +127,6 @@ void m6809_base_device::device_start() m_lic_func.resolve_safe(); // register our state for the debugger - astring tempstr; state_add(STATE_GENPC, "GENPC", m_pc.w).noshow(); state_add(STATE_GENPCBASE, "GENPCBASE", m_ppc.w).noshow(); state_add(STATE_GENFLAGS, "GENFLAGS", m_cc).callimport().callexport().formatstr("%8s").noshow(); @@ -292,12 +291,12 @@ const address_space_config *m6809_base_device::memory_space_config(address_space // for the debugger //------------------------------------------------- -void m6809_base_device::state_string_export(const device_state_entry &entry, astring &str) +void m6809_base_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", (m_cc & 0x80) ? 'E' : '.', (m_cc & 0x40) ? 'F' : '.', (m_cc & 0x20) ? 'H' : '.', diff --git a/src/emu/cpu/m6809/m6809.h b/src/emu/cpu/m6809/m6809.h index aba8a0775e1..805be7be9cf 100644 --- a/src/emu/cpu/m6809/m6809.h +++ b/src/emu/cpu/m6809/m6809.h @@ -61,7 +61,7 @@ protected: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // addressing modes enum diff --git a/src/emu/cpu/mb86233/mb86233.c b/src/emu/cpu/mb86233/mb86233.c index c2961d95cac..886f4a12496 100644 --- a/src/emu/cpu/mb86233/mb86233.c +++ b/src/emu/cpu/mb86233/mb86233.c @@ -158,12 +158,12 @@ void mb86233_cpu_device::device_start() } -void mb86233_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void mb86233_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c", (m_sr & SIGN_FLAG) ? 'N' : 'n', (m_sr & ZERO_FLAG) ? 'Z' : 'z'); + strprintf(str, "%c%c", (m_sr & SIGN_FLAG) ? 'N' : 'n', (m_sr & ZERO_FLAG) ? 'Z' : 'z'); break; } } diff --git a/src/emu/cpu/mb86233/mb86233.h b/src/emu/cpu/mb86233/mb86233.h index 5732cd3546c..d800e3ea49a 100644 --- a/src/emu/cpu/mb86233/mb86233.h +++ b/src/emu/cpu/mb86233/mb86233.h @@ -72,7 +72,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_DATA) ? &m_data_config : NULL ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 4; } diff --git a/src/emu/cpu/mb86235/mb86235.c b/src/emu/cpu/mb86235/mb86235.c index 02d9b70eb83..891f9746a91 100644 --- a/src/emu/cpu/mb86235/mb86235.c +++ b/src/emu/cpu/mb86235/mb86235.c @@ -108,12 +108,12 @@ mb86235_cpu_device::mb86235_cpu_device(const machine_config &mconfig, const char } -void mb86235_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void mb86235_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c", + strprintf(str, "%c%c%c%c", m_flags & 0x80 ? 'S':'.', m_flags & 0x40 ? 'Z':'.', m_flags & 0x20 ? 'V':'.', diff --git a/src/emu/cpu/mb86235/mb86235.h b/src/emu/cpu/mb86235/mb86235.h index a53448bf65d..1a6d4c81a4b 100644 --- a/src/emu/cpu/mb86235/mb86235.h +++ b/src/emu/cpu/mb86235/mb86235.h @@ -42,7 +42,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 8; } diff --git a/src/emu/cpu/mb88xx/mb88xx.c b/src/emu/cpu/mb88xx/mb88xx.c index c724dfdcc08..6015091562d 100644 --- a/src/emu/cpu/mb88xx/mb88xx.c +++ b/src/emu/cpu/mb88xx/mb88xx.c @@ -267,12 +267,12 @@ void mb88_cpu_device::state_export(const device_state_entry &entry) } -void mb88_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void mb88_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c", TEST_ST() ? 'T' : 't', TEST_ZF() ? 'Z' : 'z', TEST_CF() ? 'C' : 'c', diff --git a/src/emu/cpu/mb88xx/mb88xx.h b/src/emu/cpu/mb88xx/mb88xx.h index c770dcdd6f9..56ee148181e 100644 --- a/src/emu/cpu/mb88xx/mb88xx.h +++ b/src/emu/cpu/mb88xx/mb88xx.h @@ -88,7 +88,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_DATA) ? &m_data_config : ( (spacenum == AS_IO) ? &m_io_config : NULL ) ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); void state_import(const device_state_entry &entry); void state_export(const device_state_entry &entry); diff --git a/src/emu/cpu/mc68hc11/mc68hc11.c b/src/emu/cpu/mc68hc11/mc68hc11.c index c0496c04d03..1f475beb8ba 100644 --- a/src/emu/cpu/mc68hc11/mc68hc11.c +++ b/src/emu/cpu/mc68hc11/mc68hc11.c @@ -448,12 +448,12 @@ void mc68hc11_cpu_device::device_start() } -void mc68hc11_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void mc68hc11_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", (m_ccr & CC_S) ? 'S' : '.', (m_ccr & CC_X) ? 'X' : '.', (m_ccr & CC_H) ? 'H' : '.', diff --git a/src/emu/cpu/mc68hc11/mc68hc11.h b/src/emu/cpu/mc68hc11/mc68hc11.h index 999a40524d0..dddd9f00a55 100644 --- a/src/emu/cpu/mc68hc11/mc68hc11.h +++ b/src/emu/cpu/mc68hc11/mc68hc11.h @@ -68,7 +68,7 @@ protected: } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/mcs48/mcs48.c b/src/emu/cpu/mcs48/mcs48.c index e3cd5a1b716..303745e444e 100644 --- a/src/emu/cpu/mcs48/mcs48.c +++ b/src/emu/cpu/mcs48/mcs48.c @@ -976,10 +976,11 @@ void mcs48_cpu_device::device_start() state_add(MCS48_P1, "P1", m_p1); state_add(MCS48_P2, "P2", m_p2); - astring tempstr; - for (int regnum = 0; regnum < 8; regnum++) - state_add(MCS48_R0 + regnum, tempstr.format("R%d", regnum).c_str(), m_rtemp).callimport().callexport(); - + std::string tempstr; + for (int regnum = 0; regnum < 8; regnum++) { + strprintf(tempstr, "R%d", regnum); + state_add(MCS48_R0 + regnum, tempstr.c_str(), m_rtemp).callimport().callexport(); + } state_add(MCS48_EA, "EA", m_ea).mask(0x1); if (m_feature_mask & UPI41_FEATURE) @@ -1295,12 +1296,12 @@ void mcs48_cpu_device::state_export(const device_state_entry &entry) } } -void mcs48_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void mcs48_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c %c%c%c%c%c%c%c%c", + strprintf(str, "%c%c %c%c%c%c%c%c%c%c", m_irq_state ? 'I':'.', m_a11 ? 'M':'.', m_psw & 0x80 ? 'C':'.', diff --git a/src/emu/cpu/mcs48/mcs48.h b/src/emu/cpu/mcs48/mcs48.h index 655c8111f07..7bdc32e75e6 100644 --- a/src/emu/cpu/mcs48/mcs48.h +++ b/src/emu/cpu/mcs48/mcs48.h @@ -150,7 +150,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/mcs51/mcs51.c b/src/emu/cpu/mcs51/mcs51.c index ce53db78330..f03c7decdf6 100644 --- a/src/emu/cpu/mcs51/mcs51.c +++ b/src/emu/cpu/mcs51/mcs51.c @@ -2223,12 +2223,12 @@ void mcs51_cpu_device::state_export(const device_state_entry &entry) } } -void mcs51_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void mcs51_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str,"%c%c%c%c%c%c%c%c", PSW & 0x80 ? 'C':'.', PSW & 0x40 ? 'A':'.', PSW & 0x20 ? 'F':'.', diff --git a/src/emu/cpu/mcs51/mcs51.h b/src/emu/cpu/mcs51/mcs51.h index 27f4fedf842..efca4c8de16 100644 --- a/src/emu/cpu/mcs51/mcs51.h +++ b/src/emu/cpu/mcs51/mcs51.h @@ -119,7 +119,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/mcs96/mcs96.c b/src/emu/cpu/mcs96/mcs96.c index 942693b3088..b905c2db8b1 100644 --- a/src/emu/cpu/mcs96/mcs96.c +++ b/src/emu/cpu/mcs96/mcs96.c @@ -156,12 +156,12 @@ void mcs96_device::state_export(const device_state_entry &entry) { } -void mcs96_device::state_string_export(const device_state_entry &entry, astring &str) +void mcs96_device::state_string_export(const device_state_entry &entry, std::string &str) { switch(entry.index()) { case STATE_GENFLAGS: case MCS96_PSW: - str.printf("%c%c%c%c%c%c%c %c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c %c%c%c%c%c%c%c%c", PSW & F_Z ? 'Z' : '.', PSW & F_N ? 'N' : '.', PSW & F_V ? 'V' : '.', @@ -181,7 +181,7 @@ void mcs96_device::state_string_export(const device_state_entry &entry, astring } } -astring mcs96_device::regname(UINT8 reg) +std::string mcs96_device::regname(UINT8 reg) { char res[32]; switch(reg) { diff --git a/src/emu/cpu/mcs96/mcs96.h b/src/emu/cpu/mcs96/mcs96.h index d80dcf372c7..4858d455ce6 100644 --- a/src/emu/cpu/mcs96/mcs96.h +++ b/src/emu/cpu/mcs96/mcs96.h @@ -114,7 +114,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const; @@ -143,7 +143,7 @@ protected: virtual UINT16 io_r16(UINT8 adr) = 0; void recompute_bcount(UINT64 event_time); - static astring regname(UINT8 reg); + static std::string regname(UINT8 reg); inline void next(int cycles) { icount -= cycles_scaling*cycles; inst_state = STATE_FETCH; } inline void next_noirq(int cycles) { icount -= cycles_scaling*cycles; inst_state = STATE_FETCH_NOIRQ; } diff --git a/src/emu/cpu/minx/minx.c b/src/emu/cpu/minx/minx.c index 700de4bf874..85e450d5646 100644 --- a/src/emu/cpu/minx/minx.c +++ b/src/emu/cpu/minx/minx.c @@ -119,12 +119,12 @@ void minx_cpu_device::device_start() } -void minx_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void minx_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c-%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c-%c%c%c%c%c", m_F & FLAG_I ? 'I' : '.', m_F & FLAG_D ? 'D' : '.', m_F & FLAG_L ? 'L' : '.', diff --git a/src/emu/cpu/minx/minx.h b/src/emu/cpu/minx/minx.h index 3f833da028e..eb7dbe5e9e9 100644 --- a/src/emu/cpu/minx/minx.h +++ b/src/emu/cpu/minx/minx.h @@ -34,7 +34,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/mips/mips3.c b/src/emu/cpu/mips/mips3.c index 9baf8542c57..3ffdd64aac7 100644 --- a/src/emu/cpu/mips/mips3.c +++ b/src/emu/cpu/mips/mips3.c @@ -661,268 +661,268 @@ void mips3_device::state_export(const device_state_entry &entry) } -void mips3_device::state_string_export(const device_state_entry &entry, astring &str) +void mips3_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case MIPS3_FPS0: - str.printf("!%16g", *(float *)&m_core->cpr[1][0]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][0]); break; case MIPS3_FPD0: - str.printf("!%16g", *(double *)&m_core->cpr[1][0]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][0]); break; case MIPS3_FPS1: - str.printf("!%16g", *(float *)&m_core->cpr[1][1]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][1]); break; case MIPS3_FPD1: - str.printf("!%16g", *(double *)&m_core->cpr[1][1]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][1]); break; case MIPS3_FPS2: - str.printf("!%16g", *(float *)&m_core->cpr[1][2]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][2]); break; case MIPS3_FPD2: - str.printf("!%16g", *(double *)&m_core->cpr[1][2]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][2]); break; case MIPS3_FPS3: - str.printf("!%16g", *(float *)&m_core->cpr[1][3]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][3]); break; case MIPS3_FPD3: - str.printf("!%16g", *(double *)&m_core->cpr[1][3]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][3]); break; case MIPS3_FPS4: - str.printf("!%16g", *(float *)&m_core->cpr[1][4]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][4]); break; case MIPS3_FPD4: - str.printf("!%16g", *(double *)&m_core->cpr[1][4]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][4]); break; case MIPS3_FPS5: - str.printf("!%16g", *(float *)&m_core->cpr[1][5]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][5]); break; case MIPS3_FPD5: - str.printf("!%16g", *(double *)&m_core->cpr[1][5]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][5]); break; case MIPS3_FPS6: - str.printf("!%16g", *(float *)&m_core->cpr[1][6]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][6]); break; case MIPS3_FPD6: - str.printf("!%16g", *(double *)&m_core->cpr[1][6]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][6]); break; case MIPS3_FPS7: - str.printf("!%16g", *(float *)&m_core->cpr[1][7]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][7]); break; case MIPS3_FPD7: - str.printf("!%16g", *(double *)&m_core->cpr[1][7]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][7]); break; case MIPS3_FPS8: - str.printf("!%16g", *(float *)&m_core->cpr[1][8]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][8]); break; case MIPS3_FPD8: - str.printf("!%16g", *(double *)&m_core->cpr[1][8]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][8]); break; case MIPS3_FPS9: - str.printf("!%16g", *(float *)&m_core->cpr[1][9]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][9]); break; case MIPS3_FPD9: - str.printf("!%16g", *(double *)&m_core->cpr[1][9]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][9]); break; case MIPS3_FPS10: - str.printf("!%16g", *(float *)&m_core->cpr[1][10]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][10]); break; case MIPS3_FPD10: - str.printf("!%16g", *(double *)&m_core->cpr[1][10]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][10]); break; case MIPS3_FPS11: - str.printf("!%16g", *(float *)&m_core->cpr[1][11]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][11]); break; case MIPS3_FPD11: - str.printf("!%16g", *(double *)&m_core->cpr[1][11]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][11]); break; case MIPS3_FPS12: - str.printf("!%16g", *(float *)&m_core->cpr[1][12]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][12]); break; case MIPS3_FPD12: - str.printf("!%16g", *(double *)&m_core->cpr[1][12]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][12]); break; case MIPS3_FPS13: - str.printf("!%16g", *(float *)&m_core->cpr[1][13]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][13]); break; case MIPS3_FPD13: - str.printf("!%16g", *(double *)&m_core->cpr[1][13]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][13]); break; case MIPS3_FPS14: - str.printf("!%16g", *(float *)&m_core->cpr[1][14]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][14]); break; case MIPS3_FPD14: - str.printf("!%16g", *(double *)&m_core->cpr[1][14]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][14]); break; case MIPS3_FPS15: - str.printf("!%16g", *(float *)&m_core->cpr[1][15]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][15]); break; case MIPS3_FPD15: - str.printf("!%16g", *(double *)&m_core->cpr[1][15]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][15]); break; case MIPS3_FPS16: - str.printf("!%16g", *(float *)&m_core->cpr[1][16]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][16]); break; case MIPS3_FPD16: - str.printf("!%16g", *(double *)&m_core->cpr[1][16]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][16]); break; case MIPS3_FPS17: - str.printf("!%16g", *(float *)&m_core->cpr[1][17]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][17]); break; case MIPS3_FPD17: - str.printf("!%16g", *(double *)&m_core->cpr[1][17]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][17]); break; case MIPS3_FPS18: - str.printf("!%16g", *(float *)&m_core->cpr[1][18]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][18]); break; case MIPS3_FPD18: - str.printf("!%16g", *(double *)&m_core->cpr[1][18]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][18]); break; case MIPS3_FPS19: - str.printf("!%16g", *(float *)&m_core->cpr[1][19]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][19]); break; case MIPS3_FPD19: - str.printf("!%16g", *(double *)&m_core->cpr[1][19]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][19]); break; case MIPS3_FPS20: - str.printf("!%16g", *(float *)&m_core->cpr[1][20]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][20]); break; case MIPS3_FPD20: - str.printf("!%16g", *(double *)&m_core->cpr[1][20]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][20]); break; case MIPS3_FPS21: - str.printf("!%16g", *(float *)&m_core->cpr[1][21]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][21]); break; case MIPS3_FPD21: - str.printf("!%16g", *(double *)&m_core->cpr[1][21]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][21]); break; case MIPS3_FPS22: - str.printf("!%16g", *(float *)&m_core->cpr[1][22]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][22]); break; case MIPS3_FPD22: - str.printf("!%16g", *(double *)&m_core->cpr[1][22]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][22]); break; case MIPS3_FPS23: - str.printf("!%16g", *(float *)&m_core->cpr[1][23]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][23]); break; case MIPS3_FPD23: - str.printf("!%16g", *(double *)&m_core->cpr[1][23]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][23]); break; case MIPS3_FPS24: - str.printf("!%16g", *(float *)&m_core->cpr[1][24]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][24]); break; case MIPS3_FPD24: - str.printf("!%16g", *(double *)&m_core->cpr[1][24]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][24]); break; case MIPS3_FPS25: - str.printf("!%16g", *(float *)&m_core->cpr[1][25]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][25]); break; case MIPS3_FPD25: - str.printf("!%16g", *(double *)&m_core->cpr[1][25]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][25]); break; case MIPS3_FPS26: - str.printf("!%16g", *(float *)&m_core->cpr[1][26]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][26]); break; case MIPS3_FPD26: - str.printf("!%16g", *(double *)&m_core->cpr[1][26]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][26]); break; case MIPS3_FPS27: - str.printf("!%16g", *(float *)&m_core->cpr[1][27]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][27]); break; case MIPS3_FPD27: - str.printf("!%16g", *(double *)&m_core->cpr[1][27]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][27]); break; case MIPS3_FPS28: - str.printf("!%16g", *(float *)&m_core->cpr[1][28]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][28]); break; case MIPS3_FPD28: - str.printf("!%16g", *(double *)&m_core->cpr[1][28]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][28]); break; case MIPS3_FPS29: - str.printf("!%16g", *(float *)&m_core->cpr[1][29]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][29]); break; case MIPS3_FPD29: - str.printf("!%16g", *(double *)&m_core->cpr[1][29]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][29]); break; case MIPS3_FPS30: - str.printf("!%16g", *(float *)&m_core->cpr[1][30]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][30]); break; case MIPS3_FPD30: - str.printf("!%16g", *(double *)&m_core->cpr[1][30]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][30]); break; case MIPS3_FPS31: - str.printf("!%16g", *(float *)&m_core->cpr[1][31]); + strprintf(str, "!%16g", *(float *)&m_core->cpr[1][31]); break; case MIPS3_FPD31: - str.printf("!%16g", *(double *)&m_core->cpr[1][31]); + strprintf(str, "!%16g", *(double *)&m_core->cpr[1][31]); break; case STATE_GENFLAGS: - str.printf(" "); + strprintf(str, " "); break; } } diff --git a/src/emu/cpu/mips/mips3.h b/src/emu/cpu/mips/mips3.h index b9737128098..5d5d61354d7 100644 --- a/src/emu/cpu/mips/mips3.h +++ b/src/emu/cpu/mips/mips3.h @@ -320,7 +320,7 @@ protected: // device_state_interface overrides virtual void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 4; } diff --git a/src/emu/cpu/mips/r3000.c b/src/emu/cpu/mips/r3000.c index 4214857f5b9..5e6fa280884 100644 --- a/src/emu/cpu/mips/r3000.c +++ b/src/emu/cpu/mips/r3000.c @@ -443,7 +443,7 @@ void r3000_device::state_export(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void r3000_device::state_string_export(const device_state_entry &entry, astring &str) +void r3000_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { diff --git a/src/emu/cpu/mips/r3000.h b/src/emu/cpu/mips/r3000.h index cfcc4e1e0f1..da008d2b213 100644 --- a/src/emu/cpu/mips/r3000.h +++ b/src/emu/cpu/mips/r3000.h @@ -126,7 +126,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const; diff --git a/src/emu/cpu/mn10200/mn10200.c b/src/emu/cpu/mn10200/mn10200.c index 01c8f3ecdab..4456a65e70e 100644 --- a/src/emu/cpu/mn10200/mn10200.c +++ b/src/emu/cpu/mn10200/mn10200.c @@ -174,12 +174,12 @@ void mn10200_device::device_start() } -void mn10200_device::state_string_export(const device_state_entry &entry, astring &str) +void mn10200_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("S=%d irq=%s im=%d %c%c%c%c %c%c%c%c", + strprintf(str, "S=%d irq=%s im=%d %c%c%c%c %c%c%c%c", (m_psw >> 12) & 3, m_psw & FLAG_IE ? "on " : "off", (m_psw >> 8) & 7, diff --git a/src/emu/cpu/mn10200/mn10200.h b/src/emu/cpu/mn10200/mn10200.h index 712334e1d3b..d5e072e3844 100644 --- a/src/emu/cpu/mn10200/mn10200.h +++ b/src/emu/cpu/mn10200/mn10200.h @@ -86,7 +86,7 @@ protected: } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/nec/nec.c b/src/emu/cpu/nec/nec.c index ea1593f7a1c..de109bfa176 100644 --- a/src/emu/cpu/nec/nec.c +++ b/src/emu/cpu/nec/nec.c @@ -435,14 +435,14 @@ void nec_common_device::device_start() m_icountptr = &m_icount; } -void nec_common_device::state_string_export(const device_state_entry &entry, astring &str) +void nec_common_device::state_string_export(const device_state_entry &entry, std::string &str) { UINT16 flags = CompressFlags(); switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", flags & 0x8000 ? 'N':'E', flags & 0x4000 ? '?':'.', flags & 0x2000 ? '?':'.', diff --git a/src/emu/cpu/nec/nec.h b/src/emu/cpu/nec/nec.h index 6cf7c9c0554..8321fcde1af 100644 --- a/src/emu/cpu/nec/nec.h +++ b/src/emu/cpu/nec/nec.h @@ -40,7 +40,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : NULL); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); diff --git a/src/emu/cpu/nec/v25.c b/src/emu/cpu/nec/v25.c index 2b542b84f45..b4cb319e7f8 100644 --- a/src/emu/cpu/nec/v25.c +++ b/src/emu/cpu/nec/v25.c @@ -523,14 +523,14 @@ void v25_common_device::device_start() } -void v25_common_device::state_string_export(const device_state_entry &entry, astring &str) +void v25_common_device::state_string_export(const device_state_entry &entry, std::string &str) { UINT16 flags = CompressFlags(); switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c %d %c%c%c%c%c%c%c%c%c%c%c%c", + strprintf(str, "%c %d %c%c%c%c%c%c%c%c%c%c%c%c", flags & 0x8000 ? 'N':'S', (flags & 0x7000) >> 12, flags & 0x0800 ? 'O':'.', diff --git a/src/emu/cpu/nec/v25.h b/src/emu/cpu/nec/v25.h index 7f467d891f1..be67e7fe7c9 100644 --- a/src/emu/cpu/nec/v25.h +++ b/src/emu/cpu/nec/v25.h @@ -57,7 +57,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : NULL); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); diff --git a/src/emu/cpu/pdp1/pdp1.c b/src/emu/cpu/pdp1/pdp1.c index 96346ad71a7..c31313cf7b8 100644 --- a/src/emu/cpu/pdp1/pdp1.c +++ b/src/emu/cpu/pdp1/pdp1.c @@ -735,12 +735,12 @@ void pdp1_device::state_export(const device_state_entry &entry) } -void pdp1_device::state_string_export(const device_state_entry &entry, astring &str) +void pdp1_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c-%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c-%c%c%c%c%c%c", (FLAGS & 040) ? '1' : '.', (FLAGS & 020) ? '2' : '.', (FLAGS & 010) ? '3' : '.', diff --git a/src/emu/cpu/pdp1/pdp1.h b/src/emu/cpu/pdp1/pdp1.h index ba39bf8e4f7..d6b7fe1f2eb 100644 --- a/src/emu/cpu/pdp1/pdp1.h +++ b/src/emu/cpu/pdp1/pdp1.h @@ -105,7 +105,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 4; } diff --git a/src/emu/cpu/pic16c5x/pic16c5x.c b/src/emu/cpu/pic16c5x/pic16c5x.c index b1f9b2aefc6..78be71b5499 100644 --- a/src/emu/cpu/pic16c5x/pic16c5x.c +++ b/src/emu/cpu/pic16c5x/pic16c5x.c @@ -921,16 +921,16 @@ void pic16c5x_device::state_export(const device_state_entry &entry) } } -void pic16c5x_device::state_string_export(const device_state_entry &entry, astring &str) +void pic16c5x_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case PIC16C5x_PSCL: - str.printf("%c%02X", ((m_OPTION & 0x08) ? 'W' : 'T'), m_prescaler); + strprintf(str, "%c%02X", ((m_OPTION & 0x08) ? 'W' : 'T'), m_prescaler); break; case STATE_GENFLAGS: - str.printf("%01x%c%c%c%c%c %c%c%c%03x", + strprintf(str, "%01x%c%c%c%c%c %c%c%c%03x", (STATUS & 0xe0) >> 5, STATUS & 0x10 ? '.':'O', /* WDT Overflow */ STATUS & 0x08 ? 'P':'D', /* Power/Down */ diff --git a/src/emu/cpu/pic16c5x/pic16c5x.h b/src/emu/cpu/pic16c5x/pic16c5x.h index fbf3815281b..41b1bb9ebd8 100644 --- a/src/emu/cpu/pic16c5x/pic16c5x.h +++ b/src/emu/cpu/pic16c5x/pic16c5x.h @@ -115,7 +115,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 2; } diff --git a/src/emu/cpu/pic16c62x/pic16c62x.c b/src/emu/cpu/pic16c62x/pic16c62x.c index 403fdd9ac04..4f6fa19fc75 100644 --- a/src/emu/cpu/pic16c62x/pic16c62x.c +++ b/src/emu/cpu/pic16c62x/pic16c62x.c @@ -979,16 +979,16 @@ void pic16c62x_device::state_export(const device_state_entry &entry) } } -void pic16c62x_device::state_string_export(const device_state_entry &entry, astring &str) +void pic16c62x_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case PIC16C62x_PSCL: - str.printf("%c%02X", ((m_OPTION & 0x08) ? 'W' : 'T'), m_prescaler); + strprintf(str, "%c%02X", ((m_OPTION & 0x08) ? 'W' : 'T'), m_prescaler); break; case STATE_GENFLAGS: - str.printf("%01x%c%c%c%c%c %c%c%c%03x", + strprintf(str, "%01x%c%c%c%c%c %c%c%c%03x", (STATUS & 0xe0) >> 5, STATUS & 0x10 ? '.':'O', /* WDT Overflow */ STATUS & 0x08 ? 'P':'D', /* Power/Down */ diff --git a/src/emu/cpu/pic16c62x/pic16c62x.h b/src/emu/cpu/pic16c62x/pic16c62x.h index 6ba54df93be..55c6f963728 100644 --- a/src/emu/cpu/pic16c62x/pic16c62x.h +++ b/src/emu/cpu/pic16c62x/pic16c62x.h @@ -86,7 +86,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 2; } diff --git a/src/emu/cpu/powerpc/ppc.h b/src/emu/cpu/powerpc/ppc.h index f3ef96a7fce..9fe6bcb6fe1 100644 --- a/src/emu/cpu/powerpc/ppc.h +++ b/src/emu/cpu/powerpc/ppc.h @@ -265,7 +265,7 @@ protected: // device_state_interface overrides virtual void state_export(const device_state_entry &entry); virtual void state_import(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 4; } diff --git a/src/emu/cpu/powerpc/ppccom.c b/src/emu/cpu/powerpc/ppccom.c index 1c528b3204a..6f91b4a96e8 100644 --- a/src/emu/cpu/powerpc/ppccom.c +++ b/src/emu/cpu/powerpc/ppccom.c @@ -1007,136 +1007,136 @@ void ppc_device::state_import(const device_state_entry &entry) } -void ppc_device::state_string_export(const device_state_entry &entry, astring &str) +void ppc_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case PPC_F0: - str.printf("%12f", m_core->f[0]); + strprintf(str, "%12f", m_core->f[0]); break; case PPC_F1: - str.printf("%12f", m_core->f[1]); + strprintf(str, "%12f", m_core->f[1]); break; case PPC_F2: - str.printf("%12f", m_core->f[2]); + strprintf(str, "%12f", m_core->f[2]); break; case PPC_F3: - str.printf("%12f", m_core->f[3]); + strprintf(str, "%12f", m_core->f[3]); break; case PPC_F4: - str.printf("%12f", m_core->f[4]); + strprintf(str, "%12f", m_core->f[4]); break; case PPC_F5: - str.printf("%12f", m_core->f[5]); + strprintf(str, "%12f", m_core->f[5]); break; case PPC_F6: - str.printf("%12f", m_core->f[6]); + strprintf(str, "%12f", m_core->f[6]); break; case PPC_F7: - str.printf("%12f", m_core->f[7]); + strprintf(str, "%12f", m_core->f[7]); break; case PPC_F8: - str.printf("%12f", m_core->f[8]); + strprintf(str, "%12f", m_core->f[8]); break; case PPC_F9: - str.printf("%12f", m_core->f[9]); + strprintf(str, "%12f", m_core->f[9]); break; case PPC_F10: - str.printf("%12f", m_core->f[10]); + strprintf(str, "%12f", m_core->f[10]); break; case PPC_F11: - str.printf("%12f", m_core->f[11]); + strprintf(str, "%12f", m_core->f[11]); break; case PPC_F12: - str.printf("%12f", m_core->f[12]); + strprintf(str, "%12f", m_core->f[12]); break; case PPC_F13: - str.printf("%12f", m_core->f[13]); + strprintf(str, "%12f", m_core->f[13]); break; case PPC_F14: - str.printf("%12f", m_core->f[14]); + strprintf(str, "%12f", m_core->f[14]); break; case PPC_F15: - str.printf("%12f", m_core->f[15]); + strprintf(str, "%12f", m_core->f[15]); break; case PPC_F16: - str.printf("%12f", m_core->f[16]); + strprintf(str, "%12f", m_core->f[16]); break; case PPC_F17: - str.printf("%12f", m_core->f[17]); + strprintf(str, "%12f", m_core->f[17]); break; case PPC_F18: - str.printf("%12f", m_core->f[18]); + strprintf(str, "%12f", m_core->f[18]); break; case PPC_F19: - str.printf("%12f", m_core->f[19]); + strprintf(str, "%12f", m_core->f[19]); break; case PPC_F20: - str.printf("%12f", m_core->f[20]); + strprintf(str, "%12f", m_core->f[20]); break; case PPC_F21: - str.printf("%12f", m_core->f[21]); + strprintf(str, "%12f", m_core->f[21]); break; case PPC_F22: - str.printf("%12f", m_core->f[22]); + strprintf(str, "%12f", m_core->f[22]); break; case PPC_F23: - str.printf("%12f", m_core->f[23]); + strprintf(str, "%12f", m_core->f[23]); break; case PPC_F24: - str.printf("%12f", m_core->f[24]); + strprintf(str, "%12f", m_core->f[24]); break; case PPC_F25: - str.printf("%12f", m_core->f[25]); + strprintf(str, "%12f", m_core->f[25]); break; case PPC_F26: - str.printf("%12f", m_core->f[26]); + strprintf(str, "%12f", m_core->f[26]); break; case PPC_F27: - str.printf("%12f", m_core->f[27]); + strprintf(str, "%12f", m_core->f[27]); break; case PPC_F28: - str.printf("%12f", m_core->f[28]); + strprintf(str, "%12f", m_core->f[28]); break; case PPC_F29: - str.printf("%12f", m_core->f[29]); + strprintf(str, "%12f", m_core->f[29]); break; case PPC_F30: - str.printf("%12f", m_core->f[30]); + strprintf(str, "%12f", m_core->f[30]); break; case PPC_F31: - str.printf("%12f", m_core->f[31]); + strprintf(str, "%12f", m_core->f[31]); break; } } diff --git a/src/emu/cpu/pps4/pps4.c b/src/emu/cpu/pps4/pps4.c index 47ea940d202..3a942aa6cca 100644 --- a/src/emu/cpu/pps4/pps4.c +++ b/src/emu/cpu/pps4/pps4.c @@ -1552,12 +1552,12 @@ void pps4_device::device_start() m_icountptr = &m_icount; } -void pps4_device::state_string_export(const device_state_entry &entry, astring &str) +void pps4_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c", + strprintf(str, "%c%c%c", m_C ? 'C':'.', m_FF1 ? '1':'.', m_FF2 ? '2':'.'); diff --git a/src/emu/cpu/pps4/pps4.h b/src/emu/cpu/pps4/pps4.h index cfa1fa50b6f..d459591a7c0 100644 --- a/src/emu/cpu/pps4/pps4.h +++ b/src/emu/cpu/pps4/pps4.h @@ -62,7 +62,7 @@ protected: } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/psx/psx.c b/src/emu/cpu/psx/psx.c index 00aeb6fcfb5..bb0d07a13b6 100644 --- a/src/emu/cpu/psx/psx.c +++ b/src/emu/cpu/psx/psx.c @@ -2025,18 +2025,18 @@ void psxcpu_device::state_import( const device_state_entry &entry ) // for the debugger //------------------------------------------------- -void psxcpu_device::state_string_export( const device_state_entry &entry, astring &str ) +void psxcpu_device::state_string_export( const device_state_entry &entry, std::string &str ) { switch( entry.index() ) { case PSXCPU_DELAYR: if( m_delayr <= PSXCPU_DELAYR_NOTPC ) { - str.printf("%02x %-3s", m_delayr, delayn[m_delayr]); + strprintf(str, "%02x %-3s", m_delayr, delayn[m_delayr]); } else { - str.printf("%02x ---", m_delayr); + strprintf(str, "%02x ---", m_delayr); } break; } diff --git a/src/emu/cpu/psx/psx.h b/src/emu/cpu/psx/psx.h index 3839be8d21f..7fe938349eb 100644 --- a/src/emu/cpu/psx/psx.h +++ b/src/emu/cpu/psx/psx.h @@ -220,7 +220,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 4; } diff --git a/src/emu/cpu/rsp/rsp.c b/src/emu/cpu/rsp/rsp.c index 25b096cb45f..49ad29975b1 100644 --- a/src/emu/cpu/rsp/rsp.c +++ b/src/emu/cpu/rsp/rsp.c @@ -537,7 +537,7 @@ void rsp_device::state_export(const device_state_entry &entry) } } -void rsp_device::state_string_export(const device_state_entry &entry, astring &str) +void rsp_device::state_string_export(const device_state_entry &entry, std::string &str) { const int index = entry.index(); if (index >= RSP_V0 && index <= RSP_V31) @@ -546,7 +546,7 @@ void rsp_device::state_string_export(const device_state_entry &entry, astring &s } else if (index == STATE_GENFLAGS) { - str.printf("%s", ""); + strprintf(str, "%s", ""); } } diff --git a/src/emu/cpu/rsp/rsp.h b/src/emu/cpu/rsp/rsp.h index a7db6341b6f..dba8ff38b7b 100644 --- a/src/emu/cpu/rsp/rsp.h +++ b/src/emu/cpu/rsp/rsp.h @@ -185,7 +185,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 4; } diff --git a/src/emu/cpu/rsp/rspcp2.c b/src/emu/cpu/rsp/rspcp2.c index 225a6d31bca..681d503c878 100644 --- a/src/emu/cpu/rsp/rspcp2.c +++ b/src/emu/cpu/rsp/rspcp2.c @@ -171,105 +171,105 @@ void rsp_cop2::start() } } -void rsp_cop2::state_string_export(const int index, astring &str) +void rsp_cop2::state_string_export(const int index, std::string &str) { switch (index) { case RSP_V0: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 0, 0), (UINT16)VREG_S( 0, 1), (UINT16)VREG_S( 0, 2), (UINT16)VREG_S( 0, 3), (UINT16)VREG_S( 0, 4), (UINT16)VREG_S( 0, 5), (UINT16)VREG_S( 0, 6), (UINT16)VREG_S( 0, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 0, 0), (UINT16)VREG_S( 0, 1), (UINT16)VREG_S( 0, 2), (UINT16)VREG_S( 0, 3), (UINT16)VREG_S( 0, 4), (UINT16)VREG_S( 0, 5), (UINT16)VREG_S( 0, 6), (UINT16)VREG_S( 0, 7)); break; case RSP_V1: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 1, 0), (UINT16)VREG_S( 1, 1), (UINT16)VREG_S( 1, 2), (UINT16)VREG_S( 1, 3), (UINT16)VREG_S( 1, 4), (UINT16)VREG_S( 1, 5), (UINT16)VREG_S( 1, 6), (UINT16)VREG_S( 1, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 1, 0), (UINT16)VREG_S( 1, 1), (UINT16)VREG_S( 1, 2), (UINT16)VREG_S( 1, 3), (UINT16)VREG_S( 1, 4), (UINT16)VREG_S( 1, 5), (UINT16)VREG_S( 1, 6), (UINT16)VREG_S( 1, 7)); break; case RSP_V2: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 2, 0), (UINT16)VREG_S( 2, 1), (UINT16)VREG_S( 2, 2), (UINT16)VREG_S( 2, 3), (UINT16)VREG_S( 2, 4), (UINT16)VREG_S( 2, 5), (UINT16)VREG_S( 2, 6), (UINT16)VREG_S( 2, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 2, 0), (UINT16)VREG_S( 2, 1), (UINT16)VREG_S( 2, 2), (UINT16)VREG_S( 2, 3), (UINT16)VREG_S( 2, 4), (UINT16)VREG_S( 2, 5), (UINT16)VREG_S( 2, 6), (UINT16)VREG_S( 2, 7)); break; case RSP_V3: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 3, 0), (UINT16)VREG_S( 3, 1), (UINT16)VREG_S( 3, 2), (UINT16)VREG_S( 3, 3), (UINT16)VREG_S( 3, 4), (UINT16)VREG_S( 3, 5), (UINT16)VREG_S( 3, 6), (UINT16)VREG_S( 3, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 3, 0), (UINT16)VREG_S( 3, 1), (UINT16)VREG_S( 3, 2), (UINT16)VREG_S( 3, 3), (UINT16)VREG_S( 3, 4), (UINT16)VREG_S( 3, 5), (UINT16)VREG_S( 3, 6), (UINT16)VREG_S( 3, 7)); break; case RSP_V4: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 4, 0), (UINT16)VREG_S( 4, 1), (UINT16)VREG_S( 4, 2), (UINT16)VREG_S( 4, 3), (UINT16)VREG_S( 4, 4), (UINT16)VREG_S( 4, 5), (UINT16)VREG_S( 4, 6), (UINT16)VREG_S( 4, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 4, 0), (UINT16)VREG_S( 4, 1), (UINT16)VREG_S( 4, 2), (UINT16)VREG_S( 4, 3), (UINT16)VREG_S( 4, 4), (UINT16)VREG_S( 4, 5), (UINT16)VREG_S( 4, 6), (UINT16)VREG_S( 4, 7)); break; case RSP_V5: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 5, 0), (UINT16)VREG_S( 5, 1), (UINT16)VREG_S( 5, 2), (UINT16)VREG_S( 5, 3), (UINT16)VREG_S( 5, 4), (UINT16)VREG_S( 5, 5), (UINT16)VREG_S( 5, 6), (UINT16)VREG_S( 5, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 5, 0), (UINT16)VREG_S( 5, 1), (UINT16)VREG_S( 5, 2), (UINT16)VREG_S( 5, 3), (UINT16)VREG_S( 5, 4), (UINT16)VREG_S( 5, 5), (UINT16)VREG_S( 5, 6), (UINT16)VREG_S( 5, 7)); break; case RSP_V6: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 6, 0), (UINT16)VREG_S( 6, 1), (UINT16)VREG_S( 6, 2), (UINT16)VREG_S( 6, 3), (UINT16)VREG_S( 6, 4), (UINT16)VREG_S( 6, 5), (UINT16)VREG_S( 6, 6), (UINT16)VREG_S( 6, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 6, 0), (UINT16)VREG_S( 6, 1), (UINT16)VREG_S( 6, 2), (UINT16)VREG_S( 6, 3), (UINT16)VREG_S( 6, 4), (UINT16)VREG_S( 6, 5), (UINT16)VREG_S( 6, 6), (UINT16)VREG_S( 6, 7)); break; case RSP_V7: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 7, 0), (UINT16)VREG_S( 7, 1), (UINT16)VREG_S( 7, 2), (UINT16)VREG_S( 7, 3), (UINT16)VREG_S( 7, 4), (UINT16)VREG_S( 7, 5), (UINT16)VREG_S( 7, 6), (UINT16)VREG_S( 7, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 7, 0), (UINT16)VREG_S( 7, 1), (UINT16)VREG_S( 7, 2), (UINT16)VREG_S( 7, 3), (UINT16)VREG_S( 7, 4), (UINT16)VREG_S( 7, 5), (UINT16)VREG_S( 7, 6), (UINT16)VREG_S( 7, 7)); break; case RSP_V8: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 8, 0), (UINT16)VREG_S( 8, 1), (UINT16)VREG_S( 8, 2), (UINT16)VREG_S( 8, 3), (UINT16)VREG_S( 8, 4), (UINT16)VREG_S( 8, 5), (UINT16)VREG_S( 8, 6), (UINT16)VREG_S( 8, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 8, 0), (UINT16)VREG_S( 8, 1), (UINT16)VREG_S( 8, 2), (UINT16)VREG_S( 8, 3), (UINT16)VREG_S( 8, 4), (UINT16)VREG_S( 8, 5), (UINT16)VREG_S( 8, 6), (UINT16)VREG_S( 8, 7)); break; case RSP_V9: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 9, 0), (UINT16)VREG_S( 9, 1), (UINT16)VREG_S( 9, 2), (UINT16)VREG_S( 9, 3), (UINT16)VREG_S( 9, 4), (UINT16)VREG_S( 9, 5), (UINT16)VREG_S( 9, 6), (UINT16)VREG_S( 9, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 9, 0), (UINT16)VREG_S( 9, 1), (UINT16)VREG_S( 9, 2), (UINT16)VREG_S( 9, 3), (UINT16)VREG_S( 9, 4), (UINT16)VREG_S( 9, 5), (UINT16)VREG_S( 9, 6), (UINT16)VREG_S( 9, 7)); break; case RSP_V10: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(10, 0), (UINT16)VREG_S(10, 1), (UINT16)VREG_S(10, 2), (UINT16)VREG_S(10, 3), (UINT16)VREG_S(10, 4), (UINT16)VREG_S(10, 5), (UINT16)VREG_S(10, 6), (UINT16)VREG_S(10, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(10, 0), (UINT16)VREG_S(10, 1), (UINT16)VREG_S(10, 2), (UINT16)VREG_S(10, 3), (UINT16)VREG_S(10, 4), (UINT16)VREG_S(10, 5), (UINT16)VREG_S(10, 6), (UINT16)VREG_S(10, 7)); break; case RSP_V11: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(11, 0), (UINT16)VREG_S(11, 1), (UINT16)VREG_S(11, 2), (UINT16)VREG_S(11, 3), (UINT16)VREG_S(11, 4), (UINT16)VREG_S(11, 5), (UINT16)VREG_S(11, 6), (UINT16)VREG_S(11, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(11, 0), (UINT16)VREG_S(11, 1), (UINT16)VREG_S(11, 2), (UINT16)VREG_S(11, 3), (UINT16)VREG_S(11, 4), (UINT16)VREG_S(11, 5), (UINT16)VREG_S(11, 6), (UINT16)VREG_S(11, 7)); break; case RSP_V12: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(12, 0), (UINT16)VREG_S(12, 1), (UINT16)VREG_S(12, 2), (UINT16)VREG_S(12, 3), (UINT16)VREG_S(12, 4), (UINT16)VREG_S(12, 5), (UINT16)VREG_S(12, 6), (UINT16)VREG_S(12, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(12, 0), (UINT16)VREG_S(12, 1), (UINT16)VREG_S(12, 2), (UINT16)VREG_S(12, 3), (UINT16)VREG_S(12, 4), (UINT16)VREG_S(12, 5), (UINT16)VREG_S(12, 6), (UINT16)VREG_S(12, 7)); break; case RSP_V13: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(13, 0), (UINT16)VREG_S(13, 1), (UINT16)VREG_S(13, 2), (UINT16)VREG_S(13, 3), (UINT16)VREG_S(13, 4), (UINT16)VREG_S(13, 5), (UINT16)VREG_S(13, 6), (UINT16)VREG_S(13, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(13, 0), (UINT16)VREG_S(13, 1), (UINT16)VREG_S(13, 2), (UINT16)VREG_S(13, 3), (UINT16)VREG_S(13, 4), (UINT16)VREG_S(13, 5), (UINT16)VREG_S(13, 6), (UINT16)VREG_S(13, 7)); break; case RSP_V14: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(14, 0), (UINT16)VREG_S(14, 1), (UINT16)VREG_S(14, 2), (UINT16)VREG_S(14, 3), (UINT16)VREG_S(14, 4), (UINT16)VREG_S(14, 5), (UINT16)VREG_S(14, 6), (UINT16)VREG_S(14, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(14, 0), (UINT16)VREG_S(14, 1), (UINT16)VREG_S(14, 2), (UINT16)VREG_S(14, 3), (UINT16)VREG_S(14, 4), (UINT16)VREG_S(14, 5), (UINT16)VREG_S(14, 6), (UINT16)VREG_S(14, 7)); break; case RSP_V15: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(15, 0), (UINT16)VREG_S(15, 1), (UINT16)VREG_S(15, 2), (UINT16)VREG_S(15, 3), (UINT16)VREG_S(15, 4), (UINT16)VREG_S(15, 5), (UINT16)VREG_S(15, 6), (UINT16)VREG_S(15, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(15, 0), (UINT16)VREG_S(15, 1), (UINT16)VREG_S(15, 2), (UINT16)VREG_S(15, 3), (UINT16)VREG_S(15, 4), (UINT16)VREG_S(15, 5), (UINT16)VREG_S(15, 6), (UINT16)VREG_S(15, 7)); break; case RSP_V16: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(16, 0), (UINT16)VREG_S(16, 1), (UINT16)VREG_S(16, 2), (UINT16)VREG_S(16, 3), (UINT16)VREG_S(16, 4), (UINT16)VREG_S(16, 5), (UINT16)VREG_S(16, 6), (UINT16)VREG_S(16, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(16, 0), (UINT16)VREG_S(16, 1), (UINT16)VREG_S(16, 2), (UINT16)VREG_S(16, 3), (UINT16)VREG_S(16, 4), (UINT16)VREG_S(16, 5), (UINT16)VREG_S(16, 6), (UINT16)VREG_S(16, 7)); break; case RSP_V17: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(17, 0), (UINT16)VREG_S(17, 1), (UINT16)VREG_S(17, 2), (UINT16)VREG_S(17, 3), (UINT16)VREG_S(17, 4), (UINT16)VREG_S(17, 5), (UINT16)VREG_S(17, 6), (UINT16)VREG_S(17, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(17, 0), (UINT16)VREG_S(17, 1), (UINT16)VREG_S(17, 2), (UINT16)VREG_S(17, 3), (UINT16)VREG_S(17, 4), (UINT16)VREG_S(17, 5), (UINT16)VREG_S(17, 6), (UINT16)VREG_S(17, 7)); break; case RSP_V18: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(18, 0), (UINT16)VREG_S(18, 1), (UINT16)VREG_S(18, 2), (UINT16)VREG_S(18, 3), (UINT16)VREG_S(18, 4), (UINT16)VREG_S(18, 5), (UINT16)VREG_S(18, 6), (UINT16)VREG_S(18, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(18, 0), (UINT16)VREG_S(18, 1), (UINT16)VREG_S(18, 2), (UINT16)VREG_S(18, 3), (UINT16)VREG_S(18, 4), (UINT16)VREG_S(18, 5), (UINT16)VREG_S(18, 6), (UINT16)VREG_S(18, 7)); break; case RSP_V19: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(19, 0), (UINT16)VREG_S(19, 1), (UINT16)VREG_S(19, 2), (UINT16)VREG_S(19, 3), (UINT16)VREG_S(19, 4), (UINT16)VREG_S(19, 5), (UINT16)VREG_S(19, 6), (UINT16)VREG_S(19, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(19, 0), (UINT16)VREG_S(19, 1), (UINT16)VREG_S(19, 2), (UINT16)VREG_S(19, 3), (UINT16)VREG_S(19, 4), (UINT16)VREG_S(19, 5), (UINT16)VREG_S(19, 6), (UINT16)VREG_S(19, 7)); break; case RSP_V20: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(20, 0), (UINT16)VREG_S(20, 1), (UINT16)VREG_S(20, 2), (UINT16)VREG_S(20, 3), (UINT16)VREG_S(20, 4), (UINT16)VREG_S(20, 5), (UINT16)VREG_S(20, 6), (UINT16)VREG_S(20, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(20, 0), (UINT16)VREG_S(20, 1), (UINT16)VREG_S(20, 2), (UINT16)VREG_S(20, 3), (UINT16)VREG_S(20, 4), (UINT16)VREG_S(20, 5), (UINT16)VREG_S(20, 6), (UINT16)VREG_S(20, 7)); break; case RSP_V21: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(21, 0), (UINT16)VREG_S(21, 1), (UINT16)VREG_S(21, 2), (UINT16)VREG_S(21, 3), (UINT16)VREG_S(21, 4), (UINT16)VREG_S(21, 5), (UINT16)VREG_S(21, 6), (UINT16)VREG_S(21, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(21, 0), (UINT16)VREG_S(21, 1), (UINT16)VREG_S(21, 2), (UINT16)VREG_S(21, 3), (UINT16)VREG_S(21, 4), (UINT16)VREG_S(21, 5), (UINT16)VREG_S(21, 6), (UINT16)VREG_S(21, 7)); break; case RSP_V22: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(22, 0), (UINT16)VREG_S(22, 1), (UINT16)VREG_S(22, 2), (UINT16)VREG_S(22, 3), (UINT16)VREG_S(22, 4), (UINT16)VREG_S(22, 5), (UINT16)VREG_S(22, 6), (UINT16)VREG_S(22, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(22, 0), (UINT16)VREG_S(22, 1), (UINT16)VREG_S(22, 2), (UINT16)VREG_S(22, 3), (UINT16)VREG_S(22, 4), (UINT16)VREG_S(22, 5), (UINT16)VREG_S(22, 6), (UINT16)VREG_S(22, 7)); break; case RSP_V23: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(23, 0), (UINT16)VREG_S(23, 1), (UINT16)VREG_S(23, 2), (UINT16)VREG_S(23, 3), (UINT16)VREG_S(23, 4), (UINT16)VREG_S(23, 5), (UINT16)VREG_S(23, 6), (UINT16)VREG_S(23, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(23, 0), (UINT16)VREG_S(23, 1), (UINT16)VREG_S(23, 2), (UINT16)VREG_S(23, 3), (UINT16)VREG_S(23, 4), (UINT16)VREG_S(23, 5), (UINT16)VREG_S(23, 6), (UINT16)VREG_S(23, 7)); break; case RSP_V24: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(24, 0), (UINT16)VREG_S(24, 1), (UINT16)VREG_S(24, 2), (UINT16)VREG_S(24, 3), (UINT16)VREG_S(24, 4), (UINT16)VREG_S(24, 5), (UINT16)VREG_S(24, 6), (UINT16)VREG_S(24, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(24, 0), (UINT16)VREG_S(24, 1), (UINT16)VREG_S(24, 2), (UINT16)VREG_S(24, 3), (UINT16)VREG_S(24, 4), (UINT16)VREG_S(24, 5), (UINT16)VREG_S(24, 6), (UINT16)VREG_S(24, 7)); break; case RSP_V25: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(25, 0), (UINT16)VREG_S(25, 1), (UINT16)VREG_S(25, 2), (UINT16)VREG_S(25, 3), (UINT16)VREG_S(25, 4), (UINT16)VREG_S(25, 5), (UINT16)VREG_S(25, 6), (UINT16)VREG_S(25, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(25, 0), (UINT16)VREG_S(25, 1), (UINT16)VREG_S(25, 2), (UINT16)VREG_S(25, 3), (UINT16)VREG_S(25, 4), (UINT16)VREG_S(25, 5), (UINT16)VREG_S(25, 6), (UINT16)VREG_S(25, 7)); break; case RSP_V26: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(26, 0), (UINT16)VREG_S(26, 1), (UINT16)VREG_S(26, 2), (UINT16)VREG_S(26, 3), (UINT16)VREG_S(26, 4), (UINT16)VREG_S(26, 5), (UINT16)VREG_S(26, 6), (UINT16)VREG_S(26, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(26, 0), (UINT16)VREG_S(26, 1), (UINT16)VREG_S(26, 2), (UINT16)VREG_S(26, 3), (UINT16)VREG_S(26, 4), (UINT16)VREG_S(26, 5), (UINT16)VREG_S(26, 6), (UINT16)VREG_S(26, 7)); break; case RSP_V27: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(27, 0), (UINT16)VREG_S(27, 1), (UINT16)VREG_S(27, 2), (UINT16)VREG_S(27, 3), (UINT16)VREG_S(27, 4), (UINT16)VREG_S(27, 5), (UINT16)VREG_S(27, 6), (UINT16)VREG_S(27, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(27, 0), (UINT16)VREG_S(27, 1), (UINT16)VREG_S(27, 2), (UINT16)VREG_S(27, 3), (UINT16)VREG_S(27, 4), (UINT16)VREG_S(27, 5), (UINT16)VREG_S(27, 6), (UINT16)VREG_S(27, 7)); break; case RSP_V28: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(28, 0), (UINT16)VREG_S(28, 1), (UINT16)VREG_S(28, 2), (UINT16)VREG_S(28, 3), (UINT16)VREG_S(28, 4), (UINT16)VREG_S(28, 5), (UINT16)VREG_S(28, 6), (UINT16)VREG_S(28, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(28, 0), (UINT16)VREG_S(28, 1), (UINT16)VREG_S(28, 2), (UINT16)VREG_S(28, 3), (UINT16)VREG_S(28, 4), (UINT16)VREG_S(28, 5), (UINT16)VREG_S(28, 6), (UINT16)VREG_S(28, 7)); break; case RSP_V29: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(29, 0), (UINT16)VREG_S(29, 1), (UINT16)VREG_S(29, 2), (UINT16)VREG_S(29, 3), (UINT16)VREG_S(29, 4), (UINT16)VREG_S(29, 5), (UINT16)VREG_S(29, 6), (UINT16)VREG_S(29, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(29, 0), (UINT16)VREG_S(29, 1), (UINT16)VREG_S(29, 2), (UINT16)VREG_S(29, 3), (UINT16)VREG_S(29, 4), (UINT16)VREG_S(29, 5), (UINT16)VREG_S(29, 6), (UINT16)VREG_S(29, 7)); break; case RSP_V30: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(30, 0), (UINT16)VREG_S(30, 1), (UINT16)VREG_S(30, 2), (UINT16)VREG_S(30, 3), (UINT16)VREG_S(30, 4), (UINT16)VREG_S(30, 5), (UINT16)VREG_S(30, 6), (UINT16)VREG_S(30, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(30, 0), (UINT16)VREG_S(30, 1), (UINT16)VREG_S(30, 2), (UINT16)VREG_S(30, 3), (UINT16)VREG_S(30, 4), (UINT16)VREG_S(30, 5), (UINT16)VREG_S(30, 6), (UINT16)VREG_S(30, 7)); break; case RSP_V31: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(31, 0), (UINT16)VREG_S(31, 1), (UINT16)VREG_S(31, 2), (UINT16)VREG_S(31, 3), (UINT16)VREG_S(31, 4), (UINT16)VREG_S(31, 5), (UINT16)VREG_S(31, 6), (UINT16)VREG_S(31, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(31, 0), (UINT16)VREG_S(31, 1), (UINT16)VREG_S(31, 2), (UINT16)VREG_S(31, 3), (UINT16)VREG_S(31, 4), (UINT16)VREG_S(31, 5), (UINT16)VREG_S(31, 6), (UINT16)VREG_S(31, 7)); break; } } diff --git a/src/emu/cpu/rsp/rspcp2.h b/src/emu/cpu/rsp/rspcp2.h index 3f45d1e89c7..9b8c8d206a4 100644 --- a/src/emu/cpu/rsp/rspcp2.h +++ b/src/emu/cpu/rsp/rspcp2.h @@ -52,7 +52,7 @@ protected: virtual int generate_lwc2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc) { return TRUE; } virtual int generate_swc2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc) { return TRUE; } - virtual void state_string_export(const int index, astring &str); + virtual void state_string_export(const int index, std::string &str); public: virtual ~rsp_cop2(); diff --git a/src/emu/cpu/rsp/rspcp2d.c b/src/emu/cpu/rsp/rspcp2d.c index 11dcd896203..75f5daae1a6 100644 --- a/src/emu/cpu/rsp/rspcp2d.c +++ b/src/emu/cpu/rsp/rspcp2d.c @@ -150,105 +150,105 @@ static void unimplemented_opcode(void *param) ((rsp_cop2 *)param)->cfunc_unimplemented_opcode(); } -void rsp_cop2_drc::state_string_export(const int index, astring &str) +void rsp_cop2_drc::state_string_export(const int index, std::string &str) { switch (index) { case RSP_V0: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 0, 0), (UINT16)VREG_S( 0, 1), (UINT16)VREG_S( 0, 2), (UINT16)VREG_S( 0, 3), (UINT16)VREG_S( 0, 4), (UINT16)VREG_S( 0, 5), (UINT16)VREG_S( 0, 6), (UINT16)VREG_S( 0, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 0, 0), (UINT16)VREG_S( 0, 1), (UINT16)VREG_S( 0, 2), (UINT16)VREG_S( 0, 3), (UINT16)VREG_S( 0, 4), (UINT16)VREG_S( 0, 5), (UINT16)VREG_S( 0, 6), (UINT16)VREG_S( 0, 7)); break; case RSP_V1: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 1, 0), (UINT16)VREG_S( 1, 1), (UINT16)VREG_S( 1, 2), (UINT16)VREG_S( 1, 3), (UINT16)VREG_S( 1, 4), (UINT16)VREG_S( 1, 5), (UINT16)VREG_S( 1, 6), (UINT16)VREG_S( 1, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 1, 0), (UINT16)VREG_S( 1, 1), (UINT16)VREG_S( 1, 2), (UINT16)VREG_S( 1, 3), (UINT16)VREG_S( 1, 4), (UINT16)VREG_S( 1, 5), (UINT16)VREG_S( 1, 6), (UINT16)VREG_S( 1, 7)); break; case RSP_V2: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 2, 0), (UINT16)VREG_S( 2, 1), (UINT16)VREG_S( 2, 2), (UINT16)VREG_S( 2, 3), (UINT16)VREG_S( 2, 4), (UINT16)VREG_S( 2, 5), (UINT16)VREG_S( 2, 6), (UINT16)VREG_S( 2, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 2, 0), (UINT16)VREG_S( 2, 1), (UINT16)VREG_S( 2, 2), (UINT16)VREG_S( 2, 3), (UINT16)VREG_S( 2, 4), (UINT16)VREG_S( 2, 5), (UINT16)VREG_S( 2, 6), (UINT16)VREG_S( 2, 7)); break; case RSP_V3: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 3, 0), (UINT16)VREG_S( 3, 1), (UINT16)VREG_S( 3, 2), (UINT16)VREG_S( 3, 3), (UINT16)VREG_S( 3, 4), (UINT16)VREG_S( 3, 5), (UINT16)VREG_S( 3, 6), (UINT16)VREG_S( 3, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 3, 0), (UINT16)VREG_S( 3, 1), (UINT16)VREG_S( 3, 2), (UINT16)VREG_S( 3, 3), (UINT16)VREG_S( 3, 4), (UINT16)VREG_S( 3, 5), (UINT16)VREG_S( 3, 6), (UINT16)VREG_S( 3, 7)); break; case RSP_V4: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 4, 0), (UINT16)VREG_S( 4, 1), (UINT16)VREG_S( 4, 2), (UINT16)VREG_S( 4, 3), (UINT16)VREG_S( 4, 4), (UINT16)VREG_S( 4, 5), (UINT16)VREG_S( 4, 6), (UINT16)VREG_S( 4, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 4, 0), (UINT16)VREG_S( 4, 1), (UINT16)VREG_S( 4, 2), (UINT16)VREG_S( 4, 3), (UINT16)VREG_S( 4, 4), (UINT16)VREG_S( 4, 5), (UINT16)VREG_S( 4, 6), (UINT16)VREG_S( 4, 7)); break; case RSP_V5: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 5, 0), (UINT16)VREG_S( 5, 1), (UINT16)VREG_S( 5, 2), (UINT16)VREG_S( 5, 3), (UINT16)VREG_S( 5, 4), (UINT16)VREG_S( 5, 5), (UINT16)VREG_S( 5, 6), (UINT16)VREG_S( 5, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 5, 0), (UINT16)VREG_S( 5, 1), (UINT16)VREG_S( 5, 2), (UINT16)VREG_S( 5, 3), (UINT16)VREG_S( 5, 4), (UINT16)VREG_S( 5, 5), (UINT16)VREG_S( 5, 6), (UINT16)VREG_S( 5, 7)); break; case RSP_V6: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 6, 0), (UINT16)VREG_S( 6, 1), (UINT16)VREG_S( 6, 2), (UINT16)VREG_S( 6, 3), (UINT16)VREG_S( 6, 4), (UINT16)VREG_S( 6, 5), (UINT16)VREG_S( 6, 6), (UINT16)VREG_S( 6, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 6, 0), (UINT16)VREG_S( 6, 1), (UINT16)VREG_S( 6, 2), (UINT16)VREG_S( 6, 3), (UINT16)VREG_S( 6, 4), (UINT16)VREG_S( 6, 5), (UINT16)VREG_S( 6, 6), (UINT16)VREG_S( 6, 7)); break; case RSP_V7: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 7, 0), (UINT16)VREG_S( 7, 1), (UINT16)VREG_S( 7, 2), (UINT16)VREG_S( 7, 3), (UINT16)VREG_S( 7, 4), (UINT16)VREG_S( 7, 5), (UINT16)VREG_S( 7, 6), (UINT16)VREG_S( 7, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 7, 0), (UINT16)VREG_S( 7, 1), (UINT16)VREG_S( 7, 2), (UINT16)VREG_S( 7, 3), (UINT16)VREG_S( 7, 4), (UINT16)VREG_S( 7, 5), (UINT16)VREG_S( 7, 6), (UINT16)VREG_S( 7, 7)); break; case RSP_V8: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 8, 0), (UINT16)VREG_S( 8, 1), (UINT16)VREG_S( 8, 2), (UINT16)VREG_S( 8, 3), (UINT16)VREG_S( 8, 4), (UINT16)VREG_S( 8, 5), (UINT16)VREG_S( 8, 6), (UINT16)VREG_S( 8, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 8, 0), (UINT16)VREG_S( 8, 1), (UINT16)VREG_S( 8, 2), (UINT16)VREG_S( 8, 3), (UINT16)VREG_S( 8, 4), (UINT16)VREG_S( 8, 5), (UINT16)VREG_S( 8, 6), (UINT16)VREG_S( 8, 7)); break; case RSP_V9: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 9, 0), (UINT16)VREG_S( 9, 1), (UINT16)VREG_S( 9, 2), (UINT16)VREG_S( 9, 3), (UINT16)VREG_S( 9, 4), (UINT16)VREG_S( 9, 5), (UINT16)VREG_S( 9, 6), (UINT16)VREG_S( 9, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S( 9, 0), (UINT16)VREG_S( 9, 1), (UINT16)VREG_S( 9, 2), (UINT16)VREG_S( 9, 3), (UINT16)VREG_S( 9, 4), (UINT16)VREG_S( 9, 5), (UINT16)VREG_S( 9, 6), (UINT16)VREG_S( 9, 7)); break; case RSP_V10: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(10, 0), (UINT16)VREG_S(10, 1), (UINT16)VREG_S(10, 2), (UINT16)VREG_S(10, 3), (UINT16)VREG_S(10, 4), (UINT16)VREG_S(10, 5), (UINT16)VREG_S(10, 6), (UINT16)VREG_S(10, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(10, 0), (UINT16)VREG_S(10, 1), (UINT16)VREG_S(10, 2), (UINT16)VREG_S(10, 3), (UINT16)VREG_S(10, 4), (UINT16)VREG_S(10, 5), (UINT16)VREG_S(10, 6), (UINT16)VREG_S(10, 7)); break; case RSP_V11: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(11, 0), (UINT16)VREG_S(11, 1), (UINT16)VREG_S(11, 2), (UINT16)VREG_S(11, 3), (UINT16)VREG_S(11, 4), (UINT16)VREG_S(11, 5), (UINT16)VREG_S(11, 6), (UINT16)VREG_S(11, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(11, 0), (UINT16)VREG_S(11, 1), (UINT16)VREG_S(11, 2), (UINT16)VREG_S(11, 3), (UINT16)VREG_S(11, 4), (UINT16)VREG_S(11, 5), (UINT16)VREG_S(11, 6), (UINT16)VREG_S(11, 7)); break; case RSP_V12: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(12, 0), (UINT16)VREG_S(12, 1), (UINT16)VREG_S(12, 2), (UINT16)VREG_S(12, 3), (UINT16)VREG_S(12, 4), (UINT16)VREG_S(12, 5), (UINT16)VREG_S(12, 6), (UINT16)VREG_S(12, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(12, 0), (UINT16)VREG_S(12, 1), (UINT16)VREG_S(12, 2), (UINT16)VREG_S(12, 3), (UINT16)VREG_S(12, 4), (UINT16)VREG_S(12, 5), (UINT16)VREG_S(12, 6), (UINT16)VREG_S(12, 7)); break; case RSP_V13: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(13, 0), (UINT16)VREG_S(13, 1), (UINT16)VREG_S(13, 2), (UINT16)VREG_S(13, 3), (UINT16)VREG_S(13, 4), (UINT16)VREG_S(13, 5), (UINT16)VREG_S(13, 6), (UINT16)VREG_S(13, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(13, 0), (UINT16)VREG_S(13, 1), (UINT16)VREG_S(13, 2), (UINT16)VREG_S(13, 3), (UINT16)VREG_S(13, 4), (UINT16)VREG_S(13, 5), (UINT16)VREG_S(13, 6), (UINT16)VREG_S(13, 7)); break; case RSP_V14: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(14, 0), (UINT16)VREG_S(14, 1), (UINT16)VREG_S(14, 2), (UINT16)VREG_S(14, 3), (UINT16)VREG_S(14, 4), (UINT16)VREG_S(14, 5), (UINT16)VREG_S(14, 6), (UINT16)VREG_S(14, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(14, 0), (UINT16)VREG_S(14, 1), (UINT16)VREG_S(14, 2), (UINT16)VREG_S(14, 3), (UINT16)VREG_S(14, 4), (UINT16)VREG_S(14, 5), (UINT16)VREG_S(14, 6), (UINT16)VREG_S(14, 7)); break; case RSP_V15: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(15, 0), (UINT16)VREG_S(15, 1), (UINT16)VREG_S(15, 2), (UINT16)VREG_S(15, 3), (UINT16)VREG_S(15, 4), (UINT16)VREG_S(15, 5), (UINT16)VREG_S(15, 6), (UINT16)VREG_S(15, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(15, 0), (UINT16)VREG_S(15, 1), (UINT16)VREG_S(15, 2), (UINT16)VREG_S(15, 3), (UINT16)VREG_S(15, 4), (UINT16)VREG_S(15, 5), (UINT16)VREG_S(15, 6), (UINT16)VREG_S(15, 7)); break; case RSP_V16: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(16, 0), (UINT16)VREG_S(16, 1), (UINT16)VREG_S(16, 2), (UINT16)VREG_S(16, 3), (UINT16)VREG_S(16, 4), (UINT16)VREG_S(16, 5), (UINT16)VREG_S(16, 6), (UINT16)VREG_S(16, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(16, 0), (UINT16)VREG_S(16, 1), (UINT16)VREG_S(16, 2), (UINT16)VREG_S(16, 3), (UINT16)VREG_S(16, 4), (UINT16)VREG_S(16, 5), (UINT16)VREG_S(16, 6), (UINT16)VREG_S(16, 7)); break; case RSP_V17: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(17, 0), (UINT16)VREG_S(17, 1), (UINT16)VREG_S(17, 2), (UINT16)VREG_S(17, 3), (UINT16)VREG_S(17, 4), (UINT16)VREG_S(17, 5), (UINT16)VREG_S(17, 6), (UINT16)VREG_S(17, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(17, 0), (UINT16)VREG_S(17, 1), (UINT16)VREG_S(17, 2), (UINT16)VREG_S(17, 3), (UINT16)VREG_S(17, 4), (UINT16)VREG_S(17, 5), (UINT16)VREG_S(17, 6), (UINT16)VREG_S(17, 7)); break; case RSP_V18: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(18, 0), (UINT16)VREG_S(18, 1), (UINT16)VREG_S(18, 2), (UINT16)VREG_S(18, 3), (UINT16)VREG_S(18, 4), (UINT16)VREG_S(18, 5), (UINT16)VREG_S(18, 6), (UINT16)VREG_S(18, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(18, 0), (UINT16)VREG_S(18, 1), (UINT16)VREG_S(18, 2), (UINT16)VREG_S(18, 3), (UINT16)VREG_S(18, 4), (UINT16)VREG_S(18, 5), (UINT16)VREG_S(18, 6), (UINT16)VREG_S(18, 7)); break; case RSP_V19: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(19, 0), (UINT16)VREG_S(19, 1), (UINT16)VREG_S(19, 2), (UINT16)VREG_S(19, 3), (UINT16)VREG_S(19, 4), (UINT16)VREG_S(19, 5), (UINT16)VREG_S(19, 6), (UINT16)VREG_S(19, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(19, 0), (UINT16)VREG_S(19, 1), (UINT16)VREG_S(19, 2), (UINT16)VREG_S(19, 3), (UINT16)VREG_S(19, 4), (UINT16)VREG_S(19, 5), (UINT16)VREG_S(19, 6), (UINT16)VREG_S(19, 7)); break; case RSP_V20: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(20, 0), (UINT16)VREG_S(20, 1), (UINT16)VREG_S(20, 2), (UINT16)VREG_S(20, 3), (UINT16)VREG_S(20, 4), (UINT16)VREG_S(20, 5), (UINT16)VREG_S(20, 6), (UINT16)VREG_S(20, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(20, 0), (UINT16)VREG_S(20, 1), (UINT16)VREG_S(20, 2), (UINT16)VREG_S(20, 3), (UINT16)VREG_S(20, 4), (UINT16)VREG_S(20, 5), (UINT16)VREG_S(20, 6), (UINT16)VREG_S(20, 7)); break; case RSP_V21: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(21, 0), (UINT16)VREG_S(21, 1), (UINT16)VREG_S(21, 2), (UINT16)VREG_S(21, 3), (UINT16)VREG_S(21, 4), (UINT16)VREG_S(21, 5), (UINT16)VREG_S(21, 6), (UINT16)VREG_S(21, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(21, 0), (UINT16)VREG_S(21, 1), (UINT16)VREG_S(21, 2), (UINT16)VREG_S(21, 3), (UINT16)VREG_S(21, 4), (UINT16)VREG_S(21, 5), (UINT16)VREG_S(21, 6), (UINT16)VREG_S(21, 7)); break; case RSP_V22: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(22, 0), (UINT16)VREG_S(22, 1), (UINT16)VREG_S(22, 2), (UINT16)VREG_S(22, 3), (UINT16)VREG_S(22, 4), (UINT16)VREG_S(22, 5), (UINT16)VREG_S(22, 6), (UINT16)VREG_S(22, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(22, 0), (UINT16)VREG_S(22, 1), (UINT16)VREG_S(22, 2), (UINT16)VREG_S(22, 3), (UINT16)VREG_S(22, 4), (UINT16)VREG_S(22, 5), (UINT16)VREG_S(22, 6), (UINT16)VREG_S(22, 7)); break; case RSP_V23: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(23, 0), (UINT16)VREG_S(23, 1), (UINT16)VREG_S(23, 2), (UINT16)VREG_S(23, 3), (UINT16)VREG_S(23, 4), (UINT16)VREG_S(23, 5), (UINT16)VREG_S(23, 6), (UINT16)VREG_S(23, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(23, 0), (UINT16)VREG_S(23, 1), (UINT16)VREG_S(23, 2), (UINT16)VREG_S(23, 3), (UINT16)VREG_S(23, 4), (UINT16)VREG_S(23, 5), (UINT16)VREG_S(23, 6), (UINT16)VREG_S(23, 7)); break; case RSP_V24: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(24, 0), (UINT16)VREG_S(24, 1), (UINT16)VREG_S(24, 2), (UINT16)VREG_S(24, 3), (UINT16)VREG_S(24, 4), (UINT16)VREG_S(24, 5), (UINT16)VREG_S(24, 6), (UINT16)VREG_S(24, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(24, 0), (UINT16)VREG_S(24, 1), (UINT16)VREG_S(24, 2), (UINT16)VREG_S(24, 3), (UINT16)VREG_S(24, 4), (UINT16)VREG_S(24, 5), (UINT16)VREG_S(24, 6), (UINT16)VREG_S(24, 7)); break; case RSP_V25: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(25, 0), (UINT16)VREG_S(25, 1), (UINT16)VREG_S(25, 2), (UINT16)VREG_S(25, 3), (UINT16)VREG_S(25, 4), (UINT16)VREG_S(25, 5), (UINT16)VREG_S(25, 6), (UINT16)VREG_S(25, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(25, 0), (UINT16)VREG_S(25, 1), (UINT16)VREG_S(25, 2), (UINT16)VREG_S(25, 3), (UINT16)VREG_S(25, 4), (UINT16)VREG_S(25, 5), (UINT16)VREG_S(25, 6), (UINT16)VREG_S(25, 7)); break; case RSP_V26: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(26, 0), (UINT16)VREG_S(26, 1), (UINT16)VREG_S(26, 2), (UINT16)VREG_S(26, 3), (UINT16)VREG_S(26, 4), (UINT16)VREG_S(26, 5), (UINT16)VREG_S(26, 6), (UINT16)VREG_S(26, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(26, 0), (UINT16)VREG_S(26, 1), (UINT16)VREG_S(26, 2), (UINT16)VREG_S(26, 3), (UINT16)VREG_S(26, 4), (UINT16)VREG_S(26, 5), (UINT16)VREG_S(26, 6), (UINT16)VREG_S(26, 7)); break; case RSP_V27: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(27, 0), (UINT16)VREG_S(27, 1), (UINT16)VREG_S(27, 2), (UINT16)VREG_S(27, 3), (UINT16)VREG_S(27, 4), (UINT16)VREG_S(27, 5), (UINT16)VREG_S(27, 6), (UINT16)VREG_S(27, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(27, 0), (UINT16)VREG_S(27, 1), (UINT16)VREG_S(27, 2), (UINT16)VREG_S(27, 3), (UINT16)VREG_S(27, 4), (UINT16)VREG_S(27, 5), (UINT16)VREG_S(27, 6), (UINT16)VREG_S(27, 7)); break; case RSP_V28: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(28, 0), (UINT16)VREG_S(28, 1), (UINT16)VREG_S(28, 2), (UINT16)VREG_S(28, 3), (UINT16)VREG_S(28, 4), (UINT16)VREG_S(28, 5), (UINT16)VREG_S(28, 6), (UINT16)VREG_S(28, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(28, 0), (UINT16)VREG_S(28, 1), (UINT16)VREG_S(28, 2), (UINT16)VREG_S(28, 3), (UINT16)VREG_S(28, 4), (UINT16)VREG_S(28, 5), (UINT16)VREG_S(28, 6), (UINT16)VREG_S(28, 7)); break; case RSP_V29: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(29, 0), (UINT16)VREG_S(29, 1), (UINT16)VREG_S(29, 2), (UINT16)VREG_S(29, 3), (UINT16)VREG_S(29, 4), (UINT16)VREG_S(29, 5), (UINT16)VREG_S(29, 6), (UINT16)VREG_S(29, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(29, 0), (UINT16)VREG_S(29, 1), (UINT16)VREG_S(29, 2), (UINT16)VREG_S(29, 3), (UINT16)VREG_S(29, 4), (UINT16)VREG_S(29, 5), (UINT16)VREG_S(29, 6), (UINT16)VREG_S(29, 7)); break; case RSP_V30: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(30, 0), (UINT16)VREG_S(30, 1), (UINT16)VREG_S(30, 2), (UINT16)VREG_S(30, 3), (UINT16)VREG_S(30, 4), (UINT16)VREG_S(30, 5), (UINT16)VREG_S(30, 6), (UINT16)VREG_S(30, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(30, 0), (UINT16)VREG_S(30, 1), (UINT16)VREG_S(30, 2), (UINT16)VREG_S(30, 3), (UINT16)VREG_S(30, 4), (UINT16)VREG_S(30, 5), (UINT16)VREG_S(30, 6), (UINT16)VREG_S(30, 7)); break; case RSP_V31: - str.printf("%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(31, 0), (UINT16)VREG_S(31, 1), (UINT16)VREG_S(31, 2), (UINT16)VREG_S(31, 3), (UINT16)VREG_S(31, 4), (UINT16)VREG_S(31, 5), (UINT16)VREG_S(31, 6), (UINT16)VREG_S(31, 7)); + strprintf(str, "%04X|%04X|%04X|%04X|%04X|%04X|%04X|%04X", (UINT16)VREG_S(31, 0), (UINT16)VREG_S(31, 1), (UINT16)VREG_S(31, 2), (UINT16)VREG_S(31, 3), (UINT16)VREG_S(31, 4), (UINT16)VREG_S(31, 5), (UINT16)VREG_S(31, 6), (UINT16)VREG_S(31, 7)); break; } } diff --git a/src/emu/cpu/rsp/rspcp2d.h b/src/emu/cpu/rsp/rspcp2d.h index 2cbdfd218b6..3fcb3572820 100644 --- a/src/emu/cpu/rsp/rspcp2d.h +++ b/src/emu/cpu/rsp/rspcp2d.h @@ -30,7 +30,7 @@ class rsp_cop2_drc : public rsp_cop2 virtual int generate_lwc2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc); virtual int generate_swc2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc); - virtual void state_string_export(const int index, astring &str); + virtual void state_string_export(const int index, std::string &str); void cfunc_unimplemented_opcode(); public: diff --git a/src/emu/cpu/rsp/rspcp2s.c b/src/emu/cpu/rsp/rspcp2s.c index 01613ec7466..376d27b0a23 100644 --- a/src/emu/cpu/rsp/rspcp2s.c +++ b/src/emu/cpu/rsp/rspcp2s.c @@ -295,7 +295,7 @@ rsp_cop2_simd::rsp_cop2_simd(rsp_device &rsp, running_machine &machine) : rsp_co vec_flag_reverse = _mm_set_epi16(0x0100, 0x0302, 0x0504, 0x0706, 0x0908, 0x0b0a, 0x0d0c, 0x0f0e); } -void rsp_cop2_simd::state_string_export(const int index, astring &str) +void rsp_cop2_simd::state_string_export(const int index, std::string &str) { switch (index) { diff --git a/src/emu/cpu/rsp/rspcp2s.h b/src/emu/cpu/rsp/rspcp2s.h index dbc31e97c3c..4b164c5aefe 100644 --- a/src/emu/cpu/rsp/rspcp2s.h +++ b/src/emu/cpu/rsp/rspcp2s.h @@ -32,7 +32,7 @@ class rsp_cop2_simd : public rsp_cop2_drc virtual int generate_lwc2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc); virtual int generate_swc2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc); - virtual void state_string_export(const int index, astring &str); + virtual void state_string_export(const int index, std::string &str); public: virtual void lbv(); diff --git a/src/emu/cpu/s2650/s2650.c b/src/emu/cpu/s2650/s2650.c index f93f6313b8b..e2f6c289fb3 100644 --- a/src/emu/cpu/s2650/s2650.c +++ b/src/emu/cpu/s2650/s2650.c @@ -870,12 +870,12 @@ void s2650_device::state_export(const device_state_entry &entry) } } -void s2650_device::state_string_export(const device_state_entry &entry, astring &str) +void s2650_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", m_psu & 0x80 ? 'S':'.', m_psu & 0x40 ? 'O':'.', m_psu & 0x20 ? 'I':'.', diff --git a/src/emu/cpu/s2650/s2650.h b/src/emu/cpu/s2650/s2650.h index acdad88ae61..703058d1fca 100644 --- a/src/emu/cpu/s2650/s2650.h +++ b/src/emu/cpu/s2650/s2650.h @@ -60,7 +60,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/saturn/saturn.c b/src/emu/cpu/saturn/saturn.c index 0bd5b8c53de..cf82e50ac50 100644 --- a/src/emu/cpu/saturn/saturn.c +++ b/src/emu/cpu/saturn/saturn.c @@ -181,7 +181,7 @@ void saturn_device::device_start() m_icountptr = &m_icount; } -void saturn_device::state_string_export(const device_state_entry &entry, astring &str) +void saturn_device::state_string_export(const device_state_entry &entry, std::string &str) { #define Reg64Data(s) s[15],s[14],s[13],s[12],s[11],s[10],s[9],s[8],s[7],s[6],s[5],s[4],s[3],s[2],s[1],s[0] #define Reg64Format "%x %x%x%x%x%x%x%x %x%x%x %x%x%x%x%x" @@ -189,47 +189,47 @@ void saturn_device::state_string_export(const device_state_entry &entry, astring switch (entry.index()) { case SATURN_A: - str.printf( Reg64Format, Reg64Data(m_reg[A]) ); + strprintf(str, Reg64Format, Reg64Data(m_reg[A]) ); break; case SATURN_B: - str.printf( Reg64Format, Reg64Data(m_reg[B]) ); + strprintf(str, Reg64Format, Reg64Data(m_reg[B]) ); break; case SATURN_C: - str.printf( Reg64Format, Reg64Data(m_reg[C]) ); + strprintf(str, Reg64Format, Reg64Data(m_reg[C]) ); break; case SATURN_D: - str.printf( Reg64Format, Reg64Data(m_reg[D]) ); + strprintf(str, Reg64Format, Reg64Data(m_reg[D]) ); break; case SATURN_R0: - str.printf( Reg64Format, Reg64Data(m_reg[R0]) ); + strprintf(str, Reg64Format, Reg64Data(m_reg[R0]) ); break; case SATURN_R1: - str.printf( Reg64Format, Reg64Data(m_reg[R1]) ); + strprintf(str, Reg64Format, Reg64Data(m_reg[R1]) ); break; case SATURN_R2: - str.printf( Reg64Format, Reg64Data(m_reg[R2]) ); + strprintf(str, Reg64Format, Reg64Data(m_reg[R2]) ); break; case SATURN_R3: - str.printf( Reg64Format, Reg64Data(m_reg[R3]) ); + strprintf(str, Reg64Format, Reg64Data(m_reg[R3]) ); break; case SATURN_R4: - str.printf( Reg64Format, Reg64Data(m_reg[R4]) ); + strprintf(str, Reg64Format, Reg64Data(m_reg[R4]) ); break; case SATURN_IRQ_STATE: - str.printf( "%c%c%c%i", m_in_irq?'S':'.', m_irq_enable?'e':'.', m_pending_irq?'p':'.', m_irq_state ); + strprintf(str, "%c%c%c%i", m_in_irq?'S':'.', m_irq_enable?'e':'.', m_pending_irq?'p':'.', m_irq_state ); break; case STATE_GENFLAGS: - str.printf( "%c%c", m_decimal?'D':'.', m_carry ? 'C':'.' ); + strprintf(str, "%c%c", m_decimal?'D':'.', m_carry ? 'C':'.' ); break; } } diff --git a/src/emu/cpu/saturn/saturn.h b/src/emu/cpu/saturn/saturn.h index a54faaca164..cd9705cbbcd 100644 --- a/src/emu/cpu/saturn/saturn.h +++ b/src/emu/cpu/saturn/saturn.h @@ -117,7 +117,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); diff --git a/src/emu/cpu/sc61860/sc61860.c b/src/emu/cpu/sc61860/sc61860.c index ee4e33e931d..6d887ffe916 100644 --- a/src/emu/cpu/sc61860/sc61860.c +++ b/src/emu/cpu/sc61860/sc61860.c @@ -181,12 +181,12 @@ void sc61860_device::device_start() } -void sc61860_device::state_string_export(const device_state_entry &entry, astring &str) +void sc61860_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c", m_zero ? 'Z' : '.', m_carry ? 'C' : '.'); + strprintf(str, "%c%c", m_zero ? 'Z' : '.', m_carry ? 'C' : '.'); break; } } diff --git a/src/emu/cpu/sc61860/sc61860.h b/src/emu/cpu/sc61860/sc61860.h index 3966ada8a58..e4c4c7e7a9c 100644 --- a/src/emu/cpu/sc61860/sc61860.h +++ b/src/emu/cpu/sc61860/sc61860.h @@ -116,7 +116,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/scmp/scmp.c b/src/emu/cpu/scmp/scmp.c index a6a36dc604e..cbfaf6a82c2 100644 --- a/src/emu/cpu/scmp/scmp.c +++ b/src/emu/cpu/scmp/scmp.c @@ -547,12 +547,12 @@ void scmp_device::device_reset() COMMON STATE IMPORT/EXPORT ***************************************************************************/ -void scmp_device::state_string_export(const device_state_entry &entry, astring &str) +void scmp_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", (m_SR & 0x80) ? 'C' : '.', (m_SR & 0x40) ? 'V' : '.', (m_SR & 0x20) ? 'B' : '.', diff --git a/src/emu/cpu/scmp/scmp.h b/src/emu/cpu/scmp/scmp.h index 56f99ee1361..86590f93546 100644 --- a/src/emu/cpu/scmp/scmp.h +++ b/src/emu/cpu/scmp/scmp.h @@ -56,7 +56,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/score/score.c b/src/emu/cpu/score/score.c index 59616854f22..3ecbbe6fb4c 100644 --- a/src/emu/cpu/score/score.c +++ b/src/emu/cpu/score/score.c @@ -80,16 +80,16 @@ void score7_cpu_device::device_start() // register state for debugger state_add(SCORE_PC , "PC" , m_pc).callimport().callexport().formatstr("%08X"); - astring tmp_string; + std::string tmp_string; for(int i=0; i<0x20; i++) - state_add(SCORE_GPR + i, tmp_string.format("r%d", i).c_str(), m_gpr[i]).callimport().callexport().formatstr("%08X"); + state_add(SCORE_GPR + i, strformat(tmp_string, "r%d", i).c_str(), m_gpr[i]).callimport().callexport().formatstr("%08X"); for(int i=0; i<0x20; i++) - state_add(SCORE_CR + i, tmp_string.format("cr%d", i).c_str(), m_cr[i]).callimport().callexport().formatstr("%08X"); + state_add(SCORE_CR + i, strformat(tmp_string, "cr%d", i).c_str(), m_cr[i]).callimport().callexport().formatstr("%08X"); for(int i=0; i<3; i++) - state_add(SCORE_SR + i, tmp_string.format("sr%d", i).c_str(), m_sr[i]).callimport().callexport().formatstr("%08X"); + state_add(SCORE_SR + i, strformat(tmp_string, "sr%d", i).c_str(), m_sr[i]).callimport().callexport().formatstr("%08X"); state_add(SCORE_CEH, "ceh", REG_CEH).callimport().callexport().formatstr("%08X"); state_add(SCORE_CEL, "cel", REG_CEL).callimport().callexport().formatstr("%08X"); @@ -132,12 +132,12 @@ void score7_cpu_device::device_reset() // for the debugger //------------------------------------------------- -void score7_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void score7_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%s%s%s%s%s", + strprintf(str, "%s%s%s%s%s", REG_CR & FLAG_V ? "V" : ".", REG_CR & FLAG_C ? "C" : ".", REG_CR & FLAG_Z ? "Z" : ".", diff --git a/src/emu/cpu/score/score.h b/src/emu/cpu/score/score.h index c3eeaba67b5..2fd8ca70ca3 100644 --- a/src/emu/cpu/score/score.h +++ b/src/emu/cpu/score/score.h @@ -47,7 +47,7 @@ protected: virtual void execute_set_input(int inputnum, int state); // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_memory_interface overrides virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; diff --git a/src/emu/cpu/scudsp/scudsp.c b/src/emu/cpu/scudsp/scudsp.c index 416e3a54005..1c73999404c 100644 --- a/src/emu/cpu/scudsp/scudsp.c +++ b/src/emu/cpu/scudsp/scudsp.c @@ -1021,12 +1021,12 @@ scudsp_cpu_device::scudsp_cpu_device(const machine_config &mconfig, const char * } -void scudsp_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void scudsp_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%s%s%s%c%c%c%c%c%s%s%s", + strprintf(str, "%s%s%s%c%c%c%c%c%s%s%s", m_flags & 0x4000000 ? "PR":"..", m_flags & 0x2000000 ? "EP":"..", m_flags & 0x800000 ? "T0":"..", diff --git a/src/emu/cpu/scudsp/scudsp.h b/src/emu/cpu/scudsp/scudsp.h index df7364ac39e..a1ccb3a5ee1 100644 --- a/src/emu/cpu/scudsp/scudsp.h +++ b/src/emu/cpu/scudsp/scudsp.h @@ -94,7 +94,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_DATA) ? &m_data_config : NULL ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 4; } diff --git a/src/emu/cpu/se3208/se3208.c b/src/emu/cpu/se3208/se3208.c index 91e09033bb3..7dc842ad789 100644 --- a/src/emu/cpu/se3208/se3208.c +++ b/src/emu/cpu/se3208/se3208.c @@ -1795,12 +1795,12 @@ void se3208_device::device_start() } -void se3208_device::state_string_export(const device_state_entry &entry, astring &str) +void se3208_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c %c%c%c%c%c", + strprintf(str, "%c%c%c%c %c%c%c%c%c", m_SR&FLAG_C?'C':'.', m_SR&FLAG_V?'V':'.', m_SR&FLAG_S?'S':'.', diff --git a/src/emu/cpu/se3208/se3208.h b/src/emu/cpu/se3208/se3208.h index 9a61b4e3559..9be2316cc87 100644 --- a/src/emu/cpu/se3208/se3208.h +++ b/src/emu/cpu/se3208/se3208.h @@ -30,7 +30,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 2; } diff --git a/src/emu/cpu/sh2/sh2.c b/src/emu/cpu/sh2/sh2.c index 3717cd28521..fb7161acffd 100644 --- a/src/emu/cpu/sh2/sh2.c +++ b/src/emu/cpu/sh2/sh2.c @@ -2610,12 +2610,12 @@ void sh2_device::device_start() } -void sh2_device::state_string_export(const device_state_entry &entry, astring &str) +void sh2_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%d%c%c", + strprintf(str, "%c%c%d%c%c", m_sh2_state->sr & M ? 'M':'.', m_sh2_state->sr & Q ? 'Q':'.', (m_sh2_state->sr & I) >> 4, diff --git a/src/emu/cpu/sh2/sh2.h b/src/emu/cpu/sh2/sh2.h index 59ba4c62bc0..495ff2540ab 100644 --- a/src/emu/cpu/sh2/sh2.h +++ b/src/emu/cpu/sh2/sh2.h @@ -156,7 +156,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 2; } diff --git a/src/emu/cpu/sh4/sh4.c b/src/emu/cpu/sh4/sh4.c index 4d2a903a236..eed99ceca33 100644 --- a/src/emu/cpu/sh4/sh4.c +++ b/src/emu/cpu/sh4/sh4.c @@ -4445,7 +4445,7 @@ void sh34_base_device::state_export(const device_state_entry &entry) } } -void sh34_base_device::state_string_export(const device_state_entry &entry, astring &str) +void sh34_base_device::state_string_export(const device_state_entry &entry, std::string &str) { #ifdef LSB_FIRST UINT8 fpu_xor = m_fpu_pr; @@ -4456,7 +4456,7 @@ void sh34_base_device::state_string_export(const device_state_entry &entry, astr switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%s%s%s%s%c%c%d%c%c", + strprintf(str, "%s%s%s%s%c%c%d%c%c", m_sr & MD ? "MD ":" ", m_sr & sRB ? "RB ":" ", m_sr & BL ? "BL ":" ", @@ -4469,131 +4469,131 @@ void sh34_base_device::state_string_export(const device_state_entry &entry, astr break; case SH4_FR0: - str.printf("%08X %f", m_fr[0 ^ fpu_xor], (double)FP_RFS(0 ^ fpu_xor)); + strprintf(str, "%08X %f", m_fr[0 ^ fpu_xor], (double)FP_RFS(0 ^ fpu_xor)); break; case SH4_FR1: - str.printf("%08X %f", m_fr[1 ^ fpu_xor], (double)FP_RFS(1 ^ fpu_xor)); + strprintf(str, "%08X %f", m_fr[1 ^ fpu_xor], (double)FP_RFS(1 ^ fpu_xor)); break; case SH4_FR2: - str.printf("%08X %f", m_fr[2 ^ fpu_xor], (double)FP_RFS(2 ^ fpu_xor)); + strprintf(str, "%08X %f", m_fr[2 ^ fpu_xor], (double)FP_RFS(2 ^ fpu_xor)); break; case SH4_FR3: - str.printf("%08X %f", m_fr[3 ^ fpu_xor], (double)FP_RFS(3 ^ fpu_xor)); + strprintf(str, "%08X %f", m_fr[3 ^ fpu_xor], (double)FP_RFS(3 ^ fpu_xor)); break; case SH4_FR4: - str.printf("%08X %f", m_fr[4 ^ fpu_xor], (double)FP_RFS(4 ^ fpu_xor)); + strprintf(str, "%08X %f", m_fr[4 ^ fpu_xor], (double)FP_RFS(4 ^ fpu_xor)); break; case SH4_FR5: - str.printf("%08X %f", m_fr[5 ^ fpu_xor], (double)FP_RFS(5 ^ fpu_xor)); + strprintf(str, "%08X %f", m_fr[5 ^ fpu_xor], (double)FP_RFS(5 ^ fpu_xor)); break; case SH4_FR6: - str.printf("%08X %f", m_fr[6 ^ fpu_xor], (double)FP_RFS(6 ^ fpu_xor)); + strprintf(str, "%08X %f", m_fr[6 ^ fpu_xor], (double)FP_RFS(6 ^ fpu_xor)); break; case SH4_FR7: - str.printf("%08X %f", m_fr[7 ^ fpu_xor], (double)FP_RFS(7 ^ fpu_xor)); + strprintf(str, "%08X %f", m_fr[7 ^ fpu_xor], (double)FP_RFS(7 ^ fpu_xor)); break; case SH4_FR8: - str.printf("%08X %f", m_fr[8 ^ fpu_xor], (double)FP_RFS(8 ^ fpu_xor)); + strprintf(str, "%08X %f", m_fr[8 ^ fpu_xor], (double)FP_RFS(8 ^ fpu_xor)); break; case SH4_FR9: - str.printf("%08X %f", m_fr[9 ^ fpu_xor], (double)FP_RFS(9 ^ fpu_xor)); + strprintf(str, "%08X %f", m_fr[9 ^ fpu_xor], (double)FP_RFS(9 ^ fpu_xor)); break; case SH4_FR10: - str.printf("%08X %f", m_fr[10 ^ fpu_xor], (double)FP_RFS(10 ^ fpu_xor)); + strprintf(str, "%08X %f", m_fr[10 ^ fpu_xor], (double)FP_RFS(10 ^ fpu_xor)); break; case SH4_FR11: - str.printf("%08X %f", m_fr[11 ^ fpu_xor], (double)FP_RFS(11 ^ fpu_xor)); + strprintf(str, "%08X %f", m_fr[11 ^ fpu_xor], (double)FP_RFS(11 ^ fpu_xor)); break; case SH4_FR12: - str.printf("%08X %f", m_fr[12 ^ fpu_xor], (double)FP_RFS(12 ^ fpu_xor)); + strprintf(str, "%08X %f", m_fr[12 ^ fpu_xor], (double)FP_RFS(12 ^ fpu_xor)); break; case SH4_FR13: - str.printf("%08X %f", m_fr[13 ^ fpu_xor], (double)FP_RFS(13 ^ fpu_xor)); + strprintf(str, "%08X %f", m_fr[13 ^ fpu_xor], (double)FP_RFS(13 ^ fpu_xor)); break; case SH4_FR14: - str.printf("%08X %f", m_fr[14 ^ fpu_xor], (double)FP_RFS(14 ^ fpu_xor)); + strprintf(str, "%08X %f", m_fr[14 ^ fpu_xor], (double)FP_RFS(14 ^ fpu_xor)); break; case SH4_FR15: - str.printf("%08X %f", m_fr[15 ^ fpu_xor], (double)FP_RFS(15 ^ fpu_xor)); + strprintf(str, "%08X %f", m_fr[15 ^ fpu_xor], (double)FP_RFS(15 ^ fpu_xor)); break; case SH4_XF0: - str.printf("%08X %f", m_xf[0 ^ fpu_xor], (double)FP_XFS(0 ^ fpu_xor)); + strprintf(str, "%08X %f", m_xf[0 ^ fpu_xor], (double)FP_XFS(0 ^ fpu_xor)); break; case SH4_XF1: - str.printf("%08X %f", m_xf[1 ^ fpu_xor], (double)FP_XFS(1 ^ fpu_xor)); + strprintf(str, "%08X %f", m_xf[1 ^ fpu_xor], (double)FP_XFS(1 ^ fpu_xor)); break; case SH4_XF2: - str.printf("%08X %f", m_xf[2 ^ fpu_xor], (double)FP_XFS(2 ^ fpu_xor)); + strprintf(str, "%08X %f", m_xf[2 ^ fpu_xor], (double)FP_XFS(2 ^ fpu_xor)); break; case SH4_XF3: - str.printf("%08X %f", m_xf[3 ^ fpu_xor], (double)FP_XFS(3 ^ fpu_xor)); + strprintf(str, "%08X %f", m_xf[3 ^ fpu_xor], (double)FP_XFS(3 ^ fpu_xor)); break; case SH4_XF4: - str.printf("%08X %f", m_xf[4 ^ fpu_xor], (double)FP_XFS(4 ^ fpu_xor)); + strprintf(str, "%08X %f", m_xf[4 ^ fpu_xor], (double)FP_XFS(4 ^ fpu_xor)); break; case SH4_XF5: - str.printf("%08X %f", m_xf[5 ^ fpu_xor], (double)FP_XFS(5 ^ fpu_xor)); + strprintf(str, "%08X %f", m_xf[5 ^ fpu_xor], (double)FP_XFS(5 ^ fpu_xor)); break; case SH4_XF6: - str.printf("%08X %f", m_xf[6 ^ fpu_xor], (double)FP_XFS(6 ^ fpu_xor)); + strprintf(str, "%08X %f", m_xf[6 ^ fpu_xor], (double)FP_XFS(6 ^ fpu_xor)); break; case SH4_XF7: - str.printf("%08X %f", m_xf[7 ^ fpu_xor], (double)FP_XFS(7 ^ fpu_xor)); + strprintf(str, "%08X %f", m_xf[7 ^ fpu_xor], (double)FP_XFS(7 ^ fpu_xor)); break; case SH4_XF8: - str.printf("%08X %f", m_xf[8 ^ fpu_xor], (double)FP_XFS(8 ^ fpu_xor)); + strprintf(str, "%08X %f", m_xf[8 ^ fpu_xor], (double)FP_XFS(8 ^ fpu_xor)); break; case SH4_XF9: - str.printf("%08X %f", m_xf[9 ^ fpu_xor], (double)FP_XFS(9 ^ fpu_xor)); + strprintf(str, "%08X %f", m_xf[9 ^ fpu_xor], (double)FP_XFS(9 ^ fpu_xor)); break; case SH4_XF10: - str.printf("%08X %f", m_xf[10 ^ fpu_xor], (double)FP_XFS(10 ^ fpu_xor)); + strprintf(str, "%08X %f", m_xf[10 ^ fpu_xor], (double)FP_XFS(10 ^ fpu_xor)); break; case SH4_XF11: - str.printf("%08X %f", m_xf[11 ^ fpu_xor], (double)FP_XFS(11 ^ fpu_xor)); + strprintf(str, "%08X %f", m_xf[11 ^ fpu_xor], (double)FP_XFS(11 ^ fpu_xor)); break; case SH4_XF12: - str.printf("%08X %f", m_xf[12 ^ fpu_xor], (double)FP_XFS(12 ^ fpu_xor)); + strprintf(str, "%08X %f", m_xf[12 ^ fpu_xor], (double)FP_XFS(12 ^ fpu_xor)); break; case SH4_XF13: - str.printf("%08X %f", m_xf[13 ^ fpu_xor], (double)FP_XFS(13 ^ fpu_xor)); + strprintf(str, "%08X %f", m_xf[13 ^ fpu_xor], (double)FP_XFS(13 ^ fpu_xor)); break; case SH4_XF14: - str.printf("%08X %f", m_xf[14 ^ fpu_xor], (double)FP_XFS(14 ^ fpu_xor)); + strprintf(str, "%08X %f", m_xf[14 ^ fpu_xor], (double)FP_XFS(14 ^ fpu_xor)); break; case SH4_XF15: - str.printf("%08X %f", m_xf[15 ^ fpu_xor], (double)FP_XFS(15 ^ fpu_xor)); + strprintf(str, "%08X %f", m_xf[15 ^ fpu_xor], (double)FP_XFS(15 ^ fpu_xor)); break; } diff --git a/src/emu/cpu/sh4/sh4.h b/src/emu/cpu/sh4/sh4.h index 7f2055b6c36..e7ad4fd9cb0 100644 --- a/src/emu/cpu/sh4/sh4.h +++ b/src/emu/cpu/sh4/sh4.h @@ -218,7 +218,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 2; } diff --git a/src/emu/cpu/sm8500/sm8500.c b/src/emu/cpu/sm8500/sm8500.c index e34c53c8178..0e8b6bea10f 100644 --- a/src/emu/cpu/sm8500/sm8500.c +++ b/src/emu/cpu/sm8500/sm8500.c @@ -139,48 +139,48 @@ void sm8500_cpu_device::device_start() } -void sm8500_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void sm8500_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case SM8500_PS: - str.printf( "%04X", ( m_PS0 << 8 ) | m_PS1 ); + strprintf(str, "%04X", ( m_PS0 << 8 ) | m_PS1 ); break; case SM8500_RR0: - str.printf( "%04X", mem_readword( 0x00 ) ); + strprintf(str, "%04X", mem_readword( 0x00 ) ); break; case SM8500_RR2: - str.printf( "%04X", mem_readword( 0x02 ) ); + strprintf(str, "%04X", mem_readword( 0x02 ) ); break; case SM8500_RR4: - str.printf( "%04X", mem_readword( 0x04 ) ); + strprintf(str, "%04X", mem_readword( 0x04 ) ); break; case SM8500_RR6: - str.printf( "%04X", mem_readword( 0x06 ) ); + strprintf(str, "%04X", mem_readword( 0x06 ) ); break; case SM8500_RR8: - str.printf( "%04X", mem_readword( 0x08 ) ); + strprintf(str, "%04X", mem_readword( 0x08 ) ); break; case SM8500_RR10: - str.printf( "%04X", mem_readword( 0x0a ) ); + strprintf(str, "%04X", mem_readword( 0x0a ) ); break; case SM8500_RR12: - str.printf( "%04X", mem_readword( 0x0c ) ); + strprintf(str, "%04X", mem_readword( 0x0c ) ); break; case SM8500_RR14: - str.printf( "%04X", mem_readword( 0x0e ) ); + strprintf(str, "%04X", mem_readword( 0x0e ) ); break; case STATE_GENFLAGS: - str.printf( "%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", m_PS1 & FLAG_C ? 'C' : '.', m_PS1 & FLAG_Z ? 'Z' : '.', m_PS1 & FLAG_S ? 'S' : '.', diff --git a/src/emu/cpu/sm8500/sm8500.h b/src/emu/cpu/sm8500/sm8500.h index 58b1cded478..0c56e82b7a2 100644 --- a/src/emu/cpu/sm8500/sm8500.h +++ b/src/emu/cpu/sm8500/sm8500.h @@ -69,7 +69,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/spc700/spc700.c b/src/emu/cpu/spc700/spc700.c index 94513ceed5b..0e385bb06ef 100644 --- a/src/emu/cpu/spc700/spc700.c +++ b/src/emu/cpu/spc700/spc700.c @@ -1242,12 +1242,12 @@ void spc700_device::device_start() } -void spc700_device::state_string_export(const device_state_entry &entry, astring &str) +void spc700_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", (m_flag_n & 0x80) ? 'N':'.', ((m_flag_v & 0x80) >> 1) ? 'V':'.', (m_flag_p>>3) ? 'P':'.', diff --git a/src/emu/cpu/spc700/spc700.h b/src/emu/cpu/spc700/spc700.h index 053f2fbb9d3..192ec9ba6fe 100644 --- a/src/emu/cpu/spc700/spc700.h +++ b/src/emu/cpu/spc700/spc700.h @@ -28,7 +28,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/ssem/ssem.c b/src/emu/cpu/ssem/ssem.c index 93f7d5281b7..0bd4133a563 100644 --- a/src/emu/cpu/ssem/ssem.c +++ b/src/emu/cpu/ssem/ssem.c @@ -98,7 +98,7 @@ void ssem_device::device_start() m_program = &space(AS_PROGRAM); // register our state for the debugger - astring tempstr; + std::string tempstr; state_add(STATE_GENPC, "GENPC", m_pc).noshow(); state_add(STATE_GENFLAGS, "GENFLAGS", m_halt).callimport().callexport().formatstr("%1s").noshow(); state_add(SSEM_PC, "PC", m_shifted_pc).mask(0xffff); @@ -148,12 +148,12 @@ const address_space_config *ssem_device::memory_space_config(address_spacenum sp // for the debugger //------------------------------------------------- -void ssem_device::state_string_export(const device_state_entry &entry, astring &str) +void ssem_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c", m_halt ? 'H' : '.'); + strprintf(str, "%c", m_halt ? 'H' : '.'); break; } } diff --git a/src/emu/cpu/ssem/ssem.h b/src/emu/cpu/ssem/ssem.h index 85a9df24583..251c7a29fd3 100644 --- a/src/emu/cpu/ssem/ssem.h +++ b/src/emu/cpu/ssem/ssem.h @@ -43,7 +43,7 @@ public: virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // address spaces const address_space_config m_program_config; diff --git a/src/emu/cpu/ssp1601/ssp1601.c b/src/emu/cpu/ssp1601/ssp1601.c index c37fc9fdd4a..a50aee5bfe0 100644 --- a/src/emu/cpu/ssp1601/ssp1601.c +++ b/src/emu/cpu/ssp1601/ssp1601.c @@ -548,12 +548,12 @@ void ssp1601_device::device_start() } -void ssp1601_device::state_string_export(const device_state_entry &entry, astring &str) +void ssp1601_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c", (rST&SSP_FLAG_N) ? 'N' : '.', (rST&SSP_FLAG_V) ? 'V' : '.', + strprintf(str, "%c%c%c%c", (rST&SSP_FLAG_N) ? 'N' : '.', (rST&SSP_FLAG_V) ? 'V' : '.', (rST&SSP_FLAG_Z)?'Z':'.', (rST&SSP_FLAG_L)?'L':'.' ); break; diff --git a/src/emu/cpu/ssp1601/ssp1601.h b/src/emu/cpu/ssp1601/ssp1601.h index 8bdeb2eab11..0c06d2785f0 100644 --- a/src/emu/cpu/ssp1601/ssp1601.h +++ b/src/emu/cpu/ssp1601/ssp1601.h @@ -38,7 +38,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ((spacenum == AS_IO) ? &m_io_config : NULL); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 2; } diff --git a/src/emu/cpu/t11/t11.c b/src/emu/cpu/t11/t11.c index ed4667a8b32..46f82f9a627 100644 --- a/src/emu/cpu/t11/t11.c +++ b/src/emu/cpu/t11/t11.c @@ -275,12 +275,12 @@ void t11_device::device_start() m_icountptr = &m_icount; } -void t11_device::state_string_export(const device_state_entry &entry, astring &str) +void t11_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", m_psw.b.l & 0x80 ? '?':'.', m_psw.b.l & 0x40 ? 'I':'.', m_psw.b.l & 0x20 ? 'I':'.', diff --git a/src/emu/cpu/t11/t11.h b/src/emu/cpu/t11/t11.h index dd724f09ddd..2d7aa2aa180 100644 --- a/src/emu/cpu/t11/t11.h +++ b/src/emu/cpu/t11/t11.h @@ -56,7 +56,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 2; } diff --git a/src/emu/cpu/tlcs90/tlcs90.c b/src/emu/cpu/tlcs90/tlcs90.c index 4b320fd6831..118d7a93168 100644 --- a/src/emu/cpu/tlcs90/tlcs90.c +++ b/src/emu/cpu/tlcs90/tlcs90.c @@ -2761,12 +2761,12 @@ void tlcs90_device::device_start() } -void tlcs90_device::state_string_export(const device_state_entry &entry, astring &str) +void tlcs90_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", F & 0x80 ? 'S':'.', F & 0x40 ? 'Z':'.', F & 0x20 ? 'I':'.', diff --git a/src/emu/cpu/tlcs90/tlcs90.h b/src/emu/cpu/tlcs90/tlcs90.h index 7dd96f9e452..77f4f82d750 100644 --- a/src/emu/cpu/tlcs90/tlcs90.h +++ b/src/emu/cpu/tlcs90/tlcs90.h @@ -49,7 +49,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : NULL ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/tlcs900/tlcs900.c b/src/emu/cpu/tlcs900/tlcs900.c index 37fdea0c12b..05126275cc8 100644 --- a/src/emu/cpu/tlcs900/tlcs900.c +++ b/src/emu/cpu/tlcs900/tlcs900.c @@ -374,12 +374,12 @@ void tlcs900h_device::device_start() } -void tlcs900h_device::state_string_export(const device_state_entry &entry, astring &str) +void tlcs900h_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%d%c%d%c%c%c%c%c%c%c%c", + strprintf(str, "%c%d%c%d%c%c%c%c%c%c%c%c", m_sr.w.l & 0x8000 ? 'S' : 'U', ( m_sr.w.l & 0x7000 ) >> 12, m_sr.w.l & 0x0800 ? 'M' : 'N', diff --git a/src/emu/cpu/tlcs900/tlcs900.h b/src/emu/cpu/tlcs900/tlcs900.h index b550480cb27..11b61e532f1 100644 --- a/src/emu/cpu/tlcs900/tlcs900.h +++ b/src/emu/cpu/tlcs900/tlcs900.h @@ -70,7 +70,7 @@ protected: } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/tms0980/tms0980.c b/src/emu/cpu/tms0980/tms0980.c index 93111b88dba..20897c81b70 100644 --- a/src/emu/cpu/tms0980/tms0980.c +++ b/src/emu/cpu/tms0980/tms0980.c @@ -392,12 +392,12 @@ offs_t tms0980_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const UIN return CPU_DISASSEMBLE_NAME(tms0980)(this, buffer, pc, oprom, opram, options); } -void tms1xxx_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void tms1xxx_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENPC: - str.printf("%03X", m_rom_address << ((m_byte_bits > 8) ? 1 : 0)); + strprintf(str, "%03X", m_rom_address << ((m_byte_bits > 8) ? 1 : 0)); break; } } diff --git a/src/emu/cpu/tms0980/tms0980.h b/src/emu/cpu/tms0980/tms0980.h index a5407e8cf62..ee04406c1c9 100644 --- a/src/emu/cpu/tms0980/tms0980.h +++ b/src/emu/cpu/tms0980/tms0980.h @@ -96,7 +96,7 @@ protected: virtual UINT32 disasm_min_opcode_bytes() const { return 1; } virtual UINT32 disasm_max_opcode_bytes() const { return 1; } - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); void next_pc(); diff --git a/src/emu/cpu/tms32010/tms32010.c b/src/emu/cpu/tms32010/tms32010.c index 2b3053f38bb..28361c39e49 100644 --- a/src/emu/cpu/tms32010/tms32010.c +++ b/src/emu/cpu/tms32010/tms32010.c @@ -893,12 +893,12 @@ void tms32010_device::device_reset() } -void tms32010_device::state_string_export(const device_state_entry &entry, astring &str) +void tms32010_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", m_STR & 0x8000 ? 'O':'.', m_STR & 0x4000 ? 'M':'.', m_STR & 0x2000 ? 'I':'.', diff --git a/src/emu/cpu/tms32010/tms32010.h b/src/emu/cpu/tms32010/tms32010.h index cc305815f71..0b9448112f3 100644 --- a/src/emu/cpu/tms32010/tms32010.h +++ b/src/emu/cpu/tms32010/tms32010.h @@ -70,7 +70,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : ( (spacenum == AS_DATA) ? &m_data_config : NULL ) ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 2; } diff --git a/src/emu/cpu/tms32025/tms32025.c b/src/emu/cpu/tms32025/tms32025.c index 75a36da04c6..5e237b2f35d 100644 --- a/src/emu/cpu/tms32025/tms32025.c +++ b/src/emu/cpu/tms32025/tms32025.c @@ -1799,12 +1799,12 @@ void tms32025_device::state_export(const device_state_entry &entry) } -void tms32025_device::state_string_export(const device_state_entry &entry, astring &str) +void tms32025_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("arp%d%c%c%c%cdp%03x arb%d%c%c%c%c%c%c%c%c%c%c%cpm%d", + strprintf(str, "arp%d%c%c%c%cdp%03x arb%d%c%c%c%c%c%c%c%c%c%c%cpm%d", (m_STR0 & 0xe000) >> 13, m_STR0 & 0x1000 ? 'O':'.', m_STR0 & 0x0800 ? 'M':'.', diff --git a/src/emu/cpu/tms32025/tms32025.h b/src/emu/cpu/tms32025/tms32025.h index 09ad0c48d30..60d6cba9643 100644 --- a/src/emu/cpu/tms32025/tms32025.h +++ b/src/emu/cpu/tms32025/tms32025.h @@ -95,7 +95,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 2; } diff --git a/src/emu/cpu/tms32031/tms32031.c b/src/emu/cpu/tms32031/tms32031.c index 18dcaeb7577..df1f389e4c5 100644 --- a/src/emu/cpu/tms32031/tms32031.c +++ b/src/emu/cpu/tms32031/tms32031.c @@ -529,7 +529,7 @@ void tms3203x_device::state_export(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void tms3203x_device::state_string_export(const device_state_entry &entry, astring &str) +void tms3203x_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { @@ -541,12 +541,12 @@ void tms3203x_device::state_string_export(const device_state_entry &entry, astri case TMS3203X_R5F: case TMS3203X_R6F: case TMS3203X_R7F: - str.printf("%12g", m_r[TMR_R0 + (entry.index() - TMS3203X_R0F)].as_double()); + strprintf(str, "%12g", m_r[TMR_R0 + (entry.index() - TMS3203X_R0F)].as_double()); break; case STATE_GENFLAGS: UINT32 temp = m_r[TMR_ST].i32[0]; - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", (temp & 0x80) ? 'O':'.', (temp & 0x40) ? 'U':'.', (temp & 0x20) ? 'V':'.', diff --git a/src/emu/cpu/tms32031/tms32031.h b/src/emu/cpu/tms32031/tms32031.h index bcdc36cdea6..ce1189e6c7a 100644 --- a/src/emu/cpu/tms32031/tms32031.h +++ b/src/emu/cpu/tms32031/tms32031.h @@ -179,7 +179,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const; diff --git a/src/emu/cpu/tms32082/tms32082.c b/src/emu/cpu/tms32082/tms32082.c index 39e3e18b5fb..742694aa7f9 100644 --- a/src/emu/cpu/tms32082/tms32082.c +++ b/src/emu/cpu/tms32082/tms32082.c @@ -203,12 +203,12 @@ void tms32082_mp_device::device_start() m_icountptr = &m_icount; } -void tms32082_mp_device::state_string_export(const device_state_entry &entry, astring &str) +void tms32082_mp_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("?"); + strprintf(str, "?"); break; } } @@ -502,12 +502,12 @@ void tms32082_pp_device::device_start() m_icountptr = &m_icount; } -void tms32082_pp_device::state_string_export(const device_state_entry &entry, astring &str) +void tms32082_pp_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("?"); + strprintf(str, "?"); break; } } diff --git a/src/emu/cpu/tms32082/tms32082.h b/src/emu/cpu/tms32082/tms32082.h index a0d2b2c8cc1..9c496e73904 100644 --- a/src/emu/cpu/tms32082/tms32082.h +++ b/src/emu/cpu/tms32082/tms32082.h @@ -91,7 +91,7 @@ protected: } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 4; } @@ -181,7 +181,7 @@ protected: } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 8; } diff --git a/src/emu/cpu/tms34010/tms34010.c b/src/emu/cpu/tms34010/tms34010.c index 2a8d023199e..53882e3a59e 100644 --- a/src/emu/cpu/tms34010/tms34010.c +++ b/src/emu/cpu/tms34010/tms34010.c @@ -590,14 +590,14 @@ void tms340x0_device::device_start() state_add(TMS34010_ST, "ST", m_st); state_add(STATE_GENFLAGS, "GENFLAGS", m_st).noshow().formatstr("%18s"); - astring tempstr; + std::string tempstr; for (int regnum = 0; regnum < 15; regnum++) { - state_add(TMS34010_A0 + regnum, tempstr.format("A%d", regnum).c_str(), m_regs[regnum].reg); + state_add(TMS34010_A0 + regnum, strformat(tempstr, "A%d", regnum).c_str(), m_regs[regnum].reg); } for (int regnum = 0; regnum < 15; regnum++) { - state_add(TMS34010_B0 + regnum, tempstr.format("B%d", regnum).c_str(), m_regs[30 - regnum].reg); + state_add(TMS34010_B0 + regnum, strformat(tempstr, "B%d", regnum).c_str(), m_regs[30 - regnum].reg); } } @@ -1596,12 +1596,12 @@ READ16_MEMBER( tms340x0_device::host_r ) } -void tms340x0_device::state_string_export(const device_state_entry &entry, astring &str) +void tms340x0_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", m_st & 0x80000000 ? 'N':'.', m_st & 0x40000000 ? 'C':'.', m_st & 0x20000000 ? 'Z':'.', diff --git a/src/emu/cpu/tms34010/tms34010.h b/src/emu/cpu/tms34010/tms34010.h index 990020f0a62..b9420def0ae 100644 --- a/src/emu/cpu/tms34010/tms34010.h +++ b/src/emu/cpu/tms34010/tms34010.h @@ -280,7 +280,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; } // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 2; } diff --git a/src/emu/cpu/tms7000/tms7000.c b/src/emu/cpu/tms7000/tms7000.c index 4b825f75d35..9eb1b3ee271 100644 --- a/src/emu/cpu/tms7000/tms7000.c +++ b/src/emu/cpu/tms7000/tms7000.c @@ -271,12 +271,12 @@ void tms7000_device::device_start() state_add(STATE_GENFLAGS, "GENFLAGS", m_sr).formatstr("%8s").noshow(); } -void tms7000_device::state_string_export(const device_state_entry &entry, astring &str) +void tms7000_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", m_sr & 0x80 ? 'C':'c', m_sr & 0x40 ? 'N':'n', m_sr & 0x20 ? 'Z':'z', diff --git a/src/emu/cpu/tms7000/tms7000.h b/src/emu/cpu/tms7000/tms7000.h index 0488355a8f6..2f30ce144ae 100644 --- a/src/emu/cpu/tms7000/tms7000.h +++ b/src/emu/cpu/tms7000/tms7000.h @@ -91,7 +91,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : NULL ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/tms9900/tms9900.c b/src/emu/cpu/tms9900/tms9900.c index ec5bbf797fc..0029d9cf392 100644 --- a/src/emu/cpu/tms9900/tms9900.c +++ b/src/emu/cpu/tms9900/tms9900.c @@ -349,7 +349,7 @@ void tms99xx_device::state_export(const device_state_entry &entry) /* state_string_export - export state as a string for the debugger */ -void tms99xx_device::state_string_export(const device_state_entry &entry, astring &str) +void tms99xx_device::state_string_export(const device_state_entry &entry, std::string &str) { static const char *statestr = "LAECOPX-----IIII"; char flags[17]; @@ -363,7 +363,7 @@ void tms99xx_device::state_string_export(const device_state_entry &entry, astrin val = (val >> 1) & 0x7fff; } } - str.cpy(flags); + str.assign(flags); } /**************************************************************************/ diff --git a/src/emu/cpu/tms9900/tms9900.h b/src/emu/cpu/tms9900/tms9900.h index f585a0a4cd3..8e7f19042c6 100644 --- a/src/emu/cpu/tms9900/tms9900.h +++ b/src/emu/cpu/tms9900/tms9900.h @@ -226,7 +226,7 @@ private: static const char* s_statename[]; void state_import(const device_state_entry &entry); void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // Interrupt handling void service_interrupt(); diff --git a/src/emu/cpu/tms9900/tms9995.c b/src/emu/cpu/tms9900/tms9995.c index df48a9c41e7..d561a0550c9 100644 --- a/src/emu/cpu/tms9900/tms9995.c +++ b/src/emu/cpu/tms9900/tms9995.c @@ -372,7 +372,7 @@ void tms9995_device::state_export(const device_state_entry &entry) /* state_string_export - export state as a string for the debugger */ -void tms9995_device::state_string_export(const device_state_entry &entry, astring &str) +void tms9995_device::state_string_export(const device_state_entry &entry, std::string &str) { static const char *statestr = "LAECOPX-----IIII"; char flags[17]; @@ -386,7 +386,7 @@ void tms9995_device::state_string_export(const device_state_entry &entry, astrin val = (val >> 1) & 0x7fff; } } - str.cpy(flags); + str.assign(flags); } /* diff --git a/src/emu/cpu/tms9900/tms9995.h b/src/emu/cpu/tms9900/tms9995.h index 0a08f6ebe58..81e2e560505 100644 --- a/src/emu/cpu/tms9900/tms9995.h +++ b/src/emu/cpu/tms9900/tms9995.h @@ -106,7 +106,7 @@ private: static const char* s_statename[]; void state_import(const device_state_entry &entry); void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); UINT16 read_workspace_register_debug(int reg); void write_workspace_register_debug(int reg, UINT16 data); diff --git a/src/emu/cpu/ucom4/ucom4.c b/src/emu/cpu/ucom4/ucom4.c index cb18beec37b..f8fbf383cb2 100644 --- a/src/emu/cpu/ucom4/ucom4.c +++ b/src/emu/cpu/ucom4/ucom4.c @@ -75,13 +75,13 @@ upd552_cpu_device::upd552_cpu_device(const machine_config &mconfig, const char * // disasm -void ucom4_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void ucom4_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { // obviously not from a single flags register case STATE_GENFLAGS: - str.printf("%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c", m_inte_f ? 'E':'e', m_int_f ? 'I':'i', m_timer_f ? 'T':'t', diff --git a/src/emu/cpu/ucom4/ucom4.h b/src/emu/cpu/ucom4/ucom4.h index cf412d59a2f..5c4cd18eac4 100644 --- a/src/emu/cpu/ucom4/ucom4.h +++ b/src/emu/cpu/ucom4/ucom4.h @@ -151,7 +151,7 @@ protected: virtual UINT32 disasm_max_opcode_bytes() const { return 2; } virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); address_space_config m_program_config; address_space_config m_data_config; diff --git a/src/emu/cpu/uml.c b/src/emu/cpu/uml.c index b1ca222771e..eef08cc7d47 100644 --- a/src/emu/cpu/uml.c +++ b/src/emu/cpu/uml.c @@ -740,7 +740,7 @@ void uml::instruction::simplify() /* if (LOG_SIMPLIFICATIONS && memcmp(&orig, inst, sizeof(orig)) != 0) { - astring disasm1, disasm2; + std::string disasm1, disasm2; orig.disasm(disasm1, block->drcuml); inst->disasm(disasm2, block->drcuml); osd_printf_debug("Simplified: %-50.50s -> %s\n", disasm1.c_str(), disasm2.c_str()); @@ -855,7 +855,7 @@ UINT8 uml::instruction::modified_flags() const // given buffer //------------------------------------------------- -const char *uml::instruction::disasm(astring &buffer, drcuml_state *drcuml) const +const char *uml::instruction::disasm(std::string &buffer, drcuml_state *drcuml) const { static const char *const conditions[] = { "z", "nz", "s", "ns", "c", "nc", "v", "nv", "u", "nu", "a", "be", "g", "le", "l", "ge" }; static const char *const pound_size[] = { "?", "?", "?", "?", "s", "?", "?", "?", "d" }; @@ -869,19 +869,19 @@ const char *uml::instruction::disasm(astring &buffer, drcuml_state *drcuml) cons assert(m_opcode != OP_INVALID && m_opcode < OP_MAX); // start with the raw mnemonic and substitute sizes - buffer.reset(); + buffer.clear(); for (const char *opsrc = opinfo.mnemonic; *opsrc != 0; opsrc++) if (*opsrc == '!') - buffer.catprintf("%s", bang_size[m_size]); + strcatprintf(buffer, "%s", bang_size[m_size]); else if (*opsrc == '#') - buffer.catprintf("%s", pound_size[m_size]); + strcatprintf(buffer, "%s", pound_size[m_size]); else - buffer.cat(*opsrc); + buffer.push_back(*opsrc); // pad to 8 spaces - int pad = 8 - buffer.len(); + int pad = 8 - buffer.length(); for (int ch = 0; ch < pad; ch++) - buffer.cat(' '); + buffer.push_back(' '); // iterate through parameters for (int pnum = 0; pnum < m_numparams; pnum++) @@ -890,7 +890,7 @@ const char *uml::instruction::disasm(astring &buffer, drcuml_state *drcuml) cons // start with a comma for all except the first parameter if (pnum != 0) - buffer.cat(','); + buffer.push_back(','); // ouput based on type switch (param.type()) @@ -918,20 +918,20 @@ const char *uml::instruction::disasm(astring &buffer, drcuml_state *drcuml) cons if (size == 2) value = (UINT16)value; if (size == 4) value = (UINT32)value; if ((UINT32)value == value) - buffer.catprintf("$%X", (UINT32)value); + strcatprintf(buffer, "$%X", (UINT32)value); else - buffer.catprintf("$%X%08X", (UINT32)(value >> 32), (UINT32)value); + strcatprintf(buffer, "$%X%08X", (UINT32)(value >> 32), (UINT32)value); } break; // immediates have several special cases case parameter::PTYPE_SIZE: - buffer.catprintf("%s", sizes[param.size()]); + strcatprintf(buffer, "%s", sizes[param.size()]); break; // size + address space immediate case parameter::PTYPE_SIZE_SPACE: - buffer.catprintf("%s_%s", spaces[param.space()], sizes[param.size()]); + strcatprintf(buffer, "%s_%s", spaces[param.space()], sizes[param.size()]); break; // size + scale immediate @@ -940,30 +940,30 @@ const char *uml::instruction::disasm(astring &buffer, drcuml_state *drcuml) cons int scale = param.scale(); int size = param.size(); if (scale == size) - buffer.catprintf("%s", sizes[size]); + strcatprintf(buffer, "%s", sizes[size]); else - buffer.catprintf("%s_x%d", sizes[size], 1 << scale); + strcatprintf(buffer, "%s_x%d", sizes[size], 1 << scale); } break; // fmod immediate case parameter::PTYPE_ROUNDING: - buffer.catprintf("%s", fmods[param.rounding()]); + strcatprintf(buffer, "%s", fmods[param.rounding()]); break; // integer registers case parameter::PTYPE_INT_REGISTER: - buffer.catprintf("i%d", param.ireg() - REG_I0); + strcatprintf(buffer, "i%d", param.ireg() - REG_I0); break; // floating point registers case parameter::PTYPE_FLOAT_REGISTER: - buffer.catprintf("f%d", param.freg() - REG_F0); + strcatprintf(buffer, "f%d", param.freg() - REG_F0); break; // map variables case parameter::PTYPE_MAPVAR: - buffer.catprintf("m%d", param.mapvar() - MAPVAR_M0); + strcatprintf(buffer, "m%d", param.mapvar() - MAPVAR_M0); break; // memory @@ -976,55 +976,55 @@ const char *uml::instruction::disasm(astring &buffer, drcuml_state *drcuml) cons if (drcuml != NULL && (symbol = drcuml->symbol_find(param.memory(), &symoffset)) != NULL) { if (symoffset == 0) - buffer.catprintf("[%s]", symbol); + strcatprintf(buffer, "[%s]", symbol); else - buffer.catprintf("[%s+$%X]", symbol, symoffset); + strcatprintf(buffer, "[%s+$%X]", symbol, symoffset); } // cache memory else if (drcuml != NULL && drcuml->cache().contains_pointer(param.memory())) - buffer.catprintf("[+$%X]", (UINT32)(FPTR)((drccodeptr)param.memory() - drcuml->cache().near())); + strcatprintf(buffer, "[+$%X]", (UINT32)(FPTR)((drccodeptr)param.memory() - drcuml->cache().near())); // general memory else - buffer.catprintf("[[$%p]]", param.memory()); + strcatprintf(buffer, "[[$%p]]", param.memory()); break; } // string pointer case parameter::PTYPE_STRING: - buffer.catprintf("%s", (const char *)(FPTR)param.string()); + strcatprintf(buffer, "%s", (const char *)(FPTR)param.string()); break; // handle pointer case parameter::PTYPE_CODE_HANDLE: - buffer.catprintf("%s", param.handle().string()); + strcatprintf(buffer, "%s", param.handle().string()); break; default: - buffer.catprintf("???"); + strcatprintf(buffer, "???"); break; } } // if there's a condition, append it if (m_condition != COND_ALWAYS) - buffer.catprintf(",%s", conditions[m_condition & 0x0f]); + strcatprintf(buffer, ",%s", conditions[m_condition & 0x0f]); // if there are flags, append them if (m_flags != 0) { - buffer.cat(','); + buffer.push_back(','); if (m_flags & FLAG_U) - buffer.cat('U'); + buffer.push_back('U'); if (m_flags & FLAG_S) - buffer.cat('S'); + buffer.push_back('S'); if (m_flags & FLAG_Z) - buffer.cat('Z'); + buffer.push_back('Z'); if (m_flags & FLAG_V) - buffer.cat('V'); + buffer.push_back('V'); if (m_flags & FLAG_C) - buffer.cat('C'); + buffer.push_back('C'); } return buffer.c_str(); } diff --git a/src/emu/cpu/uml.h b/src/emu/cpu/uml.h index ab94a949c98..6d1e6c2d89a 100644 --- a/src/emu/cpu/uml.h +++ b/src/emu/cpu/uml.h @@ -247,7 +247,7 @@ namespace uml private: // internal state drccodeptr * m_code; // pointer in the cache to the associated code - astring m_string; // pointer to string attached to handle + std::string m_string; // pointer to string attached to handle code_handle * m_next; // link to next handle in the list drcuml_state & m_drcuml; // pointer to owning object }; @@ -409,7 +409,7 @@ namespace uml void set_mapvar(int paramnum, UINT32 value) { assert(paramnum < m_numparams); assert(m_param[paramnum].is_mapvar()); m_param[paramnum] = value; } // misc - const char *disasm(astring &str, drcuml_state *drcuml = NULL) const; + const char *disasm(std::string &str, drcuml_state *drcuml = NULL) const; UINT8 input_flags() const; UINT8 output_flags() const; UINT8 modified_flags() const; diff --git a/src/emu/cpu/upd7725/upd7725.c b/src/emu/cpu/upd7725/upd7725.c index 30833ba254e..20cf81d20b2 100644 --- a/src/emu/cpu/upd7725/upd7725.c +++ b/src/emu/cpu/upd7725/upd7725.c @@ -67,7 +67,7 @@ void necdsp_device::device_start() m_direct = &m_program->direct(); // register our state for the debugger - astring tempstr; + std::string tempstr; state_add(STATE_GENPC, "GENPC", regs.pc).noshow(); state_add(UPD7725_PC, "PC", regs.pc); state_add(UPD7725_RP, "RP", regs.rp); @@ -201,12 +201,12 @@ void necdsp_device::state_export(const device_state_entry &entry) // for the debugger //------------------------------------------------- -void necdsp_device::state_string_export(const device_state_entry &entry, astring &str) +void necdsp_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case UPD7725_FLAGA: - str.printf("%s %s %c%c %s %s %s %s", + strprintf(str, "%s %s %c%c %s %s %s %s", regs.flaga.s1 ? "S1" : "s1", regs.flaga.s0 ? "S0" : "s0", regs.flaga.c ? 'C' : 'c', @@ -218,7 +218,7 @@ void necdsp_device::state_string_export(const device_state_entry &entry, astring break; case UPD7725_FLAGB: - str.printf("%s %s %c%c %s %s %s %s", + strprintf(str, "%s %s %c%c %s %s %s %s", regs.flagb.s1 ? "S1" : "s1", regs.flagb.s0 ? "S0" : "s0", regs.flagb.c ? 'C' : 'c', diff --git a/src/emu/cpu/upd7725/upd7725.h b/src/emu/cpu/upd7725/upd7725.h index e773b72a5ec..904e3771386 100644 --- a/src/emu/cpu/upd7725/upd7725.h +++ b/src/emu/cpu/upd7725/upd7725.h @@ -108,7 +108,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const; diff --git a/src/emu/cpu/upd7810/upd7810.c b/src/emu/cpu/upd7810/upd7810.c index ab847a83775..cf1ded0c32b 100644 --- a/src/emu/cpu/upd7810/upd7810.c +++ b/src/emu/cpu/upd7810/upd7810.c @@ -1732,12 +1732,12 @@ void upd78c05_device::device_start() } -void upd7810_device::state_string_export(const device_state_entry &entry, astring &str) +void upd7810_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%s:%s:%s:%s:%s:%s", + strprintf(str, "%s:%s:%s:%s:%s:%s", m_psw & 0x40 ? "ZF":"--", m_psw & 0x20 ? "SK":"--", m_psw & 0x10 ? "HC":"--", diff --git a/src/emu/cpu/upd7810/upd7810.h b/src/emu/cpu/upd7810/upd7810.h index 93e09ab98d0..adbfc21e733 100644 --- a/src/emu/cpu/upd7810/upd7810.h +++ b/src/emu/cpu/upd7810/upd7810.h @@ -168,7 +168,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : NULL ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/v30mz/v30mz.c b/src/emu/cpu/v30mz/v30mz.c index 8ecb338d2c0..c8fc839c856 100644 --- a/src/emu/cpu/v30mz/v30mz.c +++ b/src/emu/cpu/v30mz/v30mz.c @@ -183,18 +183,18 @@ void v30mz_cpu_device::device_start() } -void v30mz_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void v30mz_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENPC: - str.printf("%08X", pc()); + strprintf(str, "%08X", pc()); break; case STATE_GENFLAGS: { UINT16 flags = CompressFlags(); - str.printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", flags & 0x8000 ? 'M':'.', flags & 0x4000 ? '?':'.', flags & 0x2000 ? '?':'.', diff --git a/src/emu/cpu/v30mz/v30mz.h b/src/emu/cpu/v30mz/v30mz.h index 1c195e6f581..40deaf1fa43 100644 --- a/src/emu/cpu/v30mz/v30mz.h +++ b/src/emu/cpu/v30mz/v30mz.h @@ -42,7 +42,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_IO) ? &m_io_config : NULL ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/v810/v810.c b/src/emu/cpu/v810/v810.c index 8d1189095ff..525447c481f 100644 --- a/src/emu/cpu/v810/v810.c +++ b/src/emu/cpu/v810/v810.c @@ -1317,12 +1317,12 @@ void v810_device::device_start() m_icountptr = &m_icount; } -void v810_device::state_string_export(const device_state_entry &entry, astring &str) +void v810_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", GET_AE ? 'A':'.', GET_NP ? 'N':'.', GET_EP ? 'E':'.', diff --git a/src/emu/cpu/v810/v810.h b/src/emu/cpu/v810/v810.h index 770e5cc4449..b2b87b7d247 100644 --- a/src/emu/cpu/v810/v810.h +++ b/src/emu/cpu/v810/v810.h @@ -99,7 +99,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ((spacenum == AS_IO) ? &m_io_config : NULL); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 2; } diff --git a/src/emu/cpu/x86log.c b/src/emu/cpu/x86log.c index 95013f1d579..4c311310d96 100644 --- a/src/emu/cpu/x86log.c +++ b/src/emu/cpu/x86log.c @@ -48,7 +48,7 @@ struct data_range_t /* the code logging context */ struct x86log_context { - astring filename; /* name of the file */ + std::string filename; /* name of the file */ FILE * file; /* file we are logging to */ data_range_t data_range[MAX_DATA_RANGES]; /* list of data ranges */ @@ -88,7 +88,7 @@ x86log_context *x86log_create_context(const char *filename) log = global_alloc_clear(x86log_context); /* allocate the filename */ - log->filename.cpy(filename); + log->filename.assign(filename); /* reset things */ reset_log(log); diff --git a/src/emu/cpu/z180/z180.c b/src/emu/cpu/z180/z180.c index 446a83c903a..05a6ff6e5eb 100644 --- a/src/emu/cpu/z180/z180.c +++ b/src/emu/cpu/z180/z180.c @@ -2581,12 +2581,12 @@ void z180_device::state_export(const device_state_entry &entry) } } -void z180_device::state_string_export(const device_state_entry &entry, astring &str) +void z180_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", m_AF.b.l & 0x80 ? 'S':'.', m_AF.b.l & 0x40 ? 'Z':'.', m_AF.b.l & 0x20 ? '5':'.', diff --git a/src/emu/cpu/z180/z180.h b/src/emu/cpu/z180/z180.h index 98c53d773db..53479149502 100644 --- a/src/emu/cpu/z180/z180.h +++ b/src/emu/cpu/z180/z180.h @@ -157,7 +157,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/z8/z8.c b/src/emu/cpu/z8/z8.c index 0b5793deadd..47cc5531b65 100644 --- a/src/emu/cpu/z8/z8.c +++ b/src/emu/cpu/z8/z8.c @@ -678,9 +678,9 @@ void z8_device::device_start() state_add(Z8_T1, "T1", m_t1); state_add(STATE_GENFLAGS, "GENFLAGS", m_r[Z8_REGISTER_FLAGS]).noshow().formatstr("%6s"); - astring tempstr; + std::string tempstr; for (int regnum = 0; regnum < 16; regnum++) - state_add(Z8_R0 + regnum, tempstr.format("R%d", regnum).c_str(), m_fake_r[regnum]).callimport().callexport(); + state_add(Z8_R0 + regnum, strformat(tempstr, "R%d", regnum).c_str(), m_fake_r[regnum]).callimport().callexport(); } /* find address spaces */ @@ -807,11 +807,11 @@ void z8_device::state_export(const device_state_entry &entry) } } -void z8_device::state_string_export(const device_state_entry &entry, astring &str) +void z8_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { - case STATE_GENFLAGS: str.printf("%c%c%c%c%c%c", + case STATE_GENFLAGS: strprintf(str, "%c%c%c%c%c%c", m_r[Z8_REGISTER_FLAGS] & Z8_FLAGS_C ? 'C' : '.', m_r[Z8_REGISTER_FLAGS] & Z8_FLAGS_Z ? 'Z' : '.', m_r[Z8_REGISTER_FLAGS] & Z8_FLAGS_S ? 'S' : '.', diff --git a/src/emu/cpu/z8/z8.h b/src/emu/cpu/z8/z8.h index a3776d3a0e3..c9a653d58d3 100644 --- a/src/emu/cpu/z8/z8.h +++ b/src/emu/cpu/z8/z8.h @@ -60,7 +60,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/z80/z80.c b/src/emu/cpu/z80/z80.c index c1dce14a44a..13f4a59ab6a 100644 --- a/src/emu/cpu/z80/z80.c +++ b/src/emu/cpu/z80/z80.c @@ -3666,12 +3666,12 @@ void z80_device::state_export( const device_state_entry &entry ) } } -void z80_device::state_string_export(const device_state_entry &entry, astring &str) +void z80_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c", F & 0x80 ? 'S':'.', F & 0x40 ? 'Z':'.', F & 0x20 ? 'Y':'.', diff --git a/src/emu/cpu/z80/z80.h b/src/emu/cpu/z80/z80.h index e60e796a07b..6c8d216c135 100644 --- a/src/emu/cpu/z80/z80.h +++ b/src/emu/cpu/z80/z80.h @@ -58,7 +58,7 @@ protected: // device_state_interface overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 1; } diff --git a/src/emu/cpu/z8000/z8000.c b/src/emu/cpu/z8000/z8000.c index f114f665faa..924313481ec 100644 --- a/src/emu/cpu/z8000/z8000.c +++ b/src/emu/cpu/z8000/z8000.c @@ -648,12 +648,12 @@ void z8002_device::register_debug_state() state_add( STATE_GENSP, "GENSP", m_nspoff ).noshow(); } -void z8002_device::state_string_export(const device_state_entry &entry, astring &str) +void z8002_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", + strprintf(str, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", m_fcw & 0x8000 ? 'S':'s', m_fcw & 0x4000 ? 'n':'N', m_fcw & 0x2000 ? 'E':'e', diff --git a/src/emu/cpu/z8000/z8000.h b/src/emu/cpu/z8000/z8000.h index 86a87fc7628..20a15ee6738 100644 --- a/src/emu/cpu/z8000/z8000.h +++ b/src/emu/cpu/z8000/z8000.h @@ -60,7 +60,7 @@ protected: } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 2; } diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c index 8e1c485046c..50155dacbe0 100644 --- a/src/emu/debug/debugcmd.c +++ b/src/emu/debug/debugcmd.c @@ -1026,7 +1026,7 @@ static void execute_ignore(running_machine &machine, int ref, int params, const /* if there are no parameters, dump the ignore list */ if (params == 0) { - astring buffer; + std::string buffer; /* loop over all executable devices */ execute_interface_iterator iter(machine.root_device()); @@ -1036,14 +1036,14 @@ static void execute_ignore(running_machine &machine, int ref, int params, const if (!exec->device().debug()->observing()) { if (buffer.empty()) - buffer.printf("Currently ignoring device '%s'", exec->device().tag()); + strprintf(buffer, "Currently ignoring device '%s'", exec->device().tag()); else - buffer.catprintf(", '%s'", exec->device().tag()); + strcatprintf(buffer, ", '%s'", exec->device().tag()); } /* special message for none */ if (buffer.empty()) - buffer.printf("Not currently ignoring any devices"); + strprintf(buffer, "Not currently ignoring any devices"); debug_console_printf(machine, "%s\n", buffer.c_str()); } @@ -1091,7 +1091,7 @@ static void execute_observe(running_machine &machine, int ref, int params, const /* if there are no parameters, dump the ignore list */ if (params == 0) { - astring buffer; + std::string buffer; /* loop over all executable devices */ execute_interface_iterator iter(machine.root_device()); @@ -1101,14 +1101,14 @@ static void execute_observe(running_machine &machine, int ref, int params, const if (exec->device().debug()->observing()) { if (buffer.empty()) - buffer.printf("Currently observing CPU '%s'", exec->device().tag()); + strprintf(buffer, "Currently observing CPU '%s'", exec->device().tag()); else - buffer.catprintf(", '%s'", exec->device().tag()); + strcatprintf(buffer, ", '%s'", exec->device().tag()); } /* special message for none */ if (buffer.empty()) - buffer.printf("Not currently observing any devices"); + strprintf(buffer, "Not currently observing any devices"); debug_console_printf(machine, "%s\n", buffer.c_str()); } @@ -1315,7 +1315,7 @@ static void execute_bpdisenable(running_machine &machine, int ref, int params, c static void execute_bplist(running_machine &machine, int ref, int params, const char *param[]) { int printed = 0; - astring buffer; + std::string buffer; /* loop over all CPUs */ device_iterator iter(machine.root_device()); @@ -1327,11 +1327,11 @@ static void execute_bplist(running_machine &machine, int ref, int params, const /* loop over the breakpoints */ for (device_debug::breakpoint *bp = device->debug()->breakpoint_first(); bp != NULL; bp = bp->next()) { - buffer.printf("%c%4X @ %s", bp->enabled() ? ' ' : 'D', bp->index(), core_i64_hex_format(bp->address(), device->debug()->logaddrchars())); - if (astring(bp->condition()).cmp("1")!=0) - buffer.catprintf(" if %s", bp->condition()); - if (astring(bp->action()).cmp("")!=0) - buffer.catprintf(" do %s", bp->action()); + strprintf(buffer, "%c%4X @ %s", bp->enabled() ? ' ' : 'D', bp->index(), core_i64_hex_format(bp->address(), device->debug()->logaddrchars())); + if (std::string(bp->condition()).compare("1") != 0) + strcatprintf(buffer, " if %s", bp->condition()); + if (std::string(bp->action()).compare("") != 0) + strcatprintf(buffer, " do %s", bp->action()); debug_console_printf(machine, "%s\n", buffer.c_str()); printed++; } @@ -1478,7 +1478,7 @@ static void execute_wpdisenable(running_machine &machine, int ref, int params, c static void execute_wplist(running_machine &machine, int ref, int params, const char *param[]) { int printed = 0; - astring buffer; + std::string buffer; /* loop over all CPUs */ device_iterator iter(machine.root_device()); @@ -1494,14 +1494,14 @@ static void execute_wplist(running_machine &machine, int ref, int params, const /* loop over the watchpoints */ for (device_debug::watchpoint *wp = device->debug()->watchpoint_first(spacenum); wp != NULL; wp = wp->next()) { - buffer.printf("%c%4X @ %s-%s %s", wp->enabled() ? ' ' : 'D', wp->index(), + strprintf(buffer, "%c%4X @ %s-%s %s", wp->enabled() ? ' ' : 'D', wp->index(), core_i64_hex_format(wp->space().byte_to_address(wp->address()), wp->space().addrchars()), core_i64_hex_format(wp->space().byte_to_address_end(wp->address() + wp->length()) - 1, wp->space().addrchars()), types[wp->type() & 3]); - if (astring(wp->condition()).cmp("1")!=0) - buffer.catprintf(" if %s", wp->condition()); - if (astring(wp->action()).cmp("")!=0) - buffer.catprintf(" do %s", wp->action()); + if (std::string(wp->condition()).compare("1") != 0) + strcatprintf(buffer, " if %s", wp->condition()); + if (std::string(wp->action()).compare("") != 0) + strcatprintf(buffer, " do %s", wp->action()); debug_console_printf(machine, "%s\n", buffer.c_str()); printed++; } @@ -1625,7 +1625,7 @@ static void execute_rpdisenable(running_machine &machine, int ref, int params, c static void execute_rplist(running_machine &machine, int ref, int params, const char *param[]) { int printed = 0; - astring buffer; + std::string buffer; /* loop over all CPUs */ device_iterator iter(machine.root_device()); @@ -1637,10 +1637,10 @@ static void execute_rplist(running_machine &machine, int ref, int params, const /* loop over the breakpoints */ for (device_debug::registerpoint *rp = device->debug()->registerpoint_first(); rp != NULL; rp = rp->next()) { - buffer.printf("%c%4X ", rp->enabled() ? ' ' : 'D', rp->index()); - buffer.catprintf("if %s", rp->condition()); + strprintf(buffer, "%c%4X ", rp->enabled() ? ' ' : 'D', rp->index()); + strcatprintf(buffer, "if %s", rp->condition()); if (rp->action() != NULL) - buffer.catprintf(" do %s", rp->action()); + strcatprintf(buffer, " do %s", rp->action()); debug_console_printf(machine, "%s\n", buffer.c_str()); printed++; } @@ -1701,7 +1701,7 @@ static void execute_hotspot(running_machine &machine, int ref, int params, const static void execute_statesave(running_machine &machine, int ref, int params, const char *param[]) { - astring filename(param[0]); + std::string filename(param[0]); machine.immediate_save(filename.c_str()); debug_console_printf(machine, "State save attempted. Please refer to window message popup for results.\n"); } @@ -1713,7 +1713,7 @@ static void execute_statesave(running_machine &machine, int ref, int params, con static void execute_stateload(running_machine &machine, int ref, int params, const char *param[]) { - astring filename(param[0]); + std::string filename(param[0]); machine.immediate_load(filename.c_str()); // Clear all PC & memory tracks @@ -2571,10 +2571,10 @@ static void execute_trace_internal(running_machine &machine, int ref, int params device_t *cpu; FILE *f = NULL; const char *mode; - astring filename = param[0]; + std::string filename = param[0]; /* replace macros */ - filename.replace("{game}", machine.basename()); + strreplace(filename, "{game}", machine.basename()); /* validate parameters */ if (!debug_command_parameter_cpu(machine, (params > 1) ? param[1] : NULL, &cpu)) @@ -2831,9 +2831,9 @@ static void execute_snap(running_machine &machine, int ref, int params, const ch return; } - astring fname(filename); - if (fname.find(0, ".png") == -1) - fname.cat(".png"); + std::string fname(filename); + if (fname.find(".png") == -1) + fname.append(".png"); emu_file file(machine.options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); file_error filerr = file.open(fname.c_str()); @@ -3096,7 +3096,7 @@ static void execute_dumpkbd(running_machine &machine, int ref, int params, const } // loop through all codes - astring buffer = machine.ioport().natkeyboard().dump(); + std::string buffer = machine.ioport().natkeyboard().dump(); // and output it as appropriate if (file != NULL) diff --git a/src/emu/debug/debugcon.c b/src/emu/debug/debugcon.c index 639e6e479db..669ce24c92e 100644 --- a/src/emu/debug/debugcon.c +++ b/src/emu/debug/debugcon.c @@ -475,11 +475,11 @@ const char *debug_cmderr_to_string(CMDERR error) void CLIB_DECL debug_console_printf(running_machine &machine, const char *format, ...) { - astring buffer; + std::string buffer; va_list arg; va_start(arg, format); - buffer.vprintf(format, arg); + strvprintf(buffer, format, arg); va_end(arg); text_buffer_print(console_textbuf, buffer.c_str()); @@ -497,9 +497,9 @@ void CLIB_DECL debug_console_printf(running_machine &machine, const char *format void CLIB_DECL debug_console_vprintf(running_machine &machine, const char *format, va_list args) { - astring buffer; + std::string buffer; - buffer.vprintf(format, args); + strvprintf(buffer, format, args); text_buffer_print(console_textbuf, buffer.c_str()); /* force an update of any console views */ @@ -515,11 +515,11 @@ void CLIB_DECL debug_console_vprintf(running_machine &machine, const char *forma void CLIB_DECL debug_console_printf_wrap(running_machine &machine, int wrapcol, const char *format, ...) { - astring buffer; + std::string buffer; va_list arg; va_start(arg, format); - buffer.vprintf(format, arg); + strvprintf(buffer, format, arg); va_end(arg); text_buffer_print_wrap(console_textbuf, buffer.c_str(), wrapcol); diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index 02b939716cb..9e3d8121344 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -1109,8 +1109,8 @@ static void process_source_file(running_machine &machine) static device_t *expression_get_device(running_machine &machine, const char *tag) { // convert to lowercase then lookup the name (tags are enforced to be all lower case) - astring fullname(tag); - fullname.makelower(); + std::string fullname(tag); + strmakelower(fullname); return machine.device(fullname.c_str()); } @@ -1666,9 +1666,11 @@ device_debug::device_debug(device_t &device) } // add all registers into it - astring tempstr; - for (const device_state_entry *entry = m_state->state_first(); entry != NULL; entry = entry->next()) - m_symtable.add(tempstr.cpy(entry->symbol()).makelower().c_str(), (void *)(FPTR)entry->index(), get_state, set_state); + std::string tempstr; + for (const device_state_entry *entry = m_state->state_first(); entry != NULL; entry = entry->next()) { + strmakelower(tempstr.assign(entry->symbol())); + m_symtable.add(tempstr.c_str(), (void *)(FPTR)entry->index(), get_state, set_state); + } } // set up execution-related stuff @@ -2681,7 +2683,7 @@ const char *device_debug::comment_text(offs_t addr) const bool device_debug::comment_export(xml_data_node &curnode) { // iterate through the comments - astring crc_buf; + std::string crc_buf; for (std::set<dasm_comment>::iterator item = m_comment_set.begin(); item != m_comment_set.end(); ++item) { xml_data_node *datanode = xml_add_child(&curnode, "comment", xml_normalize_string(item->m_text.c_str())); @@ -2689,7 +2691,7 @@ bool device_debug::comment_export(xml_data_node &curnode) return false; xml_set_attribute_int(datanode, "address", item->m_address); xml_set_attribute_int(datanode, "color", item->m_color); - crc_buf.printf("%08X", item->m_crc); + strprintf(crc_buf,"%08X", item->m_crc); xml_set_attribute(datanode, "crc", crc_buf.c_str()); } return true; @@ -2831,7 +2833,7 @@ void device_debug::compute_debug_flags() void device_debug::prepare_for_step_overout(offs_t pc) { // disassemble the current instruction and get the flags - astring dasmbuffer; + std::string dasmbuffer; offs_t dasmresult = dasm_wrapped(dasmbuffer, pc); // if flags are supported and it's a call-style opcode, set a temp breakpoint after that instruction @@ -3048,18 +3050,18 @@ void device_debug::watchpoint_check(address_space &space, int type, offs_t addre "0bytes", "byte", "word", "3bytes", "dword", "5bytes", "6bytes", "7bytes", "qword" }; offs_t pc = (space.device().debug()->m_state != NULL) ? space.device().debug()->m_state->pc() : 0; - astring buffer; + std::string buffer; if (type & WATCHPOINT_WRITE) { - buffer.printf("Stopped at watchpoint %X writing %s to %08X (PC=%X)", wp->m_index, sizes[size], space.byte_to_address(address), pc); + strprintf(buffer, "Stopped at watchpoint %X writing %s to %08X (PC=%X)", wp->m_index, sizes[size], space.byte_to_address(address), pc); if (value_to_write >> 32) - buffer.catprintf(" (data=%X%08X)", (UINT32)(value_to_write >> 32), (UINT32)value_to_write); + strcatprintf(buffer, " (data=%X%08X)", (UINT32)(value_to_write >> 32), (UINT32)value_to_write); else - buffer.catprintf(" (data=%X)", (UINT32)value_to_write); + strcatprintf(buffer, " (data=%X)", (UINT32)value_to_write); } else - buffer.printf("Stopped at watchpoint %X reading %s from %08X (PC=%X)", wp->m_index, sizes[size], space.byte_to_address(address), pc); + strprintf(buffer,"Stopped at watchpoint %X reading %s from %08X (PC=%X)", wp->m_index, sizes[size], space.byte_to_address(address), pc); debug_console_printf(space.machine(), "%s\n", buffer.c_str()); space.device().debug()->compute_debug_flags(); } @@ -3121,7 +3123,7 @@ void device_debug::hotspot_check(address_space &space, offs_t address) // buffer and then disassembling them //------------------------------------------------- -UINT32 device_debug::dasm_wrapped(astring &buffer, offs_t pc) +UINT32 device_debug::dasm_wrapped(std::string &buffer, offs_t pc) { assert(m_memory != NULL && m_disasm != NULL); @@ -3142,7 +3144,7 @@ UINT32 device_debug::dasm_wrapped(astring &buffer, offs_t pc) char diasmbuf[200]; memset(diasmbuf, 0x00, 200); UINT32 result = disassemble(diasmbuf, pc, opbuf, argbuf); - buffer.cpy(diasmbuf); + buffer.assign(diasmbuf); return result; } @@ -3484,14 +3486,14 @@ void device_debug::tracer::update(offs_t pc) debug_console_execute_command(m_debug.m_device.machine(), m_action.c_str(), 0); // print the address - astring buffer; + std::string buffer; int logaddrchars = m_debug.logaddrchars(); - buffer.printf("%0*X: ", logaddrchars, pc); + strprintf(buffer,"%0*X: ", logaddrchars, pc); // print the disassembly - astring dasm; + std::string dasm; offs_t dasmresult = m_debug.dasm_wrapped(dasm, pc); - buffer.cat(dasm); + buffer.append(dasm); // output the result fprintf(&m_file, "%s\n", buffer.c_str()); diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h index cf92fda6f7c..1cfacc267b0 100644 --- a/src/emu/debug/debugcpu.h +++ b/src/emu/debug/debugcpu.h @@ -83,7 +83,7 @@ public: UINT8 m_enabled; // enabled? offs_t m_address; // execution address parsed_expression m_condition; // condition - astring m_action; // action + std::string m_action; // action }; // watchpoint class @@ -131,7 +131,7 @@ public: offs_t m_address; // start address offs_t m_length; // length of watch area parsed_expression m_condition; // condition - astring m_action; // action + std::string m_action; // action }; // registerpoint class @@ -158,7 +158,7 @@ public: int m_index; // user reported index UINT8 m_enabled; // enabled? parsed_expression m_condition; // condition - astring m_action; // action + std::string m_action; // action }; public: @@ -278,7 +278,7 @@ private: // internal helpers void compute_debug_flags(); void prepare_for_step_overout(offs_t pc); - UINT32 dasm_wrapped(astring &buffer, offs_t pc); + UINT32 dasm_wrapped(std::string &buffer, offs_t pc); // breakpoint and watchpoint helpers void breakpoint_update_flags(); @@ -351,7 +351,7 @@ private: device_debug & m_debug; // reference to our owner FILE & m_file; // tracing file for this CPU - astring m_action; // action to perform during a trace + std::string m_action; // action to perform during a trace offs_t m_history[TRACE_LOOPS]; // history of recent PCs int m_loops; // number of instructions in a loop int m_nextdex; // next index @@ -399,7 +399,7 @@ private: public: dasm_comment(offs_t address, UINT32 crc, const char *text, rgb_t color); - astring m_text; // Stores comment text & color for a given address & crc32 + std::string m_text; // Stores comment text & color for a given address & crc32 rgb_t m_color; }; std::set<dasm_comment> m_comment_set; // collection of comments diff --git a/src/emu/debug/debugvw.c b/src/emu/debug/debugvw.c index dd568e81d3d..d04b48b162a 100644 --- a/src/emu/debug/debugvw.c +++ b/src/emu/debug/debugvw.c @@ -501,7 +501,7 @@ bool debug_view_expression::recompute() // if dirty, re-evaluate if (m_dirty) { - astring oldstring(m_parsed.original_string()); + std::string oldstring(m_parsed.original_string()); try { m_parsed.parse(m_string.c_str()); diff --git a/src/emu/debug/debugvw.h b/src/emu/debug/debugvw.h index 462316a19e4..248379eab3c 100644 --- a/src/emu/debug/debugvw.h +++ b/src/emu/debug/debugvw.h @@ -129,7 +129,7 @@ public: private: // internal state debug_view_source * m_next; // link to next item - astring m_name; // name of the source item + std::string m_name; // name of the source item device_t * m_device; // associated device (if applicable) bool m_is_octal; // is view in octal or hex }; @@ -271,7 +271,7 @@ public: // setters void mark_dirty() { m_dirty = true; } - void set_string(const char *string) { m_string.cpy(string); m_dirty = true; } + void set_string(const char *string) { m_string.assign(string); m_dirty = true; } void set_context(symbol_table *context); private: @@ -283,7 +283,7 @@ private: bool m_dirty; // true if the expression needs to be re-evaluated UINT64 m_result; // last result from the expression parsed_expression m_parsed; // parsed expression data - astring m_string; // copy of the expression string + std::string m_string; // copy of the expression string }; diff --git a/src/emu/debug/dvbpoints.c b/src/emu/debug/dvbpoints.c index db393556639..2e4e16de68f 100644 --- a/src/emu/debug/dvbpoints.c +++ b/src/emu/debug/dvbpoints.c @@ -132,8 +132,8 @@ void debug_view_breakpoints::enumerate_sources() disasm_interface_iterator iter(machine().root_device()); for (device_disasm_interface *dasm = iter.first(); dasm != NULL; dasm = iter.next()) { - astring name; - name.printf("%s '%s'", dasm->device().name(), dasm->device().tag()); + std::string name; + strprintf(name, "%s '%s'", dasm->device().name(), dasm->device().tag()); m_source_list.append(*global_alloc(debug_view_source(name.c_str(), &dasm->device()))); } @@ -187,16 +187,15 @@ void debug_view_breakpoints::view_click(const int button, const debug_view_xy& p } -void debug_view_breakpoints::pad_astring_to_length(astring& str, int len) +void debug_view_breakpoints::pad_astring_to_length(std::string& str, int len) { - int diff = len - str.len(); + int diff = len - str.length(); if (diff > 0) { - astring buffer; - buffer.expand(diff); + std::string buffer; for (int i = 0; i < diff; i++) - buffer.catprintf(" "); - str.catprintf("%s", buffer.c_str()); + strcatprintf(buffer, " "); + strcatprintf(str, "%s", buffer.c_str()); } } @@ -236,40 +235,40 @@ void debug_view_breakpoints::view_update() // Draw debug_view_char *dest = &m_viewdata[0]; - astring linebuf; + std::string linebuf; // Header if (m_visible.y > 0) { - linebuf.reset(); - linebuf.cat("ID"); - if (m_sortType == &cIndexAscending) linebuf.cat('\\'); - else if (m_sortType == &cIndexDescending) linebuf.cat('/'); + linebuf.clear(); + linebuf.append("ID"); + if (m_sortType == &cIndexAscending) linebuf.push_back('\\'); + else if (m_sortType == &cIndexDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[0]); - linebuf.cat("En"); - if (m_sortType == &cEnabledAscending) linebuf.cat('\\'); - else if (m_sortType == &cEnabledDescending) linebuf.cat('/'); + linebuf.append("En"); + if (m_sortType == &cEnabledAscending) linebuf.push_back('\\'); + else if (m_sortType == &cEnabledDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[1]); - linebuf.cat("CPU"); - if (m_sortType == &cCpuAscending) linebuf.cat('\\'); - else if (m_sortType == &cCpuDescending) linebuf.cat('/'); + linebuf.append("CPU"); + if (m_sortType == &cCpuAscending) linebuf.push_back('\\'); + else if (m_sortType == &cCpuDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[2]); - linebuf.cat("Address"); - if (m_sortType == &cAddressAscending) linebuf.cat('\\'); - else if (m_sortType == &cAddressDescending) linebuf.cat('/'); + linebuf.append("Address"); + if (m_sortType == &cAddressAscending) linebuf.push_back('\\'); + else if (m_sortType == &cAddressDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[3]); - linebuf.cat("Condition"); - if (m_sortType == &cConditionAscending) linebuf.cat('\\'); - else if (m_sortType == &cConditionDescending) linebuf.cat('/'); + linebuf.append("Condition"); + if (m_sortType == &cConditionAscending) linebuf.push_back('\\'); + else if (m_sortType == &cConditionDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[4]); - linebuf.cat("Action"); - if (m_sortType == &cActionAscending) linebuf.cat('\\'); - else if (m_sortType == &cActionDescending) linebuf.cat('/'); + linebuf.append("Action"); + if (m_sortType == &cActionAscending) linebuf.push_back('\\'); + else if (m_sortType == &cActionDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[5]); for (UINT32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) { - dest->byte = (i < linebuf.len()) ? linebuf[i] : ' '; + dest->byte = (i < linebuf.length()) ? linebuf[i] : ' '; dest->attrib = DCA_ANCILLARY; } } @@ -282,24 +281,24 @@ void debug_view_breakpoints::view_update() { device_debug::breakpoint *const bp = m_buffer[bpi]; - linebuf.reset(); - linebuf.catprintf("%2X", bp->index()); + linebuf.clear(); + strcatprintf(linebuf, "%2X", bp->index()); pad_astring_to_length(linebuf, tableBreaks[0]); - linebuf.cat(bp->enabled() ? 'X' : 'O'); + linebuf.push_back(bp->enabled() ? 'X' : 'O'); pad_astring_to_length(linebuf, tableBreaks[1]); - linebuf.cat(bp->debugInterface()->device().tag()); + linebuf.append(bp->debugInterface()->device().tag()); pad_astring_to_length(linebuf, tableBreaks[2]); - linebuf.cat(core_i64_hex_format(bp->address(), bp->debugInterface()->logaddrchars())); + linebuf.append(core_i64_hex_format(bp->address(), bp->debugInterface()->logaddrchars())); pad_astring_to_length(linebuf, tableBreaks[3]); if (strcmp(bp->condition(), "1")) - linebuf.cat(bp->condition()); + linebuf.append(bp->condition()); pad_astring_to_length(linebuf, tableBreaks[4]); - linebuf.cat(bp->action()); + linebuf.append(bp->action()); pad_astring_to_length(linebuf, tableBreaks[5]); for (UINT32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) { - dest->byte = (i < linebuf.len()) ? linebuf[i] : ' '; + dest->byte = (i < linebuf.length()) ? linebuf[i] : ' '; dest->attrib = DCA_NORMAL; // Color disabled breakpoints red diff --git a/src/emu/debug/dvbpoints.h b/src/emu/debug/dvbpoints.h index 59a446f8a03..1ee3cdcb510 100644 --- a/src/emu/debug/dvbpoints.h +++ b/src/emu/debug/dvbpoints.h @@ -46,7 +46,7 @@ protected: private: // internal helpers void enumerate_sources(); - void pad_astring_to_length(astring& str, int len); + void pad_astring_to_length(std::string& str, int len); void gather_breakpoints(); diff --git a/src/emu/debug/dvdisasm.c b/src/emu/debug/dvdisasm.c index 79453127662..d29ab590fd4 100644 --- a/src/emu/debug/dvdisasm.c +++ b/src/emu/debug/dvdisasm.c @@ -95,10 +95,10 @@ void debug_view_disasm::enumerate_sources() // iterate over devices with disassembly interfaces disasm_interface_iterator iter(machine().root_device()); - astring name; + std::string name; for (device_disasm_interface *dasm = iter.first(); dasm != NULL; dasm = iter.next()) { - name.printf("%s '%s'", dasm->device().name(), dasm->device().tag()); + strprintf(name,"%s '%s'", dasm->device().name(), dasm->device().tag()); m_source_list.append(*global_alloc(debug_view_disasm_source(name.c_str(), dasm->device()))); } diff --git a/src/emu/debug/dvmemory.c b/src/emu/debug/dvmemory.c index 7ccea671324..a81e032ce48 100644 --- a/src/emu/debug/dvmemory.c +++ b/src/emu/debug/dvmemory.c @@ -127,7 +127,7 @@ void debug_view_memory::enumerate_sources() { // start with an empty list m_source_list.reset(); - astring name; + std::string name; // first add all the devices' address spaces memory_interface_iterator iter(machine().root_device()); @@ -137,14 +137,14 @@ void debug_view_memory::enumerate_sources() if (memintf->has_space(spacenum)) { address_space &space = memintf->space(spacenum); - name.printf("%s '%s' %s space memory", memintf->device().name(), memintf->device().tag(), space.name()); + strprintf(name,"%s '%s' %s space memory", memintf->device().name(), memintf->device().tag(), space.name()); m_source_list.append(*global_alloc(debug_view_memory_source(name.c_str(), space))); } // then add all the memory regions for (memory_region *region = machine().memory().first_region(); region != NULL; region = region->next()) { - name.printf("Region '%s'", region->name()); + strprintf(name, "Region '%s'", region->name()); m_source_list.append(*global_alloc(debug_view_memory_source(name.c_str(), *region))); } @@ -162,7 +162,7 @@ void debug_view_memory::enumerate_sources() // also, don't trim the front of the name, it's important to know which VIA6522 we're looking at, e.g. if (strncmp(itemname, "timer/", 6)) { - name.cpy(itemname); + name.assign(itemname); m_source_list.append(*global_alloc(debug_view_memory_source(name.c_str(), base, valsize, valcount))); } } @@ -451,14 +451,14 @@ void debug_view_memory::recompute() else { m_maxaddr = source.m_length - 1; - addrchars = m_addrformat.printf("%X", m_maxaddr); + addrchars = strprintf(m_addrformat, "%X", m_maxaddr); } // generate an 8-byte aligned format for the address if (!m_reverse_view) - m_addrformat.printf("%*s%%0%dX", 8 - addrchars, "", addrchars); + strprintf(m_addrformat, "%*s%%0%dX", 8 - addrchars, "", addrchars); else - m_addrformat.printf("%%0%dX%*s", addrchars, 8 - addrchars, ""); + strprintf(m_addrformat, "%%0%dX%*s", addrchars, 8 - addrchars, ""); // if we are viewing a space with a minimum chunk size, clamp the bytes per chunk if (source.m_space != NULL && source.m_space->byte_to_address(1) > 1) diff --git a/src/emu/debug/dvmemory.h b/src/emu/debug/dvmemory.h index 69db37b3102..e3d743169a5 100644 --- a/src/emu/debug/dvmemory.h +++ b/src/emu/debug/dvmemory.h @@ -108,7 +108,7 @@ private: offs_t m_maxaddr; // (derived) maximum address to display UINT32 m_bytes_per_row; // (derived) number of bytes displayed per line UINT32 m_byte_offset; // (derived) offset of starting visible byte - astring m_addrformat; // (derived) format string to use to print addresses + std::string m_addrformat; // (derived) format string to use to print addresses struct section { diff --git a/src/emu/debug/dvstate.c b/src/emu/debug/dvstate.c index 4d5ab739d00..8e5906be416 100644 --- a/src/emu/debug/dvstate.c +++ b/src/emu/debug/dvstate.c @@ -75,10 +75,10 @@ void debug_view_state::enumerate_sources() // iterate over devices that have state interfaces state_interface_iterator iter(machine().root_device()); - astring name; + std::string name; for (device_state_interface *state = iter.first(); state != NULL; state = iter.next()) { - name.printf("%s '%s'", state->device().name(), state->device().tag()); + strprintf(name,"%s '%s'", state->device().name(), state->device().tag()); m_source_list.append(*global_alloc(debug_view_state_source(name.c_str(), state->device()))); } @@ -160,7 +160,7 @@ void debug_view_state::recompute() for (state_item *item = m_state_list; item != NULL; item = item->m_next) { count++; - maxtaglen = MAX(maxtaglen, item->m_symbol.len()); + maxtaglen = MAX(maxtaglen, item->m_symbol.length()); maxvallen = MAX(maxvallen, item->m_vallen); } @@ -223,7 +223,7 @@ void debug_view_state::view_update() UINT32 effcol = m_topleft.x; UINT8 attrib = DCA_NORMAL; UINT32 len = 0; - astring valstr; + std::string valstr; // get the effective string if (curitem->m_index >= REG_FRAME && curitem->m_index <= REG_DIVIDER) @@ -233,16 +233,16 @@ void debug_view_state::view_update() { case REG_DIVIDER: curitem->m_vallen = 0; - curitem->m_symbol.reset(); + curitem->m_symbol.clear(); for (int i = 0; i < m_total.x; i++) - curitem->m_symbol.cat("-"); + curitem->m_symbol.append("-"); break; case REG_CYCLES: if (source.m_execintf != NULL) { curitem->m_currval = source.m_execintf->cycles_remaining(); - valstr.printf("%-8d", (UINT32)curitem->m_currval); + strprintf(valstr, "%-8d", (UINT32)curitem->m_currval); } break; @@ -250,7 +250,7 @@ void debug_view_state::view_update() if (screen != NULL) { curitem->m_currval = screen->hpos(); - valstr.printf("%4d", (UINT32)curitem->m_currval); + strprintf(valstr, "%4d", (UINT32)curitem->m_currval); } break; @@ -258,7 +258,7 @@ void debug_view_state::view_update() if (screen != NULL) { curitem->m_currval = screen->vpos(); - valstr.printf("%4d", (UINT32)curitem->m_currval); + strprintf(valstr, "%4d", (UINT32)curitem->m_currval); } break; @@ -266,7 +266,7 @@ void debug_view_state::view_update() if (screen != NULL) { curitem->m_currval = screen->frame_number(); - valstr.printf("%6d", (UINT32)curitem->m_currval); + strprintf(valstr, "%6d", (UINT32)curitem->m_currval); } break; } @@ -285,14 +285,14 @@ void debug_view_state::view_update() // build up a string char temp[256]; - if (curitem->m_symbol.len() < m_divider - 1) + if (curitem->m_symbol.length() < m_divider - 1) { - memset(&temp[len], ' ', m_divider - 1 - curitem->m_symbol.len()); - len += m_divider - 1 - curitem->m_symbol.len(); + memset(&temp[len], ' ', m_divider - 1 - curitem->m_symbol.length()); + len += m_divider - 1 - curitem->m_symbol.length(); } - memcpy(&temp[len], curitem->m_symbol.c_str(), curitem->m_symbol.len()); - len += curitem->m_symbol.len(); + memcpy(&temp[len], curitem->m_symbol.c_str(), curitem->m_symbol.length()); + len += curitem->m_symbol.length(); temp[len++] = ' '; temp[len++] = ' '; diff --git a/src/emu/debug/dvstate.h b/src/emu/debug/dvstate.h index 932d4b80a41..88930587d7b 100644 --- a/src/emu/debug/dvstate.h +++ b/src/emu/debug/dvstate.h @@ -63,7 +63,7 @@ private: UINT64 m_currval; // current value int m_index; // index UINT8 m_vallen; // number of value chars - astring m_symbol; // symbol + std::string m_symbol; // symbol }; // internal helpers diff --git a/src/emu/debug/dvwpoints.c b/src/emu/debug/dvwpoints.c index d8b447a568a..2e5f89b24f3 100644 --- a/src/emu/debug/dvwpoints.c +++ b/src/emu/debug/dvwpoints.c @@ -154,8 +154,8 @@ void debug_view_watchpoints::enumerate_sources() disasm_interface_iterator iter(machine().root_device()); for (device_disasm_interface *dasm = iter.first(); dasm != NULL; dasm = iter.next()) { - astring name; - name.printf("%s '%s'", dasm->device().name(), dasm->device().tag()); + std::string name; + strprintf(name, "%s '%s'", dasm->device().name(), dasm->device().tag()); m_source_list.append(*global_alloc(debug_view_source(name.c_str(), &dasm->device()))); } @@ -211,16 +211,15 @@ void debug_view_watchpoints::view_click(const int button, const debug_view_xy& p } -void debug_view_watchpoints::pad_astring_to_length(astring& str, int len) +void debug_view_watchpoints::pad_astring_to_length(std::string& str, int len) { - int diff = len - str.len(); + int diff = len - str.length(); if (diff > 0) { - astring buffer; - buffer.expand(diff); + std::string buffer; for (int i = 0; i < diff; i++) - buffer.catprintf(" "); - str.catprintf("%s", buffer.c_str()); + buffer.append(" "); + strcatprintf(str, "%s", buffer.c_str()); } } @@ -263,48 +262,48 @@ void debug_view_watchpoints::view_update() // Draw debug_view_char *dest = &m_viewdata[0]; - astring linebuf; + std::string linebuf; // Header if (m_visible.y > 0) { - linebuf.reset(); - linebuf.cat("ID"); - if (m_sortType == &cIndexAscending) linebuf.cat('\\'); - else if (m_sortType == &cIndexDescending) linebuf.cat('/'); + linebuf.clear(); + linebuf.append("ID"); + if (m_sortType == &cIndexAscending) linebuf.push_back('\\'); + else if (m_sortType == &cIndexDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[0]); - linebuf.cat("En"); - if (m_sortType == &cEnabledAscending) linebuf.cat('\\'); - else if (m_sortType == &cEnabledDescending) linebuf.cat('/'); + linebuf.append("En"); + if (m_sortType == &cEnabledAscending) linebuf.push_back('\\'); + else if (m_sortType == &cEnabledDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[1]); - linebuf.cat("CPU"); - if (m_sortType == &cCpuAscending) linebuf.cat('\\'); - else if (m_sortType == &cCpuDescending) linebuf.cat('/'); + linebuf.append("CPU"); + if (m_sortType == &cCpuAscending) linebuf.push_back('\\'); + else if (m_sortType == &cCpuDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[2]); - linebuf.cat("Space"); - if (m_sortType == &cSpaceAscending) linebuf.cat('\\'); - else if (m_sortType == &cSpaceDescending) linebuf.cat('/'); + linebuf.append("Space"); + if (m_sortType == &cSpaceAscending) linebuf.push_back('\\'); + else if (m_sortType == &cSpaceDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[3]); - linebuf.cat("Addresses"); - if (m_sortType == &cAddressAscending) linebuf.cat('\\'); - else if (m_sortType == &cAddressDescending) linebuf.cat('/'); + linebuf.append("Addresses"); + if (m_sortType == &cAddressAscending) linebuf.push_back('\\'); + else if (m_sortType == &cAddressDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[4]); - linebuf.cat("Type"); - if (m_sortType == &cTypeAscending) linebuf.cat('\\'); - else if (m_sortType == &cTypeDescending) linebuf.cat('/'); + linebuf.append("Type"); + if (m_sortType == &cTypeAscending) linebuf.push_back('\\'); + else if (m_sortType == &cTypeDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[5]); - linebuf.cat("Condition"); - if (m_sortType == &cConditionAscending) linebuf.cat('\\'); - else if (m_sortType == &cConditionDescending) linebuf.cat('/'); + linebuf.append("Condition"); + if (m_sortType == &cConditionAscending) linebuf.push_back('\\'); + else if (m_sortType == &cConditionDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[6]); - linebuf.cat("Action"); - if (m_sortType == &cActionAscending) linebuf.cat('\\'); - else if (m_sortType == &cActionDescending) linebuf.cat('/'); + linebuf.append("Action"); + if (m_sortType == &cActionAscending) linebuf.push_back('\\'); + else if (m_sortType == &cActionDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[7]); for (UINT32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) { - dest->byte = (i < linebuf.len()) ? linebuf[i] : ' '; + dest->byte = (i < linebuf.length()) ? linebuf[i] : ' '; dest->attrib = DCA_ANCILLARY; } } @@ -318,30 +317,30 @@ void debug_view_watchpoints::view_update() static char const *const types[] = { "unkn ", "read ", "write", "r/w " }; device_debug::watchpoint *const wp = m_buffer[wpi]; - linebuf.reset(); - linebuf.catprintf("%2X", wp->index()); + linebuf.clear(); + strcatprintf(linebuf, "%2X", wp->index()); pad_astring_to_length(linebuf, tableBreaks[0]); - linebuf.cat(wp->enabled() ? 'X' : 'O'); + linebuf.push_back(wp->enabled() ? 'X' : 'O'); pad_astring_to_length(linebuf, tableBreaks[1]); - linebuf.cat(wp->debugInterface()->device().tag()); + linebuf.append(wp->debugInterface()->device().tag()); pad_astring_to_length(linebuf, tableBreaks[2]); - linebuf.cat(wp->space().name()); + linebuf.append(wp->space().name()); pad_astring_to_length(linebuf, tableBreaks[3]); - linebuf.cat(core_i64_hex_format(wp->space().byte_to_address(wp->address()), wp->space().addrchars())); - linebuf.cat('-'); - linebuf.cat(core_i64_hex_format(wp->space().byte_to_address_end(wp->address() + wp->length()) - 1, wp->space().addrchars())); + linebuf.append(core_i64_hex_format(wp->space().byte_to_address(wp->address()), wp->space().addrchars())); + linebuf.push_back('-'); + linebuf.append(core_i64_hex_format(wp->space().byte_to_address_end(wp->address() + wp->length()) - 1, wp->space().addrchars())); pad_astring_to_length(linebuf, tableBreaks[4]); - linebuf.cat(types[wp->type() & 3]); + linebuf.append(types[wp->type() & 3]); pad_astring_to_length(linebuf, tableBreaks[5]); if (strcmp(wp->condition(), "1")) - linebuf.cat(wp->condition()); + linebuf.append(wp->condition()); pad_astring_to_length(linebuf, tableBreaks[6]); - linebuf.cat(wp->action()); + linebuf.append(wp->action()); pad_astring_to_length(linebuf, tableBreaks[7]); for (UINT32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) { - dest->byte = (i < linebuf.len()) ? linebuf[i] : ' '; + dest->byte = (i < linebuf.length()) ? linebuf[i] : ' '; dest->attrib = DCA_NORMAL; // Color disabled watchpoints red diff --git a/src/emu/debug/dvwpoints.h b/src/emu/debug/dvwpoints.h index fc6b641effc..e56c992cb8d 100644 --- a/src/emu/debug/dvwpoints.h +++ b/src/emu/debug/dvwpoints.h @@ -42,7 +42,7 @@ protected: private: // internal helpers void enumerate_sources(); - void pad_astring_to_length(astring& str, int len); + void pad_astring_to_length(std::string& str, int len); void gather_watchpoints(); diff --git a/src/emu/debug/express.c b/src/emu/debug/express.c index 46a4ff22efc..a37a7796f5f 100644 --- a/src/emu/debug/express.c +++ b/src/emu/debug/express.c @@ -579,7 +579,7 @@ parsed_expression::parsed_expression(symbol_table *symtable, const char *express void parsed_expression::parse(const char *expression) { // copy the string and reset our parsing state - m_original_string.cpy(expression); + m_original_string.assign(expression); m_tokenlist.reset(); m_stringlist.reset(); @@ -598,7 +598,7 @@ void parsed_expression::parse(const char *expression) void parsed_expression::copy(const parsed_expression &src) { m_symtable = src.m_symtable; - m_original_string.cpy(src.m_original_string); + m_original_string.assign(src.m_original_string); if (!m_original_string.empty()) parse_string_into_tokens(); } @@ -1033,7 +1033,7 @@ void parsed_expression::parse_quoted_string(parse_token &token, const char *&str { // accumulate a copy of the quoted string string++; - astring buffer; + std::string buffer; while (string[0] != 0) { // allow "" to mean a nested double-quote @@ -1043,7 +1043,7 @@ void parsed_expression::parse_quoted_string(parse_token &token, const char *&str break; string++; } - buffer.cat(string++, 1); + buffer.append(string++, 1); } // if we didn't find the ending quote, report an error diff --git a/src/emu/debug/express.h b/src/emu/debug/express.h index 3063f5e9c04..37f357b0830 100644 --- a/src/emu/debug/express.h +++ b/src/emu/debug/express.h @@ -135,7 +135,7 @@ protected: symbol_entry * m_next; // link to next entry symbol_table & m_table; // pointer back to the owning table symbol_type m_type; // type of symbol - astring m_name; // name of the symbol + std::string m_name; // name of the symbol void * m_ref; // internal reference }; @@ -341,7 +341,7 @@ private: private: // internal state expression_string * m_next; // next string in list - astring m_string; // copy of the string + std::string m_string; // copy of the string }; // internal helpers @@ -373,7 +373,7 @@ private: // internal state symbol_table * m_symtable; // symbol table - astring m_original_string; // original string (prior to parsing) + std::string m_original_string; // original string (prior to parsing) simple_list<parse_token> m_tokenlist; // token list simple_list<expression_string> m_stringlist; // string list int m_token_stack_ptr; // stack pointer (used during execution) diff --git a/src/emu/devfind.h b/src/emu/devfind.h index 38f7705ca0a..2493a66782f 100644 --- a/src/emu/devfind.h +++ b/src/emu/devfind.h @@ -267,8 +267,9 @@ public: // construction/destruction ioport_array_finder(device_t &base, const char *basetag) { - for (int index = 0; index < _Count; index++) - m_array[index].reset(global_alloc(ioport_finder_type(base, m_tag[index].format("%s.%d", basetag, index).c_str()))); + for (int index = 0; index < _Count; index++) { + m_array[index].reset(global_alloc(ioport_finder_type(base, strformat(m_tag[index], "%s.%d", basetag, index).c_str()))); + } } ioport_array_finder(device_t &base, const char * const *tags) @@ -284,7 +285,7 @@ public: protected: // internal state auto_pointer<ioport_finder_type> m_array[_Count]; - astring m_tag[_Count]; + std::string m_tag[_Count]; }; // optional ioport array finder @@ -436,7 +437,7 @@ public: shared_ptr_array_finder(device_t &base, const char *basetag, UINT8 width = sizeof(_PointerType) * 8) { for (int index = 0; index < _Count; index++) - m_array[index].reset(global_alloc(shared_ptr_type(base, m_tag[index].format("%s.%d", basetag, index).c_str(), width))); + m_array[index].reset(global_alloc(shared_ptr_type(base, strformat(m_tag[index],"%s.%d", basetag, index).c_str(), width))); } // array accessors @@ -446,7 +447,7 @@ public: protected: // internal state auto_pointer<shared_ptr_type> m_array[_Count]; - astring m_tag[_Count]; + std::string m_tag[_Count]; }; // optional shared pointer array finder diff --git a/src/emu/diimage.c b/src/emu/diimage.c index 45474cca2c6..060e2a1b040 100644 --- a/src/emu/diimage.c +++ b/src/emu/diimage.c @@ -151,30 +151,31 @@ image_error_t device_image_interface::set_image_filename(const char *filename) { m_image_name = filename; zippath_parent(m_working_directory, filename); - m_basename.cpy(m_image_name); + m_basename.assign(m_image_name); - int loc1 = m_image_name.rchr(0,'\\'); - int loc2 = m_image_name.rchr(0,'/'); - int loc3 = m_image_name.rchr(0,':'); + int loc1 = m_image_name.find_last_of('\\'); + int loc2 = m_image_name.find_last_of('/'); + int loc3 = m_image_name.find_last_of(':'); int loc = MAX(loc1,MAX(loc2,loc3)); if (loc!=-1) { if (loc == loc3) { // temp workaround for softlists now that m_image_name contains the part name too (e.g. list:gamename:cart) - astring tmpstr = astring(m_basename.substr(0,loc)); - int tmploc = tmpstr.rchr(0,':'); + m_basename = m_basename.substr(0, loc); + std::string tmpstr = std::string(m_basename); + int tmploc = tmpstr.find_last_of(':'); m_basename = m_basename.substr(tmploc + 1,loc-tmploc); } else - m_basename = m_basename.substr(loc + 1,m_basename.len()-loc); + m_basename = m_basename.substr(loc + 1, m_basename.length() - loc); } - m_basename_noext = m_basename.cpy(m_basename); + m_basename_noext = m_basename.assign(m_basename); m_filetype = ""; - loc = m_basename_noext.rchr(0,'.'); + loc = m_basename_noext.find_last_of('.'); if (loc!=-1) { m_basename_noext = m_basename_noext.substr(0,loc); - m_filetype = m_basename.cpy(m_basename); - m_filetype = m_filetype.substr(loc + 1,m_filetype.len()-loc); + m_filetype = m_basename.assign(m_basename); + m_filetype = m_filetype.substr(loc + 1, m_filetype.length() - loc); } return IMAGE_ERROR_SUCCESS; @@ -212,7 +213,7 @@ void device_image_interface::clear_error() m_err = IMAGE_ERROR_SUCCESS; if (!m_err_message.empty()) { - m_err_message.reset(); + m_err_message.clear(); } } @@ -500,13 +501,13 @@ UINT32 device_image_interface::crc() -------------------------------------------------*/ void device_image_interface::battery_load(void *buffer, int length, int fill) { - astring fname = astring(device().machine().system().name).cat(PATH_SEPARATOR).cat(m_basename_noext.c_str()).cat(".nv"); + std::string fname = std::string(device().machine().system().name).append(PATH_SEPARATOR).append(m_basename_noext.c_str()).append(".nv"); image_battery_load_by_name(device().machine().options(), fname.c_str(), buffer, length, fill); } void device_image_interface::battery_load(void *buffer, int length, void *def_buffer) { - astring fname = astring(device().machine().system().name).cat(PATH_SEPARATOR).cat(m_basename_noext.c_str()).cat(".nv"); + std::string fname = std::string(device().machine().system().name).append(PATH_SEPARATOR).append(m_basename_noext.c_str()).append(".nv"); image_battery_load_by_name(device().machine().options(), fname.c_str(), buffer, length, def_buffer); } @@ -518,7 +519,7 @@ void device_image_interface::battery_load(void *buffer, int length, void *def_bu -------------------------------------------------*/ void device_image_interface::battery_save(const void *buffer, int length) { - astring fname = astring(device().machine().system().name).cat(PATH_SEPARATOR).cat(m_basename_noext.c_str()).cat(".nv"); + std::string fname = std::string(device().machine().system().name).append(PATH_SEPARATOR).append(m_basename_noext.c_str()).append(".nv"); image_battery_save_by_name(device().machine().options(), fname.c_str(), buffer, length); } @@ -536,7 +537,7 @@ bool device_image_interface::uses_file_extension(const char *file_extension) con file_extension++; /* find the extensions */ - astring extensions(file_extensions()); + std::string extensions(file_extensions()); char *ext = strtok((char*)extensions.c_str(),","); while (ext != NULL) { @@ -703,7 +704,7 @@ void device_image_interface::determine_open_plan(int is_create, UINT32 *open_pla static void dump_wrong_and_correct_checksums(const hash_collection &hashes, const hash_collection &acthashes) { - astring tempstr; + std::string tempstr; osd_printf_error(" EXPECTED: %s\n", hashes.macro_string(tempstr)); osd_printf_error(" FOUND: %s\n", acthashes.macro_string(tempstr)); } @@ -727,7 +728,7 @@ static int verify_length_and_hash(emu_file *file, const char *name, UINT32 exple } /* If there is no good dump known, write it */ - astring tempstr; + std::string tempstr; hash_collection &acthashes = file->hashes(hashes.hash_types(tempstr)); if (hashes.flag(hash_collection::FLAG_NO_DUMP)) { @@ -755,9 +756,9 @@ static int verify_length_and_hash(emu_file *file, const char *name, UINT32 exple bool device_image_interface::load_software(software_list_device &swlist, const char *swname, const rom_entry *start) { - astring locationtag, breakstr("%"); + std::string locationtag, breakstr("%"); const rom_entry *region; - astring regiontag; + std::string regiontag; bool retVal = FALSE; int warningcount = 0; for (region = start; region != NULL; region = rom_next_region(region)) @@ -784,40 +785,40 @@ bool device_image_interface::load_software(software_list_device &swlist, const c if (supported == SOFTWARE_SUPPORTED_NO) osd_printf_error("WARNING: support for software %s (in list %s) is only preliminary\n", swname, swlist.list_name()); - // attempt reading up the chain through the parents and create a locationtag astring in the format + // attempt reading up the chain through the parents and create a locationtag std::string in the format // " swlist % clonename % parentname " // below, we have the code to split the elements and to create paths to load from while (swinfo != NULL) { - locationtag.cat(swinfo->shortname()).cat(breakstr); + locationtag.append(swinfo->shortname()).append(breakstr); const char *parentname = swinfo->parentname(); swinfo = (parentname != NULL) ? swlist.find(parentname) : NULL; } // strip the final '%' - locationtag.del(locationtag.len() - 1, 1); + locationtag.erase(locationtag.length() - 1, 1); // check if locationtag actually contains two locations separated by '%' // (i.e. check if we are dealing with a clone in softwarelist) - astring tag2, tag3, tag4(locationtag), tag5; - int separator = tag4.chr(0, '%'); + std::string tag2, tag3, tag4(locationtag), tag5; + int separator = tag4.find_first_of('%'); if (separator != -1) { - // we are loading a clone through softlists, split the setname from the parentname - tag5.cpysubstr(tag4, separator + 1, tag4.len() - separator + 1); - tag4.del(separator, tag4.len() - separator); + // we are loading a clone through softlists, split the setname from the parentname + tag5.assign(tag4.substr(separator + 1, tag4.length() - separator + 1)); + tag4.erase(separator, tag4.length() - separator); } // prepare locations where we have to load from: list/parentname & list/clonename - astring tag1(swlist.list_name()); - tag1.cat(PATH_SEPARATOR); - tag2.cpy(tag1.cat(tag4)); - tag1.cpy(swlist.list_name()); - tag1.cat(PATH_SEPARATOR); - tag3.cpy(tag1.cat(tag5)); - - if (tag5.chr(0, '%') != -1) + std::string tag1(swlist.list_name()); + tag1.append(PATH_SEPARATOR); + tag2.assign(tag1.append(tag4)); + tag1.assign(swlist.list_name()); + tag1.append(PATH_SEPARATOR); + tag3.assign(tag1.append(tag5)); + + if (tag5.find_first_of('%') != -1) fatalerror("We do not support clones of clones!\n"); // try to load from the available location(s): @@ -868,8 +869,8 @@ bool device_image_interface::load_internal(const char *path, bool is_create, int m_from_swlist = FALSE; // if the path contains no period, we are using softlists, so we won't create an image - astring pathstr(path); - bool filename_has_period = (pathstr.rchr(0, '.') != -1) ? TRUE : FALSE; + std::string pathstr(path); + bool filename_has_period = (pathstr.find_last_of('.') != -1) ? TRUE : FALSE; /* first unload the image */ unload(); @@ -895,8 +896,8 @@ bool device_image_interface::load_internal(const char *path, bool is_create, int if (softload) { m_software_info_ptr = &m_software_part_ptr->info(); - m_software_list_name.cpy(m_software_info_ptr->list().list_name()); - m_full_software_name.cpy(m_software_part_ptr->info().shortname()); + m_software_list_name.assign(m_software_info_ptr->list().list_name()); + m_full_software_name.assign(m_software_part_ptr->info().shortname()); // if we had launched from softlist with a specified part, e.g. "shortname:part" // we would have recorded the wrong name, so record it again based on software_info @@ -1094,21 +1095,21 @@ void device_image_interface::clear() } } - m_image_name.reset(); + m_image_name.clear(); m_readonly = false; m_created = false; - m_longname.reset(); - m_manufacturer.reset(); - m_year.reset(); - m_basename.reset(); - m_basename_noext.reset(); - m_filetype.reset(); + m_longname.clear(); + m_manufacturer.clear(); + m_year.clear(); + m_basename.clear(); + m_basename_noext.clear(); + m_filetype.clear(); - m_full_software_name.reset(); + m_full_software_name.clear(); m_software_info_ptr = NULL; m_software_part_ptr = NULL; - m_software_list_name.reset(); + m_software_list_name.clear(); } /*------------------------------------------------- @@ -1145,8 +1146,8 @@ void device_image_interface::update_names(const device_type device_type, const c const char *brief_name = (device_type!=NULL) ? brief : device_brieftypename(image_type()); if (count > 1) { - m_instance_name.printf("%s%d", inst_name , index + 1); - m_brief_instance_name.printf("%s%d", brief_name, index + 1); + strprintf(m_instance_name,"%s%d", inst_name, index + 1); + strprintf(m_brief_instance_name, "%s%d", brief_name, index + 1); } else { @@ -1276,8 +1277,8 @@ bool device_image_interface::load_software_part(const char *path, software_part bool result = call_softlist_load(swpart->info().list(), swpart->info().shortname(), swpart->romdata()); // Tell the world which part we actually loaded - astring full_sw_name; - full_sw_name.printf("%s:%s:%s", swpart->info().list().list_name(), swpart->info().shortname(), swpart->name()); + std::string full_sw_name; + strprintf(full_sw_name,"%s:%s:%s", swpart->info().list().list_name(), swpart->info().shortname(), swpart->name()); // check compatibility if (!swpart->is_compatible(swpart->info().list())) diff --git a/src/emu/diimage.h b/src/emu/diimage.h index 3d082af7b2e..b8a7038f6e3 100644 --- a/src/emu/diimage.h +++ b/src/emu/diimage.h @@ -87,10 +87,10 @@ public: private: image_device_format *m_next; - astring m_name; - astring m_description; - astring m_extensions; - astring m_optspec; + std::string m_name; + std::string m_description; + std::string m_extensions; + std::string m_optspec; }; @@ -269,29 +269,29 @@ protected: /* error related info */ image_error_t m_err; - astring m_err_message; + std::string m_err_message; /* variables that are only non-zero when an image is mounted */ core_file *m_file; emu_file *m_mame_file; - astring m_image_name; - astring m_basename; - astring m_basename_noext; - astring m_filetype; + std::string m_image_name; + std::string m_basename; + std::string m_basename_noext; + std::string m_filetype; /* working directory; persists across mounts */ std::string m_working_directory; /* Software information */ - astring m_full_software_name; + std::string m_full_software_name; software_info *m_software_info_ptr; software_part *m_software_part_ptr; - astring m_software_list_name; + std::string m_software_list_name; /* info read from the hash file/software list */ - astring m_longname; - astring m_manufacturer; - astring m_year; + std::string m_longname; + std::string m_manufacturer; + std::string m_year; UINT32 m_supported; /* flags */ @@ -306,8 +306,8 @@ protected: hash_collection m_hash; - astring m_brief_instance_name; - astring m_instance_name; + std::string m_brief_instance_name; + std::string m_instance_name; /* creation info */ simple_list<image_device_format> m_formatlist; diff --git a/src/emu/dimemory.c b/src/emu/dimemory.c index 362c0fe8fda..f269c9caf21 100644 --- a/src/emu/dimemory.c +++ b/src/emu/dimemory.c @@ -326,13 +326,13 @@ void device_memory_interface::interface_validity_check(validity_checker &valid) // FIXME: This doesn't work! AMH_DEVICE_DELEGATE entries don't even set m_tag, the device tag is inside the proto-delegate if (entry->m_read.m_type == AMH_DEVICE_DELEGATE && entry->m_read.m_tag != NULL) { - astring temp(entry->m_read.m_tag); + std::string temp(entry->m_read.m_tag); if (device().siblingdevice(temp.c_str()) == NULL) osd_printf_error("%s space memory map entry references nonexistant device '%s'\n", spaceconfig->m_name, entry->m_read.m_tag); } if (entry->m_write.m_type == AMH_DEVICE_DELEGATE && entry->m_write.m_tag != NULL) { - astring temp(entry->m_write.m_tag); + std::string temp(entry->m_write.m_tag); if (device().siblingdevice(temp.c_str()) == NULL) osd_printf_error("%s space memory map entry references nonexistant device '%s'\n", spaceconfig->m_name, entry->m_write.m_tag); } diff --git a/src/emu/dislot.c b/src/emu/dislot.c index 22fc5c903f9..e0c07d206f1 100644 --- a/src/emu/dislot.c +++ b/src/emu/dislot.c @@ -64,7 +64,7 @@ device_t* device_slot_interface::get_card_device() { const char *subtag; device_t *dev = NULL; - astring temp; + std::string temp; if (!device().mconfig().options().exists(device().tag()+1)) { subtag = m_default_option; } else { diff --git a/src/emu/disound.h b/src/emu/disound.h index 3dd3737b35f..949d03ce29e 100644 --- a/src/emu/disound.h +++ b/src/emu/disound.h @@ -80,7 +80,7 @@ public: UINT32 m_input; // target input index UINT32 m_mixoutput; // target mixer output float m_gain; // gain - astring m_target; // target tag + std::string m_target; // target tag }; // construction/destruction diff --git a/src/emu/distate.c b/src/emu/distate.c index 9cafa069e37..79ec37e422b 100644 --- a/src/emu/distate.c +++ b/src/emu/distate.c @@ -78,13 +78,13 @@ device_state_entry::device_state_entry(int index, const char *symbol, void *data // override well-known symbols if (index == STATE_GENPC) - m_symbol.cpy("CURPC"); + m_symbol.assign("CURPC"); else if (index == STATE_GENPCBASE) - m_symbol.cpy("CURPCBASE"); + m_symbol.assign("CURPCBASE"); else if (index == STATE_GENSP) - m_symbol.cpy("CURSP"); + m_symbol.assign("CURSP"); else if (index == STATE_GENFLAGS) - m_symbol.cpy("CURFLAGS"); + m_symbol.assign("CURFLAGS"); } device_state_entry::device_state_entry(int index, device_state_interface *dev) @@ -108,12 +108,12 @@ device_state_entry::device_state_entry(int index, device_state_interface *dev) device_state_entry &device_state_entry::formatstr(const char *_format) { - m_format.cpy(_format); + m_format.assign(_format); m_default_format = false; // set the DSF_CUSTOM_STRING flag by formatting with a NULL string m_flags &= ~DSF_CUSTOM_STRING; - astring dummy; + std::string dummy; format(dummy, NULL); return *this; @@ -135,7 +135,7 @@ void device_state_entry::format_from_mask() int width = 0; for (UINT64 tempmask = m_datamask; tempmask != 0; tempmask >>= 4) width++; - m_format.printf("%%0%dX", width); + strprintf(m_format,"%%0%dX", width); } @@ -164,7 +164,7 @@ UINT64 device_state_entry::value() const // pieces of indexed state as a string //------------------------------------------------- -astring &device_state_entry::format(astring &dest, const char *string, bool maxout) const +std::string &device_state_entry::format(std::string &dest, const char *string, bool maxout) const { UINT64 result = value(); @@ -188,7 +188,7 @@ astring &device_state_entry::format(astring &dest, const char *string, bool maxo // if we're not within a format, then anything other than a % outputs directly if (!percent && *fptr != '%') { - dest.cat(fptr, 1); + dest.append(fptr, 1); continue; } @@ -201,7 +201,7 @@ astring &device_state_entry::format(astring &dest, const char *string, bool maxo percent = true; else { - dest.cat(fptr, 1); + dest.append(fptr, 1); percent = false; } break; @@ -232,7 +232,7 @@ astring &device_state_entry::format(astring &dest, const char *string, bool maxo hitnonzero = false; while (leadzero && width > 16) { - dest.cat(" "); + dest.append(" "); width--; } for (int digitnum = 15; digitnum >= 0; digitnum--) @@ -241,11 +241,11 @@ astring &device_state_entry::format(astring &dest, const char *string, bool maxo if (digit != 0) { static const char hexchars[] = "0123456789ABCDEF"; - dest.cat(&hexchars[digit], 1); + dest.append(&hexchars[digit], 1); hitnonzero = true; } else if (hitnonzero || (leadzero && digitnum < width) || digitnum == 0) - dest.cat("0"); + dest.append("0"); } reset = true; break; @@ -257,7 +257,7 @@ astring &device_state_entry::format(astring &dest, const char *string, bool maxo hitnonzero = false; while (leadzero && width > 22) { - dest.cat(" "); + dest.append(" "); width--; } for (int digitnum = 21; digitnum >= 0; digitnum--) @@ -266,11 +266,11 @@ astring &device_state_entry::format(astring &dest, const char *string, bool maxo if (digit != 0) { static const char octchars[] = "01234567"; - dest.cat(&octchars[digit], 1); + dest.append(&octchars[digit], 1); hitnonzero = true; } else if (hitnonzero || (leadzero && digitnum < width) || digitnum == 0) - dest.cat("0"); + dest.append("0"); } reset = true; break; @@ -282,12 +282,12 @@ astring &device_state_entry::format(astring &dest, const char *string, bool maxo if ((result & m_datamask) > (m_datamask >> 1)) { result = -result & m_datamask; - dest.cat("-"); + dest.append("-"); width--; } else if (explicitsign) { - dest.cat("+"); + dest.append("+"); width--; } // fall through to unsigned case @@ -299,7 +299,7 @@ astring &device_state_entry::format(astring &dest, const char *string, bool maxo hitnonzero = false; while (leadzero && width > ARRAY_LENGTH(k_decimal_divisor)) { - dest.cat(" "); + dest.append(" "); width--; } for (int digitnum = ARRAY_LENGTH(k_decimal_divisor) - 1; digitnum >= 0; digitnum--) @@ -308,11 +308,11 @@ astring &device_state_entry::format(astring &dest, const char *string, bool maxo if (digit != 0) { static const char decchars[] = "0123456789"; - dest.cat(&decchars[digit], 1); + dest.append(&decchars[digit], 1); hitnonzero = true; } else if (hitnonzero || (leadzero && digitnum < width) || digitnum == 0) - dest.cat("0"); + dest.append("0"); } reset = true; break; @@ -328,13 +328,13 @@ astring &device_state_entry::format(astring &dest, const char *string, bool maxo } if (strlen(string) <= width) { - dest.cat(string); + dest.append(string); width -= strlen(string); while (width-- != 0) - dest.cat(" "); + dest.append(" "); } else - dest.cat(string, width); + dest.append(string, width); reset = true; break; @@ -436,15 +436,15 @@ UINT64 device_state_interface::state_int(int index) // pieces of indexed state as a string //------------------------------------------------- -astring &device_state_interface::state_string(int index, astring &dest) +std::string &device_state_interface::state_string(int index, std::string &dest) { // NULL or out-of-range entry returns bogus string const device_state_entry *entry = state_find_entry(index); if (entry == NULL) - return dest.cpy("???"); + return dest.assign("???"); // get the custom string if needed - astring custom; + std::string custom; if (entry->needs_custom_string()) state_string_export(*entry, custom); @@ -466,8 +466,8 @@ int device_state_interface::state_string_max_length(int index) return 3; // ask the entry to format itself maximally - astring tempstring; - return entry->format(tempstring, "", true).len(); + std::string tempstring; + return entry->format(tempstring, "", true).length(); } @@ -580,7 +580,7 @@ void device_state_interface::state_export(const device_state_entry &entry) // written to perform any post-processing //------------------------------------------------- -void device_state_interface::state_string_import(const device_state_entry &entry, astring &str) +void device_state_interface::state_string_import(const device_state_entry &entry, std::string &str) { // do nothing by default } @@ -591,7 +591,7 @@ void device_state_interface::state_string_import(const device_state_entry &entry // written to perform any post-processing //------------------------------------------------- -void device_state_interface::state_string_export(const device_state_entry &entry, astring &str) +void device_state_interface::state_string_export(const device_state_entry &entry, std::string &str) { // do nothing by default } diff --git a/src/emu/distate.h b/src/emu/distate.h index 8e660422be5..352a3c1337d 100644 --- a/src/emu/distate.h +++ b/src/emu/distate.h @@ -87,7 +87,7 @@ protected: // return the current value -- only for our friends who handle export bool needs_export() const { return ((m_flags & DSF_EXPORT) != 0); } UINT64 value() const; - astring &format(astring &dest, const char *string, bool maxout = false) const; + std::string &format(std::string &dest, const char *string, bool maxout = false) const; // set the current value -- only for our friends who handle import bool needs_import() const { return ((m_flags & DSF_IMPORT) != 0); } @@ -105,8 +105,8 @@ protected: UINT64 m_datamask; // mask that applies to the data UINT8 m_datasize; // size of the data UINT8 m_flags; // flags for this data - astring m_symbol; // symbol for display; all lower-case version for expressions - astring m_format; // supported formats + std::string m_symbol; // symbol for display; all lower-case version for expressions + std::string m_format; // supported formats bool m_default_format; // true if we are still using default format UINT64 m_sizemask; // mask derived from the data size }; @@ -128,7 +128,7 @@ public: // state getters UINT64 state_int(int index); - astring &state_string(int index, astring &dest); + std::string &state_string(int index, std::string &dest); int state_string_max_length(int index); offs_t pc() { return state_int(STATE_GENPC); } offs_t pcbase() { return state_int(STATE_GENPCBASE); } @@ -162,8 +162,8 @@ protected: // derived class overrides virtual void state_import(const device_state_entry &entry); virtual void state_export(const device_state_entry &entry); - virtual void state_string_import(const device_state_entry &entry, astring &str); - virtual void state_string_export(const device_state_entry &entry, astring &str); + virtual void state_string_import(const device_state_entry &entry, std::string &str); + virtual void state_string_export(const device_state_entry &entry, std::string &str); // internal operation overrides virtual void interface_post_start(); diff --git a/src/emu/emucore.h b/src/emu/emucore.h index 7183c3ca838..bffac6e0bf6 100644 --- a/src/emu/emucore.h +++ b/src/emu/emucore.h @@ -31,11 +31,9 @@ // standard C++ includes #include <exception> #include <typeinfo> -#include <string> // core system includes #include "osdcomm.h" -#include "astring.h" #include "emualloc.h" #include "corestr.h" #include "bitmap.h" diff --git a/src/emu/emuopts.c b/src/emu/emuopts.c index 5ac2d8780d4..fb06caf7f6c 100644 --- a/src/emu/emuopts.c +++ b/src/emu/emuopts.c @@ -310,10 +310,10 @@ void emu_options::add_device_options(bool isfirstpass) first = false; // retrieve info about the device instance - astring option_name; - option_name.printf("%s;%s", image->instance_name(), image->brief_instance_name()); + std::string option_name; + strprintf(option_name, "%s;%s", image->instance_name(), image->brief_instance_name()); if (strcmp(image->device_typename(image->image_type()), image->instance_name()) == 0) - option_name.catprintf(";%s1;%s1", image->instance_name(), image->brief_instance_name()); + strprintf(option_name, ";%s1;%s1", image->instance_name(), image->brief_instance_name()); // add the option if (!exists(image->instance_name())) @@ -347,7 +347,7 @@ void emu_options::remove_device_options() // and update slot and image devices //------------------------------------------------- -bool emu_options::parse_slot_devices(int argc, char *argv[], astring &error_string, const char *name, const char *value) +bool emu_options::parse_slot_devices(int argc, char *argv[], std::string &error_string, const char *name, const char *value) { // an initial parse to capture the initial set of values bool result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); @@ -382,7 +382,7 @@ bool emu_options::parse_slot_devices(int argc, char *argv[], astring &error_stri // and update the devices //------------------------------------------------- -bool emu_options::parse_command_line(int argc, char *argv[], astring &error_string) +bool emu_options::parse_command_line(int argc, char *argv[], std::string &error_string) { // parse as normal core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); @@ -395,10 +395,10 @@ bool emu_options::parse_command_line(int argc, char *argv[], astring &error_stri // of INI files //------------------------------------------------- -void emu_options::parse_standard_inis(astring &error_string) +void emu_options::parse_standard_inis(std::string &error_string) { // start with an empty string - error_string.reset(); + error_string.clear(); // parse the INI file defined by the platform (e.g., "mame.ini") // we do this twice so that the first file can change the INI path @@ -442,8 +442,8 @@ void emu_options::parse_standard_inis(astring &error_string) } // next parse "source/<sourcefile>.ini"; if that doesn't exist, try <sourcefile>.ini - astring sourcename; - core_filename_extract_base(sourcename, cursystem->source_file, true).ins(0, "source" PATH_SEPARATOR); + std::string sourcename; + core_filename_extract_base(sourcename, cursystem->source_file, true).insert(0, "source" PATH_SEPARATOR); if (!parse_one_ini(sourcename.c_str(), OPTION_PRIORITY_SOURCE_INI, &error_string)) { core_filename_extract_base(sourcename, cursystem->source_file, true); @@ -471,7 +471,7 @@ void emu_options::parse_standard_inis(astring &error_string) const game_driver *emu_options::system() const { - astring tempstr; + std::string tempstr; int index = driver_list::find(core_filename_extract_base(tempstr, system_name(), true).c_str()); return (index != -1) ? &driver_list::driver(index) : NULL; } @@ -490,7 +490,7 @@ void emu_options::set_system_name(const char *name) if (old_system_name.compare(name)!=0) { // first set the new name - astring error; + std::string error; set_value(OPTION_SYSTEMNAME, name, OPTION_PRIORITY_CMDLINE, error); assert(error.empty()); @@ -513,7 +513,7 @@ void emu_options::set_system_name(const char *name) // parse_one_ini - parse a single INI file //------------------------------------------------- -bool emu_options::parse_one_ini(const char *basename, int priority, astring *error_string) +bool emu_options::parse_one_ini(const char *basename, int priority, std::string *error_string) { // don't parse if it has been disabled if (!read_config()) @@ -527,39 +527,39 @@ bool emu_options::parse_one_ini(const char *basename, int priority, astring *err // parse the file osd_printf_verbose("Parsing %s.ini\n", basename); - astring error; + std::string error; bool result = parse_ini_file(file, priority, OPTION_PRIORITY_DRIVER_INI, error); // append errors if requested if (!error.empty() && error_string != NULL) - error_string->catprintf("While parsing %s:\n%s\n", file.fullpath(), error.c_str()); + strcatprintf(*error_string, "While parsing %s:\n%s\n", file.fullpath(), error.c_str()); return result; } -const char *emu_options::main_value(astring &buffer, const char *name) const +const char *emu_options::main_value(std::string &buffer, const char *name) const { buffer = value(name); - int pos = buffer.chr(0, ','); + int pos = buffer.find_first_of(','); if (pos != -1) buffer = buffer.substr(0, pos); return buffer.c_str(); } -const char *emu_options::sub_value(astring &buffer, const char *name, const char *subname) const +const char *emu_options::sub_value(std::string &buffer, const char *name, const char *subname) const { - astring tmp = astring(",").cat(subname).cat("="); + std::string tmp = std::string(",").append(subname).append("="); buffer = value(name); - int pos = buffer.find(0, tmp.c_str()); + int pos = buffer.find(tmp.c_str()); if (pos != -1) { - int endpos = buffer.chr(pos + 1, ','); + int endpos = buffer.find_first_of(',', pos + 1); if (endpos == -1) - endpos = buffer.len(); - buffer = buffer.substr(pos + tmp.len(), endpos - pos - tmp.len()); + endpos = buffer.length(); + buffer = buffer.substr(pos + tmp.length(), endpos - pos - tmp.length()); } else - buffer.reset(); + buffer.clear(); return buffer.c_str(); } diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h index aadb98a72c7..ac2f18ac767 100644 --- a/src/emu/emuopts.h +++ b/src/emu/emuopts.h @@ -203,9 +203,9 @@ public: emu_options(); // parsing wrappers - bool parse_command_line(int argc, char *argv[], astring &error_string); - void parse_standard_inis(astring &error_string); - bool parse_slot_devices(int argc, char *argv[], astring &error_string, const char *name, const char *value); + bool parse_command_line(int argc, char *argv[], std::string &error_string); + void parse_standard_inis(std::string &error_string); + bool parse_slot_devices(int argc, char *argv[], std::string &error_string, const char *name, const char *value); // core options const char *system_name() const { return value(OPTION_SYSTEMNAME); } @@ -358,8 +358,8 @@ public: // FIXME: Couriersud: This should be in image_device_exit void remove_device_options(); - const char *main_value(astring &buffer, const char *option) const; - const char *sub_value(astring &buffer, const char *name, const char *subname) const; + const char *main_value(std::string &buffer, const char *option) const; + const char *sub_value(std::string &buffer, const char *name, const char *subname) const; bool add_slot_options(bool isfirst); private: @@ -368,7 +368,7 @@ private: void update_slot_options(); // INI parsing helper - bool parse_one_ini(const char *basename, int priority, astring *error_string = NULL); + bool parse_one_ini(const char *basename, int priority, std::string *error_string = NULL); static const options_entry s_option_entries[]; }; diff --git a/src/emu/emupal.c b/src/emu/emupal.c index b5f0c128f6a..c4190456567 100644 --- a/src/emu/emupal.c +++ b/src/emu/emupal.c @@ -408,7 +408,7 @@ void palette_device::device_start() if (share != NULL) { // find the extended (split) memory, if present - astring tag_ext = astring(tag()).cat("_ext"); + std::string tag_ext = std::string(tag()).append("_ext"); const memory_share *share_ext = memshare(tag_ext.c_str()); // make sure we have specified a format diff --git a/src/emu/fileio.c b/src/emu/fileio.c index ddc225e67f3..2314e31564f 100644 --- a/src/emu/fileio.c +++ b/src/emu/fileio.c @@ -39,7 +39,7 @@ path_iterator::path_iterator(const char *rawsearchpath) // in a multipath sequence //------------------------------------------------- -bool path_iterator::next(astring &buffer, const char *name) +bool path_iterator::next(std::string &buffer, const char *name) { // if none left, return FALSE to indicate we are done if (m_index != 0 && *m_current == 0) @@ -49,16 +49,16 @@ bool path_iterator::next(astring &buffer, const char *name) const char *semi = strchr(m_current, ';'); if (semi == NULL) semi = m_current + strlen(m_current); - buffer.cpy(m_current, semi - m_current); + buffer.assign(m_current, semi - m_current); m_current = (*semi == 0) ? semi : semi + 1; // append the name if we have one if (name != NULL) { // compute the full pathname - if (buffer.len() > 0) - buffer.cat(PATH_SEPARATOR); - buffer.cat(name); + if (buffer.length() > 0) + buffer.append(PATH_SEPARATOR); + buffer.append(name); } // bump the index and return TRUE @@ -219,14 +219,14 @@ emu_file::operator core_file &() hash_collection &emu_file::hashes(const char *types) { // determine the hashes we already have - astring already_have; + std::string already_have; m_hashes.hash_types(already_have); // determine which hashes we need - astring needed; + std::string needed; for (const char *scan = types; *scan != 0; scan++) - if (already_have.chr(0, *scan) == -1) - needed.cat(*scan); + if (already_have.find_first_of(*scan) == -1) + needed.push_back(*scan); // if we need nothing, skip it if (needed.empty()) @@ -281,21 +281,21 @@ file_error emu_file::open(const char *name) file_error emu_file::open(const char *name1, const char *name2) { // concatenate the strings and do a standard open - astring name = astring(name1).cat(name2); + std::string name = std::string(name1).append(name2); return open(name.c_str()); } file_error emu_file::open(const char *name1, const char *name2, const char *name3) { // concatenate the strings and do a standard open - astring name = astring(name1).cat(name2).cat(name3); + std::string name = std::string(name1).append(name2).append(name3); return open(name.c_str()); } file_error emu_file::open(const char *name1, const char *name2, const char *name3, const char *name4) { // concatenate the strings and do a standard open - astring name = astring(name1).cat(name2).cat(name3).cat(name4); + std::string name = std::string(name1).append(name2).append(name3).append(name4); return open(name.c_str()); } @@ -314,21 +314,21 @@ file_error emu_file::open(const char *name, UINT32 crc) file_error emu_file::open(const char *name1, const char *name2, UINT32 crc) { // concatenate the strings and do a standard open - astring name = astring(name1).cat(name2); + std::string name = std::string(name1).append(name2); return open(name.c_str(), crc); } file_error emu_file::open(const char *name1, const char *name2, const char *name3, UINT32 crc) { // concatenate the strings and do a standard open - astring name = astring(name1).cat(name2).cat(name3); + std::string name = std::string(name1).append(name2).append(name3); return open(name.c_str(), crc); } file_error emu_file::open(const char *name1, const char *name2, const char *name3, const char *name4, UINT32 crc) { // concatenate the strings and do a standard open - astring name = astring(name1).cat(name2).cat(name3).cat(name4); + std::string name = std::string(name1).append(name2).append(name3).append(name4); return open(name.c_str(), crc); } @@ -356,7 +356,7 @@ file_error emu_file::open_next() // if we're opening for read-only we have other options if ((m_openflags & (OPEN_FLAG_READ | OPEN_FLAG_WRITE)) == OPEN_FLAG_READ) { - astring tempfullpath = m_fullpath; + std::string tempfullpath = m_fullpath; filerr = attempt_zipped(); if (filerr == FILERR_NONE) @@ -418,7 +418,7 @@ void emu_file::close() // reset our hashes and path as well m_hashes.reset(); - m_fullpath.reset(); + m_fullpath.clear(); } @@ -657,14 +657,15 @@ int emu_file::vprintf(const char *fmt, va_list va) // any media path //------------------------------------------------- -bool emu_file::part_of_mediapath(astring path) +bool emu_file::part_of_mediapath(std::string path) { bool result = false; - astring mediapath; + std::string mediapath; m_mediapaths.reset(); - while (m_mediapaths.next(mediapath, NULL) && !result) - if (path.cmpsubstr(mediapath, 0, mediapath.len())) + while (m_mediapaths.next(mediapath, NULL) && !result) { + if (path.compare(mediapath.substr(0, mediapath.length()))) result = true; + } return result; } @@ -674,13 +675,13 @@ bool emu_file::part_of_mediapath(astring path) file_error emu_file::attempt_zipped() { - astring filename; + std::string filename; // loop over directory parts up to the start of filename while (1) { // find the final path separator - int dirsep = m_fullpath.rchr(0, PATH_SEPARATOR[0]); + int dirsep = m_fullpath.find_last_of(PATH_SEPARATOR[0]); if (dirsep == -1) return FILERR_NOT_FOUND; @@ -689,19 +690,19 @@ file_error emu_file::attempt_zipped() return FILERR_NOT_FOUND; // insert the part from the right of the separator into the head of the filename - if (filename.len() > 0) - filename.ins(0, "/"); - filename.inssubstr(0, m_fullpath, dirsep + 1, -1); + if (filename.length() > 0) + filename.insert(0, "/"); + filename.insert(0, m_fullpath.substr(dirsep + 1, -1)); // remove this part of the filename and append a .zip extension - m_fullpath.substr(0, dirsep).cat(".zip"); + m_fullpath = m_fullpath.substr(0, dirsep).append(".zip"); // attempt to open the ZIP file zip_file *zip; zip_error ziperr = zip_file_open(m_fullpath.c_str(), &zip); // chop the .zip back off the filename before continuing - m_fullpath.substr(0, dirsep); + m_fullpath = m_fullpath.substr(0, dirsep); // if we failed to open this file, continue scanning if (ziperr != ZIPERR_NONE) @@ -785,10 +786,11 @@ file_error emu_file::load_zipped_file() // to expected filename, ignoring any directory //------------------------------------------------- -bool emu_file::zip_filename_match(const zip_file_header &header, const astring &filename) +bool emu_file::zip_filename_match(const zip_file_header &header, const std::string &filename) { - const char *zipfile = header.filename + header.filename_length - filename.len(); - return (zipfile >= header.filename && filename.icmp(zipfile) == 0 && (zipfile == header.filename || zipfile[-1] == '/')); + const char *zipfile = header.filename + header.filename_length - filename.length(); + //FIXME: check if it should be case insensitive + return (zipfile >= header.filename && filename.compare(zipfile) == 0 && (zipfile == header.filename || zipfile[-1] == '/')); } @@ -809,13 +811,13 @@ bool emu_file::zip_header_is_path(const zip_file_header &header) file_error emu_file::attempt__7zped() { - astring filename; + std::string filename; // loop over directory parts up to the start of filename while (1) { // find the final path separator - int dirsep = m_fullpath.rchr(0, PATH_SEPARATOR[0]); + int dirsep = m_fullpath.find_last_of(PATH_SEPARATOR[0]); if (dirsep == -1) return FILERR_NOT_FOUND; @@ -824,19 +826,19 @@ file_error emu_file::attempt__7zped() return FILERR_NOT_FOUND; // insert the part from the right of the separator into the head of the filename - if (filename.len() > 0) - filename.ins(0, "/"); - filename.inssubstr(0, m_fullpath, dirsep + 1, -1); + if (filename.length() > 0) + filename.insert(0, "/"); + filename.insert(0, m_fullpath.substr(dirsep + 1, -1)); // remove this part of the filename and append a .7z extension - m_fullpath.substr(0, dirsep).cat(".7z"); + m_fullpath = m_fullpath.substr(0, dirsep).append(".7z"); // attempt to open the _7Z file _7z_file *_7z; _7z_error _7zerr = _7z_file_open(m_fullpath.c_str(), &_7z); // chop the ._7z back off the filename before continuing - m_fullpath.substr(0, dirsep); + m_fullpath = m_fullpath.substr(0, dirsep); // if we failed to open this file, continue scanning if (_7zerr != _7ZERR_NONE) @@ -845,16 +847,16 @@ file_error emu_file::attempt__7zped() int fileno = -1; // see if we can find a file with the right name and (if available) crc - if (m_openflags & OPEN_FLAG_HAS_CRC) fileno = _7z_search_crc_match(_7z, m_crc, filename.c_str(), filename.len(), true, true); + if (m_openflags & OPEN_FLAG_HAS_CRC) fileno = _7z_search_crc_match(_7z, m_crc, filename.c_str(), filename.length(), true, true); // if that failed, look for a file with the right crc, but the wrong filename if (fileno==-1) - if (m_openflags & OPEN_FLAG_HAS_CRC) fileno = _7z_search_crc_match(_7z, m_crc, filename.c_str(), filename.len(), true, false); + if (m_openflags & OPEN_FLAG_HAS_CRC) fileno = _7z_search_crc_match(_7z, m_crc, filename.c_str(), filename.length(), true, false); // if that failed, look for a file with the right name; reporting a bad checksum // is more helpful and less confusing than reporting "rom not found" if (fileno==-1) - fileno = _7z_search_crc_match(_7z, m_crc, filename.c_str(), filename.len(), false, true); + fileno = _7z_search_crc_match(_7z, m_crc, filename.c_str(), filename.length(), false, true); if (fileno != -1) { diff --git a/src/emu/fileio.h b/src/emu/fileio.h index 2f2dee57214..1377eca6bb9 100644 --- a/src/emu/fileio.h +++ b/src/emu/fileio.h @@ -42,7 +42,7 @@ public: path_iterator(const char *searchpath); // getters - bool next(astring &buffer, const char *name = NULL); + bool next(std::string &buffer, const char *name = NULL); // reset void reset() { m_current = m_base; m_index = 0; } @@ -73,7 +73,7 @@ private: // internal state path_iterator m_iterator; osd_directory * m_curdir; - astring m_pathbuffer; + std::string m_pathbuffer; //int m_buflen; }; @@ -98,7 +98,7 @@ public: UINT32 openflags() const { return m_openflags; } hash_collection &hashes(const char *types); bool restrict_to_mediapath() { return m_restrict_to_mediapath; } - bool part_of_mediapath(astring path); + bool part_of_mediapath(std::string path); // setters void remove_on_close() { m_remove_on_close = true; } @@ -143,15 +143,15 @@ private: // internal helpers file_error attempt_zipped(); file_error load_zipped_file(); - bool zip_filename_match(const zip_file_header &header, const astring &filename); + bool zip_filename_match(const zip_file_header &header, const std::string &filename); bool zip_header_is_path(const zip_file_header &header); file_error attempt__7zped(); file_error load__7zped_file(); // internal state - astring m_filename; // original filename provided - astring m_fullpath; // full filename + std::string m_filename; // original filename provided + std::string m_fullpath; // full filename core_file * m_file; // core file pointer path_iterator m_iterator; // iterator for paths path_iterator m_mediapaths; // media-path iterator @@ -168,7 +168,7 @@ private: UINT64 m__7zlength; // 7Z file length bool m_remove_on_close; // flag: remove the file when closing - bool m_restrict_to_mediapath; // flag: restrict to paths inside the media-path + bool m_restrict_to_mediapath; // flag: restrict to paths inside the media-path }; diff --git a/src/emu/hash.c b/src/emu/hash.c index 9b64d18f299..1d92458d139 100644 --- a/src/emu/hash.c +++ b/src/emu/hash.c @@ -115,13 +115,13 @@ bool hash_collection::operator==(const hash_collection &rhs) const // a string //------------------------------------------------- -const char *hash_collection::hash_types(astring &buffer) const +const char *hash_collection::hash_types(std::string &buffer) const { - buffer.reset(); + buffer.clear(); if (m_has_crc32) - buffer.cat(HASH_CRC); + buffer.push_back(HASH_CRC); if (m_has_sha1) - buffer.cat(HASH_SHA1); + buffer.push_back(HASH_SHA1); return buffer.c_str(); } @@ -133,7 +133,7 @@ const char *hash_collection::hash_types(astring &buffer) const void hash_collection::reset() { - m_flags.reset(); + m_flags.clear(); m_has_crc32 = m_has_sha1 = false; delete m_creator; m_creator = NULL; @@ -190,21 +190,24 @@ bool hash_collection::remove(char type) // format //------------------------------------------------- -const char *hash_collection::internal_string(astring &buffer) const +const char *hash_collection::internal_string(std::string &buffer) const { - buffer.reset(); + buffer.clear(); // handle CRCs - astring temp; - if (m_has_crc32) - buffer.cat(HASH_CRC).cat(m_crc32.as_string(temp)); - + std::string temp; + if (m_has_crc32) { + buffer.push_back(HASH_CRC); + buffer.append(m_crc32.as_string(temp)); + } // handle SHA1s - if (m_has_sha1) - buffer.cat(HASH_SHA1).cat(m_sha1.as_string(temp)); + if (m_has_sha1) { + buffer.push_back(HASH_SHA1); + buffer.append(m_sha1.as_string(temp)); + } // append flags - return buffer.cat(m_flags).c_str(); + return buffer.append(m_flags).c_str(); } @@ -213,25 +216,26 @@ const char *hash_collection::internal_string(astring &buffer) const // flags to a string in the macroized format //------------------------------------------------- -const char *hash_collection::macro_string(astring &buffer) const +const char *hash_collection::macro_string(std::string &buffer) const { - buffer.reset(); + buffer.clear(); // handle CRCs - astring temp; + std::string temp; if (m_has_crc32) - buffer.cat("CRC(").cat(m_crc32.as_string(temp)).cat(") "); + buffer.append("CRC(").append(m_crc32.as_string(temp)).append(") "); // handle SHA1s if (m_has_sha1) - buffer.cat("SHA1(").cat(m_sha1.as_string(temp)).cat(") "); + buffer.append("SHA1(").append(m_sha1.as_string(temp)).append(") "); // append flags if (flag(FLAG_NO_DUMP)) - buffer.cat("NO_DUMP "); + buffer.append("NO_DUMP "); if (flag(FLAG_BAD_DUMP)) - buffer.cat("BAD_DUMP "); - return buffer.trimspace().c_str(); + buffer.append("BAD_DUMP "); + strtrimspace(buffer); + return buffer.c_str(); } @@ -240,25 +244,26 @@ const char *hash_collection::macro_string(astring &buffer) const // flags to a string in XML attribute format //------------------------------------------------- -const char *hash_collection::attribute_string(astring &buffer) const +const char *hash_collection::attribute_string(std::string &buffer) const { - buffer.reset(); + buffer.clear(); // handle CRCs - astring temp; + std::string temp; if (m_has_crc32) - buffer.cat("crc=\"").cat(m_crc32.as_string(temp)).cat("\" "); + buffer.append("crc=\"").append(m_crc32.as_string(temp)).append("\" "); // handle SHA1s if (m_has_sha1) - buffer.cat("sha1=\"").cat(m_sha1.as_string(temp)).cat("\" "); + buffer.append("sha1=\"").append(m_sha1.as_string(temp)).append("\" "); // append flags if (flag(FLAG_NO_DUMP)) - buffer.cat("status=\"nodump\"" ); + buffer.append("status=\"nodump\""); if (flag(FLAG_BAD_DUMP)) - buffer.cat("status=\"baddump\"" ); - return buffer.trimspace().c_str(); + buffer.append("status=\"baddump\""); + strtrimspace(buffer); + return buffer.c_str(); } @@ -319,7 +324,7 @@ bool hash_collection::from_internal_string(const char *string) else if (skip_digits != 0) errors = true; else - m_flags.cat(c); + m_flags.push_back(c); } return !errors; } diff --git a/src/emu/hash.h b/src/emu/hash.h index f08fe27562b..9dc12af136b 100644 --- a/src/emu/hash.h +++ b/src/emu/hash.h @@ -66,8 +66,8 @@ public: bool operator!=(const hash_collection &rhs) const { return !(*this == rhs); } // getters - bool flag(char flag) const { return (m_flags.chr(0, flag) != -1); } - const char *hash_types(astring &buffer) const; + bool flag(char flag) const { return (m_flags.find_first_of(flag) != -1); } + const char *hash_types(std::string &buffer) const; // hash manipulators void reset(); @@ -83,9 +83,9 @@ public: void add_sha1(sha1_t sha1) { m_has_sha1 = true; m_sha1 = sha1; } // string conversion - const char *internal_string(astring &buffer) const; - const char *macro_string(astring &buffer) const; - const char *attribute_string(astring &buffer) const; + const char *internal_string(std::string &buffer) const; + const char *macro_string(std::string &buffer) const; + const char *attribute_string(std::string &buffer) const; bool from_internal_string(const char *string); // creation @@ -99,7 +99,7 @@ private: void copyfrom(const hash_collection &src); // internal state - astring m_flags; + std::string m_flags; bool m_has_crc32; crc32_t m_crc32; bool m_has_sha1; diff --git a/src/emu/image.c b/src/emu/image.c index 555294033bf..f17f2feb6c0 100644 --- a/src/emu/image.c +++ b/src/emu/image.c @@ -141,7 +141,7 @@ static int write_config(emu_options &options, const char *filename, const game_d file_error filerr = file.open(filename); if (filerr == FILERR_NONE) { - astring inistring; + std::string inistring; options.output_ini(inistring); file.puts(inistring.c_str()); retval = 0; @@ -167,7 +167,7 @@ static void image_options_extract(running_machine &machine) const char *filename = image->filename(); /* and set the option */ - astring error; + std::string error; machine.options().set_value(image->instance_name(), filename ? filename : "", OPTION_PRIORITY_CMDLINE, error); index++; @@ -224,8 +224,8 @@ void image_device_init(running_machine &machine) if (result) { /* retrieve image error message */ - astring image_err = astring(image->error()); - astring image_basename(image_name); + std::string image_err = std::string(image->error()); + std::string image_basename(image_name); /* unload all images */ image_unload_all(machine); @@ -244,15 +244,15 @@ void image_device_init(running_machine &machine) need an image to be loaded -------------------------------------------------*/ -astring &image_mandatory_scan(running_machine &machine, astring &mandatory) +std::string &image_mandatory_scan(running_machine &machine, std::string &mandatory) { - mandatory.reset(); + mandatory.clear(); // make sure that any required image has a mounted file image_interface_iterator iter(machine.root_device()); for (device_image_interface *image = iter.first(); image != NULL; image = iter.next()) { if (image->filename() == NULL && image->must_be_loaded()) - mandatory.cat("\"").cat(image->instance_name()).cat("\", "); + mandatory.append("\"").append(image->instance_name()).append("\", "); } return mandatory; } @@ -273,7 +273,7 @@ void image_postdevice_init(running_machine &machine) if (result) { /* retrieve image error message */ - astring image_err = astring(image->error()); + std::string image_err = std::string(image->error()); /* unload all images */ image_unload_all(machine); diff --git a/src/emu/image.h b/src/emu/image.h index 140a25473b7..a37012841b0 100644 --- a/src/emu/image.h +++ b/src/emu/image.h @@ -20,7 +20,7 @@ void image_init(running_machine &machine); void image_postdevice_init(running_machine &machine); -astring &image_mandatory_scan(running_machine &machine, astring &mandatory); +std::string &image_mandatory_scan(running_machine &machine, std::string &mandatory); extern struct io_procs image_ioprocs; diff --git a/src/emu/imagedev/cassette.c b/src/emu/imagedev/cassette.c index 60f5b0f4f57..5d204aa4613 100644 --- a/src/emu/imagedev/cassette.c +++ b/src/emu/imagedev/cassette.c @@ -273,14 +273,14 @@ bool cassette_image_device::call_load() { is_writable = !is_readonly(); cassette_flags = is_writable ? (CASSETTE_FLAG_READWRITE|CASSETTE_FLAG_SAVEONEXIT) : CASSETTE_FLAG_READONLY; - astring fname; + std::string fname; if (software_entry()==NULL) { extension = filetype(); } else { fname = m_mame_file->filename(); - int loc = fname.rchr(0,'.'); + int loc = fname.find_last_of('.'); if (loc!=-1) { - extension = fname.substr(loc + 1,fname.len()-loc).c_str(); + extension = fname.substr(loc + 1,fname.length()-loc).c_str(); } else { extension = ""; } diff --git a/src/emu/imagedev/diablo.c b/src/emu/imagedev/diablo.c index 43afc241471..10a763e8ba1 100644 --- a/src/emu/imagedev/diablo.c +++ b/src/emu/imagedev/diablo.c @@ -115,7 +115,7 @@ bool diablo_image_device::call_create(int create_format, option_resolution *crea int err; UINT32 sectorsize, hunksize; UINT32 cylinders, heads, sectors, totalsectors; - astring metadata; + std::string metadata; cylinders = option_resolution_lookup_int(create_args, 'C'); heads = option_resolution_lookup_int(create_args, 'H'); @@ -132,7 +132,7 @@ bool diablo_image_device::call_create(int create_format, option_resolution *crea goto error; /* if we created the image and hence, have metadata to set, set the metadata */ - metadata.format(HARD_DISK_METADATA_FORMAT, cylinders, heads, sectors, sectorsize); + strprintf(metadata,HARD_DISK_METADATA_FORMAT, cylinders, heads, sectors, sectorsize); err = m_origchd.write_metadata(HARD_DISK_METADATA_TAG, 0, metadata); m_origchd.close(); @@ -170,7 +170,7 @@ void diablo_image_device::call_unload() static chd_error open_disk_diff(emu_options &options, const char *name, chd_file &source, chd_file &diff_chd) { - astring fname = astring(name).cat(".dif"); + std::string fname = std::string(name).append(".dif"); /* try to open the diff */ //printf("Opening differencing image file: %s\n", fname.c_str()); @@ -178,7 +178,7 @@ static chd_error open_disk_diff(emu_options &options, const char *name, chd_file file_error filerr = diff_file.open(fname.c_str()); if (filerr == FILERR_NONE) { - astring fullpath(diff_file.fullpath()); + std::string fullpath(diff_file.fullpath()); diff_file.close(); //printf("Opening differencing image file: %s\n", fullpath.c_str()); @@ -191,7 +191,7 @@ static chd_error open_disk_diff(emu_options &options, const char *name, chd_file filerr = diff_file.open(fname.c_str()); if (filerr == FILERR_NONE) { - astring fullpath(diff_file.fullpath()); + std::string fullpath(diff_file.fullpath()); diff_file.close(); /* create the CHD */ diff --git a/src/emu/imagedev/harddriv.c b/src/emu/imagedev/harddriv.c index 48fa65500df..8520756fe22 100644 --- a/src/emu/imagedev/harddriv.c +++ b/src/emu/imagedev/harddriv.c @@ -135,7 +135,7 @@ bool harddisk_image_device::call_create(int create_format, option_resolution *cr int err; UINT32 sectorsize, hunksize; UINT32 cylinders, heads, sectors, totalsectors; - astring metadata; + std::string metadata; cylinders = option_resolution_lookup_int(create_args, 'C'); heads = option_resolution_lookup_int(create_args, 'H'); @@ -152,7 +152,7 @@ bool harddisk_image_device::call_create(int create_format, option_resolution *cr goto error; /* if we created the image and hence, have metadata to set, set the metadata */ - metadata.format(HARD_DISK_METADATA_FORMAT, cylinders, heads, sectors, sectorsize); + strprintf(metadata, HARD_DISK_METADATA_FORMAT, cylinders, heads, sectors, sectorsize); err = m_origchd.write_metadata(HARD_DISK_METADATA_TAG, 0, metadata); m_origchd.close(); @@ -190,7 +190,7 @@ void harddisk_image_device::call_unload() static chd_error open_disk_diff(emu_options &options, const char *name, chd_file &source, chd_file &diff_chd) { - astring fname = astring(name).cat(".dif"); + std::string fname = std::string(name).append(".dif"); /* try to open the diff */ //printf("Opening differencing image file: %s\n", fname.c_str()); @@ -198,7 +198,7 @@ static chd_error open_disk_diff(emu_options &options, const char *name, chd_file file_error filerr = diff_file.open(fname.c_str()); if (filerr == FILERR_NONE) { - astring fullpath(diff_file.fullpath()); + std::string fullpath(diff_file.fullpath()); diff_file.close(); //printf("Opening differencing image file: %s\n", fullpath.c_str()); @@ -211,11 +211,11 @@ static chd_error open_disk_diff(emu_options &options, const char *name, chd_file filerr = diff_file.open(fname.c_str()); if (filerr == FILERR_NONE) { - astring fullpath(diff_file.fullpath()); + std::string fullpath(diff_file.fullpath()); diff_file.close(); /* create the CHD */ - //printf("Creating differencing image file: %s\n", fullpath.c_str()); + //printf("Creating differencing image file: %s\n", fupointllpath.c_str()); chd_codec_type compression[4] = { CHD_CODEC_NONE }; chd_error err = diff_chd.create(fullpath.c_str(), source.logical_bytes(), source.hunk_bytes(), compression, source); if (err != CHDERR_NONE) diff --git a/src/emu/info.c b/src/emu/info.c index 67a31eae63b..9cb59d5c0cc 100644 --- a/src/emu/info.c +++ b/src/emu/info.c @@ -193,9 +193,9 @@ void info_xml_creator::output(FILE *out) // output the DTD fprintf(m_output, "<?xml version=\"1.0\"?>\n"); - astring dtd(s_dtd_string); - dtd.replace(0,"__XML_ROOT__", emulator_info::get_xml_root()); - dtd.replace(0,"__XML_TOP__", emulator_info::get_xml_top()); + std::string dtd(s_dtd_string); + strreplace(dtd, "__XML_ROOT__", emulator_info::get_xml_root()); + strreplace(dtd, "__XML_TOP__", emulator_info::get_xml_top()); fprintf(m_output, "%s\n\n", dtd.c_str()); @@ -239,7 +239,7 @@ void info_xml_creator::output_one() // allocate input ports machine_config &config = m_drivlist.config(); ioport_list portlist; - astring errors; + std::string errors; device_iterator iter(config.root_device()); for (device_t *device = iter.first(); device != NULL; device = iter.next()) portlist.append(*device, errors); @@ -325,7 +325,7 @@ void info_xml_creator::output_one_device(device_t &device, const char *devtag) has_speaker = TRUE; // generate input list ioport_list portlist; - astring errors; + std::string errors; device_iterator iptiter(device); for (device_t *dev = iptiter.first(); dev != NULL; dev = iptiter.next()) portlist.append(*dev, errors); @@ -341,8 +341,8 @@ void info_xml_creator::output_one_device(device_t &device, const char *devtag) // start to output info fprintf(m_output, "\t<%s", emulator_info::get_xml_top()); fprintf(m_output, " name=\"%s\"", xml_normalize_string(device.shortname())); - astring src(device.source()); - src.replace("../",""); + std::string src(device.source()); + strreplace(src,"../", ""); fprintf(m_output, " sourcefile=\"%s\"", xml_normalize_string(src.c_str())); fprintf(m_output, " isdevice=\"yes\""); fprintf(m_output, " runnable=\"no\""); @@ -402,8 +402,8 @@ void info_xml_creator::output_devices() { 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 &>(m_drivlist.config()).device_add(&m_drivlist.config().root_device(), temptag.c_str(), option->devtype(), 0); // notify this device and all its subdevices that they are now configured @@ -534,53 +534,53 @@ void info_xml_creator::output_rom(device_t &device) } } - astring output; + std::string output; // opening tag if (!is_disk) - output.cat("\t\t<rom"); + output.append("\t\t<rom"); else - output.cat("\t\t<disk"); + output.append("\t\t<disk"); // add name, merge, bios, and size tags */ if (name != NULL && name[0] != 0) - output.catprintf(" name=\"%s\"", xml_normalize_string(name)); + strcatprintf(output," name=\"%s\"", xml_normalize_string(name)); if (merge_name != NULL) - output.catprintf(" merge=\"%s\"", xml_normalize_string(merge_name)); + strcatprintf(output," merge=\"%s\"", xml_normalize_string(merge_name)); if (bios_name[0] != 0) - output.catprintf(" bios=\"%s\"", xml_normalize_string(bios_name)); + strcatprintf(output," bios=\"%s\"", xml_normalize_string(bios_name)); if (!is_disk) - output.catprintf(" size=\"%d\"", rom_file_size(rom)); + strcatprintf(output," size=\"%d\"", rom_file_size(rom)); // dump checksum information only if there is a known dump if (!hashes.flag(hash_collection::FLAG_NO_DUMP)) { // iterate over hash function types and print m_output their values - astring tempstr; - output.catprintf(" %s", hashes.attribute_string(tempstr)); + std::string tempstr; + strcatprintf(output," %s", hashes.attribute_string(tempstr)); } else - output.cat(" status=\"nodump\""); + output.append(" status=\"nodump\""); // append a region name - output.catprintf(" region=\"%s\"", ROMREGION_GETTAG(region)); + strcatprintf(output," region=\"%s\"", ROMREGION_GETTAG(region)); // for non-disk entries, print offset if (!is_disk) - output.catprintf(" offset=\"%x\"", offset); + strcatprintf(output," offset=\"%x\"", offset); // for disk entries, add the disk index else { - output.catprintf(" index=\"%x\"", DISK_GETINDEX(rom)); - output.catprintf(" writable=\"%s\"", DISK_ISREADONLY(rom) ? "no" : "yes"); + strcatprintf(output," index=\"%x\"", DISK_GETINDEX(rom)); + strcatprintf(output," writable=\"%s\"", DISK_ISREADONLY(rom) ? "no" : "yes"); } // add optional flag if (ROM_ISOPTIONAL(rom)) - output.cat(" optional=\"yes\""); + output.append(" optional=\"yes\""); - output.cat("/>\n"); + output.append("/>\n"); fprintf(m_output, "%s", output.c_str()); } @@ -627,8 +627,8 @@ void info_xml_creator::output_chips(device_t &device, const char *root_tag) { if (strcmp(exec->device().tag(), device.tag())) { - astring newtag(exec->device().tag()), oldtag(":"); - newtag.substr(newtag.find(oldtag.cat(root_tag).c_str()) + oldtag.len()); + std::string newtag(exec->device().tag()), oldtag(":"); + newtag = newtag.substr(newtag.find(oldtag.append(root_tag).c_str()) + oldtag.length()); fprintf(m_output, "\t\t<chip"); fprintf(m_output, " type=\"cpu\""); @@ -645,8 +645,8 @@ void info_xml_creator::output_chips(device_t &device, const char *root_tag) { if (strcmp(sound->device().tag(), device.tag())) { - astring newtag(sound->device().tag()), oldtag(":"); - newtag.substr(newtag.find(oldtag.cat(root_tag).c_str()) + oldtag.len()); + std::string newtag(sound->device().tag()), oldtag(":"); + newtag = newtag.substr(newtag.find(oldtag.append(root_tag).c_str()) + oldtag.length()); fprintf(m_output, "\t\t<chip"); fprintf(m_output, " type=\"audio\""); @@ -673,8 +673,8 @@ void info_xml_creator::output_display(device_t &device, const char *root_tag) { if (strcmp(screendev->tag(), device.tag())) { - astring newtag(screendev->tag()), oldtag(":"); - newtag.substr(newtag.find(oldtag.cat(root_tag).c_str()) + oldtag.len()); + std::string newtag(screendev->tag()), oldtag(":"); + newtag = newtag.substr(newtag.find(oldtag.append(root_tag).c_str()) + oldtag.length()); fprintf(m_output, "\t\t<display"); fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag.c_str())); @@ -1077,24 +1077,24 @@ void info_xml_creator::output_switches(const ioport_list &portlist, const char * for (ioport_field *field = port->first_field(); field != NULL; field = field->next()) if (field->type() == type) { - astring output; + std::string output; - astring newtag(port->tag()), oldtag(":"); - newtag.substr(newtag.find(oldtag.cat(root_tag).c_str()) + oldtag.len()); + std::string newtag(port->tag()), oldtag(":"); + newtag = newtag.substr(newtag.find(oldtag.append(root_tag).c_str()) + oldtag.length()); // output the switch name information - astring normalized_field_name(xml_normalize_string(field->name())); - astring normalized_newtag(xml_normalize_string(newtag.c_str())); - output.catprintf("\t\t<%s name=\"%s\" tag=\"%s\" mask=\"%u\">\n", outertag, normalized_field_name.c_str(), normalized_newtag.c_str(), field->mask()); + std::string normalized_field_name(xml_normalize_string(field->name())); + std::string normalized_newtag(xml_normalize_string(newtag.c_str())); + strcatprintf(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->first_setting(); setting != NULL; setting = setting->next()) { - output.catprintf("\t\t\t<%s name=\"%s\" value=\"%u\"%s/>\n", innertag, xml_normalize_string(setting->name()), setting->value(), setting->value() == field->defvalue() ? " default=\"yes\"" : ""); + strcatprintf(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\"" : ""); } // terminate the switch entry - output.catprintf("\t\t</%s>\n", outertag); + strcatprintf(output,"\t\t</%s>\n", outertag); fprintf(m_output, "%s", output.c_str()); } @@ -1210,8 +1210,8 @@ void info_xml_creator::output_images(device_t &device, const char *root_tag) { if (strcmp(imagedev->device().tag(), device.tag())) { - astring newtag(imagedev->device().tag()), oldtag(":"); - newtag.substr(newtag.find(oldtag.cat(root_tag).c_str()) + oldtag.len()); + std::string newtag(imagedev->device().tag()), oldtag(":"); + newtag = newtag.substr(newtag.find(oldtag.append(root_tag).c_str()) + oldtag.length()); // print m_output device type fprintf(m_output, "\t\t<device type=\"%s\"", xml_normalize_string(imagedev->image_type_name())); @@ -1238,7 +1238,7 @@ void info_xml_creator::output_images(device_t &device, const char *root_tag) fprintf(m_output, " briefname=\"%s\"", xml_normalize_string(shortname)); fprintf(m_output, "/>\n"); - astring extensions(imagedev->file_extensions()); + std::string extensions(imagedev->file_extensions()); char *ext = strtok((char *)extensions.c_str(), ","); while (ext != NULL) @@ -1268,8 +1268,8 @@ void info_xml_creator::output_slots(device_t &device, const char *root_tag) if (strcmp(slot->device().tag(), device.tag())) { - astring newtag(slot->device().tag()), oldtag(":"); - newtag.substr(newtag.find(oldtag.cat(root_tag).c_str()) + oldtag.len()); + std::string newtag(slot->device().tag()), oldtag(":"); + newtag = newtag.substr(newtag.find(oldtag.append(root_tag).c_str()) + oldtag.length()); // print m_output device type fprintf(m_output, "\t\t<slot name=\"%s\">\n", xml_normalize_string(newtag.c_str())); @@ -1341,11 +1341,11 @@ void info_xml_creator::output_ramoptions() if (ram->extra_options() != NULL) { - astring options(ram->extra_options()); - for (int start = 0, end = options.chr(0, ','); ; start = end + 1, end = options.chr(start, ',')) + std::string options(ram->extra_options()); + for (int start = 0, end = options.find_first_of(',');; start = end + 1, end = options.find_first_of(',', start)) { - astring option; - option.cpysubstr(options, start, (end == -1) ? -1 : end - start); + std::string option; + option.assign(options.substr(start, (end == -1) ? -1 : end - start)); fprintf(m_output, "\t\t<ramoption>%u</ramoption>\n", ram_device::parse_string(option.c_str())); if (end == -1) break; diff --git a/src/emu/input.c b/src/emu/input.c index f62ed6889c7..28337c7cf81 100644 --- a/src/emu/input.c +++ b/src/emu/input.c @@ -529,29 +529,29 @@ bool joystick_map::parse(const char *mapstring) // friendly display //------------------------------------------------- -const char *joystick_map::to_string(astring &str) const +const char *joystick_map::to_string(std::string &str) const { - str.printf("%s\n", m_origstring.c_str()); + strprintf(str, "%s\n", m_origstring.c_str()); for (int rownum = 0; rownum < 9; rownum++) { - str.catprintf(" "); + str.append(" "); for (int colnum = 0; colnum < 9; colnum++) switch (m_map[rownum][colnum]) { - case JOYSTICK_MAP_UP | JOYSTICK_MAP_LEFT: str.catprintf("7"); break; - case JOYSTICK_MAP_UP: str.catprintf("8"); break; - case JOYSTICK_MAP_UP | JOYSTICK_MAP_RIGHT: str.catprintf("9"); break; - case JOYSTICK_MAP_LEFT: str.catprintf("4"); break; - case JOYSTICK_MAP_NEUTRAL: str.catprintf("5"); break; - case JOYSTICK_MAP_RIGHT: str.catprintf("6"); break; - case JOYSTICK_MAP_DOWN | JOYSTICK_MAP_LEFT: str.catprintf("1"); break; - case JOYSTICK_MAP_DOWN: str.catprintf("2"); break; - case JOYSTICK_MAP_DOWN | JOYSTICK_MAP_RIGHT:str.catprintf("3"); break; - case JOYSTICK_MAP_STICKY: str.catprintf("s"); break; - default: str.catprintf("?"); break; + case JOYSTICK_MAP_UP | JOYSTICK_MAP_LEFT: str.append("7"); break; + case JOYSTICK_MAP_UP: str.append("8"); break; + case JOYSTICK_MAP_UP | JOYSTICK_MAP_RIGHT: str.append("9"); break; + case JOYSTICK_MAP_LEFT: str.append("4"); break; + case JOYSTICK_MAP_NEUTRAL: str.append("5"); break; + case JOYSTICK_MAP_RIGHT: str.append("6"); break; + case JOYSTICK_MAP_DOWN | JOYSTICK_MAP_LEFT: str.append("1"); break; + case JOYSTICK_MAP_DOWN: str.append("2"); break; + case JOYSTICK_MAP_DOWN | JOYSTICK_MAP_RIGHT:str.append("3"); break; + case JOYSTICK_MAP_STICKY: str.append("s"); break; + default: str.append("?"); break; } - str.catprintf("\n"); + str.append("\n"); } return str.c_str(); } @@ -808,7 +808,7 @@ input_device::input_device(input_class &_class, int devindex, const char *name, mapstring = joystick_map_8way; // parse it - astring tempstr; + std::string tempstr; if (!m_joymap.parse(mapstring)) { osd_printf_error("Invalid joystick map: %s\n", mapstring); @@ -1461,9 +1461,9 @@ input_code input_manager::code_from_itemid(input_item_id itemid) const // friendly name //------------------------------------------------- -const char *input_manager::code_name(astring &str, input_code code) const +const char *input_manager::code_name(std::string &str, input_code code) const { - str.reset(); + str.clear(); // if nothing there, return an empty string input_device_item *item = item_from_code(code); @@ -1474,19 +1474,19 @@ const char *input_manager::code_name(astring &str, input_code code) const const char *devclass = (*devclass_string_table)[code.device_class()]; // determine the devindex part - astring devindex; - devindex.printf("%d", code.device_index() + 1); + std::string devindex; + strprintf(devindex, "%d", code.device_index() + 1); // if we're unifying all devices, don't display a number if (!m_class[code.device_class()]->multi()) - devindex.reset(); + devindex.clear(); // keyboard 0 doesn't show a class or index if it is the only one input_device_class device_class = item->device().devclass(); if (device_class == DEVICE_CLASS_KEYBOARD && m_keyboard_class.maxindex() == 0) { devclass = ""; - devindex.reset(); + devindex.clear(); } // devcode part comes from the item name @@ -1501,16 +1501,17 @@ const char *input_manager::code_name(astring &str, input_code code) const devcode = ""; // concatenate the strings - str.cpy(devclass); + str.assign(devclass); if (!devindex.empty()) - str.cat(" ").cat(devindex); + str.append(" ").append(devindex); if (devcode[0] != 0) - str.cat(" ").cat(devcode); + str.append(" ").append(devcode); if (modifier != NULL) - str.cat(" ").cat(modifier); + str.append(" ").append(modifier); // delete any leading spaces - return str.trimspace().c_str(); + strtrimspace(str); + return str.c_str(); } @@ -1518,16 +1519,16 @@ const char *input_manager::code_name(astring &str, input_code code) const // code_to_token - create a token for a given code //------------------------------------------------- -const char *input_manager::code_to_token(astring &str, input_code code) const +const char *input_manager::code_to_token(std::string &str, input_code code) const { // determine the devclass part const char *devclass = (*devclass_token_table)[code.device_class()]; // determine the devindex part; keyboard 0 doesn't show an index - astring devindex; - devindex.printf("%d", code.device_index() + 1); + std::string devindex; + strprintf(devindex, "%d", code.device_index() + 1); if (code.device_class() == DEVICE_CLASS_KEYBOARD && code.device_index() == 0) - devindex.reset(); + devindex.clear(); // determine the itemid part; look up in the table if we don't have a token input_device_item *item = item_from_code(code); @@ -1542,15 +1543,15 @@ const char *input_manager::code_to_token(astring &str, input_code code) const itemclass = (*itemclass_token_table)[code.item_class()]; // concatenate the strings - str.cpy(devclass); + str.assign(devclass); if (!devindex.empty()) - str.cat("_").cat(devindex); + str.append("_").append(devindex); if (devcode[0] != 0) - str.cat("_").cat(devcode); + str.append("_").append(devcode); if (modifier != NULL) - str.cat("_").cat(modifier); + str.append("_").append(modifier); if (itemclass[0] != 0) - str.cat("_").cat(itemclass); + str.append("_").append(itemclass); return str.c_str(); } @@ -1563,13 +1564,13 @@ const char *input_manager::code_to_token(astring &str, input_code code) const input_code input_manager::code_from_token(const char *_token) { // copy the token and break it into pieces - astring token[6]; + std::string token[6]; int numtokens; for (numtokens = 0; numtokens < ARRAY_LENGTH(token); ) { // make a token up to the next underscore char *score = (char *)strchr(_token, '_'); - token[numtokens++].cpy(_token, (score == NULL) ? strlen(_token) : (score - _token)); + token[numtokens++].assign(_token, (score == NULL) ? strlen(_token) : (score - _token)); // if we hit the end, we're done, else advance our pointer if (score == NULL) @@ -1614,7 +1615,7 @@ input_code input_manager::code_from_token(const char *_token) for (itemid = ITEM_ID_FIRST_VALID; itemid <= device->maxitem(); itemid++) { input_device_item *item = device->item(itemid); - if (item != NULL && token[curtok].cmp(item->token()) == 0) + if (item != NULL && token[curtok].compare(item->token()) == 0) { // take the itemclass from the item itemclass = item->itemclass(); @@ -1925,12 +1926,12 @@ bool input_manager::seq_poll() // sequence //------------------------------------------------- -const char *input_manager::seq_name(astring &str, const input_seq &seq) const +const char *input_manager::seq_name(std::string &str, const input_seq &seq) const { // make a copy of our sequence, removing any invalid bits input_code clean_codes[sizeof(seq) / sizeof(input_code)]; int clean_index = 0; - astring codestr; + std::string codestr; for (int codenum = 0; seq[codenum] != input_seq::end_code; codenum++) { // if this is a code item which is not valid, don't copy it and remove any preceding ORs/NOTs @@ -1946,28 +1947,28 @@ const char *input_manager::seq_name(astring &str, const input_seq &seq) const // special case: empty if (clean_index == 0) - return str.cpy((seq.length() == 0) ? "None" : "n/a").c_str(); + return str.assign((seq.length() == 0) ? "None" : "n/a").c_str(); // start with an empty buffer - str.reset(); + str.clear(); // loop until we hit the end for (int codenum = 0; codenum < clean_index; codenum++) { // append a space if not the first code if (codenum != 0) - str.cat(" "); + str.append(" "); // handle OR/NOT codes here input_code code = clean_codes[codenum]; if (code == input_seq::or_code) - str.cat("or"); + str.append("or"); else if (code == input_seq::not_code) - str.cat("not"); + str.append("not"); // otherwise, assume it is an input code and ask the input system to generate it else - str.cat(code_name(codestr, code)); + str.append(code_name(codestr, code)); } return str.c_str(); } @@ -1978,31 +1979,31 @@ const char *input_manager::seq_name(astring &str, const input_seq &seq) const // a sequence //------------------------------------------------- -const char *input_manager::seq_to_tokens(astring &str, const input_seq &seq) const +const char *input_manager::seq_to_tokens(std::string &str, const input_seq &seq) const { // start with an empty buffer - str.reset(); + str.clear(); // loop until we hit the end - astring codestr; + std::string codestr; for (int codenum = 0; seq[codenum] != input_seq::end_code; codenum++) { // append a space if not the first code if (codenum != 0) - str.cat(" "); + str.append(" "); // handle OR/NOT codes here input_code code = seq[codenum]; if (code == input_seq::or_code) - str.cat("OR"); + str.append("OR"); else if (code == input_seq::not_code) - str.cat("NOT"); + str.append("NOT"); else if (code == input_seq::default_code) - str.cat("DEFAULT"); + str.append("DEFAULT"); // otherwise, assume it is an input code and ask the input system to generate it else - str.cat(code_to_token(codestr, code)); + str.append(code_to_token(codestr, code)); } return str.c_str(); } @@ -2019,7 +2020,7 @@ void input_manager::seq_from_tokens(input_seq &seq, const char *string) seq.reset(); // loop until we're done - astring strcopy = string; + std::string strcopy = string; char *str = const_cast<char *>(strcopy.c_str()); while (1) { @@ -2072,7 +2073,7 @@ bool input_manager::set_global_joystick_map(const char *mapstring) if (!map.parse(mapstring)) return false; - astring tempstr; + std::string tempstr; osd_printf_verbose("Input: Changing default joystick map = %s\n", map.to_string(tempstr)); // iterate over joysticks and set the map @@ -2107,11 +2108,15 @@ input_device_item::input_device_item(input_device &device, const char *name, voi { // use a standard token name for know item IDs if (itemid <= ITEM_ID_MAXIMUM && (*itemid_token_table)[itemid] != NULL) - m_token.cpy((*itemid_token_table)[itemid]); + m_token.assign((*itemid_token_table)[itemid]); // otherwise, create a tokenized name - else - m_token.cpy(name).makeupper().delchr(' ').delchr('_'); + else { + m_token.assign(name); + strmakeupper(m_token); + strdelchr(m_token, ' '); + strdelchr(m_token, '_'); + } } diff --git a/src/emu/input.h b/src/emu/input.h index 7db18199a9a..6a67685907a 100644 --- a/src/emu/input.h +++ b/src/emu/input.h @@ -365,7 +365,7 @@ public: bool parse(const char *mapstring); // create a friendly string - const char *to_string(astring &str) const; + const char *to_string(std::string &str) const; // update the state of a live map UINT8 update(INT32 xaxisval, INT32 yaxisval); @@ -390,7 +390,7 @@ private: // internal state UINT8 m_map[9][9]; // 9x9 grid UINT8 m_lastmap; // last value returned (for sticky tracking) - astring m_origstring; // originally parsed string + std::string m_origstring; // originally parsed string }; @@ -520,12 +520,12 @@ public: protected: // internal state input_device & m_device; // reference to our owning device - astring m_name; // string name of item + std::string m_name; // string name of item void * m_internal; // internal callback pointer input_item_id m_itemid; // originally specified item id input_item_class m_itemclass; // class of the item item_get_state_func m_getstate; // get state callback - astring m_token; // tokenized name for non-standard items + std::string m_token; // tokenized name for non-standard items // live state INT32 m_current; // current raw value @@ -569,7 +569,7 @@ public: private: // internal state input_class & m_class; // reference to our class - astring m_name; // string name of device + std::string m_name; // string name of device int m_devindex; // device index of this device auto_pointer<input_device_item> m_item[ITEM_ID_ABSOLUTE_MAXIMUM+1]; // array of pointers to items input_item_id m_maxitem; // maximum item index @@ -655,8 +655,8 @@ public: input_device *device_from_code(input_code code) const; input_device_item *item_from_code(input_code code) const; input_code code_from_itemid(input_item_id itemid) const; - const char *code_name(astring &str, input_code code) const; - const char *code_to_token(astring &str, input_code code) const; + const char *code_name(std::string &str, input_code code) const; + const char *code_to_token(std::string &str, input_code code) const; input_code code_from_token(const char *_token); // input sequence readers @@ -669,8 +669,8 @@ public: const input_seq &seq_poll_final() const { return m_poll_seq; } // input sequence helpers - const char *seq_name(astring &str, const input_seq &seq) const; - const char *seq_to_tokens(astring &str, const input_seq &seq) const; + const char *seq_name(std::string &str, const input_seq &seq) const; + const char *seq_to_tokens(std::string &str, const input_seq &seq) const; void seq_from_tokens(input_seq &seq, const char *_token); // misc diff --git a/src/emu/ioport.c b/src/emu/ioport.c index 92d39a90eac..dec69cdb202 100644 --- a/src/emu/ioport.c +++ b/src/emu/ioport.c @@ -640,7 +640,7 @@ static const struct // to the current list //------------------------------------------------- -void ioport_list::append(device_t &device, astring &errorbuf) +void ioport_list::append(device_t &device, std::string &errorbuf) { // no constructor, no list ioport_constructor constructor = device.input_ports(); @@ -648,7 +648,7 @@ void ioport_list::append(device_t &device, astring &errorbuf) return; // reset error buffer - errorbuf.reset(); + errorbuf.clear(); // detokenize into the list (*constructor)(device, *this, errorbuf); @@ -897,7 +897,7 @@ void natural_keyboard::post(unicode_char ch) if (LOG_NATURAL_KEYBOARD) { const keycode_map_entry *code = find_code(ch); - astring tempstr; + std::string tempstr; logerror("natural_keyboard::post(): code=%i (%s) field->name='%s'\n", int(ch), unicode_to_string(tempstr, ch), (code != NULL && code->field[0] != NULL) ? code->field[0]->name() : "<null>"); } @@ -1101,7 +1101,7 @@ void natural_keyboard::build_codes(ioport_manager &manager) if (LOG_NATURAL_KEYBOARD) { - astring tempstr; + std::string tempstr; logerror("natural_keyboard: code=%i (%s) port=%p field->name='%s'\n", int(code), unicode_to_string(tempstr, code), port, field->name()); } } @@ -1234,23 +1234,23 @@ void natural_keyboard::timer(void *ptr, int param) // logging and debugging //------------------------------------------------- -const char *natural_keyboard::unicode_to_string(astring &buffer, unicode_char ch) +const char *natural_keyboard::unicode_to_string(std::string &buffer, unicode_char ch) { - buffer.reset(); + buffer.clear(); switch (ch) { // check some magic values - case '\0': buffer.cpy("\\0"); break; - case '\r': buffer.cpy("\\r"); break; - case '\n': buffer.cpy("\\n"); break; - case '\t': buffer.cpy("\\t"); break; + case '\0': buffer.assign("\\0"); break; + case '\r': buffer.assign("\\r"); break; + case '\n': buffer.assign("\\n"); break; + case '\t': buffer.assign("\\t"); break; default: // seven bit ASCII is easy if (ch >= 32 && ch < 128) { char temp[2] = { char(ch), 0 }; - buffer.cpy(temp); + buffer.assign(temp); } else if (ch >= UCHAR_MAMEKEY_BEGIN) { @@ -1260,8 +1260,8 @@ const char *natural_keyboard::unicode_to_string(astring &buffer, unicode_char ch } // did we fail to resolve? if so, we have a last resort - if (buffer.len() == 0) - buffer.format("U+%04X", unsigned(ch)); + if (buffer.length() == 0) + strprintf(buffer,"U+%04X", unsigned(ch)); break; } return buffer.c_str(); @@ -1307,13 +1307,13 @@ void natural_keyboard::frame_update(ioport_port &port, ioport_value &digital) // key_name - returns the name of a specific key //------------------------------------------------- -const char *natural_keyboard::key_name(astring &str, unicode_char ch) +const char *natural_keyboard::key_name(std::string &str, unicode_char ch) { // attempt to get the string from the character info table const char_info *ci = char_info::find(ch); const char *result = (ci != NULL) ? ci->name : NULL; if (result != NULL) - str.cpy(result); + str.assign(result); // if that doesn't work, convert to UTF-8 else if (ch > 0x7F || isprint(ch)) @@ -1321,12 +1321,12 @@ const char *natural_keyboard::key_name(astring &str, unicode_char ch) char buf[10]; int count = utf8_from_uchar(buf, ARRAY_LENGTH(buf), ch); buf[count] = 0; - str.cpy(buf); + str.assign(buf); } // otherwise, opt for question marks else - str.cpy("???"); + str.assign("???"); return str.c_str(); } @@ -1335,9 +1335,9 @@ const char *natural_keyboard::key_name(astring &str, unicode_char ch) // dump - dumps info to string //------------------------------------------------- -astring natural_keyboard::dump() +std::string natural_keyboard::dump() { - astring buffer, tempstr; + std::string buffer, tempstr; const size_t left_column_width = 24; // loop through all codes @@ -1345,18 +1345,18 @@ astring natural_keyboard::dump() { // describe the character code const natural_keyboard::keycode_map_entry &code = m_keycode_map[index]; - buffer.catprintf("%08X (%s) ", code.ch, unicode_to_string(tempstr, code.ch)); + strcatprintf(buffer,"%08X (%s) ", code.ch, unicode_to_string(tempstr, code.ch)); // pad with spaces - while (buffer.len() < left_column_width) - buffer.cat(' '); + while (buffer.length() < left_column_width) + buffer.push_back(' '); // identify the keys used for (int field = 0; field < ARRAY_LENGTH(code.field) && code.field[field] != 0; field++) - buffer.catprintf("%s'%s'", (field > 0) ? ", " : "", code.field[field]->name()); + strcatprintf(buffer, "%s'%s'", (field > 0) ? ", " : "", code.field[field]->name()); // carriage return - buffer.cat('\n'); + buffer.push_back('\n'); } return buffer; @@ -2041,7 +2041,7 @@ void ioport_field::crosshair_position(float &x, float &y, bool &gotx, bool &goty // descriptions //------------------------------------------------- -void ioport_field::expand_diplocation(const char *location, astring &errorbuf) +void ioport_field::expand_diplocation(const char *location, std::string &errorbuf) { // if nothing present, bail if (location == NULL) @@ -2050,7 +2050,7 @@ void ioport_field::expand_diplocation(const char *location, astring &errorbuf) m_diploclist.reset(); // parse the string - astring name; // Don't move this variable inside the loop, lastname's lifetime depends on it being outside + std::string name; // Don't move this variable inside the loop, lastname's lifetime depends on it being outside const char *lastname = NULL; const char *curentry = location; int entries = 0; @@ -2062,8 +2062,8 @@ void ioport_field::expand_diplocation(const char *location, astring &errorbuf) comma = curentry + strlen(curentry); // extract it to tempbuf - astring tempstr; - tempstr.cpy(curentry, comma - curentry); + std::string tempstr; + tempstr.assign(curentry, comma - curentry); // first extract the switch name if present const char *number = tempstr.c_str(); @@ -2072,7 +2072,7 @@ void ioport_field::expand_diplocation(const char *location, astring &errorbuf) // allocate and copy the name if it is present if (colon != NULL) { - lastname = name.cpy(number, colon - number).c_str(); + lastname = name.assign(number, colon - number).c_str(); number = colon + 1; } @@ -2081,10 +2081,10 @@ void ioport_field::expand_diplocation(const char *location, astring &errorbuf) { if (lastname == NULL) { - errorbuf.catprintf("Switch location '%s' missing switch name!\n", location); + strcatprintf(errorbuf, "Switch location '%s' missing switch name!\n", location); lastname = (char *)"UNK"; } - name.cpy(lastname); + name.assign(lastname); } // if the number is preceded by a '!' it's active high @@ -2098,7 +2098,7 @@ void ioport_field::expand_diplocation(const char *location, astring &errorbuf) // now scan the switch number int swnum = -1; if (sscanf(number, "%d", &swnum) != 1) - errorbuf.catprintf("Switch location '%s' has invalid format!\n", location); + strcatprintf(errorbuf, "Switch location '%s' has invalid format!\n", location); // allocate a new entry m_diploclist.append(*global_alloc(ioport_diplocation(name.c_str(), swnum, invert))); @@ -2116,7 +2116,7 @@ void ioport_field::expand_diplocation(const char *location, astring &errorbuf) for (bits = 0, temp = m_mask; temp != 0 && bits < 32; bits++) temp &= temp - 1; if (bits != entries) - errorbuf.catprintf("Switch location '%s' does not describe enough bits for mask %X\n", location, m_mask); + strcatprintf(errorbuf, "Switch location '%s' does not describe enough bits for mask %X\n", location, m_mask); } @@ -2174,21 +2174,21 @@ ioport_field_live::ioport_field_live(ioport_field &field, analog_field *analog) if (field.type_class() == INPUT_CLASS_KEYBOARD && field.specific_name() == NULL) { // loop through each character on the field - astring tempstr; + std::string tempstr; for (int which = 0; ; which++) { unicode_char ch = field.keyboard_code(which); if (ch == 0) break; - name.catprintf("%-*s ", MAX(SPACE_COUNT - 1, 0), field.manager().natkeyboard().key_name(tempstr, ch)); + strcatprintf(name, "%-*s ", MAX(SPACE_COUNT - 1, 0), field.manager().natkeyboard().key_name(tempstr, ch)); } // trim extra spaces - name.trimspace(); + strtrimspace(name); // special case - if (name.len() == 0) - name.cpy("Unnamed Key"); + if (name.length() == 0) + name.assign("Unnamed Key"); } } @@ -2321,7 +2321,7 @@ void ioport_port::frame_update(ioport_field *mouse_field) // wholly overlapped by other fields //------------------------------------------------- -void ioport_port::collapse_fields(astring &errorbuf) +void ioport_port::collapse_fields(std::string &errorbuf) { ioport_value maskbits = 0; int lastmodcount = -1; @@ -2350,13 +2350,13 @@ void ioport_port::collapse_fields(astring &errorbuf) // for errors //------------------------------------------------- -void ioport_port::insert_field(ioport_field &newfield, ioport_value &disallowedbits, astring &errorbuf) +void ioport_port::insert_field(ioport_field &newfield, ioport_value &disallowedbits, std::string &errorbuf) { // verify against the disallowed bits, but only if we are condition-free if (newfield.condition().none()) { if ((newfield.mask() & disallowedbits) != 0) - errorbuf.catprintf("INPUT_TOKEN_FIELD specifies duplicate port bits (port=%s mask=%X)\n", tag(), newfield.mask()); + strcatprintf(errorbuf, "INPUT_TOKEN_FIELD specifies duplicate port bits (port=%s mask=%X)\n", tag(), newfield.mask()); disallowedbits |= newfield.mask(); } @@ -2479,7 +2479,7 @@ time_t ioport_manager::initialize() device_iterator iter(machine().root_device()); for (device_t *device = iter.first(); device != NULL; device = iter.next()) { - astring errors; + std::string errors; m_portlist.append(*device, errors); if (!errors.empty()) osd_printf_error("Input port errors:\n%s", errors.c_str()); @@ -3169,9 +3169,9 @@ void ioport_manager::save_config(int config_type, xml_data_node *parentnode) void ioport_manager::save_sequence(xml_data_node *parentnode, input_seq_type type, ioport_type porttype, const input_seq &seq) { // get the string for the sequence - astring seqstring; + std::string seqstring; if (seq.length() == 0) - seqstring.cpy("NONE"); + seqstring.assign("NONE"); else machine().input().seq_to_tokens(seqstring, seq); @@ -3231,7 +3231,7 @@ void ioport_manager::save_default_inputs(xml_data_node *parentnode) if (portnode != NULL) { // add the port information and attributes - astring tempstr; + std::string tempstr; xml_set_attribute(portnode, "type", input_type_to_token(tempstr, entry->type(), entry->player())); // add only the sequences that have changed from the defaults @@ -3286,7 +3286,7 @@ void ioport_manager::save_game_inputs(xml_data_node *parentnode) if (portnode != NULL) { // add the identifying information and attributes - astring tempstr; + std::string tempstr; xml_set_attribute(portnode, "tag", port->tag()); xml_set_attribute(portnode, "type", input_type_to_token(tempstr, field->type(), field->player())); xml_set_attribute_int(portnode, "mask", field->mask()); @@ -3629,7 +3629,7 @@ void ioport_manager::record_port(ioport_port &port) // ioport_configurer - constructor //------------------------------------------------- -ioport_configurer::ioport_configurer(device_t &owner, ioport_list &portlist, astring &errorbuf) +ioport_configurer::ioport_configurer(device_t &owner, ioport_list &portlist, std::string &errorbuf) : m_owner(owner), m_portlist(portlist), m_errorbuf(errorbuf), @@ -4397,15 +4397,15 @@ ioport_type ioport_manager::token_to_input_type(const char *string, int &player) // type and player to a string token //------------------------------------------------- -const char *ioport_manager::input_type_to_token(astring &str, ioport_type type, int player) +const char *ioport_manager::input_type_to_token(std::string &str, ioport_type type, int player) { // look up the port and return the token input_type_entry *entry = m_type_to_entry[type][player]; if (entry != NULL) - return str.cpy(entry->token()).c_str(); + return str.assign(entry->token()).c_str(); // if that fails, carry on - return str.format("TYPE_OTHER(%d,%d)", type, player).c_str(); + return strformat(str, "TYPE_OTHER(%d,%d)", type, player).c_str(); } diff --git a/src/emu/ioport.h b/src/emu/ioport.h index 49058ab061d..27f1e22b71f 100644 --- a/src/emu/ioport.h +++ b/src/emu/ioport.h @@ -667,7 +667,7 @@ struct xml_data_node; class analog_field; // constructor function pointer -typedef void (*ioport_constructor)(device_t &owner, ioport_list &portlist, astring &errorbuf); +typedef void(*ioport_constructor)(device_t &owner, ioport_list &portlist, std::string &errorbuf); // I/O port callback function delegates typedef device_delegate<ioport_value (ioport_field &, void *)> ioport_field_read_delegate; @@ -830,10 +830,10 @@ public: void post_coded(const char *text, size_t length = 0, const attotime &rate = attotime::zero); void frame_update(ioport_port &port, ioport_value &digital); - const char *key_name(astring &str, unicode_char ch); + const char *key_name(std::string &str, unicode_char ch); // debugging - astring dump(); + std::string dump(); private: // internal keyboard code information @@ -850,7 +850,7 @@ private: attotime choose_delay(unicode_char ch); void internal_post(unicode_char ch); void timer(void *ptr, int param); - const char *unicode_to_string(astring &buffer, unicode_char ch); + const char *unicode_to_string(std::string &buffer, unicode_char ch); const keycode_map_entry *find_code(unicode_char ch) const; // internal state @@ -975,7 +975,7 @@ public: private: ioport_diplocation * m_next; // pointer to the next bit - astring m_name; // name of the physical DIP switch + std::string m_name; // name of the physical DIP switch UINT8 m_number; // physical switch number bool m_invert; // is this an active-high DIP? }; @@ -1093,7 +1093,7 @@ public: void set_user_settings(const user_settings &settings); private: - void expand_diplocation(const char *location, astring &errorbuf); + void expand_diplocation(const char *location, std::string &errorbuf); // internal state ioport_field * m_next; // pointer to next field in sequence @@ -1158,7 +1158,7 @@ struct ioport_field_live bool last; // were we pressed last time? bool toggle; // current toggle setting digital_joystick::direction_t joydir; // digital joystick direction index - astring name; // overridden name + std::string name; // overridden name }; @@ -1173,7 +1173,7 @@ public: ioport_list() { } using tagged_list<ioport_port>::append; - void append(device_t &device, astring &errorbuf); + void append(device_t &device, std::string &errorbuf); }; @@ -1211,18 +1211,18 @@ public: // other operations ioport_field *field(ioport_value mask); - void collapse_fields(astring &errorbuf); + void collapse_fields(std::string &errorbuf); void frame_update(ioport_field *mouse_field); void init_live_state(); private: - void insert_field(ioport_field &newfield, ioport_value &disallowedbits, astring &errorbuf); + void insert_field(ioport_field &newfield, ioport_value &disallowedbits, std::string &errorbuf); // internal state ioport_port * m_next; // pointer to next port device_t & m_device; // associated device simple_list<ioport_field> m_fieldlist; // list of ioport_fields - astring m_tag; // copy of this port's tag + std::string m_tag; // copy of this port's tag int m_modcount; // modification count ioport_value m_active; // mask of active bits in the port auto_pointer<ioport_port_live> m_live; // live state of port (NULL if not live) @@ -1397,7 +1397,7 @@ public: void setup_natural_keyboard(ioport_queue_chars_delegate queue_chars, ioport_accept_char_delegate accept_char, ioport_charqueue_empty_delegate charqueue_empty); INT32 frame_interpolate(INT32 oldval, INT32 newval); ioport_type token_to_input_type(const char *string, int &player) const; - const char *input_type_to_token(astring &str, ioport_type type, int player); + const char *input_type_to_token(std::string &str, ioport_type type, int player); private: // internal helpers @@ -1473,7 +1473,7 @@ class ioport_configurer { public: // construction/destruction - ioport_configurer(device_t &owner, ioport_list &portlist, astring &errorbuf); + ioport_configurer(device_t &owner, ioport_list &portlist, std::string &errorbuf); // static helpers static const char *string_from_token(const char *string); @@ -1521,7 +1521,7 @@ private: // internal state device_t & m_owner; ioport_list & m_portlist; - astring & m_errorbuf; + std::string & m_errorbuf; ioport_port * m_curport; ioport_field * m_curfield; @@ -1566,7 +1566,7 @@ private: // start of table #define INPUT_PORTS_START(_name) \ -ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, astring &errorbuf) \ +ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, std::string &errorbuf) \ { \ ioport_configurer configurer(owner, portlist, errorbuf); // end of table @@ -1575,7 +1575,7 @@ ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, a // aliasing #define INPUT_PORTS_EXTERN(_name) \ - extern void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, astring &errorbuf) + extern void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, std::string &errorbuf) // including #define PORT_INCLUDE(_name) \ diff --git a/src/emu/luaengine.c b/src/emu/luaengine.c index 9084a97dc46..027d9731346 100644 --- a/src/emu/luaengine.c +++ b/src/emu/luaengine.c @@ -802,9 +802,9 @@ int lua_engine::luaopen_ioport(lua_State *L) } struct msg { - astring text; + std::string text; int ready; - astring response; + std::string response; int status; int done; } msg; @@ -817,7 +817,7 @@ void lua_engine::serve_lua() printf("%s v%s - %s\n%s\n%s\n\n", emulator_info::get_applongname(),build_version,emulator_info::get_fulllongname(),emulator_info::get_copyright_info(),LUA_COPYRIGHT); fflush(stdout); char buff[LUA_MAXINPUT]; - astring oldbuff; + std::string oldbuff; const char *b = LUA_PROMPT; @@ -830,8 +830,8 @@ void lua_engine::serve_lua() osd_lock_acquire(lock); if (msg.ready == 0) { msg.text = oldbuff; - if (oldbuff.len()!=0) msg.text.cat("\n"); - msg.text.cat(buff); + if (oldbuff.length()!=0) msg.text.append("\n"); + msg.text.append(buff); msg.ready = 1; msg.done = 0; } diff --git a/src/emu/machine.c b/src/emu/machine.c index fd397757baf..d225dda1a27 100644 --- a/src/emu/machine.c +++ b/src/emu/machine.c @@ -190,10 +190,10 @@ const char *running_machine::describe_context() { cpu_device *cpu = dynamic_cast<cpu_device *>(&executing->device()); if (cpu != NULL) - m_context.printf("'%s' (%s)", cpu->tag(), core_i64_format(cpu->pc(), cpu->space(AS_PROGRAM).logaddrchars(), cpu->is_octal())); + strprintf(m_context, "'%s' (%s)", cpu->tag(), core_i64_format(cpu->pc(), cpu->space(AS_PROGRAM).logaddrchars(), cpu->is_octal())); } else - m_context.cpy("(no context)"); + m_context.assign("(no context)"); return m_context.c_str(); } @@ -204,9 +204,9 @@ TIMER_CALLBACK_MEMBER(running_machine::autoboot_callback) manager().lua()->load_script(options().autoboot_script()); } else if (strlen(options().autoboot_command())!=0) { - astring cmd = astring(options().autoboot_command()); - cmd.replace("'","\\'"); - astring val = astring("emu.keypost('").cat(cmd.c_str()).cat("')").c_str(); + std::string cmd = std::string(options().autoboot_command()); + strreplace(cmd, "'", "\\'"); + std::string val = std::string("emu.keypost('").append(cmd.c_str()).append("')").c_str(); manager().lua()->load_string(val.c_str()); } } @@ -545,36 +545,36 @@ void running_machine::schedule_soft_reset() // software //------------------------------------------------- -astring running_machine::get_statename(const char *option) +std::string running_machine::get_statename(const char *option) { - astring statename_str(""); + std::string statename_str(""); if (option == NULL || option[0] == 0) - statename_str.cpy("%g"); + statename_str.assign("%g"); else - statename_str.cpy(option); + statename_str.assign(option); // strip any extension in the provided statename - int index = statename_str.rchr(0, '.'); + int index = statename_str.find_last_of('.'); if (index != -1) - statename_str.substr(0, index); + statename_str = statename_str.substr(0, index); // handle %d in the template (for image devices) - astring statename_dev("%d_"); - int pos = statename_str.find(0, statename_dev.c_str()); + std::string statename_dev("%d_"); + int pos = statename_str.find(statename_dev.c_str()); if (pos != -1) { // if more %d are found, revert to default and ignore them all - if (statename_str.find(pos + 3, statename_dev.c_str()) != -1) - statename_str.cpy("%g"); + if (statename_str.find(statename_dev.c_str(), pos + 3) != -1) + statename_str.assign("%g"); // else if there is a single %d, try to create the correct snapname else { int name_found = 0; // find length of the device name - int end1 = statename_str.find(pos + 3, "/"); - int end2 = statename_str.find(pos + 3, "%"); + int end1 = statename_str.find("/", pos + 3); + int end2 = statename_str.find("%", pos + 3); int end = -1; if ((end1 != -1) && (end2 != -1)) @@ -584,14 +584,14 @@ astring running_machine::get_statename(const char *option) else if (end2 != -1) end = end2; else - end = statename_str.len(); + end = statename_str.length(); if (end - pos < 3) fatalerror("Something very wrong is going on!!!\n"); - // copy the device name to an astring - astring devname_str; - devname_str.cpysubstr(statename_str, pos + 3, end - pos - 3); + // copy the device name to an std::string + std::string devname_str; + devname_str.assign(statename_str.substr(pos + 3, end - pos - 3)); //printf("check template: %s\n", devname_str.c_str()); // verify that there is such a device for this system @@ -599,19 +599,19 @@ astring running_machine::get_statename(const char *option) for (device_image_interface *image = iter.first(); image != NULL; image = iter.next()) { // get the device name - astring tempdevname(image->brief_instance_name()); + std::string tempdevname(image->brief_instance_name()); //printf("check device: %s\n", tempdevname.c_str()); - if (devname_str.cmp(tempdevname) == 0) + if (devname_str.compare(tempdevname) == 0) { // verify that such a device has an image mounted if (image->basename_noext() != NULL) { - astring filename(image->basename_noext()); + std::string filename(image->basename_noext()); // setup snapname and remove the %d_ - statename_str.replace(0, devname_str.c_str(), filename.c_str()); - statename_str.del(pos, 3); + strreplace(statename_str, devname_str.c_str(), filename.c_str()); + statename_str.erase(pos, 3); //printf("check image: %s\n", filename.c_str()); name_found = 1; @@ -621,13 +621,13 @@ astring running_machine::get_statename(const char *option) // or fallback to default if (name_found == 0) - statename_str.cpy("%g"); + statename_str.assign("%g"); } } // substitute path and gamename up front - statename_str.replace(0, "/", PATH_SEPARATOR); - statename_str.replace(0, "%g", basename()); + strreplace(statename_str, "/", PATH_SEPARATOR); + strreplace(statename_str, "%g", basename()); return statename_str; } @@ -643,15 +643,15 @@ void running_machine::set_saveload_filename(const char *filename) if (osd_is_absolute_path(filename)) { m_saveload_searchpath = NULL; - m_saveload_pending_file.cpy(filename); + m_saveload_pending_file.assign(filename); } else { m_saveload_searchpath = options().state_directory(); // take into account the statename option const char *stateopt = options().state_name(); - astring statename = get_statename(stateopt); - m_saveload_pending_file.cpy(statename.c_str()).cat(PATH_SEPARATOR).cat(filename).cat(".sta"); + std::string statename = get_statename(stateopt); + m_saveload_pending_file.assign(statename.c_str()).append(PATH_SEPARATOR).append(filename).append(".sta"); } } @@ -955,7 +955,7 @@ void running_machine::handle_saveload() // unschedule the operation cancel: - m_saveload_pending_file.reset(); + m_saveload_pending_file.clear(); m_saveload_searchpath = NULL; m_saveload_schedule = SLS_NONE; } @@ -1203,12 +1203,12 @@ const char *running_machine::image_parent_basename(device_t *device) NVRAM depending of selected BIOS -------------------------------------------------*/ -astring &running_machine::nvram_filename(astring &result, device_t &device) +std::string &running_machine::nvram_filename(std::string &result, device_t &device) { // start with either basename or basename_biosnum - result.cpy(basename()); + result.assign(basename()); if (root_device().system_bios() != 0 && root_device().default_bios() != root_device().system_bios()) - result.catprintf("_%d", root_device().system_bios() - 1); + strcatprintf(result, "_%d", root_device().system_bios() - 1); // device-based NVRAM gets its own name in a subdirectory if (&device != &root_device()) @@ -1217,11 +1217,12 @@ astring &running_machine::nvram_filename(astring &result, device_t &device) const char *software = image_parent_basename(&device); if (software!=NULL && strlen(software)>0) { - result.cat(PATH_SEPARATOR).cat(software); + result.append(PATH_SEPARATOR).append(software); } - astring tag(device.tag()); - tag.del(0, 1).replacechr(':', '_'); - result.cat(PATH_SEPARATOR).cat(tag); + std::string tag(device.tag()); + tag.erase(0, 1); + strreplacechr(tag,':', '_'); + result.append(PATH_SEPARATOR).append(tag); } return result; } @@ -1235,7 +1236,7 @@ void running_machine::nvram_load() nvram_interface_iterator iter(root_device()); for (device_nvram_interface *nvram = iter.first(); nvram != NULL; nvram = iter.next()) { - astring filename; + std::string filename; emu_file file(options().nvram_directory(), OPEN_FLAG_READ); if (file.open(nvram_filename(filename, nvram->device()).c_str()) == FILERR_NONE) { @@ -1257,7 +1258,7 @@ void running_machine::nvram_save() nvram_interface_iterator iter(root_device()); for (device_nvram_interface *nvram = iter.first(); nvram != NULL; nvram = iter.next()) { - astring filename; + std::string filename; emu_file file(options().nvram_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open(nvram_filename(filename, nvram->device()).c_str()) == FILERR_NONE) { diff --git a/src/emu/machine.h b/src/emu/machine.h index b045d37700a..a989ba2c874 100644 --- a/src/emu/machine.h +++ b/src/emu/machine.h @@ -253,14 +253,14 @@ private: // internal helpers void start(); void set_saveload_filename(const char *filename); - astring get_statename(const char *statename_opt); + std::string get_statename(const char *statename_opt); void fill_systime(system_time &systime, time_t t); void handle_saveload(); void soft_reset(void *ptr = NULL, INT32 param = 0); void watchdog_fired(void *ptr = NULL, INT32 param = 0); void watchdog_vblank(screen_device &screen, bool vblank_state); const char *image_parent_basename(device_t *device); - astring &nvram_filename(astring &result, device_t &device); + std::string &nvram_filename(std::string &result, device_t &device); void nvram_load(); void nvram_save(); @@ -306,8 +306,8 @@ private: UINT32 m_rand_seed; // current random number seed bool m_ui_active; // ui active or not (useful for games / systems with keyboard inputs) time_t m_base_time; // real time at initial emulation time - astring m_basename; // basename used for game-related paths - astring m_context; // context string buffer + std::string m_basename; // basename used for game-related paths + std::string m_context; // context string buffer int m_sample_rate; // the digital audio sample rate auto_pointer<emu_file> m_logfile; // pointer to the active log file @@ -320,7 +320,7 @@ private: }; saveload_schedule m_saveload_schedule; attotime m_saveload_schedule_time; - astring m_saveload_pending_file; + std::string m_saveload_pending_file; const char * m_saveload_searchpath; // notifier callbacks diff --git a/src/emu/machine/fdc_pll.c b/src/emu/machine/fdc_pll.c index 0efb48b813e..e0cd8338ef2 100644 --- a/src/emu/machine/fdc_pll.c +++ b/src/emu/machine/fdc_pll.c @@ -1,6 +1,6 @@ #include "fdc_pll.h" -astring fdc_pll_t::tts(attotime t) +std::string fdc_pll_t::tts(attotime t) { char buf[256]; bool neg = t.seconds < 0; diff --git a/src/emu/machine/fdc_pll.h b/src/emu/machine/fdc_pll.h index 4a356616126..7bb04e0be33 100644 --- a/src/emu/machine/fdc_pll.h +++ b/src/emu/machine/fdc_pll.h @@ -25,7 +25,7 @@ public: void commit(floppy_image_device *floppy, const attotime &tm); void stop_writing(floppy_image_device *floppy, const attotime &tm); - astring tts(attotime tm); + std::string tts(attotime tm); }; #endif diff --git a/src/emu/machine/hdc9234.c b/src/emu/machine/hdc9234.c index be924040fde..f3b6077db3f 100644 --- a/src/emu/machine/hdc9234.c +++ b/src/emu/machine/hdc9234.c @@ -1767,7 +1767,7 @@ void hdc9234_device::write_sectors() =========================================================================== */ -astring hdc9234_device::tts(const attotime &t) +std::string hdc9234_device::tts(const attotime &t) { char buf[256]; int nsec = t.attoseconds / ATTOSECONDS_PER_NANOSECOND; @@ -1775,7 +1775,7 @@ astring hdc9234_device::tts(const attotime &t) return buf; } -astring hdc9234_device::ttsn() +std::string hdc9234_device::ttsn() { return tts(machine().time()); } diff --git a/src/emu/machine/hdc9234.h b/src/emu/machine/hdc9234.h index e4efd35ad3e..a933f6b1959 100644 --- a/src/emu/machine/hdc9234.h +++ b/src/emu/machine/hdc9234.h @@ -184,10 +184,10 @@ private: void wait_line(int line, line_state level, int substate, bool stopwrite); // Converts attotime to a string - astring tts(const attotime &t); + std::string tts(const attotime &t); // Current time - astring ttsn(); + std::string ttsn(); // Utility routine to set or reset bits void set_bits(UINT8& byte, int mask, bool set); diff --git a/src/emu/machine/laserdsc.c b/src/emu/machine/laserdsc.c index 809422871a4..a027ac62271 100644 --- a/src/emu/machine/laserdsc.c +++ b/src/emu/machine/laserdsc.c @@ -755,7 +755,7 @@ void laserdisc_device::init_disc() throw emu_fatalerror("Laserdisc video must be compressed with the A/V codec!"); // read the metadata - astring metadata; + std::string metadata; chd_error err = m_disc->read_metadata(AV_METADATA_TAG, 0, metadata); if (err != CHDERR_NONE) throw emu_fatalerror("Non-A/V CHD file specified"); diff --git a/src/emu/machine/netlist.h b/src/emu/machine/netlist.h index 214b95c4b92..5b08b04a9dc 100644 --- a/src/emu/machine/netlist.h +++ b/src/emu/machine/netlist.h @@ -268,14 +268,14 @@ protected: // device_state_interface overrides - virtual void state_string_export(const device_state_entry &entry, astring &str) + virtual void state_string_export(const device_state_entry &entry, std::string &str) { if (entry.index() >= 0) { if (entry.index() & 1) - str.format("%10.6f", *((double *)entry.dataptr())); + strprintf(str,"%10.6f", *((double *)entry.dataptr())); else - str.format("%d", *((netlist_sig_t *)entry.dataptr())); + strprintf(str, "%d", *((netlist_sig_t *)entry.dataptr())); } } diff --git a/src/emu/machine/ram.c b/src/emu/machine/ram.c index d777ab9d064..6f5d3c4ec27 100644 --- a/src/emu/machine/ram.c +++ b/src/emu/machine/ram.c @@ -154,19 +154,19 @@ void ram_device::device_validity_check(validity_checker &valid) const if (!is_valid) { - astring output; - output.catprintf("Cannot recognize the RAM option %s", ramsize_string); - output.catprintf(" (valid options are %s", m_default_size); + std::string output; + strcatprintf(output, "Cannot recognize the RAM option %s", ramsize_string); + strcatprintf(output, " (valid options are %s", m_default_size); if (m_extra_options != NULL) - output.catprintf(",%s).\n", m_extra_options); + strcatprintf(output, ",%s).\n", m_extra_options); else - output.catprintf(").\n"); + strcatprintf(output, ").\n"); osd_printf_error("%s", output.c_str()); osd_printf_warning("Setting value to default %s\n",m_default_size); - astring error; + std::string error; mconfig().options().set_value(OPTION_RAMSIZE, m_default_size, OPTION_PRIORITY_CMDLINE, error); assert(error.empty()); } diff --git a/src/emu/machine/upd765.c b/src/emu/machine/upd765.c index 214e10f8614..84aa7e1ae85 100644 --- a/src/emu/machine/upd765.c +++ b/src/emu/machine/upd765.c @@ -2181,7 +2181,7 @@ bool upd765_family_device::get_irq() const return cur_irq; } -astring upd765_family_device::tts(attotime t) +std::string upd765_family_device::tts(attotime t) { char buf[256]; const char *sign = ""; @@ -2194,7 +2194,7 @@ astring upd765_family_device::tts(attotime t) return buf; } -astring upd765_family_device::ttsn() +std::string upd765_family_device::ttsn() { return tts(machine().time()); } diff --git a/src/emu/machine/upd765.h b/src/emu/machine/upd765.h index 27ed83a7122..d692686be65 100644 --- a/src/emu/machine/upd765.h +++ b/src/emu/machine/upd765.h @@ -329,8 +329,8 @@ protected: emu_timer *poll_timer; - static astring tts(attotime t); - astring ttsn(); + static std::string tts(attotime t); + std::string ttsn(); enum { C_CONFIGURE, diff --git a/src/emu/machine/wd_fdc.c b/src/emu/machine/wd_fdc.c index 6205f92f973..79e766da362 100644 --- a/src/emu/machine/wd_fdc.c +++ b/src/emu/machine/wd_fdc.c @@ -188,7 +188,7 @@ void wd_fdc_t::dden_w(bool _dden) } } -astring wd_fdc_t::tts(const attotime &t) +std::string wd_fdc_t::tts(const attotime &t) { char buf[256]; int nsec = t.attoseconds / ATTOSECONDS_PER_NANOSECOND; @@ -196,7 +196,7 @@ astring wd_fdc_t::tts(const attotime &t) return buf; } -astring wd_fdc_t::ttsn() +std::string wd_fdc_t::ttsn() { return tts(machine().time()); } diff --git a/src/emu/machine/wd_fdc.h b/src/emu/machine/wd_fdc.h index 36cf9f63edf..39467ffd2c4 100644 --- a/src/emu/machine/wd_fdc.h +++ b/src/emu/machine/wd_fdc.h @@ -368,10 +368,10 @@ private: UINT8 format_last_byte; int format_last_byte_count; - astring format_description_string; + std::string format_description_string; - static astring tts(const attotime &t); - astring ttsn(); + static std::string tts(const attotime &t); + std::string ttsn(); void delay_cycles(emu_timer *tm, int cycles); diff --git a/src/emu/mame.c b/src/emu/mame.c index 297fe1c6d9b..1af6ccff012 100644 --- a/src/emu/mame.c +++ b/src/emu/mame.c @@ -199,7 +199,7 @@ int machine_manager::execute() if (m_options.read_config()) { m_options.revert(OPTION_PRIORITY_INI); - astring errors; + std::string errors; m_options.parse_standard_inis(errors); } @@ -236,7 +236,7 @@ int machine_manager::execute() // third: if we scheduled a new system, take also care of ramsize options if (new_system) { - astring error_string; + std::string error_string; m_options.set_value(OPTION_RAMSIZE, "", OPTION_PRIORITY_CMDLINE, error_string); } firstrun = true; @@ -276,16 +276,16 @@ void CLIB_DECL popmessage(const char *format, ...) // otherwise, generate the buffer and call the UI to display the message else { - astring temp; + std::string temp; va_list arg; // dump to the buffer va_start(arg, format); - temp.vprintf(format, arg); + strvprintf(temp,format, arg); va_end(arg); // pop it in the UI - machine_manager::instance()->machine()->ui().popup_time(temp.len() / 40 + 2, "%s", temp.c_str()); + machine_manager::instance()->machine()->ui().popup_time(temp.length() / 40 + 2, "%s", temp.c_str()); /* // also write to error.log diff --git a/src/emu/mconfig.c b/src/emu/mconfig.c index b05c33653e9..55dd19148f3 100644 --- a/src/emu/mconfig.c +++ b/src/emu/mconfig.c @@ -38,7 +38,7 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options) for (device_slot_interface *slot = slotiter.first(); slot != NULL; slot = slotiter.next()) { device_t &owner = slot->device(); - astring temp; + std::string temp; const char *selval = options.main_value(temp, owner.tag()+1); bool isdefault = (options.priority(owner.tag()+1)==OPTION_PRIORITY_DEFAULT); if (!is_selected_driver || !options.exists(owner.tag()+1)) diff --git a/src/emu/memory.c b/src/emu/memory.c index 3defdf6fe53..a61456b4e7b 100644 --- a/src/emu/memory.c +++ b/src/emu/memory.c @@ -1932,7 +1932,7 @@ void address_space::populate_from_map(address_map *map) void address_space::populate_map_entry(const address_map_entry &entry, read_or_write readorwrite) { const map_handler_data &data = (readorwrite == ROW_READ) ? entry.m_read : entry.m_write; - astring fulltag; + std::string fulltag; // based on the handler type, alter the bits, name, funcptr, and object switch (data.m_type) @@ -2679,9 +2679,11 @@ memory_bank &address_space::bank_find_or_allocate(const char *tag, offs_t addrst // if no tag, create a unique one membank = global_alloc(memory_bank(*this, banknum, bytestart, byteend, tag)); - astring temptag; - if (tag == NULL) - tag = temptag.format("anon_%p", membank).c_str(); + std::string temptag; + if (tag == NULL) { + strprintf(temptag, "anon_%p", membank); + tag = temptag.c_str(); + } manager().m_banklist.append(tag, *membank); } @@ -3877,8 +3879,8 @@ memory_block::memory_block(address_space &space, offs_t bytestart, offs_t byteen if (region == NULL) { int bytes_per_element = space.data_width() / 8; - astring name; - name.printf("%08x-%08x", bytestart, byteend); + std::string name; + strprintf(name,"%08x-%08x", bytestart, byteend); space.machine().save().save_memory(NULL, "memory", space.device().tag(), space.spacenum(), name.c_str(), m_data, bytes_per_element, (UINT32)(byteend + 1 - bytestart) / bytes_per_element); } } @@ -3916,13 +3918,13 @@ memory_bank::memory_bank(address_space &space, int index, offs_t bytestart, offs // generate an internal tag if we don't have one if (tag == NULL) { - m_tag.printf("~%d~", index); - m_name.printf("Internal bank #%d", index); + strprintf(m_tag,"~%d~", index); + strprintf(m_name,"Internal bank #%d", index); } else { - m_tag.cpy(tag); - m_name.printf("Bank '%s'", tag); + m_tag.assign(tag); + strprintf(m_name,"Bank '%s'", tag); } if (!m_anonymous && space.machine().save().registration_allowed()) diff --git a/src/emu/memory.h b/src/emu/memory.h index fff49dd6d0c..7503301453e 100644 --- a/src/emu/memory.h +++ b/src/emu/memory.h @@ -626,9 +626,9 @@ private: offs_t m_bytestart; // byte-adjusted start offset offs_t m_byteend; // byte-adjusted end offset int m_curentry; // current entry - std::vector<bank_entry> m_entry; // array of entries (dynamically allocated) - astring m_name; // friendly name for this bank - astring m_tag; // tag for this bank + std::vector<bank_entry> m_entry; // array of entries (dynamically allocated) + std::string m_name; // friendly name for this bank + std::string m_tag; // tag for this bank simple_list<bank_reference> m_reflist; // linked list of address spaces referencing this bank }; @@ -712,7 +712,7 @@ private: // internal data running_machine & m_machine; memory_region * m_next; - astring m_name; + std::string m_name; dynamic_buffer m_buffer; endianness_t m_endianness; UINT8 m_bitwidth; diff --git a/src/emu/output.c b/src/emu/output.c index 842473b25cc..883a3922b2a 100644 --- a/src/emu/output.c +++ b/src/emu/output.c @@ -45,7 +45,7 @@ public: struct output_item { output_item * next; /* next item in list */ - astring name; /* string name of the item */ + std::string name; /* string name of the item */ UINT32 hash; /* hash for this item name */ UINT32 id; /* unique ID for this item */ INT32 value; /* current value */ @@ -117,7 +117,7 @@ INLINE output_item *create_new_item(const char *outname, INT32 value) /* fill in the data */ item->next = itemtable[hash % HASH_SIZE]; - item->name.cpy(outname); + item->name.assign(outname); item->hash = hash; item->id = uniqueid++; item->value = value; diff --git a/src/emu/profiler.c b/src/emu/profiler.c index 6da529325f0..50e289e8d46 100644 --- a/src/emu/profiler.c +++ b/src/emu/profiler.c @@ -112,7 +112,7 @@ void real_profiler_state::reset(bool enabled) //------------------------------------------------- -// text - return the current text in an astring +// text - return the current text in an std::string //------------------------------------------------- const char *real_profiler_state::text(running_machine &machine) @@ -136,7 +136,7 @@ const char *real_profiler_state::text(running_machine &machine) //------------------------------------------------- -// update_text - update the current astring +// update_text - update the current std::string //------------------------------------------------- void real_profiler_state::update_text(running_machine &machine) @@ -185,7 +185,7 @@ void real_profiler_state::update_text(running_machine &machine) // this becomes the total; if we end up with 0 for anything, we were just started, so return empty UINT64 total = computed; - m_text.reset(); + m_text.clear(); if (total == 0 || normalize == 0) { return; @@ -202,25 +202,25 @@ void real_profiler_state::update_text(running_machine &machine) if (computed != 0) { // start with the un-normalized percentage - m_text.catprintf("%02d%% ", (int)((computed * 100 + total/2) / total)); + strcatprintf(m_text, "%02d%% ", (int)((computed * 100 + total / 2) / total)); // followed by the normalized percentage for everything but profiler and idle if (curtype < PROFILER_PROFILER) - m_text.catprintf("%02d%% ", (int)((computed * 100 + normalize/2) / normalize)); + strcatprintf(m_text, "%02d%% ", (int)((computed * 100 + normalize / 2) / normalize)); // and then the text if (curtype >= PROFILER_DEVICE_FIRST && curtype <= PROFILER_DEVICE_MAX) - m_text.catprintf("'%s'", iter.byindex(curtype - PROFILER_DEVICE_FIRST)->tag()); + strcatprintf(m_text, "'%s'", iter.byindex(curtype - PROFILER_DEVICE_FIRST)->tag()); else for (int nameindex = 0; nameindex < ARRAY_LENGTH(names); nameindex++) if (names[nameindex].type == curtype) { - m_text.cat(names[nameindex].string); + m_text.append(names[nameindex].string); break; } // followed by a carriage return - m_text.cat("\n"); + m_text.append("\n"); } } diff --git a/src/emu/profiler.h b/src/emu/profiler.h index ee4292f24b9..25cd2b4d7ce 100644 --- a/src/emu/profiler.h +++ b/src/emu/profiler.h @@ -167,7 +167,7 @@ private: // internal state filo_entry * m_filoptr; // current FILO index - astring m_text; // profiler text + std::string m_text; // profiler text attotime m_text_time; // profiler text last update filo_entry m_filo[32]; // array of FILO entries osd_ticks_t m_data[PROFILER_TOTAL + 1]; // array of data diff --git a/src/emu/render.c b/src/emu/render.c index ed4a7b7d1a0..30a0b992215 100644 --- a/src/emu/render.c +++ b/src/emu/render.c @@ -1571,9 +1571,9 @@ bool render_target::load_layout_file(const char *dirname, const char *filename) else { // build the path and optionally prepend the directory - astring fname = astring(filename).cat(".lay"); + std::string fname = std::string(filename).append(".lay"); if (dirname != NULL) - fname.ins(0, PATH_SEPARATOR).ins(0, dirname); + fname.insert(0, PATH_SEPARATOR).insert(0, dirname); // attempt to open the file; bail if we can't emu_file layoutfile(manager().machine().options().art_path(), OPEN_FLAG_READ); diff --git a/src/emu/rendfont.c b/src/emu/rendfont.c index 62a0581f9ab..2011119979c 100644 --- a/src/emu/rendfont.c +++ b/src/emu/rendfont.c @@ -392,8 +392,8 @@ bool render_font::load_cached_bdf(const char *filename) UINT32 hash = crc32(0, (const UINT8 *)&m_rawdata[0], bytes) ^ (UINT32)m_rawsize; // create the cached filename, changing the 'F' to a 'C' on the extension - astring cachedname(filename); - cachedname.del(cachedname.len() - 3, 3).cat("bdc"); + std::string cachedname(filename); + cachedname.erase(cachedname.length() - 3, 3).append("bdc"); // attempt to open the cached version of the font { diff --git a/src/emu/rendlay.c b/src/emu/rendlay.c index 397e7a704ec..a3b5f48e8b1 100644 --- a/src/emu/rendlay.c +++ b/src/emu/rendlay.c @@ -626,19 +626,19 @@ layout_element::component::component(running_machine &machine, xml_data_node &co { m_type = CTYPE_REEL; - astring symbollist = xml_get_attribute_string_with_subst(machine, compnode, "symbollist", "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15"); + std::string symbollist = xml_get_attribute_string_with_subst(machine, compnode, "symbollist", "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15"); // split out position names from string and figure out our number of symbols int location = -1; m_numstops = 0; - location=symbollist.find(0,","); + location=symbollist.find(","); while (location!=-1) { m_stopnames[m_numstops] = symbollist; - m_stopnames[m_numstops].substr(0, location); - symbollist.substr(location+1, symbollist.len()-(location-1)); + m_stopnames[m_numstops] = m_stopnames[m_numstops].substr(0, location); + symbollist = symbollist.substr(location+1, symbollist.length()-(location-1)); m_numstops++; - location=symbollist.find(0,","); + location=symbollist.find(","); } m_stopnames[m_numstops++] = symbollist; @@ -648,12 +648,12 @@ layout_element::component::component(running_machine &machine, xml_data_node &co for (int i=0;i<m_numstops;i++) { - location=m_stopnames[i].find(0,":"); + location=m_stopnames[i].find(":"); if (location!=-1) { m_imagefile[i] = m_stopnames[i]; - m_stopnames[i].substr(0, location); - m_imagefile[i].substr(location+1, m_imagefile[i].len()-(location-1)); + m_stopnames[i] = m_stopnames[i].substr(0, location); + m_imagefile[i] = m_imagefile[i].substr(location+1, m_imagefile[i].length()-(location-1)); //m_alphafile[i] = m_file[i].reset(global_alloc(emu_file(machine.options().art_path(), OPEN_FLAG_READ))); @@ -987,7 +987,7 @@ void layout_element::component::draw_simplecounter(running_machine &machine, bit { char temp[256]; sprintf(temp, "%0*d", m_digits, state); - m_string = astring(temp); + m_string = std::string(temp); draw_text(machine, dest, bounds); } diff --git a/src/emu/rendlay.h b/src/emu/rendlay.h index bcfbdcaf6d1..a288e0ab09d 100644 --- a/src/emu/rendlay.h +++ b/src/emu/rendlay.h @@ -134,20 +134,20 @@ private: int m_state; // state where this component is visible (-1 means all states) render_bounds m_bounds; // bounds of the element render_color m_color; // color of the element - astring m_string; // string for text components + std::string m_string; // string for text components int m_digits; // number of digits for simple counters int m_textalign; // text alignment to box bitmap_argb32 m_bitmap[MAX_BITMAPS]; // source bitmap for images - astring m_dirname; // directory name of image file (for lazy loading) + std::string m_dirname; // directory name of image file (for lazy loading) auto_pointer<emu_file> m_file[MAX_BITMAPS]; // file object for reading image/alpha files - astring m_imagefile[MAX_BITMAPS]; // name of the image file (for lazy loading) - astring m_alphafile[MAX_BITMAPS]; // name of the alpha file (for lazy loading) + std::string m_imagefile[MAX_BITMAPS]; // name of the image file (for lazy loading) + std::string m_alphafile[MAX_BITMAPS]; // name of the alpha file (for lazy loading) bool m_hasalpha[MAX_BITMAPS]; // is there any alpha component present? // stuff for fruit machine reels // basically made up of multiple text strings / gfx int m_numstops; - astring m_stopnames[MAX_BITMAPS]; + std::string m_stopnames[MAX_BITMAPS]; int m_stateoffset; int m_reelreversed; int m_numsymbolsvisible; @@ -172,7 +172,7 @@ private: // internal state layout_element * m_next; // link to next element running_machine & m_machine; // reference to the owning machine - astring m_name; // name of this element + std::string m_name; // name of this element simple_list<component> m_complist; // list of components int m_defstate; // default state of this element int m_maxstate; // maximum state value for all components @@ -217,8 +217,8 @@ public: // internal state item * m_next; // link to next item layout_element * m_element; // pointer to the associated element (non-screens only) - astring m_output_name; // name of this item - astring m_input_tag; // input tag of this item + std::string m_output_name; // name of this item + std::string m_input_tag; // input tag of this item ioport_value m_input_mask; // input mask of this item screen_device * m_screen; // pointer to screen int m_orientation; // orientation of this item @@ -248,7 +248,7 @@ public: private: // internal state layout_view * m_next; // pointer to next layout in the list - astring m_name; // name of the layout + std::string m_name; // name of the layout float m_aspect; // X/Y of the layout float m_scraspect; // X/Y of the screen areas render_screen_list m_screens; // list of active screens diff --git a/src/emu/rendutil.c b/src/emu/rendutil.c index 59f4fb4b55d..5eb7c012521 100644 --- a/src/emu/rendutil.c +++ b/src/emu/rendutil.c @@ -537,11 +537,11 @@ bool render_load_png(bitmap_argb32 &bitmap, emu_file &file, const char *dirname, bitmap.reset(); // open the file - astring fname; + std::string fname; if (dirname == NULL) - fname.cpy(filename); + fname.assign(filename); else - fname.cpy(dirname).cat(PATH_SEPARATOR).cat(filename); + fname.assign(dirname).append(PATH_SEPARATOR).append(filename); file_error filerr = file.open(fname.c_str()); if (filerr != FILERR_NONE) return false; diff --git a/src/emu/romload.c b/src/emu/romload.c index a6a0764c110..b9a003d1c5a 100644 --- a/src/emu/romload.c +++ b/src/emu/romload.c @@ -51,7 +51,7 @@ public: private: open_chd * m_next; /* pointer to next in the list */ - astring m_region; /* disk region we came from */ + std::string m_region; /* disk region we came from */ chd_file m_origchd; /* handle to the original CHD */ chd_file m_diffchd; /* handle to the diff CHD */ }; @@ -77,8 +77,8 @@ struct romload_private memory_region * region; /* info about current region */ - astring errorstring; /* error string */ - astring softwarningstring; /* software warning string */ + std::string errorstring; /* error string */ + std::string softwarningstring; /* software warning string */ }; @@ -373,7 +373,7 @@ static void determine_bios_rom(romload_private *romdata, device_t *device, const /* if we got neither an empty string nor 'default' then warn the user */ if (specbios[0] != 0 && strcmp(specbios, "default") != 0 && romdata != NULL) { - romdata->errorstring.catprintf("%s: invalid bios\n", specbios); + strcatprintf(romdata->errorstring, "%s: invalid bios\n", specbios); romdata->errors++; } @@ -428,12 +428,12 @@ static void fill_random(running_machine &machine, UINT8 *base, UINT32 length) for missing files -------------------------------------------------*/ -static void handle_missing_file(romload_private *romdata, const rom_entry *romp, astring tried_file_names, chd_error chderr) +static void handle_missing_file(romload_private *romdata, const rom_entry *romp, std::string tried_file_names, chd_error chderr) { - if(tried_file_names.len() != 0) + if(tried_file_names.length() != 0) tried_file_names = " (tried in " + tried_file_names + ")"; - astring name(ROM_GETNAME(romp)); + std::string name(ROM_GETNAME(romp)); bool is_chd = (chderr != CHDERR_NONE); if (is_chd) @@ -441,13 +441,13 @@ static void handle_missing_file(romload_private *romdata, const rom_entry *romp, bool is_chd_error = (is_chd && chderr != CHDERR_FILE_NOT_FOUND); if (is_chd_error) - romdata->errorstring.catprintf("%s CHD ERROR: %s\n", name.c_str(), chd_file::error_string(chderr)); + strcatprintf(romdata->errorstring, "%s CHD ERROR: %s\n", name.c_str(), chd_file::error_string(chderr)); /* optional files are okay */ if (ROM_ISOPTIONAL(romp)) { if (!is_chd_error) - romdata->errorstring.catprintf("OPTIONAL %s NOT FOUND%s\n", name.c_str(), tried_file_names.c_str()); + strcatprintf(romdata->errorstring, "OPTIONAL %s NOT FOUND%s\n", name.c_str(), tried_file_names.c_str()); romdata->warnings++; } @@ -455,7 +455,7 @@ static void handle_missing_file(romload_private *romdata, const rom_entry *romp, else if (hash_collection(ROM_GETHASHDATA(romp)).flag(hash_collection::FLAG_NO_DUMP)) { if (!is_chd_error) - romdata->errorstring.catprintf("%s NOT FOUND (NO GOOD DUMP KNOWN)%s\n", name.c_str(), tried_file_names.c_str()); + strcatprintf(romdata->errorstring, "%s NOT FOUND (NO GOOD DUMP KNOWN)%s\n", name.c_str(), tried_file_names.c_str()); romdata->knownbad++; } @@ -463,7 +463,7 @@ static void handle_missing_file(romload_private *romdata, const rom_entry *romp, else { if (!is_chd_error) - romdata->errorstring.catprintf("%s NOT FOUND%s\n", name.c_str(), tried_file_names.c_str()); + strcatprintf(romdata->errorstring, "%s NOT FOUND%s\n", name.c_str(), tried_file_names.c_str()); romdata->errors++; } } @@ -477,9 +477,9 @@ static void handle_missing_file(romload_private *romdata, const rom_entry *romp, static void dump_wrong_and_correct_checksums(romload_private *romdata, const hash_collection &hashes, const hash_collection &acthashes) { - astring tempstr; - romdata->errorstring.catprintf(" EXPECTED: %s\n", hashes.macro_string(tempstr)); - romdata->errorstring.catprintf(" FOUND: %s\n", acthashes.macro_string(tempstr)); + std::string tempstr; + strcatprintf(romdata->errorstring, " EXPECTED: %s\n", hashes.macro_string(tempstr)); + strcatprintf(romdata->errorstring, " FOUND: %s\n", acthashes.macro_string(tempstr)); } @@ -498,30 +498,30 @@ static void verify_length_and_hash(romload_private *romdata, const char *name, U UINT32 actlength = romdata->file->size(); if (explength != actlength) { - romdata->errorstring.catprintf("%s WRONG LENGTH (expected: %08x found: %08x)\n", name, explength, actlength); + strcatprintf(romdata->errorstring, "%s WRONG LENGTH (expected: %08x found: %08x)\n", name, explength, actlength); romdata->warnings++; } /* If there is no good dump known, write it */ - astring tempstr; + std::string tempstr; hash_collection &acthashes = romdata->file->hashes(hashes.hash_types(tempstr)); if (hashes.flag(hash_collection::FLAG_NO_DUMP)) { - romdata->errorstring.catprintf("%s NO GOOD DUMP KNOWN\n", name); + strcatprintf(romdata->errorstring, "%s NO GOOD DUMP KNOWN\n", name); romdata->knownbad++; } /* verify checksums */ else if (hashes != acthashes) { /* otherwise, it's just bad */ - romdata->errorstring.catprintf("%s WRONG CHECKSUMS:\n", name); + strcatprintf(romdata->errorstring, "%s WRONG CHECKSUMS:\n", name); dump_wrong_and_correct_checksums(romdata, hashes, acthashes); romdata->warnings++; } /* If it matches, but it is actually a bad dump, write it */ else if (hashes.flag(hash_collection::FLAG_BAD_DUMP)) { - romdata->errorstring.catprintf("%s ROM NEEDS REDUMP\n",name); + strcatprintf(romdata->errorstring, "%s ROM NEEDS REDUMP\n",name); romdata->knownbad++; } } @@ -567,9 +567,9 @@ static void display_rom_load_results(romload_private *romdata, bool from_list) /* if we had warnings, output them, but continue */ if ((romdata-> warnings) || (romdata->knownbad)) { - romdata->errorstring.cat("WARNING: the "); - romdata->errorstring.cat(emulator_info::get_gamenoun()); - romdata->errorstring.cat(" might not run correctly."); + romdata->errorstring.append("WARNING: the "); + romdata->errorstring.append(emulator_info::get_gamenoun()); + romdata->errorstring.append(" might not run correctly."); osd_printf_warning("%s\n", romdata->errorstring.c_str()); } } @@ -622,7 +622,7 @@ static void region_post_process(romload_private *romdata, const char *rgntag, bo up the parent and loading by checksum -------------------------------------------------*/ -static int open_rom_file(romload_private *romdata, const char *regiontag, const rom_entry *romp, astring &tried_file_names, bool from_list) +static int open_rom_file(romload_private *romdata, const char *regiontag, const rom_entry *romp, std::string &tried_file_names, bool from_list) { file_error filerr = FILERR_NOT_FOUND; UINT32 romsize = rom_file_size(romp); @@ -639,7 +639,7 @@ static int open_rom_file(romload_private *romdata, const char *regiontag, const attempts any kind of load by checksum supported by the archives. */ romdata->file = NULL; for (int drv = driver_list::find(romdata->machine().system()); romdata->file == NULL && drv != -1; drv = driver_list::clone(drv)) { - if(tried_file_names.len() != 0) + if (tried_file_names.length() != 0) tried_file_names += " "; tried_file_names += driver_list::driver(drv).name; filerr = common_process_file(romdata->machine().options(), driver_list::driver(drv).name, has_crc, crc, romp, &romdata->file); @@ -651,42 +651,42 @@ static int open_rom_file(romload_private *romdata, const char *regiontag, const // check if we are dealing with softwarelists. if so, locationtag // is actually a concatenation of: listname + setname + parentname // separated by '%' (parentname being present only for clones) - astring tag1(regiontag), tag2, tag3, tag4, tag5; + std::string tag1(regiontag), tag2, tag3, tag4, tag5; bool is_list = FALSE; bool has_parent = FALSE; - int separator1 = tag1.chr(0, '%'); + int separator1 = tag1.find_first_of('%'); if (separator1 != -1) { is_list = TRUE; // we are loading through softlists, split the listname from the regiontag - tag4.cpysubstr(tag1, separator1 + 1, tag1.len() - separator1 + 1); - tag1.del(separator1, tag1.len() - separator1); - tag1.cat(PATH_SEPARATOR); + tag4.assign(tag1.substr(separator1 + 1, tag1.length() - separator1 + 1)); + tag1.erase(separator1, tag1.length() - separator1); + tag1.append(PATH_SEPARATOR); // check if we are loading a clone (if this is the case also tag1 have a separator '%') - int separator2 = tag4.chr(0, '%'); + int separator2 = tag4.find_first_of('%'); if (separator2 != -1) { has_parent = TRUE; // we are loading a clone through softlists, split the setname from the parentname - tag5.cpysubstr(tag4, separator2 + 1, tag4.len() - separator2 + 1); - tag4.del(separator2, tag4.len() - separator2); + tag5.assign(tag4.substr(separator2 + 1, tag4.length() - separator2 + 1)); + tag4.erase(separator2, tag4.length() - separator2); } // prepare locations where we have to load from: list/parentname & list/clonename - astring swlist(tag1.c_str()); - tag2.cpy(swlist.cat(tag4)); + std::string swlist(tag1.c_str()); + tag2.assign(swlist.append(tag4)); if (has_parent) { - swlist.cpy(tag1); - tag3.cpy(swlist.cat(tag5)); + swlist.assign(tag1); + tag3.assign(swlist.append(tag5)); } } - if (tag5.chr(0, '%') != -1) + if (tag5.find_first_of('%') != -1) fatalerror("We do not support clones of clones!\n"); // try to load from the available location(s): @@ -966,7 +966,7 @@ static void process_rom_entries(romload_private *romdata, const char *regiontag, /* open the file if it is a non-BIOS or matches the current BIOS */ LOG(("Opening ROM file: %s\n", ROM_GETNAME(romp))); - astring tried_file_names; + std::string tried_file_names; if (!irrelevantbios && !open_rom_file(romdata, regiontag, romp, tried_file_names, from_list)) handle_missing_file(romdata, romp, tried_file_names, CHDERR_NONE); @@ -1052,42 +1052,42 @@ int open_disk_image(emu_options &options, const game_driver *gamedrv, const rom_ // check if we are dealing with softwarelists. if so, locationtag // is actually a concatenation of: listname + setname + parentname // separated by '%' (parentname being present only for clones) - astring tag1(locationtag), tag2, tag3, tag4, tag5; + std::string tag1(locationtag), tag2, tag3, tag4, tag5; bool is_list = FALSE; bool has_parent = FALSE; - int separator1 = tag1.chr(0, '%'); + int separator1 = tag1.find_first_of('%'); if (separator1 != -1) { is_list = TRUE; // we are loading through softlists, split the listname from the regiontag - tag4.cpysubstr(tag1, separator1 + 1, tag1.len() - separator1 + 1); - tag1.del(separator1, tag1.len() - separator1); - tag1.cat(PATH_SEPARATOR); + tag4.assign(tag1.substr(separator1 + 1, tag1.length() - separator1 + 1)); + tag1.erase(separator1, tag1.length() - separator1); + tag1.append(PATH_SEPARATOR); // check if we are loading a clone (if this is the case also tag1 have a separator '%') - int separator2 = tag4.chr(0, '%'); + int separator2 = tag4.find_first_of('%'); if (separator2 != -1) { has_parent = TRUE; // we are loading a clone through softlists, split the setname from the parentname - tag5.cpysubstr(tag4, separator2 + 1, tag4.len() - separator2 + 1); - tag4.del(separator2, tag4.len() - separator2); + tag5.assign(tag4.substr(separator2 + 1, tag4.length() - separator2 + 1)); + tag4.erase(separator2, tag4.length() - separator2); } // prepare locations where we have to load from: list/parentname (if any) & list/clonename - astring swlist(tag1.c_str()); - tag2.cpy(swlist.cat(tag4)); + std::string swlist(tag1.c_str()); + tag2.assign(swlist.append(tag4)); if (has_parent) { - swlist.cpy(tag1); - tag3.cpy(swlist.cat(tag5)); + swlist.assign(tag1); + tag3.assign(swlist.append(tag5)); } } - if (tag5.chr(0, '%') != -1) + if (tag5.find_first_of('%') != -1) fatalerror("We do not support clones of clones!\n"); // try to load from the available location(s): @@ -1112,7 +1112,7 @@ int open_disk_image(emu_options &options, const game_driver *gamedrv, const rom_ // only for CHD we also try to load from list/ if ((filerr != FILERR_NONE) && (tag1.c_str() != NULL)) { - tag1.del(tag1.len() - 1, 1); // remove the PATH_SEPARATOR + tag1.erase(tag1.length() - 1, 1); // remove the PATH_SEPARATOR filerr = common_process_file(options, tag1.c_str(), ".chd", romp, image_file); } } @@ -1121,7 +1121,7 @@ int open_disk_image(emu_options &options, const game_driver *gamedrv, const rom_ /* did the file open succeed? */ if (filerr == FILERR_NONE) { - astring fullpath(image_file.fullpath()); + std::string fullpath(image_file.fullpath()); image_file.close(); /* try to open the CHD */ @@ -1159,7 +1159,7 @@ int open_disk_image(emu_options &options, const game_driver *gamedrv, const rom_ /* did the file open succeed? */ if (filerr == FILERR_NONE) { - astring fullpath(image_file.fullpath()); + std::string fullpath(image_file.fullpath()); image_file.close(); /* try to open the CHD */ @@ -1179,7 +1179,7 @@ int open_disk_image(emu_options &options, const game_driver *gamedrv, const rom_ static chd_error open_disk_diff(emu_options &options, const rom_entry *romp, chd_file &source, chd_file &diff_chd) { - astring fname = astring(ROM_GETNAME(romp)).cat(".dif"); + std::string fname = std::string(ROM_GETNAME(romp)).append(".dif"); /* try to open the diff */ LOG(("Opening differencing image file: %s\n", fname.c_str())); @@ -1187,7 +1187,7 @@ static chd_error open_disk_diff(emu_options &options, const rom_entry *romp, chd file_error filerr = diff_file.open(fname.c_str()); if (filerr == FILERR_NONE) { - astring fullpath(diff_file.fullpath()); + std::string fullpath(diff_file.fullpath()); diff_file.close(); LOG(("Opening differencing image file: %s\n", fullpath.c_str())); @@ -1200,7 +1200,7 @@ static chd_error open_disk_diff(emu_options &options, const rom_entry *romp, chd filerr = diff_file.open(fname.c_str()); if (filerr == FILERR_NONE) { - astring fullpath(diff_file.fullpath()); + std::string fullpath(diff_file.fullpath()); diff_file.close(); /* create the CHD */ @@ -1236,14 +1236,14 @@ static void process_disk_entries(romload_private *romdata, const char *regiontag chd_error err; /* make the filename of the source */ - astring filename = astring(ROM_GETNAME(romp)).cat(".chd"); + std::string filename = std::string(ROM_GETNAME(romp)).append(".chd"); /* first open the source drive */ LOG(("Opening disk image: %s\n", filename.c_str())); err = chd_error(open_disk_image(romdata->machine().options(), &romdata->machine().system(), romp, chd->orig_chd(), locationtag)); if (err != CHDERR_NONE) { - handle_missing_file(romdata, romp, astring(), err); + handle_missing_file(romdata, romp, std::string(), err); global_free(chd); continue; } @@ -1255,13 +1255,13 @@ static void process_disk_entries(romload_private *romdata, const char *regiontag /* verify the hash */ if (hashes != acthashes) { - romdata->errorstring.catprintf("%s WRONG CHECKSUMS:\n", filename.c_str()); + strcatprintf(romdata->errorstring, "%s WRONG CHECKSUMS:\n", filename.c_str()); dump_wrong_and_correct_checksums(romdata, hashes, acthashes); romdata->warnings++; } else if (hashes.flag(hash_collection::FLAG_BAD_DUMP)) { - romdata->errorstring.catprintf("%s CHD NEEDS REDUMP\n", filename.c_str()); + strcatprintf(romdata->errorstring, "%s CHD NEEDS REDUMP\n", filename.c_str()); romdata->knownbad++; } @@ -1272,7 +1272,7 @@ static void process_disk_entries(romload_private *romdata, const char *regiontag err = open_disk_diff(romdata->machine().options(), romp, chd->orig_chd(), chd->diff_chd()); if (err != CHDERR_NONE) { - romdata->errorstring.catprintf("%s DIFF CHD ERROR: %s\n", filename.c_str(), chd_file::error_string(err)); + strcatprintf(romdata->errorstring, "%s DIFF CHD ERROR: %s\n", filename.c_str(), chd_file::error_string(err)); romdata->errors++; global_free(chd); continue; @@ -1335,13 +1335,13 @@ static void normalize_flags_for_device(running_machine &machine, const char *rgn void load_software_part_region(device_t &device, software_list_device &swlist, const char *swname, const rom_entry *start_region) { - astring locationtag(swlist.list_name()), breakstr("%"); + std::string locationtag(swlist.list_name()), breakstr("%"); romload_private *romdata = device.machine().romload_data; const rom_entry *region; std::string regiontag; - romdata->errorstring.reset(); - romdata->softwarningstring.reset(); + romdata->errorstring.clear(); + romdata->softwarningstring.clear(); romdata->romstotal = 0; romdata->romstotalsize = 0; @@ -1353,29 +1353,29 @@ void load_software_part_region(device_t &device, software_list_device &swlist, c UINT32 supported = swinfo->supported(); if (supported == SOFTWARE_SUPPORTED_PARTIAL) { - romdata->errorstring.catprintf("WARNING: support for software %s (in list %s) is only partial\n", swname, swlist.list_name()); - romdata->softwarningstring.catprintf("Support for software %s (in list %s) is only partial\n", swname, swlist.list_name()); + strcatprintf(romdata->errorstring, "WARNING: support for software %s (in list %s) is only partial\n", swname, swlist.list_name()); + strcatprintf(romdata->softwarningstring, "Support for software %s (in list %s) is only partial\n", swname, swlist.list_name()); } if (supported == SOFTWARE_SUPPORTED_NO) { - romdata->errorstring.catprintf("WARNING: support for software %s (in list %s) is only preliminary\n", swname, swlist.list_name()); - romdata->softwarningstring.catprintf("Support for software %s (in list %s) is only preliminary\n", swname, swlist.list_name()); + strcatprintf(romdata->errorstring, "WARNING: support for software %s (in list %s) is only preliminary\n", swname, swlist.list_name()); + strcatprintf(romdata->softwarningstring, "Support for software %s (in list %s) is only preliminary\n", swname, swlist.list_name()); } - // attempt reading up the chain through the parents and create a locationtag astring in the format + // attempt reading up the chain through the parents and create a locationtag std::string in the format // " swlist % clonename % parentname " // open_rom_file contains the code to split the elements and to create paths to load from - locationtag.cat(breakstr); + locationtag.append(breakstr); while (swinfo != NULL) { - locationtag.cat(swinfo->shortname()).cat(breakstr); + locationtag.append(swinfo->shortname()).append(breakstr); const char *parentname = swinfo->parentname(); swinfo = (parentname != NULL) ? swlist.find(parentname) : NULL; } // strip the final '%' - locationtag.del(locationtag.len() - 1, 1); + locationtag.erase(locationtag.length() - 1, 1); } @@ -1542,7 +1542,7 @@ void rom_init(running_machine &machine) for (device_t *device = deviter.first(); device != NULL; device = deviter.next()) { if (device->rom_region()) { const char *specbios; - astring temp; + std::string temp; if (strcmp(device->tag(),":")==0) { specbios = romdata->machine().options().bios(); } else { @@ -1594,7 +1594,7 @@ int rom_load_warnings(running_machine &machine) software load warnings we generated -------------------------------------------------*/ -astring& software_load_warnings_message(running_machine &machine) +std::string& software_load_warnings_message(running_machine &machine) { return machine.romload_data->softwarningstring; } diff --git a/src/emu/romload.h b/src/emu/romload.h index a533bc12120..d5dd211cccf 100644 --- a/src/emu/romload.h +++ b/src/emu/romload.h @@ -268,7 +268,7 @@ void rom_init(running_machine &machine); /* return the number of warnings we generated */ int rom_load_warnings(running_machine &machine); -astring& software_load_warnings_message(running_machine &machine); +std::string& software_load_warnings_message(running_machine &machine); /* return the number of BAD_DUMP/NO_DUMP warnings we generated */ int rom_load_knownbad(running_machine &machine); diff --git a/src/emu/save.c b/src/emu/save.c index 03f0859ef6a..3efeea2856d 100644 --- a/src/emu/save.c +++ b/src/emu/save.c @@ -162,23 +162,23 @@ void save_manager::save_memory(device_t *device, const char *module, const char } // create the full name - astring totalname; + std::string totalname; if (tag != NULL) - totalname.printf("%s/%s/%X/%s", module, tag, index, name); + strprintf(totalname, "%s/%s/%X/%s", module, tag, index, name); else - totalname.printf("%s/%X/%s", module, index, name); + strprintf(totalname, "%s/%X/%s", module, index, name); // look for duplicates and an entry to insert in front of state_entry *insert_after = NULL; for (state_entry *entry = m_entry_list.first(); entry != NULL; entry = entry->next()) { // stop when we find an entry whose name is after ours - if (entry->m_name.cmp(totalname)>0) + if (entry->m_name.compare(totalname)>0) break; insert_after = entry; // error if we are equal - if (entry->m_name.cmp(totalname)==0) + if (entry->m_name.compare(totalname)==0) fatalerror("Duplicate save state registration entry (%s)\n", totalname.c_str()); } @@ -333,7 +333,7 @@ UINT32 save_manager::signature() const for (state_entry *entry = m_entry_list.first(); entry != NULL; entry = entry->next()) { // add the entry name to the CRC - crc = crc32(crc, (UINT8 *)entry->m_name.c_str(), entry->m_name.len()); + crc = crc32(crc, (UINT8 *)entry->m_name.c_str(), entry->m_name.length()); // add the type and size to the CRC UINT32 temp[2]; diff --git a/src/emu/save.h b/src/emu/save.h index 0c9553e1d5b..e541514b2ee 100644 --- a/src/emu/save.h +++ b/src/emu/save.h @@ -84,10 +84,10 @@ public: // state state_entry * m_next; // pointer to next entry void * m_data; // pointer to the memory to save/restore - astring m_name; // full name + std::string m_name; // full name device_t * m_device; // associated device, NULL if none - astring m_module; // module name - astring m_tag; // tag name + std::string m_module; // module name + std::string m_tag; // tag name int m_index; // index UINT8 m_typesize; // size of the raw data type UINT32 m_typecount; // number of items @@ -260,9 +260,9 @@ inline void save_manager::save_item(device_t *device, const char *module, const template<> inline void save_manager::save_item(device_t *device, const char *module, const char *tag, int index, attotime &value, const char *name) { - astring tempstr = astring(name).cat(".attoseconds"); + std::string tempstr = std::string(name).append(".attoseconds"); save_memory(device, module, tag, index, tempstr.c_str(), &value.attoseconds, sizeof(value.attoseconds)); - tempstr.cpy(name).cat(".seconds"); + tempstr.assign(name).append(".seconds"); save_memory(device, module, tag, index, tempstr.c_str(), &value.seconds, sizeof(value.seconds)); } diff --git a/src/emu/schedule.c b/src/emu/schedule.c index c4aa618caee..1695936fa26 100644 --- a/src/emu/schedule.c +++ b/src/emu/schedule.c @@ -239,7 +239,7 @@ void emu_timer::register_save() { // determine our instance number and name int index = 0; - astring name; + std::string name; // for non-device timers, it is an index based on the callback function name if (m_device == NULL) @@ -253,7 +253,7 @@ void emu_timer::register_save() // for device timers, it is an index based on the device and timer ID else { - name.printf("%s/%d", m_device->tag(), m_id); + strprintf(name,"%s/%d", m_device->tag(), m_id); for (emu_timer *curtimer = machine().scheduler().first_timer(); curtimer != NULL; curtimer = curtimer->next()) if (!curtimer->m_temporary && curtimer->m_device != NULL && curtimer->m_device == m_device && curtimer->m_id == m_id) index++; diff --git a/src/emu/screen.c b/src/emu/screen.c index 9648eef6069..0690695efd5 100644 --- a/src/emu/screen.c +++ b/src/emu/screen.c @@ -1046,11 +1046,11 @@ void screen_device::finalize_burnin() void screen_device::load_effect_overlay(const char *filename) { // ensure that there is a .png extension - astring fullname(filename); - int extension = fullname.rchr(0, '.'); + std::string fullname(filename); + int extension = fullname.find_last_of('.'); if (extension != -1) - fullname.del(extension, -1); - fullname.cat(".png"); + fullname.erase(extension, -1); + fullname.append(".png"); // load the file emu_file file(machine().options().art_path(), OPEN_FLAG_READ); diff --git a/src/emu/softlist.c b/src/emu/softlist.c index 1528304339d..ed41ca05560 100644 --- a/src/emu/softlist.c +++ b/src/emu/softlist.c @@ -30,7 +30,7 @@ class softlist_parser { public: // construction (== execution) - softlist_parser(software_list_device &list, astring &errors); + softlist_parser(software_list_device &list, std::string &errors); private: enum parse_position @@ -76,11 +76,11 @@ private: // internal parsing state software_list_device & m_list; - astring & m_errors; + std::string & m_errors; XML_Parser m_parser; bool m_done; bool m_data_accum_expected; - astring m_data_accum; + std::string m_data_accum; software_info * m_current_info; software_part * m_current_part; parse_position m_pos; @@ -149,14 +149,14 @@ bool software_part::is_compatible(const software_list_device &swlistdev) const return true; // copy the comma-delimited strings and ensure they end with a final comma - astring comp = astring(compatibility).cat(","); - astring filt = astring(filter).cat(","); + std::string comp = std::string(compatibility).append(","); + std::string filt = std::string(filter).append(","); // iterate over filter items and see if they exist in the compatibility list; if so, return true - for (int start = 0, end = filt.chr(start, ','); end != -1; start = end + 1, end = filt.chr(start, ',')) + for (int start = 0, end = filt.find_first_of(',',start); end != -1; start = end + 1, end = filt.find_first_of(',', start)) { - astring token(filt, start, end - start + 1); - if (comp.find(0, token.c_str()) != -1) + std::string token(filt, start, end - start + 1); + if (comp.find(token.c_str()) != -1) return true; } return false; @@ -175,11 +175,11 @@ bool software_part::matches_interface(const char *interface_list) const return true; // copy the comma-delimited interface list and ensure it ends with a final comma - astring interfaces = astring(interface_list).cat(","); + std::string interfaces = std::string(interface_list).append(","); // then add a comma to the end of our interface and return true if we find it in the list string - astring our_interface = astring(m_interface).cat(","); - return (interfaces.find(0, our_interface.c_str()) != -1); + std::string our_interface = std::string(m_interface).append(","); + return (interfaces.find(our_interface.c_str()) != -1); } @@ -290,7 +290,7 @@ software_list_device::software_list_device(const machine_config &mconfig, const void software_list_device::static_set_type(device_t &device, const char *list, softlist_type list_type) { software_list_device &swlistdev = downcast<software_list_device &>(device); - swlistdev.m_list_name.cpy(list); + swlistdev.m_list_name.assign(list); swlistdev.m_list_type = list_type; } @@ -376,7 +376,7 @@ void software_list_device::release() osd_printf_verbose("Resetting %s\n", m_file.filename()); m_parsed = false; m_description = NULL; - m_errors.reset(); + m_errors.clear(); m_infolist.reset(); m_stringpool.reset(); } @@ -473,7 +473,7 @@ void software_list_device::parse() return; // reset the errors - m_errors.reset(); + m_errors.clear(); // attempt to open the file file_error filerr = m_file.open(m_list_name.c_str(), ".xml"); @@ -484,7 +484,7 @@ void software_list_device::parse() m_file.close(); } else - m_errors.printf("Error opening file: %s\n", filename()); + strprintf(m_errors, "Error opening file: %s\n", filename()); // indicate that we've been parsed m_parsed = true; @@ -500,7 +500,7 @@ void software_list_device::device_validity_check(validity_checker &valid) const { // add to the global map whenever we check a list so we don't re-check // it in the future - if (valid.already_checked(astring("softlist/").cat(m_list_name.c_str()).c_str())) + if (valid.already_checked(std::string("softlist/").append(m_list_name.c_str()).c_str())) return; // do device validation only in case of validate command @@ -526,7 +526,7 @@ void software_list_device::internal_validity_check(validity_checker &valid) for (software_info *swinfo = first_software_info(); swinfo != NULL; swinfo = swinfo->next()) { // first parse and output core errors if any - if (m_errors.len() > 0) + if (m_errors.length() > 0) { osd_printf_error("%s: Errors parsing software list:\n%s", filename(), errors_string()); break; @@ -565,7 +565,8 @@ void software_list_device::internal_validity_check(validity_checker &valid) } // check for duplicate descriptions - if (descriptions.add(astring(swinfo->longname()).makelower().c_str(), swinfo, false) == TMERR_DUPLICATE) + std::string longname = std::string(swinfo->longname()); + if (descriptions.add(strmakelower(longname).c_str(), swinfo, false) == TMERR_DUPLICATE) osd_printf_error("%s: %s is a duplicate description (%s)\n", filename(), swinfo->longname(), swinfo->shortname()); bool is_clone = false; @@ -645,7 +646,7 @@ void software_list_device::internal_validity_check(validity_checker &valid) // softlist_parser - constructor //------------------------------------------------- -softlist_parser::softlist_parser(software_list_device &list, astring &errors) +softlist_parser::softlist_parser(software_list_device &list, std::string &errors) : m_list(list), m_errors(errors), m_done(false), @@ -724,16 +725,16 @@ void softlist_parser::expat_free(void *ptr) void ATTR_PRINTF(2,3) softlist_parser::parse_error(const char *fmt, ...) { // always start with filename(line.column): - m_errors.catprintf("%s(%d.%d): ", filename(), line(), column()); + strcatprintf(m_errors, "%s(%d.%d): ", filename(), line(), column()); // append the remainder of the string va_list va; va_start(va, fmt); - m_errors.catvprintf(fmt, va); + strcatvprintf(m_errors, fmt, va); va_end(va); // append a newline at the end - m_errors.cat("\n"); + m_errors.append("\n"); } @@ -867,7 +868,7 @@ void softlist_parser::end_handler(void *data, const char *name) // stop accumulating state->m_data_accum_expected = false; - state->m_data_accum.reset(); + state->m_data_accum.clear(); } @@ -879,9 +880,9 @@ void softlist_parser::data_handler(void *data, const XML_Char *s, int len) { softlist_parser *state = reinterpret_cast<softlist_parser *>(data); - // if we have an astring to accumulate data in, do it + // if we have an std::string to accumulate data in, do it if (state->m_data_accum_expected) - state->m_data_accum.cat(s, len); + state->m_data_accum.append(s, len); // otherwise, report an error if the data is non-blank else @@ -1146,17 +1147,17 @@ void softlist_parser::parse_data_start(const char *tagname, const char **attribu bool baddump = (status != NULL && strcmp(status, "baddump") == 0); bool nodump = (status != NULL && strcmp(status, "nodump") == 0); - astring hashdata; + std::string hashdata; if (nodump) { - hashdata.printf("%s", NO_DUMP); + strprintf(hashdata, "%s", NO_DUMP); if (crc != NULL && sha1 != NULL) parse_error("No need for hash definition"); } else { if (crc != NULL && sha1 != NULL) - hashdata.printf("%c%s%c%s%s", hash_collection::HASH_CRC, crc, hash_collection::HASH_SHA1, sha1, (baddump ? BAD_DUMP : "")); + strprintf(hashdata, "%c%s%c%s%s", hash_collection::HASH_CRC, crc, hash_collection::HASH_SHA1, sha1, (baddump ? BAD_DUMP : "")); else parse_error("Incomplete rom hash definition"); } @@ -1199,8 +1200,8 @@ void softlist_parser::parse_data_start(const char *tagname, const char **attribu bool baddump = (status != NULL && strcmp(status, "baddump") == 0); bool nodump = (status != NULL && strcmp(status, "nodump" ) == 0); bool writeable = (writeablestr != NULL && strcmp(writeablestr, "yes") == 0); - astring hashdata; - hashdata.printf( "%c%s%s", hash_collection::HASH_SHA1, sha1, (nodump ? NO_DUMP : (baddump ? BAD_DUMP : ""))); + std::string hashdata; + strprintf(hashdata, "%c%s%s", hash_collection::HASH_SHA1, sha1, (nodump ? NO_DUMP : (baddump ? BAD_DUMP : ""))); add_rom_entry(name, hashdata.c_str(), 0, 0, ROMENTRYTYPE_ROM | (writeable ? DISK_READWRITE : DISK_READONLY)); } diff --git a/src/emu/softlist.h b/src/emu/softlist.h index 7e6abc19246..77ed72437b2 100644 --- a/src/emu/softlist.h +++ b/src/emu/softlist.h @@ -227,7 +227,7 @@ protected: virtual void device_validity_check(validity_checker &valid) const ATTR_COLD; // configuration state - astring m_list_name; + std::string m_list_name; softlist_type m_list_type; const char * m_filter; @@ -235,7 +235,7 @@ protected: bool m_parsed; emu_file m_file; const char * m_description; - astring m_errors; + std::string m_errors; simple_list<software_info> m_infolist; const_string_pool m_stringpool; }; diff --git a/src/emu/sound.c b/src/emu/sound.c index 02211325158..b4179336582 100644 --- a/src/emu/sound.c +++ b/src/emu/sound.c @@ -75,8 +75,8 @@ sound_stream::sound_stream(device_t &device, int inputs, int outputs, int sample m_callback = stream_update_delegate(FUNC(device_sound_interface::sound_stream_update),(device_sound_interface *)sound); // create a unique tag for saving - astring state_tag; - state_tag.printf("%d", m_device.machine().sound().m_stream_list.count()); + std::string state_tag; + strprintf(state_tag, "%d", m_device.machine().sound().m_stream_list.count()); m_device.machine().save().save_item(&m_device, "stream", state_tag.c_str(), 0, NAME(m_sample_rate)); m_device.machine().save().register_postload(save_prepost_delegate(FUNC(sound_stream::postload), this)); @@ -163,17 +163,17 @@ float sound_stream::output_gain(int outputnum) const // on a given stream's input //------------------------------------------------- -const char *sound_stream::input_name(int inputnum, astring &str) const +const char *sound_stream::input_name(int inputnum, std::string &str) const { // start with our device name and tag assert(inputnum >= 0 && inputnum < m_input.size()); - str.printf("%s '%s': ", m_device.name(), m_device.tag()); + strprintf(str, "%s '%s': ", m_device.name(), m_device.tag()); // if we have a source, indicate where the sound comes from by device name and tag if (m_input[inputnum].m_source != NULL && m_input[inputnum].m_source->m_stream != NULL) { device_t &source = m_input[inputnum].m_source->m_stream->device(); - str.catprintf("%s '%s'", source.name(), source.tag()); + strcatprintf(str, "%s '%s'", source.name(), source.tag()); // get the sound interface; if there is more than 1 output we need to figure out which one device_sound_interface *sound; @@ -186,7 +186,7 @@ const char *sound_stream::input_name(int inputnum, astring &str) const for (int outputnum = 0; (outstream = sound->output_to_stream_output(outputnum, streamoutputnum)) != NULL; outputnum++) if (outstream == m_input[inputnum].m_source->m_stream && m_input[inputnum].m_source == &outstream->m_output[streamoutputnum]) { - str.catprintf(" Ch.%d", outputnum); + strcatprintf(str, " Ch.%d", outputnum); break; } } diff --git a/src/emu/sound.h b/src/emu/sound.h index f025f70787d..557d4242fa6 100644 --- a/src/emu/sound.h +++ b/src/emu/sound.h @@ -106,7 +106,7 @@ public: attotime sample_period() const { return attotime(0, m_attoseconds_per_sample); } int input_count() const { return m_input.size(); } int output_count() const { return m_output.size(); } - const char *input_name(int inputnum, astring &str) const; + const char *input_name(int inputnum, std::string &str) const; device_t *input_source_device(int inputnum) const; int input_source_outputnum(int inputnum) const; float user_gain(int inputnum) const; diff --git a/src/emu/tilemap.c b/src/emu/tilemap.c index 4d1ec2cba5f..6f61210355b 100644 --- a/src/emu/tilemap.c +++ b/src/emu/tilemap.c @@ -1787,7 +1787,7 @@ void tilemap_device::device_start() m_basemem.set(*share, m_bytes_per_entry); // look for an extension entry - astring tag_ext = astring(tag()).cat("_ext"); + std::string tag_ext = std::string(tag()).append("_ext"); share = memshare(tag_ext.c_str()); if (share != NULL) m_extmem.set(*share, m_bytes_per_entry); diff --git a/src/emu/ui/barcode.c b/src/emu/ui/barcode.c index ee556b305f2..ef26c6244a4 100644 --- a/src/emu/ui/barcode.c +++ b/src/emu/ui/barcode.c @@ -52,7 +52,7 @@ void ui_menu_barcode_reader::populate() { if (current_device()) { - astring buffer; + std::string buffer; const char *new_barcode; // selected device @@ -61,7 +61,7 @@ void ui_menu_barcode_reader::populate() // append the "New Barcode" item if (get_selection() == ITEMREF_NEW_BARCODE) { - buffer.cat(m_barcode_buffer); + buffer.append(m_barcode_buffer); new_barcode = buffer.c_str(); } else @@ -112,13 +112,13 @@ void ui_menu_barcode_reader::handle() case IPT_UI_SELECT: if (event->itemref == ITEMREF_ENTER_BARCODE) { - astring tmp_file(m_barcode_buffer); + std::string tmp_file(m_barcode_buffer); //printf("code %s\n", m_barcode_buffer); - if (!current_device()->is_valid(tmp_file.len())) + if (!current_device()->is_valid(tmp_file.length())) machine().ui().popup_time(5, "Barcode length invalid!"); else { - current_device()->write_code(tmp_file.c_str(), tmp_file.len()); + current_device()->write_code(tmp_file.c_str(), tmp_file.length()); // if sending was successful, reset char buffer if (m_barcode_buffer[0] != '\0') memset(m_barcode_buffer, '\0', ARRAY_LENGTH(m_barcode_buffer)); diff --git a/src/emu/ui/cheatopt.c b/src/emu/ui/cheatopt.c index b14ae03a963..4932fc23133 100644 --- a/src/emu/ui/cheatopt.c +++ b/src/emu/ui/cheatopt.c @@ -109,8 +109,8 @@ ui_menu_cheat::ui_menu_cheat(running_machine &machine, render_container *contain void ui_menu_cheat::populate() { /* iterate over cheats */ - astring text; - astring subtext; + std::string text; + std::string subtext; for (cheat_entry *curcheat = machine().cheat().first(); curcheat != NULL; curcheat = curcheat->next()) { UINT32 flags; diff --git a/src/emu/ui/devctrl.h b/src/emu/ui/devctrl.h index 81fe091315b..b5b008e4baa 100644 --- a/src/emu/ui/devctrl.h +++ b/src/emu/ui/devctrl.h @@ -37,7 +37,7 @@ protected: int current_index(); void previous(); void next(); - astring current_display_name(); + std::string current_display_name(); UINT32 current_display_flags(); private: @@ -122,15 +122,15 @@ void ui_menu_device_control<_DeviceType>::next() //------------------------------------------------- template<class _DeviceType> -astring ui_menu_device_control<_DeviceType>::current_display_name() +std::string ui_menu_device_control<_DeviceType>::current_display_name() { - astring display_name; - display_name.cpy(current_device()->name()); + std::string display_name; + display_name.assign(current_device()->name()); if (count() > 1) { - astring temp; - temp.printf(" %d", current_index() + 1); - display_name.cat(temp); + std::string temp; + strprintf(temp, " %d", current_index() + 1); + display_name.append(temp); } return display_name; } diff --git a/src/emu/ui/devopt.c b/src/emu/ui/devopt.c index c1e26ed9049..c009dc539db 100644 --- a/src/emu/ui/devopt.c +++ b/src/emu/ui/devopt.c @@ -20,8 +20,8 @@ ui_menu_device_config::ui_menu_device_config(running_machine &machine, render_container *container, device_slot_interface *slot, device_slot_option *option) : ui_menu(machine, container) { - astring tmp_tag; - tmp_tag.cpy(slot->device().tag()).cat(":").cat(option->name()); + std::string tmp_tag; + tmp_tag.assign(slot->device().tag()).append(":").append(option->name()); m_option = option; m_owner = slot; m_mounted = false; @@ -39,25 +39,25 @@ ui_menu_device_config::ui_menu_device_config(running_machine &machine, render_co void ui_menu_device_config::populate() { - astring str; + std::string str; device_t *dev; - str.printf("[This option is%s currently mounted in the running system]\n\n", m_mounted ? "" : " NOT"); - str.catprintf("Option: %s\n", m_option->name()); + strprintf(str,"[This option is%s currently mounted in the running system]\n\n", m_mounted ? "" : " NOT"); + strcatprintf(str,"Option: %s\n", m_option->name()); dev = const_cast<machine_config &>(machine().config()).device_add(&machine().config().root_device(), m_option->name(), m_option->devtype(), 0); - str.catprintf("Device: %s\n", dev->name()); + strcatprintf(str,"Device: %s\n", dev->name()); if (!m_mounted) - str.cat("\nIf you select this option, the following items will be enabled:\n"); + str.append("\nIf you select this option, the following items will be enabled:\n"); else - str.cat("\nThe selected option enables the following items:\n"); + str.append("\nThe selected option enables the following items:\n"); // loop over all CPUs execute_interface_iterator execiter(*dev); if (execiter.count() > 0) { - str.cat("* CPU:\n"); + str.append("* CPU:\n"); tagmap_t<UINT8> exectags; for (device_execute_interface *exec = execiter.first(); exec != NULL; exec = execiter.next()) { @@ -80,16 +80,16 @@ void ui_menu_device_config::populate() // if more than one, prepend a #x in front of the CPU name if (count > 1) - str.catprintf(" %d" UTF8_MULTIPLY, count); + strcatprintf(str," %d" UTF8_MULTIPLY, count); else - str.cat(" "); - str.cat(name); + str.append(" "); + str.append(name); // display clock in kHz or MHz if (clock >= 1000000) - str.catprintf(" %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000); + strcatprintf(str," %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000); else - str.catprintf(" %d.%03d" UTF8_NBSP "kHz\n", clock / 1000, clock % 1000); + strcatprintf(str," %d.%03d" UTF8_NBSP "kHz\n", clock / 1000, clock % 1000); } } @@ -97,18 +97,18 @@ void ui_menu_device_config::populate() screen_device_iterator scriter(*dev); if (scriter.count() > 0) { - str.cat("* Video:\n"); + str.append("* Video:\n"); for (screen_device *screen = scriter.first(); screen != NULL; screen = scriter.next()) { - str.catprintf(" Screen '%s': ", screen->tag()); + strcatprintf(str," Screen '%s': ", screen->tag()); if (screen->screen_type() == SCREEN_TYPE_VECTOR) - str.cat("Vector\n"); + str.append("Vector\n"); else { const rectangle &visarea = screen->visible_area(); - str.catprintf("%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz\n", + strcatprintf(str,"%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz\n", visarea.width(), visarea.height(), (machine().system().flags & ORIENTATION_SWAP_XY) ? "V" : "H", ATTOSECONDS_TO_HZ(screen->frame_period().attoseconds)); @@ -120,7 +120,7 @@ void ui_menu_device_config::populate() sound_interface_iterator snditer(*dev); if (snditer.count() > 0) { - str.cat("* Sound:\n"); + str.append("* Sound:\n"); tagmap_t<UINT8> soundtags; for (device_sound_interface *sound = snditer.first(); sound != NULL; sound = snditer.next()) { @@ -138,19 +138,19 @@ void ui_menu_device_config::populate() } // if more than one, prepend a #x in front of the CPU name if (count > 1) - str.catprintf(" %d" UTF8_MULTIPLY, count); + strcatprintf(str," %d" UTF8_MULTIPLY, count); else - str.cat(" "); - str.cat(sound->device().name()); + str.append(" "); + str.append(sound->device().name()); // display clock in kHz or MHz int clock = sound->device().clock(); if (clock >= 1000000) - str.catprintf(" %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000); + strcatprintf(str," %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000); else if (clock != 0) - str.catprintf(" %d.%03d" UTF8_NBSP "kHz\n", clock / 1000, clock % 1000); + strcatprintf(str," %d.%03d" UTF8_NBSP "kHz\n", clock / 1000, clock % 1000); else - str.cat("\n"); + str.append("\n"); } } @@ -176,12 +176,12 @@ void ui_menu_device_config::populate() } if (bios) - str.catprintf("* BIOS settings:\n %d options [default: %s]\n", bios, bios_str.c_str()); + strcatprintf(str,"* BIOS settings:\n %d options [default: %s]\n", bios, bios_str.c_str()); } int input = 0, input_mj = 0, input_hana = 0, input_gamble = 0, input_analog = 0, input_adjust = 0; int input_keypad = 0, input_keyboard = 0, dips = 0, confs = 0; - astring errors, dips_opt, confs_opt; + std::string errors, dips_opt, confs_opt; ioport_list portlist; device_iterator iptiter(*dev); for (device_t *iptdev = iptiter.first(); iptdev != NULL; iptdev = iptiter.next()) @@ -210,12 +210,12 @@ void ui_menu_device_config::populate() else if (field->type() == IPT_DIPSWITCH) { dips++; - dips_opt.cat(" ").cat(field->name()); + dips_opt.append(" ").append(field->name()); for (ioport_setting *setting = field->first_setting(); setting != NULL; setting = setting->next()) { if (setting->value() == field->defvalue()) { - dips_opt.catprintf(" [default: %s]\n", setting->name()); + strcatprintf(dips_opt, " [default: %s]\n", setting->name()); break; } } @@ -223,12 +223,12 @@ void ui_menu_device_config::populate() else if (field->type() == IPT_CONFIG) { confs++; - confs_opt.cat(" ").cat(field->name()); + confs_opt.append(" ").append(field->name()); for (ioport_setting *setting = field->first_setting(); setting != NULL; setting = setting->next()) { if (setting->value() == field->defvalue()) { - confs_opt.catprintf(" [default: %s]\n", setting->name()); + strcatprintf(confs_opt," [default: %s]\n", setting->name()); break; } } @@ -236,47 +236,47 @@ void ui_menu_device_config::populate() } if (dips) - str.cat("* Dispwitch settings:\n").cat(dips_opt); + str.append("* Dispwitch settings:\n").append(dips_opt); if (confs) - str.cat("* Configuration settings:\n").cat(confs_opt); + str.append("* Configuration settings:\n").append(confs_opt); if (input + input_mj + input_hana + input_gamble + input_analog + input_adjust + input_keypad + input_keyboard) - str.cat("* Input device(s):\n"); + str.append("* Input device(s):\n"); if (input) - str.catprintf(" User inputs [%d inputs]\n", input); + strcatprintf(str," User inputs [%d inputs]\n", input); if (input_mj) - str.catprintf(" Mahjong inputs [%d inputs]\n", input_mj); + strcatprintf(str," Mahjong inputs [%d inputs]\n", input_mj); if (input_hana) - str.catprintf(" Hanafuda inputs [%d inputs]\n", input_hana); + strcatprintf(str," Hanafuda inputs [%d inputs]\n", input_hana); if (input_gamble) - str.catprintf(" Gambling inputs [%d inputs]\n", input_gamble); + strcatprintf(str," Gambling inputs [%d inputs]\n", input_gamble); if (input_analog) - str.catprintf(" Analog inputs [%d inputs]\n", input_analog); + strcatprintf(str," Analog inputs [%d inputs]\n", input_analog); if (input_adjust) - str.catprintf(" Adjuster inputs [%d inputs]\n", input_adjust); + strcatprintf(str," Adjuster inputs [%d inputs]\n", input_adjust); if (input_keypad) - str.catprintf(" Keypad inputs [%d inputs]\n", input_keypad); + strcatprintf(str," Keypad inputs [%d inputs]\n", input_keypad); if (input_keyboard) - str.catprintf(" Keyboard inputs [%d inputs]\n", input_keyboard); + strcatprintf(str," Keyboard inputs [%d inputs]\n", input_keyboard); image_interface_iterator imgiter(*dev); if (imgiter.count() > 0) { - str.cat("* Media Options:\n"); + str.append("* Media Options:\n"); for (const device_image_interface *imagedev = imgiter.first(); imagedev != NULL; imagedev = imgiter.next()) - str.catprintf(" %s [tag: %s]\n", imagedev->image_type_name(), imagedev->device().tag()); + strcatprintf(str," %s [tag: %s]\n", imagedev->image_type_name(), imagedev->device().tag()); } slot_interface_iterator slotiter(*dev); if (slotiter.count() > 0) { - str.cat("* Slot Options:\n"); + str.append("* Slot Options:\n"); for (const device_slot_interface *slot = slotiter.first(); slot != NULL; slot = slotiter.next()) - str.catprintf(" %s [default: %s]\n", slot->device().tag(), slot->default_option() ? slot->default_option() : "----"); + strcatprintf(str," %s [default: %s]\n", slot->device().tag(), slot->default_option() ? slot->default_option() : "----"); } if ((execiter.count() + scriter.count() + snditer.count() + imgiter.count() + slotiter.count() + bios + dips + confs + input + input_mj + input_hana + input_gamble + input_analog + input_adjust + input_keypad + input_keyboard) == 0) - str.cat("[None]\n"); + str.append("[None]\n"); const_cast<machine_config &>(machine().config()).device_remove(&machine().config().root_device(), m_option->name()); item_append(str.c_str(), NULL, MENU_FLAG_MULTILINE, NULL); diff --git a/src/emu/ui/filemngr.c b/src/emu/ui/filemngr.c index 55da5ba86bf..578721b233b 100644 --- a/src/emu/ui/filemngr.c +++ b/src/emu/ui/filemngr.c @@ -30,9 +30,9 @@ ui_menu_file_manager::ui_menu_file_manager(running_machine &machine, render_cont // This warning string is used when accessing from the force_file_manager call, i.e. // when the file manager is loaded top front in the case of mandatory image devices if (warnings) - m_warnings.cpy(warnings); + m_warnings.assign(warnings); else - m_warnings.reset(); + m_warnings.clear(); m_curr_selected = FALSE; } @@ -62,15 +62,15 @@ void ui_menu_file_manager::custom_render(void *selectedref, float top, float bot } -void ui_menu_file_manager::fill_image_line(device_image_interface *img, astring &instance, astring &filename) +void ui_menu_file_manager::fill_image_line(device_image_interface *img, std::string &instance, std::string &filename) { // get the image type/id - instance.printf("%s (%s)", img->instance_name(), img->brief_instance_name()); + strprintf(instance,"%s (%s)", img->instance_name(), img->brief_instance_name()); // get the base name if (img->basename() != NULL) { - filename.cpy(img->basename()); + filename.assign(img->basename()); // if the image has been loaded through softlist, also show the loaded part if (img->part_entry() != NULL) @@ -78,20 +78,20 @@ void ui_menu_file_manager::fill_image_line(device_image_interface *img, astring const software_part *tmp = img->part_entry(); if (tmp->name() != NULL) { - filename.cat(" ("); - filename.cat(tmp->name()); + filename.append(" ("); + filename.append(tmp->name()); // also check if this part has a specific part_id (e.g. "Map Disc", "Bonus Disc", etc.), and in case display it if (img->get_feature("part_id") != NULL) { - filename.cat(": "); - filename.cat(img->get_feature("part_id")); + filename.append(": "); + filename.append(img->get_feature("part_id")); } - filename.cat(")"); + filename.append(")"); } } } else - filename.cpy("---"); + filename.assign("---"); } //------------------------------------------------- @@ -100,9 +100,9 @@ void ui_menu_file_manager::fill_image_line(device_image_interface *img, astring void ui_menu_file_manager::populate() { - astring buffer, tmp_inst, tmp_name; + std::string buffer, tmp_inst, tmp_name; bool first_entry = true; - astring prev_owner; + std::string prev_owner; if (!m_warnings.empty()) { @@ -138,7 +138,7 @@ void ui_menu_file_manager::populate() first_entry = false; else item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); - buffer.printf("[root%s]", dev->tag()); + strprintf(buffer, "[root%s]", dev->tag()); item_append(buffer.c_str(), NULL, 0, NULL); tag_appended = true; } diff --git a/src/emu/ui/filemngr.h b/src/emu/ui/filemngr.h index a2d7fbca74f..dbc4c72e50d 100644 --- a/src/emu/ui/filemngr.h +++ b/src/emu/ui/filemngr.h @@ -16,8 +16,8 @@ class ui_menu_file_manager : public ui_menu { public: - astring current_directory; - astring current_file; + std::string current_directory; + std::string current_file; device_image_interface *selected_device; static void force_file_manager(running_machine &machine, render_container *container, const char *warnings); @@ -28,10 +28,10 @@ public: virtual void handle(); virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2); - void fill_image_line(device_image_interface *img, astring &instance, astring &filename); + void fill_image_line(device_image_interface *img, std::string &instance, std::string &filename); private: - astring m_warnings; + std::string m_warnings; bool m_curr_selected; }; diff --git a/src/emu/ui/info.c b/src/emu/ui/info.c index 8ff2c7d50fb..caee68b8bce 100644 --- a/src/emu/ui/info.c +++ b/src/emu/ui/info.c @@ -29,7 +29,7 @@ ui_menu_game_info::~ui_menu_game_info() void ui_menu_game_info::populate() { - astring tempstring; + std::string tempstring; item_append(machine().ui().game_info_astring(tempstring).c_str(), NULL, MENU_FLAG_MULTILINE, NULL); } @@ -85,13 +85,13 @@ void ui_menu_image_info::image_info(device_image_interface *image) // if image has been loaded through softlist, let's add some more info if (image->software_entry()) { - astring str; + std::string str; // display long filename item_append(image->longname(), "", MENU_FLAG_DISABLE, NULL); // display manufacturer and year - str.catprintf("%s, %s", image->manufacturer(), image->year()); + strcatprintf(str, "%s, %s", image->manufacturer(), image->year()); item_append(str.c_str(), "", MENU_FLAG_DISABLE, NULL); // display supported information, if available diff --git a/src/emu/ui/inputmap.c b/src/emu/ui/inputmap.c index 06f1fa748d0..129d933ae92 100644 --- a/src/emu/ui/inputmap.c +++ b/src/emu/ui/inputmap.c @@ -92,7 +92,7 @@ void ui_menu_input_general::populate() { input_item_data *itemlist = NULL; int suborder[SEQ_TYPE_TOTAL]; - astring tempstring; + std::string tempstring; int sortorder = 1; /* create a mini lookup table for sort order based on sequence type */ @@ -155,7 +155,7 @@ void ui_menu_input_specific::populate() { input_item_data *itemlist = NULL; int suborder[SEQ_TYPE_TOTAL]; - astring tempstring; + std::string tempstring; int port_count = 0; /* create a mini lookup table for sort order based on sequence type */ @@ -382,9 +382,9 @@ void ui_menu_input::populate_and_sort(input_item_data *itemlist) const char *nameformat[INPUT_TYPE_TOTAL] = { 0 }; input_item_data **itemarray, *item; int numitems = 0, curitem; - astring text; - astring subtext; - astring prev_owner; + std::string text; + std::string subtext; + std::string prev_owner; bool first_entry = true; /* create a mini lookup table for name format based on type */ @@ -420,17 +420,17 @@ void ui_menu_input::populate_and_sort(input_item_data *itemlist) first_entry = false; else item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); - text.printf("[root%s]", item->owner_name); + strprintf(text, "[root%s]", item->owner_name); item_append(text.c_str(), NULL, 0, NULL); - prev_owner.cpy(item->owner_name); + prev_owner.assign(item->owner_name); } - text.printf(nameformat[item->type], item->name); + strprintf(text, nameformat[item->type], item->name); /* if we're polling this item, use some spaces with left/right arrows */ if (pollingref == item->ref) { - subtext.cpy(" "); + subtext.assign(" "); flags |= MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW; } @@ -545,7 +545,7 @@ void ui_menu_settings::populate() ioport_field *field; ioport_port *port; dip_descriptor **diplist_tailptr; - astring prev_owner; + std::string prev_owner; bool first_entry = true; /* reset the dip switch tracking */ @@ -559,7 +559,7 @@ void ui_menu_settings::populate() if (field->type() == type && field->enabled()) { UINT32 flags = 0; - astring name; + std::string name; /* set the left/right flags appropriately */ if (field->has_previous_setting()) @@ -574,12 +574,12 @@ void ui_menu_settings::populate() first_entry = false; else item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); - name.printf("[root%s]", field->device().tag()); + strprintf(name, "[root%s]", field->device().tag()); item_append(name.c_str(), NULL, 0, NULL); - prev_owner.cpy(field->device().tag()); + prev_owner.assign(field->device().tag()); } - name.cpy(field->name()); + name.assign(field->name()); item_append(name.c_str(), field->setting_name(), flags, (void *)field); @@ -825,9 +825,9 @@ void ui_menu_analog::populate() { ioport_field *field; ioport_port *port; - astring text; - astring subtext; - astring prev_owner; + std::string text; + std::string subtext; + std::string prev_owner; bool first_entry = true; /* loop over input ports and add the items */ @@ -871,19 +871,19 @@ void ui_menu_analog::populate() { analog_item_data *data; UINT32 flags = 0; - astring name; + std::string name; if (strcmp(field->device().tag(), prev_owner.c_str()) != 0) { if (first_entry) first_entry = false; else item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); - name.printf("[root%s]", field->device().tag()); + strprintf(name,"[root%s]", field->device().tag()); item_append(name.c_str(), NULL, 0, NULL); - prev_owner.cpy(field->device().tag()); + prev_owner.assign(field->device().tag()); } - name.cpy(field->name()); + name.assign(field->name()); /* allocate a data item for tracking what this menu item refers to */ data = (analog_item_data *)m_pool_alloc(sizeof(*data)); @@ -895,8 +895,8 @@ void ui_menu_analog::populate() { default: case ANALOG_ITEM_KEYSPEED: - text.printf("%s Digital Speed", name.c_str()); - subtext.printf("%d", settings.delta); + strprintf(text, "%s Digital Speed", name.c_str()); + strprintf(subtext, "%d", settings.delta); data->min = 0; data->max = 255; data->cur = settings.delta; @@ -904,8 +904,8 @@ void ui_menu_analog::populate() break; case ANALOG_ITEM_CENTERSPEED: - text.printf("%s Autocenter Speed", name.c_str()); - subtext.printf("%d", settings.centerdelta); + strprintf(text, "%s Autocenter Speed", name.c_str()); + strprintf(subtext, "%d", settings.centerdelta); data->min = 0; data->max = 255; data->cur = settings.centerdelta; @@ -913,8 +913,8 @@ void ui_menu_analog::populate() break; case ANALOG_ITEM_REVERSE: - text.printf("%s Reverse", name.c_str()); - subtext.cpy(settings.reverse ? "On" : "Off"); + strprintf(text, "%s Reverse", name.c_str()); + subtext.assign(settings.reverse ? "On" : "Off"); data->min = 0; data->max = 1; data->cur = settings.reverse; @@ -922,8 +922,8 @@ void ui_menu_analog::populate() break; case ANALOG_ITEM_SENSITIVITY: - text.printf("%s Sensitivity", name.c_str()); - subtext.printf("%d", settings.sensitivity); + strprintf(text, "%s Sensitivity", name.c_str()); + strprintf(subtext, "%d", settings.sensitivity); data->min = 1; data->max = 255; data->cur = settings.sensitivity; diff --git a/src/emu/ui/mainmenu.c b/src/emu/ui/mainmenu.c index be8ca14f9a3..9e122ba7a2b 100644 --- a/src/emu/ui/mainmenu.c +++ b/src/emu/ui/mainmenu.c @@ -50,12 +50,12 @@ ui_menu_main::ui_menu_main(running_machine &machine, render_container *container void ui_menu_main::populate() { - astring menu_text; + std::string menu_text; /* add input menu items */ item_append("Input (general)", NULL, 0, (void *)INPUT_GROUPS); - menu_text.printf("Input (this %s)",emulator_info::get_capstartgamenoun()); + strprintf(menu_text, "Input (this %s)", emulator_info::get_capstartgamenoun()); item_append(menu_text.c_str(), NULL, 0, (void *)INPUT_SPECIFIC); /* add optional input-related menus */ @@ -65,7 +65,7 @@ void ui_menu_main::populate() item_append("Dip Switches", NULL, 0, (void *)SETTINGS_DIP_SWITCHES); if (machine().ioport().has_configs()) { - menu_text.printf("%s Configuration",emulator_info::get_capstartgamenoun()); + strprintf(menu_text, "%s Configuration", emulator_info::get_capstartgamenoun()); item_append(menu_text.c_str(), NULL, 0, (void *)SETTINGS_DRIVER_CONFIG); } @@ -73,7 +73,7 @@ void ui_menu_main::populate() item_append("Bookkeeping Info", NULL, 0, (void *)BOOKKEEPING); /* add game info menu */ - menu_text.printf("%s Information",emulator_info::get_capstartgamenoun()); + strprintf(menu_text, "%s Information", emulator_info::get_capstartgamenoun()); item_append(menu_text.c_str(), NULL, 0, (void *)GAME_INFO); image_interface_iterator imgiter(machine().root_device()); @@ -134,7 +134,7 @@ void ui_menu_main::populate() item_append("Cheat", NULL, 0, (void *)CHEAT); /* add reset and exit menus */ - menu_text.printf("Select New %s",emulator_info::get_capstartgamenoun()); + strprintf(menu_text, "Select New %s", emulator_info::get_capstartgamenoun()); item_append(menu_text.c_str(), NULL, 0, (void *)SELECT_GAME); } diff --git a/src/emu/ui/menu.c b/src/emu/ui/menu.c index 1ae7c2d2145..906aa507087 100644 --- a/src/emu/ui/menu.c +++ b/src/emu/ui/menu.c @@ -180,8 +180,8 @@ void ui_menu::reset(ui_menu_reset_options options) numitems = 0; visitems = 0; selected = 0; - astring backtext; - backtext.printf("Return to %s",emulator_info::get_capstartgamenoun()); + std::string backtext; + strprintf(backtext, "Return to %s", emulator_info::get_capstartgamenoun()); // add an item to return if (parent == NULL) diff --git a/src/emu/ui/miscmenu.c b/src/emu/ui/miscmenu.c index 431261cee78..e06b8933de0 100644 --- a/src/emu/ui/miscmenu.c +++ b/src/emu/ui/miscmenu.c @@ -120,14 +120,14 @@ void ui_menu_bios_selection::handle() if (val>cnt) val=1; dev->set_system_bios(val); if (strcmp(dev->tag(),":")==0) { - astring error; + std::string error; machine().options().set_value("bios", val-1, OPTION_PRIORITY_CMDLINE, error); assert(error.empty()); } else { - astring error; - astring value; - astring temp; - value.printf("%s,bios=%d",machine().options().main_value(temp,dev->owner()->tag()+1),val-1); + std::string error; + std::string value; + std::string temp; + strprintf(value,"%s,bios=%d",machine().options().main_value(temp,dev->owner()->tag()+1),val-1); machine().options().set_value(dev->owner()->tag()+1, value.c_str(), OPTION_PRIORITY_CMDLINE, error); assert(error.empty()); } @@ -233,18 +233,18 @@ ui_menu_bookkeeping::~ui_menu_bookkeeping() void ui_menu_bookkeeping::populate() { int tickets = get_dispensed_tickets(machine()); - astring tempstring; + std::string tempstring; int ctrnum; /* show total time first */ if (prevtime.seconds >= 60 * 60) - tempstring.catprintf("Uptime: %d:%02d:%02d\n\n", prevtime.seconds / (60*60), (prevtime.seconds / 60) % 60, prevtime.seconds % 60); + strcatprintf(tempstring, "Uptime: %d:%02d:%02d\n\n", prevtime.seconds / (60 * 60), (prevtime.seconds / 60) % 60, prevtime.seconds % 60); else - tempstring.catprintf("Uptime: %d:%02d\n\n", (prevtime.seconds / 60) % 60, prevtime.seconds % 60); + strcatprintf(tempstring,"Uptime: %d:%02d\n\n", (prevtime.seconds / 60) % 60, prevtime.seconds % 60); /* show tickets at the top */ if (tickets > 0) - tempstring.catprintf("Tickets dispensed: %d\n\n", tickets); + strcatprintf(tempstring,"Tickets dispensed: %d\n\n", tickets); /* loop over coin counters */ for (ctrnum = 0; ctrnum < COIN_COUNTERS; ctrnum++) @@ -252,18 +252,18 @@ void ui_menu_bookkeeping::populate() int count = coin_counter_get_count(machine(), ctrnum); /* display the coin counter number */ - tempstring.catprintf("Coin %c: ", ctrnum + 'A'); + strcatprintf(tempstring,"Coin %c: ", ctrnum + 'A'); /* display how many coins */ if (count == 0) - tempstring.cat("NA"); + tempstring.append("NA"); else - tempstring.catprintf("%d", count); + strcatprintf(tempstring, "%d", count); /* display whether or not we are locked out */ if (coin_lockout_get_state(machine(), ctrnum)) - tempstring.cat(" (locked)"); - tempstring.cat("\n"); + tempstring.append(" (locked)"); + tempstring.append("\n"); } /* append the single item */ diff --git a/src/emu/ui/selgame.c b/src/emu/ui/selgame.c index 8a78d8a5c4f..45faeac207a 100644 --- a/src/emu/ui/selgame.c +++ b/src/emu/ui/selgame.c @@ -232,8 +232,8 @@ void ui_menu_select_game::populate() // if nothing there, add a single multiline item and return if (matchcount == 0) { - astring txt; - txt.printf("No %s found. Please check the rompath specified in the %s.ini file.\n\n" + std::string txt; + strprintf(txt, "No %s found. Please check the rompath specified in the %s.ini file.\n\n" "If this is your first time using %s, please see the config.txt file in " "the docs directory for information on configuring %s.", emulator_info::get_gamesnoun(), @@ -282,15 +282,15 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott const game_driver *driver; float width, maxwidth; float x1, y1, x2, y2; - astring tempbuf[5]; + std::string tempbuf[5]; rgb_t color; int line; // display the current typeahead if (m_search[0] != 0) - tempbuf[0].printf("Type name or select: %s_", m_search); + strprintf(tempbuf[0], "Type name or select: %s_", m_search); else - tempbuf[0].printf("Type name or select: (random)"); + strprintf(tempbuf[0],"Type name or select: (random)"); // get the size of the text machine().ui().draw_text_full(container, tempbuf[0].c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, @@ -324,21 +324,21 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott const char *gfxstat, *soundstat; // first line is game name - tempbuf[0].printf("%-.100s", driver->description); + strprintf(tempbuf[0],"%-.100s", driver->description); // next line is year, manufacturer - tempbuf[1].printf("%s, %-.100s", driver->year, driver->manufacturer); + strprintf(tempbuf[1], "%s, %-.100s", driver->year, driver->manufacturer); // next line source path - tempbuf[2].printf("Driver: %-.100s", core_filename_extract_base(tempbuf[3], driver->source_file).c_str()); + strprintf(tempbuf[2],"Driver: %-.100s", core_filename_extract_base(tempbuf[3], driver->source_file).c_str()); // next line is overall driver status if (driver->flags & GAME_NOT_WORKING) - tempbuf[3].cpy("Overall: NOT WORKING"); + tempbuf[3].assign("Overall: NOT WORKING"); else if (driver->flags & GAME_UNEMULATED_PROTECTION) - tempbuf[3].cpy("Overall: Unemulated Protection"); + tempbuf[3].assign("Overall: Unemulated Protection"); else - tempbuf[3].cpy("Overall: Working"); + tempbuf[3].assign("Overall: Working"); // next line is graphics, sound status if (driver->flags & (GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_IMPERFECT_COLORS)) @@ -353,7 +353,7 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott else soundstat = "OK"; - tempbuf[4].printf("Gfx: %s, Sound: %s", gfxstat, soundstat); + strprintf(tempbuf[4], "Gfx: %s, Sound: %s", gfxstat, soundstat); } else { @@ -361,13 +361,13 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott line = 0; // first line is version string - tempbuf[line++].printf("%s %s", emulator_info::get_applongname(), build_version); + strprintf(tempbuf[line++], "%s %s", emulator_info::get_applongname(), build_version); // output message while (line < ARRAY_LENGTH(tempbuf)) { if (!(*s == 0 || *s == '\n')) - tempbuf[line].cat(*s); + tempbuf[line].push_back(*s); if (*s == '\n') { diff --git a/src/emu/ui/sliders.c b/src/emu/ui/sliders.c index 73b077e7c08..e547538bc76 100644 --- a/src/emu/ui/sliders.c +++ b/src/emu/ui/sliders.c @@ -130,7 +130,7 @@ void ui_menu_sliders::handle() void ui_menu_sliders::populate() { - astring tempstring; + std::string tempstring; /* add UI sliders */ for (const slider_state *curslider = machine().ui().get_slider_list(); curslider != NULL; curslider = curslider->next) @@ -175,7 +175,7 @@ void ui_menu_sliders::custom_render(void *selectedref, float top, float bottom, float bar_left, bar_area_top, bar_width, bar_area_height, bar_top, bar_bottom, default_x, current_x; float line_height = machine().ui().get_line_height(); float percentage, default_percentage; - astring tempstring; + std::string tempstring; float text_height; INT32 curval; @@ -187,7 +187,7 @@ void ui_menu_sliders::custom_render(void *selectedref, float top, float bottom, default_percentage = (float)(curslider->defval - curslider->minval) / (float)(curslider->maxval - curslider->minval); /* assemble the text */ - tempstring.ins(0, " ").ins(0, curslider->description); + tempstring.insert(0, " ").insert(0, curslider->description); /* move us to the bottom of the screen, and expand to full width */ y2 = 1.0f - UI_BOX_TB_BORDER; diff --git a/src/emu/ui/slotopt.c b/src/emu/ui/slotopt.c index 99fa9b32699..5a2314591a6 100644 --- a/src/emu/ui/slotopt.c +++ b/src/emu/ui/slotopt.c @@ -28,7 +28,7 @@ device_slot_option *ui_menu_slot_devices::slot_get_current_option(device_slot_in } else { - astring temp; + std::string temp; current = machine().options().main_value(temp, slot->device().tag() + 1); } @@ -134,7 +134,7 @@ const char *ui_menu_slot_devices::slot_get_option(device_slot_interface *slot, i void ui_menu_slot_devices::set_slot_device(device_slot_interface *slot, const char *val) { - astring error; + std::string error; machine().options().set_value(slot->device().tag()+1, val, OPTION_PRIORITY_CMDLINE, error); assert(error.empty()); } @@ -156,14 +156,14 @@ void ui_menu_slot_devices::populate() { /* record the menu item */ const device_slot_option *option = slot_get_current_option(slot); - astring opt_name; + std::string opt_name; if (option == NULL) - opt_name.cpy("------"); + opt_name.assign("------"); else { - opt_name.cpy(option->name()); + opt_name.assign(option->name()); if (slot->fixed() || slot_get_length(slot) == 0) - opt_name.cat(" [internal]"); + opt_name.append(" [internal]"); } item_append(slot->device().tag() + 1, opt_name.c_str(), (slot->fixed() || slot_get_length(slot) == 0) ? 0 : (MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW), (void *)slot); diff --git a/src/emu/ui/swlist.c b/src/emu/ui/swlist.c index ff3d5771b76..847483edcc1 100644 --- a/src/emu/ui/swlist.c +++ b/src/emu/ui/swlist.c @@ -82,9 +82,9 @@ void ui_menu_software_parts::populate() software_part_menu_entry *entry = (software_part_menu_entry *) m_pool_alloc(sizeof(*entry)); // check if the available parts have specific part_id to be displayed (e.g. "Map Disc", "Bonus Disc", etc.) // if not, we simply display "part_name"; if yes we display "part_name (part_id)" - astring menu_part_name(swpart->name()); + std::string menu_part_name(swpart->name()); if (swpart->feature("part_id") != NULL) - menu_part_name.cat(" (").cat(swpart->feature("part_id")).cat(")"); + menu_part_name.append(" (").append(swpart->feature("part_id")).append(")"); entry->type = T_ENTRY; entry->part = swpart; item_append(m_info->shortname(), menu_part_name.c_str(), 0, entry); diff --git a/src/emu/ui/tapectrl.c b/src/emu/ui/tapectrl.c index 2de59a87767..c4bd850e232 100644 --- a/src/emu/ui/tapectrl.c +++ b/src/emu/ui/tapectrl.c @@ -62,7 +62,7 @@ void ui_menu_tape_control::populate() if (current_device()->exists()) { - astring timepos; + std::string timepos; cassette_state state; double t0 = current_device()->get_position(); double t1 = current_device()->get_length(); @@ -163,7 +163,7 @@ void ui_menu_tape_control::handle() // representation of the time //------------------------------------------------- -void ui_menu_tape_control::get_time_string(astring &dest, cassette_image_device *cassette, int *curpos, int *endpos) +void ui_menu_tape_control::get_time_string(std::string &dest, cassette_image_device *cassette, int *curpos, int *endpos) { double t0, t1; @@ -171,9 +171,9 @@ void ui_menu_tape_control::get_time_string(astring &dest, cassette_image_device t1 = cassette->get_length(); if (t1) - dest.printf("%04d/%04d", (int) t0, (int) t1); + strprintf(dest, "%04d/%04d", (int)t0, (int)t1); else - dest.printf("%04d/%04d", 0, (int) t1); + strprintf(dest, "%04d/%04d", 0, (int)t1); if (curpos != NULL) *curpos = t0; diff --git a/src/emu/ui/tapectrl.h b/src/emu/ui/tapectrl.h index b1c36c73dcd..dadaca63f6a 100644 --- a/src/emu/ui/tapectrl.h +++ b/src/emu/ui/tapectrl.h @@ -25,7 +25,7 @@ public: virtual void handle(); private: - static void get_time_string(astring &dest, cassette_image_device *cassette, int *curpos, int *endpos); + static void get_time_string(std::string &dest, cassette_image_device *cassette, int *curpos, int *endpos); }; #endif /* __UI_TAPECTRL_H__ */ diff --git a/src/emu/ui/ui.c b/src/emu/ui/ui.c index 8c43d20181c..5ca1b3ddb13 100644 --- a/src/emu/ui/ui.c +++ b/src/emu/ui/ui.c @@ -92,7 +92,7 @@ static const input_item_id non_char_keys[] = ***************************************************************************/ // messagebox buffer -static astring messagebox_text; +static std::string messagebox_text; static rgb_t messagebox_backcolor; // slider info @@ -107,28 +107,28 @@ static slider_state *slider_current; // slider controls static slider_state *slider_alloc(running_machine &machine, const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, slider_update update, void *arg); static slider_state *slider_init(running_machine &machine); -static INT32 slider_volume(running_machine &machine, void *arg, astring *str, INT32 newval); -static INT32 slider_mixervol(running_machine &machine, void *arg, astring *str, INT32 newval); -static INT32 slider_adjuster(running_machine &machine, void *arg, astring *str, INT32 newval); -static INT32 slider_overclock(running_machine &machine, void *arg, astring *str, INT32 newval); -static INT32 slider_refresh(running_machine &machine, void *arg, astring *str, INT32 newval); -static INT32 slider_brightness(running_machine &machine, void *arg, astring *str, INT32 newval); -static INT32 slider_contrast(running_machine &machine, void *arg, astring *str, INT32 newval); -static INT32 slider_gamma(running_machine &machine, void *arg, astring *str, INT32 newval); -static INT32 slider_xscale(running_machine &machine, void *arg, astring *str, INT32 newval); -static INT32 slider_yscale(running_machine &machine, void *arg, astring *str, INT32 newval); -static INT32 slider_xoffset(running_machine &machine, void *arg, astring *str, INT32 newval); -static INT32 slider_yoffset(running_machine &machine, void *arg, astring *str, INT32 newval); -static INT32 slider_overxscale(running_machine &machine, void *arg, astring *str, INT32 newval); -static INT32 slider_overyscale(running_machine &machine, void *arg, astring *str, INT32 newval); -static INT32 slider_overxoffset(running_machine &machine, void *arg, astring *str, INT32 newval); -static INT32 slider_overyoffset(running_machine &machine, void *arg, astring *str, INT32 newval); -static INT32 slider_flicker(running_machine &machine, void *arg, astring *str, INT32 newval); -static INT32 slider_beam(running_machine &machine, void *arg, astring *str, INT32 newval); +static INT32 slider_volume(running_machine &machine, void *arg, std::string *str, INT32 newval); +static INT32 slider_mixervol(running_machine &machine, void *arg, std::string *str, INT32 newval); +static INT32 slider_adjuster(running_machine &machine, void *arg, std::string *str, INT32 newval); +static INT32 slider_overclock(running_machine &machine, void *arg, std::string *str, INT32 newval); +static INT32 slider_refresh(running_machine &machine, void *arg, std::string *str, INT32 newval); +static INT32 slider_brightness(running_machine &machine, void *arg, std::string *str, INT32 newval); +static INT32 slider_contrast(running_machine &machine, void *arg, std::string *str, INT32 newval); +static INT32 slider_gamma(running_machine &machine, void *arg, std::string *str, INT32 newval); +static INT32 slider_xscale(running_machine &machine, void *arg, std::string *str, INT32 newval); +static INT32 slider_yscale(running_machine &machine, void *arg, std::string *str, INT32 newval); +static INT32 slider_xoffset(running_machine &machine, void *arg, std::string *str, INT32 newval); +static INT32 slider_yoffset(running_machine &machine, void *arg, std::string *str, INT32 newval); +static INT32 slider_overxscale(running_machine &machine, void *arg, std::string *str, INT32 newval); +static INT32 slider_overyscale(running_machine &machine, void *arg, std::string *str, INT32 newval); +static INT32 slider_overxoffset(running_machine &machine, void *arg, std::string *str, INT32 newval); +static INT32 slider_overyoffset(running_machine &machine, void *arg, std::string *str, INT32 newval); +static INT32 slider_flicker(running_machine &machine, void *arg, std::string *str, INT32 newval); +static INT32 slider_beam(running_machine &machine, void *arg, std::string *str, INT32 newval); static char *slider_get_screen_desc(screen_device &screen); #ifdef MAME_DEBUG -static INT32 slider_crossscale(running_machine &machine, void *arg, astring *str, INT32 newval); -static INT32 slider_crossoffset(running_machine &machine, void *arg, astring *str, INT32 newval); +static INT32 slider_crossscale(running_machine &machine, void *arg, std::string *str, INT32 newval); +static INT32 slider_crossoffset(running_machine &machine, void *arg, std::string *str, INT32 newval); #endif @@ -335,12 +335,12 @@ void ui_manager::display_startup_screens(bool first_time, bool show_disclaimer) switch (state) { case 0: - if (show_disclaimer && disclaimer_string(messagebox_text).len() > 0) + if (show_disclaimer && disclaimer_string(messagebox_text).length() > 0) set_handler(handler_messagebox_ok, 0); break; case 1: - if (show_warnings && warnings_string(messagebox_text).len() > 0) + if (show_warnings && warnings_string(messagebox_text).length() > 0) { set_handler(handler_messagebox_ok, 0); if (machine().system().flags & (GAME_WRONG_COLORS | GAME_IMPERFECT_COLORS | GAME_REQUIRES_ARTWORK | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_KEYBOARD | GAME_NO_SOUND)) @@ -351,15 +351,15 @@ void ui_manager::display_startup_screens(bool first_time, bool show_disclaimer) break; case 2: - if (show_gameinfo && game_info_astring(messagebox_text).len() > 0) + if (show_gameinfo && game_info_astring(messagebox_text).length() > 0) set_handler(handler_messagebox_anykey, 0); break; case 3: - if (show_mandatory_fileman && image_mandatory_scan(machine(), messagebox_text).len() > 0) + if (show_mandatory_fileman && image_mandatory_scan(machine(), messagebox_text).length() > 0) { - astring warning; - warning.cpy("This driver requires images to be loaded in the following device(s): ").cat(messagebox_text.substr(0, messagebox_text.len() - 2)); + std::string warning; + warning.assign("This driver requires images to be loaded in the following device(s): ").append(messagebox_text.substr(0, messagebox_text.length() - 2)); ui_menu_file_manager::force_file_manager(machine(), &machine().render().ui_container(), warning.c_str()); } break; @@ -398,7 +398,7 @@ void ui_manager::set_startup_text(const char *text, bool force) osd_ticks_t curtime = osd_ticks(); // copy in the new text - messagebox_text.cpy(text); + messagebox_text.assign(text); messagebox_backcolor = UI_BACKGROUND_COLOR; // don't update more than 4 times/second @@ -869,7 +869,7 @@ void CLIB_DECL ui_manager::popup_time(int seconds, const char *text, ...) // extract the text va_start(arg,text); - messagebox_text.vprintf(text, arg); + strvprintf(messagebox_text, text, arg); messagebox_backcolor = UI_BACKGROUND_COLOR; va_end(arg); @@ -992,11 +992,11 @@ bool ui_manager::is_menu_active(void) // text to the given buffer //------------------------------------------------- -astring &ui_manager::disclaimer_string(astring &str) +std::string &ui_manager::disclaimer_string(std::string &str) { - str.cpy("Usage of emulators in conjunction with ROMs you don't own is forbidden by copyright law.\n\n"); - str.catprintf("IF YOU ARE NOT LEGALLY ENTITLED TO PLAY \"%s\" ON THIS EMULATOR, PRESS ESC.\n\n", machine().system().description); - str.cat("Otherwise, type OK or move the joystick left then right to continue"); + str.assign("Usage of emulators in conjunction with ROMs you don't own is forbidden by copyright law.\n\n"); + strcatprintf(str, "IF YOU ARE NOT LEGALLY ENTITLED TO PLAY \"%s\" ON THIS EMULATOR, PRESS ESC.\n\n", machine().system().description); + str.append("Otherwise, type OK or move the joystick left then right to continue"); return str; } @@ -1006,7 +1006,7 @@ astring &ui_manager::disclaimer_string(astring &str) // text to the given buffer //------------------------------------------------- -astring &ui_manager::warnings_string(astring &str) +std::string &ui_manager::warnings_string(std::string &str) { #define WARNING_FLAGS ( GAME_NOT_WORKING | \ GAME_UNEMULATED_PROTECTION | \ @@ -1020,79 +1020,79 @@ astring &ui_manager::warnings_string(astring &str) GAME_IMPERFECT_KEYBOARD | \ GAME_NO_COCKTAIL) - str.reset(); + str.clear(); // if no warnings, nothing to return - if (rom_load_warnings(machine()) == 0 && rom_load_knownbad(machine()) == 0 && !(machine().system().flags & WARNING_FLAGS) && software_load_warnings_message(machine()).len()==0) + if (rom_load_warnings(machine()) == 0 && rom_load_knownbad(machine()) == 0 && !(machine().system().flags & WARNING_FLAGS) && software_load_warnings_message(machine()).length() == 0) return str; // add a warning if any ROMs were loaded with warnings if (rom_load_warnings(machine()) > 0) { - str.cat("One or more ROMs/CHDs for this game are incorrect. The "); - str.cat(emulator_info::get_gamenoun()); - str.cat(" may not run correctly.\n"); + str.append("One or more ROMs/CHDs for this game are incorrect. The "); + str.append(emulator_info::get_gamenoun()); + str.append(" may not run correctly.\n"); if (machine().system().flags & WARNING_FLAGS) - str.cat("\n"); + str.append("\n"); } - if (software_load_warnings_message(machine()).len()>0) { - str.cat(software_load_warnings_message(machine())); + if (software_load_warnings_message(machine()).length()>0) { + str.append(software_load_warnings_message(machine())); if (machine().system().flags & WARNING_FLAGS) - str.cat("\n"); + str.append("\n"); } // if we have at least one warning flag, print the general header if ((machine().system().flags & WARNING_FLAGS) || rom_load_knownbad(machine()) > 0) { - str.cat("There are known problems with this "); - str.cat(emulator_info::get_gamenoun()); - str.cat("\n\n"); + str.append("There are known problems with this "); + str.append(emulator_info::get_gamenoun()); + str.append("\n\n"); // add a warning if any ROMs are flagged BAD_DUMP/NO_DUMP if (rom_load_knownbad(machine()) > 0) { - str.cat("One or more ROMs/CHDs for this "); - str.cat(emulator_info::get_gamenoun()); - str.cat(" have not been correctly dumped.\n"); + str.append("One or more ROMs/CHDs for this "); + str.append(emulator_info::get_gamenoun()); + str.append(" have not been correctly dumped.\n"); } // add one line per warning flag if (machine().system().flags & GAME_IMPERFECT_KEYBOARD) - str.cat("The keyboard emulation may not be 100% accurate.\n"); + str.append("The keyboard emulation may not be 100% accurate.\n"); if (machine().system().flags & GAME_IMPERFECT_COLORS) - str.cat("The colors aren't 100% accurate.\n"); + str.append("The colors aren't 100% accurate.\n"); if (machine().system().flags & GAME_WRONG_COLORS) - str.cat("The colors are completely wrong.\n"); + str.append("The colors are completely wrong.\n"); if (machine().system().flags & GAME_IMPERFECT_GRAPHICS) - str.cat("The video emulation isn't 100% accurate.\n"); + str.append("The video emulation isn't 100% accurate.\n"); if (machine().system().flags & GAME_IMPERFECT_SOUND) - str.cat("The sound emulation isn't 100% accurate.\n"); + str.append("The sound emulation isn't 100% accurate.\n"); if (machine().system().flags & GAME_NO_SOUND) - str.cat("The game lacks sound.\n"); + str.append("The game lacks sound.\n"); if (machine().system().flags & GAME_NO_COCKTAIL) - str.cat("Screen flipping in cocktail mode is not supported.\n"); + str.append("Screen flipping in cocktail mode is not supported.\n"); // check if external artwork is present before displaying this warning? if (machine().system().flags & GAME_REQUIRES_ARTWORK) - str.cat("The game requires external artwork files\n"); + str.append("The game requires external artwork files\n"); // if there's a NOT WORKING, UNEMULATED PROTECTION or GAME MECHANICAL warning, make it stronger if (machine().system().flags & (GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_MECHANICAL)) { // add the strings for these warnings if (machine().system().flags & GAME_UNEMULATED_PROTECTION) - str.cat("The game has protection which isn't fully emulated.\n"); + str.append("The game has protection which isn't fully emulated.\n"); if (machine().system().flags & GAME_NOT_WORKING) { - str.cat("\nTHIS "); - str.cat(emulator_info::get_capgamenoun()); - str.cat(" DOESN'T WORK. The emulation for this game is not yet complete. " + str.append("\nTHIS "); + str.append(emulator_info::get_capgamenoun()); + str.append(" DOESN'T WORK. The emulation for this game is not yet complete. " "There is nothing you can do to fix this problem except wait for the developers to improve the emulation.\n"); } if (machine().system().flags & GAME_MECHANICAL) { - str.cat("\nCertain elements of this "); - str.cat(emulator_info::get_gamenoun()); - str.cat(" cannot be emulated as it requires actual physical interaction or consists of mechanical devices. " + str.append("\nCertain elements of this "); + str.append(emulator_info::get_gamenoun()); + str.append(" cannot be emulated as it requires actual physical interaction or consists of mechanical devices. " "It is not possible to fully play this "); - str.cat(emulator_info::get_gamenoun()); - str.cat(".\n"); + str.append(emulator_info::get_gamenoun()); + str.append(".\n"); } // find the parent of this driver @@ -1110,34 +1110,34 @@ astring &ui_manager::warnings_string(astring &str) { // this one works, add a header and display the name of the clone if (!foundworking) - str.cat("\n\nThere are working clones of this game: "); + str.append("\n\nThere are working clones of this game: "); else - str.cat(", "); - str.cat(drivlist.driver().name); + str.append(", "); + str.append(drivlist.driver().name); foundworking = true; } if (foundworking) - str.cat("\n"); + str.append("\n"); } } // add the 'press OK' string - str.cat("\n\nType OK or move the joystick left then right to continue"); + str.append("\n\nType OK or move the joystick left then right to continue"); return str; } //------------------------------------------------- -// game_info_astring - populate an allocated +// game_info_std::string - populate an allocated // string with the game info text //------------------------------------------------- -astring &ui_manager::game_info_astring(astring &str) +std::string &ui_manager::game_info_astring(std::string &str) { // print description, manufacturer, and CPU: - astring tempstr; - str.printf("%s\n%s %s\nDriver: %s\n\nCPU:\n", machine().system().description, machine().system().year, machine().system().manufacturer, core_filename_extract_base(tempstr, machine().system().source_file).c_str()); + std::string tempstr; + strprintf(str, "%s\n%s %s\nDriver: %s\n\nCPU:\n", machine().system().description, machine().system().year, machine().system().manufacturer, core_filename_extract_base(tempstr, machine().system().source_file).c_str()); // loop over all CPUs execute_interface_iterator execiter(machine().root_device()); @@ -1162,14 +1162,14 @@ astring &ui_manager::game_info_astring(astring &str) // if more than one, prepend a #x in front of the CPU name if (count > 1) - str.catprintf("%d" UTF8_MULTIPLY, count); - str.cat(name); + strcatprintf(str, "%d" UTF8_MULTIPLY, count); + str.append(name); // display clock in kHz or MHz if (clock >= 1000000) - str.catprintf(" %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000); + strcatprintf(str, " %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000); else - str.catprintf(" %d.%03d" UTF8_NBSP "kHz\n", clock / 1000, clock % 1000); + strcatprintf(str, " %d.%03d" UTF8_NBSP "kHz\n", clock / 1000, clock % 1000); } // loop over all sound chips @@ -1183,7 +1183,7 @@ astring &ui_manager::game_info_astring(astring &str) // append the Sound: string if (!found_sound) - str.cat("\nSound:\n"); + str.append("\nSound:\n"); found_sound = true; // count how many identical sound chips we have @@ -1197,42 +1197,42 @@ astring &ui_manager::game_info_astring(astring &str) } // if more than one, prepend a #x in front of the CPU name if (count > 1) - str.catprintf("%d" UTF8_MULTIPLY, count); - str.cat(sound->device().name()); + strcatprintf(str, "%d" UTF8_MULTIPLY, count); + str.append(sound->device().name()); // display clock in kHz or MHz int clock = sound->device().clock(); if (clock >= 1000000) - str.catprintf(" %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000); + strcatprintf(str, " %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000); else if (clock != 0) - str.catprintf(" %d.%03d" UTF8_NBSP "kHz\n", clock / 1000, clock % 1000); + strcatprintf(str, " %d.%03d" UTF8_NBSP "kHz\n", clock / 1000, clock % 1000); else - str.cat("\n"); + str.append("\n"); } // display screen information - str.cat("\nVideo:\n"); + str.append("\nVideo:\n"); screen_device_iterator scriter(machine().root_device()); int scrcount = scriter.count(); if (scrcount == 0) - str.cat("None\n"); + str.append("None\n"); else { for (screen_device *screen = scriter.first(); screen != NULL; screen = scriter.next()) { if (scrcount > 1) { - str.cat(slider_get_screen_desc(*screen)); - str.cat(": "); + str.append(slider_get_screen_desc(*screen)); + str.append(": "); } if (screen->screen_type() == SCREEN_TYPE_VECTOR) - str.cat("Vector\n"); + str.append("Vector\n"); else { const rectangle &visarea = screen->visible_area(); - str.catprintf("%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz\n", + strcatprintf(str, "%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz\n", visarea.width(), visarea.height(), (machine().system().flags & ORIENTATION_SWAP_XY) ? "V" : "H", ATTOSECONDS_TO_HZ(screen->frame_period().attoseconds)); @@ -1471,7 +1471,7 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co // first draw the FPS counter if (machine.ui().show_fps_counter()) { - astring tempstring; + std::string tempstring; machine.ui().draw_text_full(container, machine.video().speed_text(tempstring).c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL); } @@ -1751,16 +1751,16 @@ void ui_manager::request_quit() UINT32 ui_manager::handler_confirm_quit(running_machine &machine, render_container *container, UINT32 state) { // get the text for 'UI Select' - astring ui_select_text; + std::string ui_select_text; machine.input().seq_name(ui_select_text, machine.ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD)); // get the text for 'UI Cancel' - astring ui_cancel_text; + std::string ui_cancel_text; machine.input().seq_name(ui_cancel_text, machine.ioport().type_seq(IPT_UI_CANCEL, 0, SEQ_TYPE_STANDARD)); // assemble the quit message - astring quit_message; - quit_message.printf( + std::string quit_message; + strprintf(quit_message, "Are you sure you want to quit?\n\n" "Press ''%s'' to quit,\n" "Press ''%s'' to return to emulation.", @@ -1831,7 +1831,7 @@ static slider_state *slider_init(running_machine &machine) ioport_port *port; slider_state *listhead = NULL; slider_state **tailptr = &listhead; - astring str; + std::string str; int item; // add overall volume @@ -1846,7 +1846,7 @@ static slider_state *slider_init(running_machine &machine) INT32 defval = 1000; info.stream->input_name(info.inputnum, str); - str.cat(" Volume"); + str.append(" Volume"); *tailptr = slider_alloc(machine, str.c_str(), 0, defval, maxval, 20, slider_mixervol, (void *)(FPTR)item); tailptr = &(*tailptr)->next; } @@ -1868,7 +1868,7 @@ static slider_state *slider_init(running_machine &machine) for (device_execute_interface *exec = iter.first(); exec != NULL; exec = iter.next()) { void *param = (void *)&exec->device(); - str.printf("Overclock CPU %s", exec->device().tag()); + strprintf(str, "Overclock CPU %s", exec->device().tag()); *tailptr = slider_alloc(machine, str.c_str(), 10, 1000, 2000, 1, slider_overclock, param); tailptr = &(*tailptr)->next; } @@ -1887,33 +1887,33 @@ static slider_state *slider_init(running_machine &machine) // add refresh rate tweaker if (machine.options().cheat()) { - str.printf("%s Refresh Rate", slider_get_screen_desc(*screen)); + strprintf(str, "%s Refresh Rate", slider_get_screen_desc(*screen)); *tailptr = slider_alloc(machine, str.c_str(), -10000, 0, 10000, 1000, slider_refresh, param); tailptr = &(*tailptr)->next; } // add standard brightness/contrast/gamma controls per-screen - str.printf("%s Brightness", slider_get_screen_desc(*screen)); + strprintf(str, "%s Brightness", slider_get_screen_desc(*screen)); *tailptr = slider_alloc(machine, str.c_str(), 100, 1000, 2000, 10, slider_brightness, param); tailptr = &(*tailptr)->next; - str.printf("%s Contrast", slider_get_screen_desc(*screen)); + strprintf(str, "%s Contrast", slider_get_screen_desc(*screen)); *tailptr = slider_alloc(machine, str.c_str(), 100, 1000, 2000, 50, slider_contrast, param); tailptr = &(*tailptr)->next; - str.printf("%s Gamma", slider_get_screen_desc(*screen)); + strprintf(str,"%s Gamma", slider_get_screen_desc(*screen)); *tailptr = slider_alloc(machine, str.c_str(), 100, 1000, 3000, 50, slider_gamma, param); tailptr = &(*tailptr)->next; // add scale and offset controls per-screen - str.printf("%s Horiz Stretch", slider_get_screen_desc(*screen)); + strprintf(str,"%s Horiz Stretch", slider_get_screen_desc(*screen)); *tailptr = slider_alloc(machine, str.c_str(), 500, defxscale, 1500, 2, slider_xscale, param); tailptr = &(*tailptr)->next; - str.printf("%s Horiz Position", slider_get_screen_desc(*screen)); + strprintf(str,"%s Horiz Position", slider_get_screen_desc(*screen)); *tailptr = slider_alloc(machine, str.c_str(), -500, defxoffset, 500, 2, slider_xoffset, param); tailptr = &(*tailptr)->next; - str.printf("%s Vert Stretch", slider_get_screen_desc(*screen)); + strprintf(str,"%s Vert Stretch", slider_get_screen_desc(*screen)); *tailptr = slider_alloc(machine, str.c_str(), 500, defyscale, 1500, 2, slider_yscale, param); tailptr = &(*tailptr)->next; - str.printf("%s Vert Position", slider_get_screen_desc(*screen)); + strprintf(str,"%s Vert Position", slider_get_screen_desc(*screen)); *tailptr = slider_alloc(machine, str.c_str(), -500, defyoffset, 500, 2, slider_yoffset, param); tailptr = &(*tailptr)->next; } @@ -1931,16 +1931,16 @@ static slider_state *slider_init(running_machine &machine) void *param = (void *)laserdisc; // add scale and offset controls per-overlay - str.printf("Laserdisc '%s' Horiz Stretch", laserdisc->tag()); + strprintf(str,"Laserdisc '%s' Horiz Stretch", laserdisc->tag()); *tailptr = slider_alloc(machine, str.c_str(), 500, (defxscale == 0) ? 1000 : defxscale, 1500, 2, slider_overxscale, param); tailptr = &(*tailptr)->next; - str.printf("Laserdisc '%s' Horiz Position", laserdisc->tag()); + strprintf(str,"Laserdisc '%s' Horiz Position", laserdisc->tag()); *tailptr = slider_alloc(machine, str.c_str(), -500, defxoffset, 500, 2, slider_overxoffset, param); tailptr = &(*tailptr)->next; - str.printf("Laserdisc '%s' Vert Stretch", laserdisc->tag()); + strprintf(str,"Laserdisc '%s' Vert Stretch", laserdisc->tag()); *tailptr = slider_alloc(machine, str.c_str(), 500, (defyscale == 0) ? 1000 : defyscale, 1500, 2, slider_overyscale, param); tailptr = &(*tailptr)->next; - str.printf("Laserdisc '%s' Vert Position", laserdisc->tag()); + strprintf(str,"Laserdisc '%s' Vert Position", laserdisc->tag()); *tailptr = slider_alloc(machine, str.c_str(), -500, defyoffset, 500, 2, slider_overyoffset, param); tailptr = &(*tailptr)->next; } @@ -1963,10 +1963,10 @@ static slider_state *slider_init(running_machine &machine) if (field->crosshair_axis() != CROSSHAIR_AXIS_NONE && field->player() == 0) { void *param = (void *)field; - str.printf("Crosshair Scale %s", (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? "X" : "Y"); + strprintf(str,"Crosshair Scale %s", (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? "X" : "Y"); *tailptr = slider_alloc(machine, str.c_str(), -3000, 1000, 3000, 100, slider_crossscale, param); tailptr = &(*tailptr)->next; - str.printf("Crosshair Offset %s", (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? "X" : "Y"); + strprintf(str,"Crosshair Offset %s", (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? "X" : "Y"); *tailptr = slider_alloc(machine, str.c_str(), -3000, 0, 3000, 100, slider_crossoffset, param); tailptr = &(*tailptr)->next; } @@ -1980,12 +1980,12 @@ static slider_state *slider_init(running_machine &machine) // slider_volume - global volume slider callback //------------------------------------------------- -static INT32 slider_volume(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_volume(running_machine &machine, void *arg, std::string *str, INT32 newval) { if (newval != SLIDER_NOCHANGE) machine.sound().set_attenuation(newval); if (str != NULL) - str->printf("%3ddB", machine.sound().attenuation()); + strprintf(*str,"%3ddB", machine.sound().attenuation()); return machine.sound().attenuation(); } @@ -1995,7 +1995,7 @@ static INT32 slider_volume(running_machine &machine, void *arg, astring *str, IN // slider callback //------------------------------------------------- -static INT32 slider_mixervol(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_mixervol(running_machine &machine, void *arg, std::string *str, INT32 newval) { mixer_input info; if (!machine.sound().indexed_mixer_input((FPTR)arg, info)) @@ -2007,7 +2007,7 @@ static INT32 slider_mixervol(running_machine &machine, void *arg, astring *str, info.stream->set_user_gain(info.inputnum, (float)newval * 0.001f); } if (str != NULL) - str->printf("%4.2f", info.stream->user_gain(info.inputnum)); + strprintf(*str,"%4.2f", info.stream->user_gain(info.inputnum)); return floor(info.stream->user_gain(info.inputnum) * 1000.0f + 0.5f); } @@ -2017,7 +2017,7 @@ static INT32 slider_mixervol(running_machine &machine, void *arg, astring *str, // callback //------------------------------------------------- -static INT32 slider_adjuster(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_adjuster(running_machine &machine, void *arg, std::string *str, INT32 newval) { ioport_field *field = (ioport_field *)arg; ioport_field::user_settings settings; @@ -2029,7 +2029,7 @@ static INT32 slider_adjuster(running_machine &machine, void *arg, astring *str, field->set_user_settings(settings); } if (str != NULL) - str->printf("%d%%", settings.value); + strprintf(*str,"%d%%", settings.value); return settings.value; } @@ -2039,13 +2039,13 @@ static INT32 slider_adjuster(running_machine &machine, void *arg, astring *str, // callback //------------------------------------------------- -static INT32 slider_overclock(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_overclock(running_machine &machine, void *arg, std::string *str, INT32 newval) { device_t *cpu = (device_t *)arg; if (newval != SLIDER_NOCHANGE) cpu->set_clock_scale((float)newval * 0.001f); if (str != NULL) - str->printf("%3.0f%%", floor(cpu->clock_scale() * 100.0f + 0.5f)); + strprintf(*str,"%3.0f%%", floor(cpu->clock_scale() * 100.0f + 0.5f)); return floor(cpu->clock_scale() * 1000.0f + 0.5f); } @@ -2054,7 +2054,7 @@ static INT32 slider_overclock(running_machine &machine, void *arg, astring *str, // slider_refresh - refresh rate slider callback //------------------------------------------------- -static INT32 slider_refresh(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_refresh(running_machine &machine, void *arg, std::string *str, INT32 newval) { screen_device *screen = reinterpret_cast<screen_device *>(arg); double defrefresh = ATTOSECONDS_TO_HZ(screen->refresh_attoseconds()); @@ -2068,7 +2068,7 @@ static INT32 slider_refresh(running_machine &machine, void *arg, astring *str, I screen->configure(width, height, visarea, HZ_TO_ATTOSECONDS(defrefresh + (double)newval * 0.001)); } if (str != NULL) - str->printf("%.3ffps", ATTOSECONDS_TO_HZ(machine.first_screen()->frame_period().attoseconds)); + strprintf(*str,"%.3ffps", ATTOSECONDS_TO_HZ(machine.first_screen()->frame_period().attoseconds)); refresh = ATTOSECONDS_TO_HZ(machine.first_screen()->frame_period().attoseconds); return floor((refresh - defrefresh) * 1000.0f + 0.5f); } @@ -2079,7 +2079,7 @@ static INT32 slider_refresh(running_machine &machine, void *arg, astring *str, I // callback //------------------------------------------------- -static INT32 slider_brightness(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_brightness(running_machine &machine, void *arg, std::string *str, INT32 newval) { screen_device *screen = reinterpret_cast<screen_device *>(arg); render_container::user_settings settings; @@ -2091,7 +2091,7 @@ static INT32 slider_brightness(running_machine &machine, void *arg, astring *str screen->container().set_user_settings(settings); } if (str != NULL) - str->printf("%.3f", settings.m_brightness); + strprintf(*str,"%.3f", settings.m_brightness); return floor(settings.m_brightness * 1000.0f + 0.5f); } @@ -2101,7 +2101,7 @@ static INT32 slider_brightness(running_machine &machine, void *arg, astring *str // callback //------------------------------------------------- -static INT32 slider_contrast(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_contrast(running_machine &machine, void *arg, std::string *str, INT32 newval) { screen_device *screen = reinterpret_cast<screen_device *>(arg); render_container::user_settings settings; @@ -2113,7 +2113,7 @@ static INT32 slider_contrast(running_machine &machine, void *arg, astring *str, screen->container().set_user_settings(settings); } if (str != NULL) - str->printf("%.3f", settings.m_contrast); + strprintf(*str,"%.3f", settings.m_contrast); return floor(settings.m_contrast * 1000.0f + 0.5f); } @@ -2122,7 +2122,7 @@ static INT32 slider_contrast(running_machine &machine, void *arg, astring *str, // slider_gamma - screen gamma slider callback //------------------------------------------------- -static INT32 slider_gamma(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_gamma(running_machine &machine, void *arg, std::string *str, INT32 newval) { screen_device *screen = reinterpret_cast<screen_device *>(arg); render_container::user_settings settings; @@ -2134,7 +2134,7 @@ static INT32 slider_gamma(running_machine &machine, void *arg, astring *str, INT screen->container().set_user_settings(settings); } if (str != NULL) - str->printf("%.3f", settings.m_gamma); + strprintf(*str,"%.3f", settings.m_gamma); return floor(settings.m_gamma * 1000.0f + 0.5f); } @@ -2144,7 +2144,7 @@ static INT32 slider_gamma(running_machine &machine, void *arg, astring *str, INT // callback //------------------------------------------------- -static INT32 slider_xscale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_xscale(running_machine &machine, void *arg, std::string *str, INT32 newval) { screen_device *screen = reinterpret_cast<screen_device *>(arg); render_container::user_settings settings; @@ -2156,7 +2156,7 @@ static INT32 slider_xscale(running_machine &machine, void *arg, astring *str, IN screen->container().set_user_settings(settings); } if (str != NULL) - str->printf("%.3f", settings.m_xscale); + strprintf(*str,"%.3f", settings.m_xscale); return floor(settings.m_xscale * 1000.0f + 0.5f); } @@ -2166,7 +2166,7 @@ static INT32 slider_xscale(running_machine &machine, void *arg, astring *str, IN // callback //------------------------------------------------- -static INT32 slider_yscale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_yscale(running_machine &machine, void *arg, std::string *str, INT32 newval) { screen_device *screen = reinterpret_cast<screen_device *>(arg); render_container::user_settings settings; @@ -2178,7 +2178,7 @@ static INT32 slider_yscale(running_machine &machine, void *arg, astring *str, IN screen->container().set_user_settings(settings); } if (str != NULL) - str->printf("%.3f", settings.m_yscale); + strprintf(*str,"%.3f", settings.m_yscale); return floor(settings.m_yscale * 1000.0f + 0.5f); } @@ -2188,7 +2188,7 @@ static INT32 slider_yscale(running_machine &machine, void *arg, astring *str, IN // slider callback //------------------------------------------------- -static INT32 slider_xoffset(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_xoffset(running_machine &machine, void *arg, std::string *str, INT32 newval) { screen_device *screen = reinterpret_cast<screen_device *>(arg); render_container::user_settings settings; @@ -2200,7 +2200,7 @@ static INT32 slider_xoffset(running_machine &machine, void *arg, astring *str, I screen->container().set_user_settings(settings); } if (str != NULL) - str->printf("%.3f", settings.m_xoffset); + strprintf(*str,"%.3f", settings.m_xoffset); return floor(settings.m_xoffset * 1000.0f + 0.5f); } @@ -2210,7 +2210,7 @@ static INT32 slider_xoffset(running_machine &machine, void *arg, astring *str, I // slider callback //------------------------------------------------- -static INT32 slider_yoffset(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_yoffset(running_machine &machine, void *arg, std::string *str, INT32 newval) { screen_device *screen = reinterpret_cast<screen_device *>(arg); render_container::user_settings settings; @@ -2222,7 +2222,7 @@ static INT32 slider_yoffset(running_machine &machine, void *arg, astring *str, I screen->container().set_user_settings(settings); } if (str != NULL) - str->printf("%.3f", settings.m_yoffset); + strprintf(*str,"%.3f", settings.m_yoffset); return floor(settings.m_yoffset * 1000.0f + 0.5f); } @@ -2232,7 +2232,7 @@ static INT32 slider_yoffset(running_machine &machine, void *arg, astring *str, I // callback //------------------------------------------------- -static INT32 slider_overxscale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_overxscale(running_machine &machine, void *arg, std::string *str, INT32 newval) { laserdisc_device *laserdisc = (laserdisc_device *)arg; laserdisc_overlay_config settings; @@ -2244,7 +2244,7 @@ static INT32 slider_overxscale(running_machine &machine, void *arg, astring *str laserdisc->set_overlay_config(settings); } if (str != NULL) - str->printf("%.3f", settings.m_overscalex); + strprintf(*str,"%.3f", settings.m_overscalex); return floor(settings.m_overscalex * 1000.0f + 0.5f); } @@ -2254,7 +2254,7 @@ static INT32 slider_overxscale(running_machine &machine, void *arg, astring *str // callback //------------------------------------------------- -static INT32 slider_overyscale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_overyscale(running_machine &machine, void *arg, std::string *str, INT32 newval) { laserdisc_device *laserdisc = (laserdisc_device *)arg; laserdisc_overlay_config settings; @@ -2266,7 +2266,7 @@ static INT32 slider_overyscale(running_machine &machine, void *arg, astring *str laserdisc->set_overlay_config(settings); } if (str != NULL) - str->printf("%.3f", settings.m_overscaley); + strprintf(*str,"%.3f", settings.m_overscaley); return floor(settings.m_overscaley * 1000.0f + 0.5f); } @@ -2276,7 +2276,7 @@ static INT32 slider_overyscale(running_machine &machine, void *arg, astring *str // slider callback //------------------------------------------------- -static INT32 slider_overxoffset(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_overxoffset(running_machine &machine, void *arg, std::string *str, INT32 newval) { laserdisc_device *laserdisc = (laserdisc_device *)arg; laserdisc_overlay_config settings; @@ -2288,7 +2288,7 @@ static INT32 slider_overxoffset(running_machine &machine, void *arg, astring *st laserdisc->set_overlay_config(settings); } if (str != NULL) - str->printf("%.3f", settings.m_overposx); + strprintf(*str,"%.3f", settings.m_overposx); return floor(settings.m_overposx * 1000.0f + 0.5f); } @@ -2298,7 +2298,7 @@ static INT32 slider_overxoffset(running_machine &machine, void *arg, astring *st // slider callback //------------------------------------------------- -static INT32 slider_overyoffset(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_overyoffset(running_machine &machine, void *arg, std::string *str, INT32 newval) { laserdisc_device *laserdisc = (laserdisc_device *)arg; laserdisc_overlay_config settings; @@ -2310,7 +2310,7 @@ static INT32 slider_overyoffset(running_machine &machine, void *arg, astring *st laserdisc->set_overlay_config(settings); } if (str != NULL) - str->printf("%.3f", settings.m_overposy); + strprintf(*str,"%.3f", settings.m_overposy); return floor(settings.m_overposy * 1000.0f + 0.5f); } @@ -2320,13 +2320,13 @@ static INT32 slider_overyoffset(running_machine &machine, void *arg, astring *st // callback //------------------------------------------------- -static INT32 slider_flicker(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_flicker(running_machine &machine, void *arg, std::string *str, INT32 newval) { vector_device *vector = NULL; if (newval != SLIDER_NOCHANGE) vector->set_flicker((float)newval * 0.1f); if (str != NULL) - str->printf("%1.2f", vector->get_flicker()); + strprintf(*str,"%1.2f", vector->get_flicker()); return floor(vector->get_flicker() * 10.0f + 0.5f); } @@ -2336,13 +2336,13 @@ static INT32 slider_flicker(running_machine &machine, void *arg, astring *str, I // callback //------------------------------------------------- -static INT32 slider_beam(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_beam(running_machine &machine, void *arg, std::string *str, INT32 newval) { vector_device *vector = NULL; if (newval != SLIDER_NOCHANGE) vector->set_beam((float)newval * 0.01f); if (str != NULL) - str->printf("%1.2f", vector->get_beam()); + strprintf(*str,"%1.2f", vector->get_beam()); return floor(vector->get_beam() * 100.0f + 0.5f); } @@ -2372,14 +2372,14 @@ static char *slider_get_screen_desc(screen_device &screen) //------------------------------------------------- #ifdef MAME_DEBUG -static INT32 slider_crossscale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_crossscale(running_machine &machine, void *arg, std::string *str, INT32 newval) { ioport_field *field = (ioport_field *)arg; if (newval != SLIDER_NOCHANGE) field->set_crosshair_scale(float(newval) * 0.001); if (str != NULL) - str->printf("%s %s %1.3f", "Crosshair Scale", (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? "X" : "Y", float(newval) * 0.001f); + strprintf(*str,"%s %s %1.3f", "Crosshair Scale", (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? "X" : "Y", float(newval) * 0.001f); return floor(field->crosshair_scale() * 1000.0f + 0.5f); } #endif @@ -2391,14 +2391,14 @@ static INT32 slider_crossscale(running_machine &machine, void *arg, astring *str //------------------------------------------------- #ifdef MAME_DEBUG -static INT32 slider_crossoffset(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_crossoffset(running_machine &machine, void *arg, std::string *str, INT32 newval) { ioport_field *field = (ioport_field *)arg; if (newval != SLIDER_NOCHANGE) field->set_crosshair_offset(float(newval) * 0.001f); if (str != NULL) - str->printf("%s %s %1.3f", "Crosshair Offset", (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? "X" : "Y", float(newval) * 0.001f); + strprintf(*str,"%s %s %1.3f", "Crosshair Offset", (field->crosshair_axis() == CROSSHAIR_AXIS_X) ? "X" : "Y", float(newval) * 0.001f); return field->crosshair_offset(); } #endif @@ -2423,7 +2423,7 @@ bool ui_manager::use_natural_keyboard() const void ui_manager::set_use_natural_keyboard(bool use_natural_keyboard) { m_use_natural_keyboard = use_natural_keyboard; - astring error; + std::string error; machine().options().set_value(OPTION_NATURAL_KEYBOARD, use_natural_keyboard, OPTION_PRIORITY_CMDLINE, error); assert(error.empty()); } diff --git a/src/emu/ui/ui.h b/src/emu/ui/ui.h index e63b00339df..3f74eac6097 100644 --- a/src/emu/ui/ui.h +++ b/src/emu/ui/ui.h @@ -93,7 +93,7 @@ enum typedef UINT32 (*ui_callback)(running_machine &, render_container *, UINT32); -typedef INT32 (*slider_update)(running_machine &machine, void *arg, astring *str, INT32 newval); +typedef INT32(*slider_update)(running_machine &machine, void *arg, std::string *str, INT32 newval); struct slider_state { @@ -160,7 +160,7 @@ public: void request_quit(); // print the game info string into a buffer - astring &game_info_astring(astring &str); + std::string &game_info_astring(std::string &str); // slider controls const slider_state *get_slider_list(void); @@ -185,8 +185,8 @@ private: bool m_mouse_show; // text generators - astring &disclaimer_string(astring &buffer); - astring &warnings_string(astring &buffer); + std::string &disclaimer_string(std::string &buffer); + std::string &warnings_string(std::string &buffer); // UI handlers static UINT32 handler_messagebox(running_machine &machine, render_container *container, UINT32 state); diff --git a/src/emu/ui/videoopt.c b/src/emu/ui/videoopt.c index d0788527b2e..57e25ce5edc 100644 --- a/src/emu/ui/videoopt.c +++ b/src/emu/ui/videoopt.c @@ -174,7 +174,7 @@ ui_menu_video_options::ui_menu_video_options(running_machine &machine, render_co void ui_menu_video_options::populate() { const char *subtext = ""; - astring tempstring; + std::string tempstring; int viewnum; int enabled; @@ -186,7 +186,8 @@ void ui_menu_video_options::populate() break; /* create a string for the item, replacing underscores with spaces */ - tempstring.cpy(name).replace(0, "_", " "); + tempstring.assign(name); + strreplace(tempstring, "_", " "); item_append(tempstring.c_str(), NULL, 0, (void *)(FPTR)(VIDEO_ITEM_VIEW + viewnum)); } diff --git a/src/emu/validity.c b/src/emu/validity.c index 887dd76e123..bd5c0702662 100644 --- a/src/emu/validity.c +++ b/src/emu/validity.c @@ -198,16 +198,16 @@ void validity_checker::check_all() // if we had warnings or errors, output if (m_errors > 0 || m_warnings > 0) { - astring tempstr; + std::string tempstr; output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Core: %d errors, %d warnings\n", m_errors, m_warnings); if (m_errors > 0) { - m_error_text.replace("\n", "\n "); + strreplace(m_error_text, "\n", "\n "); output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Errors:\n %s", m_error_text.c_str()); } if (m_warnings > 0) { - m_warning_text.replace("\n", "\n "); + strreplace(m_warning_text, "\n", "\n "); output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Warnings:\n %s", m_warning_text.c_str()); } output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "\n"); @@ -276,8 +276,8 @@ void validity_checker::validate_one(const game_driver &driver) // reset error/warning state int start_errors = m_errors; int start_warnings = m_warnings; - m_error_text.reset(); - m_warning_text.reset(); + m_error_text.clear(); + m_warning_text.clear(); // wrap in try/except to catch fatalerrors try @@ -298,16 +298,16 @@ void validity_checker::validate_one(const game_driver &driver) // if we had warnings or errors, output if (m_errors > start_errors || m_warnings > start_warnings) { - astring tempstr; + std::string tempstr; output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Driver %s (file %s): %d errors, %d warnings\n", driver.name, core_filename_extract_base(tempstr, driver.source_file).c_str(), m_errors - start_errors, m_warnings - start_warnings); if (m_errors > start_errors) { - m_error_text.replace("\n", "\n "); + strreplace(m_error_text, "\n", "\n "); output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Errors:\n %s", m_error_text.c_str()); } if (m_warnings > start_warnings) { - m_warning_text.replace("\n", "\n "); + strreplace(m_warning_text, "\n", "\n "); output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Warnings:\n %s", m_warning_text.c_str()); } output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "\n"); @@ -519,7 +519,7 @@ void validity_checker::validate_inlines() void validity_checker::validate_driver() { // check for duplicate names - astring tempstr; + std::string tempstr; if (m_names_map.add(m_current_driver->name, m_current_driver, false) == TMERR_DUPLICATE) { const game_driver *match = m_names_map.find(m_current_driver->name); @@ -878,7 +878,7 @@ void validity_checker::validate_inputs() // allocate the input ports ioport_list portlist; - astring errorbuf; + std::string errorbuf; portlist.append(*device, errorbuf); // report any errors during construction @@ -1008,8 +1008,8 @@ void validity_checker::validate_devices() { 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 &>(*m_current_config).device_add(&m_current_config->root_device(), temptag.c_str(), option->devtype(), 0); // notify this device and all its subdevices that they are now configured @@ -1036,18 +1036,18 @@ void validity_checker::validate_devices() // and device //------------------------------------------------- -void validity_checker::build_output_prefix(astring &str) +void validity_checker::build_output_prefix(std::string &str) { // start empty - str.reset(); + str.clear(); // if we have a current device, indicate that if (m_current_device != NULL) - str.cat(m_current_device->name()).cat(" device '").cat(m_current_device->tag()).cat("': "); + str.append(m_current_device->name()).append(" device '").append(m_current_device->tag()).append("': "); // if we have a current port, indicate that as well if (m_current_ioport != NULL) - str.cat("ioport '").cat(m_current_ioport).cat("': "); + str.append("ioport '").append(m_current_ioport).append("': "); } @@ -1057,7 +1057,7 @@ void validity_checker::build_output_prefix(astring &str) void validity_checker::output_callback(osd_output_channel channel, const char *msg, va_list args) { - astring output; + std::string output; switch (channel) { case OSD_OUTPUT_CHANNEL_ERROR: @@ -1068,8 +1068,8 @@ void validity_checker::output_callback(osd_output_channel channel, const char *m build_output_prefix(output); // generate the string - output.catvprintf(msg, args); - m_error_text.cat(output); + strcatvprintf(output, msg, args); + m_error_text.append(output); break; case OSD_OUTPUT_CHANNEL_WARNING: // count the error @@ -1079,8 +1079,8 @@ void validity_checker::output_callback(osd_output_channel channel, const char *m build_output_prefix(output); // generate the string and output to the original target - output.catvprintf(msg, args); - m_warning_text.cat(output); + strcatvprintf(output, msg, args); + m_warning_text.append(output); break; default: chain_output(channel, msg, args); diff --git a/src/emu/validity.h b/src/emu/validity.h index 6ba3f1ad6c7..64984433ecf 100644 --- a/src/emu/validity.h +++ b/src/emu/validity.h @@ -79,7 +79,7 @@ private: void validate_devices(); // output helpers - void build_output_prefix(astring &str); + void build_output_prefix(std::string &str); void output_via_delegate(osd_output_channel channel, const char *format, ...) ATTR_PRINTF(3,4); // internal driver list @@ -88,8 +88,8 @@ private: // error tracking int m_errors; int m_warnings; - astring m_error_text; - astring m_warning_text; + std::string m_error_text; + std::string m_warning_text; // maps for finding duplicates game_driver_map m_names_map; diff --git a/src/emu/video.c b/src/emu/video.c index caa0138455f..bee4f24282d 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -257,30 +257,30 @@ void video_manager::frame_update(bool debug) // into a string buffer //------------------------------------------------- -astring &video_manager::speed_text(astring &str) +std::string &video_manager::speed_text(std::string &str) { - str.reset(); + str.clear(); // if we're paused, just display Paused bool paused = machine().paused(); if (paused) - str.cat("paused"); + str.append("paused"); // if we're fast forwarding, just display Fast-forward else if (m_fastforward) - str.cat("fast "); + str.append("fast "); // if we're auto frameskipping, display that plus the level else if (effective_autoframeskip()) - str.catprintf("auto%2d/%d", effective_frameskip(), MAX_FRAMESKIP); + strcatprintf(str, "auto%2d/%d", effective_frameskip(), MAX_FRAMESKIP); // otherwise, just display the frameskip plus the level else - str.catprintf("skip %d/%d", effective_frameskip(), MAX_FRAMESKIP); + strcatprintf(str, "skip %d/%d", effective_frameskip(), MAX_FRAMESKIP); // append the speed for all cases except paused if (!paused) - str.catprintf("%4d%%", (int)(100 * m_speed_percent + 0.5)); + strcatprintf(str, "%4d%%", (int)(100 * m_speed_percent + 0.5)); // display the number of partial updates as well int partials = 0; @@ -288,7 +288,7 @@ astring &video_manager::speed_text(astring &str) for (screen_device *screen = iter.first(); screen != NULL; screen = iter.next()) partials += screen->partial_updates(); if (partials > 1) - str.catprintf("\n%d partial updates", partials); + strcatprintf(str, "\n%d partial updates", partials); return str; } @@ -308,8 +308,8 @@ void video_manager::save_snapshot(screen_device *screen, emu_file &file) create_snapshot_bitmap(screen); // add two text entries describing the image - astring text1 = astring(emulator_info::get_appname()).cat(" ").cat(build_version); - astring text2 = astring(machine().system().manufacturer).cat(" ").cat(machine().system().description); + std::string text1 = std::string(emulator_info::get_appname()).append(" ").append(build_version); + std::string text2 = std::string(machine().system().manufacturer).append(" ").append(machine().system().description); png_info pnginfo = { 0 }; png_add_text(&pnginfo, "Software", text1.c_str()); png_add_text(&pnginfo, "System", text2.c_str()); @@ -398,7 +398,7 @@ void video_manager::begin_recording(const char *name, movie_format format) // create a new temporary movie file file_error filerr; - astring fullpath; + std::string fullpath; { emu_file tempfile(machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (name != NULL) @@ -1117,30 +1117,30 @@ file_error video_manager::open_next(emu_file &file, const char *extension) if (snapname == NULL || snapname[0] == 0) snapname = "%g/%i"; - astring snapstr(snapname); + std::string snapstr(snapname); // strip any extension in the provided name - int index = snapstr.rchr(0, '.'); + int index = snapstr.find_last_of('.'); if (index != -1) - snapstr.substr(0, index); + snapstr = snapstr.substr(0, index); // handle %d in the template (for image devices) - astring snapdev("%d_"); - int pos = snapstr.find(0, snapdev.c_str()); + std::string snapdev("%d_"); + int pos = snapstr.find(snapdev.c_str()); if (pos != -1) { // if more %d are found, revert to default and ignore them all - if (snapstr.find(pos + 3, snapdev.c_str()) != -1) - snapstr.cpy("%g/%i"); + if (snapstr.find(snapdev.c_str(), pos + 3) != -1) + snapstr.assign("%g/%i"); // else if there is a single %d, try to create the correct snapname else { int name_found = 0; // find length of the device name - int end1 = snapstr.find(pos + 3, "/"); - int end2 = snapstr.find(pos + 3, "%"); + int end1 = snapstr.find("/", pos + 3); + int end2 = snapstr.find("%", pos + 3); int end = -1; if ((end1 != -1) && (end2 != -1)) @@ -1150,14 +1150,14 @@ file_error video_manager::open_next(emu_file &file, const char *extension) else if (end2 != -1) end = end2; else - end = snapstr.len(); + end = snapstr.length(); if (end - pos < 3) fatalerror("Something very wrong is going on!!!\n"); - // copy the device name to an astring - astring snapdevname; - snapdevname.cpysubstr(snapstr, pos + 3, end - pos - 3); + // copy the device name to an std::string + std::string snapdevname; + snapdevname.assign(snapstr.substr(pos + 3, end - pos - 3)); //printf("check template: %s\n", snapdevname.c_str()); // verify that there is such a device for this system @@ -1165,22 +1165,22 @@ file_error video_manager::open_next(emu_file &file, const char *extension) for (device_image_interface *image = iter.first(); image != NULL; image = iter.next()) { // get the device name - astring tempdevname(image->brief_instance_name()); + std::string tempdevname(image->brief_instance_name()); //printf("check device: %s\n", tempdevname.c_str()); - if (snapdevname.cmp(tempdevname) == 0) + if (snapdevname.compare(tempdevname) == 0) { // verify that such a device has an image mounted if (image->basename() != NULL) { - astring filename(image->basename()); + std::string filename(image->basename()); // strip extension - filename.substr(0, filename.rchr(0, '.')); + filename = filename.substr(0, filename.find_last_of('.')); // setup snapname and remove the %d_ - snapstr.replace(0, snapdevname.c_str(), filename.c_str()); - snapstr.del(pos, 3); + strreplace(snapstr, snapdevname.c_str(), filename.c_str()); + snapstr.erase(pos, 3); //printf("check image: %s\n", filename.c_str()); name_found = 1; @@ -1190,32 +1190,34 @@ file_error video_manager::open_next(emu_file &file, const char *extension) // or fallback to default if (name_found == 0) - snapstr.cpy("%g/%i"); + snapstr.assign("%g/%i"); } } // add our own extension - snapstr.cat(".").cat(extension); + snapstr.append(".").append(extension); // substitute path and gamename up front - snapstr.replace(0, "/", PATH_SEPARATOR); - snapstr.replace(0, "%g", machine().basename()); + strreplace(snapstr, "/", PATH_SEPARATOR); + strreplace(snapstr, "%g", machine().basename()); // determine if the template has an index; if not, we always use the same name - astring fname; - if (snapstr.find(0, "%i") == -1) - fname.cpy(snapstr); + std::string fname; + if (snapstr.find("%i") == -1) + fname.assign(snapstr); // otherwise, we scan for the next available filename else { // try until we succeed - astring seqtext; + std::string seqtext; file.set_openflags(OPEN_FLAG_READ); for (int seq = 0; ; seq++) { // build up the filename - fname.cpy(snapstr).replace(0, "%i", seqtext.format("%04d", seq).c_str()); + fname.assign(snapstr); + strprintf(seqtext, "%04d", seq); + strreplace(fname, "%i", seqtext.c_str()); // try to open the file; stop when we fail file_error filerr = file.open(fname.c_str()); @@ -1278,8 +1280,8 @@ void video_manager::record_frame() png_info pnginfo = { 0 }; if (m_mng_frame == 0) { - astring text1 = astring(emulator_info::get_appname()).cat(" ").cat(build_version); - astring text2 = astring(machine().system().manufacturer).cat(" ").cat(machine().system().description); + std::string text1 = std::string(emulator_info::get_appname()).append(" ").append(build_version); + std::string text2 = std::string(machine().system().manufacturer).append(" ").append(machine().system().description); png_add_text(&pnginfo, "Software", text1.c_str()); png_add_text(&pnginfo, "System", text2.c_str()); } diff --git a/src/emu/video.h b/src/emu/video.h index a26c7e468bf..4286f774d03 100644 --- a/src/emu/video.h +++ b/src/emu/video.h @@ -81,7 +81,7 @@ public: void frame_update(bool debug = false); // current speed helpers - astring &speed_text(astring &str); + std::string &speed_text(std::string &str); double speed_percent() const { return m_speed_percent; } // snapshots diff --git a/src/emu/webengine.c b/src/emu/webengine.c index 70c6e50f43b..6c04722a5c1 100644 --- a/src/emu/webengine.c +++ b/src/emu/webengine.c @@ -88,7 +88,7 @@ int web_engine::json_game_handler(struct mg_connection *conn) int web_engine::json_slider_handler(struct mg_connection *conn) { const slider_state *curslider; - astring tempstring; + std::string tempstring; Json::Value array(Json::arrayValue); // add all sliders @@ -260,7 +260,7 @@ static int filename_endswith(const char *str, const char *suffix) // This function will be called by mongoose on every new request. int web_engine::begin_request_handler(struct mg_connection *conn) { - astring file_path = astring(mg_get_option(m_server, "document_root")).cat(PATH_SEPARATOR).cat(conn->uri); + std::string file_path = std::string(mg_get_option(m_server, "document_root")).append(PATH_SEPARATOR).append(conn->uri); if (filename_endswith(file_path.c_str(), ".lp")) { FILE *fp = NULL; @@ -440,7 +440,7 @@ int web_engine::begin_request_handler(struct mg_connection *conn) return 0; } - astring fname("screenshot.png"); + std::string fname("screenshot.png"); emu_file file(m_machine->options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); file_error filerr = file.open(fname.c_str()); @@ -450,7 +450,7 @@ int web_engine::begin_request_handler(struct mg_connection *conn) } m_machine->video().save_snapshot(screen, file); - astring fullpath(file.fullpath()); + std::string fullpath(file.fullpath()); file.close(); mg_send_header(conn, "Cache-Control", "no-cache, no-store, must-revalidate"); mg_send_header(conn, "Pragma", "no-cache"); diff --git a/src/lib/formats/ccvf_dsk.c b/src/lib/formats/ccvf_dsk.c index 03ee6fd0dbc..44d919bc88e 100644 --- a/src/lib/formats/ccvf_dsk.c +++ b/src/lib/formats/ccvf_dsk.c @@ -93,18 +93,18 @@ bool ccvf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image) dynamic_buffer img(size); io_generic_read(io, &img[0], 0, size); - astring ccvf = astring((const char *)&img[0], size); + std::string ccvf = std::string((const char *)&img[0], size); dynamic_buffer bytes(78720); int start = 0, end = 0; - astring line; + std::string line; UINT32 byteoffs = 0; char hex[3] = {0}; do { - end = ccvf.chr(start, 10); - line.cpysubstr(ccvf, start, end); - if (line.find(0, "Compucolor Virtual Floppy Disk Image") && line.find(0, "Label") && line.find(0, "Track")) { + end = ccvf.find_first_of(10, start); + line.assign(ccvf.substr(start, end)); + if (line.find("Compucolor Virtual Floppy Disk Image") != std::string::npos && line.find("Label") != std::string::npos && line.find("Track") != std::string::npos) { for (int byte = 0; byte < 32; byte++) { if (byteoffs==78720) break; hex[0]=line[byte * 2]; diff --git a/src/lib/util/astring.c b/src/lib/util/astring.c deleted file mode 100644 index 7f2b3411adf..00000000000 --- a/src/lib/util/astring.c +++ /dev/null @@ -1,483 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -/*************************************************************************** - - astring.c - - Allocated string manipulation functions. - -****************************************************************************/ - -#include "astring.h" -#include "osdcore.h" - -#include <string.h> -#include <stdarg.h> -#include <stdlib.h> -#include <ctype.h> -#include <new> - - -/*************************************************************************** - GLOBAL VARIABLES -***************************************************************************/ - -static const astring dummy_astring; - - - -//************************************************************************** -// INLINE FUNCTIONS -//************************************************************************** - -//------------------------------------------------- -// ensure_room - ensure we have room for a -// given string, or else reallocate our buffer -//------------------------------------------------- - -bool astring::ensure_room(int length) -{ - // always fail to expand the dummy - if (this == &dummy_astring) - return false; - - // if we have the room, do nothing - if (m_alloclen >= length + 1) - return true; - - // allocate a new buffer with some slop - int alloclen = length + 256; - char *newbuf = new char[alloclen]; - - // swap in the new buffer and free the old one - char *oldbuf = (m_text == m_smallbuf) ? NULL : m_text; - m_text = strcpy(newbuf, m_text); - m_len = strlen(m_text); - m_alloclen = alloclen; - delete[] oldbuf; - - return true; -} - - -//------------------------------------------------- -// safe_string_base - return a "safe" string -// base for a given start index -//------------------------------------------------- - -inline char *astring::safe_string_base(int start) const -{ - int max = len(); - return (start >= 0 && start < max) ? m_text + start : m_text + max; -} - - -//------------------------------------------------- -// normalize_substr - normalize substr parameters -//------------------------------------------------- - -inline void astring::normalize_substr(int &start, int &count, int length) const -{ - // limit start - if (start < 0) - start = 0; - else if (start > length) - start = length; - - // update count - if (count == -1 || start + count > length) - count = length - start; -} - - - -//************************************************************************** -// ASTRING ALLOCATION -//************************************************************************** - -//------------------------------------------------- -// init - constructor helper -//------------------------------------------------- - -astring &astring::init() -{ - // initialize ourselves to point to the internal buffer - m_text = m_smallbuf; - m_alloclen = ARRAY_LENGTH(m_smallbuf); - m_smallbuf[0] = 0; - m_len = 0; - return *this; -} - - -//------------------------------------------------- -// ~astring - destructor -//------------------------------------------------- - -astring::~astring() -{ - if (m_text != m_smallbuf) - delete[] m_text; -} - - - -/*************************************************************************** - INLINE ASTRING CHANGES -***************************************************************************/ - -//------------------------------------------------- -// cpy - copy a character array into an astring -//------------------------------------------------- - -astring &astring::cpy(const char *src, int count) -{ - // make room; if we fail or if we are the dummy, do nothing - if (!ensure_room(count)) - return *this; - - // copy the raw data and NULL-terminate - if (count > 0 && m_text != src) - memcpy(m_text, src, count); - m_text[count] = 0; - m_len = count; - return *this; -} - - -//------------------------------------------------- -// cpysubstr - copy a substring of one string to -// another -//------------------------------------------------- - -astring &astring::cpysubstr(const astring &src, int start, int count) -{ - normalize_substr(start, count, src.len()); - return cpy(src.m_text + start, count); -} - - -//------------------------------------------------- -// ins - insert a character array into an astring -//------------------------------------------------- - -astring &astring::ins(int insbefore, const char *src, int count) -{ - // make room; if we fail or if we are the dummy, do nothing - int dstlength = len(); - if (!ensure_room(dstlength + count)) - return *this; - - // adjust insbefore to be logical - if (insbefore < 0 || insbefore > dstlength) - insbefore = dstlength; - - // copy the data an NULL-terminate - if (insbefore < dstlength) - memmove(m_text + insbefore + count, m_text + insbefore, dstlength - insbefore); - memcpy(m_text + insbefore, src, count); - m_text[dstlength + count] = 0; - m_len = dstlength + count; - return *this; -} - - -//------------------------------------------------- -// inssubstr - insert a substring of one string -// into another -//------------------------------------------------- - -astring &astring::inssubstr(int insbefore, const astring &src, int start, int count) -{ - normalize_substr(start, count, src.len()); - return ins(insbefore, src.m_text + start, count); -} - - -//------------------------------------------------- -// substr - extract a substring of ourself, -// removing everything else -//------------------------------------------------- - -astring &astring::substr(int start, int count) -{ - // ignore attempts to do this on the dummy - if (this == &dummy_astring) - return *this; - - // normalize parameters - normalize_substr(start, count, len()); - - // move the data and NULL-terminate - if (count > 0 && start > 0) - memmove(m_text, m_text + start, count); - m_text[count] = 0; - m_len = count; - return *this; -} - - -//------------------------------------------------- -// del - delete a substring of ourself, keeping -// everything else -//------------------------------------------------- - -astring &astring::del(int start, int count) -{ - // ignore attempts to do this on the dummy - if (this == &dummy_astring) - return *this; - - // normalize parameters - int strlength = len(); - normalize_substr(start, count, strlength); - - // move the data and NULL-terminate - if (count > 0) - memmove(m_text + start, m_text + start + count, strlength - (start + count)); - m_text[strlength - count] = 0; - m_len = strlength - count; - return *this; -} - - -//------------------------------------------------- -// vprintf - vprintf text into an astring -//-------------------------------------------------*/ - -int astring::vprintf(const char *format, va_list args) -{ - // sprintf into the temporary buffer - char tempbuf[4096]; - int result = vsprintf(tempbuf, format, args); - - // set the result - cpy(tempbuf); - return result; -} - - -//------------------------------------------------- -// catprintf - formatted vprintf to the end of -// an astring -//------------------------------------------------- - -int astring::catvprintf(const char *format, va_list args) -{ - // sprintf into the temporary buffer - char tempbuf[4096]; - int result = vsprintf(tempbuf, format, args); - - // append the result - cat(tempbuf); - return result; -} - - - -/*************************************************************************** - ASTRING QUERIES -***************************************************************************/ - -//------------------------------------------------- -// cmp - compare a character array to an astring -//------------------------------------------------- - -int astring::cmp(const char *str2, int count) const -{ - // loop while equal until we hit the end of strings - int index; - for (index = 0; index < count; index++) - if (m_text[index] == 0 || m_text[index] != str2[index]) - break; - - // determine the final result - if (index < count) - return m_text[index] - str2[index]; - if (m_text[index] == 0) - return 0; - return 1; -} - - -//------------------------------------------------- -// cmpsubstr - compare a substring to an astring -//------------------------------------------------- - -int astring::cmpsubstr(const astring &str2, int start, int count) const -{ - normalize_substr(start, count, str2.len()); - return cmp(str2.m_text + start, count); -} - - -//------------------------------------------------- -// icmp - compare a character array to an astring -//------------------------------------------------- - -int astring::icmp(const char *str2, int count) const -{ - // loop while equal until we hit the end of strings - int index; - for (index = 0; index < count; index++) - if (m_text[index] == 0 || tolower(m_text[index]) != tolower(str2[index])) - break; - - // determine the final result - if (index < count) - return tolower(m_text[index]) - tolower(str2[index]); - if (m_text[index] == 0) - return 0; - return 1; -} - - -//------------------------------------------------- -// icmpsubstr - compare a substring to an astring -//------------------------------------------------- - -int astring::icmpsubstr(const astring &str2, int start, int count) const -{ - normalize_substr(start, count, str2.len()); - return icmp(str2.m_text + start, count); -} - - -//------------------------------------------------- -// chr - return the index of a character in an -// astring -//------------------------------------------------- - -int astring::chr(int start, int ch) const -{ - char *result = strchr(safe_string_base(start), ch); - return (result != NULL) ? (result - m_text) : -1; -} - - -//------------------------------------------------- -// rchr - return the index of a character in an -// astring, searching from the end -//------------------------------------------------- - -int astring::rchr(int start, int ch) const -{ - char *result = strrchr(safe_string_base(start), ch); - return (result != NULL) ? (result - m_text) : -1; -} - - -//------------------------------------------------- -// find - find a C string in an astring -//-------------------------------------------------*/ - -int astring::find(int start, const char *search) const -{ - char *result = strstr(safe_string_base(start), search); - return (result != NULL) ? (result - m_text) : -1; -} - - -//------------------------------------------------- -// replacec - search in an astring for a C string, -// replacing all instances with another C string -// and returning the number of matches -//------------------------------------------------- - -int astring::replace(int start, const char *search, const char *replace) -{ - int searchlen = strlen(search); - int replacelen = strlen(replace); - int matches = 0; - - for (int curindex = find(start, search); curindex != -1; curindex = find(curindex + replacelen, search)) - { - matches++; - del(curindex, searchlen).ins(curindex, replace); - } - return matches; -} - - - -//************************************************************************** -// ASTRING UTILITIES -//************************************************************************** - -//------------------------------------------------- -// delchr - delete all instances of 'ch' -//------------------------------------------------- - -astring &astring::delchr(int ch) -{ - // simple deletion - char *dst = m_text; - for (char *src = m_text; *src != 0; src++) - if (*src != ch) - *dst++ = *src; - *dst = 0; - m_len = strlen(m_text); - return *this; -} - - -//------------------------------------------------- -// replacechr - replace all instances of 'ch' -// with 'newch' -//------------------------------------------------- - -astring &astring::replacechr(int ch, int newch) -{ - // simple replacement - for (char *text = m_text; *text != 0; text++) - if (*text == ch) - *text = newch; - return *this; -} - - -//------------------------------------------------- -// makeupper - convert string to all upper-case -//------------------------------------------------- - -astring &astring::makeupper() -{ - // just makeupper() on all characters - for (char *text = m_text; *text != 0; text++) - *text = toupper((UINT8)*text); - return *this; -} - - -//------------------------------------------------- -// makelower - convert string to all lower-case -//------------------------------------------------- - -astring &astring::makelower() -{ - // just tolower() on all characters - for (char *text = m_text; *text != 0; text++) - *text = tolower((UINT8)*text); - return *this; -} - - -//------------------------------------------------- -// trimspace - remove all space characters from -// beginning/end -//------------------------------------------------- - -astring &astring::trimspace() -{ - // first remove stuff from the end - for (char *ptr = m_text + len() - 1; ptr >= m_text && (!(*ptr & 0x80) && isspace(UINT8(*ptr))); ptr--) - *ptr = 0; - - // then count how much to remove from the beginning - char *ptr; - for (ptr = m_text; *ptr != 0 && (!(*ptr & 0x80) && isspace(UINT8(*ptr))); ptr++) ; - if (ptr > m_text) - substr(ptr - m_text); - m_len = strlen(m_text); - return *this; -} diff --git a/src/lib/util/astring.h b/src/lib/util/astring.h deleted file mode 100644 index 1988f73840d..00000000000 --- a/src/lib/util/astring.h +++ /dev/null @@ -1,157 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -/*************************************************************************** - - astring.h - - Allocated string manipulation functions. - -***************************************************************************/ - -#pragma once - -#ifndef __ASTRING_H__ -#define __ASTRING_H__ - -#include <stdarg.h> -#include <ctype.h> -#include "osdcomm.h" - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// basic allocated string class -class astring -{ -public: - // simple construction/destruction - astring() { init(); } - ~astring(); - - // construction with copy - astring(const char *string) { init(); if(string) cpy(string); } - astring(const char *string, int length) { init().cpy(string, length); } - astring(const astring &string) { init().cpy(string); } - astring(const astring &string, int start, int count = -1) { init().cpysubstr(string, start, count); } - - // assignment operators - astring &operator=(const char *string) { return cpy(string); } - astring &operator=(const astring &string) { return cpy(string); } - - // concatenation operators - astring& operator+=(const astring &string) { return cat(string); } - friend astring operator+(const astring &lhs, const astring &rhs) { return astring(lhs) += rhs; } - friend astring operator+(const astring &lhs, const char *rhs) { return astring(lhs) += rhs; } - friend astring operator+(const char *lhs, const astring &rhs) { return astring(lhs) += rhs; } - - // comparison operators -// bool operator==(const char *string) const { return (cmp(string) == 0); } -// bool operator==(const astring &string) const { return (cmp(string) == 0); } -// bool operator!=(const char *string) const { return (cmp(string) != 0); } -// bool operator!=(const astring &string) const { return (cmp(string) != 0); } -// bool operator<(const char *string) const { return (cmp(string) < 0); } -// bool operator<(const astring &string) const { return (cmp(string) < 0); } -// bool operator<=(const char *string) const { return (cmp(string) <= 0); } -// bool operator<=(const astring &string) const { return (cmp(string) <= 0); } -// bool operator>(const char *string) const { return (cmp(string) > 0); } -// bool operator>(const astring &string) const { return (cmp(string) > 0); } -// bool operator>=(const char *string) const { return (cmp(string) >= 0); } -// bool operator>=(const astring &string) const { return (cmp(string) >= 0); } - - // character access operators - char operator[](int index) const { return (index < len()) ? m_text[index] : 0; } - - // implicit boolean conversion operators - //operator bool() { return m_text[0] != 0; } - //operator bool() const { return m_text[0] != 0; } - - // C string conversion operators and helpers - const char *c_str() const { return m_text; } - - // buffer management - astring &reset() { return cpy(""); } - astring &expand(int length) { ensure_room(length); return *this; } - - // length query - int len() const { return m_len; } - bool empty() const { return m_len==0; } - - // copy helpers - astring &cpy(const char *src, int count); - astring &cpysubstr(const astring &src, int start, int count = -1); - astring &cpy(const astring &src) { return cpy(src.c_str(), src.len()); } - astring &cpy(const char *src) { return cpy(src, strlen(src)); } - - // insertion helpers - astring &ins(int insbefore, const char *src, int count); - astring &inssubstr(int insbefore, const astring &src, int start, int count = -1); - astring &ins(int insbefore, const astring &src) { return ins(insbefore, src.c_str(), src.len()); } - astring &ins(int insbefore, const char *src) { return ins(insbefore, src, strlen(src)); } - - // concatenation helpers (== insert at end) - astring &cat(const char *src, int count) { return ins(-1, src, count); } - astring &catsubstr(const astring &src, int start, int count = -1) { return inssubstr(-1, src, start, count); } - astring &cat(const astring &src) { return ins(-1, src.c_str(), src.len()); } - astring &cat(const char *src) { return ins(-1, src, strlen(src)); } - astring &cat(char ch) { return ins(-1, &ch, 1); } - - // substring helpers - astring &substr(int start, int count = -1); - astring &del(int start, int count = -1); - - // formatted string helpers - int vprintf(const char *format, va_list args); - int catvprintf(const char *format, va_list args); - int printf(const char *format, ...) ATTR_PRINTF(2,3) { va_list ap; va_start(ap, format); int result = this->vprintf(format, ap); va_end(ap); return result; } - int catprintf(const char *format, ...) ATTR_PRINTF(2,3) { va_list ap; va_start(ap, format); int result = catvprintf(format, ap); va_end(ap); return result; } - astring &format(const char *format, ...) ATTR_PRINTF(2,3) { va_list ap; va_start(ap, format); this->vprintf(format, ap); va_end(ap); return *this; } - astring &catformat(const char *format, ...) ATTR_PRINTF(2,3) { va_list ap; va_start(ap, format); catvprintf(format, ap); va_end(ap); return *this; } - - // comparison helpers - int cmp(const char *str2, int count) const; - int cmpsubstr(const astring &str2, int start, int count = -1) const; - int cmp(const astring &str2) const { return cmp(str2.c_str(), str2.len()); } - int cmp(const char *str2) const { return cmp(str2, strlen(str2)); } - - // case-insensitive comparison helpers - int icmp(const char *str2, int count) const; - int icmpsubstr(const astring &str2, int start, int count = -1) const; - int icmp(const astring &str2) const { return icmp(str2.c_str(), str2.len()); } - int icmp(const char *str2) const { return icmp(str2, strlen(str2)); } - - // character searching helpers - int chr(int start, int ch) const; - int rchr(int start, int ch) const; - - // string searching/replacing helpers - int find(int start, const char *search) const; - int find(const char *search) const { return find(0, search); } - int replace(int start, const char *search, const char *replace); - int replace(const char *search, const char *_replace) { return replace(0, search, _replace); } - - // misc utilities - astring &delchr(int ch); - astring &replacechr(int ch, int newch); - astring &makeupper(); - astring &makelower(); - astring &trimspace(); - -private: - // internal helpers - astring &init(); - char *safe_string_base(int start) const; - bool ensure_room(int length); - void normalize_substr(int &start, int &count, int length) const; - - // internal state - char * m_text; - int m_alloclen; - char m_smallbuf[64]; - int m_len; -}; - - -#endif /* __ASTRING_H__ */ diff --git a/src/lib/util/cdrom.c b/src/lib/util/cdrom.c index ce9a0e7b130..6655418583a 100644 --- a/src/lib/util/cdrom.c +++ b/src/lib/util/cdrom.c @@ -811,7 +811,7 @@ const char *cdrom_get_subtype_string(UINT32 subtype) chd_error cdrom_parse_metadata(chd_file *chd, cdrom_toc *toc) { - astring metadata; + std::string metadata; chd_error err; int i; @@ -983,7 +983,7 @@ chd_error cdrom_write_metadata(chd_file *chd, const cdrom_toc *toc) /* write the metadata */ for (i = 0; i < toc->numtrks; i++) { - astring metadata; + std::string metadata; if (!(toc->flags & CD_FLAG_GDROM)) { char submode[32]; @@ -998,7 +998,7 @@ chd_error cdrom_write_metadata(chd_file *chd, const cdrom_toc *toc) strcpy(submode, cdrom_get_type_string(toc->tracks[i].pgtype)); } - metadata.format(CDROM_TRACK_METADATA2_FORMAT, i + 1, cdrom_get_type_string(toc->tracks[i].trktype), + strprintf(metadata, CDROM_TRACK_METADATA2_FORMAT, i + 1, cdrom_get_type_string(toc->tracks[i].trktype), cdrom_get_subtype_string(toc->tracks[i].subtype), toc->tracks[i].frames, toc->tracks[i].pregap, submode, cdrom_get_subtype_string(toc->tracks[i].pgsub), toc->tracks[i].postgap); @@ -1006,7 +1006,7 @@ chd_error cdrom_write_metadata(chd_file *chd, const cdrom_toc *toc) } else { - metadata.format(GDROM_TRACK_METADATA_FORMAT, i + 1, cdrom_get_type_string(toc->tracks[i].trktype), + strprintf(metadata, GDROM_TRACK_METADATA_FORMAT, i + 1, cdrom_get_type_string(toc->tracks[i].trktype), cdrom_get_subtype_string(toc->tracks[i].subtype), toc->tracks[i].frames, toc->tracks[i].padframes, toc->tracks[i].pregap, cdrom_get_type_string(toc->tracks[i].pgtype), cdrom_get_subtype_string(toc->tracks[i].pgsub), toc->tracks[i].postgap); diff --git a/src/lib/util/chd.c b/src/lib/util/chd.c index 9c5674e7559..3dd088c0121 100644 --- a/src/lib/util/chd.c +++ b/src/lib/util/chd.c @@ -1039,7 +1039,7 @@ chd_error chd_file::write_bytes(UINT64 offset, const void *buffer, UINT32 bytes) // of the given type //------------------------------------------------- -chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, astring &output) +chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, std::string &output) { // wrap this for clean reporting try @@ -1054,7 +1054,7 @@ chd_error chd_file::read_metadata(chd_metadata_tag searchtag, UINT32 searchindex char* metabuf = new char[metaentry.length+1]; memset(metabuf, 0x00, metaentry.length+1); file_read(metaentry.offset + METADATA_HEADER_SIZE, metabuf, metaentry.length); - output.cpy(metabuf); + output.assign(metabuf); delete[] metabuf; return CHDERR_NONE; } @@ -1409,7 +1409,7 @@ const char *chd_file::error_string(chd_error err) UINT32 chd_file::guess_unitbytes() { // look for hard disk metadata; if found, then the unit size == sector size - astring metadata; + std::string metadata; int i0, i1, i2, i3; if (read_metadata(HARD_DISK_METADATA_TAG, 0, metadata) == CHDERR_NONE && sscanf(metadata.c_str(), HARD_DISK_METADATA_FORMAT, &i0, &i1, &i2, &i3) == 4) return i3; diff --git a/src/lib/util/chd.h b/src/lib/util/chd.h index 5062ca9c23a..d767c0889e0 100644 --- a/src/lib/util/chd.h +++ b/src/lib/util/chd.h @@ -15,7 +15,8 @@ #include "osdcore.h" #include "coretmpl.h" -#include "astring.h" +#include "corestr.h" +#include <string> #include "bitmap.h" #include "corefile.h" #include "hashing.h" @@ -347,12 +348,12 @@ public: chd_error write_bytes(UINT64 offset, const void *buffer, UINT32 bytes); // metadata management - chd_error read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, astring &output); + chd_error read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, std::string &output); chd_error read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, dynamic_buffer &output); chd_error read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, void *output, UINT32 outputlen, UINT32 &resultlen); chd_error read_metadata(chd_metadata_tag searchtag, UINT32 searchindex, dynamic_buffer &output, chd_metadata_tag &resulttag, UINT8 &resultflags); chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const void *inputbuf, UINT32 inputlen, UINT8 flags = CHD_MDFLAGS_CHECKSUM); - chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const astring &input, UINT8 flags = CHD_MDFLAGS_CHECKSUM) { return write_metadata(metatag, metaindex, input.c_str(), input.len() + 1, flags); } + chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const std::string &input, UINT8 flags = CHD_MDFLAGS_CHECKSUM) { return write_metadata(metatag, metaindex, input.c_str(), input.length() + 1, flags); } chd_error write_metadata(chd_metadata_tag metatag, UINT32 metaindex, const dynamic_buffer &input, UINT8 flags = CHD_MDFLAGS_CHECKSUM) { return write_metadata(metatag, metaindex, &input[0], input.size(), flags); } chd_error delete_metadata(chd_metadata_tag metatag, UINT32 metaindex); chd_error clone_all_metadata(chd_file &source); diff --git a/src/lib/util/chdcd.c b/src/lib/util/chdcd.c index bd2cf2a3837..992c95bfeae 100644 --- a/src/lib/util/chdcd.c +++ b/src/lib/util/chdcd.c @@ -38,13 +38,13 @@ static char linebuffer[512]; IMPLEMENTATION ***************************************************************************/ -static astring get_file_path(astring &path) +static std::string get_file_path(std::string &path) { - int pos = path.rchr( 0, '\\'); + int pos = path.find_last_of('\\'); if (pos!=-1) { path = path.substr(0,pos+1); } else { - pos = path.rchr( 0, '/'); + pos = path.find_last_of('/'); path = path.substr(0,pos+1); } return path; @@ -360,7 +360,7 @@ chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc &outtoc, chdcd_track_ UINT32 chain_offs, chunk_size; int done = 0; - astring path = astring(tocfname); + std::string path = std::string(tocfname); infile = fopen(tocfname, "rb"); path = get_file_path(path); @@ -437,7 +437,7 @@ chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc &outtoc, chdcd_track_ track_end = read_uint64(infile); // printf("Track %d: sector size %d mode %x index0 %llx index1 %llx track_end %llx (pregap %d sectors, length %d sectors)\n", track, size, mode, index0, index1, track_end, (UINT32)(index1-index0)/size, (UINT32)(track_end-index1)/size); - outinfo.track[track-1].fname.cpy(tocfname); + outinfo.track[track-1].fname.assign(tocfname); outinfo.track[track-1].offset = offset + (UINT32)(index1-index0); outinfo.track[track-1].idx0offs = 0; outinfo.track[track-1].idx1offs = 0; @@ -530,7 +530,7 @@ chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc &outtoc, chdcd_track_ chd_error chdcd_parse_iso(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo) { FILE *infile; - astring path = astring(tocfname); + std::string path = std::string(tocfname); infile = fopen(tocfname, "rb"); path = get_file_path(path); @@ -597,7 +597,7 @@ static chd_error chdcd_parse_gdi(const char *tocfname, cdrom_toc &outtoc, chdcd_ FILE *infile; int i, numtracks; - astring path = astring(tocfname); + std::string path = std::string(tocfname); infile = fopen(tocfname, "rt"); path = get_file_path(path); @@ -663,7 +663,7 @@ static chd_error chdcd_parse_gdi(const char *tocfname, cdrom_toc &outtoc, chdcd_ outinfo.track[trknum].swap = true; } - astring name; + std::string name; tok=strtok(NULL," "); name = tok; @@ -675,9 +675,9 @@ static chd_error chdcd_parse_gdi(const char *tocfname, cdrom_toc &outtoc, chdcd_ name += tok; } } while(tok!=NULL && (strrchr(tok,'"')-tok !=(strlen(tok)-1))); - name = name.delchr('"'); + strdelchr(name,'"'); } - outinfo.track[trknum].fname.cpy(path).cat(name); + outinfo.track[trknum].fname.assign(path).append(name); sz = get_file_size(outinfo.track[trknum].fname.c_str()); @@ -717,9 +717,9 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i FILE *infile; int i, trknum; static char token[512]; - astring lastfname; + std::string lastfname; UINT32 wavlen, wavoffs; - astring path = astring(tocfname); + std::string path = std::string(tocfname); infile = fopen(tocfname, "rt"); path = get_file_path(path); @@ -753,7 +753,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i TOKENIZE /* keep the filename */ - lastfname.cpy(path).cat(token); + lastfname.assign(path).append(token); /* get the file type */ TOKENIZE @@ -810,7 +810,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i outinfo.track[trknum].idx0offs = -1; outinfo.track[trknum].idx1offs = 0; - outinfo.track[trknum].fname.cpy(lastfname); // default filename to the last one + outinfo.track[trknum].fname.assign(lastfname); // default filename to the last one // printf("trk %d: fname %s offset %d\n", trknum, outinfo.track[trknum].fname.c_str(), outinfo.track[trknum].offset); @@ -925,7 +925,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i if (trknum == (outtoc.numtrks-1)) { /* if we have the same filename as the last track, do it that way */ - if (trknum != 0 && (outinfo.track[trknum].fname.cmp(outinfo.track[trknum-1].fname)==0)) + if (trknum != 0 && (outinfo.track[trknum].fname.compare(outinfo.track[trknum-1].fname)==0)) { tlen = get_file_size(outinfo.track[trknum].fname.c_str()); if (tlen == 0) @@ -952,7 +952,7 @@ chd_error chdcd_parse_cue(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i else { /* if we have the same filename as the next track, do it that way */ - if (outinfo.track[trknum].fname.cmp(outinfo.track[trknum+1].fname)==0) + if (outinfo.track[trknum].fname.compare(outinfo.track[trknum+1].fname)==0) { outtoc.tracks[trknum].frames = outinfo.track[trknum+1].idx0offs - outinfo.track[trknum].idx0offs; @@ -1028,7 +1028,7 @@ chd_error chdcd_parse_toc(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i return chdcd_parse_iso(tocfname, outtoc, outinfo); } - astring path = astring(tocfname); + std::string path = std::string(tocfname); infile = fopen(tocfname, "rt"); path = get_file_path(path); @@ -1064,7 +1064,7 @@ chd_error chdcd_parse_toc(const char *tocfname, cdrom_toc &outtoc, chdcd_track_i TOKENIZE /* keep the filename */ - outinfo.track[trknum].fname.cpy(path).cat(token); + outinfo.track[trknum].fname.assign(path).append(token); /* get either the offset or the length */ TOKENIZE diff --git a/src/lib/util/chdcd.h b/src/lib/util/chdcd.h index d32fc6c0c73..b0f3623ce61 100644 --- a/src/lib/util/chdcd.h +++ b/src/lib/util/chdcd.h @@ -17,9 +17,9 @@ struct chdcd_track_input_entry { chdcd_track_input_entry() { reset(); } - void reset() { fname.reset(); offset = idx0offs = idx1offs = 0; swap = false; } + void reset() { fname.clear(); offset = idx0offs = idx1offs = 0; swap = false; } - astring fname; // filename for each track + std::string fname; // filename for each track UINT32 offset; // offset in the data file for each track bool swap; // data needs to be byte swapped UINT32 idx0offs; diff --git a/src/lib/util/chdcodec.c b/src/lib/util/chdcodec.c index df253489f7e..3a7781fced8 100644 --- a/src/lib/util/chdcodec.c +++ b/src/lib/util/chdcodec.c @@ -1619,7 +1619,7 @@ UINT32 chd_avhuff_compressor::compress(const UINT8 *src, UINT32 srclen, UINT8 *d void chd_avhuff_compressor::postinit() { // get the metadata - astring metadata; + std::string metadata; chd_error err = chd().read_metadata(AV_METADATA_TAG, 0, metadata); if (err != CHDERR_NONE) throw err; diff --git a/src/lib/util/corefile.c b/src/lib/util/corefile.c index 491c35cacbf..4ada0f36aae 100644 --- a/src/lib/util/corefile.c +++ b/src/lib/util/corefile.c @@ -888,7 +888,7 @@ int CLIB_DECL core_fprintf(core_file *f, const char *fmt, ...) assumptions about path separators -------------------------------------------------*/ -astring &core_filename_extract_base(astring &result, const char *name, bool strip_extension) +std::string &core_filename_extract_base(std::string &result, const char *name, bool strip_extension) { /* find the start of the name */ const char *start = name + strlen(name); @@ -896,11 +896,11 @@ astring &core_filename_extract_base(astring &result, const char *name, bool stri start--; /* copy the rest into an astring */ - result.cpy(start); + result.assign(start); /* chop the extension if present */ if (strip_extension) - result.substr(0, result.rchr(0, '.')); + result = result.substr(0, result.find_last_of('.')); return result; } diff --git a/src/lib/util/corefile.h b/src/lib/util/corefile.h index 07ac491e1f2..42dfd70aef8 100644 --- a/src/lib/util/corefile.h +++ b/src/lib/util/corefile.h @@ -14,7 +14,8 @@ #define __COREFILE_H__ #include <stdarg.h> -#include "astring.h" +#include "corestr.h" +#include <string> #include "coretmpl.h" @@ -121,7 +122,7 @@ int CLIB_DECL core_fprintf(core_file *f, const char *fmt, ...) ATTR_PRINTF(2,3); /* ----- filename utilities ----- */ /* extract the base part of a filename (remove extensions and paths) */ -astring &core_filename_extract_base(astring &result, const char *name, bool strip_extension = false); +std::string &core_filename_extract_base(std::string &result, const char *name, bool strip_extension = false); /* true if the given filename ends with a particular extension */ int core_filename_ends_with(const char *filename, const char *extension); diff --git a/src/lib/util/corestr.c b/src/lib/util/corestr.c index a8e49f9b1f6..84feda50939 100644 --- a/src/lib/util/corestr.c +++ b/src/lib/util/corestr.c @@ -191,3 +191,125 @@ char *core_i64_format(UINT64 value, UINT8 mindigits, bool is_octal) { return is_octal ? core_i64_oct_format(value,mindigits) : core_i64_hex_format(value,mindigits); } + +/*------------------------------------------------- + std::string helpers +-------------------------------------------------*/ + +#include <algorithm> + +int strvprintf(std::string &str, const char *format, va_list args) +{ + char tempbuf[4096]; + int result = vsprintf(tempbuf, format, args); + + // set the result + str.assign(tempbuf); + return result; +} + +int strprintf(std::string &str, const char *format, ...) +{ + va_list ap; + va_start(ap, format); + int retVal = strvprintf(str, format, ap); + va_end(ap); + return retVal; +} + +std::string strformat(std::string &str, const char *format, ...) +{ + std::string retVal; + va_list ap; + va_start(ap, format); + strvprintf(str, format, ap); + va_end(ap); + retVal.assign(str); + return retVal; +} + +int strcatvprintf(std::string &str, const char *format, va_list args) +{ + char tempbuf[4096]; + int result = vsprintf(tempbuf, format, args); + + // set the result + str.append(tempbuf); + return result; +} + +int strcatprintf(std::string &str, const char *format, ...) +{ + va_list ap; + va_start(ap, format); + int retVal = strcatvprintf(str, format, ap); + va_end(ap); + return retVal; +} + +void strdelchr(std::string& str, char chr) +{ + for (size_t i = 0; i < str.length(); i++) + { + if (str[i] == chr) + { + str.erase(i, 1); + i--; + } + } +} + +void strreplacechr(std::string& str, char ch, char newch) +{ + for (size_t i = 0; i < str.length(); i++) + { + if (str[i] == ch) str[i] = newch; + } +} + +std::string strtrimspace(std::string& str) +{ + int start = 0; + for (size_t i = 0; i < str.length(); i++) + { + if (!isspace(UINT8(str[i]))) break; + start++; + } + int end = str.length(); + if (end > 0) + { + for (size_t i = str.length() - 1; i > 0; i--) + { + if (!isspace(UINT8(str[i]))) break; + end--; + } + } + str = str.substr(start, end-start); + return str; +} + +std::string strmakeupper(std::string& str) +{ + std::transform(str.begin(), str.end(), str.begin(), ::toupper); + return str; +} + +std::string strmakelower(std::string& str) +{ + std::transform(str.begin(), str.end(), str.begin(), ::tolower); + return str; +} + +int strreplace(std::string str, const std::string& search, const std::string& replace) +{ + int searchlen = search.length(); + int replacelen = replace.length(); + int matches = 0; + + for (int curindex = str.find(search, 0); curindex != -1; curindex = str.find(search, curindex + replacelen)) + { + matches++; + str.erase(curindex, searchlen).insert(curindex, replace); + } + return matches; +}
\ No newline at end of file diff --git a/src/lib/util/corestr.h b/src/lib/util/corestr.h index e9750b5f85f..b875b25db02 100644 --- a/src/lib/util/corestr.h +++ b/src/lib/util/corestr.h @@ -62,4 +62,19 @@ char *core_i64_format(UINT64 value, UINT8 mindigits, bool is_octal); char *core_i64_hex_format(UINT64 value, UINT8 mindigits); char *core_i64_oct_format(UINT64 value, UINT8 mindigits); +#include <string> + +int strvprintf(std::string &str, const char *format, va_list args); +int strcatvprintf(std::string &str, const char *format, va_list args); +int strprintf(std::string &str, const char *format, ...) ATTR_PRINTF(2, 3); +int strcatprintf(std::string &str, const char *format, ...) ATTR_PRINTF(2, 3); +std::string strformat(std::string &str, const char *format, ...) ATTR_PRINTF(2, 3); + +void strdelchr(std::string& str, char chr); +void strreplacechr(std::string& str, char ch, char newch); +std::string strtrimspace(std::string& str); +std::string strmakeupper(std::string& str); +std::string strmakelower(std::string& str); +int strreplace(std::string str, const std::string& search, const std::string& replace); + #endif /* __CORESTR_H__ */ diff --git a/src/lib/util/harddisk.c b/src/lib/util/harddisk.c index 7fce13ca638..4760a5fd51f 100644 --- a/src/lib/util/harddisk.c +++ b/src/lib/util/harddisk.c @@ -40,7 +40,7 @@ hard_disk_file *hard_disk_open(chd_file *chd) { int cylinders, heads, sectors, sectorbytes; hard_disk_file *file; - astring metadata; + std::string metadata; chd_error err; /* punt if no CHD */ diff --git a/src/lib/util/hashing.c b/src/lib/util/hashing.c index d7be3af1427..b4e2b7a9d6d 100644 --- a/src/lib/util/hashing.c +++ b/src/lib/util/hashing.c @@ -79,11 +79,11 @@ bool sha1_t::from_string(const char *string, int length) // as_string - convert to a string //------------------------------------------------- -const char *sha1_t::as_string(astring &buffer) const +const char *sha1_t::as_string(std::string &buffer) const { - buffer.reset(); + buffer.clear(); for (int i = 0; i < ARRAY_LENGTH(m_raw); i++) - buffer.catformat("%02x", m_raw[i]); + strcatprintf(buffer, "%02x", m_raw[i]); return buffer.c_str(); } @@ -122,11 +122,11 @@ bool md5_t::from_string(const char *string, int length) // as_string - convert to a string //------------------------------------------------- -const char *md5_t::as_string(astring &buffer) const +const char *md5_t::as_string(std::string &buffer) const { - buffer.reset(); + buffer.clear(); for (int i = 0; i < ARRAY_LENGTH(m_raw); i++) - buffer.catformat("%02x", m_raw[i]); + strcatprintf(buffer, "%02x", m_raw[i]); return buffer.c_str(); } @@ -166,9 +166,10 @@ bool crc32_t::from_string(const char *string, int length) // as_string - convert to a string //------------------------------------------------- -const char *crc32_t::as_string(astring &buffer) const -{ - return buffer.format("%08x", m_raw).c_str(); +const char *crc32_t::as_string(std::string &buffer) const +{ + strprintf(buffer, "%08x", m_raw); + return buffer.c_str(); } @@ -218,9 +219,10 @@ bool crc16_t::from_string(const char *string, int length) // as_string - convert to a string //------------------------------------------------- -const char *crc16_t::as_string(astring &buffer) const +const char *crc16_t::as_string(std::string &buffer) const { - return buffer.format("%04x", m_raw).c_str(); + strprintf(buffer, "%04x", m_raw); + return buffer.c_str(); } diff --git a/src/lib/util/hashing.h b/src/lib/util/hashing.h index 78e02c6e145..b0de6a5c3c8 100644 --- a/src/lib/util/hashing.h +++ b/src/lib/util/hashing.h @@ -14,7 +14,8 @@ #define __HASHING_H__ #include "osdcore.h" -#include "astring.h" +#include "corestr.h" +#include <string> #include "md5.h" #include "sha1.h" @@ -33,7 +34,7 @@ struct sha1_t bool operator!=(const sha1_t &rhs) const { return memcmp(m_raw, rhs.m_raw, sizeof(m_raw)) != 0; } operator UINT8 *() { return m_raw; } bool from_string(const char *string, int length = -1); - const char *as_string(astring &buffer) const; + const char *as_string(std::string &buffer) const; UINT8 m_raw[20]; static const sha1_t null; }; @@ -84,7 +85,7 @@ struct md5_t bool operator!=(const md5_t &rhs) const { return memcmp(m_raw, rhs.m_raw, sizeof(m_raw)) != 0; } operator UINT8 *() { return m_raw; } bool from_string(const char *string, int length = -1); - const char *as_string(astring &buffer) const; + const char *as_string(std::string &buffer) const; UINT8 m_raw[16]; static const md5_t null; }; @@ -135,7 +136,7 @@ struct crc32_t crc32_t &operator=(const UINT32 crc) { m_raw = crc; return *this; } operator UINT32() const { return m_raw; } bool from_string(const char *string, int length = -1); - const char *as_string(astring &buffer) const; + const char *as_string(std::string &buffer) const; UINT32 m_raw; static const crc32_t null; }; @@ -181,7 +182,7 @@ struct crc16_t crc16_t &operator=(const UINT16 crc) { m_raw = crc; return *this; } operator UINT16() const { return m_raw; } bool from_string(const char *string, int length = -1); - const char *as_string(astring &buffer) const; + const char *as_string(std::string &buffer) const; UINT16 m_raw; static const crc16_t null; }; diff --git a/src/lib/util/options.c b/src/lib/util/options.c index 3ba8956eb3f..d229624017a 100644 --- a/src/lib/util/options.c +++ b/src/lib/util/options.c @@ -13,7 +13,8 @@ #include <ctype.h> #include <assert.h> #include "options.h" -#include "astring.h" +#include "corestr.h" +#include <string> @@ -63,24 +64,24 @@ core_options::entry::entry(const char *name, const char *description, UINT32 fla if (name != NULL) { // first extract any range - astring namestr(name); - int lparen = namestr.chr(0, '('); - int dash = namestr.chr(lparen + 1, '-'); - int rparen = namestr.chr(dash + 1, ')'); + std::string namestr(name); + int lparen = namestr.find_first_of('(',0); + int dash = namestr.find_first_of('-',lparen + 1); + int rparen = namestr.find_first_of(')',dash + 1); if (lparen != -1 && dash != -1 && rparen != -1) { - m_minimum.cpysubstr(namestr, lparen + 1, dash - (lparen + 1)).trimspace(); - m_maximum.cpysubstr(namestr, dash + 1, rparen - (dash + 1)).trimspace(); - namestr.del(lparen, rparen + 1 - lparen); + strtrimspace(m_minimum.assign(namestr.substr(lparen + 1, dash - (lparen + 1)))); + strtrimspace(m_maximum.assign(namestr.substr(dash + 1, rparen - (dash + 1)))); + namestr.erase(lparen, rparen + 1 - lparen); } // then chop up any semicolon-separated names int semi; int nameindex = 0; - while ((semi = namestr.chr(0, ';')) != -1 && nameindex < ARRAY_LENGTH(m_name)) + while ((semi = namestr.find_first_of(';')) != -1 && nameindex < ARRAY_LENGTH(m_name)) { - m_name[nameindex++].cpysubstr(namestr, 0, semi); - namestr.del(0, semi + 1); + m_name[nameindex++].assign(namestr.substr(0, semi)); + namestr.erase(0, semi + 1); } // finally add the last item @@ -332,11 +333,11 @@ void core_options::set_description(const char *name, const char *description) // command line arguments //------------------------------------------------- -bool core_options::parse_command_line(int argc, char **argv, int priority, astring &error_string) +bool core_options::parse_command_line(int argc, char **argv, int priority, std::string &error_string) { // reset the errors and the command - error_string.reset(); - m_command.reset(); + error_string.clear(); + m_command.clear(); // iterate through arguments int unadorned_index = 0; @@ -352,7 +353,7 @@ bool core_options::parse_command_line(int argc, char **argv, int priority, astri entry *curentry = m_entrymap.find(optionname); if (curentry == NULL) { - error_string.catprintf("Error: unknown option: %s\n", curarg); + strcatprintf(error_string, "Error: unknown option: %s\n", curarg); retval = false; if (!is_unadorned) arg++; continue; @@ -364,7 +365,7 @@ bool core_options::parse_command_line(int argc, char **argv, int priority, astri // can only have one command if (!m_command.empty()) { - error_string.catprintf("Error: multiple commands specified -%s and %s\n", m_command.c_str(), curarg); + strcatprintf(error_string,"Error: multiple commands specified -%s and %s\n", m_command.c_str(), curarg); return false; } m_command = curentry->name(); @@ -381,7 +382,7 @@ bool core_options::parse_command_line(int argc, char **argv, int priority, astri newdata = argv[++arg]; else { - error_string.catprintf("Error: option %s expected a parameter\n", curarg); + strcatprintf(error_string, "Error: option %s expected a parameter\n", curarg); return false; } @@ -397,7 +398,7 @@ bool core_options::parse_command_line(int argc, char **argv, int priority, astri // an INI file //------------------------------------------------- -bool core_options::parse_ini_file(core_file &inifile, int priority, int ignore_priority, astring &error_string) +bool core_options::parse_ini_file(core_file &inifile, int priority, int ignore_priority, std::string &error_string) { // loop over lines in the file char buffer[4096]; @@ -422,7 +423,7 @@ bool core_options::parse_ini_file(core_file &inifile, int priority, int ignore_p // if we hit the end early, print a warning and continue if (*temp == 0) { - error_string.catprintf("Warning: invalid line in INI: %s", buffer); + strcatprintf(error_string,"Warning: invalid line in INI: %s", buffer); continue; } @@ -446,7 +447,7 @@ bool core_options::parse_ini_file(core_file &inifile, int priority, int ignore_p if (curentry == NULL) { if (priority >= ignore_priority) - error_string.catprintf("Warning: unknown option in INI: %s\n", optionname); + strcatprintf(error_string, "Warning: unknown option in INI: %s\n", optionname); continue; } @@ -476,10 +477,10 @@ void core_options::revert(int priority) // the optional diff //------------------------------------------------- -const char *core_options::output_ini(astring &buffer, const core_options *diff) +const char *core_options::output_ini(std::string &buffer, const core_options *diff) { // INI files are complete, so always start with a blank buffer - buffer.reset(); + buffer.clear(); int num_valid_headers = 0; int unadorned_index = 0; @@ -515,8 +516,8 @@ const char *core_options::output_ini(astring &buffer, const core_options *diff) if (last_header != NULL) { if (num_valid_headers++) - buffer.catprintf("\n"); - buffer.catprintf("#\n# %s\n#\n", last_header); + strcatprintf(buffer,"\n"); + strcatprintf(buffer, "#\n# %s\n#\n", last_header); last_header = NULL; } @@ -524,9 +525,9 @@ const char *core_options::output_ini(astring &buffer, const core_options *diff) if (!is_unadorned) { if (strchr(value, ' ') != NULL) - buffer.catprintf("%-25s \"%s\"\n", name, value); + strcatprintf(buffer,"%-25s \"%s\"\n", name, value); else - buffer.catprintf("%-25s %s\n", name, value); + strcatprintf(buffer,"%-25s %s\n", name, value); } } } @@ -540,21 +541,21 @@ const char *core_options::output_ini(astring &buffer, const core_options *diff) // output_help - output option help to a string //------------------------------------------------- -const char *core_options::output_help(astring &buffer) +const char *core_options::output_help(std::string &buffer) { // start empty - buffer.reset(); + buffer.clear(); // loop over all items for (entry *curentry = m_entrylist.first(); curentry != NULL; curentry = curentry->next()) { // header: just print if (curentry->is_header()) - buffer.catprintf("\n#\n# %s\n#\n", curentry->description()); + strcatprintf(buffer,"\n#\n# %s\n#\n", curentry->description()); // otherwise, output entries for all non-deprecated items else if (curentry->description() != NULL) - buffer.catprintf("-%-20s%s\n", curentry->name(), curentry->description()); + strcatprintf(buffer,"-%-20s%s\n", curentry->name(), curentry->description()); } return buffer.c_str(); } @@ -617,13 +618,13 @@ bool core_options::exists(const char *name) const // set_value - set the raw option value //------------------------------------------------- -bool core_options::set_value(const char *name, const char *value, int priority, astring &error_string) +bool core_options::set_value(const char *name, const char *value, int priority, std::string &error_string) { // find the entry first entry *curentry = m_entrymap.find(name); if (curentry == NULL) { - error_string.catprintf("Attempted to set unknown option %s\n", name); + strcatprintf(error_string, "Attempted to set unknown option %s\n", name); return false; } @@ -631,17 +632,17 @@ bool core_options::set_value(const char *name, const char *value, int priority, return validate_and_set_data(*curentry, value, priority, error_string); } -bool core_options::set_value(const char *name, int value, int priority, astring &error_string) +bool core_options::set_value(const char *name, int value, int priority, std::string &error_string) { - astring tempstr; - tempstr.printf("%d", value); + std::string tempstr; + strprintf(tempstr,"%d", value); return set_value(name, tempstr.c_str(), priority, error_string); } -bool core_options::set_value(const char *name, float value, int priority, astring &error_string) +bool core_options::set_value(const char *name, float value, int priority, std::string &error_string) { - astring tempstr; - tempstr.printf("%f", value); + std::string tempstr; + strprintf(tempstr, "%f", value); return set_value(name, tempstr.c_str(), priority, error_string); } @@ -687,7 +688,7 @@ void core_options::append_entry(core_options::entry &newentry) // for boolean options add a "no" variant as well if (newentry.type() == OPTION_BOOLEAN) - m_entrymap.add(astring("no").cat(newentry.name(name)).c_str(), &newentry); + m_entrymap.add(std::string("no").append(newentry.name(name)).c_str(), &newentry); } } @@ -730,17 +731,18 @@ void core_options::copyfrom(const core_options &src) // then set it //------------------------------------------------- -bool core_options::validate_and_set_data(core_options::entry &curentry, const char *newdata, int priority, astring &error_string) +bool core_options::validate_and_set_data(core_options::entry &curentry, const char *newdata, int priority, std::string &error_string) { // trim any whitespace - astring data(newdata); - data.trimspace(); + std::string data(newdata); + strtrimspace(data); + // trim quotes - if (data.chr(0, '"') == 0 && data.rchr(0, '"') == data.len() - 1) + if (data.find_first_of('"') == 0 && data.find_last_of('"') == data.length() - 1) { - data.del(0, 1); - data.del(data.len() - 1, 1); + data.erase(0, 1); + data.erase(data.length() - 1, 1); } // validate the type of data and optionally the range @@ -752,7 +754,7 @@ bool core_options::validate_and_set_data(core_options::entry &curentry, const ch case OPTION_BOOLEAN: if (sscanf(data.c_str(), "%d", &ival) != 1 || ival < 0 || ival > 1) { - error_string.catprintf("Illegal boolean value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.c_str(), curentry.value()); + strcatprintf(error_string, "Illegal boolean value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.c_str(), curentry.value()); return false; } break; @@ -761,12 +763,12 @@ bool core_options::validate_and_set_data(core_options::entry &curentry, const ch case OPTION_INTEGER: if (sscanf(data.c_str(), "%d", &ival) != 1) { - error_string.catprintf("Illegal integer value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.c_str(), curentry.value()); + strcatprintf(error_string, "Illegal integer value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.c_str(), curentry.value()); return false; } if (curentry.has_range() && (ival < atoi(curentry.minimum()) || ival > atoi(curentry.maximum()))) { - error_string.catprintf("Out-of-range integer value for %s: \"%s\" (must be between %s and %s); reverting to %s\n", curentry.name(), data.c_str(), curentry.minimum(), curentry.maximum(), curentry.value()); + strcatprintf(error_string, "Out-of-range integer value for %s: \"%s\" (must be between %s and %s); reverting to %s\n", curentry.name(), data.c_str(), curentry.minimum(), curentry.maximum(), curentry.value()); return false; } break; @@ -775,12 +777,12 @@ bool core_options::validate_and_set_data(core_options::entry &curentry, const ch case OPTION_FLOAT: if (sscanf(data.c_str(), "%f", &fval) != 1) { - error_string.catprintf("Illegal float value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.c_str(), curentry.value()); + strcatprintf(error_string, "Illegal float value for %s: \"%s\"; reverting to %s\n", curentry.name(), data.c_str(), curentry.value()); return false; } if (curentry.has_range() && (fval < atof(curentry.minimum()) || fval > atof(curentry.maximum()))) { - error_string.catprintf("Out-of-range float value for %s: \"%s\" (must be between %s and %s); reverting to %s\n", curentry.name(), data.c_str(), curentry.minimum(), curentry.maximum(), curentry.value()); + strcatprintf(error_string, "Out-of-range float value for %s: \"%s\" (must be between %s and %s); reverting to %s\n", curentry.name(), data.c_str(), curentry.minimum(), curentry.maximum(), curentry.value()); return false; } break; @@ -793,7 +795,7 @@ bool core_options::validate_and_set_data(core_options::entry &curentry, const ch case OPTION_INVALID: case OPTION_HEADER: default: - error_string.catprintf("Attempted to set invalid option %s\n", curentry.name()); + strcatprintf(error_string, "Attempted to set invalid option %s\n", curentry.name()); return false; } diff --git a/src/lib/util/options.h b/src/lib/util/options.h index dafd2214dab..1ef4636e1e6 100644 --- a/src/lib/util/options.h +++ b/src/lib/util/options.h @@ -105,11 +105,11 @@ public: bool m_error_reported; // have we reported an error on this option yet? int m_priority; // priority of the data set const char * m_description; // description for this item - astring m_name[4]; // up to 4 names for the item - astring m_data; // data for this item - astring m_defdata; // default data for this item - astring m_minimum; // minimum value - astring m_maximum; // maximum value + std::string m_name[4]; // up to 4 names for the item + std::string m_data; // data for this item + std::string m_defdata; // default data for this item + std::string m_minimum; // minimum value + std::string m_maximum; // maximum value }; // construction/destruction @@ -138,15 +138,15 @@ public: void remove_entry(entry &delentry); // parsing/input - bool parse_command_line(int argc, char **argv, int priority, astring &error_string); - bool parse_ini_file(core_file &inifile, int priority, int ignore_priority, astring &error_string); + bool parse_command_line(int argc, char **argv, int priority, std::string &error_string); + bool parse_ini_file(core_file &inifile, int priority, int ignore_priority, std::string &error_string); // reverting void revert(int priority = OPTION_PRIORITY_MAXIMUM); // output - const char *output_ini(astring &buffer, const core_options *diff = NULL); - const char *output_help(astring &buffer); + const char *output_ini(std::string &buffer, const core_options *diff = NULL); + const char *output_help(std::string &buffer); // reading const char *value(const char *option) const; @@ -160,9 +160,9 @@ public: // setting void set_command(const char *command); - bool set_value(const char *name, const char *value, int priority, astring &error_string); - bool set_value(const char *name, int value, int priority, astring &error_string); - bool set_value(const char *name, float value, int priority, astring &error_string); + bool set_value(const char *name, const char *value, int priority, std::string &error_string); + bool set_value(const char *name, int value, int priority, std::string &error_string); + bool set_value(const char *name, float value, int priority, std::string &error_string); void set_flag(const char *name, UINT32 mask, UINT32 flags); // misc @@ -174,12 +174,12 @@ private: void reset(); void append_entry(entry &newentry); void copyfrom(const core_options &src); - bool validate_and_set_data(entry &curentry, const char *newdata, int priority, astring &error_string); + bool validate_and_set_data(entry &curentry, const char *newdata, int priority, std::string &error_string); // internal state simple_list<entry> m_entrylist; // head of list of entries tagmap_t<entry *> m_entrymap; // map for fast lookup - astring m_command; // command found + std::string m_command; // command found static const char *const s_option_unadorned[]; // array of unadorned option "names" }; diff --git a/src/lib/util/zippath.c b/src/lib/util/zippath.c index b2097689ac7..fdb5a3b957d 100644 --- a/src/lib/util/zippath.c +++ b/src/lib/util/zippath.c @@ -328,17 +328,21 @@ file_error zippath_fopen(const char *filename, UINT32 openflags, core_file *&fil if (subpath.length() > 0) { std::string temp2; - temp2.assign(mainpath.substr(temp.length()).append(PATH_SEPARATOR).append(subpath)); + mainpath = mainpath.substr(temp.length()); + temp2.assign(mainpath).append(PATH_SEPARATOR).append(subpath); subpath.assign(temp2); } - else - subpath.assign(mainpath.substr(temp.length())); - + else + { + mainpath = mainpath.substr(temp.length()); + subpath.assign(mainpath); + } /* get the new main path, truncating path separators */ len = temp.length(); while (len > 0 && is_zip_file_separator(temp[len - 1])) len--; - mainpath.assign(temp.substr(0, len)); + temp = temp.substr(0, len); + mainpath.assign(temp); } } @@ -562,7 +566,8 @@ static file_error zippath_resolve(const char *path, osd_dir_entry_type &entry_ty i = apath.length(); while (i > 1 && is_path_separator(apath[i - 1])) i--; - apath_trimmed.assign(apath.substr(0, i)); + apath = apath.substr(0, i); + apath_trimmed.assign(apath); /* stat the path */ current_entry = osd_stat(apath_trimmed.c_str()); diff --git a/src/mame/drivers/bfm_sc45_helper.c b/src/mame/drivers/bfm_sc45_helper.c index d46afca2d12..ce7d40f7e9d 100644 --- a/src/mame/drivers/bfm_sc45_helper.c +++ b/src/mame/drivers/bfm_sc45_helper.c @@ -126,7 +126,7 @@ int find_project_string(running_machine &machine, int addrxor, int mode) struct sc4inputinfo { - astring name; + std::string name; bool used; }; @@ -193,7 +193,7 @@ int find_input_strings(running_machine &machine) UINT32 stringaddr = (rom[j + 2] << 16) | rom[j + 3]; sc45helperlog("(port %02x position %02x) unk %04x addr %08x ", port,pos, unk2, stringaddr); - astring tempstring; + std::string tempstring; for (int k = stringaddr; k < stringaddr + 6; k++) { @@ -205,13 +205,13 @@ int find_input_strings(running_machine &machine) } else { - tempstring.cat(chr); + tempstring.push_back(chr); } } - tempstring.trimspace(); - tempstring.makelower(); + strtrimspace(tempstring); + strmakelower(tempstring); //if (pos <= 5) @@ -226,8 +226,8 @@ int find_input_strings(running_machine &machine) { printf("position already used?\n"); - sc4inputs[port][pos].name.cat(" OR "); - sc4inputs[port][pos].name.cat(tempstring); + sc4inputs[port][pos].name.append(" OR "); + sc4inputs[port][pos].name.append(tempstring); } } //else @@ -371,20 +371,20 @@ int find_input_strings(running_machine &machine) struct lampinfo { - astring lampname; - astring lampname_alt; + std::string lampname; + std::string lampname_alt; bool used; int x, y; int width, height; bool draw_label; - astring lamptypename; + std::string lamptypename; int clickport; int clickmask; }; lampinfo lamps[16][16]; -void set_clickable_temp(running_machine &machine, const astring &teststring, int clickport, int clickmask) +void set_clickable_temp(running_machine &machine, const std::string &teststring, int clickport, int clickmask) { for (int y = 0; y < 16; y++) { @@ -438,7 +438,7 @@ int find_lamp_strings(running_machine &machine) sprintf(tmp, "(%02d:%02d)", y, x); - lamps[y][x].lampname = astring(tmp); + lamps[y][x].lampname = std::string(tmp); lamps[y][x].used = false; lamps[y][x].y = (y * 28); lamps[y][x].x = 380 + (x * 24); @@ -476,7 +476,7 @@ int find_lamp_strings(running_machine &machine) //sc45helperlog("(row %02d, col %02d, unused %02x) addr %08x ", row,col, (portpos&0xff00)>>8, stringaddr); - astring tempstring; + std::string tempstring; for (int k = stringaddr; k < stringaddr + 10; k++) { @@ -488,7 +488,7 @@ int find_lamp_strings(running_machine &machine) } else { - tempstring.cat(chr); + tempstring.push_back(chr); } } @@ -499,8 +499,8 @@ int find_lamp_strings(running_machine &machine) lamps[row][col].lampname = tempstring; lamps[row][col].lamptypename = "matrixlamp"; - lamps[row][col].lampname.trimspace(); - lamps[row][col].lampname.makelower(); + strtrimspace(lamps[row][col].lampname); + strmakelower(lamps[row][col].lampname); } else { @@ -879,7 +879,7 @@ int find_reel_strings(running_machine &machine) //sc45helperlog("addr %08x ", stringaddr); - astring tempstring; + std::string tempstring; for (int k = stringaddr; k < stringaddr + 10; k++) { @@ -891,18 +891,18 @@ int find_reel_strings(running_machine &machine) } else { - tempstring.cat(chr); + tempstring.push_back(chr); } } - tempstring.trimspace(); - tempstring.makelower(); + strtrimspace(tempstring); + strmakelower(tempstring); if (tempstring[0] == '!') { - tempstring.delchr('!'); - tempstring.cat("PND"); + strdelchr(tempstring,'!'); + tempstring.append("PND"); } sc45helperlog("%s", tempstring.c_str()); diff --git a/src/mame/drivers/cps3.c b/src/mame/drivers/cps3.c index 21a05f72d53..9df931edfe4 100644 --- a/src/mame/drivers/cps3.c +++ b/src/mame/drivers/cps3.c @@ -777,10 +777,10 @@ void cps3_state::init_common(void) m_nops[0] = 0x00090009; // flash roms - astring tempstr; + std::string tempstr; for (int simmnum = 0; simmnum < 7; simmnum++) for (int chipnum = 0; chipnum < 8; chipnum++) - m_simm[simmnum][chipnum] = machine().device<fujitsu_29f016a_device>(tempstr.format("simm%d.%d", simmnum + 1, chipnum).c_str()); + m_simm[simmnum][chipnum] = machine().device<fujitsu_29f016a_device>(strformat(tempstr,"simm%d.%d", simmnum + 1, chipnum).c_str()); m_eeprom = auto_alloc_array(machine(), UINT32, 0x400/4); machine().device<nvram_device>("eeprom")->set_base(m_eeprom, 0x400); diff --git a/src/mame/etc/template_cpu.c b/src/mame/etc/template_cpu.c index ee76f8fefbd..4c3e3cac81e 100644 --- a/src/mame/etc/template_cpu.c +++ b/src/mame/etc/template_cpu.c @@ -107,12 +107,12 @@ xxx_cpu_device::xxx_cpu_device(const machine_config &mconfig, const char *tag, d } -void xxx_cpu_device::state_string_export(const device_state_entry &entry, astring &str) +void xxx_cpu_device::state_string_export(const device_state_entry &entry, std::string &str) { switch (entry.index()) { case STATE_GENFLAGS: - str.printf("%c%c%c%c", + strprintf(str, "%c%c%c%c", m_flags & 0x80 ? 'S':'.', m_flags & 0x40 ? 'Z':'.', m_flags & 0x20 ? 'V':'.', diff --git a/src/mame/etc/template_cpu.h b/src/mame/etc/template_cpu.h index ff3cadc646c..82900d37406 100644 --- a/src/mame/etc/template_cpu.h +++ b/src/mame/etc/template_cpu.h @@ -42,7 +42,7 @@ protected: virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : ( (spacenum == AS_DATA) ? &m_data_config : NULL ); } // device_state_interface overrides - void state_string_export(const device_state_entry &entry, astring &str); + void state_string_export(const device_state_entry &entry, std::string &str); // device_disasm_interface overrides virtual UINT32 disasm_min_opcode_bytes() const { return 4; } diff --git a/src/mess/drivers/aim65.c b/src/mess/drivers/aim65.c index 951c0204792..933b0b642ca 100644 --- a/src/mess/drivers/aim65.c +++ b/src/mess/drivers/aim65.c @@ -156,8 +156,8 @@ int aim65_state::load_cart(device_image_interface &image, generic_slot_device *s if (image.software_entry() != NULL && image.get_software_region(slot_tag) == NULL) { - astring errmsg; - errmsg.printf("Attempted to load file with wrong extension\nSocket '%s' only accepts files with '.%s' extension", + std::string errmsg; + strprintf(errmsg,"Attempted to load file with wrong extension\nSocket '%s' only accepts files with '.%s' extension", slot_tag, slot_tag); image.seterror(IMAGE_ERROR_UNSPECIFIED, errmsg.c_str()); return IMAGE_INIT_FAIL; diff --git a/src/mess/drivers/pegasus.c b/src/mess/drivers/pegasus.c index 3971ea51613..dc74d93eff0 100644 --- a/src/mess/drivers/pegasus.c +++ b/src/mess/drivers/pegasus.c @@ -433,8 +433,8 @@ int pegasus_state::load_cart(device_image_interface &image, generic_slot_device if (size == 0) { - astring errmsg; - errmsg.printf("Attempted to load a file that does not work in this socket.\nPlease check \"Usage\" field in the software list for the correct socket(s) to use."); + std::string errmsg; + strprintf(errmsg,"Attempted to load a file that does not work in this socket.\nPlease check \"Usage\" field in the software list for the correct socket(s) to use."); image.seterror(IMAGE_ERROR_UNSPECIFIED, errmsg.c_str()); return IMAGE_INIT_FAIL; } diff --git a/src/mess/machine/spec_snqk.c b/src/mess/machine/spec_snqk.c index dfc8ce696f5..480c6188e18 100644 --- a/src/mess/machine/spec_snqk.c +++ b/src/mess/machine/spec_snqk.c @@ -46,22 +46,22 @@ static void log_quickload(running_machine &machine, const char *type, UINT32 start, UINT32 length, UINT32 exec, const char *exec_format) { - astring tempstring; + std::string tempstring; logerror("Loading %04X bytes of RAM at %04X\n", length, start); - tempstring.catprintf("Quickload type: %s Length: %d bytes\n", type, length); - tempstring.catprintf("Start: 0x%04X End: 0x%04X Exec: ", start, start + length - 1); + strcatprintf(tempstring,"Quickload type: %s Length: %d bytes\n", type, length); + strcatprintf(tempstring,"Start: 0x%04X End: 0x%04X Exec: ", start, start + length - 1); logerror("Quickload loaded.\n"); if (!core_stricmp(exec_format, EXEC_NA)) - tempstring.cat("N/A"); + tempstring.append("N/A"); else { logerror("Execution can resume with "); logerror(exec_format, exec); logerror("\n"); - tempstring.catprintf(exec_format, exec); + strcatprintf(tempstring,exec_format, exec); } machine.ui().popup_time(10, "%s", tempstring.c_str()); diff --git a/src/mess/machine/thomson.c b/src/mess/machine/thomson.c index ad18eed60cc..19be7a86354 100644 --- a/src/mess/machine/thomson.c +++ b/src/mess/machine/thomson.c @@ -375,8 +375,8 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state, to7_cartridge ) m_thom_cart_nb_banks = 4; else { - astring errmsg; - errmsg.printf("Invalid cartridge size %u", size); + std::string errmsg; + strprintf(errmsg,"Invalid cartridge size %u", size); image.seterror(IMAGE_ERROR_UNSUPPORTED, errmsg.c_str()); return IMAGE_INIT_FAIL; } @@ -1516,8 +1516,8 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state, mo5_cartridge ) m_thom_cart_nb_banks = 4; else { - astring errmsg; - errmsg.printf("Invalid cartridge size %" I64FMT "d", size); + std::string errmsg; + strprintf(errmsg,"Invalid cartridge size %" I64FMT "d", size); image.seterror(IMAGE_ERROR_UNSUPPORTED, errmsg.c_str()); return IMAGE_INIT_FAIL; } diff --git a/src/mess/tools/imgtool/imghd.c b/src/mess/tools/imgtool/imghd.c index e96ecc8f51c..f07334d68ef 100644 --- a/src/mess/tools/imgtool/imghd.c +++ b/src/mess/tools/imgtool/imghd.c @@ -52,7 +52,7 @@ imgtoolerr_t imghd_create(imgtool_stream *stream, UINT32 hunksize, UINT32 cylind chd_error rc; UINT64 logicalbytes; int hunknum, totalhunks; - astring metadata; + std::string metadata; chd_codec_type compression[4] = { CHD_CODEC_NONE }; /* sanity check args */ @@ -92,7 +92,7 @@ imgtoolerr_t imghd_create(imgtool_stream *stream, UINT32 hunksize, UINT32 cylind } /* write the metadata */ - metadata.format(HARD_DISK_METADATA_FORMAT, cylinders, heads, sectors, seclen); + strprintf(metadata,HARD_DISK_METADATA_FORMAT, cylinders, heads, sectors, seclen); err = (imgtoolerr_t)chd.write_metadata(HARD_DISK_METADATA_TAG, 0, metadata); if (rc != CHDERR_NONE) { diff --git a/src/osd/modules/debugger/debugint.c b/src/osd/modules/debugger/debugint.c index cbb7a627466..1d25453f443 100644 --- a/src/osd/modules/debugger/debugint.c +++ b/src/osd/modules/debugger/debugint.c @@ -157,7 +157,7 @@ public: { } int active; render_container * container; - astring str; + std::string str; }; /*************************************************************************** @@ -222,7 +222,7 @@ public: rectangle bounds; int ofs_x; int ofs_y; - astring title; + std::string title; int last_x; int last_y; // Scrollbars @@ -459,9 +459,9 @@ static void dview_draw_size(DView *dv) r.width(),r.height(), rgb_t(0xff, 0xff, 0xff, 0x00)); } -static void dview_set_title(DView *dv, astring title) +static void dview_set_title(DView *dv, std::string title) { - if (dv->title.cmp(title) != 0) + if (dv->title.compare(title) != 0) { dv->title = title; dview_set_state(dv, VIEW_STATE_NEEDS_UPDATE, TRUE); @@ -1155,7 +1155,7 @@ static void CreateMainMenu(running_machine &machine) { const char *subtext = ""; int rc; - astring title; + std::string title; if (menu) global_free( menu); @@ -1180,7 +1180,7 @@ static void CreateMainMenu(running_machine &machine) break; } - menu->item_append(title.cat(focus_view->title).c_str(), NULL, MENU_FLAG_DISABLE, NULL); + menu->item_append(title.append(focus_view->title).c_str(), NULL, MENU_FLAG_DISABLE, NULL); menu->item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); switch (focus_view->type) @@ -1295,11 +1295,11 @@ static void handle_editor(running_machine &machine) { case UI_EVENT_CHAR: /* if it's a backspace and we can handle it, do so */ - if ((event.ch == 8 || event.ch == 0x7f) && focus_view->editor.str.len() > 0) + if ((event.ch == 8 || event.ch == 0x7f) && focus_view->editor.str.length() > 0) { /* autoschow */ cur_editor = &focus_view->editor; - cur_editor->str = cur_editor->str.substr(0, cur_editor->str.len()-1); + cur_editor->str = cur_editor->str.substr(0, cur_editor->str.length()-1); } /* if it's any other key and we're not maxed out, update */ else if (event.ch >= ' ' && event.ch < 0x7f) @@ -1310,7 +1310,7 @@ static void handle_editor(running_machine &machine) cur_editor = &focus_view->editor; ret = utf8_from_uchar(buf, 10, event.ch); buf[ret] = 0; - cur_editor->str = cur_editor->str.cat(buf); + cur_editor->str = cur_editor->str.append(buf); } break; default: @@ -1380,7 +1380,7 @@ static void handle_menus(running_machine &machine) static void followers_set_cpu(device_t *device) { - astring title; + std::string title; for (DView *dv = list; dv != NULL; dv = dv->next) { @@ -1392,7 +1392,7 @@ static void followers_set_cpu(device_t *device) case DVT_DISASSEMBLY: case DVT_STATE: dv->view->set_source(*source); - title.printf("%s", source->name()); + strprintf(title, "%s", source->name()); dview_set_title(dv, title); break; } diff --git a/src/osd/modules/debugger/qt/deviceinformationwindow.h b/src/osd/modules/debugger/qt/deviceinformationwindow.h index eb32398e9b3..58fcb764cc8 100644 --- a/src/osd/modules/debugger/qt/deviceinformationwindow.h +++ b/src/osd/modules/debugger/qt/deviceinformationwindow.h @@ -34,7 +34,7 @@ private: class DeviceInformationWindowQtConfig : public WindowQtConfig { public: - astring m_device_tag; + std::string m_device_tag; DeviceInformationWindowQtConfig() : WindowQtConfig(WIN_TYPE_DEVICE_INFORMATION) diff --git a/src/osd/modules/debugger/qt/mainwindow.c b/src/osd/modules/debugger/qt/mainwindow.c index 8e07cd09c3e..45e82504ccf 100644 --- a/src/osd/modules/debugger/qt/mainwindow.c +++ b/src/osd/modules/debugger/qt/mainwindow.c @@ -136,7 +136,7 @@ void MainWindow::setProcessor(device_t* processor) m_dasmFrame->view()->verticalScrollBar()->setValue(m_dasmFrame->view()->view()->visible_position().y); // Window title - astring title; + std::string title; title.printf("Debug: %s - %s '%s'", m_machine->system().name, processor->name(), processor->tag()); setWindowTitle(title.c_str()); } @@ -225,7 +225,7 @@ void MainWindow::toggleBreakpointAtCursor(bool changedTo) } // If none exists, add a new one - astring command; + std::string command; if (bpindex == -1) { command.printf("bpset 0x%X", address); @@ -257,7 +257,7 @@ void MainWindow::enableBreakpointAtCursor(bool changedTo) if (bp != NULL) { INT32 const bpindex = bp->index(); - astring command; + std::string command; command.printf(bp->enabled() ? "bpdisable 0x%X" : "bpenable 0x%X", bpindex); debug_console_execute_command(*m_machine, command.c_str(), 1); } @@ -273,7 +273,7 @@ void MainWindow::runToCursor(bool changedTo) if (dasmView->cursor_visible() && (debug_cpu_get_visible_cpu(*m_machine) == dasmView->source()->device())) { offs_t address = downcast<debug_view_disasm*>(dasmView)->selected_address(); - astring command; + std::string command; command.printf("go 0x%X", address); debug_console_execute_command(*m_machine, command.c_str(), 1); } @@ -463,7 +463,7 @@ void MainWindow::createImagesMenu() image_interface_iterator iter(m_machine->root_device()); for (device_image_interface *img = iter.first(); img != NULL; img = iter.next()) { - astring menuName; + std::string menuName; menuName.format("%s : %s", img->device().name(), img->exists() ? img->filename() : "[empty slot]"); QMenu* interfaceMenu = imagesMenu->addMenu(menuName.c_str()); diff --git a/src/osd/modules/debugger/win/consolewininfo.c b/src/osd/modules/debugger/win/consolewininfo.c index 892eec0768f..a55c7b7885f 100644 --- a/src/osd/modules/debugger/win/consolewininfo.c +++ b/src/osd/modules/debugger/win/consolewininfo.c @@ -44,8 +44,8 @@ consolewin_info::consolewin_info(debugger_windows_interface &debugger) : m_devices_menu = CreatePopupMenu(); for ( ; img != NULL; img = iter.next()) { - astring temp; - temp.format("%s : %s", img->device().name(), img->exists() ? img->filename() : "[no image]"); + std::string temp; + strprintf(temp,"%s : %s", img->device().name(), img->exists() ? img->filename() : "[no image]"); TCHAR *tc_buf = tstring_from_utf8(temp.c_str()); if (tc_buf != NULL) { @@ -107,11 +107,11 @@ void consolewin_info::set_cpu(device_t &device) // then update the caption char curtitle[256]; - astring title; + std::string title; - title.printf("Debug: %s - %s '%s'", device.machine().system().name, device.name(), device.tag()); + strprintf(title, "Debug: %s - %s '%s'", device.machine().system().name, device.name(), device.tag()); win_get_window_text_utf8(window(), curtitle, ARRAY_LENGTH(curtitle)); - if (title.cmp(curtitle) != 0) + if (title.compare(curtitle) != 0) win_set_window_text_utf8(window(), title.c_str()); // and recompute the children @@ -201,8 +201,8 @@ void consolewin_info::update_menu() AppendMenu(devicesubmenu, flags_for_exists, new_item + DEVOPTION_CASSETTE_FASTFORWARD, TEXT("Fast Forward")); } - astring temp; - temp.format("%s :%s", img->device().name(), img->exists() ? img->filename() : "[empty slot]"); + std::string temp; + strprintf(temp,"%s :%s", img->device().name(), img->exists() ? img->filename() : "[empty slot]"); TCHAR *tc_buf = tstring_from_utf8(temp.c_str()); if (tc_buf != NULL) { @@ -227,7 +227,7 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam) { case DEVOPTION_OPEN : { - astring filter; + std::string filter; build_generic_filter(img, false, filter); LPTSTR t_filter = tstring_from_utf8(filter.c_str()); if (t_filter) @@ -314,41 +314,41 @@ void consolewin_info::process_string(char const *string) } -void consolewin_info::build_generic_filter(device_image_interface *img, bool is_save, astring &filter) +void consolewin_info::build_generic_filter(device_image_interface *img, bool is_save, std::string &filter) { // common image types add_filter_entry(filter, "Common image types", img->file_extensions()); // compressed if (!is_save) - filter.cat("Compressed Images (*.zip)|*.zip|"); + filter.append("Compressed Images (*.zip)|*.zip|"); // all files - filter.cat("All files (*.*)|*.*|"); + filter.append("All files (*.*)|*.*|"); } -void consolewin_info::add_filter_entry(astring &dest, const char *description, const char *extensions) +void consolewin_info::add_filter_entry(std::string &dest, const char *description, const char *extensions) { // add the description - dest.cat(description); - dest.catformat(" ("); + dest.append(description); + dest.append(" ("); // add the extensions to the description copy_extension_list(dest, extensions); // add the trailing rparen and '|' character - dest.cat(")|"); + dest.append(")|"); // now add the extension list itself copy_extension_list(dest, extensions); // append a '|' - dest.cat('|'); + dest.append("|"); } -void consolewin_info::copy_extension_list(astring &dest, const char *extensions) +void consolewin_info::copy_extension_list(std::string &dest, const char *extensions) { // our extension lists are comma delimited; Win32 expects to see lists // delimited by semicolons @@ -357,14 +357,14 @@ void consolewin_info::copy_extension_list(astring &dest, const char *extensions) { // append a semicolon if not at the beginning if (s != extensions) - dest.cat(';'); + dest.push_back(';'); // append ".*" - dest.cat("*."); + dest.append("*."); // append the file extension while (*s && (*s != ',')) - dest.cat(*s++); + dest.push_back(*s++); // if we found a comma, advance while(*s == ',') diff --git a/src/osd/modules/debugger/win/consolewininfo.h b/src/osd/modules/debugger/win/consolewininfo.h index b74a189657d..f788b044873 100644 --- a/src/osd/modules/debugger/win/consolewininfo.h +++ b/src/osd/modules/debugger/win/consolewininfo.h @@ -43,9 +43,9 @@ private: virtual void process_string(char const *string); - static void build_generic_filter(device_image_interface *img, bool is_save, astring &filter); - static void add_filter_entry(astring &dest, char const *description, char const *extensions); - static void copy_extension_list(astring &dest, char const *extensions); + static void build_generic_filter(device_image_interface *img, bool is_save, std::string &filter); + static void add_filter_entry(std::string &dest, char const *description, char const *extensions); + static void copy_extension_list(std::string &dest, char const *extensions); HMENU m_devices_menu; }; diff --git a/src/osd/modules/debugger/win/disasmbasewininfo.c b/src/osd/modules/debugger/win/disasmbasewininfo.c index c06c6cf1326..783cc8d75fa 100644 --- a/src/osd/modules/debugger/win/disasmbasewininfo.c +++ b/src/osd/modules/debugger/win/disasmbasewininfo.c @@ -195,11 +195,11 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam) } else if (dasmview->source_is_visible_cpu()) { - astring command; + std::string command; if (bpindex == -1) - command.printf("bpset 0x%X", address); + strprintf(command, "bpset 0x%X", address); else - command.printf("bpclear 0x%X", bpindex); + strprintf(command, "bpclear 0x%X", bpindex); debug_console_execute_command(machine(), command.c_str(), 1); } } @@ -228,8 +228,8 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam) } else if (dasmview->source_is_visible_cpu()) { - astring command; - command.printf(bp->enabled() ? "bpdisable 0x%X" : "bpenable 0x%X", (UINT32)bp->index()); + std::string command; + strprintf(command, bp->enabled() ? "bpdisable 0x%X" : "bpenable 0x%X", (UINT32)bp->index()); debug_console_execute_command(machine(), command.c_str(), 1); } } @@ -242,8 +242,8 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam) offs_t const address = dasmview->selected_address(); if (dasmview->source_is_visible_cpu()) { - astring command; - command.printf("go 0x%X", address); + std::string command; + strprintf(command, "go 0x%X", address); debug_console_execute_command(machine(), command.c_str(), 1); } else diff --git a/src/osd/modules/debugger/win/disasmwininfo.c b/src/osd/modules/debugger/win/disasmwininfo.c index 7b9097a1e67..5d9c72f3fc6 100644 --- a/src/osd/modules/debugger/win/disasmwininfo.c +++ b/src/osd/modules/debugger/win/disasmwininfo.c @@ -145,5 +145,5 @@ void disasmwin_info::process_string(char const *string) void disasmwin_info::update_caption() { - win_set_window_text_utf8(window(), astring("Disassembly: ").cat(m_views[0]->source_name()).c_str()); + win_set_window_text_utf8(window(), std::string("Disassembly: ").append(m_views[0]->source_name()).c_str()); } diff --git a/src/osd/modules/debugger/win/editwininfo.h b/src/osd/modules/debugger/win/editwininfo.h index ff5e20f03ec..f1b729a1f59 100644 --- a/src/osd/modules/debugger/win/editwininfo.h +++ b/src/osd/modules/debugger/win/editwininfo.h @@ -46,7 +46,7 @@ private: static int const HISTORY_LENGTH = 20; HWND m_editwnd; - astring m_edit_defstr; + std::string m_edit_defstr; WNDPROC m_original_editproc; TCHAR m_history[HISTORY_LENGTH][MAX_EDIT_STRING]; int m_history_count; diff --git a/src/osd/modules/debugger/win/logwininfo.c b/src/osd/modules/debugger/win/logwininfo.c index 6621048ac48..c623245db72 100644 --- a/src/osd/modules/debugger/win/logwininfo.c +++ b/src/osd/modules/debugger/win/logwininfo.c @@ -12,7 +12,7 @@ logwin_info::logwin_info(debugger_windows_interface &debugger) : - debugwin_info(debugger, false, astring("Errorlog: ").cat(debugger.machine().system().description).cat(" [").cat(debugger.machine().system().name).cat("]").c_str(), NULL) + debugwin_info(debugger, false, std::string("Errorlog: ").append(debugger.machine().system().description).append(" [").append(debugger.machine().system().name).append("]").c_str(), NULL) { if (!window()) return; diff --git a/src/osd/modules/debugger/win/memorywininfo.c b/src/osd/modules/debugger/win/memorywininfo.c index 1610e2b6002..0c67bdf01da 100644 --- a/src/osd/modules/debugger/win/memorywininfo.c +++ b/src/osd/modules/debugger/win/memorywininfo.c @@ -275,5 +275,5 @@ void memorywin_info::process_string(char const *string) void memorywin_info::update_caption() { - win_set_window_text_utf8(window(), astring("Memory: ").cat(m_views[0]->source_name()).c_str()); + win_set_window_text_utf8(window(), std::string("Memory: ").append(m_views[0]->source_name()).c_str()); } diff --git a/src/osd/modules/debugger/win/pointswininfo.c b/src/osd/modules/debugger/win/pointswininfo.c index 6395603ec6e..5ed28a17e16 100644 --- a/src/osd/modules/debugger/win/pointswininfo.c +++ b/src/osd/modules/debugger/win/pointswininfo.c @@ -14,7 +14,7 @@ pointswin_info::pointswin_info(debugger_windows_interface &debugger) : - debugwin_info(debugger, false, astring("All Breakpoints").c_str(), NULL) + debugwin_info(debugger, false, std::string("All Breakpoints").c_str(), NULL) { if (!window()) return; diff --git a/src/osd/modules/font/font_sdl.c b/src/osd/modules/font/font_sdl.c index ec823243b9f..12571623583 100644 --- a/src/osd/modules/font/font_sdl.c +++ b/src/osd/modules/font/font_sdl.c @@ -18,7 +18,7 @@ #endif -#include "astring.h" +#include "std::string.h" #include "corealloc.h" #include "fileio.h" @@ -39,10 +39,10 @@ public: virtual bool get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); private: #ifndef SDLMAME_HAIKU - TTF_Font *search_font_config(astring name, bool bold, bool italic, bool underline, bool &bakedstyles); + TTF_Font *search_font_config(std::string name, bool bold, bool italic, bool underline, bool &bakedstyles); #endif - bool BDF_Check_Magic(astring name); - TTF_Font * TTF_OpenFont_Magic(astring name, int fsize); + bool BDF_Check_Magic(std::string name); + TTF_Font * TTF_OpenFont_Magic(std::string name, int fsize); TTF_Font *m_font; }; @@ -53,7 +53,7 @@ bool osd_font_sdl::open(const char *font_path, const char *_name, int &height) int style = 0; // accept qualifiers from the name - astring name(_name); + std::string name(_name); if (name.cmp("default")==0) { @@ -77,7 +77,7 @@ bool osd_font_sdl::open(const char *font_path, const char *_name, int &height) emu_file file(font_path, OPEN_FLAG_READ); if (file.open(name.c_str()) == FILERR_NONE) { - astring full_name = file.fullpath(); + std::string full_name = file.fullpath(); font = TTF_OpenFont_Magic(full_name, POINT_SIZE); if (font) osd_printf_verbose("Found font %s\n", full_name.c_str()); @@ -184,7 +184,7 @@ bool osd_font_sdl::get_bitmap(unicode_char chnum, bitmap_argb32 &bitmap, INT32 & return bitmap.valid(); } -TTF_Font * osd_font_sdl::TTF_OpenFont_Magic(astring name, int fsize) +TTF_Font * osd_font_sdl::TTF_OpenFont_Magic(std::string name, int fsize) { emu_file file(OPEN_FLAG_READ); if (file.open(name.c_str()) == FILERR_NONE) @@ -198,7 +198,7 @@ TTF_Font * osd_font_sdl::TTF_OpenFont_Magic(astring name, int fsize) return TTF_OpenFont(name.c_str(), POINT_SIZE); } -bool osd_font_sdl::BDF_Check_Magic(astring name) +bool osd_font_sdl::BDF_Check_Magic(std::string name) { emu_file file(OPEN_FLAG_READ); if (file.open(name.c_str()) == FILERR_NONE) @@ -215,7 +215,7 @@ bool osd_font_sdl::BDF_Check_Magic(astring name) } #ifndef SDLMAME_HAIKU -TTF_Font *osd_font_sdl::search_font_config(astring name, bool bold, bool italic, bool underline, bool &bakedstyles) +TTF_Font *osd_font_sdl::search_font_config(std::string name, bool bold, bool italic, bool underline, bool &bakedstyles) { TTF_Font *font = (TTF_Font *)NULL; FcConfig *config; @@ -269,7 +269,7 @@ TTF_Font *osd_font_sdl::search_font_config(astring name, bool bold, bool italic, osd_printf_verbose("Matching font: %s\n", val.u.s); { - astring match_name((const char*)val.u.s); + std::string match_name((const char*)val.u.s); font = TTF_OpenFont_Magic(match_name, POINT_SIZE); } @@ -306,7 +306,7 @@ TTF_Font *osd_font_sdl::search_font_config(astring name, bool bold, bool italic, osd_printf_verbose("Matching unstyled font: %s\n", val.u.s); { - astring match_name((const char*)val.u.s); + std::string match_name((const char*)val.u.s); font = TTF_OpenFont_Magic(match_name, POINT_SIZE); } diff --git a/src/osd/modules/font/font_windows.c b/src/osd/modules/font/font_windows.c index 162a8956f89..5b0b57823ab 100644 --- a/src/osd/modules/font/font_windows.c +++ b/src/osd/modules/font/font_windows.c @@ -19,7 +19,7 @@ #include "modules/osdmodule.h" #include "strconv.h" -#include "astring.h" +#include "corestr.h" #include "corealloc.h" #include "fileio.h" @@ -46,10 +46,10 @@ private: bool osd_font_windows::open(const char *font_path, const char *_name, int &height) { // accept qualifiers from the name - astring name(_name); - if (name.cmp("default")==0) name = "Tahoma"; - bool bold = (name.replace(0, "[B]", "") + name.replace(0, "[b]", "") > 0); - bool italic = (name.replace(0, "[I]", "") + name.replace(0, "[i]", "") > 0); + std::string name(_name); + if (name.compare("default")==0) name = "Tahoma"; + bool bold = (strreplace(name, "[B]", "") + strreplace(name, "[b]", "") > 0); + bool italic = (strreplace(name, "[I]", "") + strreplace(name, "[i]", "") > 0); // build a basic LOGFONT description of what we want LOGFONT logfont; diff --git a/src/osd/modules/lib/osdobj_common.c b/src/osd/modules/lib/osdobj_common.c index 41f9d4396ba..903ee072d36 100644 --- a/src/osd/modules/lib/osdobj_common.c +++ b/src/osd/modules/lib/osdobj_common.c @@ -245,22 +245,22 @@ void osd_common_t::register_options() void osd_common_t::update_option(const char * key, std::vector<const char *> &values) { - astring current_value(m_options.description(key)); - astring new_option_value(""); + std::string current_value(m_options.description(key)); + std::string new_option_value(""); for (unsigned int index = 0; index < values.size(); index++) { - astring t(values[index]); - if (new_option_value.len() > 0) + std::string t(values[index]); + if (new_option_value.length() > 0) { if( index != (values.size()-1)) - new_option_value.cat(", "); + new_option_value.append(", "); else - new_option_value.cat(" or "); + new_option_value.append(" or "); } - new_option_value.cat(t); + new_option_value.append(t); } // TODO: core_strdup() is leaked - m_options.set_description(key, core_strdup(current_value.cat(new_option_value).c_str())); + m_options.set_description(key, core_strdup(current_value.append(new_option_value).c_str())); } diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h index 366e832fd03..d46463b414d 100644 --- a/src/osd/modules/lib/osdobj_common.h +++ b/src/osd/modules/lib/osdobj_common.h @@ -113,10 +113,10 @@ public: const char *aspect() const { return value(OSDOPTION_ASPECT); } const char *resolution() const { return value(OSDOPTION_RESOLUTION); } const char *view() const { return value(OSDOPTION_VIEW); } - const char *screen(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_SCREEN, index).c_str()); } - const char *aspect(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_ASPECT, index).c_str()); } - const char *resolution(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_RESOLUTION, index).c_str()); } - const char *view(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_VIEW, index).c_str()); } + const char *screen(int index) const { std::string temp; strprintf(temp, "%s%d", OSDOPTION_SCREEN, index); return value(temp.c_str()); } + const char *aspect(int index) const { std::string temp; strprintf(temp, "%s%d", OSDOPTION_ASPECT, index); return value(temp.c_str()); } + const char *resolution(int index) const { std::string temp; strprintf(temp, "%s%d", OSDOPTION_RESOLUTION, index); return value(temp.c_str()); } + const char *view(int index) const { std::string temp; strprintf(temp, "%s%d", OSDOPTION_VIEW, index); return value(temp.c_str()); } // full screen options bool switch_res() const { return bool_value(OSDOPTION_SWITCHRES); } @@ -136,12 +136,12 @@ public: bool gl_pbo() const { return bool_value(OSDOPTION_GL_PBO); } bool gl_glsl() const { return bool_value(OSDOPTION_GL_GLSL); } bool glsl_filter() const { return bool_value(OSDOPTION_GLSL_FILTER); } - const char *shader_mame(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_SHADER_MAME, index).c_str()); } - const char *shader_screen(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_SHADER_SCREEN, index).c_str()); } + const char *shader_mame(int index) const { std::string temp; strprintf(temp, "%s%d", OSDOPTION_SHADER_MAME, index); return value(temp.c_str()); } + const char *shader_screen(int index) const { std::string temp; strprintf(temp, "%s%d", OSDOPTION_SHADER_SCREEN, index); return value(temp.c_str()); } // CoreAudio specific options const char *audio_output() const { return value(OSDOPTION_AUDIO_OUTPUT); } - const char *audio_effect(int index) const { astring temp; return value(temp.format("%s%d", OSDOPTION_AUDIO_EFFECT, index).c_str()); } + const char *audio_effect(int index) const { std::string temp; strprintf(temp, "%s%d", OSDOPTION_AUDIO_EFFECT, index); return value(temp.c_str()); } private: static const options_entry s_option_entries[]; @@ -238,7 +238,7 @@ private: void update_option(const char * key, std::vector<const char *> &values); // FIXME: should be elsewhere - osd_module *select_module_options(const core_options &opts, const astring &opt_name) + osd_module *select_module_options(const core_options &opts, const std::string &opt_name) { std::string opt_val = opts.value(opt_name.c_str()); if (opt_val.compare("auto")==0) @@ -252,7 +252,7 @@ private: } template<class C> - C select_module_options(const core_options &opts, const astring &opt_name) + C select_module_options(const core_options &opts, const std::string &opt_name) { return dynamic_cast<C>(select_module_options(opts, opt_name)); } diff --git a/src/osd/modules/osdmodule.h b/src/osd/modules/osdmodule.h index f8378fb6dcb..64f0f3c99e6 100644 --- a/src/osd/modules/osdmodule.h +++ b/src/osd/modules/osdmodule.h @@ -41,8 +41,8 @@ public: virtual void exit() { } private: - astring m_name; - astring m_type; + std::string m_name; + std::string m_type; }; // a module_type is simply a pointer to its alloc function diff --git a/src/osd/modules/render/d3d/d3dhlsl.c b/src/osd/modules/render/d3d/d3dhlsl.c index b76c3365528..733ccfe0723 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.c +++ b/src/osd/modules/render/d3d/d3dhlsl.c @@ -370,8 +370,8 @@ void shaders::render_snapshot(surface *surface) return; // add two text entries describing the image - astring text1 = astring(emulator_info::get_appname()).cat(" ").cat(build_version); - astring text2 = astring(machine->system().manufacturer).cat(" ").cat(machine->system().description); + std::string text1 = std::string(emulator_info::get_appname()).append(" ").append(build_version); + std::string text2 = std::string(machine->system().manufacturer).append(" ").append(machine->system().description); png_info pnginfo = { 0 }; png_add_text(&pnginfo, "Software", text1.c_str()); png_add_text(&pnginfo, "System", text2.c_str()); @@ -540,7 +540,7 @@ void shaders::begin_avi_recording(const char *name) // create a new temporary movie file file_error filerr; - astring fullpath; + std::string fullpath; { emu_file tempfile(machine->options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (name != NULL) @@ -2394,415 +2394,415 @@ static slider_state *slider_alloc(running_machine &machine, const char *title, I // assorted global slider accessors //============================================================ -static INT32 slider_set(float *option, float scale, const char *fmt, astring *str, INT32 newval) +static INT32 slider_set(float *option, float scale, const char *fmt, std::string *str, INT32 newval) { if (option != NULL && newval != SLIDER_NOCHANGE) *option = (float)newval * scale; - if (str != NULL) str->printf(fmt, *option); + if (str != NULL) strprintf(*str, fmt, *option); return floor(*option / scale + 0.5f); } -static INT32 slider_shadow_mask_alpha(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_shadow_mask_alpha(running_machine &machine, void *arg, std::string *str, INT32 newval) { return slider_set(&(((hlsl_options*)arg)->shadow_mask_alpha), 0.01f, "%2.2f", str, newval); } -static INT32 slider_shadow_mask_x_count(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_shadow_mask_x_count(running_machine &machine, void *arg, std::string *str, INT32 newval) { hlsl_options *options = (hlsl_options*)arg; if (newval != SLIDER_NOCHANGE) options->shadow_mask_count_x = newval; - if (str != NULL) str->printf("%d", options->shadow_mask_count_x); + if (str != NULL) strprintf(*str, "%d", options->shadow_mask_count_x); options->params_dirty = true; return options->shadow_mask_count_x; } -static INT32 slider_shadow_mask_y_count(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_shadow_mask_y_count(running_machine &machine, void *arg, std::string *str, INT32 newval) { hlsl_options *options = (hlsl_options*)arg; if (newval != SLIDER_NOCHANGE) options->shadow_mask_count_y = newval; - if (str != NULL) str->printf("%d", options->shadow_mask_count_y); + if (str != NULL) strprintf(*str, "%d", options->shadow_mask_count_y); options->params_dirty = true; return options->shadow_mask_count_y; } -static INT32 slider_shadow_mask_usize(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_shadow_mask_usize(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->shadow_mask_u_size), 1.0f / 32.0f, "%2.5f", str, newval); } -static INT32 slider_shadow_mask_vsize(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_shadow_mask_vsize(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->shadow_mask_v_size), 1.0f / 32.0f, "%2.5f", str, newval); } -static INT32 slider_curvature(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_curvature(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->curvature), 0.01f, "%2.2f", str, newval); } -static INT32 slider_pincushion(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_pincushion(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->pincushion), 0.01f, "%2.2f", str, newval); } -static INT32 slider_scanline_alpha(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_scanline_alpha(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->scanline_alpha), 0.01f, "%2.2f", str, newval); } -static INT32 slider_scanline_scale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_scanline_scale(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->scanline_scale), 0.05f, "%2.2f", str, newval); } -static INT32 slider_scanline_height(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_scanline_height(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->scanline_height), 0.05f, "%2.2f", str, newval); } -static INT32 slider_scanline_bright_scale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_scanline_bright_scale(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->scanline_bright_scale), 0.05f, "%2.2f", str, newval); } -static INT32 slider_scanline_bright_offset(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_scanline_bright_offset(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->scanline_bright_offset), 0.05f, "%2.2f", str, newval); } -static INT32 slider_scanline_offset(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_scanline_offset(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->scanline_offset), 0.05f, "%2.2f", str, newval); } -static INT32 slider_defocus_x(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_defocus_x(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->defocus[0]), 0.5f, "%2.1f", str, newval); } -static INT32 slider_defocus_y(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_defocus_y(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->defocus[1]), 0.5f, "%2.1f", str, newval); } -static INT32 slider_red_converge_x(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_red_converge_x(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->converge_x[0]), 0.1f, "%3.1f", str, newval); } -static INT32 slider_red_converge_y(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_red_converge_y(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->converge_y[0]), 0.1f, "%3.1f", str, newval); } -static INT32 slider_green_converge_x(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_green_converge_x(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->converge_x[1]), 0.1f, "%3.1f", str, newval); } -static INT32 slider_green_converge_y(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_green_converge_y(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->converge_y[1]), 0.1f, "%3.1f", str, newval); } -static INT32 slider_blue_converge_x(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_blue_converge_x(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->converge_x[2]), 0.1f, "%3.1f", str, newval); } -static INT32 slider_blue_converge_y(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_blue_converge_y(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->converge_y[2]), 0.1f, "%3.1f", str, newval); } -static INT32 slider_red_radial_converge_x(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_red_radial_converge_x(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->radial_converge_x[0]), 0.1f, "%3.1f", str, newval); } -static INT32 slider_red_radial_converge_y(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_red_radial_converge_y(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->radial_converge_y[0]), 0.1f, "%3.1f", str, newval); } -static INT32 slider_green_radial_converge_x(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_green_radial_converge_x(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->radial_converge_x[1]), 0.1f, "%3.1f", str, newval); } -static INT32 slider_green_radial_converge_y(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_green_radial_converge_y(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->radial_converge_y[1]), 0.1f, "%3.1f", str, newval); } -static INT32 slider_blue_radial_converge_x(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_blue_radial_converge_x(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->radial_converge_x[2]), 0.1f, "%3.1f", str, newval); } -static INT32 slider_blue_radial_converge_y(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_blue_radial_converge_y(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->radial_converge_y[2]), 0.1f, "%3.1f", str, newval); } -static INT32 slider_red_from_r(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_red_from_r(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->red_ratio[0]), 0.005f, "%2.3f", str, newval); } -static INT32 slider_red_from_g(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_red_from_g(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->red_ratio[1]), 0.005f, "%2.3f", str, newval); } -static INT32 slider_red_from_b(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_red_from_b(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->red_ratio[2]), 0.005f, "%2.3f", str, newval); } -static INT32 slider_green_from_r(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_green_from_r(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->grn_ratio[0]), 0.005f, "%2.3f", str, newval); } -static INT32 slider_green_from_g(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_green_from_g(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->grn_ratio[1]), 0.005f, "%2.3f", str, newval); } -static INT32 slider_green_from_b(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_green_from_b(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->grn_ratio[2]), 0.005f, "%2.3f", str, newval); } -static INT32 slider_blue_from_r(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_blue_from_r(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->blu_ratio[0]), 0.005f, "%2.3f", str, newval); } -static INT32 slider_blue_from_g(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_blue_from_g(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->blu_ratio[1]), 0.005f, "%2.3f", str, newval); } -static INT32 slider_blue_from_b(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_blue_from_b(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->blu_ratio[2]), 0.005f, "%2.3f", str, newval); } -static INT32 slider_red_offset(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_red_offset(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->offset[0]), 0.01f, "%2.2f", str, newval); } -static INT32 slider_green_offset(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_green_offset(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->offset[1]), 0.01f, "%2.2f", str, newval); } -static INT32 slider_blue_offset(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_blue_offset(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->offset[2]), 0.01f, "%2.2f", str, newval); } -static INT32 slider_red_scale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_red_scale(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->scale[0]), 0.01f, "%2.2f", str, newval); } -static INT32 slider_green_scale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_green_scale(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->scale[1]), 0.01f, "%2.2f", str, newval); } -static INT32 slider_blue_scale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_blue_scale(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->scale[2]), 0.01f, "%2.2f", str, newval); } -static INT32 slider_red_power(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_red_power(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->power[0]), 0.05f, "%2.2f", str, newval); } -static INT32 slider_green_power(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_green_power(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->power[1]), 0.05f, "%2.2f", str, newval); } -static INT32 slider_blue_power(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_blue_power(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->power[2]), 0.05f, "%2.2f", str, newval); } -static INT32 slider_red_floor(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_red_floor(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->floor[0]), 0.01f, "%2.2f", str, newval); } -static INT32 slider_green_floor(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_green_floor(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->floor[1]), 0.01f, "%2.2f", str, newval); } -static INT32 slider_blue_floor(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_blue_floor(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->floor[2]), 0.01f, "%2.2f", str, newval); } -static INT32 slider_red_phosphor_life(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_red_phosphor_life(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->phosphor[0]), 0.01f, "%2.2f", str, newval); } -static INT32 slider_green_phosphor_life(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_green_phosphor_life(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->phosphor[1]), 0.01f, "%2.2f", str, newval); } -static INT32 slider_blue_phosphor_life(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_blue_phosphor_life(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->phosphor[2]), 0.01f, "%2.2f", str, newval); } -static INT32 slider_saturation(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_saturation(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->saturation), 0.01f, "%2.2f", str, newval); } -static INT32 slider_vector_attenuation(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_vector_attenuation(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->vector_length_scale), 0.01f, "%1.2f", str, newval); } -static INT32 slider_vector_length_max(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_vector_length_max(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->vector_length_ratio), 1.0f, "%4f", str, newval); } -static INT32 slider_vector_bloom_scale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_vector_bloom_scale(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->vector_bloom_scale), 0.001f, "%1.3f", str, newval); } -static INT32 slider_raster_bloom_scale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_raster_bloom_scale(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->raster_bloom_scale), 0.001f, "%1.3f", str, newval); } -static INT32 slider_bloom_lvl0_scale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_bloom_lvl0_scale(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->bloom_level0_weight), 0.01f, "%1.2f", str, newval); } -static INT32 slider_bloom_lvl1_scale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_bloom_lvl1_scale(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->bloom_level1_weight), 0.01f, "%1.2f", str, newval); } -static INT32 slider_bloom_lvl2_scale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_bloom_lvl2_scale(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->bloom_level2_weight), 0.01f, "%1.2f", str, newval); } -static INT32 slider_bloom_lvl3_scale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_bloom_lvl3_scale(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->bloom_level3_weight), 0.01f, "%1.2f", str, newval); } -static INT32 slider_bloom_lvl4_scale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_bloom_lvl4_scale(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->bloom_level4_weight), 0.01f, "%1.2f", str, newval); } -static INT32 slider_bloom_lvl5_scale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_bloom_lvl5_scale(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->bloom_level5_weight), 0.01f, "%1.2f", str, newval); } -static INT32 slider_bloom_lvl6_scale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_bloom_lvl6_scale(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->bloom_level6_weight), 0.01f, "%1.2f", str, newval); } -static INT32 slider_bloom_lvl7_scale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_bloom_lvl7_scale(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->bloom_level7_weight), 0.01f, "%1.2f", str, newval); } -static INT32 slider_bloom_lvl8_scale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_bloom_lvl8_scale(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->bloom_level8_weight), 0.01f, "%1.2f", str, newval); } -static INT32 slider_bloom_lvl9_scale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_bloom_lvl9_scale(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->bloom_level9_weight), 0.01f, "%1.2f", str, newval); } -static INT32 slider_bloom_lvl10_scale(running_machine &machine, void *arg, astring *str, INT32 newval) +static INT32 slider_bloom_lvl10_scale(running_machine &machine, void *arg, std::string *str, INT32 newval) { ((hlsl_options*)arg)->params_dirty = true; return slider_set(&(((hlsl_options*)arg)->bloom_level10_weight), 0.01f, "%1.2f", str, newval); @@ -3393,30 +3393,30 @@ static file_error open_next(d3d::renderer *d3d, emu_file &file, const char *temp if (snapname == NULL || snapname[0] == 0) snapname = "%g/%i"; - astring snapstr(snapname); + std::string snapstr(snapname); // strip any extension in the provided name - int index = snapstr.rchr(0, '.'); + int index = snapstr.find_last_of('.'); if (index != -1) snapstr.substr(0, index); // handle %d in the template (for image devices) - astring snapdev("%d_"); - int pos = snapstr.find(0, snapdev.c_str()); + std::string snapdev("%d_"); + int pos = snapstr.find(snapdev,0); if (pos != -1) { // if more %d are found, revert to default and ignore them all - if (snapstr.find(pos + 3, snapdev.c_str()) != -1) - snapstr.cpy("%g/%i"); + if (snapstr.find(snapdev, pos + 3) != -1) + snapstr.assign("%g/%i"); // else if there is a single %d, try to create the correct snapname else { int name_found = 0; // find length of the device name - int end1 = snapstr.find(pos + 3, "/"); - int end2 = snapstr.find(pos + 3, "%"); + int end1 = snapstr.find("/", pos + 3); + int end2 = snapstr.find("%", pos + 3); int end = -1; if ((end1 != -1) && (end2 != -1)) @@ -3426,35 +3426,35 @@ static file_error open_next(d3d::renderer *d3d, emu_file &file, const char *temp else if (end2 != -1) end = end2; else - end = snapstr.len(); + end = snapstr.length(); if (end - pos < 3) fatalerror("Something very wrong is going on!!!\n"); // copy the device name to an astring - astring snapdevname; - snapdevname.cpysubstr(snapstr, pos + 3, end - pos - 3); + std::string snapdevname; + snapdevname.assign(snapstr.substr(pos + 3, end - pos - 3)); // verify that there is such a device for this system image_interface_iterator iter(d3d->window().machine().root_device()); for (device_image_interface *image = iter.first(); image != NULL; iter.next()) { // get the device name - astring tempdevname(image->brief_instance_name()); + std::string tempdevname(image->brief_instance_name()); - if (snapdevname.cmp(tempdevname) == 0) + if (snapdevname.compare(tempdevname) == 0) { // verify that such a device has an image mounted if (image->basename() != NULL) { - astring filename(image->basename()); + std::string filename(image->basename()); // strip extension - filename.substr(0, filename.rchr(0, '.')); + filename.substr(0, filename.find_last_of('.')); // setup snapname and remove the %d_ - snapstr.replace(0, snapdevname.c_str(), filename.c_str()); - snapstr.del(pos, 3); + strreplace(snapstr, snapdevname.c_str(), filename.c_str()); + snapstr.erase(pos, 3); name_found = 1; } @@ -3463,33 +3463,34 @@ static file_error open_next(d3d::renderer *d3d, emu_file &file, const char *temp // or fallback to default if (name_found == 0) - snapstr.cpy("%g/%i"); + snapstr.assign("%g/%i"); } } // add our own index // add our own extension - snapstr.cat(".").cat(extension); + snapstr.append(".").append(extension); // substitute path and gamename up front - snapstr.replace(0, "/", PATH_SEPARATOR); - snapstr.replace(0, "%g", d3d->window().machine().basename()); + strreplace(snapstr, "/", PATH_SEPARATOR); + strreplace(snapstr, "%g", d3d->window().machine().basename()); // determine if the template has an index; if not, we always use the same name - astring fname; - if (snapstr.find(0, "%i") == -1) - fname.cpy(snapstr); + std::string fname; + if (snapstr.find("%i") == -1) + fname.assign(snapstr); // otherwise, we scan for the next available filename else { // try until we succeed - astring seqtext; + std::string seqtext; file.set_openflags(OPEN_FLAG_READ); for (int seq = 0; ; seq++) { // build up the filename - fname.cpy(snapstr).replace(0, "%i", seqtext.format("%04d_%d", seq, idx).c_str()); + strprintf(seqtext, "%04d_%d", seq, idx); + strreplace(fname.assign(snapstr), "%i", seqtext.c_str()); // try to open the file; stop when we fail file_error filerr = file.open(fname.c_str()); diff --git a/src/osd/modules/render/d3d/d3dhlsl.h b/src/osd/modules/render/d3d/d3dhlsl.h index 8b8904123b2..b86af5a1bac 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.h +++ b/src/osd/modules/render/d3d/d3dhlsl.h @@ -302,7 +302,7 @@ public: int defval; int maxval; int step; - INT32 (*adjustor)(running_machine &, void *, astring *, INT32); + INT32(*adjustor)(running_machine &, void *, std::string *, INT32); }; private: diff --git a/src/osd/sdl/input.c b/src/osd/sdl/input.c index 5fab6a71fde..e2fd01298bf 100644 --- a/src/osd/sdl/input.c +++ b/src/osd/sdl/input.c @@ -132,7 +132,7 @@ struct device_info // device information device_info ** head; device_info * next; - astring name; + std::string name; // MAME information input_device * device; diff --git a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h index c1dd01cd837..6e58053d778 100644 --- a/src/osd/sdl/osdsdl.h +++ b/src/osd/sdl/osdsdl.h @@ -119,12 +119,12 @@ public: const char *ui_mode_key() const { return value(SDLOPTION_UIMODEKEY); } // joystick mapping - const char *joy_index(int index) const { astring temp; return value(temp.format("%s%d", SDLOPTION_JOYINDEX, index).c_str()); } + const char *joy_index(int index) const { std::string temp; return value(temp.format("%s%d", SDLOPTION_JOYINDEX, index).c_str()); } bool sixaxis() const { return bool_value(SDLOPTION_SIXAXIS); } #if (SDLMAME_SDL2) - const char *mouse_index(int index) const { astring temp; return value(temp.format("%s%d", SDLOPTION_MOUSEINDEX, index).c_str()); } - const char *keyboard_index(int index) const { astring temp; return value(temp.format("%s%d", SDLOPTION_KEYBINDEX, index).c_str()); } + const char *mouse_index(int index) const { std::string temp; return value(temp.format("%s%d", SDLOPTION_MOUSEINDEX, index).c_str()); } + const char *keyboard_index(int index) const { std::string temp; return value(temp.format("%s%d", SDLOPTION_KEYBINDEX, index).c_str()); } #endif const char *video_driver() const { return value(SDLOPTION_VIDEODRIVER); } diff --git a/src/osd/sdl/sdlmain.c b/src/osd/sdl/sdlmain.c index c4c2e8a1d36..823b20fc561 100644 --- a/src/osd/sdl/sdlmain.c +++ b/src/osd/sdl/sdlmain.c @@ -209,7 +209,7 @@ void MorphToPM() sdl_options::sdl_options() : osd_options() { - astring ini_path(INI_PATH); + std::string ini_path(INI_PATH); add_entries(sdl_options::s_option_entries); ini_path.replace(0, "APP_NAME", emulator_info::get_appname_lower()); set_default_value(SDLOPTION_INIPATH, ini_path.c_str()); @@ -493,7 +493,7 @@ void sdl_osd_interface::init(running_machine &machine) // determine if we are benchmarking, and adjust options appropriately int bench = options().bench(); - astring error_string; + std::string error_string; if (bench > 0) { options().set_value(OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM, error_string); diff --git a/src/osd/windows/winmain.c b/src/osd/windows/winmain.c index 7cd0fb6bfcb..cc6fd4c2dd9 100644 --- a/src/osd/windows/winmain.c +++ b/src/osd/windows/winmain.c @@ -134,8 +134,8 @@ private: // internal helpers bool query_system_for_address(FPTR address); void scan_file_for_address(FPTR address, bool create_cache); - bool parse_sym_line(const char *line, FPTR &address, astring &symbol); - bool parse_map_line(const char *line, FPTR &address, astring &symbol); + bool parse_sym_line(const char *line, FPTR &address, std::string &symbol); + bool parse_map_line(const char *line, FPTR &address, std::string &symbol); void scan_cache_for_address(FPTR address); void format_symbol(const char *name, UINT32 displacement, const char *filename = NULL, int linenumber = 0); @@ -149,13 +149,13 @@ private: cache_entry * m_next; FPTR m_address; - astring m_name; + std::string m_name; }; simple_list<cache_entry> m_cache; - astring m_mapfile; - astring m_symfile; - astring m_buffer; + std::string m_mapfile; + std::string m_symfile; + std::string m_buffer; HANDLE m_process; FPTR m_last_base; FPTR m_text_base; @@ -544,7 +544,7 @@ void windows_osd_interface::init(running_machine &machine) // determine if we are benchmarking, and adjust options appropriately int bench = options.bench(); - astring error_string; + std::string error_string; if (bench > 0) { options.set_value(OPTION_THROTTLE, false, OPTION_PRIORITY_MAXIMUM, error_string); @@ -587,10 +587,10 @@ void windows_osd_interface::init(running_machine &machine) osd_common_t::init_subsystems(); // notify listeners of screen configuration - astring tempstring; + std::string tempstring; for (win_window_info *info = win_window_list; info != NULL; info = info->m_next) { - tempstring.printf("Orientation(%s)", info->m_monitor->devicename()); + strprintf(tempstring, "Orientation(%s)", info->m_monitor->devicename()); output_set_value(tempstring.c_str(), info->m_targetorient); } @@ -1010,23 +1010,23 @@ symbol_manager::symbol_manager(const char *argv0) { #ifdef __GNUC__ // compute the name of the mapfile - int extoffs = m_mapfile.rchr(0, '.'); + int extoffs = m_mapfile.find_last_of('.'); if (extoffs != -1) m_mapfile.substr(0, extoffs); - m_mapfile.cat(".map"); + m_mapfile.append(".map"); // and the name of the symfile - extoffs = m_symfile.rchr(0, '.'); + extoffs = m_symfile.find_last_of('.'); if (extoffs != -1) - m_symfile.substr(0, extoffs); - m_symfile.cat(".sym"); + m_symfile = m_symfile.substr(0, extoffs); + m_symfile.append(".sym"); // figure out the base of the .text section m_text_base = get_text_section_base(); #endif // expand the buffer to be decently large up front - m_buffer.printf("%500s", ""); + strprintf(m_buffer,"%500s", ""); } @@ -1048,7 +1048,7 @@ symbol_manager::~symbol_manager() const char *symbol_manager::symbol_for_address(FPTR address) { // default the buffer - m_buffer.cpy(" (not found)"); + m_buffer.assign(" (not found)"); m_last_base = 0; // first try to do it using system APIs @@ -1129,11 +1129,11 @@ void symbol_manager::scan_file_for_address(FPTR address, bool create_cache) return; // reset the best info - astring best_symbol; + std::string best_symbol; FPTR best_addr = 0; // parse the file, looking for valid entries - astring symbol; + std::string symbol; char line[1024]; while (fgets(line, sizeof(line) - 1, srcfile)) { @@ -1174,7 +1174,7 @@ void symbol_manager::scan_file_for_address(FPTR address, bool create_cache) void symbol_manager::scan_cache_for_address(FPTR address) { // reset the best info - astring best_symbol; + std::string best_symbol; FPTR best_addr = 0; // walk the cache, looking for valid entries @@ -1198,7 +1198,7 @@ void symbol_manager::scan_cache_for_address(FPTR address) // which is just the output of objdump //------------------------------------------------- -bool symbol_manager::parse_sym_line(const char *line, FPTR &address, astring &symbol) +bool symbol_manager::parse_sym_line(const char *line, FPTR &address, std::string &symbol) { #ifdef __GNUC__ /* @@ -1238,8 +1238,8 @@ bool symbol_manager::parse_sym_line(const char *line, FPTR &address, astring &sy chptr++; // extract the symbol name - symbol.cpy(chptr).trimspace(); - return (symbol.len() > 0); + strtrimspace(symbol.assign(chptr)); + return (symbol.length() > 0); } } #endif @@ -1252,7 +1252,7 @@ bool symbol_manager::parse_sym_line(const char *line, FPTR &address, astring &sy // generated map file //------------------------------------------------- -bool symbol_manager::parse_map_line(const char *line, FPTR &address, astring &symbol) +bool symbol_manager::parse_map_line(const char *line, FPTR &address, std::string &symbol) { #ifdef __GNUC__ /* @@ -1278,8 +1278,8 @@ bool symbol_manager::parse_map_line(const char *line, FPTR &address, astring &sy chptr++; // extract the symbol name - symbol.cpy(chptr).trimspace(); - return (symbol.len() > 0); + strtrimspace(symbol.assign(chptr)); + return (symbol.length() > 0); } #endif return false; @@ -1293,16 +1293,16 @@ bool symbol_manager::parse_map_line(const char *line, FPTR &address, astring &sy void symbol_manager::format_symbol(const char *name, UINT32 displacement, const char *filename, int linenumber) { // start with the address and offset - m_buffer.printf(" (%s", name); + strprintf(m_buffer, " (%s", name); if (displacement != 0) - m_buffer.catprintf("+0x%04x", (UINT32)displacement); + strcatprintf(m_buffer, "+0x%04x", (UINT32)displacement); // append file/line if present if (filename != NULL) - m_buffer.catprintf(", %s:%d", filename, linenumber); + strcatprintf(m_buffer, ", %s:%d", filename, linenumber); // close up the string - m_buffer.cat(")"); + m_buffer.append(")"); } diff --git a/src/tools/chdman.c b/src/tools/chdman.c index 4e73fc5f9f8..3ea0a31f752 100644 --- a/src/tools/chdman.c +++ b/src/tools/chdman.c @@ -96,7 +96,7 @@ const int MODE_GDI = 2; // FUNCTION PROTOTYPES //************************************************************************** -typedef tagmap_t<astring *> parameters_t; +typedef tagmap_t<std::string *> parameters_t; static void report_error(int error, const char *format, ...) ATTR_PRINTF(2,3); static void do_info(parameters_t ¶ms); @@ -320,7 +320,7 @@ public: if (offset >= startoffs && offset < endoffs) { // if we don't already have this file open, open it now - if (m_file == NULL || m_lastfile.cmp(m_info.track[tracknum].fname)!=0) + if (m_file == NULL || m_lastfile.compare(m_info.track[tracknum].fname)!=0) { if (m_file != NULL) core_fclose(m_file); @@ -381,7 +381,7 @@ public: private: // internal state - astring m_lastfile; + std::string m_lastfile; core_file * m_file; cdrom_toc & m_toc; chdcd_track_input_info & m_info; @@ -826,27 +826,27 @@ static int print_help(const char *argv0, const command_description &desc, const // big_int_string - create a 64-bit string //------------------------------------------------- -const char *big_int_string(astring &str, UINT64 intvalue) +const char *big_int_string(std::string &str, UINT64 intvalue) { // 0 is a special case if (intvalue == 0) - return str.cpy("0").c_str(); + return str.assign("0").c_str(); // loop until all chunks are done - str.reset(); + str.clear(); bool first = true; while (intvalue != 0) { int chunk = intvalue % 1000; intvalue /= 1000; - astring insert; - insert.format((intvalue != 0) ? "%03d" : "%d", chunk); + std::string insert; + strprintf(insert, (intvalue != 0) ? "%03d" : "%d", chunk); if (!first) - str.ins(0, ",").c_str(); + str.insert(0, ",").c_str(); first = false; - str.ins(0, insert); + str.insert(0, insert); } return str.c_str(); } @@ -857,9 +857,10 @@ const char *big_int_string(astring &str, UINT64 intvalue) // number of frames in M:S:F format //------------------------------------------------- -const char *msf_string_from_frames(astring &str, UINT32 frames) +const char *msf_string_from_frames(std::string &str, UINT32 frames) { - return str.format("%02d:%02d:%02d", frames / (75 * 60), (frames / 75) % 60, frames % 75).c_str(); + strprintf(str, "%02d:%02d:%02d", frames / (75 * 60), (frames / 75) % 60, frames % 75); + return str.c_str(); } @@ -900,7 +901,7 @@ UINT64 parse_number(const char *string) // compute a best guess CHS value set //------------------------------------------------- -static void guess_chs(astring *filename, UINT64 filesize, int sectorsize, UINT32 &cylinders, UINT32 &heads, UINT32 §ors, UINT32 &bps) +static void guess_chs(std::string *filename, UINT64 filesize, int sectorsize, UINT32 &cylinders, UINT32 &heads, UINT32 §ors, UINT32 &bps) { // if this is a direct physical drive read, handle it specially if (filename != NULL && osd_get_physical_drive_geometry(filename->c_str(), &cylinders, &heads, §ors, &bps)) @@ -939,7 +940,7 @@ static void guess_chs(astring *filename, UINT64 filesize, int sectorsize, UINT32 static void parse_input_chd_parameters(const parameters_t ¶ms, chd_file &input_chd, chd_file &input_parent_chd, bool writeable = false) { // process input parent file - astring *input_chd_parent_str = params.find(OPTION_INPUT_PARENT); + std::string *input_chd_parent_str = params.find(OPTION_INPUT_PARENT); if (input_chd_parent_str != NULL) { chd_error err = input_parent_chd.open(input_chd_parent_str->c_str()); @@ -948,7 +949,7 @@ static void parse_input_chd_parameters(const parameters_t ¶ms, chd_file &inp } // process input file - astring *input_chd_str = params.find(OPTION_INPUT); + std::string *input_chd_str = params.find(OPTION_INPUT); if (input_chd_str != NULL) { chd_error err = input_chd.open(input_chd_str->c_str(), writeable, input_parent_chd.opened() ? &input_parent_chd : NULL); @@ -970,9 +971,9 @@ static void parse_input_start_end(const parameters_t ¶ms, UINT64 logical_siz input_end = logical_size; // process input start - astring *input_start_byte_str = params.find(OPTION_INPUT_START_BYTE); - astring *input_start_hunk_str = params.find(OPTION_INPUT_START_HUNK); - astring *input_start_frame_str = params.find(OPTION_INPUT_START_FRAME); + std::string *input_start_byte_str = params.find(OPTION_INPUT_START_BYTE); + std::string *input_start_hunk_str = params.find(OPTION_INPUT_START_HUNK); + std::string *input_start_frame_str = params.find(OPTION_INPUT_START_FRAME); if (input_start_byte_str != NULL) input_start = parse_number(input_start_byte_str->c_str()); if (input_start_hunk_str != NULL) @@ -983,9 +984,9 @@ static void parse_input_start_end(const parameters_t ¶ms, UINT64 logical_siz report_error(1, "Input start offset greater than input file size"); // process input length - astring *input_length_bytes_str = params.find(OPTION_INPUT_LENGTH_BYTES); - astring *input_length_hunks_str = params.find(OPTION_INPUT_LENGTH_HUNKS); - astring *input_length_frames_str = params.find(OPTION_INPUT_LENGTH_FRAMES); + std::string *input_length_bytes_str = params.find(OPTION_INPUT_LENGTH_BYTES); + std::string *input_length_hunks_str = params.find(OPTION_INPUT_LENGTH_HUNKS); + std::string *input_length_frames_str = params.find(OPTION_INPUT_LENGTH_FRAMES); UINT64 input_length = input_end; if (input_length_bytes_str != NULL) input_length = parse_number(input_length_bytes_str->c_str()); @@ -1024,10 +1025,10 @@ static void check_existing_output_file(const parameters_t ¶ms, const char *f // standard set of output CHD parameters //------------------------------------------------- -static astring *parse_output_chd_parameters(const parameters_t ¶ms, chd_file &output_parent_chd) +static std::string *parse_output_chd_parameters(const parameters_t ¶ms, chd_file &output_parent_chd) { // process output parent file - astring *output_chd_parent_str = params.find(OPTION_OUTPUT_PARENT); + std::string *output_chd_parent_str = params.find(OPTION_OUTPUT_PARENT); if (output_chd_parent_str != NULL) { chd_error err = output_parent_chd.open(output_chd_parent_str->c_str()); @@ -1036,7 +1037,7 @@ static astring *parse_output_chd_parameters(const parameters_t ¶ms, chd_file } // process output file - astring *output_chd_str = params.find(OPTION_OUTPUT); + std::string *output_chd_str = params.find(OPTION_OUTPUT); if (output_chd_str != NULL) check_existing_output_file(params, output_chd_str->c_str()); return output_chd_str; @@ -1050,7 +1051,7 @@ static astring *parse_output_chd_parameters(const parameters_t ¶ms, chd_file static void parse_hunk_size(const parameters_t ¶ms, UINT32 required_granularity, UINT32 &hunk_size) { - astring *hunk_size_str = params.find(OPTION_HUNK_SIZE); + std::string *hunk_size_str = params.find(OPTION_HUNK_SIZE); if (hunk_size_str != NULL) { hunk_size = parse_number(hunk_size_str->c_str()); @@ -1070,12 +1071,12 @@ static void parse_hunk_size(const parameters_t ¶ms, UINT32 required_granular static void parse_compression(const parameters_t ¶ms, chd_codec_type compression[4]) { // see if anything was specified - astring *compression_str = params.find(OPTION_COMPRESSION); + std::string *compression_str = params.find(OPTION_COMPRESSION); if (compression_str == NULL) return; // special case: 'none' - if (compression_str->cmp("none")==0) + if (compression_str->compare("none")==0) { compression[0] = compression[1] = compression[2] = compression[3] = CHD_CODEC_NONE; return; @@ -1083,10 +1084,10 @@ static void parse_compression(const parameters_t ¶ms, chd_codec_type compres // iterate through compressors int index = 0; - for (int start = 0, end = compression_str->chr(0, ','); index < 4; start = end + 1, end = compression_str->chr(end + 1, ',')) + for (int start = 0, end = compression_str->find_first_of(','); index < 4; start = end + 1, end = compression_str->find_first_of(',', end + 1)) { - astring name(*compression_str, start, (end == -1) ? -1 : end - start); - if (name.len() != 4) + std::string name(*compression_str, start, (end == -1) ? -1 : end - start); + if (name.length() != 4) report_error(1, "Invalid compressor '%s' specified", name.c_str()); chd_codec_type type = CHD_MAKE_TAG(name[0], name[1], name[2], name[3]); if (!chd_codec_list::codec_exists(type)) @@ -1110,7 +1111,7 @@ static void parse_compression(const parameters_t ¶ms, chd_codec_type compres static void parse_numprocessors(const parameters_t ¶ms) { - astring *numprocessors_str = params.find(OPTION_NUMPROCESSORS); + std::string *numprocessors_str = params.find(OPTION_NUMPROCESSORS); if (numprocessors_str == NULL) return; @@ -1128,12 +1129,12 @@ static void parse_numprocessors(const parameters_t ¶ms) // describing a set of compressors //------------------------------------------------- -static const char *compression_string(astring &str, chd_codec_type compression[4]) +static const char *compression_string(std::string &str, chd_codec_type compression[4]) { // output compression types - str.reset(); + str.clear(); if (compression[0] == CHD_CODEC_NONE) - return str.cpy("none").c_str(); + return str.assign("none").c_str(); // iterate over types for (int index = 0; index < 4; index++) @@ -1142,9 +1143,12 @@ static const char *compression_string(astring &str, chd_codec_type compression[4 if (type == CHD_CODEC_NONE) break; if (index != 0) - str.cat(", "); - str.cat((type >> 24) & 0xff).cat((type >> 16) & 0xff).cat((type >> 8) & 0xff).cat(type & 0xff); - str.cat(" (").cat(chd_codec_list::codec_name(type)).cat(")"); + str.append(", "); + str.push_back((type >> 24) & 0xff); + str.push_back((type >> 16) & 0xff); + str.push_back((type >> 8) & 0xff); + str.push_back(type & 0xff); + str.append(" (").append(chd_codec_list::codec_name(type)).append(")"); } return str.c_str(); } @@ -1240,12 +1244,12 @@ void output_track_metadata(int mode, core_file *file, int tracknum, const cdrom_ core_fprintf(file, "FILE \"%s\" BINARY\n", filename); // determine submode - astring tempstr; + std::string tempstr; switch (info.trktype) { case CD_TRACK_MODE1: case CD_TRACK_MODE1_RAW: - tempstr.format("MODE1/%04d", info.datasize); + strprintf(tempstr,"MODE1/%04d", info.datasize); break; case CD_TRACK_MODE2: @@ -1253,11 +1257,11 @@ void output_track_metadata(int mode, core_file *file, int tracknum, const cdrom_ case CD_TRACK_MODE2_FORM2: case CD_TRACK_MODE2_FORM_MIX: case CD_TRACK_MODE2_RAW: - tempstr.format("MODE2/%04d", info.datasize); + strprintf(tempstr,"MODE2/%04d", info.datasize); break; case CD_TRACK_AUDIO: - tempstr.cpy("AUDIO"); + tempstr.assign("AUDIO"); break; } @@ -1295,11 +1299,11 @@ void output_track_metadata(int mode, core_file *file, int tracknum, const cdrom_ core_fprintf(file, "// Track %d\n", tracknum + 1); // write out the track type - astring modesubmode; + std::string modesubmode; if (info.subtype != CD_SUB_NONE) - modesubmode.format("%s %s", cdrom_get_type_string(info.trktype), cdrom_get_subtype_string(info.subtype)); + strprintf(modesubmode,"%s %s", cdrom_get_type_string(info.trktype), cdrom_get_subtype_string(info.subtype)); else - modesubmode.format("%s", cdrom_get_type_string(info.trktype)); + strprintf(modesubmode,"%s", cdrom_get_type_string(info.trktype)); core_fprintf(file, "TRACK %s\n", modesubmode.c_str()); // write out the attributes @@ -1311,7 +1315,7 @@ void output_track_metadata(int mode, core_file *file, int tracknum, const cdrom_ } // output pregap - astring tempstr; + std::string tempstr; if (info.pregap > 0) core_fprintf(file, "ZERO %s %s\n", modesubmode.c_str(), msf_string_from_frames(tempstr, info.pregap)); @@ -1343,7 +1347,7 @@ static void do_info(parameters_t ¶ms) parse_input_chd_parameters(params, input_chd, input_parent_chd); // print filename and version - astring tempstr; + std::string tempstr; printf("Input file: %s\n", params.find(OPTION_INPUT)->c_str()); printf("File Version: %d\n", input_chd.version()); if (input_chd.version() < 3) @@ -1467,7 +1471,7 @@ static void do_info(parameters_t ¶ms) } // output the stats - astring tempstr; + std::string tempstr; printf("%10s %5.1f%% %-40s\n", big_int_string(tempstr, compression_types[comptype]), 100.0 * double(compression_types[comptype]) / double(input_chd.hunk_count()), @@ -1519,7 +1523,7 @@ static void do_verify(parameters_t ¶ms) // finish up if (raw_sha1 != computed_sha1) { - astring tempstr; + std::string tempstr; fprintf(stderr, "Error: Raw SHA1 in header = %s\n", raw_sha1.as_string(tempstr)); fprintf(stderr, " actual SHA1 = %s\n", computed_sha1.as_string(tempstr)); @@ -1542,7 +1546,7 @@ static void do_verify(parameters_t ¶ms) printf("Overall SHA1 verification successful!\n"); else { - astring tempstr; + std::string tempstr; fprintf(stderr, "Error: Overall SHA1 in header = %s\n", input_chd.sha1().as_string(tempstr)); fprintf(stderr, " actual SHA1 = %s\n", computed_overall_sha1.as_string(tempstr)); @@ -1567,7 +1571,7 @@ static void do_create_raw(parameters_t ¶ms) { // process input file core_file *input_file = NULL; - astring *input_file_str = params.find(OPTION_INPUT); + std::string *input_file_str = params.find(OPTION_INPUT); if (input_file_str != NULL) { file_error filerr = core_fopen(input_file_str->c_str(), OPEN_FLAG_READ, &input_file); @@ -1577,7 +1581,7 @@ static void do_create_raw(parameters_t ¶ms) // process output CHD chd_file output_parent; - astring *output_chd_str = parse_output_chd_parameters(params, output_parent); + std::string *output_chd_str = parse_output_chd_parameters(params, output_parent); // process hunk size UINT32 hunk_size = output_parent.opened() ? output_parent.hunk_bytes() : 0; @@ -1585,7 +1589,7 @@ static void do_create_raw(parameters_t ¶ms) // process unit size UINT32 unit_size = output_parent.opened() ? output_parent.unit_bytes() : 0; - astring *unit_size_str = params.find(OPTION_UNIT_SIZE); + std::string *unit_size_str = params.find(OPTION_UNIT_SIZE); if (unit_size_str != NULL) { unit_size = parse_number(unit_size_str->c_str()); @@ -1607,7 +1611,7 @@ static void do_create_raw(parameters_t ¶ms) parse_numprocessors(params); // print some info - astring tempstr; + std::string tempstr; printf("Output CHD: %s\n", output_chd_str->c_str()); if (output_parent.opened()) printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->c_str()); @@ -1647,7 +1651,7 @@ static void do_create_raw(parameters_t ¶ms) { delete chd; // delete the output file - astring *output_chd_str = params.find(OPTION_OUTPUT); + std::string *output_chd_str = params.find(OPTION_OUTPUT); if (output_chd_str != NULL) osd_rmfile(output_chd_str->c_str()); throw; @@ -1664,7 +1668,7 @@ static void do_create_hd(parameters_t ¶ms) { // process input file core_file *input_file = NULL; - astring *input_file_str = params.find(OPTION_INPUT); + std::string *input_file_str = params.find(OPTION_INPUT); if (input_file_str != NULL) { file_error filerr = core_fopen(input_file_str->c_str(), OPEN_FLAG_READ, &input_file); @@ -1674,11 +1678,11 @@ static void do_create_hd(parameters_t ¶ms) // process output CHD chd_file output_parent; - astring *output_chd_str = parse_output_chd_parameters(params, output_parent); + std::string *output_chd_str = parse_output_chd_parameters(params, output_parent); // process sectorsize UINT32 sector_size = output_parent.opened() ? output_parent.unit_bytes() : IDE_SECTOR_SIZE; - astring *sectorsize_str = params.find(OPTION_SECTOR_SIZE); + std::string *sectorsize_str = params.find(OPTION_SECTOR_SIZE); if (sectorsize_str != NULL) { if (output_parent.opened()) @@ -1701,7 +1705,7 @@ static void do_create_hd(parameters_t ¶ms) } else { - astring *size_str = params.find(OPTION_SIZE); + std::string *size_str = params.find(OPTION_SIZE); if (size_str != NULL) { if (sscanf(size_str->c_str(), "%" I64FMT"d", &filesize) != 1) @@ -1725,7 +1729,7 @@ static void do_create_hd(parameters_t ¶ms) UINT32 cylinders = 0; UINT32 heads = 0; UINT32 sectors = 0; - astring *chs_str = params.find(OPTION_CHS); + std::string *chs_str = params.find(OPTION_CHS); if (chs_str != NULL) { if (output_parent.opened()) @@ -1738,7 +1742,7 @@ static void do_create_hd(parameters_t ¶ms) dynamic_buffer identdata; if (output_parent.opened()) output_parent.read_metadata(HARD_DISK_IDENT_METADATA_TAG, 0, identdata); - astring *ident_str = params.find(OPTION_IDENT); + std::string *ident_str = params.find(OPTION_IDENT); if (ident_str != NULL) { // load the file @@ -1757,7 +1761,7 @@ static void do_create_hd(parameters_t ¶ms) // extract geometry from the parent if we have one if (output_parent.opened() && cylinders == 0) { - astring metadata; + std::string metadata; if (output_parent.read_metadata(HARD_DISK_METADATA_TAG, 0, metadata) != CHDERR_NONE) report_error(1, "Unable to find hard disk metadata in parent CHD"); if (sscanf(metadata.c_str(), HARD_DISK_METADATA_FORMAT, &cylinders, &heads, §ors, §or_size) != 4) @@ -1778,7 +1782,7 @@ static void do_create_hd(parameters_t ¶ms) UINT32 totalsectors = cylinders * heads * sectors; // print some info - astring tempstr; + std::string tempstr; printf("Output CHD: %s\n", output_chd_str->c_str()); if (output_parent.opened()) printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->c_str()); @@ -1814,8 +1818,8 @@ static void do_create_hd(parameters_t ¶ms) report_error(1, "Error creating CHD file (%s): %s", output_chd_str->c_str(), chd_file::error_string(err)); // add the standard hard disk metadata - astring metadata; - metadata.format(HARD_DISK_METADATA_FORMAT, cylinders, heads, sectors, sector_size); + std::string metadata; + strprintf(metadata, HARD_DISK_METADATA_FORMAT, cylinders, heads, sectors, sector_size); err = chd->write_metadata(HARD_DISK_METADATA_TAG, 0, metadata); if (err != CHDERR_NONE) report_error(1, "Error adding hard disk metadata: %s", chd_file::error_string(err)); @@ -1837,7 +1841,7 @@ static void do_create_hd(parameters_t ¶ms) { delete chd; // delete the output file - astring *output_chd_str = params.find(OPTION_OUTPUT); + std::string *output_chd_str = params.find(OPTION_OUTPUT); if (output_chd_str != NULL) osd_rmfile(output_chd_str->c_str()); throw; @@ -1855,7 +1859,7 @@ static void do_create_cd(parameters_t ¶ms) // process input file chdcd_track_input_info track_info; cdrom_toc toc = { 0 }; - astring *input_file_str = params.find(OPTION_INPUT); + std::string *input_file_str = params.find(OPTION_INPUT); if (input_file_str != NULL) { chd_error err = chdcd_parse_toc(input_file_str->c_str(), toc, track_info); @@ -1865,7 +1869,7 @@ static void do_create_cd(parameters_t ¶ms) // process output CHD chd_file output_parent; - astring *output_chd_str = parse_output_chd_parameters(params, output_parent); + std::string *output_chd_str = parse_output_chd_parameters(params, output_parent); // process hunk size UINT32 hunk_size = output_parent.opened() ? output_parent.hunk_bytes() : CD_FRAMES_PER_HUNK * CD_FRAME_SIZE; @@ -1892,7 +1896,7 @@ static void do_create_cd(parameters_t ¶ms) } // print some info - astring tempstr; + std::string tempstr; printf("Output CHD: %s\n", output_chd_str->c_str()); if (output_parent.opened()) printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->c_str()); @@ -1929,7 +1933,7 @@ static void do_create_cd(parameters_t ¶ms) { delete chd; // delete the output file - astring *output_chd_str = params.find(OPTION_OUTPUT); + std::string *output_chd_str = params.find(OPTION_OUTPUT); if (output_chd_str != NULL) osd_rmfile(output_chd_str->c_str()); throw; @@ -1946,7 +1950,7 @@ static void do_create_ld(parameters_t ¶ms) { // process input file avi_file *input_file = NULL; - astring *input_file_str = params.find(OPTION_INPUT); + std::string *input_file_str = params.find(OPTION_INPUT); if (input_file_str != NULL) { avi_error avierr = avi_open(input_file_str->c_str(), &input_file); @@ -1957,7 +1961,7 @@ static void do_create_ld(parameters_t ¶ms) // process output CHD chd_file output_parent; - astring *output_chd_str = parse_output_chd_parameters(params, output_parent); + std::string *output_chd_str = parse_output_chd_parameters(params, output_parent); // process input start/end UINT64 input_start; @@ -2002,7 +2006,7 @@ static void do_create_ld(parameters_t ¶ms) parse_numprocessors(params); // print some info - astring tempstr; + std::string tempstr; printf("Output CHD: %s\n", output_chd_str->c_str()); if (output_parent.opened()) printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->c_str()); @@ -2035,8 +2039,8 @@ static void do_create_ld(parameters_t ¶ms) report_error(1, "Error creating CHD file (%s): %s", output_chd_str->c_str(), chd_file::error_string(err)); // write the core A/V metadata - astring metadata; - metadata.format(AV_METADATA_FORMAT, info.fps_times_1million / 1000000, info.fps_times_1million % 1000000, info.width, info.height, info.interlaced, info.channels, info.rate); + std::string metadata; + strprintf(metadata, AV_METADATA_FORMAT, info.fps_times_1million / 1000000, info.fps_times_1million % 1000000, info.width, info.height, info.interlaced, info.channels, info.rate); err = chd->write_metadata(AV_METADATA_TAG, 0, metadata); if (err != CHDERR_NONE) report_error(1, "Error adding AV metadata: %s\n", chd_file::error_string(err)); @@ -2057,7 +2061,7 @@ static void do_create_ld(parameters_t ¶ms) { delete chd; // delete the output file - astring *output_chd_str = params.find(OPTION_OUTPUT); + std::string *output_chd_str = params.find(OPTION_OUTPUT); if (output_chd_str != NULL) osd_rmfile(output_chd_str->c_str()); throw; @@ -2084,7 +2088,7 @@ static void do_copy(parameters_t ¶ms) // process output CHD chd_file output_parent; - astring *output_chd_str = parse_output_chd_parameters(params, output_parent); + std::string *output_chd_str = parse_output_chd_parameters(params, output_parent); // process hunk size UINT32 hunk_size = input_chd.hunk_bytes(); @@ -2115,7 +2119,7 @@ static void do_copy(parameters_t ¶ms) parse_numprocessors(params); // print some info - astring tempstr; + std::string tempstr; printf("Output CHD: %s\n", output_chd_str->c_str()); if (output_parent.opened()) printf("Parent CHD: %s\n", params.find(OPTION_OUTPUT_PARENT)->c_str()); @@ -2193,7 +2197,7 @@ static void do_copy(parameters_t ¶ms) { delete chd; // delete the output file - astring *output_chd_str = params.find(OPTION_OUTPUT); + std::string *output_chd_str = params.find(OPTION_OUTPUT); if (output_chd_str != NULL) osd_rmfile(output_chd_str->c_str()); throw; @@ -2219,12 +2223,12 @@ static void do_extract_raw(parameters_t ¶ms) parse_input_start_end(params, input_chd.logical_bytes(), input_chd.hunk_bytes(), input_chd.hunk_bytes(), input_start, input_end); // verify output file doesn't exist - astring *output_file_str = params.find(OPTION_OUTPUT); + std::string *output_file_str = params.find(OPTION_OUTPUT); if (output_file_str != NULL) check_existing_output_file(params, output_file_str->c_str()); // print some info - astring tempstr; + std::string tempstr; printf("Output File: %s\n", output_file_str->c_str()); printf("Input CHD: %s\n", params.find(OPTION_INPUT)->c_str()); if (input_start != 0 || input_end != input_chd.logical_bytes()) @@ -2299,25 +2303,25 @@ static void do_extract_cd(parameters_t ¶ms) const cdrom_toc *toc = cdrom_get_toc(cdrom); // verify output file doesn't exist - astring *output_file_str = params.find(OPTION_OUTPUT); + std::string *output_file_str = params.find(OPTION_OUTPUT); if (output_file_str != NULL) check_existing_output_file(params, output_file_str->c_str()); // verify output BIN file doesn't exist - astring *output_bin_file_str = params.find(OPTION_OUTPUT_BIN); - astring default_name(*output_file_str); - int chop = default_name.rchr(0, '.'); + std::string *output_bin_file_str = params.find(OPTION_OUTPUT_BIN); + std::string default_name(*output_file_str); + int chop = default_name.find_last_of('.'); if (chop != -1) default_name.substr(0, chop); char basename[128]; strncpy(basename, default_name.c_str(), 127); - default_name.cat(".bin"); + default_name.append(".bin"); if (output_bin_file_str == NULL) output_bin_file_str = &default_name; check_existing_output_file(params, output_bin_file_str->c_str()); // print some info - astring tempstr; + std::string tempstr; printf("Output TOC: %s\n", output_file_str->c_str()); printf("Output Data: %s\n", output_bin_file_str->c_str()); printf("Input CHD: %s\n", params.find(OPTION_INPUT)->c_str()); @@ -2368,17 +2372,17 @@ static void do_extract_cd(parameters_t ¶ms) dynamic_buffer buffer; for (int tracknum = 0; tracknum < toc->numtrks; tracknum++) { - astring trackbin_name(basename); + std::string trackbin_name(basename); if (mode == MODE_GDI) { char temp[8]; sprintf(temp, "%02d", tracknum+1); - trackbin_name.cat(temp); + trackbin_name.append(temp); if (toc->tracks[tracknum].trktype == CD_TRACK_AUDIO) - trackbin_name.cat(".raw"); + trackbin_name.append(".raw"); else - trackbin_name.cat(".bin"); + trackbin_name.append(".bin"); if (output_bin_file) { @@ -2395,7 +2399,7 @@ static void do_extract_cd(parameters_t ¶ms) // output the metadata about the track to the TOC file const cdrom_track_info &trackinfo = toc->tracks[tracknum]; - astring temp; + std::string temp; if (mode == MODE_GDI) { output_track_metadata(mode, output_toc_file, tracknum, trackinfo, core_filename_extract_base(temp, trackbin_name.c_str()).c_str(), discoffs, outputoffs); @@ -2494,7 +2498,7 @@ static void do_extract_ld(parameters_t ¶ms) parse_input_chd_parameters(params, input_chd, input_parent_chd); // read core metadata - astring metadata; + std::string metadata; chd_error err = input_chd.read_metadata(AV_METADATA_TAG, 0, metadata); if (err != CHDERR_NONE) report_error(1, "Unable to find A/V metadata in the input CHD"); @@ -2546,12 +2550,12 @@ static void do_extract_ld(parameters_t ¶ms) info.audio_samplerate = rate; // verify output file doesn't exist - astring *output_file_str = params.find(OPTION_OUTPUT); + std::string *output_file_str = params.find(OPTION_OUTPUT); if (output_file_str != NULL) check_existing_output_file(params, output_file_str->c_str()); // print some info - astring tempstr; + std::string tempstr; printf("Output File: %s\n", output_file_str->c_str()); printf("Input CHD: %s\n", params.find(OPTION_INPUT)->c_str()); if (input_start != 0 || input_end != input_chd.hunk_count()) @@ -2645,31 +2649,31 @@ static void do_add_metadata(parameters_t ¶ms) // process tag chd_metadata_tag tag = CHD_MAKE_TAG('?','?','?','?'); - astring *tag_str = params.find(OPTION_TAG); + std::string *tag_str = params.find(OPTION_TAG); if (tag_str != NULL) { - tag_str->cat(" "); + tag_str->append(" "); tag = CHD_MAKE_TAG((*tag_str)[0], (*tag_str)[1], (*tag_str)[2], (*tag_str)[3]); } // process index UINT32 index = 0; - astring *index_str = params.find(OPTION_INDEX); + std::string *index_str = params.find(OPTION_INDEX); if (index_str != NULL) index = atoi(index_str->c_str()); // process text input - astring *text_str = params.find(OPTION_VALUE_TEXT); - astring text; + std::string *text_str = params.find(OPTION_VALUE_TEXT); + std::string text; if (text_str != NULL) { text = *text_str; - if (text[0] == '"' && text[text.len() - 1] == '"') - text.substr(1, text.len() - 2); + if (text[0] == '"' && text[text.length() - 1] == '"') + text.substr(1, text.length() - 2); } // process file input - astring *file_str = params.find(OPTION_VALUE_FILE); + std::string *file_str = params.find(OPTION_VALUE_FILE); dynamic_buffer file; if (file_str != NULL) { @@ -2690,7 +2694,7 @@ static void do_add_metadata(parameters_t ¶ms) flags &= ~CHD_MDFLAGS_CHECKSUM; // print some info - astring tempstr; + std::string tempstr; printf("Input file: %s\n", params.find(OPTION_INPUT)->c_str()); printf("Tag: %c%c%c%c\n", (tag >> 24) & 0xff, (tag >> 16) & 0xff, (tag >> 8) & 0xff, tag & 0xff); printf("Index: %d\n", index); @@ -2725,21 +2729,21 @@ static void do_del_metadata(parameters_t ¶ms) // process tag chd_metadata_tag tag = CHD_MAKE_TAG('?','?','?','?'); - astring *tag_str = params.find(OPTION_TAG); + std::string *tag_str = params.find(OPTION_TAG); if (tag_str != NULL) { - tag_str->cat(" "); + tag_str->append(" "); tag = CHD_MAKE_TAG((*tag_str)[0], (*tag_str)[1], (*tag_str)[2], (*tag_str)[3]); } // process index UINT32 index = 0; - astring *index_str = params.find(OPTION_INDEX); + std::string *index_str = params.find(OPTION_INDEX); if (index_str != NULL) index = atoi(index_str->c_str()); // print some info - astring tempstr; + std::string tempstr; printf("Input file: %s\n", params.find(OPTION_INPUT)->c_str()); printf("Tag: %c%c%c%c\n", (tag >> 24) & 0xff, (tag >> 16) & 0xff, (tag >> 8) & 0xff, tag & 0xff); printf("Index: %d\n", index); @@ -2765,22 +2769,22 @@ static void do_dump_metadata(parameters_t ¶ms) parse_input_chd_parameters(params, input_chd, input_parent_chd); // verify output file doesn't exist - astring *output_file_str = params.find(OPTION_OUTPUT); + std::string *output_file_str = params.find(OPTION_OUTPUT); if (output_file_str != NULL) check_existing_output_file(params, output_file_str->c_str()); // process tag chd_metadata_tag tag = CHD_MAKE_TAG('?','?','?','?'); - astring *tag_str = params.find(OPTION_TAG); + std::string *tag_str = params.find(OPTION_TAG); if (tag_str != NULL) { - tag_str->cat(" "); + tag_str->append(" "); tag = CHD_MAKE_TAG((*tag_str)[0], (*tag_str)[1], (*tag_str)[2], (*tag_str)[3]); } // process index UINT32 index = 0; - astring *index_str = params.find(OPTION_INDEX); + std::string *index_str = params.find(OPTION_INDEX); if (index_str != NULL) index = atoi(index_str->c_str()); @@ -2808,7 +2812,7 @@ static void do_dump_metadata(parameters_t ¶ms) core_fclose(output_file); // provide some feedback - astring tempstr; + std::string tempstr; printf("File (%s) written, %s bytes\n", output_file_str->c_str(), big_int_string(tempstr, buffer.size())); } @@ -2864,7 +2868,7 @@ int CLIB_DECL main(int argc, char *argv[]) return print_help(argv[0], desc); // otherwise, verify the parameters - tagmap_t<astring *> parameters; + tagmap_t<std::string *> parameters; while (argnum < argc) { // should be an option name @@ -2905,7 +2909,7 @@ int CLIB_DECL main(int argc, char *argv[]) } // add to the map - if (parameters.add(odesc.name, new astring(param)) == TMERR_DUPLICATE) + if (parameters.add(odesc.name, new std::string(param)) == TMERR_DUPLICATE) return print_help(argv[0], desc, "Multiple parameters of the same type specified"); break; } diff --git a/src/tools/ldresample.c b/src/tools/ldresample.c index 26266f064ae..d22fcd7a4a9 100644 --- a/src/tools/ldresample.c +++ b/src/tools/ldresample.c @@ -167,7 +167,7 @@ static chd_error open_chd(chd_file &file, const char *filename, movie_info &info } // get the metadata - astring metadata; + std::string metadata; chderr = file.read_metadata(AV_METADATA_TAG, 0, metadata); if (chderr != CHDERR_NONE) { diff --git a/src/tools/ldverify.c b/src/tools/ldverify.c index 80094128265..020e611181c 100644 --- a/src/tools/ldverify.c +++ b/src/tools/ldverify.c @@ -183,7 +183,7 @@ static void *open_chd(const char *filename, movie_info &info) } // get the metadata - astring metadata; + std::string metadata; chderr = chd->read_metadata(AV_METADATA_TAG, 0, metadata); if (chderr != CHDERR_NONE) { diff --git a/src/tools/nltool.c b/src/tools/nltool.c index 109453581eb..b4fa261e0a7 100644 --- a/src/tools/nltool.c +++ b/src/tools/nltool.c @@ -12,7 +12,6 @@ #include <ctype.h> #include <sstream> #include <assert.h> -#include "astring.h" #include "corefile.h" #include "corestr.h" #include "sha1.h" @@ -205,7 +204,7 @@ private: void usage(core_options &opts) { - astring buffer; + std::string buffer; fprintf(stderr, "Usage:\n" " nltool -help\n" @@ -298,7 +297,7 @@ int main(int argc, char *argv[]) { //int result; core_options opts(oplist); - astring aerror(""); + std::string aerror(""); fprintf(stderr, "%s", "WARNING: This is Work In Progress! - It may fail anytime\n"); if (!opts.parse_command_line(argc, argv, OPTION_PRIORITY_DEFAULT, aerror)) diff --git a/src/tools/pngcmp.c b/src/tools/pngcmp.c index 3fa7e8ba724..4b0974d824f 100644 --- a/src/tools/pngcmp.c +++ b/src/tools/pngcmp.c @@ -28,7 +28,7 @@ PROTOTYPES ***************************************************************************/ -static int generate_png_diff(const astring& imgfile1, const astring& imgfile2, const astring& outfilename); +static int generate_png_diff(const std::string& imgfile1, const std::string& imgfile2, const std::string& outfilename); /*************************************************************************** MAIN @@ -46,9 +46,9 @@ int main(int argc, char *argv[]) fprintf(stderr, "Usage:\npngcmp <image1> <image2> <outfile>\n"); return 10; } - astring imgfilename1(argv[1]); - astring imgfilename2(argv[2]); - astring outfilename(argv[3]); + std::string imgfilename1(argv[1]); + std::string imgfilename2(argv[2]); + std::string outfilename(argv[3]); try { return generate_png_diff(imgfilename1, imgfilename2, outfilename); @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) side with a third set of differences -------------------------------------------------*/ -static int generate_png_diff(const astring& imgfile1, const astring& imgfile2, const astring& outfilename) +static int generate_png_diff(const std::string& imgfile1, const std::string& imgfile2, const std::string& outfilename) { bitmap_argb32 bitmap1; bitmap_argb32 bitmap2; diff --git a/src/tools/regrep.c b/src/tools/regrep.c index c6b27f99192..a550f86e61b 100644 --- a/src/tools/regrep.c +++ b/src/tools/regrep.c @@ -63,7 +63,7 @@ struct summary_file char source[100]; UINT8 status[MAX_COMPARES]; UINT8 matchbitmap[MAX_COMPARES]; - astring text[MAX_COMPARES]; + std::string text[MAX_COMPARES]; }; @@ -148,15 +148,15 @@ static int CLIB_DECL compare_file(const void *file0ptr, const void *file1ptr); static summary_file *sort_file_list(void); /* HTML helpers */ -static core_file *create_file_and_output_header(astring &filename, astring &templatefile, astring &title); -static void output_footer_and_close_file(core_file *file, astring &templatefile, astring &title); +static core_file *create_file_and_output_header(std::string &filename, std::string &templatefile, std::string &title); +static void output_footer_and_close_file(core_file *file, std::string &templatefile, std::string &title); /* report generators */ -static void output_report(astring &dirname, astring &tempheader, astring &tempfooter, summary_file *filelist); +static void output_report(std::string &dirname, std::string &tempheader, std::string &tempfooter, summary_file *filelist); static int compare_screenshots(summary_file *curfile); -static int generate_png_diff(const summary_file *curfile, astring &destdir, const char *destname); -static void create_linked_file(astring &dirname, const summary_file *curfile, const summary_file *prevfile, const summary_file *nextfile, const char *pngfile, astring &tempheader, astring &tempfooter); -static void append_driver_list_table(const char *header, astring &dirname, core_file *indexfile, const summary_file *listhead, astring &tempheader, astring &tempfooter); +static int generate_png_diff(const summary_file *curfile, std::string &destdir, const char *destname); +static void create_linked_file(std::string &dirname, const summary_file *curfile, const summary_file *prevfile, const summary_file *nextfile, const char *pngfile, std::string &tempheader, std::string &tempfooter); +static void append_driver_list_table(const char *header, std::string &dirname, core_file *indexfile, const summary_file *listhead, std::string &tempheader, std::string &tempfooter); @@ -229,33 +229,33 @@ int main(int argc, char *argv[]) fprintf(stderr, "Usage:\nregrep <template> <outputdir> <summary1> [<summary2> [<summary3> ...]]\n"); return 1; } - astring tempfilename(argv[1]); - astring dirname(argv[2]); + std::string tempfilename(argv[1]); + std::string dirname(argv[2]); list_count = argc - 3; /* read the template file into an astring */ - astring tempheader; + std::string tempheader; if (core_fload(tempfilename.c_str(), &buffer, &bufsize) == FILERR_NONE) { - tempheader.cpy((const char *)buffer, bufsize); + tempheader.assign((const char *)buffer, bufsize); osd_free(buffer); } /* verify the template */ - if (tempheader.len() == 0) + if (tempheader.length() == 0) { fprintf(stderr, "Unable to read template file\n"); return 1; } - result = tempheader.find(0, "<!--CONTENT-->"); + result = tempheader.find("<!--CONTENT-->"); if (result == -1) { fprintf(stderr, "Template is missing a <!--CONTENT--> marker\n"); return 1; } - astring tempfooter(tempheader); - tempfooter.substr(result + 14); - tempheader.substr(0, result); + std::string tempfooter(tempheader); + tempfooter = tempfooter.substr(result + 14); + tempfooter = tempheader.substr(0, result); /* loop over arguments and read the files */ for (listnum = 0; listnum < list_count; listnum++) @@ -403,7 +403,7 @@ static int read_summary_log(const char *filename, int index) continue; /* append our text */ - curfile->text[index].cat(linestart); + curfile->text[index].append(linestart); } } @@ -460,7 +460,7 @@ static summary_file *parse_driver_tag(char *linestart, int index) /* clear out any old status for this file */ curfile->status[index] = STATUS_NOT_PRESENT; - curfile->text[index].reset(); + curfile->text[index].clear(); /* strip leading/trailing spaces from the status */ colon = trim_string(colon + 1); @@ -560,7 +560,7 @@ static summary_file *sort_file_list(void) HTML file with a standard header -------------------------------------------------*/ -static core_file *create_file_and_output_header(astring &filename, astring &templatefile, astring &title) +static core_file *create_file_and_output_header(std::string &filename, std::string &templatefile, std::string &title) { core_file *file; @@ -569,9 +569,9 @@ static core_file *create_file_and_output_header(astring &filename, astring &temp return NULL; /* print a header */ - astring modified(templatefile); - modified.replace("<!--TITLE-->", title.c_str()); - core_fwrite(file, modified.c_str(), modified.len()); + std::string modified(templatefile); + strreplace(modified, "<!--TITLE-->", title.c_str()); + core_fwrite(file, modified.c_str(), modified.length()); /* return the file */ return file; @@ -583,11 +583,11 @@ static core_file *create_file_and_output_header(astring &filename, astring &temp standard footer to an HTML file and close it -------------------------------------------------*/ -static void output_footer_and_close_file(core_file *file, astring &templatefile, astring &title) +static void output_footer_and_close_file(core_file *file, std::string &templatefile, std::string &title) { - astring modified(templatefile); - modified.replace(0, "<!--TITLE-->", title.c_str()); - core_fwrite(file, modified.c_str(), modified.len()); + std::string modified(templatefile); + strreplace(modified, "<!--TITLE-->", title.c_str()); + core_fwrite(file, modified.c_str(), modified.length()); core_fclose(file); } @@ -602,12 +602,12 @@ static void output_footer_and_close_file(core_file *file, astring &templatefile, report HTML files -------------------------------------------------*/ -static void output_report(astring &dirname, astring &tempheader, astring &tempfooter, summary_file *filelist) +static void output_report(std::string &dirname, std::string &tempheader, std::string &tempfooter, summary_file *filelist) { summary_file *buckethead[BUCKET_COUNT], **buckettailptr[BUCKET_COUNT]; summary_file *curfile; - astring title("MAME Regressions"); - astring tempname; + std::string title("MAME Regressions"); + std::string tempname; int listnum, bucknum; core_file *indexfile; int count = 0, total; @@ -686,7 +686,7 @@ static void output_report(astring &dirname, astring &tempheader, astring &tempfo *buckettailptr[bucknum] = NULL; /* output header */ - tempname.printf("%s" PATH_SEPARATOR "%s", dirname.c_str(), "index.html"); + strprintf(tempname,"%s" PATH_SEPARATOR "%s", dirname.c_str(), "index.html"); indexfile = create_file_and_output_header(tempname, tempheader, title); if (indexfile == NULL) { @@ -727,12 +727,12 @@ static int compare_screenshots(summary_file *curfile) for (listnum = 0; listnum < list_count; listnum++) if (curfile->status[listnum] == STATUS_SUCCESS) { - astring fullname; + std::string fullname; file_error filerr; core_file *file; /* get the filename for the image */ - fullname.printf("%s" PATH_SEPARATOR "snap" PATH_SEPARATOR "%s" PATH_SEPARATOR "final.png", lists[listnum].dir, curfile->name); + strprintf(fullname,"%s" PATH_SEPARATOR "snap" PATH_SEPARATOR "%s" PATH_SEPARATOR "final.png", lists[listnum].dir, curfile->name); /* open the file */ filerr = core_fopen(fullname.c_str(), OPEN_FLAG_READ, &file); @@ -741,7 +741,7 @@ static int compare_screenshots(summary_file *curfile) if (filerr != FILERR_NONE) { /* get the filename for the image */ - fullname.printf("%s" PATH_SEPARATOR "snap" PATH_SEPARATOR "_%s.png", lists[listnum].dir, curfile->name); + strprintf(fullname, "%s" PATH_SEPARATOR "snap" PATH_SEPARATOR "_%s.png", lists[listnum].dir, curfile->name); /* open the file */ filerr = core_fopen(fullname.c_str(), OPEN_FLAG_READ, &file); @@ -826,12 +826,12 @@ static int compare_screenshots(summary_file *curfile) side with a third set of differences -------------------------------------------------*/ -static int generate_png_diff(const summary_file *curfile, astring &destdir, const char *destname) +static int generate_png_diff(const summary_file *curfile, std::string &destdir, const char *destname) { bitmap_argb32 bitmaps[MAX_COMPARES]; - astring srcimgname; - astring dstfilename; - astring tempname; + std::string srcimgname; + std::string dstfilename; + std::string tempname; bitmap_argb32 finalbitmap; int width, height, maxwidth; int bitmapcount = 0; @@ -843,14 +843,14 @@ static int generate_png_diff(const summary_file *curfile, astring &destdir, cons int starty; /* generate the common source filename */ - dstfilename.printf("%s" PATH_SEPARATOR "%s", destdir.c_str(), destname); - srcimgname.printf("snap" PATH_SEPARATOR "%s" PATH_SEPARATOR "final.png", curfile->name); + strprintf(dstfilename,"%s" PATH_SEPARATOR "%s", destdir.c_str(), destname); + strprintf(srcimgname,"snap" PATH_SEPARATOR "%s" PATH_SEPARATOR "final.png", curfile->name); /* open and load all unique bitmaps */ for (listnum = 0; listnum < list_count; listnum++) if (curfile->matchbitmap[listnum] == listnum) { - tempname.printf("%s" PATH_SEPARATOR "%s", lists[listnum].dir, srcimgname.c_str()); + strprintf(tempname, "%s" PATH_SEPARATOR "%s", lists[listnum].dir, srcimgname.c_str()); /* open the source image */ filerr = core_fopen(tempname.c_str(), OPEN_FLAG_READ, &file); @@ -948,20 +948,20 @@ error: file between differing versions -------------------------------------------------*/ -static void create_linked_file(astring &dirname, const summary_file *curfile, const summary_file *prevfile, const summary_file *nextfile, const char *pngfile, astring &tempheader, astring &tempfooter) +static void create_linked_file(std::string &dirname, const summary_file *curfile, const summary_file *prevfile, const summary_file *nextfile, const char *pngfile, std::string &tempheader, std::string &tempfooter) { - astring linkname; - astring filename; - astring title; + std::string linkname; + std::string filename; + std::string title; core_file *linkfile; int listnum; /* create the filename */ - filename.printf("%s.html", curfile->name); + strprintf(filename,"%s.html", curfile->name); /* output header */ - title.printf("%s Regressions (%s)", curfile->name, curfile->source); - linkname.printf("%s" PATH_SEPARATOR "%s", dirname.c_str(), filename.c_str()); + strprintf(title, "%s Regressions (%s)", curfile->name, curfile->source); + strprintf(linkname,"%s" PATH_SEPARATOR "%s", dirname.c_str(), filename.c_str()); linkfile = create_file_and_output_header(linkname, tempheader, title); if (linkfile == NULL) { @@ -998,7 +998,7 @@ static void create_linked_file(astring &dirname, const summary_file *curfile, co if (imageindex != -1) core_fprintf(linkfile, " [%d]", imageindex); core_fprintf(linkfile, "\t</p>\n"); - if (curfile->text[listnum].len() != 0) + if (curfile->text[listnum].length() != 0) { core_fprintf(linkfile, "\t<p>\n"); core_fprintf(linkfile, "\t<b>Errors:</b>\n"); @@ -1026,7 +1026,7 @@ static void create_linked_file(astring &dirname, const summary_file *curfile, co of drivers from a list to an HTML file -------------------------------------------------*/ -static void append_driver_list_table(const char *header, astring &dirname, core_file *indexfile, const summary_file *listhead, astring &tempheader, astring &tempfooter) +static void append_driver_list_table(const char *header, std::string &dirname, core_file *indexfile, const summary_file *listhead, std::string &tempheader, std::string &tempfooter) { const summary_file *curfile, *prevfile; int width = 100 / (2 + list_count); diff --git a/src/tools/split.c b/src/tools/split.c index 8f598064ffd..302bc6d8d7f 100644 --- a/src/tools/split.c +++ b/src/tools/split.c @@ -13,7 +13,6 @@ #include <string.h> #include <ctype.h> #include <assert.h> -#include "astring.h" #include "corefile.h" #include "corestr.h" #include "sha1.h" @@ -33,7 +32,7 @@ hash over a buffer and return a string -------------------------------------------------*/ -static void compute_hash_as_string(astring &buffer, void *data, UINT32 length) +static void compute_hash_as_string(std::string &buffer, void *data, UINT32 length) { char expanded[SHA1_DIGEST_SIZE * 2]; UINT8 sha1digest[SHA1_DIGEST_SIZE]; @@ -54,7 +53,7 @@ static void compute_hash_as_string(astring &buffer, void *data, UINT32 length) } // copy it to the buffer - buffer.cpy(expanded, sizeof(expanded)); + buffer.assign(expanded, sizeof(expanded)); } @@ -64,9 +63,9 @@ static void compute_hash_as_string(astring &buffer, void *data, UINT32 length) static int split_file(const char *filename, const char *basename, UINT32 splitsize) { - astring outfilename, basefilename, splitfilename; + std::string outfilename, basefilename, splitfilename; core_file *outfile = NULL, *infile = NULL, *splitfile = NULL; - astring computedhash; + std::string computedhash; void *splitbuffer = NULL; int index, partnum; UINT64 totallength; @@ -111,13 +110,13 @@ static int split_file(const char *filename, const char *basename, UINT32 splitsi } // find the base name of the file - basefilename.cpy(basename); - index = basefilename.rchr(0, PATH_SEPARATOR[0]); + basefilename.assign(basename); + index = basefilename.find_last_of(PATH_SEPARATOR[0]); if (index != -1) - basefilename.del(0, index + 1); + basefilename.erase(0, index + 1); // compute the split filename - splitfilename.cpy(basename).cat(".split"); + splitfilename.assign(basename).append(".split"); // create the split file filerr = core_fopen(splitfilename.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_NO_BOM, &splitfile); @@ -153,7 +152,7 @@ static int split_file(const char *filename, const char *basename, UINT32 splitsi core_fprintf(splitfile, "hash=%s file=%s.%03d\n", computedhash.c_str(), basefilename.c_str(), partnum); // compute the full filename for this guy - outfilename.printf("%s.%03d", basename, partnum); + strprintf(outfilename,"%s.%03d", basename, partnum); // create it filerr = core_fopen(outfilename.c_str(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &outfile); @@ -216,9 +215,9 @@ cleanup: static int join_file(const char *filename, const char *outname, int write_output) { - astring expectedhash, computedhash; - astring outfilename, infilename; - astring basepath; + std::string expectedhash, computedhash; + std::string outfilename, infilename; + std::string basepath; core_file *outfile = NULL, *infile = NULL, *splitfile = NULL; void *splitbuffer = NULL; file_error filerr; @@ -241,21 +240,22 @@ static int join_file(const char *filename, const char *outname, int write_output fprintf(stderr, "Fatal error: corrupt or incomplete split file at line:\n%s\n", buffer); goto cleanup; } - outfilename.cpy(buffer + 10).trimspace(); + outfilename.assign(buffer + 10); + strtrimspace(outfilename); // compute the base path - basepath.cpy(filename); - index = basepath.rchr(0, PATH_SEPARATOR[0]); + basepath.assign(filename); + index = basepath.find_last_of(PATH_SEPARATOR[0]); if (index != -1) - basepath.del(index + 1); + basepath.erase(index + 1); else - basepath.reset(); + basepath.clear(); // override the output filename if specified, otherwise prepend the path if (outname != NULL) - outfilename.cpy(outname); + outfilename.assign(outname); else - outfilename.ins(0, basepath); + outfilename.insert(0, basepath); // read the split size if (!core_fgets(buffer, sizeof(buffer), splitfile) || sscanf(buffer, "splitsize=%d", &splitsize) != 1) @@ -299,13 +299,14 @@ static int join_file(const char *filename, const char *outname, int write_output fprintf(stderr, "Fatal error: corrupt or incomplete split file at line:\n%s\n", buffer); goto cleanup; } - expectedhash.cpy(buffer + 5, SHA1_DIGEST_SIZE * 2); - infilename.cpy(buffer + 5 + SHA1_DIGEST_SIZE * 2 + 6).trimspace(); + expectedhash.assign(buffer + 5, SHA1_DIGEST_SIZE * 2); + infilename.assign(buffer + 5 + SHA1_DIGEST_SIZE * 2 + 6); + strtrimspace(infilename); printf(" Reading file '%s'...", infilename.c_str()); // read the file's contents - infilename.ins(0, basepath); + infilename.insert(0, basepath); filerr = core_fload(infilename.c_str(), &splitbuffer, &length); if (filerr != FILERR_NONE) { @@ -318,7 +319,7 @@ static int join_file(const char *filename, const char *outname, int write_output compute_hash_as_string(computedhash, splitbuffer, length); // compare - if (computedhash.cmp(expectedhash)!=0) + if (computedhash.compare(expectedhash)!=0) { printf("\n"); fprintf(stderr, "Fatal error: file '%s' has incorrect hash\n Expected: %s\n Computed: %s\n", infilename.c_str(), expectedhash.c_str(), computedhash.c_str()); diff --git a/src/tools/src2html.c b/src/tools/src2html.c index 57bdbd9ba9b..91780cd2fc6 100644 --- a/src/tools/src2html.c +++ b/src/tools/src2html.c @@ -21,7 +21,7 @@ #include <ctype.h> #include <assert.h> #include "osdcore.h" -#include "astring.h" +#include "corestr.h" #include "corefile.h" @@ -66,14 +66,14 @@ struct token_entry struct include_path { include_path * next; - astring path; + std::string path; }; struct list_entry { list_entry * next; - astring name; + std::string name; }; @@ -202,17 +202,17 @@ static const token_entry c_token_table[] = ***************************************************************************/ // core output functions -static int recurse_dir(int srcrootlen, int dstrootlen, astring &srcdir, astring &dstdir, astring &tempheader, astring &tempfooter); -static int output_file(file_type type, int srcrootlen, int dstrootlen, astring &srcfile, astring &dstfile, bool link_to_file, astring &tempheader, astring &tempfooter); +static int recurse_dir(int srcrootlen, int dstrootlen, std::string &srcdir, std::string &dstdir, std::string &tempheader, std::string &tempfooter); +static int output_file(file_type type, int srcrootlen, int dstrootlen, std::string &srcfile, std::string &dstfile, bool link_to_file, std::string &tempheader, std::string &tempfooter); // HTML helpers -static core_file *create_file_and_output_header(astring &filename, astring &templatefile, astring &path); -static void output_footer_and_close_file(core_file *file, astring &templatefile, astring &path); +static core_file *create_file_and_output_header(std::string &filename, std::string &templatefile, std::string &path); +static void output_footer_and_close_file(core_file *file, std::string &templatefile, std::string &path); // path helpers -static astring &normalized_subpath(astring &dest, astring &path, int start); -static void output_path_as_links(core_file *file, astring &path, bool end_is_directory, bool link_to_file); -static bool find_include_file(astring &srcincpath, int srcrootlen, int dstrootlen, astring &srcfile, astring &dstfile, astring &filename); +static std::string &normalized_subpath(std::string &dest, std::string &path, int start); +static void output_path_as_links(core_file *file, std::string &path, bool end_is_directory, bool link_to_file); +static bool find_include_file(std::string &srcincpath, int srcrootlen, int dstrootlen, std::string &srcfile, std::string &dstfile, std::string &filename); @@ -234,7 +234,7 @@ int main(int argc, char *argv[]) { // loop over arguments include_path **incpathhead = &incpaths; - astring srcdir, dstdir, tempfilename, tempheader, tempfooter; + std::string srcdir, dstdir, tempfilename, tempheader, tempfooter; int unadorned = 0; for (int argnum = 1; argnum < argc; argnum++) { @@ -247,7 +247,7 @@ int main(int argc, char *argv[]) if (*incpathhead != NULL) { (*incpathhead)->next = NULL; - (*incpathhead)->path.cpy(&arg[2]).replacechr('/', PATH_SEPARATOR[0]); + strreplacechr((*incpathhead)->path.assign(&arg[2]), '/', PATH_SEPARATOR[0]); incpathhead = &(*incpathhead)->next; } } @@ -255,17 +255,17 @@ int main(int argc, char *argv[]) // other parameter else if (arg[0] != '-' && unadorned == 0) { - srcdir.cpy(arg); + srcdir.assign(arg); unadorned++; } else if (arg[0] != '-' && unadorned == 1) { - dstdir.cpy(arg); + dstdir.assign(arg); unadorned++; } else if (arg[0] != '-' && unadorned == 2) { - tempfilename.cpy(arg); + tempfilename.assign(arg); unadorned++; } else @@ -273,35 +273,35 @@ int main(int argc, char *argv[]) } // make sure we got 3 parameters - if (srcdir.len() == 0 || dstdir.len() == 0 || tempfilename.len() == 0) + if (srcdir.length() == 0 || dstdir.length() == 0 || tempfilename.length() == 0) usage(argv[0]); - // read the template file into an astring + // read the template file into an std::string UINT32 bufsize; void *buffer; if (core_fload(tempfilename.c_str(), &buffer, &bufsize) == FILERR_NONE) { - tempheader.cpy((const char *)buffer, bufsize); + tempheader.assign((const char *)buffer, bufsize); osd_free(buffer); } // verify the template - if (tempheader.len() == 0) + if (tempheader.length() == 0) { fprintf(stderr, "Unable to read template file\n"); return 1; } - int result = tempheader.find(0, "<!--CONTENT-->"); + int result = tempheader.find("<!--CONTENT-->"); if (result == -1) { fprintf(stderr, "Template is missing a <!--CONTENT--> marker\n"); return 1; } - tempfooter.cpy(tempheader).substr(result + 14, -1); + tempfooter.assign(tempheader).substr(result + 14, -1); tempheader.substr(0, result); // recurse over subdirectories - return recurse_dir(srcdir.len(), dstdir.len(), srcdir, dstdir, tempheader, tempfooter); + return recurse_dir(srcdir.length(), dstdir.length(), srcdir, dstdir, tempheader, tempfooter); } @@ -314,7 +314,7 @@ static int compare_list_entries(const void *p1, const void *p2) { const list_entry *entry1 = *(const list_entry **)p1; const list_entry *entry2 = *(const list_entry **)p2; - return entry1->name.cmp(entry2->name); + return entry1->name.compare(entry2->name); } @@ -322,17 +322,17 @@ static int compare_list_entries(const void *p1, const void *p2) recurse_dir - recurse through a directory -------------------------------------------------*/ -static int recurse_dir(int srcrootlen, int dstrootlen, astring &srcdir, astring &dstdir, astring &tempheader, astring &tempfooter) +static int recurse_dir(int srcrootlen, int dstrootlen, std::string &srcdir, std::string &dstdir, std::string &tempheader, std::string &tempfooter) { static const osd_dir_entry_type typelist[] = { ENTTYPE_DIR, ENTTYPE_FILE }; // extract a normalized subpath - astring srcdir_subpath; + std::string srcdir_subpath; normalized_subpath(srcdir_subpath, srcdir, srcrootlen + 1); // create an index file - astring indexname; - indexname.printf("%s%c%s", dstdir.c_str(), PATH_SEPARATOR[0], "index.html"); + std::string indexname; + strprintf(indexname,"%s%c%s", dstdir.c_str(), PATH_SEPARATOR[0], "index.html"); core_file *indexfile = create_file_and_output_header(indexname, tempheader, srcdir_subpath); // output the directory navigation @@ -362,7 +362,7 @@ static int recurse_dir(int srcrootlen, int dstrootlen, astring &srcdir, astring if (entry->type == entry_type && entry->name[0] != '.') { list_entry *lentry = new list_entry; - lentry->name.cpy(entry->name); + lentry->name.assign(entry->name); lentry->next = list; list = lentry; found++; @@ -401,11 +401,11 @@ static int recurse_dir(int srcrootlen, int dstrootlen, astring &srcdir, astring core_fprintf(indexfile, "\t<h2>%s</h2>\n\t<ul>\n", (entry_type == ENTTYPE_DIR) ? "Directories" : "Files"); // build the source filename - astring srcfile; - srcfile.printf("%s%c%s", srcdir.c_str(), PATH_SEPARATOR[0], curlist->name.c_str()); + std::string srcfile; + strprintf(srcfile, "%s%c%s", srcdir.c_str(), PATH_SEPARATOR[0], curlist->name.c_str()); // if we have a file, output it - astring dstfile; + std::string dstfile; if (entry_type == ENTTYPE_FILE) { // make sure we care, first @@ -420,17 +420,17 @@ static int recurse_dir(int srcrootlen, int dstrootlen, astring &srcdir, astring // if we got a valid file, process it if (type != FILE_TYPE_INVALID) { - dstfile.printf("%s%c%s.html", dstdir.c_str(), PATH_SEPARATOR[0], curlist->name.c_str()); + strprintf(dstfile, "%s%c%s.html", dstdir.c_str(), PATH_SEPARATOR[0], curlist->name.c_str()); if (indexfile != NULL) core_fprintf(indexfile, "\t<li><a href=\"%s.html\">%s</a></li>\n", curlist->name.c_str(), curlist->name.c_str()); - result = output_file(type, srcrootlen, dstrootlen, srcfile, dstfile, srcdir.cmp(dstdir)==0, tempheader, tempfooter); + result = output_file(type, srcrootlen, dstrootlen, srcfile, dstfile, srcdir.compare(dstdir) == 0, tempheader, tempfooter); } } // if we have a directory, recurse else { - dstfile.printf("%s%c%s", dstdir.c_str(), PATH_SEPARATOR[0], curlist->name.c_str()); + strprintf(dstfile, "%s%c%s", dstdir.c_str(), PATH_SEPARATOR[0], curlist->name.c_str()); if (indexfile != NULL) core_fprintf(indexfile, "\t<li><a href=\"%s/index.html\">%s/</a></li>\n", curlist->name.c_str(), curlist->name.c_str()); result = recurse_dir(srcrootlen, dstrootlen, srcfile, dstfile, tempheader, tempfooter); @@ -461,10 +461,10 @@ static int recurse_dir(int srcrootlen, int dstrootlen, astring &srcdir, astring HTML -------------------------------------------------*/ -static int output_file(file_type type, int srcrootlen, int dstrootlen, astring &srcfile, astring &dstfile, bool link_to_file, astring &tempheader, astring &tempfooter) +static int output_file(file_type type, int srcrootlen, int dstrootlen, std::string &srcfile, std::string &dstfile, bool link_to_file, std::string &tempheader, std::string &tempfooter) { // extract a normalized subpath - astring srcfile_subpath; + std::string srcfile_subpath; normalized_subpath(srcfile_subpath, srcfile, srcrootlen + 1); fprintf(stderr, "Processing %s\n", srcfile_subpath.c_str()); @@ -547,8 +547,8 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, astring & while (core_fgets(srcline, ARRAY_LENGTH(srcline), src) != NULL) { // start with the line number - astring dstline; - dstline.catprintf("<span class=\"linenum\">%5d</span> ", linenum++); + std::string dstline; + strcatprintf(dstline, "<span class=\"linenum\">%5d</span> ", linenum++); // iterate over characters in the source line bool escape = false; @@ -568,7 +568,7 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, astring & { if (!in_comment && ch == comment_start[0] && strncmp(srcptr - 1, comment_start, strlen(comment_start)) == 0) { - dstline.catprintf("<span class=\"comment\">%s", comment_start_esc); + strcatprintf(dstline, "<span class=\"comment\">%s", comment_start_esc); curcol += strlen(comment_start); srcptr += strlen(comment_start) - 1; ch = 0; @@ -576,7 +576,7 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, astring & } else if (in_comment && ch == comment_end[0] && strncmp(srcptr - 1, comment_end, strlen(comment_end)) == 0) { - dstline.catprintf("%s</span>", comment_end_esc); + strcatprintf(dstline, "%s</span>", comment_end_esc); curcol += strlen(comment_end); srcptr += strlen(comment_end) - 1; ch = 0; @@ -587,7 +587,7 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, astring & // track whether or not we are within an inline (C++-style) comment if (!in_quotes && !in_comment && !in_inline_comment && ch == comment_inline[0] && strncmp(srcptr - 1, comment_inline, strlen(comment_inline)) == 0) { - dstline.catprintf("<span class=\"comment\">%s", comment_inline_esc); + strcatprintf(dstline, "<span class=\"comment\">%s", comment_inline_esc); curcol += strlen(comment_inline); srcptr += strlen(comment_inline) - 1; ch = 0; @@ -611,7 +611,7 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, astring & for (curtoken = token_table; curtoken->token != NULL; curtoken++) if (strncmp(srcptr - 1, curtoken->token, toklength) == 0 && strlen(curtoken->token) == toklength) { - dstline.catprintf("<span class=\"%s\">%s</span>", curtoken->color, curtoken->token); + strcatprintf(dstline, "<span class=\"%s\">%s</span>", curtoken->color, curtoken->token); curcol += strlen(curtoken->token); srcptr += strlen(curtoken->token) - 1; ch = 0; @@ -631,7 +631,7 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, astring & int spaces = 4 - curcol % 4; while (spaces--) { - dstline.cat(' '); + dstline.push_back(' '); curcol++; } } @@ -643,9 +643,9 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, astring & if (!in_comment && !in_inline_comment && !in_quotes && (ch == '"' || ch == '\'')) { if (color_quotes) - dstline.catprintf("<span class=\"string\">%c", ch); + strcatprintf(dstline, "<span class=\"string\">%c", ch); else - dstline.cat(ch); + dstline.push_back(ch); in_quotes = true; curquote = ch; @@ -655,11 +655,11 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, astring & char *endquote = strchr(srcptr, ch); if (endquote != NULL) { - astring filename(srcptr, endquote - srcptr); - astring target; + std::string filename(srcptr, endquote - srcptr); + std::string target; if (find_include_file(target, srcrootlen, dstrootlen, srcfile, dstfile, filename)) { - dstline.catprintf("<a href=\"%s\">", target.c_str()); + strcatprintf(dstline, "<a href=\"%s\">", target.c_str()); quotes_are_linked = true; } } @@ -670,11 +670,11 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, astring & else if (!in_comment && !in_inline_comment && in_quotes && (ch == curquote) && !escape) { if (quotes_are_linked) - dstline.catprintf("</a>"); + dstline.append("</a>"); if (color_quotes) - dstline.catprintf("%c</span>", ch); + strcatprintf(dstline, "%c</span>", ch); else - dstline.cat(ch); + dstline.push_back(ch); in_quotes = false; curquote = 0; quotes_are_linked = false; @@ -682,13 +682,13 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, astring & // else just output the current character else if (ch == '&') - dstline.catprintf("&"); + dstline.append("&"); else if (ch == '<') - dstline.catprintf("<"); + dstline.append("<"); else if (ch == '>') - dstline.catprintf(">"); + dstline.append(">"); else - dstline.cat(ch); + dstline.push_back(ch); curcol++; } @@ -700,12 +700,12 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, astring & // finish inline comments if (in_inline_comment) { - dstline.catprintf("</span>"); + dstline.append("</span>"); in_inline_comment = false; } // append a break and move on - dstline.catprintf("\n"); + dstline.append("\n"); core_fputs(dst, dstline.c_str()); } @@ -729,7 +729,7 @@ static int output_file(file_type type, int srcrootlen, int dstrootlen, astring & HTML file with a standard header -------------------------------------------------*/ -static core_file *create_file_and_output_header(astring &filename, astring &templatefile, astring &path) +static core_file *create_file_and_output_header(std::string &filename, std::string &templatefile, std::string &path) { // create the indexfile core_file *file; @@ -737,9 +737,9 @@ static core_file *create_file_and_output_header(astring &filename, astring &temp return NULL; // print a header - astring modified(templatefile); - modified.replace(0, "<!--PATH-->", path.c_str()); - core_fwrite(file, modified.c_str(), modified.len()); + std::string modified(templatefile); + strreplace(modified, "<!--PATH-->", path.c_str()); + core_fwrite(file, modified.c_str(), modified.length()); // return the file return file; @@ -751,11 +751,11 @@ static core_file *create_file_and_output_header(astring &filename, astring &temp standard footer to an HTML file and close it -------------------------------------------------*/ -static void output_footer_and_close_file(core_file *file, astring &templatefile, astring &path) +static void output_footer_and_close_file(core_file *file, std::string &templatefile, std::string &path) { - astring modified(templatefile); - modified.replace(0, "<!--PATH-->", path.c_str()); - core_fwrite(file, modified.c_str(), modified.len()); + std::string modified(templatefile); + strreplace(modified, "<!--PATH-->", path.c_str()); + core_fwrite(file, modified.c_str(), modified.length()); core_fclose(file); } @@ -770,9 +770,10 @@ static void output_footer_and_close_file(core_file *file, astring &templatefile, forward slashes and extract a subpath -------------------------------------------------*/ -static astring &normalized_subpath(astring &dest, astring &path, int start) +static std::string &normalized_subpath(std::string &dest, std::string &path, int start) { - return dest.cpysubstr(path, start, -1).replacechr(PATH_SEPARATOR[0], '/'); + strreplacechr(dest.assign(path.substr(start, -1)),PATH_SEPARATOR[0], '/'); + return dest; } @@ -781,11 +782,11 @@ static astring &normalized_subpath(astring &dest, astring &path, int start) series of links -------------------------------------------------*/ -static void output_path_as_links(core_file *file, astring &path, bool end_is_directory, bool link_to_file) +static void output_path_as_links(core_file *file, std::string &path, bool end_is_directory, bool link_to_file) { // first count how deep we are int srcdepth = 0; - for (int slashindex = path.chr(0, '/'); slashindex != -1; slashindex = path.chr(slashindex + 1, '/')) + for (int slashindex = path.find_first_of('/'); slashindex != -1; slashindex = path.find_first_of('/', slashindex + 1)) srcdepth++; if (end_is_directory) srcdepth++; @@ -799,9 +800,9 @@ static void output_path_as_links(core_file *file, astring &path, bool end_is_dir // now output links to each path up the chain int curdepth = 0; int lastslash = 0; - for (int slashindex = path.chr(lastslash, '/'); slashindex != -1; slashindex = path.chr(lastslash, '/')) + for (int slashindex = path.find_first_of('/', lastslash); slashindex != -1; slashindex = path.find_first_of('/', lastslash)) { - astring substr(path, lastslash, slashindex - lastslash); + std::string substr(path, lastslash, slashindex - lastslash); curdepth++; core_fprintf(file, "<a href=\""); @@ -813,7 +814,7 @@ static void output_path_as_links(core_file *file, astring &path, bool end_is_dir } // and a final link to the current directory - astring substr(path, lastslash, -1); + std::string substr(path, lastslash, -1); if (end_is_directory) core_fprintf(file, "<a href=\"index.html\">%s</a>", substr.c_str()); else if (link_to_file) @@ -827,41 +828,41 @@ static void output_path_as_links(core_file *file, astring &path, bool end_is_dir find_include_file - find an include file -------------------------------------------------*/ -static bool find_include_file(astring &srcincpath, int srcrootlen, int dstrootlen, astring &srcfile, astring &dstfile, astring &filename) +static bool find_include_file(std::string &srcincpath, int srcrootlen, int dstrootlen, std::string &srcfile, std::string &dstfile, std::string &filename) { // iterate over include paths and find the file for (include_path *curpath = incpaths; curpath != NULL; curpath = curpath->next) { // a '.' include path is specially treated - if (curpath->path.cmp(".")==0) - srcincpath.cpysubstr(srcfile, 0, srcfile.rchr(0, PATH_SEPARATOR[0])); + if (curpath->path.compare(".") == 0) + srcincpath.assign(srcfile.substr(0, srcfile.find_last_of(PATH_SEPARATOR[0]))); else - srcincpath.cpysubstr(srcfile, 0, srcrootlen + 1).cat(curpath->path); + srcincpath.assign(srcfile.substr(0, srcrootlen + 1)).append(curpath->path); // append the filename piecemeal to account for directories int lastsepindex = 0; int sepindex; - while ((sepindex = filename.chr(lastsepindex, '/')) != -1) + while ((sepindex = filename.find_first_of('/', lastsepindex)) != -1) { // handle .. by removing a chunk from the incpath - astring pathpart(filename, lastsepindex, sepindex - lastsepindex); - if (pathpart.cmp("..")==0) + std::string pathpart(filename, lastsepindex, sepindex - lastsepindex); + if (pathpart.compare("..")==0) { - sepindex = srcincpath.rchr(0, PATH_SEPARATOR[0]); + sepindex = srcincpath.find_last_of(PATH_SEPARATOR[0]); if (sepindex != -1) srcincpath.substr(0, sepindex); } // otherwise, append a path separator and the pathpart else - srcincpath.cat(PATH_SEPARATOR).cat(pathpart); + srcincpath.append(PATH_SEPARATOR).append(pathpart); // advance past the previous index lastsepindex = sepindex + 1; } // now append the filename - srcincpath.cat(PATH_SEPARATOR).catsubstr(filename, lastsepindex, -1); + srcincpath.append(PATH_SEPARATOR).append(filename.substr(lastsepindex, -1)); // see if we can open it core_file *testfile; @@ -872,29 +873,30 @@ static bool find_include_file(astring &srcincpath, int srcrootlen, int dstrootle // find the longest matching directory substring between the include and source file lastsepindex = 0; - while ((sepindex = srcincpath.chr(lastsepindex, PATH_SEPARATOR[0])) != -1) + while ((sepindex = srcincpath.find_first_of(PATH_SEPARATOR[0], lastsepindex)) != -1) { // get substrings up to the current directory - astring tempfile(srcfile, 0, sepindex); - astring tempinc(srcincpath, 0, sepindex); + std::string tempfile(srcfile, 0, sepindex); + std::string tempinc(srcincpath, 0, sepindex); // if we don't match, stop - if (tempfile.cmp(tempinc)!=0) + if (tempfile.compare(tempinc)!=0) break; lastsepindex = sepindex + 1; } // chop off the common parts of the paths - astring tempfile(srcfile, lastsepindex, -1); - srcincpath.substr(lastsepindex, -1).replacechr(PATH_SEPARATOR[0], '/'); + std::string tempfile(srcfile, lastsepindex, -1); + srcincpath = srcincpath.substr(lastsepindex, -1); + strreplacechr(srcincpath, PATH_SEPARATOR[0], '/'); // for each directory left in the filename, we need to prepend a "../" - while ((sepindex = tempfile.chr(0, PATH_SEPARATOR[0])) != -1) + while ((sepindex = tempfile.find_first_of(PATH_SEPARATOR[0])) != -1) { tempfile.substr(sepindex + 1, -1); - srcincpath.ins(0, "../"); + srcincpath.insert(0, "../"); } - srcincpath.cat(".html"); + srcincpath.append(".html"); // free the strings and return the include path return true; |