Add -I flag to curses Frotz to allow for setting the interpreter number.
authorDavid Griffith <dave@661.org>
Tue, 31 Jul 2018 20:09:54 +0000 (13:09 -0700)
committerDavid Griffith <dave@661.org>
Wed, 1 Aug 2018 04:35:42 +0000 (21:35 -0700)
src/curses/ux_init.c
src/curses/ux_params.txt

index e5357732d68a9a6e31ac6cd139968c76798bbf47..96459edd172e1a901c25f702b17dec229caaf978 100644 (file)
@@ -62,9 +62,17 @@ Syntax: frotz [options] story-file\n\
   -F   Force color mode           \t -S # transcript width\n\
   -h # screen height              \t -t   set Tandy bit\n\
   -i   ignore fatal errors        \t -u # slots for multiple undo\n\
-  -l # left margin                \t -v   show version information\n\
-  -L <file> load this save file   \t -w # screen width\n\
-  -o   watch object movement      \t -x   expand abbreviations g/x/z\n"
+  -I # interpreter number         \t -v   show version information\n\
+  -l # left margin                \t -w # screen width\n\
+  -L <file> load this save file   \t -x   expand abbreviations g/x/z\n\
+  -o   watch object movement      \t -Z # error checking (see below)\n"
+
+#define INFO2 "\
+Error checking: 0 none, 1 first only (default), 2 all, 3 exit after any error.\n\
+For more options and explanations, please read the manual page.\n"
+
+
+static bool interpreter_number_override = FALSE;
 
 /*
 char stripped_story_name[FILENAME_MAX+1];
@@ -241,7 +249,7 @@ void os_process_arguments (int argc, char *argv[])
 
     /* Parse the options */
     do {
-       c = zgetopt(argc, argv, "-aAb:c:def:Fh:il:oOpPqrR:s:S:tu:vw:W:xZ:");
+       c = zgetopt(argc, argv, "-aAb:c:def:Fh:iI:l:oOpPqrR:s:S:tu:vw:W:xZ:");
        switch(c) {
          case 'a': f_setup.attribute_assignment = 1; break;
          case 'A': f_setup.attribute_testing = 1; break;
@@ -267,6 +275,9 @@ void os_process_arguments (int argc, char *argv[])
                    break;
           case 'h': u_setup.screen_height = atoi(zoptarg); break;
          case 'i': f_setup.ignore_errors = 1; break;
+         case 'I': f_setup.interpreter_number = atoi(zoptarg);
+                   interpreter_number_override = TRUE;
+                   break;
          case 'l': f_setup.left_margin = atoi(zoptarg); break;
          case 'L': f_setup.restore_mode = 1;
                    f_setup.tmp_save_name = malloc(FILENAME_MAX * sizeof(char) + 1);
@@ -306,12 +317,7 @@ void os_process_arguments (int argc, char *argv[])
        putchar('\n');
 
        puts (INFORMATION);
-       printf ("\t-Z # error checking mode (default = %d)\n"
-           "\t     %d = don't report errors   %d = report first error\n"
-           "\t     %d = report all errors     %d = exit after any error\n\n",
-           ERR_DEFAULT_REPORT_MODE, ERR_REPORT_NEVER,
-           ERR_REPORT_ONCE, ERR_REPORT_ALWAYS,
-           ERR_REPORT_FATAL);
+       puts (INFO2);
        exit (1);
     }
 
@@ -492,7 +498,11 @@ void os_init_screen (void)
 
     /* Use the ms-dos interpreter number for v6, because that's the
      * kind of graphics files we understand.  Otherwise, use DEC.  */
-    h_interpreter_number = h_version == 6 ? INTERP_MSDOS : INTERP_DEC_20;
+    if (!interpreter_number_override || (f_setup.interpreter_number == 0))
+       h_interpreter_number = h_version == 6 ? INTERP_MSDOS : INTERP_DEC_20;
+    else
+       h_interpreter_number = f_setup.interpreter_number;
+
     h_interpreter_version = 'F';
 
 #ifdef COLOR_SUPPORT
@@ -1040,6 +1050,7 @@ void os_init_setup(void)
        f_setup.left_margin = 0;
        f_setup.right_margin = 0;
        f_setup.ignore_errors = 0;
+       f_setup.interpreter_number = INTERP_DEC_20;
        f_setup.piracy = 0;             /* enable the piracy opcode */
        f_setup.undo_slots = MAX_UNDO_SLOTS;
        f_setup.expand_abbreviations = 0;
index 26e18e7fdb7134c862536da4c353c74aab405f65..c8a96b418f6d0746e9904057c720fc585d46a5a1 100644 (file)
@@ -8,6 +8,7 @@
 -F   Force color mode
 -h # screen height
 -i   ignore fatal errors
+-I # interpreter number
 -l # left margin
 -L <file> load this save file
 -o   watch object movement
@@ -24,3 +25,4 @@
 -v   show version information
 -w # screen width
 -x   expand abbreviations g/x/z
+-Z # error checking (see below)