64 char a_name[200], *temp;
65 int32 a_n_type, a_count;
67 void chk_str(attr_str,
char *, int32);
69 if ((attr_index = SDfindattr(fid, attr.access_nm))
71 printf(
"**** object: '%s', Error trying to get attribute '%s'\n",
72 attr.obj_nm, attr.access_nm);
79 if (SDattrinfo(fid, attr_index, a_name, &a_n_type, &a_count)
81 printf(
"**** Error in SDattrinfo for object: '%s', attribute: '%s'\n",
82 attr.obj_nm, attr.access_nm);
95 if (strcmp(a_name, attr.int_nm) != 0) {
97 "**** object: '%s', attribute: '%s', difference in attribute name found\n",
98 attr.obj_nm, attr.access_nm);
99 printf(
"expected: '%s', read: '%s'\n", attr.int_nm, a_name);
103 if (a_n_type != attr.type) {
105 "**** object: '%s', attribute: '%s', difference in number type found\n",
106 attr.obj_nm, attr.access_nm);
107 printf(
"expected: %d, read: %d\n", attr.type, a_n_type);
111 if (attr.count > 0 && a_count != attr.count) {
112 printf(
"**** object: '%s', attribute: '%s', difference in count found\n",
113 attr.obj_nm, attr.access_nm);
114 printf(
"expected: %d, read: %d\n", attr.count, a_count);
118 if (
i != 0)
return -2;
129 if (a_count * DFKNTsize(a_n_type) >=
FMT_8BLEN * 8) {
130 printf(
"**** object: '%s', attribute: '%s' has excessive count of \n",
131 attr.obj_nm, attr.access_nm);
132 printf(
"%d items. Truncated list of bytes will be used\n",
138 temp = (
char *) malloc(a_count * DFKNTsize(a_n_type));
139 if (SDreadattr(fid, attr_index, temp) == -1) {
140 printf(
"**** object: '%s', attribute: '%s', Error reading data\n",
141 attr.obj_nm, attr.access_nm);
153 if (SDreadattr(fid, attr_index,
value->chr) == -1) {
154 printf(
"**** object: '%s', attribute: '%s', Error reading data\n",
155 attr.obj_nm, attr.access_nm);
170 for (
i = 0;
i < attr.count;
i++) {
171 if (isnan(
value->f32[
i])) {
173 "**** object: '%s', attribute '%s'[%d]\n",
174 attr.obj_nm, attr.access_nm,
i);
175 printf(
"is not a number (NaN)\n");
181 for (
i = 0;
i < attr.count;
i++) {
182 if (!isfinite(attr.data.f64[
i])) {
184 "**** object: '%s', attribute '%s'[%d]\n",
185 attr.obj_nm, attr.access_nm,
i);
186 printf(
"is not a number (NaN) or not finite\n");
199 if (
value->chr[a_count - 1] != 0)
200 value->chr[a_count] = 0;
201 if (strcmp(
value->chr, attr.data.chr) != 0) {
202 printf(
"**** object: '%s', difference in attribute '%s'\n",
203 attr.obj_nm, attr.access_nm);
204 printf(
"expected value: '%s'\nread value : '%s'\n",
205 attr.data.chr,
value->chr);
210 for (
i = 0;
i < attr.count;
i++) {
211 if ((
value->f32[
i] < attr.data.f32[
i] -
213 (
value->f32[
i] > attr.data.f32[
i] +
216 "**** object: '%s', difference in attribute '%s'[%d]\n",
217 attr.obj_nm, attr.access_nm,
i);
218 printf(
"expected value: %f\nread value: %f\n",
219 attr.data.f32[
i],
value->f32[
i]);
225 for (
i = 0;
i < attr.count;
i++) {
226 if ((
value->f64[
i] < attr.data.f64[
i] -
228 (
value->f64[
i] > attr.data.f64[
i] +
231 "**** object: '%s', difference in attribute '%s'[%d]\n", attr.obj_nm, attr.access_nm,
i);
232 printf(
"expected value: %f\nread value: %f\n",
233 attr.data.f64[
i],
value->f64[
i]);
239 for (
i = 0;
i < attr.count;
i++) {
240 if (
value->i8[
i] != attr.data.i8[
i]) {
242 "**** object: '%s', difference in attribute '%s'[%d]\n", attr.obj_nm, attr.access_nm,
i);
243 printf(
"expected value: %d\nread value: %d\n",
244 attr.data.i8[
i],
value->i8[
i]);
250 for (
i = 0;
i < attr.count;
i++) {
251 if (
value->ui8[
i] != attr.data.ui8[
i]) {
253 "**** object: '%s', difference in attribute '%s'[%d]\n", attr.obj_nm, attr.access_nm,
i);
254 printf(
"expected value: %d\nread value: %d\n",
255 attr.data.ui8[
i],
value->ui8[
i]);
261 for (
i = 0;
i < attr.count;
i++) {
262 if (
value->i16[
i] != attr.data.i16[
i]) {
264 "**** object: '%s', difference in attribute '%s'[%d]\n",
265 attr.obj_nm, attr.access_nm,
i);
266 printf(
"expected value: %d\nread value: %d\n",
267 attr.data.i16[
i],
value->i16[
i]);
273 for (
i = 0;
i < attr.count;
i++) {
274 if (
value->i32[
i] != attr.data.i32[
i]) {
276 "**** object: '%s', difference in attribute '%s'[%d]\n",
277 attr.obj_nm, attr.access_nm,
i);
278 printf(
"expected value: %d\nread value: %d\n",
279 attr.data.i32[
i],
value->i32[
i]);
285 printf(
"************* DEFAULT CASE OF VALUE CHECKING\n");
286 printf(
"Program error\n");
293 if (
value->chr[a_count - 1] != 0)
294 value->chr[a_count] = 0;
295 if (strcmp(
value->chr, attr.data.chr) != 0) {
296 printf(
"**** object: '%s', difference in attribute '%s'\n",
297 attr.obj_nm, attr.access_nm);
298 printf(
"expected value: '%s'\nread value : '%s'\n",
299 attr.data.chr,
value->chr);
304 for (
i = 0;
i < attr.count;
i++) {
305 if (
value->f32[
i] < attr.data.f32[0] ||
306 value->f32[
i] > attr.data.f32[1]) {
308 "**** object: '%s', outside range in attribute '%s'[%d]\n",
309 attr.obj_nm, attr.access_nm,
i);
310 printf(
"valid range: %f - %f\nread value: %f\n",
311 attr.data.f32[0], attr.data.f32[1],
value->f32[
i]);
317 for (
i = 0;
i < attr.count;
i++) {
318 if (
value->f64[
i] < attr.data.f64[0] ||
319 value->f64[
i] > attr.data.f64[1]) {
321 "**** object: '%s', outside range in attribute '%s'[%d]\n", attr.obj_nm, attr.access_nm,
i);
322 printf(
"valid range: %f - %f\nread value: %f\n",
323 attr.data.f64[0], attr.data.f64[1],
value->f64[
i]);
329 for (
i = 0;
i < attr.count;
i++) {
330 if (
value->i8[
i] < attr.data.i8[0] ||
331 value->i8[
i] > attr.data.i8[1]) {
333 "**** object: '%s', outside range in attribute '%s'[%d]\n", attr.obj_nm, attr.access_nm,
i);
334 printf(
"valid range: %d - %d\nread value: %d\n",
335 attr.data.i8[0], attr.data.i8[1],
value->i8[
i]);
341 for (
i = 0;
i < attr.count;
i++) {
342 if (
value->ui8[
i] < attr.data.ui8[0] ||
343 value->ui8[
i] > attr.data.ui8[1]) {
345 "**** object: '%s', outside range in attribute '%s'[%d]\n", attr.obj_nm, attr.access_nm,
i);
346 printf(
"valid range: %d - %d\nread value: %d\n",
347 attr.data.ui8[0], attr.data.ui8[1],
value->ui8[
i]);
353 for (
i = 0;
i < attr.count;
i++) {
354 if (
value->i16[
i] < attr.data.i16[0] ||
355 value->i16[
i] > attr.data.i16[1]) {
357 "**** object: '%s', outside range in attribute '%s'[%d]\n",
358 attr.obj_nm, attr.access_nm,
i);
359 printf(
"valid range: %d - %d\nread value: %d\n",
360 attr.data.i16[0], attr.data.i16[1],
value->i16[
i]);
366 for (
i = 0;
i < attr.count;
i++) {
367 if (
value->i32[
i] < attr.data.i32[0] ||
368 value->i32[
i] > attr.data.i32[1]) {
370 "**** object: '%s', outside range in attribute '%s'[%d]\n",
371 attr.obj_nm, attr.access_nm,
i);
372 printf(
"valid range: %d - %d\nread value: %d\n",
373 attr.data.i32[0], attr.data.i32[1],
value->i32[
i]);
379 printf(
"************* DEFAULT CASE OF VALUE CHECKING\n");
380 printf(
"Program error\n");