Fix another round of suggestions.

Signed-off-by: Ricky Zhang <rickyzhang@gmail.com>
This commit is contained in:
Ricky Zhang 2017-09-04 14:21:16 -04:00
parent 597ff0666c
commit 93e800ffc7
No known key found for this signature in database
GPG Key ID: 681AFAEF6CDEDB4C
3 changed files with 50 additions and 50 deletions

View File

@ -33,8 +33,8 @@
#endif #endif
static const char* STR_ACTIVE_BREAK_POINTS = "Active Break Points:\n"; static const char STR_ACTIVE_BREAK_POINTS[] = "Active Break Points:\n";
static const char* STR_DISABLED_BREAK_POINTS = "Disabled Break Points:\n"; static const char STR_DISABLED_BREAK_POINTS[] = "Disabled Break Points:\n";
/* /*
* range_args = [expression] [[COMMA] expression] END * range_args = [expression] [[COMMA] expression] END
@ -347,7 +347,7 @@ bool validate_index(uintptr *index_ptr, const BREAK_POINT_SET& break_point_set)
} }
if (*index_ptr > break_point_set.size()) { if (*index_ptr > break_point_set.size()) {
mon_error("Illegal Index Number!"); mon_error("Illegal index number!");
return false; return false;
} }
@ -418,8 +418,7 @@ void break_point_enable(void)
return; return;
if (0 == index) { if (0 == index) {
for (BREAK_POINT_SET::iterator it = disabled_break_points.begin(); it != disabled_break_points.end(); it++) active_break_points.insert(disabled_break_points.begin(), disabled_break_points.end());
active_break_points.insert(*it);
disabled_break_points.clear(); disabled_break_points.clear();
printf("Enabled all break points!\n"); printf("Enabled all break points!\n");
return; return;
@ -469,8 +468,6 @@ void break_point_info(void)
*/ */
void break_point_save(void) void break_point_save(void)
{ {
FILE *file;
if (mon_token == T_END) { if (mon_token == T_END) {
mon_error("Missing file name"); mon_error("Missing file name");
return; return;
@ -485,9 +482,12 @@ void break_point_save(void)
return; return;
} }
if (!(file = fopen(mon_string, "w"))) FILE *file;
if (!(file = fopen(mon_string, "w"))) {
mon_error("Unable to create file"); mon_error("Unable to create file");
else { return;
}
BREAK_POINT_SET::iterator it; BREAK_POINT_SET::iterator it;
fprintf(file, STR_ACTIVE_BREAK_POINTS); fprintf(file, STR_ACTIVE_BREAK_POINTS);
@ -500,7 +500,6 @@ void break_point_save(void)
fclose(file); fclose(file);
} }
}
/* /*
@ -508,8 +507,6 @@ void break_point_save(void)
*/ */
void break_point_load(void) void break_point_load(void)
{ {
FILE *file;
if (mon_token == T_END) { if (mon_token == T_END) {
mon_error("Missing file name"); mon_error("Missing file name");
return; return;
@ -524,15 +521,19 @@ void break_point_load(void)
return; return;
} }
if (!(file = fopen(mon_string, "r"))) FILE *file;
if (!(file = fopen(mon_string, "r"))) {
mon_error("Unable to create file"); mon_error("Unable to create file");
else { return;
}
char line_buff[1024]; char line_buff[1024];
bool is_disabled_break_points = false;; bool is_disabled_break_points = false;;
if (fgets(line_buff, sizeof(line_buff), file) == NULL || if (fgets(line_buff, sizeof(line_buff), file) == NULL ||
strcmp(line_buff, STR_ACTIVE_BREAK_POINTS) != 0) { strcmp(line_buff, STR_ACTIVE_BREAK_POINTS) != 0) {
mon_error("Invalid break point file format!"); mon_error("Invalid break point file format!");
fclose(file);
return; return;
} }
@ -553,7 +554,6 @@ void break_point_load(void)
fclose(file); fclose(file);
} }
}
/* /*

View File

@ -1,5 +1,5 @@
# What # What
suspend.bin is a MacBinary file which should be upacked and run in M68k Macintosh only. It runs emul_op `0x7138` and trigger BasiliskII into cxmon so that you can add break points there. suspend.bin is a MacBinary file which should be unpacked and run in M68k Macintosh only. It runs emul_op `0x7138` and trigger BasiliskII into cxmon so that you can add break points there.
# How # How
1. You must build Basilisk II `--with-mon=YES` options. 1. You must build Basilisk II `--with-mon=YES` options.