Made cmd line parameter parsing going into unlimited levels (no whatsnew)

This commit is contained in:
Miodrag Milanovic 2012-09-04 13:21:17 +00:00
parent 491e447c93
commit 97409c7e6f
3 changed files with 30 additions and 8 deletions

View File

@ -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());
}
}

View File

@ -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;
}

View File

@ -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();