home *** CD-ROM | disk | FTP | other *** search
- #include "header.h"
- #include "file.h"
-
- /************************************************************************/
- /** animals functions **/
- /************************************************************************/
- /* currently supported animals:
-
- animal code# animal abbrev.
- -----------------------------------------------
- sprague-dawley rat 0 sdrat
- sherman rat 1 shrat
- hamster 2 hamster
- c3h mouse 3 c3h
- dog 4 dog
-
- all animals require the following files:
- <abbrev>.stg
- <abbrev>.seq
- <abbrev>.fil
- <abbrev>.mcl
- <abbrev>.ref
- in the same directory where stages.exe is
-
- to add new animals:
- 1/ create a <animal>.stg file
- this file holds the stage cycle data. see stages.doc
- for format info.
- 2/ create a <animal>.seq file
- this file holds the cell sequence data. see stages.doc
- for format info.
- 3/ create a <animal>.fil file
- this file holds the format of the cell sequence. see
- sdrat.fil for format example.
- 4/ create a <animal>.mcl file
- this file holds the cell names for stages with multiple
- cell names possible (mcl = Multiple CeL names). see
- sdrat.mcl for format example.
- 5/ create a <animal>.ref file
- this file holds the reference data from which the stage
- and sequence information were taken. see sdrat.ref for
- format example.
- 6/ install the <animal>.stg, <animal>.seq, <animal>.fil,
- <animal>.mcl and <animal>.ref files in the same directory
- where the stages program is
- 6/ add lines to the animalmenu function (in file menus1.c):
- entries to the menu, and
- cases to the menu selection switch statement
- 7/ add lines to getanimal function (here), patterned after other
- cases in the function
- 8/ add lines to the Help! Using the Animal Menu file, in helps2.c,
- listing the animals supported by stages
- */
-
- /********************************/
- /* function: getanimal */
- /********************************/
- /* gets data for animal from files *.stg, *.seq, and *.mcl
- NB: the code char "animal" doesn't have any mnemonic meaning,
- see animalmenu() in menus1.c to see which animal has which animal code */
- getanimal (pfpstg, pfpseq, pfpmcl, stgfil, seqfil, mclfil, id)
- FILE **pfpstg, **pfpseq, **pfpmcl;
- char *stgfil, *seqfil, *mclfil, id;
- {
- int val1, val2, val3;
- char tmpstr[MAXLEN]; /* tmp str for Animal name */
-
- switch (id) {
- case 'H':
- strcpy(stgfil, "sdrat.stg");
- strcpy(seqfil, "sdrat.seq");
- strcpy(mclfil, "sdrat.mcl");
- strcpy(tmpstr, "Sprague-Dawley Rat");
- AnimalNum = 0;
- break;
- case 'I':
- strcpy(stgfil, "shrat.stg");
- strcpy(seqfil, "shrat.seq");
- strcpy(mclfil, "shrat.mcl");
- strcpy(tmpstr, "Sherman Rat");
- AnimalNum = 1;
- break;
- case 'J':
- strcpy(stgfil, "hamster.stg");
- strcpy(seqfil, "hamster.seq");
- strcpy(mclfil, "hamster.mcl");
- strcpy(tmpstr, "Hamster");
- AnimalNum = 2;
- break;
- case 'K':
- strcpy(stgfil, "c3h.stg");
- strcpy(seqfil, "c3h.seq");
- strcpy(mclfil, "c3h.mcl");
- strcpy(tmpstr, "C3H Mouse");
- AnimalNum = 3;
- break;
- case 'L':
- strcpy(stgfil, "dog.stg");
- strcpy(seqfil, "dog.seq");
- strcpy(mclfil, "dog.mcl");
- strcpy(tmpstr, "Dog");
- AnimalNum = 4;
- break;
- default: /* shouldn't */
- strcpy(stgfil, "sdrat.stg");
- strcpy(seqfil, "sdrat.seq");
- strcpy(mclfil, "sdrat.mcl");
- strcpy(tmpstr, "Sprague-Dawley Rat");
- AnimalNum = 0;
- } /* switch */
-
- #if (PC && (DEBUG > 4))
- clrscr1(1);
- gotoxy(1, 5);
- cprintf("%sanimal: getting stgfil & stgfil data", tab);
- hitreturn(1);
- #endif
- val1 = getipfile(stgfil, pfpstg, 'F', 'C');
- getstgdat(stgfil, *pfpstg);
- fclose(*pfpstg);
- #if (PC && (DEBUG > 4))
- clrscr1(1);
- gotoxy(1, 5);
- cprintf("%sanimal: got stage data", tab);
- gotoxy(1, 7);
- cprintf("%s getting seqfil & seqfil data", tab);
- hitreturn(1);
- #endif
- val2 = getipfile(seqfil, pfpseq, 'F', 'S');
- getseqdat(seqfil, *pfpseq);
- fclose(*pfpseq);
- #if (PC && (DEBUG > 4))
- clrscr1(1);
- gotoxy(1, 5);
- cprintf("%sanimal: got cell seq data", tab);
- gotoxy(1, 7);
- cprintf("%s getting mclfil & mclfil data", tab);
- hitreturn(1);
- #endif
- val3 = getipfile(mclfil, pfpmcl, 'F', 'S');
- getmcldat(mclfil, *pfpmcl);
- fclose(*pfpmcl);
- #if (PC && (DEBUG > 4))
- clrscr1(1);
- gotoxy(1, 5);
- cprintf("%sgot sdrat stg/seq/mcl data", tab);
- gotoxy (1, 7);
- cprintf("%sval1=%d val2=%d val3=%d", tab, val1, val2, val3);
- hitreturn(1);
- #endif
-
- if (val1 || val2 || val3) {
- return(101); /* back to general menu */
- } else {
- #if (DEBUG > 4)
- #if PC
- clrscr1(1);
- gotoxy(1, 5);
- cprintf("%sgetanimal: free(Animal)", tab);
- gotoxy(1, 7);
- cprintf("%s Animal = <%s>", tab, Animal);
- hitreturn(1);
- #else
- printf("\tgetanimal: free(Animal)\n");
- #endif
- #endif
- free1(Animal);
- Animal = strdup(tmpstr); /* does AUTOmagic malloc */
- if (Animal==NULL) {
- #if PC
- clrscr1(1);
- gotoxy(1, 5);
- cprintf("%sgetanimal: strdup returns NULL on Animal", tab);
- #else
- printf("\tgetanimal: strdup returns NULL on Animal\n");
- #endif
- printexit(401);
- } /* if */
- strcpy(Animal, tmpstr);
- #if (DEBUG > 4)
- #if PC
- clrscr1(1);
- gotoxy(1, 5);
- cprintf("%sgetanimal: Animal=<%s>", tab, Animal);
- hitreturn(1);
- #else
- printf("\tgetanimal: Animal=<%s>\n", Animal);
- #endif
- #endif
- return(0);
- } /* else */
- } /* getanimal */