/* Adagio compiler -- scan command line, call phase1, phase2 */ /***************************************************************************** * Change Log * Date | Change *-----------+----------------------------------------------------------------- * 12-Mar-86 | Created * 28-May-86 | Added calls to cmdline.c for command line parsing *****************************************************************************/ #include "cext.h" #include "stdio.h" #include "adagio.h" #include "phase1.h" #include "phase2.h" #include "atxt.h" #include "userio.h" #include "cmdline.h" char score_na[name_length]; /* this will be available to phase1 and 2 */ /**************************************************************************** * Variables set by command line switches ****************************************************************************/ extern int IsAT; boolean no_mpu = false; /* true if simulated */ /**************************************************************************** * Data for command line parsing ****************************************************************************/ #define nswitches 15 private char *switches[nswitches] = { "-debug", "-d", "-help", "-miditrace", "-m", "-trace", "-t", "-at", "-metronome", "-met", "-simulated", "-s", "-xt", "-print", "-block" }; #define noptions 3 private char *options[noptions] = { "-c", "-control", "-tune" }; #define nmsw 2 private char *msw[nmsw] = { "-met", "-metronome" }; #define nssw 2 private char *ssw[nssw] = { "-simulated", "-s" }; /**************************************************************************** * Routines local to this module ****************************************************************************/ private void cmdline_help(); /**************************************************************************** * cmdline_help * Effect: * Prints out command line help ****************************************************************************/ private void cmdline_help() { fprintf(stderr,"adagio [options] filename [options]\n"); fprintf(stderr," Options are below. Those with * are for wizrds:\n"); fprintf(stderr,"* -at PC/AT (secondary interrupt channel)\n"); fprintf(stderr," -block disable MIDI thru\n"); fprintf(stderr," -debug (-d) enable verbose debug mode\n"); fprintf(stderr," -help this message\n"); fprintf(stderr," -metronome (-met) turn on MPU-401 metronome\n"); fprintf(stderr," -miditrace (-m) turn on MIDI command trace\n"); fprintf(stderr," -print print note data\n"); fprintf(stderr," -tune file use tuning from file\n"); fprintf(stderr," -simulated (-s) run with simulated MPU-401\n"); fprintf(stderr," -trace (-t) trace music\n"); fprintf(stderr,"* -xt PC/XT (no secondary interrupt channel)\n"); } /**************************************************************************** * main * Inputs: * int argc: Count of arguments * char * argv[]: Vector of argument pointers * Effect: * Runs adagio ****************************************************************************/ void main(argc,argv) int argc; char * argv[]; { FILE *fp = NULL; char *s; /* temp pointer to input file name */ cl_init(switches, nswitches, options, noptions, argv, argc); score_na[0] = 0; if (cl_switch("-help")) { cmdline_help(); return; } IsAT = (atxt() == ISAT); if (cl_switch("-at")) { if (!IsAT) { /* lie! */ fprintf(stderr,"-at but not running on PC/AT!\n"); return; } IsAT = true; } if (cl_nswitch(msw, nmsw) != NULL) metronome(true); if (cl_switch("-help")) { cmdline_help(); return; } if (cl_nswitch(ssw, nssw) != NULL) no_mpu = true; if (cl_switch("-xt")) { if (IsAT) { /* lie! */ fprintf(stderr,"-xt but running on PC/AT!\n"); return; } } /* get input file: */ if ((s = cl_arg(1)) != NULL) strcpy(score_na, s); fp = fileopen(score_na, "gio", "r", "Name of Adagio score file"); phase2(phase1(fp)); }