1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-12-21 08:30:55 +00:00

Remove option flags; remove unnecessary --flash option

This commit is contained in:
Peter Evans 2018-03-21 15:26:58 -05:00
parent a461194a63
commit 2870bc03bc
4 changed files with 3 additions and 37 deletions

View File

@ -5,8 +5,7 @@
#include <stdio.h>
enum option_flags {
OPTION_FLASH = 1,
OPTION_DISASSEMBLE = 2,
OPTION_DISASSEMBLE = 1,
};
/*

View File

@ -337,10 +337,9 @@ apple2_free(apple2 *mach)
void
apple2_run_loop(apple2 *mach)
{
FILE *dlog = NULL;
FILE *dlog = (FILE *)vm_di_get(VM_DISASM_LOG);
if (option_flag(OPTION_DISASSEMBLE)) {
dlog = (FILE *)vm_di_get(VM_DISASM_LOG);
if (dlog != NULL) {
vm_reflect_disasm(NULL);
}

View File

@ -44,8 +44,6 @@ static char error_buffer[ERRBUF_SIZE] = "";
static int width = 840;
static int height = 576;
static int flags = 0;
/*
* These are all of the options we allow in our long-form options. It's
* a bit faster to identify them by integer symbols than to do string
@ -55,7 +53,6 @@ enum options {
DISK1,
DISK2,
HELP,
FLASH,
DISASSEMBLE,
};
@ -66,7 +63,6 @@ static struct option long_options[] = {
{ "disassemble", 1, NULL, DISASSEMBLE },
{ "disk1", 1, NULL, DISK1 },
{ "disk2", 1, NULL, DISK2 },
{ "flash", 0, NULL, FLASH },
{ "help", 0, NULL, HELP },
};
@ -120,7 +116,6 @@ option_parse(int argc, char **argv)
switch (opt) {
case DISASSEMBLE:
flags |= OPTION_DISASSEMBLE;
if (!option_open_file(&disasm_log, optarg, "w")) {
return 0;
}
@ -144,10 +139,6 @@ option_parse(int argc, char **argv)
vm_di_set(VM_DISK2, input2);
break;
case FLASH:
flags |= OPTION_FLASH;
break;
case HELP:
option_print_help();
@ -200,17 +191,7 @@ option_print_help()
--disassemble=FILE Write assembly notation into FILE\n\
--disk1=FILE Load FILE into disk drive 1\n\
--disk2=FILE Load FILE into disk drive 2\n\
--flash Flash CPU memory with contents of drive 1\n\
--help Print this help message\n\
--size=WIDTHxHEIGHT Use WIDTH and HEIGHT for window size\n\
(only 700x480 and 875x600 are supported)\n");
}
/*
* Return true if the given option flag is set.
*/
bool
option_flag(int flag)
{
return flags & flag;
}

View File

@ -75,16 +75,3 @@ Test(option, parse)
cr_assert_eq(option_parse(argc, argv), 0);
}
Test(option, flag)
{
int argc = 2;
char *argv[] = {
"prog_name",
"--flash",
};
cr_assert_eq(option_flag(OPTION_FLASH), false);
cr_assert_eq(option_parse(argc, argv), 1);
cr_assert_eq(option_flag(OPTION_FLASH), true);
}