From 91921618c2e06bd0ed073b8efccd31a127c9012d Mon Sep 17 00:00:00 2001 From: AJR Date: Wed, 20 Jan 2021 17:46:03 -0500 Subject: Much more core std::string_view modernization - Remove corestr.h from emu.h; update a few source files to not use it at all - Change strtrimspace, strtrimrightspace and core_filename_extract_* to be pure functions taking a std::string_view by value and returning the same type - Change strmakeupper and strmakelower to be pure functions taking a std::string_view and constructing a std::string - Remove the string-modifying version of zippath_parent - Change tag-based lookup functions in device_t to take std::string_view instead of const std::string & or const char * - Remove the subdevice tag cache from device_t (since device finders are now recommended) and replace it with a map covering directly owned subdevices only - Move the working directory setup method out of device_image_interface (only the UI seems to actually use the full version of this) - Change output_manager to use std::string_view for output name arguments - Change core_options to accept std::string_view for most name and value arguments (return values are still C strings for now) - Change miscellaneous other functions to accept std::string_view arguments - Remove a few string accessor macros from romload.h - Remove many unnecessary c_str() calls from logging/error messages --- src/frontend/mame/luaengine.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/frontend/mame/luaengine.cpp') diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp index 0c7b9c046fc..d8ec8c746db 100644 --- a/src/frontend/mame/luaengine.cpp +++ b/src/frontend/mame/luaengine.cpp @@ -26,6 +26,8 @@ #include "softlist.h" #include "uiinput.h" +#include "corestr.h" + #include #include @@ -882,7 +884,7 @@ void lua_engine::initialize() })); file_type.set("read", [](emu_file &file, sol::buffer *buff) { buff->set_len(file.read(buff->get_ptr(), buff->get_len())); return buff; }); file_type.set("write", [](emu_file &file, const std::string &data) { return file.write(data.data(), data.size()); }); - file_type.set("open", static_cast(&emu_file::open)); + file_type.set("open", static_cast(&emu_file::open)); file_type.set("open_next", &emu_file::open_next); file_type.set("seek", sol::overload( [](emu_file &file) { return file.tell(); }, @@ -1375,8 +1377,8 @@ void lua_engine::initialize() device_type["memshare"] = &device_t::memshare; device_type["membank"] = &device_t::membank; device_type["ioport"] = &device_t::ioport; - device_type["subdevice"] = static_cast(&device_t::subdevice); - device_type["siblingdevice"] = static_cast(&device_t::siblingdevice); + device_type["subdevice"] = static_cast(&device_t::subdevice); + device_type["siblingdevice"] = static_cast(&device_t::siblingdevice); device_type["parameter"] = &device_t::parameter; device_type["tag"] = sol::property(&device_t::tag); device_type["basetag"] = sol::property(&device_t::basetag); @@ -1582,9 +1584,9 @@ void lua_engine::initialize() auto image_type = sol().registry().new_usertype("image", "new", sol::no_constructor); image_type["load"] = &device_image_interface::load; - image_type["load_software"] = static_cast(&device_image_interface::load_software); + image_type["load_software"] = static_cast(&device_image_interface::load_software); image_type["unload"] = &device_image_interface::unload; - image_type["create"] = static_cast(&device_image_interface::create); + image_type["create"] = static_cast(&device_image_interface::create); image_type["display"] = &device_image_interface::call_display; image_type["is_readable"] = sol::property(&device_image_interface::is_readable); image_type["is_writeable"] = sol::property(&device_image_interface::is_writeable); @@ -1818,13 +1820,13 @@ void lua_engine::initialize() output_type["set_indexed_value"] = [] (output_manager &o, char const *basename, int index, int value) { - o.set_value(util::string_format("%s%d", basename, index).c_str(), value); + o.set_value(util::string_format("%s%d", basename, index), value); }; output_type["get_value"] = &output_manager::get_value; output_type["get_indexed_value"] = [] (output_manager &o, char const *basename, int index) { - return o.get_value(util::string_format("%s%d", basename, index).c_str()); + return o.get_value(util::string_format("%s%d", basename, index)); }; output_type["name_to_id"] = &output_manager::name_to_id; output_type["id_to_name"] = &output_manager::id_to_name; -- cgit v1.2.3-70-g09d2