29 #define TOKENSIZE 80 //< max size of tokens read from an input file 30 #define MAXSAMPLESIZE 65535 //< max num of dimensions in feature space 47 if ((
tfscanf(File,
"%d", &SampleSize) != 1) ||
73 for (i = 0; i < N; i++) {
74 if (
tfscanf(File,
"%s", Token) != 1)
76 "Illegal circular/linear specification");
82 if (
tfscanf(File,
"%s", Token) != 1)
84 "Illegal essential/non-essential spec");
89 if (
tfscanf(File,
"%f%f", &(ParamDesc[i].Min), &(ParamDesc[i].Max)) != 2)
91 ParamDesc[i].
Range = ParamDesc[i].
Max - ParamDesc[i].
Min;
121 if ((Status =
tfscanf(File,
"%s", Token)) == 1) {
131 if ((
tfscanf(File,
"%d", &SampleCount) != 1) || (SampleCount < 0))
136 if (Proto->
Mean == NULL)
139 switch (Proto->
Style) {
160 for (i = 0; i < N; i++) {
174 for (i = 0; i < N; i++) {
175 if (
tfscanf(File,
"%s", Token) != 1)
177 "Illegal prototype distribution");
190 "Illegal prototype distribution");
201 for (i = 0; i < N; i++) {
225 else if (Status == EOF)
246 if (
tfscanf(File,
"%s", Token) != 1)
283 bool needs_free =
false;
287 if (Buffer == NULL) {
292 for (i = 0; i < N; i++) {
293 NumFloatsRead =
tfscanf(File,
"%f", &(Buffer[i]));
294 if (NumFloatsRead != 1) {
295 if ((NumFloatsRead == EOF) && (i == 0)) {
322 for (i = 0; i < N; i++) {
323 if (ParamDesc[i].Circular)
324 fprintf (File,
"circular ");
326 fprintf (File,
"linear ");
328 if (ParamDesc[i].NonEssential)
329 fprintf (File,
"non-essential ");
331 fprintf (File,
"essential ");
333 fprintf (File,
"%10.6f %10.6f\n", ParamDesc[i].Min, ParamDesc[i].Max);
352 fprintf (File,
"significant ");
354 fprintf (File,
"insignificant ");
358 fprintf (File,
"\t");
360 switch (Proto->
Style) {
368 for (i = 0; i < N; i++)
371 fprintf (File,
" %9s",
"normal");
374 fprintf (File,
" %9s",
"uniform");
377 fprintf (File,
" %9s",
"random");
382 fprintf (File,
"\n\t");
399 for (
int i = 0; i < N; i++)
400 fprintf(File,
" %9.6f", Array[i]);
416 switch (ProtoStyle) {
418 fprintf (File,
"spherical");
421 fprintf (File,
"elliptical");
424 fprintf (File,
"mixed");
427 fprintf (File,
"automatic");
451 BOOL8 WriteInsigProtos) {
455 fprintf(File,
"%0d\n",N);
#define ILLEGALCIRCULARSPEC
#define ILLEGALDISTRIBUTION
PROTOTYPE * ReadPrototype(FILE *File, uinT16 N)
#define ILLEGALMINMAXSPEC
#define ILLEGALSAMPLESIZE
int tfscanf(FILE *stream, const char *format,...)
#define ILLEGALESSENTIALSPEC
#define ILLEGALSIGNIFICANCESPEC
void WriteNFloats(FILE *File, uinT16 N, FLOAT32 Array[])
void DoError(int Error, const char *Message)
void WriteProtoList(FILE *File, uinT16 N, PARAM_DESC ParamDesc[], LIST ProtoList, BOOL8 WriteSigProtos, BOOL8 WriteInsigProtos)
PARAM_DESC * ReadParamDesc(FILE *File, uinT16 N)
uinT16 ReadSampleSize(FILE *File)
FLOAT32 * ReadNFloats(FILE *File, uinT16 N, FLOAT32 Buffer[])
void WriteProtoStyle(FILE *File, PROTOSTYLE ProtoStyle)
#define ILLEGALSAMPLECOUNT
#define ILLEGALVARIANCESPEC
PROTOSTYLE ReadProtoStyle(FILE *File)
void WriteParamDesc(FILE *File, uinT16 N, const PARAM_DESC ParamDesc[])
void WritePrototype(FILE *File, uinT16 N, PROTOTYPE *Proto)