* This routine reads textual descriptions of sets of parameters * which describe the characteristics of feature dimensions. * * Exceptions: * - ILLEGALCIRCULARSPEC * - ILLEGALESSENTIALSPEC * - ILLEGALMINMAXSPEC * @param File open text file to read N parameter descriptions from * @param N number of parameter descriptions to read * @return Pointer to an array of parameter descriptors. * @n
| 65 | * @note History: 6/6/89, DSJ, Created. |
| 66 | */ |
| 67 | PARAM_DESC *ReadParamDesc(FILE *File, uinT16 N) { |
| 68 | int i; |
| 69 | PARAM_DESC *ParamDesc; |
| 70 | char Token[TOKENSIZE]; |
| 71 | |
| 72 | ParamDesc = (PARAM_DESC *) Emalloc (N * sizeof (PARAM_DESC)); |
| 73 | for (i = 0; i < N; i++) { |
| 74 | if (tfscanf(File, "%s", Token) != 1) |
| 75 | DoError (ILLEGALCIRCULARSPEC, |
| 76 | "Illegal circular/linear specification"); |
| 77 | if (Token[0] == 'c') |
| 78 | ParamDesc[i].Circular = TRUE; |
| 79 | else |
| 80 | ParamDesc[i].Circular = FALSE; |
| 81 | |
| 82 | if (tfscanf(File, "%s", Token) != 1) |
| 83 | DoError (ILLEGALESSENTIALSPEC, |
| 84 | "Illegal essential/non-essential spec"); |
| 85 | if (Token[0] == 'e') |
| 86 | ParamDesc[i].NonEssential = FALSE; |
| 87 | else |
| 88 | ParamDesc[i].NonEssential = TRUE; |
| 89 | if (tfscanf(File, "%f%f", &(ParamDesc[i].Min), &(ParamDesc[i].Max)) != 2) |
| 90 | DoError (ILLEGALMINMAXSPEC, "Illegal min or max specification"); |
| 91 | ParamDesc[i].Range = ParamDesc[i].Max - ParamDesc[i].Min; |
| 92 | ParamDesc[i].HalfRange = ParamDesc[i].Range / 2; |
| 93 | ParamDesc[i].MidRange = (ParamDesc[i].Max + ParamDesc[i].Min) / 2; |
| 94 | } |
| 95 | return (ParamDesc); |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * This routine reads a textual description of a prototype from |
no test coverage detected