home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Education
/
collectionofeducationcarat1997.iso
/
SCIENCE
/
STAGES12.ZIP
/
MENUS1.C
< prev
next >
Wrap
Text File
|
1991-04-14
|
18KB
|
595 lines
#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: