Add -s option, the number of frames between interactive steps.
Chris Pressey
6 years ago
6 | 6 | * |
7 | 7 | * Usage : |
8 | 8 | * |
9 | * rube [-d] [-q] [-i] [-y delay] [-f frame-skip] [-o offset] <rube-source> | |
9 | * rube [-d] [-q] [-i] [-s num-frames] [-y delay] [-f frame-skip] | |
10 | * [-o offset] <rube-source> | |
10 | 11 | * |
11 | 12 | * -d: disable debugging output |
12 | 13 | * -q: produce no output but program output |
13 | * -i: run interactively (single step with lines from stdin) | |
14 | * -i: run interactively (step with lines from stdin) | |
15 | * -s: number of frames per step for -i (default 1) | |
14 | 16 | * -y: specify debugging delay in milliseconds (default 0) |
15 | 17 | * -f: specify debugging frame skip in frames (default 1) |
16 | 18 | * |
93 | 95 | static int x = 0, y = 0; /* x and y looping */ |
94 | 96 | static int debug = 1; /* flag: display ANSI debugging? */ |
95 | 97 | static int interactive = 0; /* flag: ask for input each frame? */ |
98 | static int framestep = 1; /* number of frames to run per step */ | |
99 | static int framecount = 1; /* number of frames run this step */ | |
96 | 100 | static int deldur = 0; /* debugging delay in milliseconds */ |
97 | 101 | static int debskip = 1; /* frame skip in debug view */ |
98 | 102 | static int debopos = 1; /* output column in debugger */ |
123 | 127 | |
124 | 128 | if (argc < 2) |
125 | 129 | { |
126 | printf ("USAGE: rube [-d] [-q] [-i] [-y delay] [-f skip] foo.rub\n"); | |
130 | printf ("USAGE: rube [-d] [-q] [-i] [-s frames] [-y delay] [-f skip] foo.rub\n"); | |
127 | 131 | exit (0); |
128 | 132 | } |
129 | 133 | for (i = 1; i < argc; i++) |
131 | 135 | if (!strcmp(argv[i], "-d")) { debug = 0; } |
132 | 136 | if (!strcmp(argv[i], "-q")) { quiet = 1; debug = 0; } |
133 | 137 | if (!strcmp(argv[i], "-i")) { interactive = 1; debug = 1; } |
134 | if (!strcmp(argv[i], "-y")) { deldur = atoi(argv[i + 1]); } | |
135 | if (!strcmp(argv[i], "-f")) { debskip = atoi(argv[i + 1]); } | |
138 | if (!strcmp(argv[i], "-s")) { i++; if (i < argc) framestep = atoi(argv[i]); } | |
139 | if (!strcmp(argv[i], "-y")) { i++; if (i < argc) deldur = atoi(argv[i]); } | |
140 | if (!strcmp(argv[i], "-f")) { i++; if (i < argc) debskip = atoi(argv[i]); } | |
136 | 141 | } |
142 | framecount = framestep; | |
137 | 143 | if (!quiet) printf ("Cat's Eye Technologies' RUBE Interpreter v1.5\n"); |
138 | 144 | f = fopen (argv[argc - 1], "r"); |
139 | 145 | if (f == NULL) { |
510 | 516 | (curd(0,1)=='F')) nex = ' '; |
511 | 517 | } |
512 | 518 | } |
519 | if (deldur > 0) { | |
520 | rube_delay (deldur); | |
521 | } | |
513 | 522 | if (interactive) { |
514 | char s[80]; | |
515 | fgets(s, 79, stdin); | |
516 | if (s[0] == 'q') done = 1; | |
523 | framecount--; | |
524 | if (framecount == 0) { | |
525 | char s[80]; | |
526 | fgets(s, 79, stdin); | |
527 | if (s[0] == 'q') done = 1; | |
528 | framecount = framestep; | |
529 | } | |
517 | 530 | } else { |
518 | if (deldur > 0) { | |
519 | rube_delay (deldur); | |
520 | } | |
521 | 531 | #ifdef MSDOS |
522 | 532 | if (kbhit()) { |
523 | 533 | char c; |