Return whether all of the fields of the given feature set are well defined (not inf or nan).
| 217 | // Return whether all of the fields of the given feature set |
| 218 | // are well defined (not inf or nan). |
| 219 | bool ValidCharDescription(const FEATURE_DEFS_STRUCT &FeatureDefs, |
| 220 | CHAR_DESC CharDesc) { |
| 221 | bool anything_written = false; |
| 222 | bool well_formed = true; |
| 223 | for (int Type = 0; Type < CharDesc->NumFeatureSets; Type++) { |
| 224 | if (CharDesc->FeatureSets[Type]) { |
| 225 | for (int i = 0; i < CharDesc->FeatureSets[Type]->NumFeatures; i++) { |
| 226 | FEATURE feat = CharDesc->FeatureSets[Type]->Features[i]; |
| 227 | for (int p = 0; p < feat->Type->NumParams; p++) { |
| 228 | if (isnan(feat->Params[p]) || isinf(feat->Params[p])) |
| 229 | well_formed = false; |
| 230 | else |
| 231 | anything_written = true; |
| 232 | } |
| 233 | } |
| 234 | } else { |
| 235 | return false; |
| 236 | } |
| 237 | } |
| 238 | return anything_written && well_formed; |
| 239 | } /* ValidCharDescription */ |
| 240 | |
| 241 | /*---------------------------------------------------------------------------*/ |
| 242 | /** |