home *** CD-ROM | disk | FTP | other *** search
- #include "header.h"
- #include "file.h"
-
- /************************************************************************/
- /** print routines: part 2 **/
- /************************************************************************/
- /* contains: printusrcells
- printresulthdr
- printresults
- prresF
- prresB
- printepi
- getcellname
- printexit
- printHARDCOPY
- printFILECOPY
- printCycleTime
- printline
- printresHARD
- */
-
- static int printresulthdr(int fileq);
- static int prresF(char *daystr, int *cell, int *len,
- char *cellstr, int *ok, int okcell, int oknum,
- int endspot, char *opstr1, char *opstr2);
- static int prresB(char *daystr, int *cell, int *len,
- char *cellstr, int *ok, int okcell, int oknum,
- int endspot, char *opstr1, char *opstr2);
- static int getcellname(int i, int *cell, char *cellname,
- char dir, int endspot);
-
-
- /********************************/
- /* function: printusrcells */
- /********************************/
- /* prints out a list of the user-entered input cells
- (interactive mode only) */
- printusrcells (cellstrs, trials)
- char cellstrs[][MAXIPLEN];
- int trials;
- {
- int i;
- #if PC
- int j;
- #endif
-
- if (! trials)
- return(0);
-
- #if PC
- j = 1;
- clrscr1(3);
- gotoxy(4, j++);
- cprintf("These are the input cells:");
- gotoxy(6, j);
- if (HARDCOPY) {
- fprintf(stdprn, "\tThese are the input cells:");
- fprintf(stdprn, "\n\t\t");
- }
- #else
- printf("\tThese are the input cells:\n\t\t");
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "\tThese are the input cells:\n\t\t");
-
- for ( i=0; i<trials; i++ ) {
- #if PC
- if ((j >= MSGLNS) && (wherex() >= 65)) {
- /* end of last line of window reached */
- hitreturn(3);
- clrscr1(3);
- j = 1;
- gotoxy(4, j++);
- cprintf("These are the input cells:");
- gotoxy(6, j);
- } /* if j */
-
- if (i && (wherex() >= 65)) { /* if xpos near eol, start new ln */
- #else
- if (i && ((i % 5)==0)) { /* after 5 cells, start new line */
- #endif
- #if PC
- gotoxy(6, ++j);
- if (HARDCOPY)
- fprintf(stdprn, "\n\t\t");
- #else
- printf("\n\t\t");
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "\n\t\t");
- } /* if time for newline */
-
- #if PC
- cprintf("%s ", cellstrs[i]);
- if (HARDCOPY)
- fprintf(stdprn, "%s ", cellstrs[i]);
- #else
- printf("%s ", cellstrs[i]);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "%s ", cellstrs[i]);
- } /* for */
-
- #if PC
- if (HARDCOPY)
- fprintf(stdprn, "\n");
- #else
- printf("\n");
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "\n");
- return(0);
- } /* printusrcells */
-
- /********************************/
- /* function: printresulthdr */
- /********************************/
- /* static means that this function is only used within this file
- saves space in the executable file */
- static printresulthdr (fileq)
- int fileq;
- {
- #if PC
- clrscr1(3);
- clrscr1(2);
- clrscr1(1);
- gotoxy(2, 1);
- cprintf("Init cell Days%s 1st third", tab);
- cprintf("%s 2nd third%s 3rd third", tab, tab);
- gotoxy(2, 2);
- printline(0, LNWID, '=');
- if (HARDCOPY) {
- fprintf(stdprn, "\nInit cell Days%s 1st third", tab);
- fprintf(stdprn, "%s 2nd third%s 3rd third\n", tab, tab);
- printline(2, LNWID, '=');
- }
- fprintf(tmpfp, "\nInit cell Days%s 1st third", tab);
- fprintf(tmpfp, "%s 2nd third%s 3rd third\n", tab, tab);
- printline(5, LNWID, '=');
- #else
- printf("\nInit cell Days%s 1st third", tab);
- printf("%s 2nd third%s 3rd third\n", tab, tab);
- printline(0, LNWID, '=');
- #endif
- if (FILEq && FILECOPY)
- if (fileq) {
- fprintf(fpout, "\nInit cell Days%s 1st third", tab);
- fprintf(fpout, "%s 2nd third%s 3rd third\n", tab, tab);
- printline(1, LNWID, '=');
- }
- return(0);
- } /* printresulthdr */
-
- /********************************/
- /* function: printresults */
- /********************************/
- /* the functions printresults, prresF and prresB all use a temporary
- output file into which they write their output.
- then if the user decides to print the output on the printer,
- we just dump the file to the printer. */
- printresults (dir, days, daystr, cell, cellstr, ok, okcell, oknum,
- endspot, opstr, oncep, epip, opstr1, opstr2)
- char dir; /* direction: F or B */
- double days; /* used if oknum=1 */
- char *daystr; /* used if oknum=0 */
- int *cell; /* used if okcell=1: cells reached */
- char *cellstr; /* used if okcell=0: init cell */
- int *ok; /* move ok? from the 4 pts in init stage */
- int okcell, oknum; /* cell/days valid? */
- int endspot; /* which 3d of stage did move end in? */
- char *opstr; /* err string if move went out of bounds */
- int *oncep; /* controls outputhdr printing */
- int *epip; /* controls printepi printing */
- char *opstr1,
- *opstr2; /* strs for when cell ejac but still tracking stgs */
- {
- int len[4]; /* CellName lengths */
- int i; /* iteration var */
- #if PC
- static int j=1; /* j = y-pos in the output window (STATIC VAR!) */
- int lines; /* # lines in output window this output will need */
- #endif
-
- /* format:
- init cell<5>days<10>1st third<10>2nd third<10>3rd third
- 1 1 2 3 4 5 6 7
- 1 9 5 8 9 7 8 6 7 5 */
- if (! *oncep) {
- #if PC
- makedisplay();
- topline(" Stages Output ");
- clrscr1(3);
- clrscr1(1);
- j = 3;
- #endif
- *oncep = 1;
- printresulthdr(1);
- } /* if ! oncep */
-
- #if PC
- /* determine how many output lines this cell/day input will require;
- if cell ok, only need 2 o/p lines (1 for data, 1 for underline) */
- if ((ok[0] != 1) || (ok[1] !=1 ) || (ok[2] !=1 ) || (ok[3] != 1)) {
- /* final cell epididymis/pre-entry: need 3 extra lines */
- lines = 5;
- } else
- lines = 2;
-
- if (j >= (OUTPUTLNS-lines)) {
- hitreturn(1);
- clrscr1(1);
- printresulthdr(0);
- j = 3;
- }
- outputwin();
- gotoxy(2, j++);
- #endif
-
- if (oknum) {
- #if PC
- cprintf(" %6s %8.4lf", cellstr, days);
- if (HARDCOPY)
- fprintf(stdprn, " %6s %8.4lf", cellstr, days);
- fprintf(tmpfp, " %6s %8.4lf", cellstr, days);
- #else
- printf(" %6s %8.4lf", cellstr, days);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, " %6s %8.4lf", cellstr, days);
- } else { /* bad i/p num syntax */
- #if PC
- cprintf(" %6s %8s", cellstr, daystr);
- if (HARDCOPY)
- fprintf(stdprn, " %6s %8s", cellstr, daystr);
- fprintf(tmpfp, " %6s %8s", cellstr, daystr);
- #else
- printf(" %6s %8s", cellstr, daystr);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, " %6s %8s", cellstr, daystr);
- } /* if oknum */
-
- for ( i=0; i<4; i++ ) {
- if (ok[i]==1) {
- len[i] = strlen(CellNames[cell[i]]);
- } else {
- /* this is because, if ok!=1, then cell[i] = stage reached */
- if (cell[i] < 10)
- /* 1-digit stage */
- len[i] = 1;
- else
- /* 2-digit stage: don't expect to see > 100 stages in the cycle */
- len[i] = 2;
- }
- } /* for */
-
- switch (dir) {
- case 'F':
- prresF(daystr, cell, len, cellstr, ok, okcell, oknum,
- endspot, opstr1, opstr2);
- break;
- case 'B':
- prresB(daystr, cell, len, cellstr, ok, okcell, oknum,
- endspot, opstr1, opstr2);
- break;
- default: /* shouldn't! */
- #if PC
- clrscr1(1);
- gotoxy(1, 5);
- cprintf("%sprintresults: Internal error, dir=%d", tab2, dir);
- gotoxy(1, 7);
- cprintf("%s Sorry, aborting.", tab2);
- #endif
- printexit(21);
- break;
- } /* switch */
- #if PC
- gotoxy(2, j++);
- if (HARDCOPY)
- fprintf(stdprn, "\n");
- fprintf(tmpfp, "\n");
- #else
- printf("\n");
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "\n");
-
- if ((ok[0] != 1) || (ok[1] !=1 ) || (ok[2] !=1 ) || (ok[3] != 1)) {
- #if PC
- cprintf(" (%s)\n", opstr);
- gotoxy(2, j++);
- cprintf("%s", opstr1);
- gotoxy(2, j++);
- cprintf("%s", opstr2);
- gotoxy(2, j++);
- if (HARDCOPY) {
- fprintf(stdprn, " (%s)\n", opstr);
- fprintf(stdprn, "%s\n", opstr1);
- fprintf(stdprn, "%s\n", opstr2);
- }
- fprintf(tmpfp, " (%s)\n", opstr);
- #else
- printf(" (%s)\n", opstr);
- printf("%s\n", opstr1);
- printf("%s\n", opstr2);
- #endif
- if (FILEq && FILECOPY) {
- fprintf(fpout, " (%s)\n", opstr);
- fprintf(fpout, "%s\n", opstr1);
- fprintf(fpout, "%s\n", opstr2);
- }
- } /* if */
-
- /* set *epip if any cell went into epididymis */
- if ((ok[0]==2) || (ok[1]==2) || (ok[2]==2) || (ok[3]==2))
- *epip = 1;
- return(0);
- } /* printresults */
-
- /********************************/
- /* function: prresF */
- /********************************/
- /* static means that this function is only used within this file
- saves space in the executable file */
- static prresF (daystr, cell, len, cellstr, ok, okcell, oknum,
- endspot, opstr1, opstr2)
- char *daystr; /* used if oknum=0 */
- int *cell; /* cell seq #s of cells reached */
- int *len; /* lengths of cellnames reached */
- char *cellstr; /* name of initial cellname */
- int *ok; /* move ok? from the 4 pts in init stage */
- int okcell, oknum; /* boolean: cell/days valid? */
- int endspot; /* which 3rd of stage did move end in? */
- /* strings used when cell has been ejact, but still want to track stages */
- char *opstr1, *opstr2;
- {
- int i, val, splen;
- char spstr[MAXLEN]; /* unspec. space string */
- char opstr[MAXLEN];
- char tmpstr[MAXLEN]; /* tmpstr & tmpstr1 used if case 11 if both */
- char tmpstr1[MAXLEN]; /* cells reached are multicells */
-
- #if (DEBUG > 4)
- #if PC
- clrscr1(3);
- gotoxy(1, 1);
- cprintf("%sprresF: entering", tab);
- hitreturn(1);
- #else
- printf("\tprresF: entering\n");
- #endif
- #endif
-
- sprintf(opstr1, " After spermiation, younger cells would have ");
- strcat(opstr1, "tracked through to the");
- sprintf(opstr2, " following stages:");
-
- for ( i=0; i<3; i++ ) { /* 3 fields to print out */
-
- if (! okcell) { /* bad cellstr syntax */
- sprintf(opstr, " %s: Invalid cell syntax <%s>",
- ERRSTR, cellstr);
- #if PC
- cprintf("%s", opstr);
- if (HARDCOPY)
- fprintf(stdprn, "%s", opstr);
- fprintf(tmpfp, "%s", opstr);
- #else
- printf("%s", opstr);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "%s", opstr);
- return(0);
- } /* !okcell */
-
- if (! oknum) { /* bad number syntax */
- sprintf(opstr, " %s: Invalid days syntax <%s>",
- ERRSTR, daystr);
- #if PC
- cprintf("%s", opstr);
- if (HARDCOPY)
- fprintf(stdprn, "%s", opstr);
- fprintf(tmpfp, "%s", opstr);
- #else
- printf("%s", opstr);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "%s", opstr);
- return(0);
- } /* if !oknum */
-
- val = (10 * ok[i]) + ok[i+1];
- /* possible values for val: (since ok = 0:ejac 1:ok 2:epi)
-
- cell[i] cell[i+1] val
- ==================================
- ok ok 11
- ok epi 12
- ok ejac 10
- epi epi 22
- epi ejac 20
- ejac ejac 0
- */
- switch (val) {
-
- case 0: /* ejac */
- /* 9 for "Ejaculate" */
- splen = 19 - 9;
- makespstr(spstr, splen);
- #if PC
- cprintf("%sEjaculate", spstr);
- if (HARDCOPY)
- fprintf(stdprn, "%sEjaculate", spstr);
- fprintf(tmpfp, "%sEjaculate", spstr);
- #else
- printf("%sEjaculate", spstr);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "%sEjaculate", spstr);
-
- if (cell[i] == cell[i+1]) {
- splen = 19 - len[i];
- makespstr(spstr, splen);
- sprintf(tmpstr, "%s%d", spstr, cell[i]);
- strcat(opstr2, tmpstr);
- } else {
- splen = 19 - (len[i] + len[i+1] + 1); /* +1 for "/" */
- makespstr(spstr, splen);
- sprintf(tmpstr, "%s%d/%d", spstr, cell[i], cell[i+1]);
- strcat(opstr2, tmpstr);
- } /* if */
- break;
-
- case 10: /* ok ejac */
- /* get correct cellname */
- getcellname(i, cell, tmpstr, 'F', endspot);
-
- /* +5 for "Ejact"; +1 for '/' */
- splen = 19 - (strlen(tmpstr) + 5 + 1);
- makespstr(spstr, splen);
- #if PC
- cprintf("%s%s/Ejact", spstr, tmpstr);
- if (HARDCOPY)
- fprintf(stdprn, "%s%s/Ejact", spstr, tmpstr);
- fprintf(tmpfp, "%s%s/Ejact", spstr, tmpstr);
- #else
- printf("%s%s/Ejact", spstr, tmpstr);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "%s%s/Ejact", spstr, tmpstr);
-
- /* cell[i+1] has stage where younger cell would've ended */
- splen = 19 - (len[i+1] + 1); /* +1 for '/' */
- makespstr(spstr, splen);
- sprintf(tmpstr, "%s/%d", spstr, cell[i+1]);
- strcat(opstr2, tmpstr);
- break;
-
- case 11: /* ok ok */
- if (strcmp(CellNames[cell[i]], CellNames[cell[i+1]])==0) {
- /* same cell reached from each end of third */
- /* get correct cell name */
- getcellname(i, cell, tmpstr, 'F', endspot);
- #if PC
- cprintf("%s %10s", tab, tmpstr);
- if (HARDCOPY)
- fprintf(stdprn, "%s %10s", tab, tmpstr);
- fprintf(tmpfp, "%s %10s", tab, tmpstr);
- #else
- printf("%s %10s", tab, tmpstr);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "%s %10s", tab, tmpstr);
-
- } else {
- /* different cells reached from each end of third */
- /* get correct cell names */
- getcellname(i, cell, tmpstr, 'F', endspot);
- getcellname(i+1, cell, tmpstr1, 'F', endspot);
-
- splen = 19 - (strlen(tmpstr) + strlen(tmpstr1) + 1); /* +1 for '/' */
- makespstr(spstr, splen);
- #if PC
- cprintf("%s%s/%s", spstr, tmpstr, tmpstr1);
- if (HARDCOPY)
- fprintf(stdprn, "%s%s/%s", spstr, tmpstr, tmpstr1);
- fprintf(tmpfp, "%s%s/%s", spstr, tmpstr, tmpstr1);
- #else
- printf("%s%s/%s", spstr, tmpstr, tmpstr1);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "%s%s/%s", spstr, tmpstr, tmpstr1);
- } /* else */
-
- makespstr(spstr, 19);
- strcat(opstr2, spstr);
- break;
-
- case 12: /* ok epi */
- /* get correct cell name */
- getcellname(i, cell, tmpstr, 'F', endspot);
-
- /* +10 for "Epididymis", +1 for "/" */
- splen = 19 - (strlen(tmpstr) + 10 + 1);
- makespstr(spstr, splen);
-
- #if PC
- cprintf("%s%s/Epididymis", spstr, tmpstr);
- if (HARDCOPY)
- fprintf(stdprn, "%s%s/Epididymis", spstr, tmpstr);
- fprintf(tmpfp, "%s%s/Epididymis", spstr, tmpstr);
- #else
- printf("%s%s/Epididymis", spstr, tmpstr);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "%s%s/Epididymis", spstr, tmpstr);
-
- /* cell[i+1] has stage where younger cells would've ended */
- splen = 19 - (len[i+1] + 1); /* +1 for '/' */
- makespstr(spstr, splen);
- sprintf(tmpstr, "%s/%d", spstr, cell[i+1]);
- strcat(opstr2, tmpstr);
- break;
-
- case 20: /* epi ejac */
- /* 16 for "Epididymis/Ejact" */
- splen = 19 - 16;
- makespstr(spstr, splen);
- #if PC
- cprintf("%sEpididymis/Ejact", spstr);
- if (HARDCOPY)
- fprintf(stdprn, "%sEpididymis/Ejact", spstr);
- fprintf(tmpfp, "%sEpididymis/Ejact", spstr);
- #else
- printf("%sEpididymis/Ejact", spstr);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "%sEpididymis/Ejact", spstr);
-
- /* both cell[i] and cell[i+1] hold stages where younger cells would've
- ended */
- if (cell[i] == cell[i+1]) {
- /* reached stages are the same */
- splen = 19 - len[i];
- makespstr(spstr, splen);
- sprintf(tmpstr, "%s%d", spstr, cell[i]);
- strcat(opstr2, tmpstr);
- } else {
- /* reached stages differ */
- splen = 19 - (len[i] + len[i+1] + 1); /* +1 for '/' */
- makespstr(spstr, splen);
- sprintf(tmpstr, "%s%d/%d", spstr, cell[i], cell[i+1]);
- strcat(opstr2, tmpstr);
- }
- break;
-
- case 22: /* epi */
- /* 10 for "Epididymis" */
- splen = 19 - 10;
- makespstr(spstr, splen);
- #if PC
- cprintf("%sEpididymis", spstr);
- if (HARDCOPY)
- fprintf(stdprn, "%sEpididymis", spstr);
- fprintf(tmpfp, "%sEpididymis", spstr);
- #else
- printf("%sEpididymis", spstr);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "%sEpididymis", spstr);
-
- /* both cell[i] and cell[i+1] hold stages where younger cells
- would've ended */
- if (cell[i] == cell[i+1]) {
- /* whole stage epididymised, but reached stages are the same */
- splen = 19 - len[i];
- makespstr(spstr, splen);
- sprintf(tmpstr, "%s%d", spstr, cell[i]);
- strcat(opstr2, tmpstr);
- } else {
- /* whole stage epididymised, but reached stages differ */
- splen = 19 - (len[i] + len[i+1] + 1); /* +1 for '/' */
- makespstr(spstr, splen);
- sprintf(tmpstr, "%s%d/%d", spstr, cell[i], cell[i+1]);
- strcat(opstr2, tmpstr);
- }
- break;
-
- default: /* shouldn't happen */
- #if PC
- clrscr1(1);
- gotoxy(1, 5);
- cprintf("%s<prresF>: Internal error, val=%d", tab2, val);
- gotoxy(1, 7);
- cprintf("%s Sorry, aborting.", tab2);
- #endif
- printexit(19);
- break;
- } /* switch */
- } /* for i */
- #if (DEBUG > 4)
- #if PC
- clrscr1(3);
- gotoxy(1, 1);
- cprintf("%sprresF: leaving prresF", tab);
- hitreturn(1);
- #else
- printf("\tprresF: leaving prresF\n");
- #endif
- #endif
- return(0);
- } /* prresF */
-
- /********************************/
- /* function: prresB */
- /********************************/
- /* static means that this function is only used within this file
- saves space in the executable file */
- static prresB (daystr, cell, len, cellstr, ok, okcell, oknum,
- endspot, opstr1, opstr2)
- char *daystr; /* used if oknum=0 */
- int *cell; /* cell seq #s of cells reached */
- int *len; /* lengths of cellnames reached */
- char *cellstr; /* name of initial cellname */
- int *ok; /* move ok? from the 4 pts in init stage */
- int okcell, oknum; /* boolean: cell/days valid? */
- int endspot; /* which 3rd of stage did move end in? */
- /* strings used when cell has been ejact, but still want to track stages */
- char *opstr1, *opstr2;
- {
- int i, val, splen;
- char spstr[MAXLEN]; /* space string, unspec. len */
- char opstr[MAXLEN];
- char tmpstr[MAXLEN]; /* tmpstr & tmpstr1 used if case 11 if both */
- char tmpstr1[MAXLEN]; /* cells reached are multicells */
- char tab7[8]; /* 7 spaces */
-
- strcpy(tab7, " ");
- sprintf(opstr1, " Prior to entering spermatogenesis, cells would ");
- strcat(opstr1, "have come from the");
- sprintf(opstr2, " following stages:");
-
- for ( i=0; i<3; i++ ) { /* 3 fields to print out */
-
- if (! okcell) { /* bad cellstr syntax */
- sprintf(opstr, " %s: Invalid cell syntax <%s>",
- ERRSTR, cellstr);
- #if PC
- cprintf("%s", opstr);
- if (HARDCOPY)
- fprintf(stdprn, "%s", opstr);
- fprintf(tmpfp, "%s", opstr);
- #else
- printf("%s", opstr);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "%s", opstr);
- return(0);
- } /* !okcell */
-
- if (! oknum) { /* bad number syntax */
- sprintf(opstr, " %s: Invalid days syntax <%s>",
- ERRSTR, daystr);
- #if PC
- cprintf("%s", opstr);
- if (HARDCOPY)
- fprintf(stdprn, "%s", opstr);
- fprintf(tmpfp, "%s", opstr);
- #else
- printf("%s", opstr);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "%s", opstr);
- return(0);
- } /* !oknum */
-
- val = (10 * ok[i]) + ok[i+1];
- /* possible values for val: (since ok = 0:pre 1:ok)
-
- cell[i] cell[i+1] val
- ==================================
- ok ok 11
- pre ok 1
- pre pre 0
- */
- switch (val) {
-
- case 0: /* pre-entry from end of third */
- #if PC
- cprintf("%s Pre-Entry", tab7);
- if (HARDCOPY)
- fprintf(stdprn, "%s Pre-Entry", tab7);
- fprintf(tmpfp, "%s Pre-Entry", tab7);
- #else
- printf("%s Pre-Entry", tab7);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "%s Pre-Entry", tab7);
-
- /* both cell[i] and cell[i+1] hold stages where cells could've
- come from */
- if (cell[i] == cell[i+1]) {
- splen = 19 - len[i];
- makespstr(spstr, splen);
- sprintf(tmpstr, "%s%d", spstr, cell[i]);
- strcat(opstr2, tmpstr);
- } else {
- splen = 19 - (len[i] + len[i+1] + 1); /* +1 for "/" */
- makespstr(spstr, splen);
- sprintf(tmpstr, "%s%d/%d", spstr, cell[i], cell[i+1]);
- strcat(opstr2, tmpstr);
- } /* if */
- break;
-
- case 1: /* pre-entry from end of third */
- /* get correct cellname */
- getcellname(i+1, cell, tmpstr, 'B', endspot);
-
- /* +6 for "PreEnt"; +1 for '/' */
- splen = 19 - (strlen(tmpstr) + 6 + 1);
- makespstr(spstr, splen);
-
- #if PC
- cprintf("%sPreEnt/%s", spstr, tmpstr);
- if (HARDCOPY)
- fprintf(stdprn, "%sPreEnt/%s", spstr, tmpstr);
- fprintf(tmpfp, "%sPreEnt/%s", spstr, tmpstr);
- #else
- printf("%sPreEnt/%s", spstr, tmpstr);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "%sPreEnt/%s", spstr, tmpstr);
-
- /* cell[i] holds stage where cells might've come from */
- splen = 19 - (len[i] + 1); /* +1 for '/' */
- makespstr(spstr, splen);
- sprintf(tmpstr, "%s%d/", spstr, cell[i]);
- strcat(opstr2, tmpstr);
- break;
-
- case 11: /* reached valid cell */
- if (strcmp(CellNames[cell[i]], CellNames[cell[i+1]])==0) {
- /* same cell reached from each end of third */
- /* get correct cell name */
- getcellname(i, cell, tmpstr, 'B', endspot);
- #if PC
- cprintf("%s %10s", tab, tmpstr);
- if (HARDCOPY)
- fprintf(stdprn, "%s %10s", tab, tmpstr);
- fprintf(tmpfp, "%s %10s", tab, tmpstr);
- #else
- printf("%s %10s", tab, tmpstr);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "%s %10s", tab, tmpstr);
- } else {
- /* different cells reached from each end of third */
- /* get correct cell names */
- getcellname(i, cell, tmpstr, 'B', endspot);
- getcellname(i+1, cell, tmpstr1, 'B', endspot);
-
- splen = 19 - (strlen(tmpstr) + strlen(tmpstr1) + 1); /* +1 for '/' */
- makespstr(spstr, splen);
-
- #if PC
- cprintf("%s%s/%s", spstr, tmpstr, tmpstr1);
- if (HARDCOPY)
- fprintf(stdprn, "%s%s/%s", spstr, tmpstr, tmpstr1);
- fprintf(tmpfp, "%s%s/%s", spstr, tmpstr, tmpstr1);
- #else
- printf("%s%s/%s", spstr, tmpstr, tmpstr1);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "%s%s/%s", spstr, tmpstr, tmpstr1);
- } /* else */
-
- makespstr(spstr, 19);
- strcat(opstr2, spstr);
- break;
-
- default: /* shouldn't! */
- #if PC
- clrscr1(1);
- gotoxy(1, 5);
- cprintf("%s<prresB>: Internal error, val=%d", tab2, val);
- gotoxy(1, 7);
- cprintf("%s Sorry, aborting.", tab2);
- #endif
- printexit(20);
- break;
- } /* switch */
- } /* for i */
- return(0);
- } /* prresB */
-
- /****************************************/
- /* function: printepi */
- /****************************************/
- /* prints out the disclaimer if any trial moves a cell
- into the epididymides */
- printepi ()
- {
- /* print epididymis times disclaimer */
- #if PC
- clrscr1(3);
- cprintf(" Note: The epididymis transit time is estimated at 10 days, but can vary");
- gotoxy(1, 2);
- cprintf(" depending on the sexual activity of the animal under study. (Robaire");
- gotoxy(1, 3);
- cprintf(" & Hermo (1988) in: The Physiol. of Reprod., Knobil & Neill et al., eds.)", tab);
- if (HARDCOPY) {
- fprintf(stdprn, "\n Note: The epididymis transit time is estimated at 10 days, but can vary\n");
- fprintf(stdprn, " depending on the sexual activity of the animal under study. (Robaire\n");
- fprintf(stdprn, " & Hermo (1988) in: The Physiol. of Reprod., Knobil & Neill et al., eds.)\n");
- }
- fprintf(tmpfp, "\n Note: The epididymis transit time is estimated at 10 days, but can vary\n");
- fprintf(tmpfp, " depending on the sexual activity of the animal under study. (Robaire\n");
- fprintf(tmpfp, " & Hermo (1988) in: The Physiol. of Reprod., Knobil & Neill et al., eds.)\n");
- #else
- printf("\n Note: The epididymis transit time is estimated at 10 days, but can vary\n");
- printf(" depending on the sexual activity of the animal under study. (Robaire\n");
- printf(" & Hermo (1988) in: The Physiol. of Reprod., Knobil & Neill et al., eds.)\n");
- #endif
- if (FILEq && FILECOPY) {
- fprintf(fpout, "\n Note: The epididymis transit time is estimated at 10 days, but can vary\n");
- fprintf(fpout, " depending on the sexual activity of the animal under study. (Robaire\n");
- fprintf(fpout, " & Hermo (1988) in: The Physiol. of Reprod., Knobil & Neill et al., eds.)\n");
- }
- return(0);
- } /* printepi */
-
- /********************************/
- /* function: getcellname */
- /********************************/
- /* gets the correct cell name to print out, on the printresults output:
- correct cell is either CellNames[cell[i]], or if cell[i] is a multicell,
- then is MultiCellNames[j][i] where j is found by searching linearly
- through the MultiCellNames array */
- static getcellname (i, cell, cellname, dir, endspot)
- int i, *cell;
- char *cellname;
- char dir; /* 'F' or 'B' */
- int endspot; /* which 3d of stage did move end in? */
- {
- int j, go;
- int k; /* k=0 if dir=F, k=2 if dir=B */
- int multiflag; /* =1 if cell[i] is a multicell */
-
- #if (DEBUG > 4)
- #if PC
- clrscr1(3);
- gotoxy(1, 1);
- cprintf("%sgetcellname: entering", tab);
- hitreturn(1);
- #else
- printf("\tgetcellname: entering\n");
- #endif
- #endif
-
- if (dir=='F') k = 0;
- if (dir=='B') k = 2;
- multiflag = 0;
- go = 1;
- j = 0;
- while (go && j<NumMultiCells) {
- /* compare w/MultiCellNames[j][0] when moving fwd, because
- will get to 1st-third name (^) first -- when moving bwd,
- use MultiCellNames[j][2], since get there first */
- #if (DEBUG > 4)
- #if PC
- makeactivewin(1);
- gotoxy(1, 5);
- clreol1(1);
- gotoxy(1, 5);
- cprintf("%si=<%d> cell[i]=<%d> CellNames[cell[i]]=<%s>",
- tab, i, cell[i], CellNames[cell[i]]);
- gotoxy(1, 7);
- clreol1(1);
- gotoxy(1, 7);
- cprintf("%sj=<%d> k=<%d> MultiCellNames[j][k]=<%s>",
- tab, j, k, MultiCellNames[j][k]);
- hitreturn(1);
- #else
- printf("\tdebug stuff...\n");
- #endif
- #endif
- if (strcmp(CellNames[cell[i]], MultiCellNames[j][k])==0) {
- /* cell[i] is a multicell */
- /* -1 from endspot since endspot is 1,2 or 3, and indices run 0,1,2 */
- strcpy(cellname, MultiCellNames[j][endspot-1]);
- go = 0;
- multiflag = 1;
- }
- j++;
- } /* for j */
- if (! multiflag)
- strcpy(cellname, CellNames[cell[i]]);
- #if (DEBUG > 4)
- #if PC
- clrscr1(1);
- gotoxy(1, 11);
- cprintf("%sgetcellname: multiflag=<%d> cellname=<%s> endspot=<%d>",
- tab, multiflag, cellname, endspot);
- hitreturn(1);
- #else
- printf("\tgetcellname: cellname=<%s>\n", cellname);
- #endif
- #endif
- return(0);
- } /* getcellname */
-
- /********************************/
- /* function: printexit */
- /********************************/
- printexit (exitnum)
- int exitnum;
- {
- #if PC
- if (exitnum != 0) {
- clrscr1(3);
- gotoxy(1, 2);
- cprintf("%sExiting.", tab);
- #if (DEBUG)
- gotoxy(1, 3);
- cprintf("%sExit code = <%d>.", tab, exitnum);
- #endif
- if (HARDCOPY)
- fprintf(stdprn, "\tExiting.\n\n");
- }
- /* wholewin();
- gotoxy(1, 25); */
- #else
- printf("\tExiting.\n\n");
- if (FILEq && FILECOPY) {
- fprintf(fpout, "\tExiting.\n\n");
- fclose(fpout);
- }
- #endif
- exit(exitnum);
- return(0); /* this is unreachable code */
- } /* printexit */
-
- #if PC
- /********************************/
- /* function: printHARDCOPY */
- /********************************/
- printHARDCOPY ()
- /* the PRINT ON/OFF annunciator is on the botline window */
- {
- botline();
- return(0);
- } /* printHARDCOPY */
- #endif
-
- /********************************/
- /* function: printFILECOPY */
- /********************************/
- printFILECOPY ()
- /* the PRINT ON/OFF annunciator is on the botline window */
- {
- #if PC
- botline();
- #else
- if (FILECOPY)
- printf("\n\tFile output on.\n");
- else
- printf("\n\tFile output off.\n");
- #endif
- return(0);
- } /* printFILECOPY */
-
- #if PC
-
- /********************************/
- /* function: printCycleTime */
- /********************************/
- /* prints out CycleTime annunciator on screen: current value of CycleTime */
- printCycleTime ()
- {
- sep1win();
- return(0);
- } /* printCycleTime */
-
- #endif
-
- /********************************/
- /* function: printline */
- /********************************/
- /* prints line of num of char c's:
- if fileq = 0, print to terminal
- if fileq = 1, print to file
- if fileq = 2, print to printer
- if fileq = 3, print to all three
- if fileq = 4, print to file and printer
- if fileq = 5, print to temp file (output holder to dump) */
- printline (fileq, num, c)
- int fileq, num;
- char c;
- {
- int i;
-
- switch (fileq) {
- case 0: /* to terminal */
- for ( i=0; i<num; i++ )
- #if PC
- putch(c);
- #else
- printf("%c", c);
- printf("\n");
- #endif
- break;
-
- case 1: /* to file */
- if (FILEq && FILECOPY) {
- for ( i=0; i<num; i++ )
- fprintf(fpout, "%c", c);
- fprintf(fpout, "\n");
- }
- break;
-
- #if PC
- case 2: /* to printer */
- if (HARDCOPY) {
- for ( i=0; i<num; i++ )
- fprintf(stdprn, "%c", c);
- fprintf(stdprn, "\n");
- }
- break;
- #endif
-
- case 3: /* all three */
- for ( i=0; i<num; i++ )
- #if PC
- putch(c);
- #else
- printf("%c", c);
- printf("\n");
- #endif
- /* do not put a break here!! */
-
- case 4: /* just to file and printer */
- for ( i=0; i<num; i++ ) {
- if (FILEq && FILECOPY)
- fprintf(fpout, "%c", c);
- #if PC
- if (HARDCOPY)
- fprintf(stdprn, "%c", c);
- #endif
- } /* for */
- #if PC
- if (HARDCOPY)
- fprintf(stdprn, "\n");
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "\n");
- break;
- case 5: /* to tmp file, to hold output */
- #if PC
- for ( i=0; i<num; i++ )
- fprintf(tmpfp, "%c", c);
- fprintf(tmpfp, "\n");
- #endif
- break;
-
- default: /* shouldn't! */
- printexit(14);
- } /* switch */
- return(0);
- } /* printline */
-
- #if PC
- /********************************/
- /* function: printresHARD */
- /********************************/
- printresHARD ()
- {
- char c;
-
- fclose(tmpfp);
- tmpfp = fopen(TMPFIL, "r");
- while ((fscanf(tmpfp, "%c", &c)) != EOF)
- fprintf(stdprn, "%c", c);
- fclose(tmpfp);
- tmpfp = fopen(TMPFIL, "w");
- return(0);
- } /* printresHARD */
- #endif