/* * Redefine all the standard, such as POSIX, functions. */ /* Put all platform-specific definitions in the following file */ /* so that the following definitions are platform free. */ /* Activate this if the tool is ported to Windows. */ /* #include "H5win32defs.h" */ /* For Windows-specific definitions */ #ifndef HDfprintf #define HDfprintf fprintf #endif /* HDfprintf */ #ifndef HDcalloc #define HDcalloc(n, s) calloc(n, s) #endif /* HDcalloc */ #ifndef HDmalloc #define HDmalloc(s) malloc(s) #endif /* HDmalloc */ #ifndef HDfree #define HDfree(s) free(s) #endif /* HDfree */ #ifndef HDisdigit #define HDisdigit(s) isdigit(s) #endif /* HDisdigit */ #ifndef HDstrchr #define HDstrchr(S,C) strchr(S,C) #endif /* HDstrchr */ #ifndef HDstrrchr #define HDstrrchr(S,C) strrchr(S,C) #endif /* HDstrrchr */ #ifndef HDstrdup #define HDstrdup(s) strdup(s) #endif /* HDstrdup */ #ifndef HDmemcpy #define HDmemcpy(d,s,n) memcpy(d,s,n) #endif /* HDmemcpy */ #ifndef HDstrcpy #define HDstrcpy(d,s) strcpy(d,s) #endif /* HDstrcpy */ #ifndef HDstrncpy #define HDstrncpy(d,s,n) strncpy(d,s,n) #endif /* HDstrncpy */ #ifndef HDstrlen #define HDstrlen(s) strlen(s) #endif /* HDstrlen */ #ifndef HDstrcmp #define HDstrcmp(s1,s2) strcmp(s1,s2) #endif /* HDstrcmp */ /* Just use stat since only want to know it is a file or directory. */ #ifndef HDstat #define HDstat(S,B) stat(S,B) typedef struct stat stat_t; typedef off_t stat_size_t; #endif /* HDstat */ #ifndef HDqsort #define HDqsort(b,n,s,com) qsort(b,n,s,com) #endif /* HDqsort */ #ifndef HDtime #define HDtime(t) time(t) #endif /* HDtime */ #ifndef HDgmtime #define HDgmtime(tp) gmtime(tp) #endif /* HDgmtime */ #ifndef HDgmtime_r #define HDgmtime_r(tp, tmp) gmtime_r(tp, tmp) #endif /* HDgmtime_r */ #ifndef HDgettimeofday #define HDgettimeofday(tv, tz) gettimeofday(tv, tz) #endif /* HDgettimeofday */ /* macros as shorthands */ /* print error message with message arg */ #ifndef NAGG_ERROR #define NAGG_ERROR(arg) fprintf(stderr, "%s: ***ERROR*** %s", progname_g, arg) #endif /* print error message with message arg using fmt as extra format*/ #ifndef NAGG_ERROR1 #define NAGG_ERROR1(fmt, arg) fprintf(stderr, "%s: ***ERROR*** " fmt, progname_g, arg) #endif /* s is a *char. If s==NULL, then provide "(null)", else s itself. */ /* Useful for printing *s value in case s could be NULL */ #ifndef stringval #define stringval(s) (s ? s : "(null)") #endif /* The strings are equal */ #ifndef HDstreq #define HDstreq(s1,s2) !HDstrcmp(s1,s2) #endif /* HDstreq */ /* The strings are not equal */ #ifndef HDstrneq #define HDstrneq(s1,s2) HDstrcmp(s1,s2) #endif /* HDstrneq */ /* The set memory to a value */ #ifndef HDmemset #define HDmemset(s,c,n) memset(s,c,n) #endif /* HDmemset */ /* The zero memory */ #ifndef HDmemzero #define HDmemzero(s,n) memset(s,0,n) #endif /* HDmemzero */