diff options
author | 2012-09-04 13:21:17 +0000 | |
---|---|---|
committer | 2012-09-04 13:21:17 +0000 | |
commit | 97409c7e6fc342baa188e50ce4671761b977266a (patch) | |
tree | 5e796880f49925f37d93ce3ec3aaf9e70e3def47 /src | |
parent | 491e447c938f1a9d30891a6f5b29603e41dd6de2 (diff) |
Made cmd line parameter parsing going into unlimited levels (no whatsnew)
Diffstat (limited to 'src')
-rw-r--r-- | src/emu/emuopts.c | 24 | ||||
-rw-r--r-- | src/lib/util/options.c | 12 | ||||
-rw-r--r-- | src/lib/util/options.h | 2 |
3 files changed, 30 insertions, 8 deletions
diff --git a/src/emu/emuopts.c b/src/emu/emuopts.c index 4346148dc2e..193913ab8f4 100644 --- a/src/emu/emuopts.c +++ b/src/emu/emuopts.c @@ -377,10 +377,16 @@ bool emu_options::parse_slot_devices(int argc, char *argv[], astring &error_stri set_value(name, value, OPTION_PRIORITY_CMDLINE, error_string); } result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); - update_slot_options(); - while (add_slot_options(false)); - add_device_options(true); - result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); + + int num = 0; + do { + num = options_count(); + update_slot_options(); + while (add_slot_options(false)); + add_device_options(false); + result = core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string); + } while(num != options_count()); + return result; } @@ -510,9 +516,13 @@ void emu_options::set_system_name(const char *name) } // then add the options add_device_options(true); - update_slot_options(); - while (add_slot_options(false)); - add_device_options(true); + int num = 0; + do { + num = options_count(); + update_slot_options(); + while (add_slot_options(false)); + add_device_options(false); + } while(num != options_count()); } } diff --git a/src/lib/util/options.c b/src/lib/util/options.c index ea4d5af509f..5e46d0e98b2 100644 --- a/src/lib/util/options.c +++ b/src/lib/util/options.c @@ -811,3 +811,15 @@ bool core_options::validate_and_set_data(core_options::entry &curentry, const ch curentry.set_value(data, priority); return true; } + +//------------------------------------------------- +// options_count - take number of existing +// number of options in structure +//------------------------------------------------- + +int core_options::options_count() +{ + int number = 0; + for (entry *curentry = m_entrylist; curentry != NULL; curentry = curentry->next()) number++; + return number; +}
\ No newline at end of file diff --git a/src/lib/util/options.h b/src/lib/util/options.h index c8fbf5e1f51..6a107cbfad4 100644 --- a/src/lib/util/options.h +++ b/src/lib/util/options.h @@ -187,7 +187,7 @@ public: // misc static const char *unadorned(int x = 0) { return s_option_unadorned[MIN(x, MAX_UNADORNED_OPTIONS)]; } - + int options_count(); private: // internal helpers void reset(); |