- moved the logic to exclude log level / log action combinations that don't
make sense to siminterface.h and use it in the win32 dialog and for bochsrc parsing
This commit is contained in:
parent
c48e516386
commit
e2a1e8192d
@ -1969,6 +1969,12 @@ static Bit32s parse_log_options(const char *context, int num_params, char *param
|
||||
free(param);
|
||||
return -1;
|
||||
}
|
||||
// exclude some action / level combinations (see siminterface.h)
|
||||
if (BX_LOG_OPTS_EXCLUDE(level, action)) {
|
||||
PARSE_ERR(("%s: event type '%s' does not support log action '%s'.", context, params[0], actstr));
|
||||
free(param);
|
||||
return -1;
|
||||
}
|
||||
if (def_action) {
|
||||
SIM->set_default_log_action(level, action);
|
||||
} else {
|
||||
|
@ -173,6 +173,16 @@ typedef enum {
|
||||
N_ACT
|
||||
} bx_log_actions;
|
||||
|
||||
// normally all action choices are available for all event types. The exclude
|
||||
// expression allows some choices to be eliminated if they don't make any
|
||||
// sense. For example, it would be stupid to ignore a panic.
|
||||
#define BX_LOG_OPTS_EXCLUDE(type, choice) ( \
|
||||
/* can't die or ask, on debug or info events */ \
|
||||
(type <= LOGLEV_INFO && (choice == ACT_ASK || choice == ACT_FATAL)) \
|
||||
/* can't ignore panics */ \
|
||||
|| (type == LOGLEV_PANIC && choice == ACT_IGNORE) \
|
||||
)
|
||||
|
||||
// boot devices (using the same values as the rombios)
|
||||
enum {
|
||||
BX_BOOT_NONE,
|
||||
|
@ -332,7 +332,9 @@ void SetStandardLogOptions(HWND hDlg)
|
||||
idx = 0;
|
||||
SendMessage(GetDlgItem(hDlg, IDLOGEVT1+level), CB_RESETCONTENT, 0, 0);
|
||||
for (int action=0; action<5; action++) {
|
||||
if ((level > 1 && action > 0) || (level < 2 && (action < 2 || action > 3))) {
|
||||
// the exclude expression allows some choices not being available if they
|
||||
// don't make any sense. For example, it would be stupid to ignore a panic.
|
||||
if (!BX_LOG_OPTS_EXCLUDE(level, action)) {
|
||||
SendMessage(GetDlgItem(hDlg, IDLOGEVT1+level), CB_ADDSTRING, 0, (LPARAM)log_choices[action]);
|
||||
SendMessage(GetDlgItem(hDlg, IDLOGEVT1+level), CB_SETITEMDATA, idx, action);
|
||||
if (action == defchoice[level]) {
|
||||
@ -355,7 +357,8 @@ void SetAdvancedLogOptions(HWND hDlg)
|
||||
idx = 0;
|
||||
SendMessage(GetDlgItem(hDlg, IDLOGEVT1+level), CB_RESETCONTENT, 0, 0);
|
||||
for (int action=0; action<4; action++) {
|
||||
if ((level > 1 && action > 0) || (level < 2 && action < 2)) {
|
||||
// exclude some action / level combinations (see above)
|
||||
if (!BX_LOG_OPTS_EXCLUDE(level, action)) {
|
||||
SendMessage(GetDlgItem(hDlg, IDLOGEVT1+level), CB_ADDSTRING, 0, (LPARAM)log_choices[action]);
|
||||
SendMessage(GetDlgItem(hDlg, IDLOGEVT1+level), CB_SETITEMDATA, idx, action);
|
||||
if (action == SIM->get_log_action (mod, level)) {
|
||||
|
@ -349,7 +349,7 @@ void AdvancedLogOptionsDialog::SetAction(int dev, int evtype, int act) {
|
||||
}
|
||||
}
|
||||
// this can happen if one of the choices that is excluded by
|
||||
// ADVLOG_OPTS_EXCLUDE() is used, for example.
|
||||
// BX_LOG_OPTS_EXCLUDE() is used, for example.
|
||||
wxLogDebug(wxT("warning: SetAction type=%d act=%d not found"), evtype, act);
|
||||
}
|
||||
|
||||
@ -1657,7 +1657,7 @@ void LogOptionsDialog::SetAction(int evtype, int a)
|
||||
}
|
||||
}
|
||||
// this can happen if one of the choices that is excluded by
|
||||
// LOG_OPTS_EXCLUDE() is used, for example.
|
||||
// BX_LOG_OPTS_EXCLUDE() is used, for example.
|
||||
wxLogDebug(wxT("SetAction type=%d a=%d not found"), evtype, a);
|
||||
}
|
||||
|
||||
@ -1772,9 +1772,9 @@ wxChoice *makeLogOptionChoiceBox (wxWindow *parent,
|
||||
int lastChoice = 0; // remember index of last choice
|
||||
int nchoice = includeNoChange? LOG_OPTS_N_CHOICES : LOG_OPTS_N_CHOICES_NORMAL;
|
||||
for (int choice=0; choice<nchoice; choice++) {
|
||||
// the exclude expression allows some choices to not be available
|
||||
// for some times. For example, it would be stupid to ignore a panic.
|
||||
if (!LOG_OPTS_EXCLUDE(evtype, choice)) {
|
||||
// the exclude expression allows some choices not being available if they
|
||||
// don't make any sense. For example, it would be stupid to ignore a panic.
|
||||
if (!BX_LOG_OPTS_EXCLUDE(evtype, choice)) {
|
||||
control->Append(choices[choice], &integers[choice]);
|
||||
// the client data is an int* that points to the choice number.
|
||||
// This is what will be returned by GetAction().
|
||||
|
@ -376,15 +376,6 @@ private:
|
||||
#define LOG_OPTS_N_CHOICES_NORMAL 4
|
||||
#define LOG_OPTS_N_CHOICES 5 // number of choices, including "no change"
|
||||
#define LOG_OPTS_NO_CHANGE 4 // index of "no change"
|
||||
// normally all choices are available for all event types. The exclude
|
||||
// expression allows some choices to be eliminated if they don't make any
|
||||
// sense. For example, it would be stupid to ignore a panic.
|
||||
#define LOG_OPTS_EXCLUDE(type,choice) ( \
|
||||
/* can't die or ask, on debug or info events */ \
|
||||
(type <= LOGLEV_INFO && (choice == ACT_ASK || choice == ACT_FATAL)) \
|
||||
/* can't ignore panics or errors */ \
|
||||
|| (type == LOGLEV_PANIC && choice == ACT_IGNORE) \
|
||||
)
|
||||
#define LOG_OPTS_ADV wxT("For additional control over how each device responds to events, use the menu option \"Log ... By Device\".")
|
||||
wxFlexGridSizer *gridSizer;
|
||||
wxChoice *action[LOG_OPTS_N_TYPES];
|
||||
|
Loading…
Reference in New Issue
Block a user