home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / MISC / EDUCATIO / STAGES12.ZIP / PRINTS1.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-04-16  |  25.9 KB  |  913 lines

  1. #include "header.h"
  2. #include "file.h"
  3.  
  4. /************************************************************************/
  5. /**    print routines: part 1                           **/
  6. /************************************************************************/
  7. /*  contains:    printintro
  8.             printoutputhdr
  9.         printstgdat
  10.         printstgdatHARD
  11.         printseqdat1
  12.         printseqdat
  13.         printseqdatHARD
  14. */
  15.  
  16. /********************************/
  17. /*     function: printintro    */
  18. /********************************/
  19. /* prints out title page information */
  20. printintro (termq, fileq)
  21.   int termq, fileq;
  22. {
  23. #if PC
  24.   int i;
  25. #endif
  26.  
  27. #if PC
  28.   if (termq) {
  29.     i = 1;
  30.     printline(4, LNWID, '-');    /* to file and printer only */
  31.     clrscr1(3);
  32.     clrscr1(1);
  33.     gotoxy(1, i++);
  34.     highvideo();
  35.     cprintf("%sStages Program  [Version %s]", tab, VERSION);
  36.     normvideo();
  37.     i++;
  38.     gotoxy(1, i++);
  39.     cprintf("%sA Spermatogenesis Stage Predictor Program", tab);
  40.     gotoxy(1, i++);
  41.     cprintf("%sDeveloped at the University of Illinois, Urbana, IL", tab);
  42.     gotoxy(1, i++);
  43.     cprintf("%s    Programmer:  Paul P. Chen", tab);
  44.     i++;
  45.     gotoxy(1, i++);
  46.     cprintf("%sDirect correspondence to:", tab);
  47.     gotoxy(1, i++);
  48.     cprintf("%s    Dr. Rex A. Hess", tab);
  49.     gotoxy(1, i++);
  50.     cprintf("%s    Veterinary Biosciences", tab);
  51.     gotoxy(1, i++);
  52.     cprintf("%s    University of Illinois at Urbana-Champaign", tab);
  53.     gotoxy(1, i++);
  54.     cprintf("%s    2001 S. Lincoln Ave.", tab);
  55.     gotoxy(1, i++);
  56.     cprintf("%s    Urbana, IL  61801", tab);
  57.     gotoxy(1, i++);
  58.     cprintf("%s      Tel:  217/333-8933 or 333-2506", tab);
  59.     gotoxy(1, i++);
  60.     cprintf("%s      FAX:  217/333-4628", tab);
  61.     clrscr1(3);
  62.     gotoxy(9, 2);
  63.     cprintf("Created using Turbo C, copyright Borland 1987, 1988.");
  64.     hitreturn(1);
  65.   } /* if termq */
  66.  
  67.   if (HARDCOPY) {
  68.     introprint = 1;
  69.     fprintf(stdprn, "\n\n");
  70.     printline(2, LNWID, '-');
  71.     fprintf(stdprn, "\tStages Program  [Version %s]\n", VERSION);
  72.     fprintf(stdprn, "\tA Spermatogenesis Stage Predictor Program\n");
  73.     fprintf(stdprn, "\tDeveloped at the University of Illinois, ");
  74.     fprintf(stdprn, "Urbana, IL\n");
  75.     fprintf(stdprn, "\t    Programmer:  Paul P. Chen\n\n");
  76.     fprintf(stdprn, "\tDirect correspondence to:\n");
  77.     fprintf(stdprn, "\t    Dr. Rex A. Hess\n");
  78.     fprintf(stdprn, "\t    Veterinary Biosciences\n");
  79.     fprintf(stdprn, "\t    University of Illinois at ");
  80.     fprintf(stdprn, "Urbana-Champaign\n");
  81.     fprintf(stdprn, "\t    2001 S. Lincoln Avenue\n");
  82.     fprintf(stdprn, "\t    Urbana, IL  61801\n");
  83.     fprintf(stdprn, "\t       Tel:  217/333-8933 or 333-2506\n");
  84.     fprintf(stdprn, "\t      FAX:  217/333-4628\n\n");
  85.     fprintf(stdprn, "\tCreated using Turbo C, ");
  86.     fprintf(stdprn, "copyright Borland 1987, 1988.\n");
  87.     printline(2, LNWID, '-');
  88.   } /* if HARDCOPY */
  89. #else
  90.   if (termq) {
  91.     printf("\n\n");
  92.     printline(0, LNWID, '-');
  93.     printf("\tStages Program  [Version %s]\n\n", VERSION);
  94.     printf("\tA Spermatogenesis Stage Predictor Program\n");
  95.     printf("\tDeveloped at the University of Illinois, Urbana, IL\n");
  96.     printf("\t    Programmer:  Paul P. Chen\n\n");
  97.     printf("\tDirect correspondence to:\n");
  98.     printf("\t    Dr. Rex A. Hess\n");
  99.     printf("\t    Veterinary Biosciences\n");
  100.     printf("\t    University of Illinois at Urbana-Champaign\n");
  101.     printf("\t    2001 S. Lincoln Ave.\n");
  102.     printf("\t    Urbana, IL  61801\n");
  103.     printf("\t      Tel:  217/333-8933 or 333-2506\n");
  104.     printf("\t      FAX:  217/333-4628\n\n");
  105.     printf("\tCreated using Turbo C, ");
  106.     printf("copyright Borland 1987, 1988.\n");
  107.     printline(0, LNWID, '-');
  108.   } /* if termq */
  109. #endif
  110.  
  111.   if (fileq) {
  112.     fprintf(fpout, "\n\n");
  113.     printline(1, LNWID, '-');
  114.     fprintf(fpout, "\tStages Program  [Version %s]\n", VERSION);
  115.     fprintf(fpout, "\tA Spermatogenesis Stage Predictor Program\n");
  116.     fprintf(fpout, "\tDeveloped at the University of Illinois, ");
  117.     fprintf(fpout, "Urbana, IL\n");
  118.     fprintf(fpout, "\t    Programmer:  Paul P. Chen\n\n");
  119.     fprintf(fpout, "\tDirect correspondence to:\n");
  120.     fprintf(fpout, "\t    Dr. Rex A. Hess\n");
  121.     fprintf(fpout, "\t    Veterinary Biosciences\n");
  122.     fprintf(fpout, "\t    University of Illinois at ");
  123.     fprintf(fpout, "Urbana-Champaign\n");
  124.     fprintf(fpout, "\t    2001 S. Lincoln Avenue\n");
  125.     fprintf(fpout, "\t    Urbana, IL  61801\n");
  126.     fprintf(fpout, "\t      Tel:  217/333-8933 or 333-2506\n");
  127.     fprintf(fpout, "\t      FAX:  217/333-4628\n\n");
  128.     fprintf(fpout, "\tCreated using Turbo C, ");
  129.     fprintf(fpout, "copyright Borland 1987, 1988.\n");
  130.     printline(1, LNWID, '-');
  131.   } /* if fileq */
  132.   return(0);
  133. } /* printintro */
  134.  
  135. /********************************/
  136. /*     function: printoutputhdr    */
  137. /********************************/
  138. printoutputhdr (argc, argv, pbadipfil, interactive, ok,
  139.         ipfil, opfil, stgfil, seqfil)
  140.   int argc;
  141.   char *argv[];
  142.   int *pbadipfil, interactive, ok;
  143.   char *ipfil, *opfil, *stgfil, *seqfil;
  144. {
  145.   int j, ok1, val;
  146.   char dummy[MAXLEN];        /* user string input (y/n) */
  147. #if PC
  148.   int i;
  149.  
  150.   i = 3;
  151.   printline(4, LNWID, '-');    /* to file and printer only */
  152.   topline("");            /* puts animal name at top */
  153.   clrscr1(1);
  154.   gotoxy(1, i++);
  155.   cprintf("%sStages Program Output", tab);
  156.   gotoxy(1, i++);
  157.   cprintf("%sCalled by command: ", tab);
  158.   if (HARDCOPY) {
  159.     fprintf(stdprn, "\tStages Program Output\n\n");
  160.     fprintf(stdprn, "\tCalled by command: ");
  161.   }
  162. #else
  163.   printf("\n\n");
  164.   printline(3, LNWID, '-');
  165.   printf("\tStages Program Output\n\n");
  166.   printf("\tCalled by command: ");
  167. #endif
  168.   if (FILEq && FILECOPY) {
  169.     fprintf(fpout, "\tStages Program Output\n\n");
  170.     fprintf(fpout, "\tCalled by command: ");
  171.   }
  172.  
  173.   for ( j=0; j<argc; j++ ) {
  174. #if PC
  175.     cprintf(" %s", argv[j]);
  176.     if (HARDCOPY)
  177.       fprintf(stdprn, " %s", argv[j]);
  178. #else
  179.     printf(" %s", argv[j]);
  180. #endif
  181.     if (FILEq && FILECOPY)
  182.       fprintf(fpout, " %s", argv[j]);
  183.   } /* for j */
  184.  
  185. #if PC
  186.   i++;    /* skip a line */
  187.   if (HARDCOPY)
  188.     fprintf(stdprn, "\n\n");
  189. #else
  190.   printf("\n\n");
  191. #endif
  192.   if (FILEq && FILECOPY)
  193.     fprintf(fpout, "\n\n");
  194.  
  195.   if (! ok) {
  196. #if PC
  197.     msgwin();
  198.     gotoxy(1, 1);
  199.     cprintf("%sUnrecognized option(s) ignored.", tab);
  200.     if (HARDCOPY)
  201.       fprintf(stdprn, "\tUnrecognized option(s) ignored.\n\n");
  202. #else
  203.     printf("\tUnrecognized option(s) ignored.\n\n");
  204. #endif
  205.     if (FILEq && FILECOPY)
  206.       fprintf(fpout, "\tUnrecognized option(s) ignored.\n\n");
  207.   } /* !ok */
  208.  
  209.   if (*pbadipfil) { /* interactive because ipfil not found */
  210.     /* reset badipfil: don't want to print out this error msg more than once */
  211.     *pbadipfil = 0;
  212. #if PC
  213.     msgwin();
  214.     gotoxy(1, 2);
  215.     cprintf("%sInvalid batch input file <%s> specified.", tab, ipfil);
  216.     gotoxy(1, 3);
  217.     cprintf("%sInput must be entered interactively.", tab);
  218.     outputwin();
  219.     gotoxy(1, i++);
  220.     cprintf("%sInput must be entered interactively.", tab);
  221.     if (HARDCOPY) {
  222.       fprintf(stdprn, "\tInvalid batch input file <%s> specified.\n", ipfil);
  223.       fprintf(stdprn, "\t    Input must be entered interactively.\n");
  224.     }
  225. #else
  226.     printf("\tInvalid batch input file <%s> specified.\n", ipfil);
  227.     printf("\t    Input must be entered interactively.\n");
  228. #endif
  229.     if (FILEq && FILECOPY) {
  230.       fprintf(fpout, "\tInvalid batch input file <%s> specified.\n", ipfil);
  231.       fprintf(fpout, "\t    Input entered interactively.\n");
  232.     }
  233.   } else { /* !badipfil */
  234.     if (interactive) {
  235. #if PC
  236.       outputwin();
  237.       gotoxy(1, i++);
  238.       cprintf("%sInput entered interactively.", tab);
  239.       if (HARDCOPY)
  240.     fprintf(stdprn, "\tInput entered interactively.\n");
  241. #else
  242.       printf("\tInput entered interactively.\n");
  243. #endif
  244.       if (FILEq && FILECOPY)
  245.     fprintf(fpout, "\tInput entered interactively.\n");
  246.     } else { /* input from file */
  247. #if PC
  248.       outputwin();
  249.       gotoxy(1, i++);
  250.       cprintf("%sInput taken from file <%s>.", tab, ipfil);
  251.       if (HARDCOPY)
  252.     fprintf(stdprn, "\tInput taken from file <%s>.\n", ipfil);
  253. #else
  254.       printf("\tInput taken from file <%s>.\n", ipfil);
  255. #endif
  256.       if (FILEq && FILECOPY)
  257.     fprintf(fpout, "\tInput taken from file <%s>.\n", ipfil);
  258.     } /* ! interactive */
  259.   } /* !badipfil */
  260.  
  261.   if (strcmp(opfil, "None")) {
  262. #if PC
  263.     outputwin();
  264.     gotoxy(1, i++);
  265.     cprintf("%sOutput appended to file <%s>.", tab, opfil);
  266.     if (HARDCOPY)
  267.       fprintf(stdprn,"\tOutput appended to file <%s>.\n\n", opfil);
  268. #else
  269.     printf("\tOutput appended to file <%s>.\n\n", opfil);
  270. #endif
  271.     if (FILEq && FILECOPY)
  272.       fprintf(fpout,"\tOutput appended to file <%s>.\n\n", opfil);
  273.   } /* if output file */
  274.  
  275. /* don't need to echo this info, user neither knows nor cares */
  276. #if PC
  277. /*
  278.   i++;
  279.   outputwin();
  280.   gotoxy(1, i++);
  281.   cprintf("%sCycle stage data from file <%s>.", tab, stgfil);
  282.   gotoxy(1, i++);
  283.   cprintf("%sCell sequence data from file <%s>.", tab, seqfil);
  284.   i++;
  285. */
  286.   i += 3;    /* skip a few lines */
  287.   gotoxy(1, i++);
  288.   cprintf("%sDefault Cycle Length: %.2lf days", tab, CycleTime);
  289.   if (HARDCOPY) {
  290. /*
  291.     fprintf(stdprn, "\tCycle stage data from ");
  292.     fprintf(stdprn, "file <%s>.\n", stgfil);
  293.     fprintf(stdprn, "\tCell sequence data from ");
  294.     fprintf(stdprn, "file <%s>.\n\n", seqfil);
  295. */
  296.     fprintf(stdprn, "\tDefault Cycle Length: %.2lf days.\n", CycleTime);
  297.   }
  298. #else
  299. /*
  300.   printf("\tCycle stage data from file <%s>.\n", stgfil);
  301.   printf("\tCell sequence data from file <%s>.\n\n", seqfil);
  302. */
  303.   printf("\tDefault Cycle Length: %.2lf days.\n", CycleTime);
  304. #endif
  305.   if (FILEq && FILECOPY) {
  306. /*
  307.     fprintf(fpout, "\tCycle stage data from ");
  308.     fprintf(fpout, "file <%s>.\n", stgfil);
  309.     fprintf(fpout, "\tCell sequence data from ");
  310.     fprintf(fpout, "file <%s>.\n\n", seqfil);
  311. */
  312.     fprintf(fpout, "\tDefault Cycle Length: %.2lf days.\n", CycleTime);
  313.   }
  314.  
  315.   ok1 = 0;
  316.   while (! ok1) {
  317. #if PC
  318.     printline(4, LNWID, '-');
  319.     clrscr1(2);
  320.     cprintf("%sDo you wish to change the default Cycle Length (y/n)?", tab);
  321.     gotoxy(1, 2);
  322.     highvideo();
  323.     cprintf("%s%c%c%c ", tab2, HBAR, HBAR, RTRI);
  324.     normvideo();
  325.     val = getusrstr(dummy);
  326.     if (HARDCOPY) {
  327.       fprintf(stdprn, "\n\tDo you wish to change the default Cycle Length");
  328.       fprintf(stdprn, " (y/n)?\n\t\t==> %s\n\n", dummy);
  329.     }
  330.     if (val) return(val);
  331. #else
  332.     printline(3, LNWID, '-');
  333.     printf("\n\tDo you wish to change the default Cycle Length? (y/n)\n");
  334.     printf("\t\t==> ");
  335.     val = getusrstr(dummy);
  336. #endif
  337.     if (FILEq && FILECOPY) {
  338.       fprintf(fpout, "\n\tDo you wish to change the default Cycle Length");
  339.       fprintf(fpout, " (y/n)?\n\t\t==> %s\n\n", dummy);
  340.     }
  341.     switch (dummy[0]) {
  342.     case 'y':
  343.     case 'Y':
  344.       return(104);    /* goto cycle length menu */
  345.     case 'n':
  346.     case 'N':
  347.       return(105);    /* goto cell i/p menu */
  348.     default:
  349. #if PC
  350.       clrscr1(3);
  351.       cprintf("%s%s:  Please type either 'y' or 'n'.", tab, ERRSTR);
  352.       if (HARDCOPY)
  353.     fprintf(stdprn, "\t%s:  Please type either 'y' or 'n'.\n\n", ERRSTR);
  354. #else
  355.       printf("\t%s:  Please type either 'y' or 'n'.\n\n", ERRSTR);
  356. #endif
  357.       if (FILEq && FILECOPY)
  358.     fprintf(fpout, "\t%s:  Please type either 'y' or 'n'.\n\n", ERRSTR);
  359.     } /* switch */
  360.   } /* while ! ok */
  361.   return(0);
  362. } /* printoutputhdr */
  363.  
  364. /********************************/
  365. /*     function: printstgdat    */
  366. /********************************/
  367. /* prints out cycle stage data
  368.    returns 1 if printed ok, 0 if no animal exists to be printed */
  369. printstgdat ()
  370. {
  371.   FILE *fil;            /* ptr to ref dat info file */
  372.   int j, half;
  373.   char c, lastc;
  374. #if PC
  375.   int i;
  376. #endif
  377.  
  378.   if (strcmp(Animal, "None")==0) {
  379. #if PC
  380.     clrscr1(1);
  381.     gotoxy(1, 5);
  382.     cprintf("%sNo animal has been selected yet.", tab);
  383.     gotoxy(1, 6);
  384.     cprintf("%sPlease use the Animal Menu to select an animal.", tab);
  385.     hitreturn(1);
  386.     if (HARDCOPY) {
  387.       togglepr();
  388.       fprintf(stdprn, "\n\tNo animal has been selected yet.\n");
  389.       fprintf(stdprn, "\tPlease use the Animal Menu to select an animal.\n");
  390.     }
  391. #else
  392.     printf("\n\tNo animal has been selected yet.\n");
  393.     printf("\tPlease use the Animal Menu to select an animal.\n");
  394. #endif
  395. #if VERBOSE
  396.     if (FILEq && FILECOPY) {
  397.       fprintf(fpout, "\n\tNo animal has been selected yet.\n");
  398.       fprintf(fpout, "\tPlease use the Animal Menu to select an animal.\n");
  399.     }
  400. #endif
  401.     return(0);
  402.   } /* if no Animal */
  403.  
  404. #if PC
  405.   i = 1;
  406.   clrscr1(1);
  407.   gotoxy(1, i++);
  408.   cprintf("%sCycle length = %7.4lf days", tab, CycleTime);
  409.   if (NewCycleTime)
  410.     cprintf("  <new Cycle length>");
  411.   else
  412.     cprintf("  <default Cycle length>");
  413. #else
  414.   printf("\n\t%s\n", Animal);
  415.   printf("\tCycle length = %5.2lf days", CycleTime);
  416.   if (NewCycleTime)
  417.     printf("  <new Cycle length>\n\n");
  418.   else
  419.     printf("  <default Cycle length>\n\n");
  420. #endif
  421.   if (FILEq && FILECOPY) {
  422.     fprintf(fpout, "\n\t%s\n", Animal);
  423.     fprintf(fpout, "\tCycle length = %5.2lf days", CycleTime);
  424.     if (NewCycleTime)
  425.       fprintf(fpout, "  <new Cycle length>\n");
  426.     else
  427.       fprintf(fpout, "  <default Cycle length>\n");
  428.   }
  429.  
  430.   half = (int) (NumStages / 2);
  431.   if (NumStages % 2) half++;
  432.  
  433.   for ( j=0; j<half; j++ ) {
  434. #if PC
  435.     if (i >= OUTPUTLNS) {
  436.       hitreturn(1);
  437.       clrscr1(1);
  438.       i = 1;
  439.       gotoxy(1, i++);
  440.       cprintf("%sCycle length = %5.2lf days", tab, CycleTime);
  441.     }
  442.     gotoxy(1, i++);
  443.     cprintf("%s    Stage %2d = %5.2lf days%s", tab, j+1, stage[j], tab);
  444.     if ((j+half+1) <= NumStages)
  445.       cprintf("Stage %2d = %5.2lf days", j+1+half, stage[j+half]);
  446. #else
  447.     printf("\t    Stage %2d = %5.2lf days%s", j+1, stage[j], tab);
  448.     if ((j+half+1) <= NumStages)
  449.       printf("Stage %2d = %5.2lf days\n", j+1+half, stage[j+half]);
  450.     else
  451.       printf("\n");
  452. #endif
  453.     if (FILEq && FILECOPY) {
  454.       fprintf(fpout, "\t    Stage %2d = %5.2lf days%s", j+1, stage[j], tab);
  455.       if ((j+half+1) <= NumStages)
  456.     fprintf(fpout, "Stage %2d = %5.2lf days\n", j+1+half, stage[j+half]);
  457.       else
  458.     fprintf(fpout, "\n");
  459.     }
  460.   } /* for j */
  461.  
  462. #if PC
  463.   gotoxy(1, i++);
  464.   cprintf("%s%s   Epididymis transit time = %.2lf days", tab, tab, EpiTime);
  465. #else
  466.   printf("\n\t\t   Epididymis transit time =  %.2lf days\n", EpiTime);
  467. #endif
  468.   if (FILEq && FILECOPY) {
  469.     fprintf(fpout, "\n\t\t   Epididymis transit time =  %.2lf days\n", EpiTime);
  470.   }
  471.  
  472.   /* echo reference data */
  473.   switch (AnimalNum) {
  474.   case 0:    /* Sprague-Dawley rat */
  475.     fil = fopen("sdrat.ref", "r");
  476.     break;
  477.   case 1:    /* Sherman rat */
  478.     fil = fopen("shrat.ref", "r");
  479.     break;
  480.   case 2:    /* hamster */
  481.     fil = fopen("hamster.ref", "r");
  482.     break;
  483.   case 3:    /* c3h mouse */
  484.     fil = fopen("c3h.ref", "r");
  485.     break;
  486.   case 4:    /* dog */
  487.     fil = fopen("dog.ref", "r");
  488.     break;
  489.   default:    /* shouldn't! */
  490.     fil = fopen("sdrat.ref", "r");
  491.   } /* switch */
  492.  
  493.   i--;  /* so don't skip a line */
  494.   /* echo cell seq information */
  495. #if PC
  496.   lastc = 10;    /* ! CR */
  497. #endif
  498.   while ((c = getc(fil)) != EOF) {
  499. #if PC
  500.     if (lastc==10) {
  501.       i++;
  502.       gotoxy(3, i);
  503.     } /* if */
  504.     cprintf("%c", c);
  505. #else
  506.     printf("%c", c);
  507. #endif
  508.     if (FILEq && FILECOPY)
  509.       fprintf(fpout, "%c", c);
  510.     lastc = c;
  511.   } /* while */
  512.   fclose(fil);
  513.   return(1);
  514. } /* printstgdat */
  515.  
  516. #if PC
  517. /*********************************/
  518. /*     function: printstgdatHARD */
  519. /*********************************/
  520. /* prints out cycle stage data to the printer */
  521. printstgdatHARD ()
  522. {
  523.   FILE *fil;            /* ptr to ref data info file */
  524.   int j, half;
  525.   char c;
  526.  
  527.   if (strcmp(Animal, "None")==0) {
  528.     clrscr1(1);
  529.     gotoxy(1, 5);
  530.     cprintf("%sNo animal has been selected yet.", tab);
  531.     gotoxy(1, 6);
  532.     cprintf("%sPlease use the Animal Menu to select an animal.", tab);
  533.     hitreturn(1);
  534.     if (HARDCOPY) {
  535.       togglepr();
  536.       fprintf(stdprn, "\n\tNo animal has been selected yet.\n");
  537.       fprintf(stdprn, "\tPlease use the Animal Menu to select an animal.\n");
  538.     }
  539.     return(0);
  540.   } /* if no Animal */
  541.  
  542.   if (HARDCOPY) {
  543.     togglepr();
  544.     fprintf(stdprn, "\n\t%s\n", Animal);
  545.     fprintf(stdprn, "\tCycle length = %5.2lf days", CycleTime);
  546.     if (NewCycleTime)
  547.       fprintf(stdprn, "  <new Cycle length>\n");
  548.     else
  549.       fprintf(stdprn, "  <default Cycle length>\n");
  550.  
  551.     half = (int) (NumStages / 2);
  552.     if (NumStages % 2) half++;
  553.  
  554.     for ( j=0; j<half; j++ ) {
  555.       fprintf(stdprn, "\t    Stage %2d = %5.2lf days%s", j+1, stage[j], tab);
  556.       if ((j+half+1) <= NumStages)
  557.     fprintf(stdprn, "Stage %2d = %5.2lf days\n", j+1+half, stage[j+half]);
  558.       else
  559.     fprintf(stdprn, "\n");
  560.     } /* for j */
  561.  
  562.     fprintf(stdprn, "\n\t\t   Epididymis transit time =  %.2lf days\n",
  563.         EpiTime);
  564.  
  565.     switch (AnimalNum) {
  566.     case 0:    /* Sprague-Dawley rat */
  567.       fil = fopen("sdrat.ref", "r");
  568.       break;
  569.     case 1:    /* Sherman rat */
  570.       fil = fopen("shrat.ref", "r");
  571.       break;
  572.     case 2:    /* hamster */
  573.       fil = fopen("hamster.ref", "r");
  574.       break;
  575.     case 3:    /* c3h mouse */
  576.       fil = fopen("c3h.ref", "r");
  577.       break;
  578.     case 4:    /* dog */
  579.       fil = fopen("dog.ref", "r");
  580.       break;
  581.     default:    /* shouldn't! */
  582.       fil = fopen("sdrat.ref", "r");
  583.     } /* switch */
  584.  
  585.     rewind(fil);
  586.     while ((c = getc(fil)) != EOF)
  587.       fprintf(stdprn, "%c", c);
  588.   } /* if HARDCOPY */
  589.  
  590.   fclose(fil);
  591.   return(1);
  592. } /* printstgdatHARD */
  593.  
  594. #endif
  595.  
  596. /********************************/
  597. /*     function: printseqdat1    */
  598. /********************************/
  599. /* prints out cell sequence data (list of cell names, in sequence)
  600.    returns 1 if printed ok, 0 if no animal exists to be printed */
  601. /* this is the old printseqdat.  the new one follows
  602.    this function performs on-the-fly formatting of the info
  603.    the new func just reads files and cats them to the screen */
  604. printseqdat1 ()
  605. {
  606.   int i, j;        /* loop indices         */
  607.   int col;        /* number of columns for output */
  608.   int row;        /* number of rows for output    */
  609. #if PC
  610.   int k;
  611. #endif
  612.  
  613.   if (strcmp(Animal, "None")==0) {
  614. #if PC
  615.     clrscr1(1);
  616.     gotoxy(1, 5);
  617.     cprintf("%sNo animal has been selected yet.", tab);
  618.     gotoxy(1, 6);
  619.     cprintf("%sPlease use the Animal Menu to select an animal.", tab);
  620.     if (HARDCOPY) {
  621.       fprintf(stdprn, "\n\tNo animal has been selected yet.\n");
  622.       fprintf(stdprn, "\tPlease use the Animal Menu to select an animal.\n");
  623.     }
  624.     hitreturn(1);
  625. #else
  626.     printf("\n\tNo animal has been selected yet.\n");
  627.     printf("\tPlease use the Animal Menu to select an animal.\n");
  628. #endif
  629. #if VERBOSE
  630.     if (FILEq && FILECOPY) {
  631.       fprintf(fpout, "\n\tNo animal has been selected yet.\n");
  632.       fprintf(fpout, "\tPlease use the Animal Menu to select an animal.\n");
  633.     }
  634. #endif
  635.     return(0);
  636.   } /* if no Animal */
  637.  
  638. #if PC
  639.   k = 1;
  640.   clrscr1(1);
  641.   gotoxy(1, k++);
  642. #else
  643.   printf("\n\t%s  :  ", Animal);
  644.   printf("Cell Sequence Data\n");
  645. #endif
  646.   if (FILEq && FILECOPY) {
  647.     fprintf(fpout, "\n\t%s  :  ", Animal);
  648.     fprintf(fpout, "Cell Sequence Data\n");
  649.   }
  650.  
  651.   col = 6;
  652.   row = NumCellSeq / col;
  653.   if (NumCellSeq % col) row++;
  654.  
  655. #if (! PC)
  656.   printf("\n");
  657. #endif
  658.   if (FILEq && FILECOPY) fprintf(fpout, "\n");
  659.  
  660.   /* for printing out cells in order, down columns (vertical order) */
  661.   for ( i=0; i<row; i++ ) {
  662.     for ( j=0; j<col; j++ ) {
  663.       if ((j*row+i+1) <= NumCellSeq) {
  664.     if (j==(col-1)) {    /* prevent extra spaces in last col */
  665. #if PC
  666.       cprintf("%2d: %6s", j*row+i+1, CellNames[j*row+i]);
  667. #else
  668.       printf("%2d: %6s", j*row+i+1, CellNames[j*row+i]);
  669. #endif
  670.     } else {
  671. #if PC
  672.       cprintf("%2d: %6s   ", j*row+i+1, CellNames[j*row+i]);
  673. #else
  674.       printf("%2d: %6s   ", j*row+i+1, CellNames[j*row+i]);
  675. #endif
  676.     }
  677.     if (FILEq && FILECOPY)
  678.       fprintf(fpout, "%2d: %6s   ", j*row+i+1, CellNames[j*row+i]);
  679.       } /* if */
  680.     } /* for j */
  681. #if PC
  682.     if ((k >= OUTPUTLNS) && (i < (row-1))) {
  683.       /* on last line and there's more to go */
  684.       hitreturn(1);
  685.       clrscr1(1);
  686.       k = 1;
  687.       gotoxy(1, k++);
  688.       cprintf("%s%s  :  ", tab, Animal);
  689.       cprintf("Cell Sequence Data");
  690.     } /* if */
  691.     gotoxy(1, k++);
  692. #else
  693.     printf("\n");
  694. #endif
  695.     if (FILEq && FILECOPY) fprintf(fpout, "\n");
  696.   } /* for i */
  697.  
  698. /* prints out seq dat to the printer, if hitreturn returns F8 */
  699. #if PC
  700.   hitreturn(1);
  701.   if (HARDCOPY) {
  702.     togglepr();
  703.     fprintf(stdprn, "\n\t%s  :  ", Animal);
  704.     fprintf(stdprn, "Cell Sequence Data");
  705.     fprintf(stdprn, "\n");
  706.  
  707.     /* for printing out cells in order, down columns (vertical order) */
  708.     for ( i=0; i<row; i++ ) {
  709.       for ( j=0; j<col; j++ ) {
  710.     if ((j*row+i+1) <= NumCellSeq) {
  711.       if (j==(col-1))     /* prevent extra spaces in last col */
  712.         fprintf(stdprn, "%2d: %6s   ", j*row+i+1, CellNames[j*row+i]);
  713.     } /* if */
  714.       } /* for j */
  715.       fprintf(stdprn, "\n");
  716.     } /* for i */
  717.   } /* if HARDCOPY */
  718. #endif
  719.   return(1);
  720. } /* printseqdat1 */
  721.  
  722. /********************************/
  723. /*     function: printseqdat    */
  724. /********************************/
  725. /* prints out cell sequence data (list of cell names, in sequence)
  726.    returns 1 if printed ok, 0 if no animal exists to be printed */
  727. /* this is the new printseqdat.  this just reads files and cats
  728.    them to the screen. no on-the-fly formatting done here. */
  729. printseqdat ()
  730. {
  731.   FILE *fil1;        /* file pointer to seq dat listing file */
  732.   FILE *fil2;        /* file pointer to ref dat listing file */
  733.   char c;        /* input char read */
  734.   char lastc;        /* last input char read */
  735. #if PC
  736.   int j;        /* line counter */
  737. #endif
  738.  
  739.   if (strcmp(Animal, "None")==0) {
  740. #if PC
  741.     clrscr1(1);
  742.     gotoxy(1, 5);
  743.     cprintf("%sNo animal has been selected yet.", tab);
  744.     gotoxy(1, 6);
  745.     cprintf("%sPlease use the Animal Menu to select an animal.", tab);
  746.     if (HARDCOPY) {
  747.       fprintf(stdprn, "\n\tNo animal has been selected yet.\n");
  748.       fprintf(stdprn, "\tPlease use the Animal Menu to select an animal.\n");
  749.     }
  750.     hitreturn(1);
  751. #else
  752.     printf("\n\tNo animal has been selected yet.\n");
  753.     printf("\tPlease use the Animal Menu to select an animal.\n");
  754. #endif
  755. #if VERBOSE
  756.     if (FILEq && FILECOPY) {
  757.       fprintf(fpout, "\n\tNo animal has been selected yet.\n");
  758.       fprintf(fpout, "\tPlease use the Animal Menu to select an animal.\n");
  759.     }
  760. #endif
  761.     return(0);
  762.   } /* if no Animal */
  763.  
  764. #if PC
  765.   j = 0;
  766.   clrscr1(1);
  767. #else
  768.   printf("%s  :  ", Animal);
  769.   printf("Cell Sequence Data\n\n");
  770. #endif
  771.   if (FILEq && FILECOPY) {
  772.     fprintf(fpout, "%s  :  ", Animal);
  773.     fprintf(fpout, "Cell Sequence Data\n\n");
  774.   }
  775.  
  776.   switch (AnimalNum) {
  777.   case 0:    /* Sprague-Dawley rat */
  778.     fil1 = fopen("sdrat.fil", "r");
  779.     fil2 = fopen("sdrat.ref", "r");
  780.     break;
  781.   case 1:    /* Sherman rat */
  782.     fil1 = fopen("shrat.fil", "r");
  783.     fil2 = fopen("shrat.ref", "r");
  784.     break;
  785.   case 2:    /* hamster */
  786.     fil1 = fopen("hamster.fil", "r");
  787.     fil2 = fopen("hamster.ref", "r");
  788.     break;
  789.   case 3:    /* c3h mouse */
  790.     fil1 = fopen("c3h.fil", "r");
  791.     fil2 = fopen("c3h.ref", "r");
  792.     break;
  793.   case 4:    /* dog */
  794.     fil1 = fopen("dog.fil", "r");
  795.     fil2 = fopen("dog.ref", "r");
  796.     break;
  797.   default:    /* shouldn't! */
  798.     fil1 = fopen("sdrat.fil", "r");
  799.     fil2 = fopen("sdrat.ref", "r");
  800.   } /* switch */
  801.  
  802.   /* echo cell seq information */
  803. #if PC
  804.   lastc = 10;    /* CR */
  805. #endif
  806.   while ((c = getc(fil1)) != EOF) {
  807. #if PC
  808.     if (lastc==10) {
  809.       j++;
  810.       gotoxy(3, j);
  811.     } /* if */
  812.     cprintf("%c", c);
  813. #else
  814.     printf("%c", c);
  815. #endif
  816.     if (FILEq && FILECOPY)
  817.       fprintf(fpout, "%c", c);
  818.     lastc = c;
  819.   } /* while */
  820.   fclose(fil1);
  821.  
  822.   /* echo reference information */
  823. #if PC
  824.   lastc = 10;    /* CR */
  825. #endif
  826.   while ((c = getc(fil2)) != EOF) {
  827. #if PC
  828.     if (lastc==10) {
  829.       j++;
  830.       gotoxy(3, j);
  831.     } /* if */
  832.     cprintf("%c", c);
  833. #else
  834.     printf("%c", c);
  835. #endif
  836.     if (FILEq && FILECOPY)
  837.       fprintf(fpout, "%c", c);
  838.     lastc = c;
  839.   } /* while */
  840.   fclose(fil2);
  841.  
  842.   return(1);
  843. } /* printseqdat */
  844.  
  845. #if PC
  846. /*********************************/
  847. /*     function: printseqdatHARD */
  848. /*********************************/
  849. /* prints out cell sequence data to the printer */
  850. printseqdatHARD ()
  851. {
  852.   FILE *fil1;        /* file pointer to seq dat listing file */
  853.   FILE *fil2;        /* file pointer to ref dat listing file */
  854.   char c;        /* input char read */
  855.  
  856.   if (strcmp(Animal, "None")==0) {
  857.     clrscr1(1);
  858.     gotoxy(1, 5);
  859.     cprintf("%sNo animal has been selected yet.", tab);
  860.     gotoxy(1, 6);
  861.     cprintf("%sPlease use the Animal Menu to select an animal.", tab);
  862.     if (HARDCOPY) {
  863.       fprintf(stdprn, "\n\tNo animal has been selected yet.\n");
  864.       fprintf(stdprn, "\tPlease use the Animal Menu to select an animal.\n");
  865.     }
  866.     hitreturn(1);
  867.     return(0);
  868.   } /* if no Animal */
  869.  
  870.   switch (AnimalNum) {
  871.   case 0:    /* Sprague-Dawley rat */
  872.     fil1 = fopen("sdrat.fil", "r");
  873.     fil2 = fopen("sdrat.ref", "r");
  874.     break;
  875.   case 1:    /* Sherman rat */
  876.     fil1 = fopen("shrat.fil", "r");
  877.     fil2 = fopen("shrat.ref", "r");
  878.     break;
  879.   case 2:    /* hamster */
  880.     fil1 = fopen("hamster.fil", "r");
  881.     fil2 = fopen("hamster.ref", "r");
  882.     break;
  883.   case 3:    /* c3h mouse */
  884.     fil1 = fopen("c3h.fil", "r");
  885.     fil2 = fopen("c3h.ref", "r");
  886.     break;
  887.   case 4:    /* dog */
  888.     fil1 = fopen("dog.fil", "r");
  889.     fil2 = fopen("dog.ref", "r");
  890.     break;
  891.   default:    /* shouldn't! */
  892.     fil1 = fopen("sdrat.fil", "r");
  893.     fil2 = fopen("sdrat.ref", "r");
  894.   } /* switch */
  895.  
  896.   if (HARDCOPY) {
  897.     togglepr();
  898.     fprintf(stdprn, "\n%s  :  ", Animal);
  899.     fprintf(stdprn, "Cell Sequence Data\n\n");
  900.  
  901.     rewind(fil1);
  902.     rewind(fil2);
  903.     while ((c = getc(fil1)) != EOF)
  904.       fprintf(stdprn, "%c", c);
  905.     while ((c = getc(fil2)) != EOF)
  906.       fprintf(stdprn, "%c", c);
  907.   } /* if HARDCOPY */
  908.   fclose(fil1);
  909.   fclose(fil2);
  910.   return(1);
  911. } /* printseqdatHARD */
  912. #endif
  913.