Merge pull request #581 from ajrhacker/validity

Some more validity checking improvements [AJR]
This commit is contained in:
Miodrag Milanović 2016-01-25 08:21:28 +01:00
commit 3e6d16125c
3 changed files with 11 additions and 12 deletions

View File

@ -1595,7 +1595,8 @@ void cli_frontend::execute_commands(const char *exename)
if (strcmp(m_options.command(), CLICOMMAND_VALIDATE) == 0)
{
validity_checker valid(m_options);
bool result = valid.check_all();
const char *sysname = m_options.system_name();
bool result = valid.check_all_matching((sysname[0] == 0) ? "*" : sysname);
if (!result)
throw emu_fatalerror(MAMERR_FAILED_VALIDITY, "Validity check failed (%d errors, %d warnings in total)\n", valid.errors(), valid.warnings());
return;

View File

@ -184,10 +184,11 @@ void validity_checker::check_shared_source(const game_driver &driver)
//-------------------------------------------------
// check_all - check all drivers
// check_all_matching - check all drivers whose
// names match the given string
//-------------------------------------------------
bool validity_checker::check_all()
bool validity_checker::check_all_matching(const char *string)
{
// start by checking core stuff
validate_begin();
@ -210,7 +211,8 @@ bool validity_checker::check_all()
// then iterate over all drivers and check them
m_drivlist.reset();
while (m_drivlist.next())
validate_one(m_drivlist.driver());
if (m_drivlist.matches(string, m_drivlist.driver().name))
validate_one(m_drivlist.driver());
// cleanup
validate_end();
@ -967,17 +969,13 @@ void validity_checker::validate_devices()
device_iterator iter_find(m_current_config->root_device());
for (const device_t *device = iter_find.first(); device != nullptr; device = iter_find.next())
{
device->findit(true);
}
// iterate over devices
device_iterator iter(m_current_config->root_device());
for (const device_t *device = iter.first(); device != nullptr; device = iter.next())
{
// track the current device
m_current_device = device;
// validate auto-finders
device->findit(true);
// validate the device tag
validate_tag(device->basetag());

View File

@ -46,7 +46,7 @@ public:
// operations
void check_driver(const game_driver &driver);
void check_shared_source(const game_driver &driver);
bool check_all();
bool check_all_matching(const char *string = "*");
// helpers for devices
void validate_tag(const char *tag);