git @ Cat's Eye Technologies RUBE / b909478
Add -s option, the number of frames between interactive steps. Chris Pressey 6 years ago
1 changed file(s) with 21 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
66 *
77 * Usage :
88 *
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>
1011 *
1112 * -d: disable debugging output
1213 * -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)
1416 * -y: specify debugging delay in milliseconds (default 0)
1517 * -f: specify debugging frame skip in frames (default 1)
1618 *
9395 static int x = 0, y = 0; /* x and y looping */
9496 static int debug = 1; /* flag: display ANSI debugging? */
9597 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 */
96100 static int deldur = 0; /* debugging delay in milliseconds */
97101 static int debskip = 1; /* frame skip in debug view */
98102 static int debopos = 1; /* output column in debugger */
123127
124128 if (argc < 2)
125129 {
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");
127131 exit (0);
128132 }
129133 for (i = 1; i < argc; i++)
131135 if (!strcmp(argv[i], "-d")) { debug = 0; }
132136 if (!strcmp(argv[i], "-q")) { quiet = 1; debug = 0; }
133137 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]); }
136141 }
142 framecount = framestep;
137143 if (!quiet) printf ("Cat's Eye Technologies' RUBE Interpreter v1.5\n");
138144 f = fopen (argv[argc - 1], "r");
139145 if (f == NULL) {
510516 (curd(0,1)=='F')) nex = ' ';
511517 }
512518 }
519 if (deldur > 0) {
520 rube_delay (deldur);
521 }
513522 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 }
517530 } else {
518 if (deldur > 0) {
519 rube_delay (deldur);
520 }
521531 #ifdef MSDOS
522532 if (kbhit()) {
523533 char c;