Please, help us to better serve our user community by answering the following short survey: https://www.hdfgroup.org/website-survey/
HDF  4.3.0
API Reference
 
Loading...
Searching...
No Matches
tutils.h File Reference
#include <float.h>
#include <math.h>
#include "hdf_priv.h"

Macros

#define CHECK(ret, val, where)
 
#define CHECK_VOID(ret, val, where)
 
#define CHECK_CONT(ret, val, where)
 
#define CHECK_STATUS(status, val, msg)
 
#define CHECK_ALLOC(buffer, buf_name, func_name)
 
#define VERIFY(x, val, where)
 
#define VERIFY_VOID(x, val, where)
 
#define VERIFY_CONT(x, val, where)
 
#define VERIFY_CHAR(x, val, where)
 
#define VERIFY_CHAR_VOID(x, val, where)
 
#define RESULT(a)
 
#define MESSAGE(v, a)
 
#define VERBOSITY_STR   "Verbosity"
 
#define SKIP_STR   "Skip"
 
#define TEST_STR   "Test"
 
#define CLEAN_STR   "Cleanup"
 
#define H4_PASSED()
 
#define H4_FAILED()
 
#define H4_WARNING()
 
#define H4_SKIPPED()
 
#define H4_FLT_ABS_EQUAL(X, Y)   (fabsf((X) - (Y)) < FLT_EPSILON)
 
#define H4_DBL_ABS_EQUAL(X, Y)   (fabs((X) - (Y)) < DBL_EPSILON)
 
#define H4_LDBL_ABS_EQUAL(X, Y)   (fabsl((X) - (Y)) < LDBL_EPSILON)
 
#define JPEG_FUZZ   1
 
#define ABS(x)   ((int)(x) < 0 ? (-x) : x)
 
#define CLEAN_CMD   "rm -f *.hdf"
 

Functions

const char * get_srcdir (void)
 
const char * get_srcdir_filename (const char *filename)
 
intn fuzzy_memcmp (const void *s1, const void *s2, int32 len, intn fuzz_factor)
 
void print_mismatched (const void *s1, const void *s2, int32 size2cmp)
 

Variables

int num_errs
 
int Verbosity
 

Macro Definition Documentation

◆ ABS

#define ABS ( x)    ((int)(x) < 0 ? (-x) : x)

◆ CHECK

#define CHECK ( ret,
val,
where )
Value:
do { \
if (Verbosity > 9) \
printf(" Call to HDF routine: %15s at line %4d in %s returned %ld \n", where, (int)__LINE__, \
__FILE__, (long)ret); \
if (ret == val) { \
printf("*** UNEXPECTED RETURN from %s is %ld at line %4d in %s\n", where, (long)ret, \
(int)__LINE__, __FILE__); \
num_errs++; \
return num_errs; \
} \
} while (0)
HDFFCLIBAPI intf _fcd val
Definition mfsdf.h:142
int Verbosity
Definition tutils.h:35
int num_errs

◆ CHECK_ALLOC

#define CHECK_ALLOC ( buffer,
buf_name,
func_name )
Value:
{ \
if (buffer == NULL) { \
fprintf(stderr, "in %s: space allocation for %s failed. Terminated!\n", func_name, buf_name); \
exit(1); \
} \
}
intf intf intf intf intf void * buffer
Definition hproto_fortran.h:314

◆ CHECK_CONT

#define CHECK_CONT ( ret,
val,
where )
Value:
do { \
if (Verbosity > 9) \
printf(" Call to HDF routine: %15s at line %4d in %s returned %ld \n", where, (int)__LINE__, \
__FILE__, (long)ret); \
if (ret == val) { \
printf("*** UNEXPECTED RETURN from %s is %ld at line %4d in %s\n", where, (long)ret, \
(int)__LINE__, __FILE__); \
num_errs++; \
} \
} while (0)

◆ CHECK_STATUS

#define CHECK_STATUS ( status,
val,
msg )
Value:
do { \
if (status == val) \
printf(" %s failed at line %4d in %s\n", msg, (int)__LINE__, __FILE__); \
} while (0)

◆ CHECK_VOID

#define CHECK_VOID ( ret,
val,
where )
Value:
do { \
if (Verbosity > 9) \
printf(" Call to HDF routine: %15s at line %4d in %s returned %ld \n", where, (int)__LINE__, \
__FILE__, (long)ret); \
if (ret == val) { \
printf("*** UNEXPECTED RETURN from %s is %ld at line %4d in %s\n", where, (long)ret, \
(int)__LINE__, __FILE__); \
num_errs++; \
return; \
} \
} while (0)

◆ CLEAN_CMD

#define CLEAN_CMD   "rm -f *.hdf"

◆ CLEAN_STR

#define CLEAN_STR   "Cleanup"

◆ H4_DBL_ABS_EQUAL

#define H4_DBL_ABS_EQUAL ( X,
Y )   (fabs((X) - (Y)) < DBL_EPSILON)

◆ H4_FAILED

#define H4_FAILED ( )
Value:
{ \
puts("*FAILED*"); \
fflush(stdout); \
}

◆ H4_FLT_ABS_EQUAL

#define H4_FLT_ABS_EQUAL ( X,
Y )   (fabsf((X) - (Y)) < FLT_EPSILON)

◆ H4_LDBL_ABS_EQUAL

#define H4_LDBL_ABS_EQUAL ( X,
Y )   (fabsl((X) - (Y)) < LDBL_EPSILON)

◆ H4_PASSED

#define H4_PASSED ( )
Value:
{ \
puts(" PASSED"); \
fflush(stdout); \
}

◆ H4_SKIPPED

#define H4_SKIPPED ( )
Value:
{ \
puts(" -SKIP-"); \
fflush(stdout); \
}

◆ H4_WARNING

#define H4_WARNING ( )
Value:
{ \
puts("*WARNING*"); \
fflush(stdout); \
}

◆ JPEG_FUZZ

#define JPEG_FUZZ   1

◆ MESSAGE

#define MESSAGE ( v,
a )
Value:
{ \
if (Verbosity >= v) { \
a \
} \
}

◆ RESULT

#define RESULT ( a)
Value:
do { \
if (Verbosity > 8) \
printf(" Call to HDF routine: %15s at line %4d in %s returned %ld \n", a, (int)__LINE__, \
__FILE__, (long)ret); \
if (Verbosity > 9) \
HEprint(stdout, 0); \
if (ret == FAIL) { \
printf("*** UNEXPECTED RETURN from %s is %ld at line %4d in %s\n", a, (long)ret, (int)__LINE__, \
__FILE__); \
num_errs++; \
} \
} while (0)
#define FAIL
Definition hdf.h:135

◆ SKIP_STR

#define SKIP_STR   "Skip"

◆ TEST_STR

#define TEST_STR   "Test"

◆ VERBOSITY_STR

#define VERBOSITY_STR   "Verbosity"

◆ VERIFY

#define VERIFY ( x,
val,
where )
Value:
do { \
if (Verbosity > 9) \
printf(" Call to HDF routine: %15s at line %4d in %s had value %ld \n", where, (int)__LINE__, \
__FILE__, (long)x); \
if (x != val) { \
printf("*** UNEXPECTED VALUE from %s is %ld at line %4d in %s\n", where, (long)x, (int)__LINE__, \
__FILE__); \
num_errs++; \
return (num_errs); \
} \
} while (0)

◆ VERIFY_CHAR

#define VERIFY_CHAR ( x,
val,
where )
Value:
do { \
if (Verbosity > 9) \
printf(" Call to HDF routine: %15s at line %4d in %s had value %s \n", where, (int)__LINE__, \
__FILE__, x); \
if (strcmp(x, val) != 0) { \
printf("*** UNEXPECTED VALUE from %s is %s at line %4d in %s\n", where, x, (int)__LINE__, \
__FILE__); \
num_errs++; \
return (num_errs); \
} \
} while (0)

◆ VERIFY_CHAR_VOID

#define VERIFY_CHAR_VOID ( x,
val,
where )
Value:
do { \
if (Verbosity > 9) \
printf(" Call to HDF routine: %15s at line %4d in %s had value %s \n", where, (int)__LINE__, \
__FILE__, x); \
if (strncmp(x, val, strlen(val)) != 0) { \
printf("*** UNEXPECTED VALUE from %s is %s at line %4d in %s\n", where, x, (int)__LINE__, \
__FILE__); \
num_errs++; \
return; \
} \
} while (0)

◆ VERIFY_CONT

#define VERIFY_CONT ( x,
val,
where )
Value:
do { \
if (Verbosity > 9) \
printf(" Call to HDF routine: %15s at line %4d in %s had value %ld \n", where, (int)__LINE__, \
__FILE__, (long)x); \
if (x != val) { \
printf("*** UNEXPECTED VALUE from %s is %ld at line %4d in %s\n", where, (long)x, (int)__LINE__, \
__FILE__); \
num_errs++; \
} \
} while (0)

◆ VERIFY_VOID

#define VERIFY_VOID ( x,
val,
where )
Value:
do { \
if (Verbosity > 9) \
printf(" Call to HDF routine: %15s at line %4d in %s had value %ld \n", where, (int)__LINE__, \
__FILE__, (long)x); \
if (x != val) { \
printf("*** UNEXPECTED VALUE from %s is %ld at line %4d in %s\n", where, (long)x, (int)__LINE__, \
__FILE__); \
num_errs++; \
return; \
} \
} while (0)

Function Documentation

◆ fuzzy_memcmp()

intn fuzzy_memcmp ( const void * s1,
const void * s2,
int32 len,
intn fuzz_factor )

◆ get_srcdir()

const char * get_srcdir ( void )

◆ get_srcdir_filename()

const char * get_srcdir_filename ( const char * filename)

◆ print_mismatched()

void print_mismatched ( const void * s1,
const void * s2,
int32 size2cmp )

Variable Documentation

◆ num_errs

int num_errs
extern

◆ Verbosity

int Verbosity