home *** CD-ROM | disk | FTP | other *** search
- #include "header.h"
- #include "file.h"
-
- #if PC
- #define TAB1 4 /* pos of 1st col of menu items on pc screen */
- #define TAB2 35 /* pos of 2nd col of menu items on pc screen */
- #endif
-
- /*************************************************************************/
- /** menu functions **/
- /*************************************************************************/
- /* all menus return int value:
- 0 = successful input, continue program
-
- menus listed herein:
- generalmenu
- helpmenu
- animalmenu
- */
- /********************************/
- /* function: generalmenu */
- /********************************/
- /* prints out the general menu */
- generalmenu (opfil)
- char *opfil; /* might be set in file options screen */
- {
- char input[MAXLEN]; /* user menu choice */
- char c;
- #if PC
- int val; /* return val of getusrstr */
- int i;
- #endif
-
- while (TRUE) {
- /* endless loop; have to exit via one of the returns in the loop */
- #if PC
- topline(" General Menu ");
- clrscr1(1);
- normvideo();
- i = 2;
- gotoxy(TAB2, i++);
- cprintf("H: Stages Program Overview");
- gotoxy(TAB2, i++);
- cprintf("I: Input Syntax Description");
- gotoxy(TAB2, i++);
- cprintf("J: Output Table Explanation");
- gotoxy(TAB2, i++);
- cprintf("K: Printer and File Options");
- i = 2;
- gotoxy(TAB1, i++);
- cprintf("A: (...");
- highvideo();
- cprintf("General Menu");
- normvideo();
- cprintf("...)");
- gotoxy(TAB1, i++);
- cprintf("B: Go to Help Menu");
- gotoxy(TAB1, i++);
- cprintf("C: Go to Animal Menu");
- gotoxy(TAB1, i++);
- cprintf("D: Go to Cycle Length Menu");
- gotoxy(TAB1, i++);
- cprintf("E: Go to Display Menu");
- gotoxy(TAB1, i++);
- cprintf("F: Go to Cell Input Menu");
- gotoxy(TAB1, i++);
- cprintf("G: Go to Days Input Menu");
- i++;
- gotoxy(TAB1, i++);
- cprintf("X: Exit Program");
- if (HARDCOPY) {
- togglepr();
- fprintf(stdprn, "\n\n\t\t General Menu\n\n");
- fprintf(stdprn, "\tA: (...General Menu...)\n");
- fprintf(stdprn, "\tB: Go to Help Menu\n");
- fprintf(stdprn, "\tC: Go to Animal Menu\n");
- fprintf(stdprn, "\tD: Go to Cycle Length Menu\n");
- fprintf(stdprn, "\tE: Go to Display Menu\n");
- fprintf(stdprn, "\tF: Go to Cell Input Menu\n");
- fprintf(stdprn, "\tG: Go to Days Input Menu\n\n");
- fprintf(stdprn, "\tH: Stages Program Overview\n");
- fprintf(stdprn, "\tI: Input Syntax Description\n");
- fprintf(stdprn, "\tJ: Output Table Explanation\n");
- fprintf(stdprn, "\tK: Printer and File Options\n\n");
- fprintf(stdprn, "\tX: Exit Program\n");
- }
- #else
- printf("\n\n\t\t General Menu\n\n");
- printf("\tA: (...General Menu...)\n");
- printf("\tB: Go to Help Menu\n");
- printf("\tC: Go to Animal Menu\n");
- printf("\tD: Go to Cycle Length Menu\n");
- printf("\tE: Go to Display Menu\n");
- printf("\tF: Go to Cell Input Menu\n");
- printf("\tG: Go to Days Input Menu\n\n");
- printf("\tH: Stages Program Overview\n");
- printf("\tI: Input Syntax Description\n");
- printf("\tJ: Output Table Explanation\n");
- printf("\tK: Printer and File Options\n\n");
- printf("\tX: Exit Program\n");
- #endif
- if (FILEq && FILECOPY) {
- fprintf(fpout, "\n\n\t\t General Menu\n\n");
- fprintf(fpout, "\tA: (...General Menu...)\n");
- fprintf(fpout, "\tB: Go to Help Menu\n");
- fprintf(fpout, "\tC: Go to Animal Menu\n");
- fprintf(fpout, "\tD: Go to Cycle Length Menu\n");
- fprintf(fpout, "\tE: Go to Display Menu\n");
- fprintf(fpout, "\tF: Go to Cell Input Menu\n");
- fprintf(fpout, "\tG: Go to Days Input Menu\n\n");
- fprintf(fpout, "\tH: Stages Program Overview\n");
- fprintf(fpout, "\tI: Input Syntax Description\n");
- fprintf(fpout, "\tJ: Output Table Explanation\n");
- fprintf(fpout, "\tK: Printer and File Options\n\n");
- fprintf(fpout, "\tX: Exit Program\n");
- }
-
-
- #if PC
- clrscr1(2);
- cprintf("%sPlease enter your menu choice:", tab);
- gotoxy(1, 2);
- highvideo();
- cprintf("%s%c%c%c ", tab2, HBAR, HBAR, RTRI);
- normvideo();
- val = getusrstr(input);
- if (HARDCOPY) {
- fprintf(stdprn, "\n\tPlease enter your menu choice:\n");
- fprintf(stdprn, "\t\t==> %s", input);
- }
- #else
- printf("\n\tPlease enter your menu choice:\n");
- printf("\t\t==> ");
- getusrstr(input);
- #endif
- if (FILEq && FILECOPY) {
- fprintf(fpout, "\n\tPlease enter your menu choice:\n");
- fprintf(fpout, "\t\t==> %s", input);
- }
-
- #if PC
- if (val)
- return(val);
- else {
- clrscr1(3);
- #endif
- c = input[0];
- switch (toupper1(c)) {
- case 'A': /* stay here at general menu */
- break;
- case 'B': /* goto help menu */
- return(102);
- case 'C': /* goto animalmenu */
- return(103);
- case 'D': /* goto cycle length menu */
- return(104);
- case 'E': /* goto display menu */
- return(114);
- case 'F': /* goto cell input menu */
- return(105);
- case 'G': /* goto days input menu */
- return(106);
- case 'H':
- helpoverview();
- break;
- case 'I':
- helpipsyntax();
- break;
- case 'J':
- helpoptable();
- break;
- case 'K':
- helpoptions(opfil);
- break;
- case 'X': /* Done */
- printexit(30);
- default:
- #if PC
- printf("%s%sInvalid choice: <%c>.\n", tab, ERRSTR, input[0]);
- if (HARDCOPY)
- fprintf(stdprn, "\t%sInvalid choice: <%c>.", ERRSTR, input[0]);
- #else
- printf("\t%sInvalid choice: <%c>.\n", ERRSTR, input[0]);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "\t%sInvalid choice: <%c>.\n", ERRSTR, input[0]);
- } /* switch */
- #if PC
- } /* if ! val */
- #endif
- } /* while */
- } /* generalmenu */
-
- /********************************/
- /* function: helpmenu */
- /********************************/
- /* prints out the help menu, deals with user input to the menu */
- helpmenu ()
- {
- char input[MAXLEN]; /* user menu choice */
- char c;
- #if PC
- int val; /* return val of getusrstr */
- int i;
- #endif
-
- while (TRUE) {
- #if PC
- topline(" Help Menu ");
- clrscr1(1);
- normvideo();
- i = 2;
- gotoxy(TAB1, i++);
- cprintf("A: Go to General Menu");
- gotoxy(TAB1, i++);
- cprintf("B: (...");
- highvideo();
- cprintf("Help Menu");
- normvideo();
- cprintf("...)");
- gotoxy(TAB1, i++);
- cprintf("C: Go to Animal Menu");
- gotoxy(TAB1, i++);
- cprintf("D: Go to Cycle Length Menu");
- gotoxy(TAB1, i++);
- cprintf("E: Go to Display Menu");
- gotoxy(TAB1, i++);
- cprintf("F: Go to Cell Input Menu");
- gotoxy(TAB1, i++);
- cprintf("G: Go to Days Input Menu");
- i = 2;
- gotoxy(TAB2, i++);
- cprintf("H: Help!: Changing the Cycle Length");
- gotoxy(TAB2, i++);
- cprintf("I: Help!: Entering Cell Input Data");
- gotoxy(TAB2, i++);
- cprintf("J: Help!: Entering Days Input Data");
- gotoxy(TAB2, i++);
- cprintf("K: Help!: Saving Output to a File");
- gotoxy(TAB2, i++);
- cprintf("L: Help!: Sending Output to a Printer");
- gotoxy(TAB2, i++);
- cprintf("M: Help!: Using the F1-F10 Keys");
- gotoxy(TAB2, i++);
- cprintf("N: Help!: Batch Processing Using Stages");
- i++;
- gotoxy(TAB1, i++);
- cprintf("X: Exit Program");
- if (HARDCOPY) {
- togglepr();
- fprintf(stdprn, "\n\n\t\t Help Menu\n\n");
- fprintf(stdprn, "\tA: Go to General Menu\n");
- fprintf(stdprn, "\tB: (...Help Menu...)\n");
- fprintf(stdprn, "\tC: Go to Animal Menu\n");
- fprintf(stdprn, "\tD: Go to Cycle Length Menu\n");
- fprintf(stdprn, "\tE: Go to Display Menu\n");
- fprintf(stdprn, "\tF: Go to Cell Input Menu\n");
- fprintf(stdprn, "\tG: Go to Days Input Menu\n\n");
- fprintf(stdprn, "\tH: Help!: Changing the Cycle Length\n");
- fprintf(stdprn, "\tI: Help!: Entering Cell Input Data\n");
- fprintf(stdprn, "\tJ: Help!: Entering Days Input Data\n");
- fprintf(stdprn, "\tK: Help!: Saving Output to a File\n");
- fprintf(stdprn, "\tL: Help!: Sending Output to a Printer\n");
- fprintf(stdprn, "\tM: Help!: Using the F1-F10 Keys\n");
- fprintf(stdprn, "\tN: Help!: Batch Processing Using Stages\n\n");
- fprintf(stdprn, "\tX: Exit Program\n");
- }
-
- #else
- printf("\n\n\t\t Help Menu\n\n");
- printf("\tA: Go to General Menu\n");
- printf("\tB: (...Help Menu...)\n");
- printf("\tC: Go to Animal Menu\n");
- printf("\tD: Go to Cycle Length Menu\n");
- printf("\tE: Go to Display Menu\n");
- printf("\tF: Go to Cell Input Menu\n");
- printf("\tG: Go to Days Input Menu\n\n");
- printf("\tH: Help!: Changing the Cycle Length\n");
- printf("\tI: Help!: Entering Cell Input Data\n");
- printf("\tJ: Help!: Entering Days Input Data\n");
- printf("\tK: Help!: Saving Output to a File\n");
- printf("\tL: Help!: Batch Processing Using Stages\n\n");
- printf("\tX: Exit Program\n");
- #endif
- if (FILEq && FILECOPY) {
- fprintf(fpout, "\n\n\t\t Help Menu\n\n");
- fprintf(fpout, "\tA: Go to General Menu\n");
- fprintf(fpout, "\tB: (...Help Menu...)\n");
- fprintf(fpout, "\tC: Go to Animal Menu\n");
- fprintf(fpout, "\tD: Go to Cycle Length Menu\n");
- fprintf(fpout, "\tE: Go to Display Menu\n");
- fprintf(fpout, "\tF: Go to Cell Input Menu\n");
- fprintf(fpout, "\tG: Go to Days Input Menu\n\n");
- fprintf(fpout, "\tH: Help!: Changing the Cycle Length\n");
- fprintf(fpout, "\tI: Help!: Entering Cell Input Data\n");
- fprintf(fpout, "\tJ: Help!: Entering Days Input Data\n");
- fprintf(fpout, "\tK: Help!: Saving Output to a File\n");
- fprintf(fpout, "\tL: Help!: Batch Processing Using Stages\n\n");
- fprintf(fpout, "\tX: Exit Program\n");
- }
-
- #if PC
- clrscr1(2);
- cprintf("%sPlease enter your menu choice:", tab);
- gotoxy(1, 2);
- highvideo();
- cprintf("%s%c%c%c ", tab2, HBAR, HBAR, RTRI);
- normvideo();
- val = getusrstr(input);
- if (HARDCOPY) {
- togglepr();
- fprintf(stdprn, "\n\tPlease enter your menu choice:\n");
- fprintf(stdprn, "\t\t==> %s", input);
- }
- #else
- printf("\n\tPlease enter your menu choice:\n");
- printf("\t\t==> ");
- getusrstr(input);
- #endif
- if (FILEq && FILECOPY) {
- fprintf(fpout, "\n\tPlease enter your menu choice:\n");
- fprintf(fpout, "\t\t==> %s", input);
- }
-
- #if PC
- if (val)
- return(val);
- else {
- clrscr1(3);
- #endif
- c = input[0];
- switch (toupper1(c)) {
- case 'A': /* goto intro menu */
- return(101);
- case 'B': /* stay here at help menu */
- break;
- case 'C': /* goto animalmenu */
- return(103);
- case 'D': /* goto cycle length menu */
- return(104);
- case 'E': /* goto display menu */
- return(114);
- case 'F': /* goto cell input menu */
- return(105);
- case 'G': /* goto days input menu */
- return(106);
- case 'H':
- helpcyclelenip();
- break;
- case 'I':
- helpcellip();
- break;
- case 'J':
- helpdaysip();
- break;
- case 'K':
- helpopfile();
- break;
- #if PC
- case 'L':
- helphardcopy();
- break;
- case 'M':
- helpfkeys();
- break;
- case 'N':
- helpbatch();
- break;
- #else
- case 'L': /* batch processing */
- helpbatch();
- break;
- #endif
- case 'X': /* Done */
- printexit(38);
- default:
- #if PC
- printf("%s%sInvalid choice: <%c>.", tab, ERRSTR, input[0]);
- if (HARDCOPY) {
- togglepr();
- fprintf(stdprn, "\t%sInvalid choice: <%c>.", ERRSTR, input[0]);
- }
- #else
- printf("\t%sInvalid choice: <%c>.", ERRSTR, input[0]);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "\t%sInvalid choice: <%c>.\n", ERRSTR, input[0]);
- } /* switch */
- #if PC
- } /* if ! val */
- #endif
- } /* while */
- } /* helpmenu */
-
- /********************************/
- /* function: animalmenu */
- /********************************/
- /* prints out the Animal menu, deals with user input to the menu */
- animalmenu (pfpstg, pfpseq, pfpmcl, stgfil, seqfil, mclfil, pnew)
- FILE **pfpstg, **pfpseq, **pfpmcl;
- char *stgfil, *seqfil, *mclfil;
- int *pnew;
- {
- char input[MAXLEN]; /* user menu choice */
- char c;
- int valid; /* boolean */
- int val;
- #if PC
- int i;
- #endif
-
- valid = 0;
- while (! valid) {
- #if PC
- topline(" Animal Menu ");
- clrscr1(1);
- normvideo();
- i = 2;
- gotoxy(TAB2, i++);
- cprintf("H: Select Sprague-Dawley Rat");
- gotoxy(TAB2, i++);
- cprintf("I: Select Sherman Rat");
- gotoxy(TAB2, i++);
- cprintf("J: Select Hamster");
- gotoxy(TAB2, i++);
- cprintf("K: Select C3H Mouse");
- gotoxy(TAB2, i++);
- cprintf("L: Select Dog");
- i = 2;
- gotoxy(TAB1, i++);
- cprintf("A: Go to General Menu");
- gotoxy(TAB1, i++);
- cprintf("B: Go to Help Menu");
- gotoxy(TAB1, i++);
- cprintf("C: (...");
- highvideo();
- cprintf("Animal Menu");
- normvideo();
- cprintf("...)");
- gotoxy(TAB1, i++);
- cprintf("D: Go to Cycle Length Menu");
- gotoxy(TAB1, i++);
- cprintf("E: Go to Display Menu");
- gotoxy(TAB1, i++);
- cprintf("F: Go to Cell Input Menu");
- gotoxy(TAB1, i++);
- cprintf("G: Go to Days Input Menu");
- i++;
- gotoxy(TAB1, i);
- cprintf("X: Exit Program");
- gotoxy(TAB2, i);
- cprintf("?: Show Help Screen");
- if (HARDCOPY) {
- togglepr();
- fprintf(stdprn, "\n\n\t\t Animal Menu\n\n");
- fprintf(stdprn, "\tA: Go to General Menu\n");
- fprintf(stdprn, "\tB: Go to Help Menu\n");
- fprintf(stdprn, "\tC: (...Animal Menu...)\n");
- fprintf(stdprn, "\tD: Go to Cycle Length Menu\n");
- fprintf(stdprn, "\tE: Go to Display Menu\n");
- fprintf(stdprn, "\tF: Go to Cell Input Menu\n");
- fprintf(stdprn, "\tG: Go to Days Input Menu\n\n");
- fprintf(stdprn, "\tH: Select Sprague-Dawley Rat\n");
- fprintf(stdprn, "\tI: Select Sherman Rat\n");
- fprintf(stdprn, "\tJ: Select Hamster\n");
- fprintf(stdprn, "\tK: Select C3H Mouse\n");
- fprintf(stdprn, "\tL: Select Dog\n\n");
- fprintf(stdprn, "\tX: Exit Program\n");
- fprintf(stdprn, "\t?: Show Help Screen\n");
- }
- #else
- printf("\n\n\t\t Animal Menu\n\n");
- printf("\tA: Go to General Menu\n");
- printf("\tB: Go to Help Menu\n");
- printf("\tC: (...Animal Menu...)\n");
- printf("\tD: Go to Cycle Length Menu\n");
- printf("\tE: Go to Display Menu\n");
- printf("\tF: Go to Cell Input Menu\n");
- printf("\tG: Go to Days Input Menu\n\n");
- printf("\tH: Select Sprague-Dawley Rat\n");
- printf("\tI: Select Sherman Rat\n");
- printf("\tJ: Select Hamster\n");
- printf("\tK: Select C3H Mouse\n");
- printf("\tL: Select Dog\n\n");
- printf("\tX: Exit Program\n");
- printf("\t?: Show Help Screen\n");
- #endif
- if (FILEq && FILECOPY) {
- fprintf(fpout, "\n\n\t\t Animal Menu\n\n");
- fprintf(fpout, "\tA: Go to General Menu\n");
- fprintf(fpout, "\tB: Go to Help Menu\n");
- fprintf(fpout, "\tC: (...Animal Menu...)\n");
- fprintf(fpout, "\tD: Go to Cycle Length Menu\n");
- fprintf(fpout, "\tE: Go to Display Menu\n");
- fprintf(fpout, "\tF: Go to Cell Input Menu\n");
- fprintf(fpout, "\tG: Go to Days Input Menu\n\n");
- fprintf(fpout, "\tH: Select Sprague-Dawley Rat\n");
- fprintf(fpout, "\tI: Select Sherman Rat\n");
- fprintf(fpout, "\tJ: Select Hamster\n");
- fprintf(fpout, "\tK: Select C3H Mouse\n");
- fprintf(fpout, "\tL: Select Dog\n\n");
- fprintf(fpout, "\tX: Exit Program\n");
- fprintf(fpout, "\t?: Show Help Screen\n");
- }
-
- #if PC
- clrscr1(2);
- cprintf("%sPlease enter your menu choice:", tab);
- gotoxy(1, 2);
- highvideo();
- cprintf("%s%c%c%c ", tab2, HBAR, HBAR, RTRI);
- normvideo();
- val = getusrstr(input);
- if (HARDCOPY) {
- togglepr();
- fprintf(stdprn, "\n\tPlease enter your menu choice:\n");
- fprintf(stdprn, "\t\t==> %s", input);
- }
- #else
- printf("\n\tPlease enter your menu choice:\n");
- printf("\t\t==> ");
- getusrstr(input);
- #endif
- if (FILEq && FILECOPY) {
- fprintf(fpout, "\n\tPlease enter your menu choice:\n");
- fprintf(fpout, "\t\t==> %s", input);
- }
-
- #if PC
- if (val) {
- *pnew = 0;
- return(val);
- } else {
- #endif
- c = toupper1(input[0]);
- switch (c) {
- case 'A': /* goto intro menu */
- return(101);
- case 'B': /* goto help menu */
- return(102);
- case 'C': /* stay here at animal menu */
- break;
- case 'D': /* goto cycle length menu */
- return(104);
- case 'E': /* goto display meny */
- return(114);
- case 'F': /* goto cell input menu */
- return(105);
- case 'G': /* goto days input menu */
- return(106);
- case 'H': /* sdrat */
- case 'I': /* shrat */
- case 'J': /* hamster */
- case 'K': /* c3h mouse */
- case 'L': /* dog */
- valid = 1;
- val = getanimal(pfpstg, pfpseq, pfpmcl, stgfil, seqfil, mclfil, c);
- if (! val)
- *pnew = 1;
- #if (DEBUG > 4)
- #if PC
- clrscr1(1);
- gotoxy(1, 5);
- cprintf("%sleaving animalmenu, val = %d", tab, val);
- hitreturn(1);
- #else
- printf("\tleaving animalmenu, val = %d\n", val);
- #endif
- #endif
- return(val);
- case '?': /* show help screen */
- helpanimalmenu();
- break;
- case 'X': /* Done */
- printexit(32);
- default:
- #if PC
- clrscr1(3);
- printf("%s%sInvalid choice: <%c>.", tab, ERRSTR, input[0]);
- if (HARDCOPY) {
- togglepr();
- fprintf(stdprn, "\t%sInvalid choice: <%c>.", ERRSTR, input[0]);
- }
- #else
- printf("\t%sInvalid choice: <%c>.", ERRSTR, input[0]);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "\t%sInvalid choice: <%c>.\n", ERRSTR, input[0]);
- } /* switch */
- #if PC
- } /* if ! val */
- #endif
- } /* while */
- } /* animalmenu */