nga-c: add internal "interactive" flag to VM state information (#94)

FossilOrigin-Name: 7c5ed4e2a5b64dd3e55be32525c423df55287d0e2726a80ac2dcadf80e3262ca
This commit is contained in:
crc 2023-04-13 11:53:36 +00:00
parent 4d3970b3e0
commit 10711711fb

View file

@ -127,6 +127,7 @@ struct NgaState {
char line[4096]; char line[4096];
int current_source; int current_source;
int perform_abort; int perform_abort;
int interactive;
CELL currentLine; CELL currentLine;
CELL ignoreToEOL, ignoreToEOF; CELL ignoreToEOL, ignoreToEOF;
@ -858,6 +859,7 @@ int main(int argc, char **argv) {
#endif #endif
initialize(vm); /* Initialize Nga & image */ initialize(vm); /* Initialize Nga & image */
vm->interactive = 0;
register_device(vm, io_output, query_output); register_device(vm, io_output, query_output);
register_device(vm, io_keyboard, query_keyboard); register_device(vm, io_keyboard, query_keyboard);
@ -940,6 +942,7 @@ int main(int argc, char **argv) {
exit(0); exit(0);
} else if (strcmp(argv[i], "-i") == 0) { } else if (strcmp(argv[i], "-i") == 0) {
modes[FLAG_INTERACTIVE] = 1; modes[FLAG_INTERACTIVE] = 1;
vm->interactive = -1;
} else if (strcmp(argv[i], "-f") == 0) { } else if (strcmp(argv[i], "-f") == 0) {
include_file(vm, argv[i + 1], 0); include_file(vm, argv[i + 1], 0);
i++; i++;