diff options
Diffstat (limited to 'tools/test/h5jam')
-rw-r--r-- | tools/test/h5jam/getub.c | 16 | ||||
-rw-r--r-- | tools/test/h5jam/h5jamgentest.c | 75 | ||||
-rw-r--r-- | tools/test/h5jam/tellub.c | 12 |
3 files changed, 89 insertions, 14 deletions
diff --git a/tools/test/h5jam/getub.c b/tools/test/h5jam/getub.c index eae7f15..a9b4437 100644 --- a/tools/test/h5jam/getub.c +++ b/tools/test/h5jam/getub.c @@ -21,9 +21,9 @@ void parse_command_line(int argc, const char *argv[]); #define PROGRAM_NAME "getub" char *nbytes = NULL; -static const char * s_opts = "c:"; /* add more later ? */ -static struct h5_long_options l_opts[] = {{"c", require_arg, 'c'}, /* input file */ - {NULL, 0, '\0'}}; +static const char * s_opts = "c:"; /* add more later ? */ +static struct long_options l_opts[] = {{"c", require_arg, 'c'}, /* input file */ + {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: usage @@ -57,10 +57,10 @@ parse_command_line(int argc, const char *argv[]) int opt; /* parse command line options */ - while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case 'c': - nbytes = HDstrdup(H5_optarg); + nbytes = HDstrdup(opt_arg); break; case '?': default: @@ -69,7 +69,7 @@ parse_command_line(int argc, const char *argv[]) } /* end switch */ } /* end while */ - if (argc <= H5_optind) { + if (argc <= opt_ind) { error_msg("missing file name\n"); usage(h5tools_getprogname()); HDexit(EXIT_FAILURE); @@ -100,13 +100,13 @@ main(int argc, const char *argv[]) goto error; } /* end if */ - if (argc <= (H5_optind)) { + if (argc <= (opt_ind)) { error_msg("missing file name\n"); usage(h5tools_getprogname()); goto error; } /* end if */ - filename = HDstrdup(argv[H5_optind]); + filename = HDstrdup(argv[opt_ind]); size = 0; if (EOF == (res = sscanf(nbytes, "%u", &size))) { diff --git a/tools/test/h5jam/h5jamgentest.c b/tools/test/h5jam/h5jamgentest.c index f616c82..1da6b63 100644 --- a/tools/test/h5jam/h5jamgentest.c +++ b/tools/test/h5jam/h5jamgentest.c @@ -31,7 +31,24 @@ #define UBTXT3 "u511.txt" #define UBTXT4 "u512.txt" #define UBTXT5 "u513.txt" +/* not used yet +#define UBTXT6 "u1023.txt" +#define UBTXT7 "u1024.txt" +#define UBTXT8 "u1025.txt" +#define UBTXT9 "u2047.txt" +#define UBTXT10 "u2048.txt" +#define UBTXT11 "u2049.txt" +#define UBBIN1 "u0.dat" +#define UBBIN2 "u10.dat" +#define UBBIN3 "u511.dat" +#define UBBIN4 "u512.dat" +#define UBBIN5 "u513.dat" +*/ +/* not used yet +#define FILE1 "tnull.h5" +#define FILE2 "tnullwithub.h5" +*/ /* tall is same as dumper test */ #define FILE7 "tall.h5" #define FILE8 "twithub.h5" @@ -49,6 +66,17 @@ char pattern[11] = "abcdefghij"; #define BUF_SIZE 1024 +/* Element selection information */ + +typedef enum { RED, GREEN, BLUE, WHITE, BLACK } enumtype; + +/* Compound datatype */ +typedef struct s1_t { + unsigned int a; + unsigned int b; + float c; +} s1_t; + /* A UD link traversal function. Shouldn't actually be called. */ static hid_t UD_traverse(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED cur_group, @@ -280,18 +308,65 @@ create_textfile(const char *name, size_t size) HDclose(fd); } +#ifdef notdef +/* not used yet */ +void +create_binfile(char *name, off_t size) +{ + char *buf; + int fd; + int i; + char *bp; + + fd = creat(name, 0777); + HDassert(fd >= 0); + + buf = HDcalloc(size, 1); + HDassert(buf); + + /* fill buf with pattern */ + bp = buf; + for (i = 0; i < size; i++) + *bp++ = (char)i & 0xff; + + (void)HDwrite(fd, buf, size); + + HDclose(fd); +} +#endif + /*------------------------------------------------------------------------- * Function: main * *------------------------------------------------------------------------- */ + int main(void) { + + /* + create_textfile(UBTXT1, (size_t)0); + */ create_textfile(UBTXT2, (size_t)10); create_textfile(UBTXT3, (size_t)511); create_textfile(UBTXT4, (size_t)512); create_textfile(UBTXT5, (size_t)513); + /* + create_textfile(UBTXT6, (size_t)1023); + create_textfile(UBTXT7, (size_t)1024); + create_textfile(UBTXT8, (size_t)1025); + create_textfile(UBTXT9, (size_t)2047); + create_textfile(UBTXT10, (size_t)2048); + create_textfile(UBTXT11, (size_t)2049); + + create_binfile(UBBIN1, (off_t)0); + create_binfile(UBBIN2, (off_t)10); + create_binfile(UBBIN3, (off_t)511); + create_binfile(UBBIN4, (off_t)512); + create_binfile(UBBIN5, (off_t)513); + + */ gent_ub(FILE7, (size_t)0, (size_t)0); gent_ub(FILE8, (size_t)512, HDstrlen(pattern)); gent_ub(FILE9, (size_t)1024, (size_t)513); diff --git a/tools/test/h5jam/tellub.c b/tools/test/h5jam/tellub.c index e6769ec..45d4af4 100644 --- a/tools/test/h5jam/tellub.c +++ b/tools/test/h5jam/tellub.c @@ -24,8 +24,8 @@ * parameters. The long-named ones can be partially spelled. When * adding more, make sure that they don't clash with each other. */ -static const char * s_opts = "h"; -static struct h5_long_options l_opts[] = {{"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, {NULL, 0, '\0'}}; +static const char * s_opts = "h"; +static struct long_options l_opts[] = {{"help", no_arg, 'h'}, {"hel", no_arg, 'h'}, {NULL, 0, '\0'}}; /*------------------------------------------------------------------------- * Function: usage @@ -61,7 +61,7 @@ parse_command_line(int argc, const char *argv[]) int opt; /* parse command line options */ - while ((opt = H5_get_option(argc, argv, s_opts, l_opts)) != EOF) { + while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) { switch ((char)opt) { case 'h': usage(h5tools_getprogname()); @@ -75,7 +75,7 @@ parse_command_line(int argc, const char *argv[]) } /* check for file name to be processed */ - if (argc <= H5_optind) { + if (argc <= opt_ind) { error_msg("missing file name\n"); usage(h5tools_getprogname()); h5tools_setstatus(EXIT_FAILURE); @@ -118,14 +118,14 @@ main(int argc, const char *argv[]) /* enable error reporting if command line option */ h5tools_error_report(); - if (argc <= (H5_optind)) { + if (argc <= (opt_ind)) { error_msg("missing file name\n"); usage(h5tools_getprogname()); h5tools_setstatus(EXIT_FAILURE); goto done; } - ifname = HDstrdup(argv[H5_optind]); + ifname = HDstrdup(argv[opt_ind]); testval = H5Fis_accessible(ifname, H5P_DEFAULT); |