From 318bb47240bde11f031a2fb5f4d81f5761034f5c Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 7 Feb 2024 22:00:19 -0800 Subject: [PATCH 01/65] Fix warnings in hdf/util/he_ code (#508) * Convert giant static arrays to dynamic * intn --> int * Ensure file descriptors and memory are cleaned up --- hdf/test/rig.c | 3 + hdf/util/he.h | 16 ++-- hdf/util/he_cntrl.c | 58 +++++++------ hdf/util/he_main.c | 192 ++++++++++++++++++++++++++++---------------- 4 files changed, 160 insertions(+), 109 deletions(-) diff --git a/hdf/test/rig.c b/hdf/test/rig.c index baad7a5b0e..649b72b919 100644 --- a/hdf/test/rig.c +++ b/hdf/test/rig.c @@ -829,6 +829,9 @@ read_binary_block(const char *filename, /* file to be read */ /* Read in the specified block of data */ readlen = fread((void *)buffer, 1, nitems, fd); + + fclose(fd); + return readlen; } diff --git a/hdf/util/he.h b/hdf/util/he.h index 32d4af54d7..2ae01c37ae 100644 --- a/hdf/util/he.h +++ b/hdf/util/he.h @@ -156,14 +156,14 @@ typedef struct he_group { tag_ref_ptr ddList; } HE_GROUP; -extern int he_status; -extern int he_numDesc; -extern int he_currDesc; -extern int he_numGrp; -extern int he_remote; -extern char *he_file; -extern DFdesc he_desc[]; -extern HE_GROUP he_grp[]; +extern int he_status; +extern int he_numDesc; +extern int he_currDesc; +extern int he_numGrp; +extern int he_remote; +extern char *he_file; +extern DFdesc *he_desc; +extern HE_GROUP *he_grp; /* * ----------------- Convenient Macros --------------------- diff --git a/hdf/util/he_cntrl.c b/hdf/util/he_cntrl.c index 123ef856ce..5e10f32ae1 100644 --- a/hdf/util/he_cntrl.c +++ b/hdf/util/he_cntrl.c @@ -414,19 +414,19 @@ HEIdump(int32 length, int offset, char *format, int raw_flag) } break; case 'x': { - intn *idata; - intn sizeintn; + int *idata; + size_t sizeint; - sizeintn = sizeof(intn); - idata = (intn *)malloc((size_t)(length / 4 * sizeintn)); + sizeint = sizeof(int); + idata = (int *)malloc((size_t)(length / 4 * sizeint)); DFKconvert((void *)(data + offset), (void *)idata, DFNT_NINT32 | raw_flag, length / 4, DFACC_READ, 0, 0); printf("%8d: ", offset); - for (i = 0; i < length / sizeintn; i++) { + for (i = 0; i < length / sizeint; i++) { printf("%10x ", idata[i]); if (++len > 5) { len = 0; - printf("\n%8d: ", (int)(offset + (i + 1) * sizeintn)); + printf("\n%8d: ", (int)(offset + (i + 1) * sizeint)); } } printf("\n"); @@ -434,19 +434,19 @@ HEIdump(int32 length, int offset, char *format, int raw_flag) } break; case 'o': { - intn *idata; - intn sizeintn; + int *idata; + size_t sizeint; - sizeintn = sizeof(intn); - idata = (intn *)malloc((size_t)(length / 4 * sizeintn)); + sizeint = sizeof(int); + idata = (int *)malloc((size_t)(length / 4 * sizeint)); DFKconvert((void *)(data + offset), (void *)idata, DFNT_NINT32 | raw_flag, length / 4, DFACC_READ, 0, 0); printf("%8d: ", offset); - for (i = 0; i < length / sizeintn; i++) { + for (i = 0; i < length / sizeint; i++) { printf("%10o ", idata[i]); if (++len > 4) { len = 0; - printf("\n%8d: ", (int)(offset + (i + 1) * sizeintn)); + printf("\n%8d: ", (int)(offset + (i + 1) * sizeint)); } } printf("\n"); @@ -579,14 +579,13 @@ info(int all, int longout, int group, int label) int start, end; int d; int *mark; - int i, j; if (!fileOpen()) { noFile(); return HE_OK; } - if (!group || (!isGrp(currTag) && !all)) { + if (!group || ((!isGrp(currTag) && !all))) { if (all) { start = 0; end = he_numDesc - 1; @@ -594,7 +593,12 @@ info(int all, int longout, int group, int label) else start = end = he_currDesc; - for (i = start; i <= end; i++) + /* The gcc optimizer thinks it can optimize away the conditional here, + * which raises a strict-overflow warning. The volatile keyword + * prevents optimization (possibly unrolling the for loop) and + * squashes the warning. + */ + for (volatile int i = start; i <= end; i++) if (he_desc[i].tag == DFTAG_NULL) empty++; else { @@ -623,14 +627,14 @@ info(int all, int longout, int group, int label) } start = end = currGrpNo; } - for (i = start; i <= end; i++) { + for (int i = start; i <= end; i++) { printf("**Group %d:\n", i + 1); /* 1 based */ idx = he_grp[i].desc; infoDesc(idx, longout, label); mark[idx] = YES; - for (j = 0; j < he_grp[i].size; j++) + for (int j = 0; j < he_grp[i].size; j++) if ((d = findDesc(he_grp[i].ddList + j)) >= 0) { mark[d] = 1; infoDesc(d, longout, 0); @@ -641,7 +645,7 @@ info(int all, int longout, int group, int label) } if (all) { puts("\n**These do not belong to any group:"); - for (i = 0; i < he_numDesc; i++) + for (int i = 0; i < he_numDesc; i++) if (!mark[i]) { if (he_desc[i].tag == DFTAG_NULL) empty++; @@ -821,11 +825,10 @@ findFunc(char *fword) { unsigned len; int found = -1; - uintn i; len = strlen((const char *)fword); - for (i = 0; i < sizeof(he_funcTab) / sizeof(he_funcTab[0]); i++) + for (int i = 0; i < sizeof(he_funcTab) / sizeof(he_funcTab[0]); i++) if (!strncmp(he_funcTab[i].str, (const char *)fword, len)) { /* check for exact match */ if (strlen(he_funcTab[i].str) == len) @@ -1132,13 +1135,11 @@ findAlias(char *str) int HEunalias(HE_CMD *cmd) { - int a, i, j; - - for (a = 1; a < cmd->argc; a++) - for (i = 0; i < he_numAlias; i++) + for (int a = 1; a < cmd->argc; a++) + for (int i = 0; i < he_numAlias; i++) if (!strcmp(cmd->argv[a], he_aliasTab[i].str)) { he_numAlias--; - for (j = i; j < he_numAlias; j++) { + for (int j = i; j < he_numAlias; j++) { he_aliasTab[j].str = he_aliasTab[j + 1].str; he_aliasTab[j].cmd = he_aliasTab[j + 1].cmd; } @@ -1150,12 +1151,10 @@ HEunalias(HE_CMD *cmd) void printAlias(char *word, HE_CMD *cmd) { - int j; - printf("%s:", word); for (; cmd; cmd = cmd->next) { printf("\t"); - for (j = 0; j < cmd->argc; j++) + for (int j = 0; j < cmd->argc; j++) printf("%s ", cmd->argv[j]); puts(""); } @@ -1225,13 +1224,12 @@ struct { int findKey(char *word) { - uintn i; unsigned len; int found = -1; len = strlen(word); - for (i = 0; i < sizeof(he_keyTab) / sizeof(he_keyTab[0]); i++) + for (int i = 0; i < sizeof(he_keyTab) / sizeof(he_keyTab[0]); i++) if (!strncmp(he_keyTab[i].str, word, len)) { /* if this is an exact match, just return */ if (strlen(he_keyTab[i].str) == len) diff --git a/hdf/util/he_main.c b/hdf/util/he_main.c index eb5ff27a6e..4bac1e67e3 100644 --- a/hdf/util/he_main.c +++ b/hdf/util/he_main.c @@ -82,14 +82,21 @@ int he_remote = YES; /* is this batch mode or interactive? */ extern int he_batch; +int he_currDesc; +int he_numDesc; +int he_numGrp; +int he_backup; +char *he_file = NULL; +DFdesc *he_desc = NULL; +HE_GROUP *he_grp = NULL; + int main(int argc, char *argv[]) { - int backup = YES; /* Backup files when opening? */ - int i; + int backup = YES; /* Backup files when opening? */ char *fileName = NULL; - for (i = 1; i < argc; i++) { + for (int i = 1; i < argc; i++) { if (argv[i][0] == '-') { switch (findOpt(argv[i] + 1)) { case HE_HELP: @@ -132,6 +139,11 @@ main(int argc, char *argv[]) } } + if (NULL == (he_desc = (DFdesc *)calloc(HE_DESC_SZ, sizeof(DFdesc)))) + goto error; + if (NULL == (he_grp = (HE_GROUP *)calloc(HE_DESC_SZ, sizeof(HE_GROUP)))) + goto error; + /* if there is a file name given in the command line, open it */ if (fileName) @@ -142,8 +154,14 @@ main(int argc, char *argv[]) if (fileOpen()) closeFile(YES); /* close with keep */ - quit(0); - return 0; + quit(EXIT_SUCCESS); + return EXIT_SUCCESS; + +error: + free(he_desc); + free(he_grp); + quit(EXIT_FAILURE); + return EXIT_FAILURE; } /* cmdLoop -- read commands and execute them */ @@ -163,14 +181,6 @@ cmdLoop(void) } } -int he_currDesc; -int he_numDesc; -int he_numGrp; -int he_backup; -char *he_file; -DFdesc he_desc[HE_DESC_SZ]; -HE_GROUP he_grp[HE_DESC_SZ]; - int32 getElement(int desc, char **pdata) { @@ -225,21 +235,26 @@ getTmpName(char **pname) int writeToFile(char *file, char *data, int32 length) { - FILE *fd; + FILE *fd = NULL; int written; fd = fopen(file, "w"); if (fd == NULL) - return FAIL; + goto error; written = (int)fwrite(data, sizeof(char), (size_t)length, fd); if (written != length) { fprintf(stderr, "Error in write.\n"); - return FAIL; + goto error; } fclose(fd); return HE_OK; + +error: + if (fd != NULL) + fclose(fd); + return FAIL; } int @@ -275,18 +290,18 @@ copyFile(char *from, char *to) { int num_read; char buf[HE_BUF_SZ]; /* copying buffer */ - FILE *fp; - FILE *bfp; + FILE *fp = NULL; + FILE *bfp = NULL; /* open the hdf file for backing up */ if ((fp = fopen(from, "r")) == NULL) { fprintf(stderr, "Unable to open file: <%s>\n", from); - return FAIL; + goto error; } if ((bfp = fopen(to, "w")) == NULL) { fclose(fp); fprintf(stderr, "Unable to open backup file.\n"); - return FAIL; + goto error; } /* copy the contents from hdf file to backup file */ while ((num_read = (int)fread(buf, 1, HE_BUF_SZ, fp)) > 0) @@ -296,6 +311,15 @@ copyFile(char *from, char *to) fclose(bfp); return HE_OK; + +error: + + if (fp != NULL) + fclose(fp); + if (bfp != NULL) + fclose(bfp); + + return FAIL; } int @@ -304,7 +328,7 @@ updateDesc(void) int32 fid; int32 groupID; int32 aid, status; - int i, j; + int i; if ((fid = Hopen(he_file, DFACC_READ, 0)) == 0) { printf("failed opening\n"); @@ -347,7 +371,7 @@ updateDesc(void) HEprint(stderr, 0); return FAIL; } - for (j = 0; j < he_grp[he_numGrp].size; j++) + for (int j = 0; j < he_grp[he_numGrp].size; j++) DFdiget(groupID, &he_grp[he_numGrp].ddList[j].tag, &he_grp[he_numGrp].ddList[j].ref); he_numGrp++; @@ -380,7 +404,6 @@ initFile(char *file) int closeFile(int keep) { - int i; char *back; if (!fileOpen()) { @@ -395,7 +418,7 @@ closeFile(int keep) } free(he_file); he_file = NULL; - for (i = 0; i < he_numGrp; i++) + for (int i = 0; i < he_numGrp; i++) free(he_grp[i].ddList); return HE_OK; @@ -404,66 +427,74 @@ closeFile(int keep) int getR8(int xdim, int ydim, char *image, char *pal, int compress) { - FILE *fp; + FILE *fp = NULL; int32 length; - char *buf; + char *buf = NULL; if (!fileOpen()) { noFile(); - return FAIL; + goto error; } if (pal) if (setPal(pal) < 0) /* Error already signalled by setPal */ - return FAIL; + goto error; length = xdim * ydim; buf = (char *)malloc(length); if ((fp = fopen(image, "r")) == NULL) { fprintf(stderr, "Error opening image file: %s.\n", image); - return FAIL; + goto error; } if (fread(buf, (size_t)xdim, (size_t)ydim, fp) < (size_t)ydim) { fprintf(stderr, "Error reading image file: %s.\n", image); - return FAIL; + goto error; } - fclose(fp); if (DFR8addimage(he_file, buf, (int32)xdim, (int32)ydim, (uint16)compress) < 0) { HEprint(stderr, 0); - return FAIL; + goto error; } - free(buf); if (updateDesc() < 0) - return FAIL; + goto error; + + fclose(fp); + free(buf); return HE_OK; + +error: + + if (fp != NULL) + fclose(fp); + free(buf); + + return FAIL; } int setPal(char *pal) { - FILE *fp; + FILE *fp = NULL; char reds[HE_COLOR_SZ], greens[HE_COLOR_SZ], blues[HE_COLOR_SZ]; char palette[HE_PALETTE_SZ]; char *p; - int i; if ((fp = fopen(pal, "r")) == NULL) { fprintf(stderr, "Error opening palette file: %s.\n", pal); - return FAIL; + goto error; } if (fread(reds, 1, HE_COLOR_SZ, fp) < HE_COLOR_SZ || fread(greens, 1, HE_COLOR_SZ, fp) < HE_COLOR_SZ || fread(blues, 1, HE_COLOR_SZ, fp) < HE_COLOR_SZ) { fprintf(stderr, "Error reading palette file: %s.\n", pal); - return FAIL; + goto error; } /* convert sun palette to hdf palette */ p = palette; - for (i = 0; i < HE_COLOR_SZ; i++) { + for (int i = 0; i < HE_COLOR_SZ; i++) { *p++ = reds[i]; *p++ = greens[i]; *p++ = blues[i]; @@ -471,18 +502,24 @@ setPal(char *pal) if (DFR8setpalette((uint8 *)palette) < 0) { fputs("Error setting palette.\n", stderr); - return FAIL; + goto error; } + fclose(fp); + return HE_OK; + +error: + + if (fp != NULL) + fclose(fp); + return FAIL; } int findDesc(tag_ref_ptr dd) { - int i; - - for (i = 0; i < he_numDesc; i++) + for (int i = 0; i < he_numDesc; i++) if ((he_desc[i].tag == dd->tag) && (he_desc[i].ref == dd->ref)) return i; @@ -492,9 +529,7 @@ findDesc(tag_ref_ptr dd) int desc2Grp(int desc) { - int i; - - for (i = 0; i < he_numGrp; i++) + for (int i = 0; i < he_numGrp; i++) if (he_grp[i].desc == desc) return i; @@ -505,10 +540,8 @@ desc2Grp(int desc) int hasReference(int desc) { - int i, j; - - for (i = 0; i < he_numGrp; i++) - for (j = 0; j < he_grp[i].size; j++) + for (int i = 0; i < he_numGrp; i++) + for (int j = 0; j < he_grp[i].size; j++) if (he_grp[i].ddList[j].tag == he_desc[desc].tag && he_grp[i].ddList[j].ref == he_desc[desc].ref) return YES; return NO; @@ -517,18 +550,24 @@ hasReference(int desc) int deleteDesc(int desc) { - int32 fid; + int32 fid = -1; if ((fid = Hopen(he_file, DFACC_WRITE, 0)) == -1) { HEprint(stderr, 0); - return FAIL; + goto error; } if (Hdeldd(fid, he_desc[desc].tag, he_desc[desc].ref) == FAIL) { HEprint(stderr, 0); - return FAIL; + goto error; } return Hclose(fid); + +error: + if (fid != -1) + if (FAIL == Hclose(fid)) + HEprint(stderr, 0); + return FAIL; } int @@ -562,8 +601,8 @@ getCurrRig(int32 *pXdim, int32 *pYdim, char **pPalette, char **pRaster) int putWithTempl(char *template, int n1, int n2, int n3, char *data, int length, int verbose) { - char *file; - int ret; + char *file = NULL; + int ret = FAIL; convertTemplate(template, n1, n2, n3, &file); if (verbose) @@ -577,7 +616,7 @@ putWithTempl(char *template, int n1, int n2, int n3, char *data, int length, int int revert(void) { - char *back; + char *back = NULL; back = backupName(he_file); if (copyFile(back, he_file) < 0) @@ -646,19 +685,26 @@ int putElement(char *file, uint16 tag, uint16 ref, char *data, int32 len) { int32 ret; - int32 fid; + int32 fid = -1; if ((fid = Hopen(file, DFACC_READ | DFACC_WRITE, 0)) == FAIL) /* a little tricky here */ if (HEvalue(0) != DFE_FNF || (fid = Hopen(file, DFACC_ALL, 0)) == FAIL) { HEprint(stderr, 0); - return FAIL; + goto error; } if ((ret = Hputelement(fid, tag, ref, (unsigned char *)data, len)) < 0) { HEprint(stderr, 0); - return (int)ret; + goto error; } return Hclose(fid); + +error: + if (fid != -1) + if (FAIL == Hclose(fid)) + HEprint(stderr, 0); + + return FAIL; } int @@ -719,7 +765,7 @@ writeAnnot(char *file, uint16 tag, uint16 ref) { char *data; int32 eltLength; - intn tmp; + int tmp; char *p; uint16 newRef; @@ -802,14 +848,14 @@ putAnn(int ann, uint16 tag, uint16 ref, char *buf, int32 len) int32 readFromFile(char *file, char **pBuf) { - FILE *fp; + FILE *fp = NULL; int32 soFar; int32 bufLen; int32 num_read; fp = fopen(file, "r"); if (fp == NULL) - return FAIL; + goto error; soFar = 0; bufLen = 0; @@ -820,7 +866,7 @@ readFromFile(char *file, char **pBuf) else *pBuf = (char *)realloc(*pBuf, bufLen); if (*pBuf == NULL) - return FAIL; + goto error; num_read = (int32)fread((*pBuf) + soFar, 1, HE_BUF_SZ, fp); } @@ -828,6 +874,11 @@ readFromFile(char *file, char **pBuf) (*pBuf)[soFar] = '\0'; fclose(fp); return soFar; + +error: + if (fp != NULL) + fclose(fp); + return FAIL; } /* ---- table for operators -------- */ @@ -881,11 +932,10 @@ findOpt(char *word) { unsigned len; int found = -1; - uintn i; len = strlen(word); - for (i = 0; i < sizeof(he_optTab) / sizeof(he_optTab[0]); i++) + for (int i = 0; i < sizeof(he_optTab) / sizeof(he_optTab[0]); i++) if (!strncmp(he_optTab[i].str, word, len)) { /* exact match */ if (strlen(he_optTab[i].str) == len) @@ -906,7 +956,7 @@ findOpt(char *word) char * catStr(const char *s, const char *s1) { - char *t; + char *t = NULL; t = (char *)malloc(strlen(s) + strlen(s1) + 1); strcpy(t, s); @@ -917,7 +967,7 @@ catStr(const char *s, const char *s1) char * copyStr(char *s) { - char *t; + char *t = NULL; t = (char *)malloc(strlen(s) + 1); strcpy(t, s); @@ -952,12 +1002,14 @@ HEquit(HE_CMD *cmd) int quit(int status) { + free(he_desc); + free(he_grp); + if (fileOpen()) { if (closeFile(0) < 0) return HE_FAIL; } exit(status); - return (status); /* never executed. Just to shut up some compilers */ } int @@ -1025,15 +1077,13 @@ HEwait(HE_CMD *cmd) void deleteCmd(HE_CMD *cmd) { - intn i; - if (cmd == NULL) return; if (cmd->next != NULL) deleteCmd(cmd->next); if (cmd->sub != NULL) deleteCmd(cmd->sub); - for (i = 0; i < cmd->argc; i++) + for (int i = 0; i < cmd->argc; i++) free(cmd->argv[i]); free(cmd); } From 520f5dbb1c13b932aa699744a6723e3cb42536fb Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 7 Feb 2024 22:00:31 -0800 Subject: [PATCH 02/65] Clean up hdiff_vs.c (#509) * Missing cast on format specifier * Make large arrays dynamic --- mfhdf/hdiff/hdiff_vs.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/mfhdf/hdiff/hdiff_vs.c b/mfhdf/hdiff/hdiff_vs.c index 366c695bee..543c946ceb 100644 --- a/mfhdf/hdiff/hdiff_vs.c +++ b/mfhdf/hdiff/hdiff_vs.c @@ -184,18 +184,29 @@ vdata_cmp(int32 vs1, int32 vs2, char *gname, char *cname, diff_opt_t *opt) uint32 err_cnt; int32 nv1, interlace1, vsize1; int32 vsotag1; - char fields1[VSFIELDMAX * FIELDNAMELENMAX]; char vsclass1[VSNAMELENMAX], vsname1[VSNAMELENMAX]; int32 nv2, interlace2, vsize2; int32 vsotag2; - char fields2[VSFIELDMAX * FIELDNAMELENMAX]; char vsclass2[VSNAMELENMAX], vsname2[VSNAMELENMAX]; - uint8 *buf1, *buf2, *b1, *b2; + uint8 *b1, *b2; int32 off1[60], off2[60]; DYN_VWRITELIST *w1, *w2; uint32 nfound = 0; uint32 max_err_cnt = opt->max_err_cnt; + uint8 *buf1 = NULL; + uint8 *buf2 = NULL; + char *fields1 = NULL; + char *fields2 = NULL; + + fields1 = (char *)calloc((VSFIELDMAX * FIELDNAMELENMAX), sizeof(char)); + fields2 = (char *)calloc((VSFIELDMAX * FIELDNAMELENMAX), sizeof(char)); + if (fields1 == NULL || fields2 == NULL) { + printf("Out of memory!"); + opt->err_stat = 1; + goto out; + } + VSinquire(vs1, &nv1, &interlace1, fields1, &vsize1, vsname1); VSinquire(vs2, &nv2, &interlace2, fields2, &vsize2, vsname2); @@ -213,17 +224,17 @@ vdata_cmp(int32 vs1, int32 vs2, char *gname, char *cname, diff_opt_t *opt) fields1, vsize1, vsclass1); printf("< <%d> nrec=%d interlace=%d fld=[%s] vsize=%d class={%s})\n", vsotag2, nv2, interlace2, fields2, vsize2, vsclass2); - return 0; + goto out; } /* compare the data */ buf1 = (uint8 *)malloc((unsigned)(nv1 * vsize1)); buf2 = (uint8 *)malloc((unsigned)(nv2 * vsize2)); - if (!buf1 || !buf2) { + if (buf1 == NULL || buf2 == NULL) { printf("Out of memory!"); opt->err_stat = 1; - return 0; + goto out; } VSsetfields(vs1, fields1); @@ -327,9 +338,13 @@ vdata_cmp(int32 vs1, int32 vs2, char *gname, char *cname, diff_opt_t *opt) } } +out: free(buf1); free(buf2); + free(fields1); + free(fields2); + return nfound; } @@ -377,7 +392,7 @@ fmt_print(uint8 *x, int32 type) case DFNT_FLOAT32: memcpy(&f, x, sizeof(float32)); - printf("%f", f); + printf("%f", (double)f); break; case DFNT_FLOAT64: From be9b9c91a79bfb20520c91350a1a117ce8041eed Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Mon, 12 Feb 2024 08:44:15 -0600 Subject: [PATCH 03/65] sync and reduce examples files (#513) * sync the examples to HDF4Examples and eliminate old dirs --- .gitattributes | 6 - .github/workflows/cmake-bintest.yml | 1 - .github/workflows/main-cmake.yml | 4 +- HDF4Examples/C/AN/h4ex_AN_create_annotation.c | 247 +++++++------- .../C/AN/h4ex_AN_get_annotation_info.c | 192 +++++------ HDF4Examples/C/AN/h4ex_AN_read_annotation.c | 181 +++++------ .../testfiles/h4ex_AN_create_annotation.tst | 2 - .../testfiles/h4ex_AN_get_annotation_info.tst | 2 - .../AN/testfiles/h4ex_AN_read_annotation.tst | 2 - .../C/GR}/GR_read_chunks.c | 0 .../C/GR}/GR_write_chunks.c | 0 .../h4ex_GR_create_and_write_chunked_image.c | 36 ++- .../C/GR/h4ex_GR_create_and_write_image.c | 27 +- HDF4Examples/C/GR/h4ex_GR_get_attribute.c | 63 ++-- HDF4Examples/C/GR/h4ex_GR_image_info.c | 48 +-- HDF4Examples/C/GR/h4ex_GR_modify_image.c | 62 ++-- HDF4Examples/C/GR/h4ex_GR_read_image.c | 35 +- HDF4Examples/C/GR/h4ex_GR_read_palette.c | 22 +- HDF4Examples/C/GR/h4ex_GR_set_attribute.c | 26 +- HDF4Examples/C/GR/h4ex_GR_write_palette.c | 28 +- .../h4ex_GR_create_and_write_image.tst | 1 - HDF4Examples/C/SD/h4ex_SD_alter_sds_values.c | 13 +- HDF4Examples/C/SD/h4ex_SD_chunking_example.c | 68 ++-- HDF4Examples/C/SD/h4ex_SD_compress_sds.c | 16 +- HDF4Examples/C/SD/h4ex_SD_create_sds.c | 11 +- HDF4Examples/C/SD/h4ex_SD_dimscale_vs_sds.c | 16 +- HDF4Examples/C/SD/h4ex_SD_find_sds_by_name.c | 13 +- HDF4Examples/C/SD/h4ex_SD_get_attr.c | 135 ++++---- HDF4Examples/C/SD/h4ex_SD_get_info.c | 16 +- .../C/SD/h4ex_SD_mv_sds_to_external.c | 13 +- HDF4Examples/C/SD/h4ex_SD_read_from_sds.c | 13 +- HDF4Examples/C/SD/h4ex_SD_read_subsets.c | 19 +- HDF4Examples/C/SD/h4ex_SD_set_attr.c | 19 +- HDF4Examples/C/SD/h4ex_SD_set_get_dim_info.c | 31 +- HDF4Examples/C/SD/h4ex_SD_unlimited_sds.c | 22 +- HDF4Examples/C/SD/h4ex_SD_write_slab.c | 13 +- HDF4Examples/C/SD/h4ex_SD_write_to_sds.c | 13 +- .../C/VD/h4ex_VD_create_onefield_vdatas.c | 24 +- HDF4Examples/C/VD/h4ex_VD_create_vdatas.c | 53 +-- HDF4Examples/C/VD/h4ex_VD_get_vdata_info.c | 25 +- HDF4Examples/C/VD/h4ex_VD_locate_vdata.c | 28 +- HDF4Examples/C/VD/h4ex_VD_read_from_vdata.c | 31 +- HDF4Examples/C/VD/h4ex_VD_read_mixed_vdata.c | 39 ++- .../C/VD/h4ex_VD_set_get_vdata_attr.c | 42 ++- HDF4Examples/C/VD/h4ex_VD_write_mixed_vdata.c | 66 ++-- .../C/VD/h4ex_VD_write_mixed_vdata_struct.c | 58 ++-- HDF4Examples/C/VD/h4ex_VD_write_to_vdata.c | 54 ++-- HDF4Examples/C/VG/h4ex_VG_add_sds_to_vgroup.c | 35 +- HDF4Examples/C/VG/h4ex_VG_create_vgroup.c | 24 +- HDF4Examples/C/VG/h4ex_VG_get_vgroup_info.c | 53 +-- .../C/VG/h4ex_VG_insert_vdatas_to_vgroup.c | 104 +++--- .../C/VG/h4ex_VG_set_get_vgroup_attr.c | 35 +- HDF4Examples/C/VG/h4ex_VG_vgroup_contents.c | 30 +- HDF4Examples/CMakePresets.json | 62 +++- .../GR/h4ex_GR_create_and_write_image.f | 14 +- .../FORTRAN/GR/h4ex_GR_get_attribute.f | 23 +- HDF4Examples/FORTRAN/GR/h4ex_GR_image_info.f | 9 +- .../FORTRAN/GR/h4ex_GR_modify_image.f | 22 +- HDF4Examples/FORTRAN/GR/h4ex_GR_read_image.f | 36 +-- .../FORTRAN/GR/h4ex_GR_read_palette.f | 8 +- .../FORTRAN/GR/h4ex_GR_set_attribute.f | 18 +- .../FORTRAN/GR/h4ex_GR_write_palette.f | 18 +- .../FORTRAN/SD/h4ex_SD_alter_sds_values.f | 18 +- .../FORTRAN/SD/h4ex_SD_chunking_example.f | 74 ++--- .../FORTRAN/SD/h4ex_SD_compress_sds.f | 12 +- HDF4Examples/FORTRAN/SD/h4ex_SD_create_sds.f | 6 +- .../FORTRAN/SD/h4ex_SD_dimscale_vs_sds.f | 20 +- .../FORTRAN/SD/h4ex_SD_find_sds_by_name.f | 20 +- HDF4Examples/FORTRAN/SD/h4ex_SD_get_attr.f | 54 ++-- HDF4Examples/FORTRAN/SD/h4ex_SD_get_info.f | 12 +- .../FORTRAN/SD/h4ex_SD_mv_sds_to_external.f | 6 +- .../FORTRAN/SD/h4ex_SD_read_from_sds.f | 10 +- .../FORTRAN/SD/h4ex_SD_read_subsets.f | 66 ++-- HDF4Examples/FORTRAN/SD/h4ex_SD_set_attr.f | 22 +- .../FORTRAN/SD/h4ex_SD_set_get_dim_info.f | 26 +- .../FORTRAN/SD/h4ex_SD_unlimited_sds.f | 36 +-- HDF4Examples/FORTRAN/SD/h4ex_SD_write_slab.f | 28 +- .../FORTRAN/SD/h4ex_SD_write_to_sds.f | 4 +- .../VD/h4ex_VD_create_onefield_vdatas.f | 14 +- .../FORTRAN/VD/h4ex_VD_create_vdatas.f | 10 +- .../FORTRAN/VD/h4ex_VD_get_vdata_info.f | 41 ++- .../FORTRAN/VD/h4ex_VD_locate_vdata.f | 20 +- .../FORTRAN/VD/h4ex_VD_read_from_vdata.f | 28 +- .../FORTRAN/VD/h4ex_VD_read_mixed_vdata.f | 36 +-- .../FORTRAN/VD/h4ex_VD_set_get_vdata_attr.f | 30 +- .../FORTRAN/VD/h4ex_VD_write_mixed_vdata.f | 32 +- .../FORTRAN/VD/h4ex_VD_write_to_vdata.f | 14 +- .../FORTRAN/VG/h4ex_VG_add_sds_to_vgroup.f | 8 +- .../FORTRAN/VG/h4ex_VG_get_vgroup_info.f | 4 +- .../VG/h4ex_VG_insert_vdatas_to_vgroup.f | 20 +- .../FORTRAN/VG/h4ex_VG_set_get_vgroup_attr.f | 9 +- .../FORTRAN/VG/h4ex_VG_vgroup_contents.f | 10 +- .../config/cmake-presets/hidden-presets.json | 12 - .../config/cmake/HDFExampleMacros.cmake | 26 +- Makefile.am | 15 +- configure.ac | 5 - hdf/Makefile.am | 16 +- hdf/examples/AN_create_annotation.c | 134 -------- hdf/examples/AN_get_annotation_info.c | 109 ------- hdf/examples/AN_read_annotation.c | 97 ------ hdf/examples/CMakeLists.txt | 60 ---- hdf/examples/CMakeTests.cmake | 44 --- hdf/examples/GR_create_and_write_image.c | 89 ------ hdf/examples/GR_get_attribute.c | 148 --------- hdf/examples/GR_image_info.c | 104 ------ hdf/examples/GR_modify_image.c | 129 -------- hdf/examples/GR_read_image.c | 136 -------- hdf/examples/GR_read_palette.c | 86 ----- hdf/examples/GR_set_attribute.c | 80 ----- hdf/examples/GR_write_palette.c | 110 ------- hdf/examples/Makefile.am | 98 ------ hdf/examples/README | 29 -- hdf/examples/VD_create_onefield_vdatas.c | 70 ---- hdf/examples/VD_create_vdatas.c | 121 ------- hdf/examples/VD_get_vdata_info.c | 78 ----- hdf/examples/VD_locate_vdata.c | 83 ----- hdf/examples/VD_read_from_vdata.c | 91 ------ hdf/examples/VD_read_mixed_vdata.c | 99 ------ hdf/examples/VD_set_get_vdata_attr.c | 136 -------- hdf/examples/VD_write_mixed_vdata.c | 125 -------- hdf/examples/VD_write_mixed_vdata_struct.c | 164 ---------- hdf/examples/VD_write_to_vdata.c | 104 ------ hdf/examples/VG_add_sds_to_vgroup.c | 92 ------ hdf/examples/VG_create_vgroup.c | 63 ---- hdf/examples/VG_get_vgroup_info.c | 105 ------ hdf/examples/VG_insert_vdatas_to_vgroup.c | 163 ---------- hdf/examples/VG_set_get_vgroup_attr.c | 104 ------ hdf/examples/VG_vgroup_contents.c | 108 ------- hdf/examples/run-all-ex.sh | 38 --- hdf/examples/run-c-ex.sh | 171 ---------- hdf/fortran/Makefile.am | 15 +- hdf/fortran/examples/AN_create_annotation.f | 125 -------- hdf/fortran/examples/AN_get_annotation_info.f | 121 ------- hdf/fortran/examples/AN_read_annotation.f | 82 ----- hdf/fortran/examples/CMakeLists.txt | 130 -------- hdf/fortran/examples/CMakeTests.cmake | 48 --- .../examples/GR_create_and_write_image.f | 92 ------ hdf/fortran/examples/GR_get_attribute.f | 100 ------ hdf/fortran/examples/GR_image_info.f | 91 ------ hdf/fortran/examples/GR_modify_image.f | 133 -------- hdf/fortran/examples/GR_read_image.f | 136 -------- hdf/fortran/examples/GR_read_palette.f | 84 ----- hdf/fortran/examples/GR_set_attribute.f | 97 ------ hdf/fortran/examples/GR_write_palette.f | 116 ------- hdf/fortran/examples/Makefile.am | 89 ------ .../examples/VD_create_onefield_vdatas.f | 79 ----- hdf/fortran/examples/VD_create_vdatas.f | 106 ------ hdf/fortran/examples/VD_get_vdata_info.f | 95 ------ hdf/fortran/examples/VD_locate_vdata.f | 87 ----- hdf/fortran/examples/VD_read_from_vdata.f | 93 ------ hdf/fortran/examples/VD_read_mixed_vdata.f | 106 ------ hdf/fortran/examples/VD_set_get_vdata_attr.f | 134 -------- hdf/fortran/examples/VD_write_mixed_vdata.f | 126 -------- hdf/fortran/examples/VD_write_to_vdata.f | 106 ------ hdf/fortran/examples/VG_add_sds_to_vgroup.f | 91 ------ hdf/fortran/examples/VG_create_vgroup.f | 61 ---- hdf/fortran/examples/VG_get_vgroup_info.f | 97 ------ .../examples/VG_insert_vdatas_to_vgroup.f | 167 ---------- hdf/fortran/examples/VG_set_get_vgroup_attr.f | 107 ------- hdf/fortran/examples/VG_vgroup_contents.f | 102 ------ hdf/fortran/examples/run-fortran-ex.sh | 160 ---------- java/src/Makefile.am | 2 +- mfhdf/Makefile.am | 15 +- mfhdf/examples/CMakeLists.txt | 39 --- mfhdf/examples/CMakeTests.cmake | 30 -- mfhdf/examples/Makefile.am | 62 ---- mfhdf/examples/SD_alter_sds_values.c | 60 ---- mfhdf/examples/SD_chunking_example.c | 301 ------------------ mfhdf/examples/SD_compress_sds.c | 91 ------ mfhdf/examples/SD_create_sds.c | 52 --- mfhdf/examples/SD_dimscale_vs_sds.c | 62 ---- mfhdf/examples/SD_find_sds_by_name.c | 81 ----- mfhdf/examples/SD_get_attr.c | 165 ---------- mfhdf/examples/SD_get_info.c | 71 ----- mfhdf/examples/SD_mv_sds_to_external.c | 45 --- mfhdf/examples/SD_read_from_sds.c | 69 ---- mfhdf/examples/SD_read_subsets.c | 136 -------- mfhdf/examples/SD_set_attr.c | 79 ----- mfhdf/examples/SD_set_get_dim_info.c | 159 --------- mfhdf/examples/SD_unlimited_sds.c | 124 -------- mfhdf/examples/SD_write_slab.c | 95 ------ mfhdf/examples/SD_write_to_sds.c | 69 ---- mfhdf/examples/testexamples.sh.in | 18 -- mfhdf/fortran/Makefile.am | 16 +- mfhdf/fortran/examples/CMakeLists.txt | 87 ----- mfhdf/fortran/examples/CMakeTests.cmake | 34 -- mfhdf/fortran/examples/Makefile.am | 62 ---- mfhdf/fortran/examples/SD_alter_sds_values.f | 71 ----- mfhdf/fortran/examples/SD_chunking_example.f | 289 ----------------- mfhdf/fortran/examples/SD_compress_sds.f | 95 ------ mfhdf/fortran/examples/SD_create_sds.f | 54 ---- mfhdf/fortran/examples/SD_dimscale_vs_sds.f | 68 ---- mfhdf/fortran/examples/SD_find_sds_by_name.f | 82 ----- mfhdf/fortran/examples/SD_get_attr.f | 125 -------- mfhdf/fortran/examples/SD_get_info.f | 71 ----- .../fortran/examples/SD_mv_sds_to_external.f | 50 --- mfhdf/fortran/examples/SD_read_from_sds.f | 72 ----- mfhdf/fortran/examples/SD_read_subsets.f | 125 -------- mfhdf/fortran/examples/SD_set_attr.f | 82 ----- mfhdf/fortran/examples/SD_set_get_dim_info.f | 147 --------- mfhdf/fortran/examples/SD_unlimited_sds.f | 115 ------- mfhdf/fortran/examples/SD_write_slab.f | 101 ------ mfhdf/fortran/examples/SD_write_to_sds.f | 79 ----- 203 files changed, 1669 insertions(+), 11616 deletions(-) rename {hdf/examples => HDF4Examples/C/GR}/GR_read_chunks.c (100%) rename {hdf/examples => HDF4Examples/C/GR}/GR_write_chunks.c (100%) delete mode 100644 hdf/examples/AN_create_annotation.c delete mode 100644 hdf/examples/AN_get_annotation_info.c delete mode 100644 hdf/examples/AN_read_annotation.c delete mode 100644 hdf/examples/CMakeLists.txt delete mode 100644 hdf/examples/CMakeTests.cmake delete mode 100644 hdf/examples/GR_create_and_write_image.c delete mode 100644 hdf/examples/GR_get_attribute.c delete mode 100644 hdf/examples/GR_image_info.c delete mode 100644 hdf/examples/GR_modify_image.c delete mode 100644 hdf/examples/GR_read_image.c delete mode 100644 hdf/examples/GR_read_palette.c delete mode 100644 hdf/examples/GR_set_attribute.c delete mode 100644 hdf/examples/GR_write_palette.c delete mode 100644 hdf/examples/Makefile.am delete mode 100644 hdf/examples/README delete mode 100644 hdf/examples/VD_create_onefield_vdatas.c delete mode 100644 hdf/examples/VD_create_vdatas.c delete mode 100644 hdf/examples/VD_get_vdata_info.c delete mode 100644 hdf/examples/VD_locate_vdata.c delete mode 100644 hdf/examples/VD_read_from_vdata.c delete mode 100644 hdf/examples/VD_read_mixed_vdata.c delete mode 100644 hdf/examples/VD_set_get_vdata_attr.c delete mode 100644 hdf/examples/VD_write_mixed_vdata.c delete mode 100644 hdf/examples/VD_write_mixed_vdata_struct.c delete mode 100644 hdf/examples/VD_write_to_vdata.c delete mode 100644 hdf/examples/VG_add_sds_to_vgroup.c delete mode 100644 hdf/examples/VG_create_vgroup.c delete mode 100644 hdf/examples/VG_get_vgroup_info.c delete mode 100644 hdf/examples/VG_insert_vdatas_to_vgroup.c delete mode 100644 hdf/examples/VG_set_get_vgroup_attr.c delete mode 100644 hdf/examples/VG_vgroup_contents.c delete mode 100755 hdf/examples/run-all-ex.sh delete mode 100644 hdf/examples/run-c-ex.sh delete mode 100644 hdf/fortran/examples/AN_create_annotation.f delete mode 100644 hdf/fortran/examples/AN_get_annotation_info.f delete mode 100644 hdf/fortran/examples/AN_read_annotation.f delete mode 100644 hdf/fortran/examples/CMakeLists.txt delete mode 100644 hdf/fortran/examples/CMakeTests.cmake delete mode 100644 hdf/fortran/examples/GR_create_and_write_image.f delete mode 100644 hdf/fortran/examples/GR_get_attribute.f delete mode 100644 hdf/fortran/examples/GR_image_info.f delete mode 100644 hdf/fortran/examples/GR_modify_image.f delete mode 100644 hdf/fortran/examples/GR_read_image.f delete mode 100644 hdf/fortran/examples/GR_read_palette.f delete mode 100644 hdf/fortran/examples/GR_set_attribute.f delete mode 100644 hdf/fortran/examples/GR_write_palette.f delete mode 100644 hdf/fortran/examples/Makefile.am delete mode 100644 hdf/fortran/examples/VD_create_onefield_vdatas.f delete mode 100644 hdf/fortran/examples/VD_create_vdatas.f delete mode 100644 hdf/fortran/examples/VD_get_vdata_info.f delete mode 100644 hdf/fortran/examples/VD_locate_vdata.f delete mode 100644 hdf/fortran/examples/VD_read_from_vdata.f delete mode 100644 hdf/fortran/examples/VD_read_mixed_vdata.f delete mode 100644 hdf/fortran/examples/VD_set_get_vdata_attr.f delete mode 100644 hdf/fortran/examples/VD_write_mixed_vdata.f delete mode 100644 hdf/fortran/examples/VD_write_to_vdata.f delete mode 100644 hdf/fortran/examples/VG_add_sds_to_vgroup.f delete mode 100644 hdf/fortran/examples/VG_create_vgroup.f delete mode 100644 hdf/fortran/examples/VG_get_vgroup_info.f delete mode 100644 hdf/fortran/examples/VG_insert_vdatas_to_vgroup.f delete mode 100644 hdf/fortran/examples/VG_set_get_vgroup_attr.f delete mode 100644 hdf/fortran/examples/VG_vgroup_contents.f delete mode 100644 hdf/fortran/examples/run-fortran-ex.sh delete mode 100644 mfhdf/examples/CMakeLists.txt delete mode 100644 mfhdf/examples/CMakeTests.cmake delete mode 100644 mfhdf/examples/Makefile.am delete mode 100644 mfhdf/examples/SD_alter_sds_values.c delete mode 100644 mfhdf/examples/SD_chunking_example.c delete mode 100644 mfhdf/examples/SD_compress_sds.c delete mode 100644 mfhdf/examples/SD_create_sds.c delete mode 100644 mfhdf/examples/SD_dimscale_vs_sds.c delete mode 100644 mfhdf/examples/SD_find_sds_by_name.c delete mode 100644 mfhdf/examples/SD_get_attr.c delete mode 100644 mfhdf/examples/SD_get_info.c delete mode 100644 mfhdf/examples/SD_mv_sds_to_external.c delete mode 100644 mfhdf/examples/SD_read_from_sds.c delete mode 100644 mfhdf/examples/SD_read_subsets.c delete mode 100644 mfhdf/examples/SD_set_attr.c delete mode 100644 mfhdf/examples/SD_set_get_dim_info.c delete mode 100644 mfhdf/examples/SD_unlimited_sds.c delete mode 100644 mfhdf/examples/SD_write_slab.c delete mode 100644 mfhdf/examples/SD_write_to_sds.c delete mode 100644 mfhdf/examples/testexamples.sh.in delete mode 100644 mfhdf/fortran/examples/CMakeLists.txt delete mode 100644 mfhdf/fortran/examples/CMakeTests.cmake delete mode 100644 mfhdf/fortran/examples/Makefile.am delete mode 100644 mfhdf/fortran/examples/SD_alter_sds_values.f delete mode 100644 mfhdf/fortran/examples/SD_chunking_example.f delete mode 100644 mfhdf/fortran/examples/SD_compress_sds.f delete mode 100644 mfhdf/fortran/examples/SD_create_sds.f delete mode 100644 mfhdf/fortran/examples/SD_dimscale_vs_sds.f delete mode 100644 mfhdf/fortran/examples/SD_find_sds_by_name.f delete mode 100644 mfhdf/fortran/examples/SD_get_attr.f delete mode 100644 mfhdf/fortran/examples/SD_get_info.f delete mode 100644 mfhdf/fortran/examples/SD_mv_sds_to_external.f delete mode 100644 mfhdf/fortran/examples/SD_read_from_sds.f delete mode 100644 mfhdf/fortran/examples/SD_read_subsets.f delete mode 100644 mfhdf/fortran/examples/SD_set_attr.f delete mode 100644 mfhdf/fortran/examples/SD_set_get_dim_info.f delete mode 100644 mfhdf/fortran/examples/SD_unlimited_sds.f delete mode 100644 mfhdf/fortran/examples/SD_write_slab.f delete mode 100644 mfhdf/fortran/examples/SD_write_to_sds.f diff --git a/.gitattributes b/.gitattributes index 90cc368fc9..0a2a1a1062 100644 --- a/.gitattributes +++ b/.gitattributes @@ -66,12 +66,6 @@ hdf/util/testfiles/tvattr.hdf -text java/CMakeLists.txt -text java/Makefile.am -text java/Makefile.in -text -java/examples/CMakeLists.txt -text -java/examples/HDF4DatasetCreate.java -text -java/examples/HDF4FileCreate.java -text -java/examples/HDF4GroupCreate.java -text -java/examples/Makefile.am -text -java/examples/Makefile.in -text java/lib/ext/slf4j-nop-1.7.33.jar -text svneol=unset#application/zip java/lib/ext/slf4j-simple-1.7.33.jar -text svneol=unset#application/zip java/lib/hamcrest-core.jar -text svneol=unset#application/java-archive diff --git a/.github/workflows/cmake-bintest.yml b/.github/workflows/cmake-bintest.yml index 2f7394b4b0..d8c9e5948d 100644 --- a/.github/workflows/cmake-bintest.yml +++ b/.github/workflows/cmake-bintest.yml @@ -149,7 +149,6 @@ jobs: # MacOS w/ Clang + CMake # name: "MacOS Clang Binary Test" - if: false runs-on: macos-13 steps: - name: Install Dependencies (MacOS) diff --git a/.github/workflows/main-cmake.yml b/.github/workflows/main-cmake.yml index 98a85ce9a4..a591d28416 100644 --- a/.github/workflows/main-cmake.yml +++ b/.github/workflows/main-cmake.yml @@ -150,8 +150,6 @@ jobs: # # CMAKE CONFIGURE # - - name: Get Java setting - run: echo "useJava=${{ inputs.shared=='true' }}" >> $GITHUB_ENV - name: CMake Configure run: | @@ -167,7 +165,7 @@ jobs: -DBUILD_JPEG_WITH_PIC:BOOL=ON \ -DHDF4_ENABLE_NETCDF:BOOL=${{ inputs.netcdf }} \ -DHDF4_BUILD_FORTRAN:BOOL=${{ matrix.fortran }} \ - -DHDF4_BUILD_JAVA:BOOL=${{ env.useJava }} \ + -DHDF4_BUILD_JAVA:BOOL=${{ inputs.shared }} \ -DHDF4_BUILD_DOC:BOOL=${{ matrix.docs }} \ -DJPEG_USE_LOCALCONTENT:BOOL=${{ matrix.localjpeg }} \ -DLIBAEC_USE_LOCALCONTENT:BOOL=${{ matrix.locallibaec }} \ diff --git a/HDF4Examples/C/AN/h4ex_AN_create_annotation.c b/HDF4Examples/C/AN/h4ex_AN_create_annotation.c index e5576f0b26..62402422f8 100644 --- a/HDF4Examples/C/AN/h4ex_AN_create_annotation.c +++ b/HDF4Examples/C/AN/h4ex_AN_create_annotation.c @@ -12,144 +12,123 @@ main() { /************************* Variable declaration **************************/ - intn status_n; /* returned status for functions returning an intn */ - int32 status_32; /* returned status for functions returning an int32 */ - int32 file_id; /* HDF file identifier */ - int32 an_id; /* AN interface identifier */ - int32 file_label_id; /* file label identifier */ - int32 file_desc_id; /* file description identifier */ - int32 data_label_id; /* data label identifier */ - int32 data_desc_id; /* data description identifier */ - int32 vgroup_id; - uint16 vgroup_tag; - uint16 vgroup_ref; - int ret_val = FAIL; + int32 file_id, /* HDF file identifier */ + an_id, /* AN interface identifier */ + file_label_id, /* file label identifier */ + file_desc_id, /* file description identifier */ + data_label_id, /* data label identifier */ + data_desc_id, /* data description identifier */ + vgroup_id; + uint16 vgroup_tag, vgroup_ref; /********************** End of variable declaration **********************/ /* * Create the HDF file. */ - file_id = Hopen(FILE_NAME, DFACC_CREATE, 0); - if (file_id == FAIL) - printf("\nUnable to open file %s for writing.\n", FILE_NAME); - else { - /* - * Initialize the AN interface. - */ - an_id = ANstart(file_id); - if (an_id == FAIL) - printf("\nCannot start annotation handling on the file %s.\n", FILE_NAME); - else { - /* - * Create the file label. - */ - file_label_id = ANcreatef(an_id, AN_FILE_LABEL); - if (file_label_id == FAIL) - printf("\nCannot create a new file label annotation.\n"); - else { - /* - * Write the annotations to the file label. - */ - status_32 = ANwriteann(file_label_id, FILE_LABEL_TXT, (int32)strlen(FILE_LABEL_TXT)); - if (status_32 == FAIL) - printf("\nFailed to write label annotation.\n"); - - /* - * Create file description. - */ - file_desc_id = ANcreatef(an_id, AN_FILE_DESC); - if (file_desc_id == FAIL) - printf("\nCannot create a new file description annotation.\n"); - else { - /* - * Write the annotation to the file description. - */ - status_32 = ANwriteann(file_desc_id, FILE_DESC_TXT, (int32)strlen(FILE_DESC_TXT)); - if (status_32 == FAIL) - printf("\nFailed to write description annotation.\n"); - - /* - * Create a vgroup in the V interface. Note that the vgroup's ref number - * is set to -1 for creating and the access mode is "w" for writing. - */ - status_n = Vstart(file_id); - if (status_n == FAIL) - printf("\nCould not start VGroup interface\n"); - else { - vgroup_id = Vattach(file_id, -1, "w"); - if (vgroup_id == FAIL) - printf("\nCould not attach to VGroup interface\n"); - else { - status_32 = Vsetname(vgroup_id, VG_NAME); - if (status_32 == FAIL) - printf("\nCould not name group.\n"); - - /* - * Obtain the tag and ref number of the vgroup for subsequent - * references. - */ - vgroup_tag = (uint16)VQuerytag(vgroup_id); - vgroup_ref = (uint16)VQueryref(vgroup_id); - - /* - * Create the data label for the vgroup identified by its tag - * and ref number. - */ - data_label_id = ANcreate(an_id, vgroup_tag, vgroup_ref, AN_DATA_LABEL); - if (data_label_id == FAIL) - printf("\nCannot create a new data label annotation.\n"); - else { - /* - * Write the annotation text to the data label. - */ - status_32 = - ANwriteann(data_label_id, DATA_LABEL_TXT, (int32)strlen(DATA_LABEL_TXT)); - if (status_32 == FAIL) - printf("\nFailed to write data label annotation.\n"); - - /* - * Create the data description for the vgroup identified by its tag - * and ref number. - */ - data_desc_id = ANcreate(an_id, vgroup_tag, vgroup_ref, AN_DATA_DESC); - if (data_desc_id == FAIL) - printf("\nCannot create a new data description annotation.\n"); - else { - /* - * Write the annotation text to the data description. - */ - status_32 = - ANwriteann(data_desc_id, DATA_DESC_TXT, strlen(DATA_DESC_TXT)); - if (status_32 == FAIL) { - printf("\nFailed to write data description annotation.\n"); - } - else { - ret_val = SUCCEED; - } - status_n = ANendaccess(data_desc_id); - } - status_n = ANendaccess(data_label_id); - } - /* - * Terminate access to the vgroup and to the V interface. - */ - status_32 = Vdetach(vgroup_id); - } - status_n = Vend(file_id); - } - status_n = ANendaccess(file_desc_id); - } - status_n = ANendaccess(file_label_id); - } - /* - * Terminate access to the AN interface and close the HDF file. - */ - status_32 = ANend(an_id); - } - status_n = Hclose(file_id); - } - if (ret_val == SUCCEED) - printf("\nSuccessful!\n"); - return ret_val; + if ((file_id = Hopen(FILE_NAME, DFACC_CREATE, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); + + /* + * Initialize the AN interface. + */ + if ((an_id = ANstart(file_id)) == FAIL) + printf("*** ERROR from ANstart\n"); + + /* + * Create the file label. + */ + if ((file_label_id = ANcreatef(an_id, AN_FILE_LABEL)) == FAIL) + printf("*** ERROR from ANcreatef\n"); + + /* + * Write the annotations to the file label. + */ + if (ANwriteann(file_label_id, FILE_LABEL_TXT, strlen(FILE_LABEL_TXT)) == FAIL) + printf("*** ERROR from ANwriteann\n"); + + /* + * Create file description. + */ + if ((file_desc_id = ANcreatef(an_id, AN_FILE_DESC)) == FAIL) + printf("*** ERROR from ANcreatef\n"); + + /* + * Write the annotation to the file description. + */ + if (ANwriteann(file_desc_id, FILE_DESC_TXT, strlen(FILE_DESC_TXT)) == FAIL) + printf("*** ERROR from ANwriteann\n"); + + /* + * Create a vgroup in the V interface. Note that the vgroup's ref number + * is set to -1 for creating and the access mode is "w" for writing. + */ + if (Vstart(file_id) == FAIL) + printf("*** ERROR from Vstart\n"); + if ((vgroup_id = Vattach(file_id, -1, "w")) == FAIL) + printf("*** ERROR from Vattach\n"); + if (Vsetname(vgroup_id, VG_NAME) == FAIL) + printf("*** ERROR from Vsetname\n"); + + /* + * Obtain the tag and ref number of the vgroup for subsequent + * references. + */ + vgroup_tag = (uint16)VQuerytag(vgroup_id); + vgroup_ref = (uint16)VQueryref(vgroup_id); + + /* + * Create the data label for the vgroup identified by its tag + * and ref number. + */ + if ((data_label_id = ANcreate(an_id, vgroup_tag, vgroup_ref, AN_DATA_LABEL)) == FAIL) + printf("*** ERROR from ANcreate\n"); + + /* + * Write the annotation text to the data label. + */ + if (ANwriteann(data_label_id, DATA_LABEL_TXT, strlen(DATA_LABEL_TXT)) == FAIL) + printf("*** ERROR from ANwriteann\n"); + + /* + * Create the data description for the vgroup identified by its tag + * and ref number. + */ + if ((data_desc_id = ANcreate(an_id, vgroup_tag, vgroup_ref, AN_DATA_DESC)) == FAIL) + printf("*** ERROR from ANcreate\n"); + + /* + * Write the annotation text to the data description. + */ + if (ANwriteann(data_desc_id, DATA_DESC_TXT, strlen(DATA_DESC_TXT)) == FAIL) + printf("*** ERROR from ANwriteann\n"); + + /* + * Terminate access to the vgroup and to the V interface. + */ + if (Vdetach(vgroup_id) == FAIL) + printf("*** ERROR from Vdetach\n"); + if (Vend(file_id) == FAIL) + printf("*** ERROR from Vend\n"); + + /* + * Terminate access to each annotation explicitly. + */ + if (ANendaccess(file_label_id) == FAIL) + printf("*** ERROR from ANendaccess(file_label_id)\n"); + if (ANendaccess(file_desc_id) == FAIL) + printf("*** ERROR from ANendaccess(file_desc_id)\n"); + if (ANendaccess(data_label_id) == FAIL) + printf("*** ERROR from ANendaccess(data_label_id)\n"); + if (ANendaccess(data_desc_id) == FAIL) + printf("*** ERROR from ANendaccess(data_desc_id)\n"); + + /* + * Terminate access to the AN interface and close the HDF file. + */ + if (ANend(an_id) == FAIL) + printf("*** ERROR from ANend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/AN/h4ex_AN_get_annotation_info.c b/HDF4Examples/C/AN/h4ex_AN_get_annotation_info.c index 45fd54fb5e..cd16077d85 100644 --- a/HDF4Examples/C/AN/h4ex_AN_get_annotation_info.c +++ b/HDF4Examples/C/AN/h4ex_AN_get_annotation_info.c @@ -8,130 +8,102 @@ main() { /************************* Variable declaration **************************/ - intn status_n; /* returned status for functions returning an intn */ - int32 status_32, /* returned status for functions returning an int32*/ - file_id, an_id, n_annots, /* number of annotations */ - *ann_list, /* list of annotation identifiers */ - vgroup_ref, /* reference number of the vgroup */ - index; /* index of an annotation in the annotation list */ + int32 file_id, an_id; + int32 n_annots; /* number of annotations */ + int32 *ann_list = NULL; /* list of annotation identifiers */ + int32 vgroup_ref; /* reference number of the vgroup */ + int32 index; /* index of an annotation in the annotation list */ ann_type annot_type = AN_DATA_DESC; /* annotation to be obtained*/ uint16 ann_tag, ann_ref, /* tag/ref number of an annotation */ vgroup_tag = DFTAG_VG; /* tag of the vgroup */ - int ret_val = FAIL; /********************** End of variable declaration **********************/ /* * Open the HDF file. */ - file_id = Hopen(FILE_NAME, DFACC_READ, 0); - if (file_id == FAIL) - printf("\nUnable to open file %s for reading.\n", FILE_NAME); - else { + if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); + + /* + * Initialize the V interface. + */ + if (Vstart(file_id) == FAIL) + printf("*** ERROR from Vstart\n"); + + /* + * Get the vgroup named VG_NAME. + */ + if ((vgroup_ref = Vfind(file_id, VG_NAME)) == FAIL) + printf("*** ERROR from Vfind\n"); + + /* + * Initialize the AN interface and obtain an interface id. + */ + if ((an_id = ANstart(file_id)) == FAIL) + printf("*** ERROR from ANstart\n"); + + /* + * Get the number of object descriptions. Note that, since ANnumann takes + * the tag and reference number as being of type unit16, vgroup_ref must be + * safely cast to uint16 by checking for FAIL value first. + */ + if (vgroup_ref != FAIL) { + n_annots = ANnumann(an_id, annot_type, vgroup_tag, (uint16)vgroup_ref); + /* - * Initialize the AN interface and obtain an interface id. + * Allocate space to hold the annotation identifiers. */ - an_id = ANstart(file_id); - if (an_id == FAIL) - printf("\nCannot start annotation handling on the file %s.\n", FILE_NAME); - else { - /* - * Initialize the V interface. - */ - status_n = Vstart(file_id); - if (status_n == FAIL) - printf("\nCould not start VGroup interface\n"); - else { - - /* - * Get the vgroup named VG_NAME. - */ - vgroup_ref = Vfind(file_id, VG_NAME); - - /* - * Get the number of object descriptions. Note that, since ANnumann takes - * the tag and reference number as being of type unit16, vgroup_ref must be - * safely cast to uint16 by checking for FAIL value first. - */ - if (vgroup_ref != FAIL) { - n_annots = ANnumann(an_id, annot_type, vgroup_tag, (uint16)vgroup_ref); - if (n_annots == FAIL) { - printf("\nCannot get number of annotation ids.\n"); - } - else { - /* - * Allocate space to hold the annotation identifiers. - */ - ann_list = malloc(n_annots * sizeof(int32)); - if (ann_list) { - /* - * Get the list of identifiers of the annotations attached to the - * vgroup and of type annot_type. - */ - n_annots = ANannlist(an_id, annot_type, vgroup_tag, (uint16)vgroup_ref, ann_list); - if (n_annots == FAIL) { - printf("\nCannot get list of annotation ids.\n"); - } - else { - ret_val = SUCCEED; - /* - * Get each annotation identifier from the list then display the - * tag/ref number pair of the corresponding annotation. - */ - printf("List of annotations of type AN_DATA_DESC:\n"); - for (index = 0; index < n_annots; index++) { - /* - * Get and display the ref number of the annotation from - * its identifier. - */ - status_32 = ANid2tagref(ann_list[index], &ann_tag, &ann_ref); - if (status_32 == FAIL) { - printf("\nCannot the ref number of the annotation.\n"); - ret_val = FAIL; - } - else { - printf("Annotation index %d: tag = %s\nreference number= %d\n", index, - ann_tag == DFTAG_DIA ? "DFTAG_DIA (data description)" - : "Incorrect", - ann_ref); - } - } /* for */ - } - /* - * Free the space allocated for the annotation identifier list. - */ - free(ann_list); - } - else { - printf("\nAllocation failure\n"); - } - } - } - status_n = Vend(file_id); - } + ann_list = malloc(n_annots * sizeof(int32)); - /* - * Get and display an annotation type from an annotation tag. - */ - annot_type = ANtag2atype(DFTAG_FID); - printf("\nAnnotation type of DFTAG_FID (file label) is %s\n", - annot_type == AN_FILE_LABEL ? "AN_FILE_LABEL" : "Incorrect"); + /* + * Get the list of identifiers of the annotations attached to the + * vgroup and of type annot_type. + */ + n_annots = ANannlist(an_id, annot_type, vgroup_tag, (uint16)vgroup_ref, ann_list); + /* + * Get each annotation identifier from the list then display the + * tag/ref number pair of the corresponding annotation. + */ + printf("List of annotations of type AN_DATA_DESC:\n"); + for (index = 0; index < n_annots; index++) { /* - * Get and display an annotation tag from an annotation type. + * Get and display the ref number of the annotation from + * its identifier. */ - ann_tag = ANatype2tag(AN_DATA_LABEL); - printf("\nAnnotation tag of AN_DATA_LABEL is %s\n", - ann_tag == DFTAG_DIL ? "DFTAG_DIL (data label)" : "Incorrect"); + if (ANid2tagref(ann_list[index], &ann_tag, &ann_ref) == FAIL) + printf("*** ERROR from ANid2tagref\n"); + printf("Annotation index %d: tag = %s\nreference number= %d\n", index, + ann_tag == DFTAG_DIA ? "DFTAG_DIA (data description)" : "Incorrect", ann_ref); + } /* for */ + } /* for */ - /* - * Terminate access to the AN interface and close the HDF file. - */ - status_32 = ANend(an_id); - } - status_n = Hclose(file_id); - } - if (ret_val == SUCCEED) - printf("\nSuccessful!\n"); - return ret_val; + /* + * Get and display an annotation type from an annotation tag. + */ + annot_type = ANtag2atype(DFTAG_FID); + printf("\nAnnotation type of DFTAG_FID (file label) is %s\n", + annot_type == AN_FILE_LABEL ? "AN_FILE_LABEL" : "Incorrect"); + + /* + * Get and display an annotation tag from an annotation type. + */ + ann_tag = ANatype2tag(AN_DATA_LABEL); + printf("\nAnnotation tag of AN_DATA_LABEL is %s\n", + ann_tag == DFTAG_DIL ? "DFTAG_DIL (data label)" : "Incorrect"); + + /* + * Terminate access to the AN interface and close the HDF file. + */ + if (ANend(an_id) == FAIL) + printf("*** ERROR from ANend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + + /* + * Free the space allocated for the annotation identifier list. + */ + free(ann_list); + return 0; } diff --git a/HDF4Examples/C/AN/h4ex_AN_read_annotation.c b/HDF4Examples/C/AN/h4ex_AN_read_annotation.c index f0e072b4b8..a107d61be4 100644 --- a/HDF4Examples/C/AN/h4ex_AN_read_annotation.c +++ b/HDF4Examples/C/AN/h4ex_AN_read_annotation.c @@ -7,118 +7,91 @@ main() { /************************* Variable declaration **************************/ - intn status_n; /* returned status for functions returning an intn */ - int32 status_32; /* returned status for functions returning an int32 */ - int32 file_id; /* HDF file identifier */ - int32 an_id; /* AN interface identifier */ - int32 ann_id; /* an annotation identifier */ - int32 index; /* position of an annotation in all of the same type*/ - int32 ann_length; /* length of the text in an annotation */ - int32 n_file_labels; - int32 n_file_descs; - int32 n_data_labels; - int32 n_data_descs; + int32 file_id, /* HDF file identifier */ + an_id, /* AN interface identifier */ + ann_id, /* an annotation identifier */ + index, /* position of an annotation in all of the same type*/ + ann_length, /* length of the text in an annotation */ + n_file_labels, n_file_descs, n_data_labels, n_data_descs; char *ann_buf; /* buffer to hold the read annotation */ - int ret_val = FAIL; /********************** End of variable declaration **********************/ /* * Open the HDF file. */ - file_id = Hopen(FILE_NAME, DFACC_READ, 0); - if (file_id == FAIL) - printf("\nUnable to open file %s for reading.\n", FILE_NAME); - else { + if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); + + /* + * Initialize the AN interface. + */ + if ((an_id = ANstart(file_id)) == FAIL) + printf("*** ERROR from ANstart\n"); + + /* + * Get the annotation information, e.g., the numbers of file labels, file + * descriptions, data labels, and data descriptions. + */ + if (ANfileinfo(an_id, &n_file_labels, &n_file_descs, &n_data_labels, &n_data_descs) == FAIL) + printf("*** ERROR from ANfileinfo\n"); + + /* + * Get the data labels. Note that this for loop can be used to + * obtain the contents of each kind of annotation with the appropriate + * number of annotations and the type of annotation, i.e., replace + * n_data_labels with n_file_labels, n_file_descs, or n_data_descs, and + * AN_DATA_LABEL with AN_FILE_LABEL, AN_FILE_DESC, or AN_DATA_DESC, + * respectively. + */ + for (index = 0; index < n_data_labels; index++) { /* - * Initialize the AN interface. + * Get the identifier of the current data label. */ - an_id = ANstart(file_id); - if (an_id == FAIL) - printf("\nCannot start annotation handling on the file %s.\n", FILE_NAME); - else { - /* - * Get the annotation information, e.g., the numbers of file labels, file - * descriptions, data labels, and data descriptions. - */ - status_n = ANfileinfo(an_id, &n_file_labels, &n_file_descs, &n_data_labels, &n_data_descs); - if (status_n == FAIL) - printf("\nCould not get the annotation information\n"); - else { - /* - * Get the data labels. Note that this for loop can be used to - * obtain the contents of each kind of annotation with the appropriate - * number of annotations and the type of annotation, i.e., replace - * n_data_labels with n_file_labels, n_file_descs, or n_data_descs, and - * AN_DATA_LABEL with AN_FILE_LABEL, AN_FILE_DESC, or AN_DATA_DESC, - * respectively. - */ - ret_val = SUCCEED; - for (index = 0; index < n_data_labels; index++) { - /* - * Get the identifier of the current data label. - */ - ann_id = ANselect(an_id, index, AN_DATA_LABEL); - if (ann_id == FAIL) { - printf("\nCannot get the identifier of the current data label.\n"); - ret_val = FAIL; - } - else { - /* - * Get the length of the data label. - */ - ann_length = ANannlen(ann_id); - if (ann_id == FAIL) { - printf("\nCannot read annotation length.\n"); - ret_val = FAIL; - } - else { - /* - * Allocate space for the buffer to hold the data label text. - */ - ann_buf = malloc((ann_length + 1) * sizeof(char)); - if (ann_buf) { - /* - * Read and display the data label. Note that the size of the buffer, - * i.e., the third parameter, is 1 character more than the length of - * the data label; that is for the null character. It is not the case - * when a description is retrieved because the description does not - * necessarily end with a null character. - * - */ - status_32 = ANreadann(ann_id, ann_buf, ann_length + 1); - if (status_32 == FAIL) { - printf("\nCannot read annotation.\n"); - ret_val = FAIL; - } - else { - printf("Data label index: %d\n", index); - printf("Data label contents: %s\n", ann_buf); - } - /* - * Free the space allocated for the annotation buffer. - */ - free(ann_buf); - } - else { - printf("\nAllocation failure\n"); - } - } - /* - * Terminate access to the current data label. - */ - status_n = ANendaccess(ann_id); - } - } /* for */ - } - /* - * Terminate access to the AN interface and close the HDF file. - */ - status_32 = ANend(an_id); - } - status_n = Hclose(file_id); + if ((ann_id = ANselect(an_id, index, AN_DATA_LABEL)) == FAIL) + printf("*** ERROR from ANselect\n"); + + /* + * Get the length of the data label. + */ + ann_length = ANannlen(ann_id); + + /* + * Allocate space for the buffer to hold the data label text. + */ + ann_buf = malloc((ann_length + 1) * sizeof(char)); + + /* + * Read and display the data label. Note that the size of the buffer, + * i.e., the third parameter, is 1 character more than the length of + * the data label; that is for the null character. It is not the case + * when a description is retrieved because the description does not + * necessarily end with a null character. + * + */ + if (ANreadann(ann_id, ann_buf, ann_length + 1) == FAIL) + printf("*** ERROR from ANreadann\n"); + printf("Data label index: %d\n", index); + printf("Data label contents: %s\n", ann_buf); + + /* + * Terminate access to the current data label. + */ + if (ANendaccess(ann_id) == FAIL) + printf("*** ERROR from ANendaccess\n"); + + /* + * Free the space allocated for the annotation buffer. + */ + free(ann_buf); } - if (ret_val == SUCCEED) - printf("\nSuccessful!\n"); - return ret_val; + + /* + * Terminate access to the AN interface and close the HDF file. + */ + if (ANend(an_id) == FAIL) + printf("*** ERROR from ANend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/AN/testfiles/h4ex_AN_create_annotation.tst b/HDF4Examples/C/AN/testfiles/h4ex_AN_create_annotation.tst index 04cdffc985..e69de29bb2 100644 --- a/HDF4Examples/C/AN/testfiles/h4ex_AN_create_annotation.tst +++ b/HDF4Examples/C/AN/testfiles/h4ex_AN_create_annotation.tst @@ -1,2 +0,0 @@ - -Successful! diff --git a/HDF4Examples/C/AN/testfiles/h4ex_AN_get_annotation_info.tst b/HDF4Examples/C/AN/testfiles/h4ex_AN_get_annotation_info.tst index 39cec6f697..3b30724349 100644 --- a/HDF4Examples/C/AN/testfiles/h4ex_AN_get_annotation_info.tst +++ b/HDF4Examples/C/AN/testfiles/h4ex_AN_get_annotation_info.tst @@ -5,5 +5,3 @@ reference number= 1 Annotation type of DFTAG_FID (file label) is AN_FILE_LABEL Annotation tag of AN_DATA_LABEL is DFTAG_DIL (data label) - -Successful! diff --git a/HDF4Examples/C/AN/testfiles/h4ex_AN_read_annotation.tst b/HDF4Examples/C/AN/testfiles/h4ex_AN_read_annotation.tst index d2e9202f27..ae02cae604 100644 --- a/HDF4Examples/C/AN/testfiles/h4ex_AN_read_annotation.tst +++ b/HDF4Examples/C/AN/testfiles/h4ex_AN_read_annotation.tst @@ -1,4 +1,2 @@ Data label index: 0 Data label contents: Common AN Vgroup - -Successful! diff --git a/hdf/examples/GR_read_chunks.c b/HDF4Examples/C/GR/GR_read_chunks.c similarity index 100% rename from hdf/examples/GR_read_chunks.c rename to HDF4Examples/C/GR/GR_read_chunks.c diff --git a/hdf/examples/GR_write_chunks.c b/HDF4Examples/C/GR/GR_write_chunks.c similarity index 100% rename from hdf/examples/GR_write_chunks.c rename to HDF4Examples/C/GR/GR_write_chunks.c diff --git a/HDF4Examples/C/GR/h4ex_GR_create_and_write_chunked_image.c b/HDF4Examples/C/GR/h4ex_GR_create_and_write_chunked_image.c index 3d6b40359f..fe4d13f274 100644 --- a/HDF4Examples/C/GR/h4ex_GR_create_and_write_chunked_image.c +++ b/HDF4Examples/C/GR/h4ex_GR_create_and_write_chunked_image.c @@ -9,7 +9,6 @@ int main() { /************************* Variable declaration **************************/ - intn status; /* status for functions returning an intn */ int32 file_id, /* HDF file identifier */ gr_id, /* GR interface identifier */ ri_id, /* raster image identifier */ @@ -23,14 +22,19 @@ main() int32 chunk14[] = {1010, 1011, 1012, 1020, 1021, 1022, 1030, 1031, 1032, 1040, 1041, 1042, 1050, 1051, 1052, 1060, 1061, 1062}; /********************** End of variable declaration **********************/ + /* * Create and open the file. */ - file_id = Hopen(FILE_NAME, DFACC_CREATE, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_CREATE, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); + /* * Initialize the GR interface. */ - gr_id = GRstart(file_id); + if ((gr_id = GRstart(file_id)) == FAIL) + printf("*** ERROR from GRstart\n"); + /* * Set dimensions of the image. */ @@ -39,7 +43,9 @@ main() /* * Create the raster image array. */ - ri_id = GRcreate(gr_id, IMAGE_NAME, NCOMPS, DFNT_INT32, MFGR_INTERLACE_PIXEL, dims); + if ((ri_id = GRcreate(gr_id, IMAGE_NAME, NCOMPS, DFNT_INT32, MFGR_INTERLACE_PIXEL, dims)) == FAIL) + printf("*** ERROR from GRcreate\n"); + /* * Define chunked image. */ @@ -47,30 +53,38 @@ main() chunk_def.comp.cinfo.deflate.level = 6; chunk_def.comp.chunk_lengths[0] = 3; chunk_def.comp.chunk_lengths[1] = 2; - status = GRsetchunk(ri_id, chunk_def, HDF_CHUNK | HDF_COMP); + if (GRsetchunk(ri_id, chunk_def, HDF_CHUNK | HDF_COMP) == FAIL) + printf("*** ERROR from GRsetchunk\n"); /* * Write first chunk (0,0). */ start[0] = 0; start[1] = 0; - status = GRwritechunk(ri_id, start, (VOIDP)chunk00); + if (GRwritechunk(ri_id, start, (void *)chunk00) == FAIL) + printf("*** ERROR from GRwritechunk\n"); /* * Write second chunk (0,1). */ start[0] = 0; start[1] = 1; - status = GRwritechunk(ri_id, start, (VOIDP)chunk01); + if (GRwritechunk(ri_id, start, (void *)chunk01) == FAIL) + printf("*** ERROR from GRwritechunk\n"); /* * Write third chunk (1,4). */ start[0] = 1; start[1] = 4; - status = GRwritechunk(ri_id, start, (VOIDP)chunk14); + if (GRwritechunk(ri_id, start, (void *)chunk14) == FAIL) + printf("*** ERROR from GRwritechunk\n"); /* * Terminate access to the raster image and to the GR interface and, * close the HDF file. */ - status = GRendaccess(ri_id); - status = GRend(gr_id); - status = Hclose(file_id); + if (GRendaccess(ri_id) == FAIL) + printf("*** ERROR from GRendaccess\n"); + if (GRend(gr_id) == FAIL) + printf("*** ERROR from GRend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/GR/h4ex_GR_create_and_write_image.c b/HDF4Examples/C/GR/h4ex_GR_create_and_write_image.c index 06a34c0540..5b2f154050 100644 --- a/HDF4Examples/C/GR/h4ex_GR_create_and_write_image.c +++ b/HDF4Examples/C/GR/h4ex_GR_create_and_write_image.c @@ -11,7 +11,6 @@ main() { /************************* Variable declaration **************************/ - intn status; /* status for functions returning an intn */ int32 file_id, /* HDF file identifier */ gr_id, /* GR interface identifier */ ri_id, /* raster image identifier */ @@ -29,12 +28,14 @@ main() /* * Create and open the file. */ - file_id = Hopen(FILE_NAME, DFACC_CREATE, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_CREATE, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the GR interface. */ - gr_id = GRstart(file_id); + if ((gr_id = GRstart(file_id)) == FAIL) + printf("*** ERROR from GRstart\n"); /* * Set the data type, interlace mode, and dimensions of the image. @@ -47,15 +48,16 @@ main() /* * Create the raster image array. */ - ri_id = GRcreate(gr_id, IMAGE_NAME, N_COMPS, data_type, interlace_mode, dim_sizes); + if ((ri_id = GRcreate(gr_id, IMAGE_NAME, N_COMPS, data_type, interlace_mode, dim_sizes)) == FAIL) + printf("*** ERROR from GRcreate\n"); /* * Fill the image data buffer with values. */ for (i = 0; i < Y_LENGTH; i++) { for (j = 0; j < X_LENGTH; j++) { - image_buf[i][j][0] = (int16)(i + j) + 1; /* first component */ - image_buf[i][j][1] = (int16)(i + j) + 1; /* second component */ + image_buf[i][j][0] = (i + j) + 1; /* first component */ + image_buf[i][j][1] = (i + j) + 1; /* second component */ } } @@ -70,15 +72,18 @@ main() /* * Write the data in the buffer into the image array. */ - status = GRwriteimage(ri_id, start, NULL, edges, (VOIDP)image_buf); + if (GRwriteimage(ri_id, start, NULL, edges, (void *)image_buf) == FAIL) + printf("*** ERROR from GRwriteimage\n"); /* * Terminate access to the raster image and to the GR interface and, * close the HDF file. */ - status = GRendaccess(ri_id); - status = GRend(gr_id); - status = Hclose(file_id); - printf("GR_create_and_write_image.c done\n"); + if (GRendaccess(ri_id) == FAIL) + printf("*** ERROR from GRendaccess\n"); + if (GRend(gr_id) == FAIL) + printf("*** ERROR from GRend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); return 0; } diff --git a/HDF4Examples/C/GR/h4ex_GR_get_attribute.c b/HDF4Examples/C/GR/h4ex_GR_get_attribute.c index 69584c56ed..809699b5be 100644 --- a/HDF4Examples/C/GR/h4ex_GR_get_attribute.c +++ b/HDF4Examples/C/GR/h4ex_GR_get_attribute.c @@ -8,41 +8,45 @@ main() { /************************* Variable declaration **************************/ - intn status; /* status for functions returning an intn */ - int32 gr_id, ri_id, file_id, f_att_index, /* index of file attributes */ - ri_att_index, /* index of raster image attributes */ - data_type, /* image data type */ - n_values, /* number of values in an attribute */ - value_index, /* index of values in an attribute */ - n_rimages, /* number of raster images in the file */ - n_file_attrs; /* number of file attributes */ - char attr_name[H4_MAX_GR_NAME]; /* buffer to hold the attribute name */ - VOIDP data_buf; /* buffer to hold the attribute values */ - int16 *int_ptr; /* int16 pointer to point to a void data buffer */ - char8 *char_ptr; /* char8 pointer to point to a void data buffer */ + int32 gr_id, ri_id, file_id; + int32 f_att_index; /* index of file attributes */ + int32 ri_att_index; /* index of raster image attributes */ + int32 data_type; /* image data type */ + int32 n_values; /* number of values in an attribute */ + int32 value_index; /* index of values in an attribute */ + int32 n_rimages; /* number of raster images in the file */ + int32 n_file_attrs; /* number of file attributes */ + char attr_name[H4_MAX_GR_NAME]; /* buffer to hold the attribute name */ + void *data_buf = NULL; /* buffer to hold the attribute values */ + int16 *int_ptr; /* int16 pointer to point to a void data buffer */ + char8 *char_ptr; /* char8 pointer to point to a void data buffer */ /********************** End of variable declaration **********************/ /* * Open the HDF file. */ - file_id = Hopen(FILE_NAME, DFACC_READ, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the GR interface. */ - gr_id = GRstart(file_id); + if ((gr_id = GRstart(file_id)) == FAIL) + printf("*** ERROR from GRstart\n"); /* * Determine the number of attributes in the file. */ - status = GRfileinfo(gr_id, &n_rimages, &n_file_attrs); - if (status != FAIL && n_file_attrs > 0) { + if (GRfileinfo(gr_id, &n_rimages, &n_file_attrs) == FAIL) + printf("*** ERROR from GRfileinfo\n"); + else if (n_file_attrs > 0) { for (f_att_index = 0; f_att_index < n_file_attrs; f_att_index++) { /* * Get information about the current file attribute. */ - status = GRattrinfo(gr_id, f_att_index, attr_name, &data_type, &n_values); + if (GRattrinfo(gr_id, f_att_index, attr_name, &data_type, &n_values) == FAIL) + printf("*** ERROR from GRattrinfo\n"); /* * Allocate a buffer to hold the file attribute data. In this example, @@ -66,7 +70,8 @@ main() /* * Read and display the attribute values. */ - status = GRgetattr(gr_id, f_att_index, (VOIDP)data_buf); + if (GRgetattr(gr_id, f_att_index, (void *)data_buf) == FAIL) + printf("*** ERROR from GRgetattr\n"); char_ptr = (char8 *)data_buf; printf("Attribute %s: ", attr_name); @@ -86,17 +91,20 @@ main() /* * Select the second image in the file. */ - ri_id = GRselect(gr_id, 1); + if ((ri_id = GRselect(gr_id, 1)) == FAIL) + printf("*** ERROR from GRselect\n"); /* * Find the image attribute named RI_ATTR_NAME. */ - ri_att_index = GRfindattr(ri_id, RI_ATTR_NAME); + if ((ri_att_index = GRfindattr(ri_id, RI_ATTR_NAME)) == FAIL) + printf("*** ERROR from GRfindattr\n"); /* * Get information about the attribute. */ - status = GRattrinfo(ri_id, ri_att_index, attr_name, &data_type, &n_values); + if (GRattrinfo(ri_id, ri_att_index, attr_name, &data_type, &n_values) == FAIL) + printf("*** ERROR from GRattrinfo\n"); /* * Allocate a buffer to hold the file attribute data. As mentioned above, @@ -110,7 +118,8 @@ main() /* * Read and display the attribute values. */ - status = GRgetattr(ri_id, ri_att_index, (VOIDP)data_buf); + if (GRgetattr(ri_id, ri_att_index, (void *)data_buf) == FAIL) + printf("*** ERROR from GRgetattr\n"); printf("\nAttribute %s: ", RI_ATTR_NAME); int_ptr = (int16 *)data_buf; @@ -128,8 +137,12 @@ main() * close the file. */ - status = GRendaccess(ri_id); - status = GRend(gr_id); - status = Hclose(file_id); + if (GRendaccess(ri_id) == FAIL) + printf("*** ERROR from GRendaccess\n"); + if (GRend(gr_id) == FAIL) + printf("*** ERROR from GRend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/GR/h4ex_GR_image_info.c b/HDF4Examples/C/GR/h4ex_GR_image_info.c index c7a86e1ee0..ce75971ef1 100644 --- a/HDF4Examples/C/GR/h4ex_GR_image_info.c +++ b/HDF4Examples/C/GR/h4ex_GR_image_info.c @@ -7,35 +7,38 @@ main() { /************************* Variable declaration **************************/ - intn status; /* status for functions returning an intn */ - int32 file_id, gr_id, ri_id, n_rimages, /* number of raster images in the file */ - n_file_attrs, /* number of file attributes */ - ri_index, /* index of a image */ - dim_sizes[2], /* dimensions of an image */ - n_comps, /* number of components an image contains */ - interlace_mode, /* interlace mode of an image */ - data_type, /* number type of an image */ - n_attrs; /* number of attributes belong to an image */ - char name[H4_MAX_GR_NAME], /* name of an image */ - *type_string, /* mapped text of a number type */ - *interlace_string; /* mapped text of an interlace mode */ + int32 file_id, gr_id, ri_id; + int32 n_rimages, /* number of raster images in the file */ + n_file_attrs, /* number of file attributes */ + ri_index, /* index of a image */ + dim_sizes[2], /* dimensions of an image */ + n_comps, /* number of components an image contains */ + interlace_mode, /* interlace mode of an image */ + data_type, /* number type of an image */ + n_attrs; /* number of attributes belong to an image */ + char name[H4_MAX_GR_NAME], /* name of an image */ + *type_string, /* mapped text of a number type */ + *interlace_string; /* mapped text of an interlace mode */ /********************** End of variable declaration **********************/ /* * Open the file for reading. */ - file_id = Hopen(FILE_NAME, DFACC_READ, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the GR interface. */ - gr_id = GRstart(file_id); + if ((gr_id = GRstart(file_id)) == FAIL) + printf("*** ERROR from GRstart\n"); /* * Determine the contents of the file. */ - status = GRfileinfo(gr_id, &n_rimages, &n_file_attrs); + if (GRfileinfo(gr_id, &n_rimages, &n_file_attrs) == FAIL) + printf("*** ERROR from GRfileinfo\n"); /* * For each image in the file, get and display the image information. @@ -43,8 +46,9 @@ main() printf("RI# Name Components Type Interlace \ Dimensions Attributes\n\n"); for (ri_index = 0; ri_index < n_rimages; ri_index++) { - ri_id = GRselect(gr_id, ri_index); - status = GRgetiminfo(ri_id, name, &n_comps, &data_type, &interlace_mode, dim_sizes, &n_attrs); + ri_id = GRselect(gr_id, ri_index); + if (GRgetiminfo(ri_id, name, &n_comps, &data_type, &interlace_mode, dim_sizes, &n_attrs) == FAIL) + printf("*** ERROR from GRgetiminfo\n"); /* * Map the number type and interlace mode into text strings for output * readability. Note that, in this example, only two possible types @@ -84,13 +88,17 @@ main() /* * Terminate access to the current raster image. */ - status = GRendaccess(ri_id); + if (GRendaccess(ri_id) == FAIL) + printf("*** ERROR from GRendaccess\n"); } /* * Terminate access to the GR interface and close the HDF file. */ - status = GRend(gr_id); - status = Hclose(file_id); + if (GRend(gr_id) == FAIL) + printf("*** ERROR from GRend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/GR/h4ex_GR_modify_image.c b/HDF4Examples/C/GR/h4ex_GR_modify_image.c index 8953dafbd4..54e01c5be2 100644 --- a/HDF4Examples/C/GR/h4ex_GR_modify_image.c +++ b/HDF4Examples/C/GR/h4ex_GR_modify_image.c @@ -1,12 +1,8 @@ #include "hdf.h" -#define FILE_NAME "General_RImages2.hdf" -#define X1_LENGTH \ - 5 /* number of columns in the first image \ - being modified */ -#define Y1_LENGTH \ - 2 /* number of rows in the first image \ - being modified */ +#define FILE_NAME "General_RImages2.hdf" +#define X1_LENGTH 5 /* number of columns in the first image being modified */ +#define Y1_LENGTH 2 /* number of rows in the first image being modified */ #define N1_COMPS 2 /* number of components in the first image */ #define IMAGE1_NAME "Image Array 1" #define IMAGE2_NAME "Image Array 2" @@ -19,21 +15,18 @@ main() { /************************* Variable declaration **************************/ - intn status; /* status for functions returning an intn */ - int32 file_id, /* HDF file identifier */ - gr_id, /* GR interface identifier */ - ri1_id, /* raster image identifier */ - start1[2], /* start position to write for each dimension */ - edges1[2], /* number of elements to be written along - each dimension */ - ri2_id, /* raster image identifier */ - start2[2], /* start position to write for each dimension */ - edges2[2], /* number of elements to be written along - each dimension */ - dims_sizes[2], /* sizes of the two dimensions of the image array */ - data_type, /* data type of the image data */ - interlace_mode; /* interlace mode of the image */ - int16 i, j; /* indices for the dimensions */ + int32 file_id, /* HDF file identifier */ + gr_id, /* GR interface identifier */ + ri1_id, /* raster image identifier */ + start1[2], /* start position to write for each dimension */ + edges1[2], /* number of elements to be written along each dimension */ + ri2_id, /* raster image identifier */ + start2[2], /* start position to write for each dimension */ + edges2[2], /* number of elements to be written along each dimension */ + dims_sizes[2], /* sizes of the two dimensions of the image array */ + data_type, /* data type of the image data */ + interlace_mode; /* interlace mode of the image */ + int16 i, j; /* indices for the dimensions */ int16 image1_buf[Y1_LENGTH][X1_LENGTH][N1_COMPS]; /* data of first image */ char image2_buf[Y2_LENGTH][X2_LENGTH][N2_COMPS]; /* data of second image*/ @@ -42,12 +35,14 @@ main() /* * Open the HDF file for writing. */ - file_id = Hopen(FILE_NAME, DFACC_WRITE, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_WRITE, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the GR interface. */ - gr_id = GRstart(file_id); + if ((gr_id = GRstart(file_id)) == FAIL) + printf("*** ERROR from GRstart\n"); /* * Select the first raster image in the file. @@ -75,7 +70,8 @@ main() /* * Write the data in the buffer into the image array. */ - status = GRwriteimage(ri1_id, start1, NULL, edges1, (VOIDP)image1_buf); + if (GRwriteimage(ri1_id, start1, NULL, edges1, (void *)image1_buf) == FAIL) + printf("*** ERROR from GRwriteimage\n"); /* * Set the interlace mode and dimensions of the second image. @@ -113,15 +109,21 @@ main() /* * Write the data in the buffer into the second image array. */ - status = GRwriteimage(ri2_id, start2, NULL, edges2, (VOIDP)image2_buf); + if (GRwriteimage(ri2_id, start2, NULL, edges2, (void *)image2_buf) == FAIL) + printf("*** ERROR from GRwriteimage\n"); /* * Terminate access to the raster images and to the GR interface, and * close the HDF file. */ - status = GRendaccess(ri1_id); - status = GRendaccess(ri2_id); - status = GRend(gr_id); - status = Hclose(file_id); + if (GRendaccess(ri1_id) == FAIL) + printf("*** ERROR from GRendaccess\n"); + if (GRendaccess(ri2_id) == FAIL) + printf("*** ERROR from GRendaccess\n"); + if (GRend(gr_id) == FAIL) + printf("*** ERROR from GRend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/GR/h4ex_GR_read_image.c b/HDF4Examples/C/GR/h4ex_GR_read_image.c index 14d6d900ec..775c941157 100644 --- a/HDF4Examples/C/GR/h4ex_GR_read_image.c +++ b/HDF4Examples/C/GR/h4ex_GR_read_image.c @@ -19,12 +19,13 @@ main() { /************************* Variable declaration **************************/ - intn status; /* status for functions returning an intn */ - int32 file_id, gr_id, ri_id, start[2], /* start position to write for each dimension */ - edges[2], /* number of elements to bewritten along each dimension */ - stride[2]; /* dimension sizes of the image array */ - int16 entire_image[Y_LENGTH][X_LENGTH][N_COMPS], partial_image[PART_ROWS][PART_COLS][N_COMPS], - skipped_image[SKIP_ROWS][SKIP_COLS][N_COMPS]; + int32 file_id, gr_id, ri_id; + int32 start[2]; /* start position to write for each dimension */ + int32 edges[2]; /* number of elements to bewritten along each dimension */ + int32 stride[2]; /* number of elements to skip on each dimension */ + int16 entire_image[Y_LENGTH][X_LENGTH][N_COMPS]; + int16 partial_image[PART_ROWS][PART_COLS][N_COMPS]; + int16 skipped_image[SKIP_ROWS][SKIP_COLS][N_COMPS]; int32 i, j; /********************** End of variable declaration **********************/ @@ -32,7 +33,8 @@ main() /* * Open the HDF file for reading. */ - file_id = Hopen(FILE_NAME, DFACC_READ, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the GR interface. @@ -55,7 +57,8 @@ main() /* * Read the data from the raster image array. */ - status = GRreadimage(ri_id, start, NULL, edges, (VOIDP)entire_image); + if (GRreadimage(ri_id, start, NULL, edges, (void *)entire_image) == FAIL) + printf("*** ERROR from GRreadimage\n"); /* * Display only the first component of the image since the two components @@ -79,7 +82,8 @@ main() /* * Read a subset of the raster image array. */ - status = GRreadimage(ri_id, start, NULL, edges, (VOIDP)partial_image); + if (GRreadimage(ri_id, start, NULL, edges, (void *)partial_image) == FAIL) + printf("*** ERROR from GRreadimage\n"); /* * Display the first component of the read sample. @@ -104,7 +108,8 @@ main() /* * Read all the odd rows and even columns of the image. */ - status = GRreadimage(ri_id, start, stride, edges, (VOIDP)skipped_image); + if (GRreadimage(ri_id, start, stride, edges, (void *)skipped_image) == FAIL) + printf("*** ERROR from GRreadimage\n"); /* * Display the first component of the read sample. @@ -120,8 +125,12 @@ main() * Terminate access to the raster image and to the GR interface, and * close the HDF file. */ - status = GRendaccess(ri_id); - status = GRend(gr_id); - status = Hclose(file_id); + if (GRendaccess(ri_id) == FAIL) + printf("*** ERROR from GRendaccess\n"); + if (GRend(gr_id) == FAIL) + printf("*** ERROR from GRend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/GR/h4ex_GR_read_palette.c b/HDF4Examples/C/GR/h4ex_GR_read_palette.c index 055c18b9dc..4c26b633c2 100644 --- a/HDF4Examples/C/GR/h4ex_GR_read_palette.c +++ b/HDF4Examples/C/GR/h4ex_GR_read_palette.c @@ -9,8 +9,7 @@ main() { /************************* Variable declaration **************************/ - intn status, /* status for functions returning an intn */ - i, j; + intn i, j; int32 file_id, gr_id, ri_id, pal_id, ri_index; int32 data_type, n_comps, n_entries, interlace_mode; uint8 palette_data[N_ENTRIES][3]; /* static because of fixed size */ @@ -20,7 +19,8 @@ main() /* * Open the file. */ - file_id = Hopen(FILE_NAME, DFACC_READ, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initiate the GR interface. @@ -45,13 +45,15 @@ main() /* * Obtain and display information about the palette. */ - status = GRgetlutinfo(pal_id, &n_comps, &data_type, &interlace_mode, &n_entries); + if (GRgetlutinfo(pal_id, &n_comps, &data_type, &interlace_mode, &n_entries) == FAIL) + printf("*** ERROR from GRgetlutinfo\n"); printf("Palette: %d components; %d entries\n", n_comps, n_entries); /* * Read the palette data. */ - status = GRreadlut(pal_id, (VOIDP)palette_data); + if (GRreadlut(pal_id, (void *)palette_data) == FAIL) + printf("*** ERROR from GRreadlut\n"); /* * Display the palette data. Recall that HDF supports only 256 colors. @@ -73,8 +75,12 @@ main() * Terminate access to the image and to the GR interface, and * close the HDF file. */ - status = GRendaccess(ri_id); - status = GRend(gr_id); - status = Hclose(file_id); + if (GRendaccess(ri_id) == FAIL) + printf("*** ERROR from GRendaccess\n"); + if (GRend(gr_id) == FAIL) + printf("*** ERROR from GRend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/GR/h4ex_GR_set_attribute.c b/HDF4Examples/C/GR/h4ex_GR_set_attribute.c index 2a554be8f5..9f61fa9cf9 100644 --- a/HDF4Examples/C/GR/h4ex_GR_set_attribute.c +++ b/HDF4Examples/C/GR/h4ex_GR_set_attribute.c @@ -19,7 +19,6 @@ main() { /************************* Variable declaration **************************/ - intn status; /* status for functions returning an intn */ int32 gr_id, ri_id, file_id, ri_index; int16 ri_attr_2[RI_ATT2_N_VALUES] = {1, 2, 3, 4, 5, 6}; @@ -28,7 +27,8 @@ main() /* * Open the HDF file. */ - file_id = Hopen(FILE_NAME, DFACC_WRITE, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_WRITE, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the GR interface. @@ -39,9 +39,11 @@ main() * Set two file attributes to the file with names, data types, numbers of * values, and values of the attributes specified. */ - status = GRsetattr(gr_id, F_ATT1_NAME, DFNT_CHAR8, F_ATT1_N_VALUES, (VOIDP)F_ATT1_VAL); + if (GRsetattr(gr_id, F_ATT1_NAME, DFNT_CHAR8, F_ATT1_N_VALUES, (void *)F_ATT1_VAL) == FAIL) + printf("*** ERROR from GRsetattr\n"); - status = GRsetattr(gr_id, F_ATT2_NAME, DFNT_CHAR8, F_ATT2_N_VALUES, (VOIDP)F_ATT2_VAL); + if (GRsetattr(gr_id, F_ATT2_NAME, DFNT_CHAR8, F_ATT2_N_VALUES, (void *)F_ATT2_VAL) == FAIL) + printf("*** ERROR from GRsetattr\n"); /* * Obtain the index of the image named IMAGE_NAME. @@ -57,16 +59,22 @@ main() * Set two attributes to the image with names, data types, numbers of * values, and values of the attributes specified. */ - status = GRsetattr(ri_id, RI_ATT1_NAME, DFNT_CHAR8, RI_ATT1_N_VALUES, (VOIDP)RI_ATT1_VAL); + if (GRsetattr(ri_id, RI_ATT1_NAME, DFNT_CHAR8, RI_ATT1_N_VALUES, (void *)RI_ATT1_VAL) == FAIL) + printf("*** ERROR from GRsetattr\n"); - status = GRsetattr(ri_id, RI_ATT2_NAME, DFNT_INT16, RI_ATT2_N_VALUES, (VOIDP)ri_attr_2); + if (GRsetattr(ri_id, RI_ATT2_NAME, DFNT_INT16, RI_ATT2_N_VALUES, (void *)ri_attr_2) == FAIL) + printf("*** ERROR from GRsetattr\n"); /* * Terminate access to the image and to the GR interface, and close the * HDF file. */ - status = GRendaccess(ri_id); - status = GRend(gr_id); - status = Hclose(file_id); + if (GRendaccess(ri_id) == FAIL) + printf("*** ERROR from GRendaccess\n"); + if (GRend(gr_id) == FAIL) + printf("*** ERROR from GRend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/GR/h4ex_GR_write_palette.c b/HDF4Examples/C/GR/h4ex_GR_write_palette.c index 623f4f3b2c..6251c19fcd 100644 --- a/HDF4Examples/C/GR/h4ex_GR_write_palette.c +++ b/HDF4Examples/C/GR/h4ex_GR_write_palette.c @@ -2,9 +2,9 @@ #define FILE_NAME "h4ex_GR_write_palette.hdf" #define NEW_IMAGE_NAME "Image with Palette" -#define N_COMPS_IMG 2 /* number of image components */ -#define X_LENGTH 5 -#define Y_LENGTH 5 +#define N_COMPS_IMG 2 /* number of image components */ +#define X_LENGTH 5 /* number of rows in the image */ +#define Y_LENGTH 5 /* number of columns in the image */ #define N_ENTRIES 256 /* number of entries in the palette */ #define N_COMPS_PAL 3 /* number of palette's components */ @@ -13,8 +13,7 @@ main() { /************************* Variable declaration **************************/ - intn status, /* status for functions returning an intn */ - i, j; + intn i, j; int32 file_id, gr_id, ri_id, pal_id, interlace_mode, start[2], /* holds where to start to write for each dimension */ edges[2], /* holds how long to write for each dimension */ @@ -27,7 +26,8 @@ main() /* * Open the HDF file. */ - file_id = Hopen(FILE_NAME, DFACC_CREATE, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_CREATE, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the GR interface. @@ -67,7 +67,8 @@ main() /* * Write the data in the buffer into the image array. */ - status = GRwriteimage(ri_id, start, NULL, edges, (VOIDP)image_buf); + if (GRwriteimage(ri_id, start, NULL, edges, (void *)image_buf) == FAIL) + printf("*** ERROR from GRwriteimage\n"); /* * Initialize the palette to grayscale. @@ -91,14 +92,19 @@ main() /* * Write data to the palette. */ - status = GRwritelut(pal_id, N_COMPS_PAL, DFNT_UINT8, interlace_mode, N_ENTRIES, (VOIDP)palette_buf); + if (GRwritelut(pal_id, N_COMPS_PAL, DFNT_UINT8, interlace_mode, N_ENTRIES, (void *)palette_buf) == FAIL) + printf("*** ERROR from GRwritelut\n"); /* * Terminate access to the image and to the GR interface, and * close the HDF file. */ - status = GRendaccess(ri_id); - status = GRend(gr_id); - status = Hclose(file_id); + if (GRendaccess(ri_id) == FAIL) + printf("*** ERROR from GRendaccess\n"); + if (GRend(gr_id) == FAIL) + printf("*** ERROR from GRend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/GR/testfiles/h4ex_GR_create_and_write_image.tst b/HDF4Examples/C/GR/testfiles/h4ex_GR_create_and_write_image.tst index 8ddec3815d..e69de29bb2 100644 --- a/HDF4Examples/C/GR/testfiles/h4ex_GR_create_and_write_image.tst +++ b/HDF4Examples/C/GR/testfiles/h4ex_GR_create_and_write_image.tst @@ -1 +0,0 @@ -GR_create_and_write_image.c done diff --git a/HDF4Examples/C/SD/h4ex_SD_alter_sds_values.c b/HDF4Examples/C/SD/h4ex_SD_alter_sds_values.c index 97e7a45fbf..893f9f2e0e 100644 --- a/HDF4Examples/C/SD/h4ex_SD_alter_sds_values.c +++ b/HDF4Examples/C/SD/h4ex_SD_alter_sds_values.c @@ -8,7 +8,6 @@ main() /************************* Variable declaration **************************/ int32 sd_id, sds_id, sds_index; - intn status; int32 start[2], edges[2]; int32 new_data[2]; @@ -16,7 +15,8 @@ main() /* * Open the file and initialize the SD interface with write access. */ - sd_id = SDstart(FILE_NAME, DFACC_WRITE); + if ((sd_id = SDstart(FILE_NAME, DFACC_WRITE)) == FAIL) + printf("*** ERROR from SDstart\n"); /* * Select the first data set. @@ -41,17 +41,20 @@ main() /* * Write the new values. */ - status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)new_data); + if (SDwritedata(sds_id, start, NULL, edges, (void *)new_data) == FAIL) + printf("*** ERROR from SDwritedata\n"); /* * Terminate access to the data set. */ - status = SDendaccess(sds_id); + if (SDendaccess(sds_id) == FAIL) + printf("*** ERROR from SDendaccess\n"); /* * Terminate access to the SD interface and close the file. */ - status = SDend(sd_id); + if (SDend(sd_id) == FAIL) + printf("*** ERROR from SDend\n"); return 0; } diff --git a/HDF4Examples/C/SD/h4ex_SD_chunking_example.c b/HDF4Examples/C/SD/h4ex_SD_chunking_example.c index 3cce2410e6..9bc43bc1f5 100755 --- a/HDF4Examples/C/SD/h4ex_SD_chunking_example.c +++ b/HDF4Examples/C/SD/h4ex_SD_chunking_example.c @@ -10,8 +10,7 @@ main() /************************* Variable declaration **************************/ int32 sd_id, sds_id, sds_index; - intn status; - int32 flag, maxcache, new_maxcache; + int32 flag, maxcache; int32 dim_sizes[2], origin[2]; HDF_CHUNK_DEF c_def, c_def_out; /* Chunking definitions */ int32 comp_flag, c_flags; @@ -25,13 +24,13 @@ main() /* * Declare chunks data type and initialize some of them. */ - int16 chunk1[3][2] = {1, 1, 1, 1, 1, 1}; + int16 chunk1[3][2] = {{1, 1}, {1, 1}, {1, 1}}; - int16 chunk2[3][2] = {2, 2, 2, 2, 2, 2}; + int16 chunk2[3][2] = {{2, 2}, {2, 2}, {2, 2}}; - int16 chunk3[3][2] = {3, 3, 3, 3, 3, 3}; + int16 chunk3[3][2] = {{3, 3}, {3, 3}, {3, 3}}; - int16 chunk6[3][2] = {6, 6, 6, 6, 6, 6}; + int16 chunk6[3][2] = {{6, 6}, {6, 6}, {6, 6}}; /********************* End of variable declaration ***********************/ /* @@ -56,7 +55,8 @@ main() /* * Create the file and initialize SD interface. */ - sd_id = SDstart(FILE_NAME, DFACC_CREATE); + if ((sd_id = SDstart(FILE_NAME, DFACC_CREATE)) == FAIL) + printf("*** ERROR from SDstart\n"); /* * Create 9x4 SDS. @@ -68,7 +68,8 @@ main() /* * Fill the SDS array with the fill value. */ - status = SDsetfillvalue(sds_id, (VOIDP)&fill_value); + if (SDsetfillvalue(sds_id, (void *)&fill_value) == FAIL) + printf("*** ERROR from SDsetfillvalue\n"); /* * Create chunked SDS. @@ -104,14 +105,15 @@ main() * c_def.nbit.fill_one = value4; */ comp_flag = HDF_CHUNK; - status = SDsetchunk(sds_id, c_def, comp_flag); + if (SDsetchunk(sds_id, c_def, comp_flag) == FAIL) + printf("*** ERROR from SDsetchunk\n"); /* * Set chunk cache to hold maximum of 3 chunks. */ - maxcache = 3; - flag = 0; - new_maxcache = SDsetchunkcache(sds_id, maxcache, flag); + maxcache = 3; + flag = 0; + SDsetchunkcache(sds_id, maxcache, flag); /* * Write chunks using SDwritechunk function. @@ -123,21 +125,24 @@ main() */ origin[0] = 0; origin[1] = 0; - status = SDwritechunk(sds_id, origin, (VOIDP)chunk1); + if (SDwritechunk(sds_id, origin, (void *)chunk1) == FAIL) + printf("*** ERROR from SDwritechunk\n"); /* * Write the chunk with the coordinates (1,0). */ origin[0] = 1; origin[1] = 0; - status = SDwritechunk(sds_id, origin, (VOIDP)chunk3); + if (SDwritechunk(sds_id, origin, (void *)chunk3) == FAIL) + printf("*** ERROR from SDwritechunk\n"); /* * Write the chunk with the coordinates (0,1). */ origin[0] = 0; origin[1] = 1; - status = SDwritechunk(sds_id, origin, (VOIDP)chunk2); + if (SDwritechunk(sds_id, origin, (void *)chunk2) == FAIL) + printf("*** ERROR from SDwritechunk\n"); /* * Write chunk with the coordinates (1,2) using @@ -147,7 +152,8 @@ main() start[1] = 2; edges[0] = 3; edges[1] = 2; - status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)chunk6); + if (SDwritedata(sds_id, start, NULL, edges, (void *)chunk6) == FAIL) + printf("*** ERROR from SDwritedata\n"); /* * Fill second column in the chunk with the coordinates (1,1) @@ -157,7 +163,8 @@ main() start[1] = 3; edges[0] = 3; edges[1] = 1; - status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)column); + if (SDwritedata(sds_id, start, NULL, edges, (void *)column) == FAIL) + printf("*** ERROR from SDwritedata\n"); /* * Fill second row in the chunk with the coordinates (0,2) @@ -167,17 +174,20 @@ main() start[1] = 0; edges[0] = 1; edges[1] = 2; - status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)row); + if (SDwritedata(sds_id, start, NULL, edges, (void *)row) == FAIL) + printf("*** ERROR from SDwritedata\n"); /* * Terminate access to the data set. */ - status = SDendaccess(sds_id); + if (SDendaccess(sds_id) == FAIL) + printf("*** ERROR from SDendaccess\n"); /* * Terminate access to the SD interface and close the file. */ - status = SDend(sd_id); + if (SDend(sd_id) == FAIL) + printf("*** ERROR from SDend\n"); /* * Reopen the file and access the first data set. @@ -191,7 +201,8 @@ main() * flag can be returned. Compression information is not available if * NBIT, Skipping Huffman, or GZIP compression is used. */ - status = SDgetchunkinfo(sds_id, &c_def_out, &c_flags); + if (SDgetchunkinfo(sds_id, &c_def_out, &c_flags) == FAIL) + printf("*** ERROR from SDgetchunkinfo\n"); if (c_flags == HDF_CHUNK) printf(" SDS is chunked\nChunk's dimensions %dx%d\n", c_def_out.chunk_lengths[0], c_def_out.chunk_lengths[1]); @@ -209,7 +220,8 @@ main() start[1] = 0; edges[0] = 9; edges[1] = 4; - status = SDreaddata(sds_id, start, NULL, edges, (VOIDP)all_data); + if (SDreaddata(sds_id, start, NULL, edges, (void *)all_data) == FAIL) + printf("*** ERROR from SDreaddata\n"); /* * Print out what we have read. @@ -238,7 +250,8 @@ main() */ origin[0] = 2; origin[1] = 0; - status = SDreadchunk(sds_id, origin, chunk_out); + if (SDreadchunk(sds_id, origin, chunk_out) == FAIL) + printf("*** ERROR from SDreadchunk\n"); printf(" Chunk (2,0) \n"); for (j = 0; j < 3; j++) { for (i = 0; i < 2; i++) @@ -251,7 +264,8 @@ main() */ origin[0] = 1; origin[1] = 1; - status = SDreadchunk(sds_id, origin, chunk_out); + if (SDreadchunk(sds_id, origin, chunk_out) == FAIL) + printf("*** ERROR from SDreadchunk\n"); printf(" Chunk (1,1) \n"); for (j = 0; j < 3; j++) { for (i = 0; i < 2; i++) @@ -274,12 +288,14 @@ main() /* * Terminate access to the data set. */ - status = SDendaccess(sds_id); + if (SDendaccess(sds_id) == FAIL) + printf("*** ERROR from SDendaccess\n"); /* * Terminate access to the SD interface and close the file. */ - status = SDend(sd_id); + if (SDend(sd_id) == FAIL) + printf("*** ERROR from SDend\n"); return 0; } diff --git a/HDF4Examples/C/SD/h4ex_SD_compress_sds.c b/HDF4Examples/C/SD/h4ex_SD_compress_sds.c index 2408c1913e..0c4e7fe2b2 100644 --- a/HDF4Examples/C/SD/h4ex_SD_compress_sds.c +++ b/HDF4Examples/C/SD/h4ex_SD_compress_sds.c @@ -12,7 +12,6 @@ main() /************************* Variable declaration **************************/ int32 sd_id, sds_id; - intn status; int32 comp_type; /* Compression flag */ comp_info c_info; /* Compression structure */ int32 start[2], edges[2], dim_sizes[2]; @@ -34,7 +33,8 @@ main() /* * Create the file and initialize the SD interface. */ - sd_id = SDstart(FILE_NAME, DFACC_CREATE); + if ((sd_id = SDstart(FILE_NAME, DFACC_CREATE)) == FAIL) + printf("*** ERROR from SDstart\n"); /* * Create the data set with the name defined in SDS_NAME. @@ -55,7 +55,8 @@ main() */ comp_type = COMP_CODE_DEFLATE; c_info.deflate.level = 6; - status = SDsetcompress(sds_id, comp_type, &c_info); + if (SDsetcompress(sds_id, comp_type, &c_info) == FAIL) + printf("*** ERROR from SDsetcompress\n"); /* * Define the location and size of the data set @@ -71,17 +72,20 @@ main() * must be explicitly cast to a generic pointer since SDwritedata * is designed to write generic data. */ - status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)data); + if (SDwritedata(sds_id, start, NULL, edges, (void *)data) == FAIL) + printf("*** ERROR from SDwritedata\n"); /* * Terminate access to the data set. */ - status = SDendaccess(sds_id); + if (SDendaccess(sds_id) == FAIL) + printf("*** ERROR from SDendaccess\n"); /* * Terminate access to the SD interface and close the file. */ - status = SDend(sd_id); + if (SDend(sd_id) == FAIL) + printf("*** ERROR from SDend\n"); return 0; } diff --git a/HDF4Examples/C/SD/h4ex_SD_create_sds.c b/HDF4Examples/C/SD/h4ex_SD_create_sds.c index 2a4e1719e4..67ad60d639 100644 --- a/HDF4Examples/C/SD/h4ex_SD_create_sds.c +++ b/HDF4Examples/C/SD/h4ex_SD_create_sds.c @@ -13,15 +13,14 @@ main() int32 sd_id, sds_id; /* SD interface and data set identifiers */ int32 dim_sizes[2]; /* sizes of the SDS dimensions */ - intn status; /* status returned by some routines; has value - SUCCEED or FAIL */ /********************* End of variable declaration ***********************/ /* * Create the file and initialize the SD interface. */ - sd_id = SDstart(FILE_NAME, DFACC_CREATE); + if ((sd_id = SDstart(FILE_NAME, DFACC_CREATE)) == FAIL) + printf("*** ERROR from SDstart\n"); /* * Define the dimensions of the array to be created. @@ -40,12 +39,14 @@ main() /* * Terminate access to the data set. */ - status = SDendaccess(sds_id); + if (SDendaccess(sds_id) == FAIL) + printf("*** ERROR from SDendaccess\n"); /* * Terminate access to the SD interface and close the file. */ - status = SDend(sd_id); + if (SDend(sd_id) == FAIL) + printf("*** ERROR from SDend\n"); return 0; } diff --git a/HDF4Examples/C/SD/h4ex_SD_dimscale_vs_sds.c b/HDF4Examples/C/SD/h4ex_SD_dimscale_vs_sds.c index c1351da955..8bc71bb6d5 100644 --- a/HDF4Examples/C/SD/h4ex_SD_dimscale_vs_sds.c +++ b/HDF4Examples/C/SD/h4ex_SD_dimscale_vs_sds.c @@ -8,7 +8,6 @@ main() /************************* Variable declaration **************************/ int32 sd_id, sds_id, sds_index; - intn status; int32 rank, data_type, dim_sizes[H4_MAX_VAR_DIMS]; int32 n_datasets, n_file_attr, n_attrs; char sds_name[H4_MAX_NC_NAME]; @@ -18,12 +17,14 @@ main() /* * Open the file and initialize the SD interface. */ - sd_id = SDstart(FILE_NAME, DFACC_READ); + if ((sd_id = SDstart(FILE_NAME, DFACC_READ)) == FAIL) + printf("*** ERROR from SDstart\n"); /* * Obtain information about the file. */ - status = SDfileinfo(sd_id, &n_datasets, &n_file_attr); + if (SDfileinfo(sd_id, &n_datasets, &n_file_attr) == FAIL) + printf("*** ERROR from SDfileinfo\n"); /* Get information about each SDS in the file. * Check whether it is a coordinate variable, then display retrieved @@ -37,7 +38,8 @@ main() */ for (sds_index = 0; sds_index < n_datasets; sds_index++) { sds_id = SDselect(sd_id, sds_index); - status = SDgetinfo(sds_id, sds_name, &rank, dim_sizes, &data_type, &n_attrs); + if (SDgetinfo(sds_id, sds_name, &rank, dim_sizes, &data_type, &n_attrs) == FAIL) + printf("*** ERROR from SDgetinfo\n"); if (SDiscoordvar(sds_id)) printf(" Coordinate variable with the name %s\n", sds_name); else @@ -46,13 +48,15 @@ main() /* * Terminate access to the selected data set. */ - status = SDendaccess(sds_id); + if (SDendaccess(sds_id) == FAIL) + printf("*** ERROR from SDendaccess\n"); } /* * Terminate access to the SD interface and close the file. */ - status = SDend(sd_id); + if (SDend(sd_id) == FAIL) + printf("*** ERROR from SDend\n"); return 0; } diff --git a/HDF4Examples/C/SD/h4ex_SD_find_sds_by_name.c b/HDF4Examples/C/SD/h4ex_SD_find_sds_by_name.c index 4cd7a85023..520076be76 100644 --- a/HDF4Examples/C/SD/h4ex_SD_find_sds_by_name.c +++ b/HDF4Examples/C/SD/h4ex_SD_find_sds_by_name.c @@ -12,7 +12,6 @@ main() /************************* Variable declaration **************************/ int32 sd_id, sds_id, sds_index; - intn status; int32 start[2], edges[2]; int32 data[Y_LENGTH][X_LENGTH]; int j; @@ -22,7 +21,8 @@ main() /* * Open the file for reading and initialize the SD interface. */ - sd_id = SDstart(FILE_NAME, DFACC_READ); + if ((sd_id = SDstart(FILE_NAME, DFACC_READ)) == FAIL) + printf("*** ERROR from SDstart\n"); /* * Find index of the data set with the name specified in WRONG_NAME. @@ -53,7 +53,8 @@ main() /* * Read the entire data into the buffer named data. */ - status = SDreaddata(sds_id, start, NULL, edges, (VOIDP)data); + if (SDreaddata(sds_id, start, NULL, edges, (void *)data) == FAIL) + printf("*** ERROR from SDreaddata\n"); /* * Print 10th row; the following numbers should be displayed: @@ -67,12 +68,14 @@ main() /* * Terminate access to the data set. */ - status = SDendaccess(sds_id); + if (SDendaccess(sds_id) == FAIL) + printf("*** ERROR from SDendaccess\n"); /* * Terminate access to the SD interface and close the file. */ - status = SDend(sd_id); + if (SDend(sd_id) == FAIL) + printf("*** ERROR from SDend\n"); return 0; } diff --git a/HDF4Examples/C/SD/h4ex_SD_get_attr.c b/HDF4Examples/C/SD/h4ex_SD_get_attr.c index 0ca5c103b8..086550b41c 100644 --- a/HDF4Examples/C/SD/h4ex_SD_get_attr.c +++ b/HDF4Examples/C/SD/h4ex_SD_get_attr.c @@ -10,21 +10,18 @@ main() { /************************* Variable declaration **************************/ - int32 sd_id, sds_id, dim_id; - intn status; - int32 attr_index, data_type, n_values; - char attr_name[H4_MAX_NC_NAME]; - int8 *file_data; - int8 *dim_data; - float32 *sds_data; - int i; + int32 sd_id, sds_id, dim_id; + int32 attr_index, data_type, n_values; + char attr_name[H4_MAX_NC_NAME]; + int i; /********************* End of variable declaration ***********************/ /* * Open the file and initialize SD interface. */ - sd_id = SDstart(FILE_NAME, DFACC_READ); + if ((sd_id = SDstart(FILE_NAME, DFACC_READ)) == FAIL) + printf("*** ERROR from SDstart\n"); /* * Find the file attribute defined by FILE_ATTR_NAME. @@ -35,22 +32,31 @@ main() * Get information about the file attribute. Note that the first * parameter is an SD interface identifier. */ - status = SDattrinfo(sd_id, attr_index, attr_name, &data_type, &n_values); + if (SDattrinfo(sd_id, attr_index, attr_name, &data_type, &n_values) == FAIL) + printf("*** ERROR from SDattrinfo\n"); - /* - * Allocate a buffer to hold the attribute data. - */ - file_data = (int8 *)malloc(n_values * sizeof(data_type)); + /* The data type should be DFNT_CHAR, from SD_set_attr.c */ + if (data_type == DFNT_CHAR) { + char *fileattr_data; - /* - * Read the file attribute data. - */ - status = SDreadattr(sd_id, attr_index, file_data); + /* + * Allocate a buffer to hold the attribute data. + */ + fileattr_data = (char *)malloc((n_values + 1) * DFKNTsize(data_type)); - /* - * Print out file attribute value. - */ - printf("File attribute value is : %s\n", file_data); + /* + * Read the file attribute data. + */ + if (SDreadattr(sd_id, attr_index, fileattr_data) == FAIL) + printf("*** ERROR from SDreadattr\n"); + fileattr_data[n_values] = '\0'; + + /* + * Print out file attribute value and free buffer. + */ + printf("File attribute value is : %s\n", fileattr_data); + free(fileattr_data); + } /* * Select the first data set. @@ -66,27 +72,36 @@ main() /* * Get information about the data set attribute. */ - status = SDattrinfo(sds_id, attr_index, attr_name, &data_type, &n_values); + if (SDattrinfo(sds_id, attr_index, attr_name, &data_type, &n_values) == FAIL) + printf("*** ERROR from SDattrinfo\n"); /* - * Allocate a buffer to hold the data set attribute data. + * The data type should be DFNT_FLOAT32, from SD_set_attr.c. */ - sds_data = (float32 *)malloc(n_values * sizeof(data_type)); + if (data_type == DFNT_FLOAT32) { + float32 *sds_data; - /* - * Read the SDS attribute data. - */ - status = SDreadattr(sds_id, attr_index, sds_data); + /* + * Allocate a buffer to hold the data set attribute data. + */ + sds_data = (float32 *)malloc(n_values * DFKNTsize(data_type)); - /* - * Print out SDS attribute data type and values. - */ - if (data_type == DFNT_FLOAT32) + /* + * Read the SDS attribute data. + */ + if (SDreadattr(sds_id, attr_index, sds_data) == FAIL) + printf("*** ERROR from SDreadattr\n"); + + /* + * Print out SDS attribute data type and values and free buffer. + */ printf("SDS attribute data type is : float32\n"); - printf("SDS attribute values are : "); - for (i = 0; i < n_values; i++) - printf(" %f", sds_data[i]); - printf("\n"); + printf("SDS attribute values are : "); + for (i = 0; i < n_values; i++) + printf(" %f", sds_data[i]); + printf("\n"); + free(sds_data); + } /* * Get the identifier for the second dimension of the SDS. @@ -101,36 +116,42 @@ main() /* * Get information about the dimension attribute. */ - status = SDattrinfo(dim_id, attr_index, attr_name, &data_type, &n_values); + if (SDattrinfo(dim_id, attr_index, attr_name, &data_type, &n_values) == FAIL) + printf("*** ERROR from SDattrinfo\n"); /* - * Allocate a buffer to hold the dimension attribute data. + * The data type should be DFNT_CHAR, from SD_set_attr.c. */ - dim_data = (int8 *)malloc(n_values * sizeof(data_type)); + if (data_type == DFNT_CHAR) { + char *dimattr_data; - /* - * Read the dimension attribute data. - */ - status = SDreadattr(dim_id, attr_index, dim_data); + /* + * Allocate a buffer to hold the dimension attribute data. + */ + dimattr_data = (char *)malloc((n_values + 1) * DFKNTsize(data_type)); - /* - * Print out dimension attribute value. - */ - printf("Dimensional attribute values is : %s\n", dim_data); + /* + * Read the dimension attribute data. + */ + if (SDreadattr(dim_id, attr_index, dimattr_data) == FAIL) + printf("*** ERROR from SDreadattr\n"); + dimattr_data[n_values] = '\0'; + + /* + * Print out dimension attribute value and free buffer. + */ + printf("Dimensional attribute values is : %s\n", dimattr_data); + free(dimattr_data); + } /* * Terminate access to the data set and to the SD interface and * close the file. */ - status = SDendaccess(sds_id); - status = SDend(sd_id); - - /* - * Free all buffers. - */ - free(dim_data); - free(sds_data); - free(file_data); + if (SDendaccess(sds_id) == FAIL) + printf("*** ERROR from SDendaccess\n"); + if (SDend(sd_id) == FAIL) + printf("*** ERROR from SDend\n"); /* Output of this program is : * diff --git a/HDF4Examples/C/SD/h4ex_SD_get_info.c b/HDF4Examples/C/SD/h4ex_SD_get_info.c index dd072d0051..7ce512f545 100644 --- a/HDF4Examples/C/SD/h4ex_SD_get_info.c +++ b/HDF4Examples/C/SD/h4ex_SD_get_info.c @@ -8,7 +8,6 @@ main() /************************* Variable declaration **************************/ int32 sd_id, sds_id; - intn status; int32 n_datasets, n_file_attrs, index; int32 dim_sizes[H4_MAX_VAR_DIMS]; int32 rank, data_type, n_attrs; @@ -20,13 +19,15 @@ main() /* * Open the file and initialize the SD interface. */ - sd_id = SDstart(FILE_NAME, DFACC_READ); + if ((sd_id = SDstart(FILE_NAME, DFACC_READ)) == FAIL) + printf("*** ERROR from SDstart\n"); /* * Determine the number of data sets in the file and the number * of file attributes. */ - status = SDfileinfo(sd_id, &n_datasets, &n_file_attrs); + if (SDfileinfo(sd_id, &n_datasets, &n_file_attrs) == FAIL) + printf("*** ERROR from SDfileinfo\n"); /* * Access every data set and print its name, rank, dimension sizes, @@ -41,7 +42,8 @@ main() */ for (index = 0; index < n_datasets; index++) { sds_id = SDselect(sd_id, index); - status = SDgetinfo(sds_id, name, &rank, dim_sizes, &data_type, &n_attrs); + if (SDgetinfo(sds_id, name, &rank, dim_sizes, &data_type, &n_attrs) == FAIL) + printf("*** ERROR from SDgetinfo\n"); printf("name = %s\n", name); printf("rank = %d\n", rank); @@ -55,13 +57,15 @@ main() /* * Terminate access to the data set. */ - status = SDendaccess(sds_id); + if (SDendaccess(sds_id) == FAIL) + printf("*** ERROR from SDendaccess\n"); } /* * Terminate access to the SD interface and close the file. */ - status = SDend(sd_id); + if (SDend(sd_id) == FAIL) + printf("*** ERROR from SDend\n"); return 0; } diff --git a/HDF4Examples/C/SD/h4ex_SD_mv_sds_to_external.c b/HDF4Examples/C/SD/h4ex_SD_mv_sds_to_external.c index a12c5a50e5..3136320778 100644 --- a/HDF4Examples/C/SD/h4ex_SD_mv_sds_to_external.c +++ b/HDF4Examples/C/SD/h4ex_SD_mv_sds_to_external.c @@ -11,14 +11,14 @@ main() /************************* Variable declaration **************************/ int32 sd_id, sds_id, sds_index; - intn status; /********************* End of variable declaration ***********************/ /* * Open the file and initialize the SD interface. */ - sd_id = SDstart(FILE_NAME, DFACC_WRITE); + if ((sd_id = SDstart(FILE_NAME, DFACC_WRITE)) == FAIL) + printf("*** ERROR from SDstart\n"); /* * Select the first data set. @@ -30,13 +30,16 @@ main() * Create a file with the name EXT_FILE_NAME and move the data set * values into it, starting at byte location OFFSET. */ - status = SDsetexternalfile(sds_id, EXT_FILE_NAME, OFFSET); + if (SDsetexternalfile(sds_id, EXT_FILE_NAME, OFFSET) == FAIL) + printf("*** ERROR from SDsetexternalfile\n"); /* * Terminate access to the data set, SD interface, and file. */ - status = SDendaccess(sds_id); - status = SDend(sd_id); + if (SDendaccess(sds_id) == FAIL) + printf("*** ERROR from SDendaccess\n"); + if (SDend(sd_id) == FAIL) + printf("*** ERROR from SDend\n"); return 0; } diff --git a/HDF4Examples/C/SD/h4ex_SD_read_from_sds.c b/HDF4Examples/C/SD/h4ex_SD_read_from_sds.c index 73e707af1d..e96819a52a 100644 --- a/HDF4Examples/C/SD/h4ex_SD_read_from_sds.c +++ b/HDF4Examples/C/SD/h4ex_SD_read_from_sds.c @@ -10,7 +10,6 @@ main() /************************* Variable declaration **************************/ int32 sd_id, sds_id, sds_index; - intn status; int32 start[2], edges[2]; int32 data[Y_LENGTH][X_LENGTH]; int j; @@ -20,7 +19,8 @@ main() /* * Open the file for reading and initialize the SD interface. */ - sd_id = SDstart(FILE_NAME, DFACC_READ); + if ((sd_id = SDstart(FILE_NAME, DFACC_READ)) == FAIL) + printf("*** ERROR from SDstart\n"); /* * Select the first data set. @@ -41,7 +41,8 @@ main() /* * Read entire data into data array. */ - status = SDreaddata(sds_id, start, NULL, edges, (VOIDP)data); + if (SDreaddata(sds_id, start, NULL, edges, (void *)data) == FAIL) + printf("*** ERROR from SDreaddata\n"); /* * Print 10th row; the following numbers should be displayed. @@ -55,12 +56,14 @@ main() /* * Terminate access to the data set. */ - status = SDendaccess(sds_id); + if (SDendaccess(sds_id) == FAIL) + printf("*** ERROR from SDendaccess\n"); /* * Terminate access to the SD interface and close the file. */ - status = SDend(sd_id); + if (SDend(sd_id) == FAIL) + printf("*** ERROR from SDend\n"); return 0; } diff --git a/HDF4Examples/C/SD/h4ex_SD_read_subsets.c b/HDF4Examples/C/SD/h4ex_SD_read_subsets.c index b6f3850383..1ead1cd525 100644 --- a/HDF4Examples/C/SD/h4ex_SD_read_subsets.c +++ b/HDF4Examples/C/SD/h4ex_SD_read_subsets.c @@ -12,7 +12,6 @@ main() /************************* Variable declaration **************************/ int32 sd_id, sds_id, sds_index; - intn status; int32 start[2], edges[2], stride[2]; int32 sub1_data[SUB1_LENGTH]; int32 sub2_data[SUB2_LENGTH]; @@ -24,7 +23,8 @@ main() /* * Open the file for reading and initialize the SD interface. */ - sd_id = SDstart(FILE_NAME, DFACC_READ); + if ((sd_id = SDstart(FILE_NAME, DFACC_READ)) == FAIL) + printf("*** ERROR from SDstart\n"); /* * Select the first data set. @@ -47,7 +47,8 @@ main() /* * Read the data from the file into sub1_data array. */ - status = SDreaddata(sds_id, start, stride, edges, (VOIDP)sub1_data); + if (SDreaddata(sds_id, start, stride, edges, (void *)sub1_data) == FAIL) + printf("*** ERROR from SDreaddata\n"); /* * Print what we have just read; the following numbers should be displayed: @@ -73,7 +74,8 @@ main() * Read data from the file into sub2_data array. Note that the third * parameter is set to NULL for contiguous reading. */ - status = SDreaddata(sds_id, start, NULL, edges, (VOIDP)sub2_data); + if (SDreaddata(sds_id, start, NULL, edges, (void *)sub2_data) == FAIL) + printf("*** ERROR from SDreaddata\n"); /* * Print what we have just read; the following numbers should be displayed: @@ -103,7 +105,8 @@ main() /* * Read the data from the file into sub3_data array. */ - status = SDreaddata(sds_id, start, stride, edges, (VOIDP)sub3_data); + if (SDreaddata(sds_id, start, stride, edges, (void *)sub3_data) == FAIL) + printf("*** ERROR from SDreaddata\n"); /* * Print what we have just read; the following numbers should be displayed: @@ -120,12 +123,14 @@ main() /* * Terminate access to the data set. */ - status = SDendaccess(sds_id); + if (SDendaccess(sds_id) == FAIL) + printf("*** ERROR from SDendaccess\n"); /* * Terminate access to the SD interface and close the file. */ - status = SDend(sd_id); + if (SDend(sd_id) == FAIL) + printf("*** ERROR from SDend\n"); return 0; } diff --git a/HDF4Examples/C/SD/h4ex_SD_set_attr.c b/HDF4Examples/C/SD/h4ex_SD_set_attr.c index af38830b02..607c8bae56 100644 --- a/HDF4Examples/C/SD/h4ex_SD_set_attr.c +++ b/HDF4Examples/C/SD/h4ex_SD_set_attr.c @@ -11,7 +11,6 @@ main() /************************* Variable declaration **************************/ int32 sd_id, sds_id, sds_index; - intn status; int32 dim_id, dim_index; int32 n_values; /* number of values of the file, SDS or dimension attribute */ @@ -27,13 +26,15 @@ main() /* * Open the file and initialize the SD interface. */ - sd_id = SDstart(FILE_NAME, DFACC_WRITE); + if ((sd_id = SDstart(FILE_NAME, DFACC_WRITE)) == FAIL) + printf("*** ERROR from SDstart\n"); /* * Set an attribute that describes the file contents. */ n_values = 16; - status = SDsetattr(sd_id, FILE_ATTR_NAME, DFNT_CHAR8, n_values, (VOIDP)file_values); + if (SDsetattr(sd_id, FILE_ATTR_NAME, DFNT_CHAR, n_values, (void *)file_values) == FAIL) + printf("*** ERROR from SDsetattr\n"); /* * Select the first data set. @@ -46,7 +47,8 @@ main() * may have different data type than SDS data. */ n_values = 2; - status = SDsetattr(sds_id, SDS_ATTR_NAME, DFNT_FLOAT32, n_values, (VOIDP)sds_values); + if (SDsetattr(sds_id, SDS_ATTR_NAME, DFNT_FLOAT32, n_values, (void *)sds_values) == FAIL) + printf("*** ERROR from SDsetattr\n"); /* * Get the the second dimension identifier of the SDS. @@ -58,17 +60,20 @@ main() * Set an attribute of the dimension that specifies the dimension metric. */ n_values = 7; - status = SDsetattr(dim_id, DIM_ATTR_NAME, DFNT_CHAR8, n_values, (VOIDP)dim_values); + if (SDsetattr(dim_id, DIM_ATTR_NAME, DFNT_CHAR, n_values, (void *)dim_values) == FAIL) + printf("*** ERROR from SDsetattr\n"); /* * Terminate access to the data set. */ - status = SDendaccess(sds_id); + if (SDendaccess(sds_id) == FAIL) + printf("*** ERROR from SDendaccess\n"); /* * Terminate access to the SD interface and close the file. */ - status = SDend(sd_id); + if (SDend(sd_id) == FAIL) + printf("*** ERROR from SDend\n"); return 0; } diff --git a/HDF4Examples/C/SD/h4ex_SD_set_get_dim_info.c b/HDF4Examples/C/SD/h4ex_SD_set_get_dim_info.c index 0ec9618038..27b8db9ba2 100644 --- a/HDF4Examples/C/SD/h4ex_SD_set_get_dim_info.c +++ b/HDF4Examples/C/SD/h4ex_SD_set_get_dim_info.c @@ -15,7 +15,6 @@ main() /************************* Variable declaration **************************/ int32 sd_id, sds_id, sds_index; - intn status; int32 dim_index, dim_id; int32 n_values, data_type, n_attrs; int16 data_X[X_LENGTH]; /* X dimension dimension scale */ @@ -38,7 +37,8 @@ main() /* * Open the file and initialize SD interface. */ - sd_id = SDstart(FILE_NAME, DFACC_WRITE); + if ((sd_id = SDstart(FILE_NAME, DFACC_WRITE)) == FAIL) + printf("*** ERROR from SDstart\n"); /* * Get the index of the data set specified in SDS_NAME. @@ -67,14 +67,16 @@ main() */ switch (dim_index) { case 0: - status = SDsetdimname(dim_id, DIM_NAME_Y); + if (SDsetdimname(dim_id, DIM_NAME_Y) == FAIL) + printf("*** ERROR from SDsetdimname\n"); n_values = Y_LENGTH; - status = SDsetdimscale(dim_id, n_values, DFNT_FLOAT64, (VOIDP)data_Y); + SDsetdimscale(dim_id, n_values, DFNT_FLOAT64, (void *)data_Y); break; case 1: - status = SDsetdimname(dim_id, DIM_NAME_X); + if (SDsetdimname(dim_id, DIM_NAME_X) == FAIL) + printf("*** ERROR from SDsetdimname\n"); n_values = X_LENGTH; - status = SDsetdimscale(dim_id, n_values, DFNT_INT16, (VOIDP)data_X); + SDsetdimscale(dim_id, n_values, DFNT_INT16, (void *)data_X); break; default: break; @@ -106,7 +108,8 @@ main() * 0 1 2 3 4 */ - status = SDdiminfo(dim_id, dim_name, &n_values, &data_type, &n_attrs); + if (SDdiminfo(dim_id, dim_name, &n_values, &data_type, &n_attrs) == FAIL) + printf("*** ERROR from SDdiminfo\n"); printf("Information about %d dimension:\n", dim_index + 1); printf("dimension name is %s\n", dim_name); printf("number of scale values is %d\n", n_values); @@ -119,8 +122,9 @@ main() printf("Scale values are :\n"); switch (dim_index) { case 0: - status = SDgetdimscale(dim_id, (VOIDP)data_Y_out); - nrow = 4; + if (SDgetdimscale(dim_id, (void *)data_Y_out) == FAIL) + printf("*** ERROR from SDgetdimscale\n"); + nrow = 4; for (i = 0; i < n_values / nrow; i++) { for (j = 0; j < nrow; j++) printf(" %-6.3f", data_Y_out[i * nrow + j]); @@ -128,7 +132,8 @@ main() } break; case 1: - status = SDgetdimscale(dim_id, (VOIDP)data_X_out); + if (SDgetdimscale(dim_id, (void *)data_X_out) == FAIL) + printf("*** ERROR from SDgetdimscale\n"); for (i = 0; i < n_values; i++) printf(" %d", data_X_out[i]); break; @@ -141,12 +146,14 @@ main() /* * Terminate access to the data set. */ - status = SDendaccess(sds_id); + if (SDendaccess(sds_id) == FAIL) + printf("*** ERROR from SDendaccess\n"); /* * Terminate access to the SD interface and close the file. */ - status = SDend(sd_id); + if (SDend(sd_id) == FAIL) + printf("*** ERROR from SDend\n"); return 0; } diff --git a/HDF4Examples/C/SD/h4ex_SD_unlimited_sds.c b/HDF4Examples/C/SD/h4ex_SD_unlimited_sds.c index 05c006015c..119eeacc3c 100644 --- a/HDF4Examples/C/SD/h4ex_SD_unlimited_sds.c +++ b/HDF4Examples/C/SD/h4ex_SD_unlimited_sds.c @@ -12,7 +12,6 @@ main() /************************* Variable declaration **************************/ int32 sd_id, sds_id, sds_index; - intn status; int32 dim_sizes[2]; int32 data[Y_LENGTH][X_LENGTH], append_data[X_LENGTH]; int32 start[2], edges[2]; @@ -31,7 +30,8 @@ main() /* * Create the file and initialize the SD interface. */ - sd_id = SDstart(FILE_NAME, DFACC_CREATE); + if ((sd_id = SDstart(FILE_NAME, DFACC_CREATE)) == FAIL) + printf("*** ERROR from SDstart\n"); /* * Define dimensions of the array. Make the first dimension @@ -56,14 +56,17 @@ main() /* * Write the data. */ - status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)data); + if (SDwritedata(sds_id, start, NULL, edges, (void *)data) == FAIL) + printf("*** ERROR from SDwritedata\n"); /* * Terminate access to the array data set, terminate access * to the SD interface, and close the file. */ - status = SDendaccess(sds_id); - status = SDend(sd_id); + if (SDendaccess(sds_id) == FAIL) + printf("*** ERROR from SDendaccess\n"); + if (SDend(sd_id) == FAIL) + printf("*** ERROR from SDend\n"); /* * Store the array values to be appended to the data set. @@ -101,18 +104,21 @@ main() /* * Append data to the data set. */ - status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)append_data); + if (SDwritedata(sds_id, start, NULL, edges, (void *)append_data) == FAIL) + printf("*** ERROR from SDwritedata\n"); } /* * Terminate access to the data set. */ - status = SDendaccess(sds_id); + if (SDendaccess(sds_id) == FAIL) + printf("*** ERROR from SDendaccess\n"); /* * Terminate access to the SD interface and close the file. */ - status = SDend(sd_id); + if (SDend(sd_id) == FAIL) + printf("*** ERROR from SDend\n"); return 0; } diff --git a/HDF4Examples/C/SD/h4ex_SD_write_slab.c b/HDF4Examples/C/SD/h4ex_SD_write_slab.c index 578adfec6c..9355407880 100644 --- a/HDF4Examples/C/SD/h4ex_SD_write_slab.c +++ b/HDF4Examples/C/SD/h4ex_SD_write_slab.c @@ -13,7 +13,6 @@ main() /************************* Variable declaration **************************/ int32 sd_id, sds_id; - intn status; int32 dim_sizes[3], start[3], edges[3]; int32 data[Z_LENGTH][Y_LENGTH][X_LENGTH]; int32 zx_data[Z_LENGTH][X_LENGTH]; @@ -32,7 +31,8 @@ main() /* * Create the file and initialize the SD interface. */ - sd_id = SDstart(FILE_NAME, DFACC_CREATE); + if ((sd_id = SDstart(FILE_NAME, DFACC_CREATE)) == FAIL) + printf("*** ERROR from SDstart\n"); /* * Define dimensions of the array to be created. @@ -75,18 +75,21 @@ main() * Note that the 3rd parameter is NULL which indicates that consecutive * slabs in the Y direction are written. */ - status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)zx_data); + if (SDwritedata(sds_id, start, NULL, edges, (void *)zx_data) == FAIL) + printf("*** ERROR from SDwritedata\n"); } /* * Terminate access to the data set. */ - status = SDendaccess(sds_id); + if (SDendaccess(sds_id) == FAIL) + printf("*** ERROR from SDendaccess\n"); /* * Terminate access to the SD interface and close the file. */ - status = SDend(sd_id); + if (SDend(sd_id) == FAIL) + printf("*** ERROR from SDend\n"); return 0; } diff --git a/HDF4Examples/C/SD/h4ex_SD_write_to_sds.c b/HDF4Examples/C/SD/h4ex_SD_write_to_sds.c index ba4fa6f47b..f0317eee07 100644 --- a/HDF4Examples/C/SD/h4ex_SD_write_to_sds.c +++ b/HDF4Examples/C/SD/h4ex_SD_write_to_sds.c @@ -10,7 +10,6 @@ main() /************************* Variable declaration **************************/ int32 sd_id, sds_id, sds_index; - intn status; int32 start[2], edges[2]; int32 data[Y_LENGTH][X_LENGTH]; int i, j; @@ -28,7 +27,8 @@ main() /* * Open the file and initialize the SD interface. */ - sd_id = SDstart(FILE_NAME, DFACC_WRITE); + if ((sd_id = SDstart(FILE_NAME, DFACC_WRITE)) == FAIL) + printf("*** ERROR from SDstart\n"); /* * Attach to the first data set. @@ -50,17 +50,20 @@ main() * be explicitly cast to a generic pointer since SDwritedata is designed * to write generic data. */ - status = SDwritedata(sds_id, start, NULL, edges, (VOIDP)data); + if (SDwritedata(sds_id, start, NULL, edges, (void *)data) == FAIL) + printf("*** ERROR from SDwritedata\n"); /* * Terminate access to the data set. */ - status = SDendaccess(sds_id); + if (SDendaccess(sds_id) == FAIL) + printf("*** ERROR from SDendaccess\n"); /* * Terminate access to the SD interface and close the file. */ - status = SDend(sd_id); + if (SDend(sd_id) == FAIL) + printf("*** ERROR from SDend\n"); return 0; } diff --git a/HDF4Examples/C/VD/h4ex_VD_create_onefield_vdatas.c b/HDF4Examples/C/VD/h4ex_VD_create_onefield_vdatas.c index b3937851e9..38cfa0606f 100644 --- a/HDF4Examples/C/VD/h4ex_VD_create_onefield_vdatas.c +++ b/HDF4Examples/C/VD/h4ex_VD_create_onefield_vdatas.c @@ -17,9 +17,7 @@ main() { /************************* Variable declaration **************************/ - intn status_n; /* returned status for functions returning an intn */ - int32 status_32; /* returned status for functions returning an int32 */ - int32 file_id, vdata1_ref, vdata2_ref; + int32 file_id; /* * Define an array to buffer the data of the first vdata. @@ -37,32 +35,36 @@ main() /* * Open the HDF file for writing. */ - file_id = Hopen(FILE_NAME, DFACC_WRITE, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_WRITE, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the VS interface. */ - status_n = Vstart(file_id); + if (Vstart(file_id) == FAIL) + printf("*** ERROR from Vstart\n"); /* * Create the first vdata and populate it with data from the vdata1_buf * array. Note that the buffer vdata1_buf is cast to (uint8 *) for the * benefit of generic data type. */ - vdata1_ref = VHstoredata(file_id, FIELD1_NAME, (uint8 *)vdata1_buf, N_RECORDS_1, DFNT_CHAR8, VDATA1_NAME, - CLASS1_NAME); + VHstoredata(file_id, FIELD1_NAME, (uint8 *)vdata1_buf, N_RECORDS_1, DFNT_CHAR8, VDATA1_NAME, CLASS1_NAME); /* * Create the second vdata and populate it with data from the vdata2_buf * array. */ - vdata2_ref = VHstoredatam(file_id, FIELD2_NAME, (uint8 *)vdata2_buf, N_RECORDS_2, DFNT_INT32, VDATA2_NAME, - CLASS2_NAME, ORDER_2); + VHstoredatam(file_id, FIELD2_NAME, (uint8 *)vdata2_buf, N_RECORDS_2, DFNT_INT32, VDATA2_NAME, CLASS2_NAME, + ORDER_2); /* * Terminate access to the VS interface and close the HDF file. */ - status_n = Vend(file_id); - status_32 = Hclose(file_id); + if (Vend(file_id) == FAIL) + printf("*** ERROR from Vend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/VD/h4ex_VD_create_vdatas.c b/HDF4Examples/C/VD/h4ex_VD_create_vdatas.c index af3b803e00..7e44fd914c 100644 --- a/HDF4Examples/C/VD/h4ex_VD_create_vdatas.c +++ b/HDF4Examples/C/VD/h4ex_VD_create_vdatas.c @@ -10,9 +10,7 @@ main() { /************************* Variable declaration **************************/ - intn status_n; /* returned status for functions returning an intn */ - int32 status_32, /* returned status for functions returning an int32 */ - file1_id, file2_id, vdata_id, vdata1_id, vdata2_id, + int32 file1_id, file2_id, vdata_id, vdata1_id, vdata2_id, vdata_ref = -1; /* ref number of a vdata, set to -1 to create */ /********************** End of variable declaration **********************/ @@ -20,12 +18,14 @@ main() /* * Create the first HDF file. */ - file1_id = Hopen(FILE1_NAME, DFACC_CREATE, 0); + if ((file1_id = Hopen(FILE1_NAME, DFACC_CREATE, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the VS interface associated with the first HDF file. */ - status_n = Vstart(file1_id); + if (Vstart(file1_id) == FAIL) + printf("*** ERROR from Vstart\n"); /* * Create a vdata in the first HDF file. @@ -35,7 +35,8 @@ main() /* * Assign a name to the vdata. */ - status_32 = VSsetname(vdata_id, VDATA_NAME); + if (VSsetname(vdata_id, VDATA_NAME) == FAIL) + printf("*** ERROR from VSsetname\n"); /* * Other operations on the vdata identified by vdata_id can be carried @@ -45,12 +46,14 @@ main() /* * Create the second HDF file. */ - file2_id = Hopen(FILE2_NAME, DFACC_CREATE, 0); + if ((file2_id = Hopen(FILE2_NAME, DFACC_CREATE, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the VS interface associated with the second HDF file. */ - status_n = Vstart(file2_id); + if (Vstart(file2_id) == FAIL) + printf("*** ERROR from Vstart\n"); /* * Create the first vdata in the second HDF file. @@ -65,8 +68,10 @@ main() /* * Assign a class name to these vdatas. */ - status_32 = VSsetclass(vdata1_id, VDATA_CLASS); - status_32 = VSsetclass(vdata2_id, VDATA_CLASS); + if (VSsetclass(vdata1_id, VDATA_CLASS) == FAIL) + printf("*** ERROR from VSsetclass\n"); + if (VSsetclass(vdata2_id, VDATA_CLASS) == FAIL) + printf("*** ERROR from VSsetclass\n"); /* * Other operations on the vdatas identified by vdata1_id and vdata2_id @@ -76,12 +81,14 @@ main() /* * Terminate access to the first vdata in the second HDF file. */ - status_32 = VSdetach(vdata1_id); + if (VSdetach(vdata1_id) == FAIL) + printf("*** ERROR from VSdetach\n"); /* * Terminate access to the second vdata in the second HDF file. */ - status_32 = VSdetach(vdata2_id); + if (VSdetach(vdata2_id) == FAIL) + printf("*** ERROR from VSdetach\n"); /* * From this point on, any operations on the vdatas identified by vdata1_id @@ -91,26 +98,24 @@ main() /* * Terminate access to the VS interface associated with the second HDF file. */ - status_n = Vend(file2_id); - - /* - * Close the second HDF file. - */ - status_n = Hclose(file2_id); + if (Vend(file2_id) == FAIL) + printf("*** ERROR from Vend\n"); + if (Hclose(file2_id) == FAIL) + printf("*** ERROR from Hclose\n"); /* * Terminate access to the vdata in the first HDF file. */ - status_32 = VSdetach(vdata_id); + if (VSdetach(vdata_id) == FAIL) + printf("*** ERROR from VSdetach\n"); /* * Terminate access to the VS interface associated with the first HDF file. */ - status_n = Vend(file1_id); + if (Vend(file1_id) == FAIL) + printf("*** ERROR from Vend\n"); + if (Hclose(file1_id) == FAIL) + printf("*** ERROR from Hclose\n"); - /* - * Close the first HDF file. - */ - status_n = Hclose(file1_id); return 0; } diff --git a/HDF4Examples/C/VD/h4ex_VD_get_vdata_info.c b/HDF4Examples/C/VD/h4ex_VD_get_vdata_info.c index bfae7da1c4..9ee6678df2 100644 --- a/HDF4Examples/C/VD/h4ex_VD_get_vdata_info.c +++ b/HDF4Examples/C/VD/h4ex_VD_get_vdata_info.c @@ -8,9 +8,7 @@ main() { /************************* Variable declaration **************************/ - intn status_n; /* returned status for functions returning an intn */ - int32 status_32, /* returned status for functions returning an int32 */ - n_records, /* to retrieve the number of records in the vdata */ + int32 n_records, /* to retrieve the number of records in the vdata */ interlace_mode, /* to retrieve the interlace mode of the vdata */ vdata_size, /* to retrieve the size of all specified fields */ file_id, vdata_ref, vdata_id; @@ -22,12 +20,14 @@ main() /* * Open the HDF file for reading. */ - file_id = Hopen(FILE_NAME, DFACC_READ, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the VS interface. */ - status_n = Vstart(file_id); + if (Vstart(file_id) == FAIL) + printf("*** ERROR from Vstart\n"); /* * Set vdata_ref to -1 to start the search from the beginning of file. @@ -50,8 +50,9 @@ main() * obtain and display its information. */ if (VSisattr(vdata_id) != TRUE) { - status_n = - VSinquire(vdata_id, &n_records, &interlace_mode, fieldname_list, &vdata_size, vdata_name); + if (VSinquire(vdata_id, &n_records, &interlace_mode, fieldname_list, &vdata_size, vdata_name) == + FAIL) + printf("*** ERROR from VSinquire\n"); printf("Vdata %s: - contains %d records\n\tInterlace mode: %s \ \n\tFields: %s - %d bytes\n\t\n", vdata_name, n_records, interlace_mode == FULL_INTERLACE ? "FULL" : "NONE", fieldname_list, @@ -61,13 +62,17 @@ main() /* * Detach from the current vdata. */ - status_32 = VSdetach(vdata_id); + if (VSdetach(vdata_id) == FAIL) + printf("*** ERROR from VSdetach\n"); } /* while */ /* * Terminate access to the VS interface and close the HDF file. */ - status_n = Vend(file_id); - status_32 = Hclose(file_id); + if (Vend(file_id) == FAIL) + printf("*** ERROR from Vend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/VD/h4ex_VD_locate_vdata.c b/HDF4Examples/C/VD/h4ex_VD_locate_vdata.c index adbfd9b13a..8a548a300b 100644 --- a/HDF4Examples/C/VD/h4ex_VD_locate_vdata.c +++ b/HDF4Examples/C/VD/h4ex_VD_locate_vdata.c @@ -8,22 +8,23 @@ main() { /************************* Variable declaration **************************/ - intn status_n; /* returned status for functions returning an intn */ - int32 status_32, /* returned status for functions returning an int32 */ - file_id, vdata_id, vdata_ref, index = 0; /* index of the vdata in the file - manually kept */ - int8 found_fields; /* TRUE if the specified fields exist in the vdata */ + int32 file_id, vdata_id, vdata_ref; + int32 index = 0; /* index of the vdata in the file - manually kept */ + int8 found_fields; /* TRUE if the specified fields exist in the vdata */ /********************** End of variable declaration **********************/ /* * Open the HDF file for reading. */ - file_id = Hopen(FILE_NAME, DFACC_READ, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the VS interface. */ - status_n = Vstart(file_id); + if (Vstart(file_id) == FAIL) + printf("*** ERROR from Vstart\n"); /* * Set the reference number to -1 to start the search from @@ -44,7 +45,7 @@ main() */ while ((vdata_ref = VSgetid(file_id, vdata_ref)) != FAIL) { vdata_id = VSattach(file_id, vdata_ref, "r"); - if ((status_n = VSfexist(vdata_id, SEARCHED_FIELDS)) != FAIL) { + if (VSfexist(vdata_id, SEARCHED_FIELDS) != FAIL) { found_fields = TRUE; break; } @@ -52,7 +53,8 @@ main() /* * Detach from the current vdata before continuing searching. */ - status_32 = VSdetach(vdata_id); + if (VSdetach(vdata_id) == FAIL) + printf("*** ERROR from VSdetach\n"); index++; /* advance the index by 1 for the next vdata */ } @@ -65,13 +67,17 @@ main() printf("Fields Position and Temperature were not found.\n"); else { printf("Fields Position and Temperature found in the vdata at position %d\n", index); - status_32 = VSdetach(vdata_id); + if (VSdetach(vdata_id) == FAIL) + printf("*** ERROR from VSdetach\n"); } /* * Terminate access to the VS interface and close the HDF file. */ - status_n = Vend(file_id); - status_32 = Hclose(file_id); + if (Vend(file_id) == FAIL) + printf("*** ERROR from Vend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/VD/h4ex_VD_read_from_vdata.c b/HDF4Examples/C/VD/h4ex_VD_read_from_vdata.c index 4229fd38b7..256a3b2d77 100644 --- a/HDF4Examples/C/VD/h4ex_VD_read_from_vdata.c +++ b/HDF4Examples/C/VD/h4ex_VD_read_from_vdata.c @@ -15,11 +15,9 @@ main() { /************************* Variable declaration **************************/ - intn status_n; /* returned status for functions returning an intn */ - int32 status_32, /* returned status for functions returning an int32 */ - file_id, vdata_id, vdata_ref, /* vdata's reference number */ - num_of_records, /* number of records actually written to the vdata */ - record_pos; /* position of the current record */ + int32 file_id, vdata_id; + int32 vdata_ref; /* vdata's reference number */ + int32 num_of_records; /* number of records actually written to the vdata */ int16 rec_num; /* current record number in the vdata */ float32 databuf[N_RECORDS][N_VALS_PER_REC]; /* buffer for vdata values */ @@ -28,12 +26,14 @@ main() /* * Open the HDF file for reading. */ - file_id = Hopen(FILE_NAME, DFACC_READ, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the VS interface. */ - status_n = Vstart(file_id); + if (Vstart(file_id) == FAIL) + printf("*** ERROR from Vstart\n"); /* * Get the reference number of the vdata, whose name is specified in @@ -46,18 +46,19 @@ main() * exit the program. */ if (vdata_ref == 0) - exit(1); + return 0; vdata_id = VSattach(file_id, vdata_ref, "r"); /* * Specify the fields that will be read. */ - status_n = VSsetfields(vdata_id, FIELDNAME_LIST); + if (VSsetfields(vdata_id, FIELDNAME_LIST) == FAIL) + printf("*** ERROR from VSsetfields\n"); /* * Place the current point to the position specified in RECORD_INDEX. */ - record_pos = VSseek(vdata_id, RECORD_INDEX); + VSseek(vdata_id, RECORD_INDEX); /* * Read the next N_RECORDS records from the vdata and store the data @@ -79,8 +80,12 @@ main() * Terminate access to the vdata and to the VS interface, then close * the HDF file. */ - status_32 = VSdetach(vdata_id); - status_n = Vend(file_id); - status_32 = Hclose(file_id); + if (VSdetach(vdata_id) == FAIL) + printf("*** ERROR from VSdetach\n"); + if (Vend(file_id) == FAIL) + printf("*** ERROR from Vend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/VD/h4ex_VD_read_mixed_vdata.c b/HDF4Examples/C/VD/h4ex_VD_read_mixed_vdata.c index a555b61cf3..527147a9f2 100644 --- a/HDF4Examples/C/VD/h4ex_VD_read_mixed_vdata.c +++ b/HDF4Examples/C/VD/h4ex_VD_read_mixed_vdata.c @@ -14,14 +14,13 @@ main() { /************************* Variable declaration **************************/ - intn status_n; /* returned status for functions returning an intn */ - int32 status_32, /* returned status for functions returning an int32 */ - file_id, vdata_id, num_of_records, /* number of records actually read */ - vdata_ref; /* number of bytes the vdata can hold */ - float32 itemp[N_RECORDS]; /* buffer to hold values of first field */ - char idents[N_RECORDS]; /* buffer to hold values of fourth field */ - uint8 databuf[BUFFER_SIZE]; /* buffer to hold read data, still packed */ - VOIDP fldbufptrs[N_FIELDS]; /*pointers to be pointing to the field buffers*/ + int32 file_id, vdata_id; + int32 num_of_records; /* number of records actually read */ + int32 vdata_ref; /* reference number of the vdata to be read */ + float32 itemp[N_RECORDS]; /* buffer to hold values of first field */ + char idents[N_RECORDS]; /* buffer to hold values of fourth field */ + uint8 databuf[BUFFER_SIZE]; /* buffer to hold read data, still packed */ + void *fldbufptrs[N_FIELDS]; /*pointers to be pointing to the field buffers*/ int i; /********************** End of variable declaration **********************/ @@ -29,12 +28,14 @@ main() /* * Open the HDF file for reading. */ - file_id = Hopen(FILE_NAME, DFACC_READ, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the VS interface. */ - status_n = Vstart(file_id); + if (Vstart(file_id) == FAIL) + printf("*** ERROR from Vstart\n"); /* * Get the reference number of the vdata, whose name is specified in @@ -50,7 +51,8 @@ main() /* * Specify the fields that will be read. */ - status_n = VSsetfields(vdata_id, FIELDNAME_LIST); + if (VSsetfields(vdata_id, FIELDNAME_LIST) == FAIL) + printf("*** ERROR from VSsetfields\n"); /* * Read N_RECORDS records of the vdata and store the values into the @@ -71,8 +73,9 @@ main() * Note that the second parameter is _HDF_VSUNPACK for unpacking and the * number of records is the one returned by VSread. */ - status_n = VSfpack(vdata_id, _HDF_VSUNPACK, FIELDNAME_LIST, (VOIDP)databuf, BUFFER_SIZE, num_of_records, - NULL, (VOIDP)fldbufptrs); + if (VSfpack(vdata_id, _HDF_VSUNPACK, FIELDNAME_LIST, (void *)databuf, BUFFER_SIZE, num_of_records, NULL, + (void *)fldbufptrs) == FAIL) + printf("*** ERROR from VSfpack\n"); /* * Display the read data being stored in the field buffers. @@ -85,8 +88,12 @@ main() * Terminate access to the vdata and the VS interface, then close * the HDF file. */ - status_32 = VSdetach(vdata_id); - status_n = Vend(file_id); - status_32 = Hclose(file_id); + if (VSdetach(vdata_id) == FAIL) + printf("*** ERROR from VSdetach\n"); + if (Vend(file_id) == FAIL) + printf("*** ERROR from Vend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/VD/h4ex_VD_set_get_vdata_attr.c b/HDF4Examples/C/VD/h4ex_VD_set_get_vdata_attr.c index 35d05b8fd4..0544b277ca 100644 --- a/HDF4Examples/C/VD/h4ex_VD_set_get_vdata_attr.c +++ b/HDF4Examples/C/VD/h4ex_VD_set_get_vdata_attr.c @@ -13,9 +13,8 @@ main() { /************************* Variable declaration **************************/ - intn status_n; /* returned status for functions returning an intn */ - int32 status_32, /* returned status for functions returning an int32 */ - file_id, vdata_ref, vdata_id, field_index, /* index of a field within the vdata */ + int32 file_id, vdata_ref, vdata_id; + int32 field_index, /* index of a field within the vdata */ n_vdattrs, /* number of vdata attributes */ n_fldattrs, /* number of field attributes */ vdata_type, /* to hold the type of vdata's attribute */ @@ -36,12 +35,14 @@ main() /* * Open the HDF file for writing. */ - file_id = Hopen(FILE_NAME, DFACC_WRITE, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_WRITE, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the VS interface. */ - status_n = Vstart(file_id); + if (Vstart(file_id) == FAIL) + printf("*** ERROR from Vstart\n"); /* * Get the reference number of the vdata named VDATA_NAME. @@ -56,17 +57,20 @@ main() /* * Attach an attribute to the vdata, i.e., indicated by the second parameter. */ - status_n = VSsetattr(vdata_id, _HDF_VDATA, VATTR_NAME, DFNT_CHAR, VATTR_N_VALUES, vd_attr); + if (VSsetattr(vdata_id, _HDF_VDATA, VATTR_NAME, DFNT_CHAR, VATTR_N_VALUES, vd_attr) == FAIL) + printf("*** ERROR from VSsetattr\n"); /* * Get the index of the field FIELD_NAME within the vdata. */ - status_n = VSfindex(vdata_id, FIELD_NAME, &field_index); + if (VSfindex(vdata_id, FIELD_NAME, &field_index) == FAIL) + printf("*** ERROR from VSfindex\n"); /* * Attach an attribute to the field field_index. */ - status_n = VSsetattr(vdata_id, field_index, FATTR_NAME, DFNT_INT32, FATTR_N_VALUES, fld_attr); + if (VSsetattr(vdata_id, field_index, FATTR_NAME, DFNT_INT32, FATTR_N_VALUES, fld_attr) == FAIL) + printf("*** ERROR from VSsetattr\n"); /* * Get the number of attributes attached to the vdata's first @@ -92,24 +96,28 @@ main() * Get information about the vdata's first attribute, indicated * by the third parameter which is the index of the attribute. */ - status_n = VSattrinfo(vdata_id, _HDF_VDATA, 0, vattr_name, &vdata_type, &vdata_n_values, &vdata_size); + if (VSattrinfo(vdata_id, _HDF_VDATA, 0, vattr_name, &vdata_type, &vdata_n_values, &vdata_size) == FAIL) + printf("*** ERROR from VSattrinfo\n"); /* * Get information about the first attribute of the field specified by * field_index. */ - status_n = VSattrinfo(vdata_id, field_index, 0, fattr_name, &field_type, &field_n_values, &field_size); + if (VSattrinfo(vdata_id, field_index, 0, fattr_name, &field_type, &field_n_values, &field_size) == FAIL) + printf("*** ERROR from VSattrinfo\n"); /* * Get the vdata's first attribute. */ - status_n = VSgetattr(vdata_id, _HDF_VDATA, 0, vattr_buf); + if (VSgetattr(vdata_id, _HDF_VDATA, 0, vattr_buf) == FAIL) + printf("*** ERROR from VSgetattr\n"); printf("Values of the vdata attribute = %c %c %c\n", vattr_buf[0], vattr_buf[1], vattr_buf[2]); /* * Get the first attribute of the field specified by field_index. */ - status_n = VSgetattr(vdata_id, field_index, 0, fattr_buf); + if (VSgetattr(vdata_id, field_index, 0, fattr_buf) == FAIL) + printf("*** ERROR from VSgetattr\n"); printf("Values of the field attribute = %d %d %d %d\n", fattr_buf[0], fattr_buf[1], fattr_buf[2], fattr_buf[3]); @@ -117,8 +125,12 @@ main() * Terminate access to the vdata and to the VS interface, then close * the HDF file. */ - status_32 = VSdetach(vdata_id); - status_n = Vend(file_id); - status_32 = Hclose(file_id); + if (VSdetach(vdata_id) == FAIL) + printf("*** ERROR from VSdetach\n"); + if (Vend(file_id) == FAIL) + printf("*** ERROR from Vend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/VD/h4ex_VD_write_mixed_vdata.c b/HDF4Examples/C/VD/h4ex_VD_write_mixed_vdata.c index d85a5ac61e..d780e52413 100644 --- a/HDF4Examples/C/VD/h4ex_VD_write_mixed_vdata.c +++ b/HDF4Examples/C/VD/h4ex_VD_write_mixed_vdata.c @@ -21,16 +21,14 @@ main() { /************************* Variable declaration **************************/ - intn status_n; /* returned status for functions returning an intn */ - int32 status_32, /* returned status for functions returning an int32 */ - file_id, vdata_id, vdata_ref = -1, /* vdata's reference number, set to -1 to create */ - num_of_records; /* number of records actually written to the vdata */ - float32 temp[N_RECORDS]; /* buffer to hold values of first field */ - int16 height[N_RECORDS]; /* buffer to hold values of second field */ - float32 speed[N_RECORDS]; /* buffer to hold values of third field */ - char8 ident[N_RECORDS]; /* buffer to hold values of fourth field */ - VOIDP fldbufptrs[N_FIELDS]; /*pointers to be pointing to the field buffers*/ - uint16 databuf[BUF_SIZE]; /* buffer to hold the data after being packed*/ + int32 file_id, vdata_id; + int32 vdata_ref = -1; /* vdata's reference number, set to -1 to create */ + float32 temp[N_RECORDS]; /* buffer to hold values of first field */ + int16 height[N_RECORDS]; /* buffer to hold values of second field */ + float32 speed[N_RECORDS]; /* buffer to hold values of third field */ + char8 ident[N_RECORDS]; /* buffer to hold values of fourth field */ + void *fldbufptrs[N_FIELDS]; /*pointers to be pointing to the field buffers*/ + uint16 databuf[BUF_SIZE]; /* buffer to hold the data after being packed*/ int i; /********************** End of variable declaration **********************/ @@ -38,12 +36,14 @@ main() /* * Create an HDF file. */ - file_id = Hopen(FILE_NAME, DFACC_CREATE, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_CREATE, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the VS interface. */ - status_n = Vstart(file_id); + if (Vstart(file_id) == FAIL) + printf("*** ERROR from Vstart\n"); /* * Create a new vdata. @@ -53,30 +53,37 @@ main() /* * Set name and class name of the vdata. */ - status_32 = VSsetname(vdata_id, VDATA_NAME); - status_32 = VSsetclass(vdata_id, CLASS_NAME); + if (VSsetname(vdata_id, VDATA_NAME) == FAIL) + printf("*** ERROR from VSsetname\n"); + if (VSsetclass(vdata_id, CLASS_NAME) == FAIL) + printf("*** ERROR from VSsetclass\n"); /* * Introduce each field's name, data type, and order. This is the first * part in defining a vdata field. */ - status_n = VSfdefine(vdata_id, FIELD1_NAME, DFNT_FLOAT32, ORDER); - status_n = VSfdefine(vdata_id, FIELD2_NAME, DFNT_INT16, ORDER); - status_n = VSfdefine(vdata_id, FIELD3_NAME, DFNT_FLOAT32, ORDER); - status_n = VSfdefine(vdata_id, FIELD4_NAME, DFNT_CHAR8, ORDER); + if (VSfdefine(vdata_id, FIELD1_NAME, DFNT_FLOAT32, ORDER) == FAIL) + printf("*** ERROR from VSfdefine\n"); + if (VSfdefine(vdata_id, FIELD2_NAME, DFNT_INT16, ORDER) == FAIL) + printf("*** ERROR from VSfdefine\n"); + if (VSfdefine(vdata_id, FIELD3_NAME, DFNT_FLOAT32, ORDER) == FAIL) + printf("*** ERROR from VSfdefine\n"); + if (VSfdefine(vdata_id, FIELD4_NAME, DFNT_CHAR8, ORDER) == FAIL) + printf("*** ERROR from VSfdefine\n"); /* * Finalize the definition of the fields of the vdata. */ - status_n = VSsetfields(vdata_id, FIELDNAME_LIST); + if (VSsetfields(vdata_id, FIELDNAME_LIST) == FAIL) + printf("*** ERROR from VSsetfields\n"); /* * Enter data values into the field buffers by the records. */ for (i = 0; i < N_RECORDS; i++) { - temp[i] = (float32)(1.11 * (i + 1)); + temp[i] = 1.11 * (i + 1); height[i] = i; - speed[i] = (float32)(1.11 * (i + 1)); + speed[i] = 1.11 * (i + 1); ident[i] = 'A' + i; } @@ -94,20 +101,25 @@ main() * pointers fldbufptrs, and store the packed data into the buffer * databuf. Note that the second parameter is _HDF_VSPACK for packing. */ - status_n = - VSfpack(vdata_id, _HDF_VSPACK, NULL, (VOIDP)databuf, BUF_SIZE, N_RECORDS, NULL, (VOIDP)fldbufptrs); + if (VSfpack(vdata_id, _HDF_VSPACK, NULL, (void *)databuf, BUF_SIZE, N_RECORDS, NULL, + (void *)fldbufptrs) == FAIL) + printf("*** ERROR from VSfpack\n"); /* * Write all records of the packed data to the vdata. */ - num_of_records = VSwrite(vdata_id, (uint8 *)databuf, N_RECORDS, FULL_INTERLACE); + VSwrite(vdata_id, (uint8 *)databuf, N_RECORDS, FULL_INTERLACE); /* * Terminate access to the vdata and the VS interface, then close * the HDF file. */ - status_32 = VSdetach(vdata_id); - status_n = Vend(file_id); - status_32 = Hclose(file_id); + if (VSdetach(vdata_id) == FAIL) + printf("*** ERROR from VSdetach\n"); + if (Vend(file_id) == FAIL) + printf("*** ERROR from Vend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/VD/h4ex_VD_write_mixed_vdata_struct.c b/HDF4Examples/C/VD/h4ex_VD_write_mixed_vdata_struct.c index 4f3f664392..00195e2b8c 100644 --- a/HDF4Examples/C/VD/h4ex_VD_write_mixed_vdata_struct.c +++ b/HDF4Examples/C/VD/h4ex_VD_write_mixed_vdata_struct.c @@ -42,12 +42,10 @@ main() { /************************* Variable declaration **************************/ - intn status_n; /* returned status for functions returning an intn */ - int32 status_32, /* returned status for functions returning an int32 */ - file_id, vdata_id, num_of_records; /* number of records actually written to the vdata */ - uint8 databuf[BUFFER_SIZE]; /* buffer to hold the data after being packed */ - uint8 *pntr; /* pointer pointing to the current record in the data buffer*/ - int16 rec_num; /* current record number */ + int32 file_id, vdata_id; + uint8 databuf[BUFFER_SIZE]; /* buffer to hold the data after being packed */ + uint8 *pntr; /* pointer pointing to the current record in the data buffer*/ + int16 rec_num; /* current record number */ struct { float32 temp; /* to hold value of the first field of the vdata */ @@ -57,19 +55,21 @@ main() } source[N_RECORDS]; /* pointers to be pointing to the fields in the struct buffer */ - VOIDP fldbufptrs[N_FIELDS]; + void *fldbufptrs[N_FIELDS]; /********************** End of variable declaration **********************/ /* * Create the HDF file. */ - file_id = Hopen(FILE_NAME, DFACC_CREATE, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_CREATE, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the VS interface. */ - status_n = Vstart(file_id); + if (Vstart(file_id) == FAIL) + printf("*** ERROR from Vstart\n"); /* * Create a new vdata. @@ -79,22 +79,29 @@ main() /* * Set name and class name of the vdata. */ - status_32 = VSsetname(vdata_id, VDATA_NAME); - status_32 = VSsetclass(vdata_id, CLASS_NAME); + if (VSsetname(vdata_id, VDATA_NAME) == FAIL) + printf("*** ERROR from VSsetname\n"); + if (VSsetclass(vdata_id, CLASS_NAME) == FAIL) + printf("*** ERROR from VSsetclass\n"); /* * Introduce each field's name, data type, and order. This is the first * part in defining a vdata field. */ - status_n = VSfdefine(vdata_id, FIELD1_NAME, DFNT_FLOAT32, 1); - status_n = VSfdefine(vdata_id, FIELD2_NAME, DFNT_INT16, 1); - status_n = VSfdefine(vdata_id, FIELD3_NAME, DFNT_FLOAT32, 1); - status_n = VSfdefine(vdata_id, FIELD4_NAME, DFNT_CHAR8, 1); + if (VSfdefine(vdata_id, FIELD1_NAME, DFNT_FLOAT32, 1) == FAIL) + printf("*** ERROR from VSfdefine\n"); + if (VSfdefine(vdata_id, FIELD2_NAME, DFNT_INT16, 1) == FAIL) + printf("*** ERROR from VSfdefine\n"); + if (VSfdefine(vdata_id, FIELD3_NAME, DFNT_FLOAT32, 1) == FAIL) + printf("*** ERROR from VSfdefine\n"); + if (VSfdefine(vdata_id, FIELD4_NAME, DFNT_CHAR8, 1) == FAIL) + printf("*** ERROR from VSfdefine\n"); /* * Finalize the definition of the fields to be written to. */ - status_n = VSsetfields(vdata_id, FIELDNAME_LIST); + if (VSsetfields(vdata_id, FIELDNAME_LIST) == FAIL) + printf("*** ERROR from VSsetfields\n"); /* * Initialize pointer for traversing the buffer to pack each record. @@ -105,9 +112,9 @@ main() * Enter data values into each record. */ for (rec_num = 0; rec_num < N_RECORDS; rec_num++) { - source[rec_num].temp = (float32)(1.11 * (rec_num + 1)); + source[rec_num].temp = 1.11 * (rec_num + 1); source[rec_num].height = rec_num; - source[rec_num].speed = (float32)(1.11 * (rec_num + 1)); + source[rec_num].speed = 1.11 * (rec_num + 1); source[rec_num].ident = 'A' + rec_num; } @@ -128,7 +135,8 @@ main() * Pack the data in the field buffers into the data buffer at the * current record, i.e. indicated by "pntr". */ - status_n = VSfpack(vdata_id, _HDF_VSPACK, NULL, (VOIDP)pntr, RECORD_SIZE, 1, NULL, fldbufptrs); + if (VSfpack(vdata_id, _HDF_VSPACK, NULL, (void *)pntr, RECORD_SIZE, 1, NULL, fldbufptrs) == FAIL) + printf("*** ERROR from VSfpack\n"); /* * Advance the current position in the buffer. @@ -139,14 +147,18 @@ main() /* * Write all records of the packed data to the vdata. */ - num_of_records = VSwrite(vdata_id, (uint8 *)databuf, N_RECORDS, FULL_INTERLACE); + VSwrite(vdata_id, (uint8 *)databuf, N_RECORDS, FULL_INTERLACE); /* * Terminate access to the Vdata and the VS interface, * then close the HDF file. */ - status_32 = VSdetach(vdata_id); - status_n = Vend(file_id); - status_32 = Hclose(file_id); + if (VSdetach(vdata_id) == FAIL) + printf("*** ERROR from VSdetach\n"); + if (Vend(file_id) == FAIL) + printf("*** ERROR from Vend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/VD/h4ex_VD_write_to_vdata.c b/HDF4Examples/C/VD/h4ex_VD_write_to_vdata.c index f82f92c46d..9ef9e5d420 100644 --- a/HDF4Examples/C/VD/h4ex_VD_write_to_vdata.c +++ b/HDF4Examples/C/VD/h4ex_VD_write_to_vdata.c @@ -20,10 +20,8 @@ main() { /************************* Variable declaration **************************/ - intn status_n; /* returned status for functions returning an intn */ - int32 status_32, /* returned status for functions returning an int32 */ - file_id, vdata_id, vdata_ref = -1, /* ref number of a vdata, set to -1 to create */ - num_of_records; /* number of records actually written to vdata */ + int32 file_id, vdata_id; + int32 vdata_ref = -1; /* ref number of a vdata, set to -1 to create */ int16 rec_num; /* current record number */ float32 data_buf[N_RECORDS][N_VALS_PER_REC]; /* buffer for vdata values */ @@ -32,12 +30,14 @@ main() /* * Open the HDF file for writing. */ - file_id = Hopen(FILE_NAME, DFACC_WRITE, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_WRITE, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the VS interface. */ - status_n = Vstart(file_id); + if (Vstart(file_id) == FAIL) + printf("*** ERROR from Vstart\n"); /* * Create a new vdata. @@ -47,21 +47,27 @@ main() /* * Set name and class name of the vdata. */ - status_32 = VSsetname(vdata_id, VDATA_NAME); - status_32 = VSsetclass(vdata_id, CLASS_NAME); + if (VSsetname(vdata_id, VDATA_NAME) == FAIL) + printf("*** ERROR from VSsetname\n"); + if (VSsetclass(vdata_id, CLASS_NAME) == FAIL) + printf("*** ERROR from VSsetclass\n"); /* * Introduce each field's name, data type, and order. This is the first * part in defining a field. */ - status_n = VSfdefine(vdata_id, FIELD1_NAME, DFNT_FLOAT32, ORDER_1); - status_n = VSfdefine(vdata_id, FIELD2_NAME, DFNT_FLOAT32, ORDER_2); - status_n = VSfdefine(vdata_id, FIELD3_NAME, DFNT_FLOAT32, ORDER_3); + if (VSfdefine(vdata_id, FIELD1_NAME, DFNT_FLOAT32, ORDER_1) == FAIL) + printf("*** ERROR from VSfdefine\n"); + if (VSfdefine(vdata_id, FIELD2_NAME, DFNT_FLOAT32, ORDER_2) == FAIL) + printf("*** ERROR from VSfdefine\n"); + if (VSfdefine(vdata_id, FIELD3_NAME, DFNT_FLOAT32, ORDER_3) == FAIL) + printf("*** ERROR from VSfdefine\n"); /* * Finalize the definition of the fields. */ - status_n = VSsetfields(vdata_id, FIELDNAME_LIST); + if (VSsetfields(vdata_id, FIELDNAME_LIST) == FAIL) + printf("*** ERROR from VSsetfields\n"); /* * Buffer the data by the record for fully interlaced mode. Note that the @@ -70,25 +76,29 @@ main() * elements contain the two values of the third field. */ for (rec_num = 0; rec_num < N_RECORDS; rec_num++) { - data_buf[rec_num][0] = (float32)(1.0 * rec_num); - data_buf[rec_num][1] = (float32)(2.0 * rec_num); - data_buf[rec_num][2] = (float32)(3.0 * rec_num); - data_buf[rec_num][3] = (float32)(0.1 + rec_num); - data_buf[rec_num][4] = (float32)(0.0); - data_buf[rec_num][5] = (float32)(65.0); + data_buf[rec_num][0] = 1.0 * rec_num; + data_buf[rec_num][1] = 2.0 * rec_num; + data_buf[rec_num][2] = 3.0 * rec_num; + data_buf[rec_num][3] = 0.1 + rec_num; + data_buf[rec_num][4] = 0.0; + data_buf[rec_num][5] = 65.0; } /* * Write the data from data_buf to the vdata with full interlacing mode. */ - num_of_records = VSwrite(vdata_id, (uint8 *)data_buf, N_RECORDS, FULL_INTERLACE); + VSwrite(vdata_id, (uint8 *)data_buf, N_RECORDS, FULL_INTERLACE); /* * Terminate access to the vdata and to the VS interface, then close * the HDF file. */ - status_32 = VSdetach(vdata_id); - status_n = Vend(file_id); - status_32 = Hclose(file_id); + if (VSdetach(vdata_id) == FAIL) + printf("*** ERROR from VSdetach\n"); + if (Vend(file_id) == FAIL) + printf("*** ERROR from Vend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/VG/h4ex_VG_add_sds_to_vgroup.c b/HDF4Examples/C/VG/h4ex_VG_add_sds_to_vgroup.c index 7bf739219f..2d365b792a 100644 --- a/HDF4Examples/C/VG/h4ex_VG_add_sds_to_vgroup.c +++ b/HDF4Examples/C/VG/h4ex_VG_add_sds_to_vgroup.c @@ -11,9 +11,7 @@ main() { /************************* Variable declaration **************************/ - intn status_n; /* returned status for functions returning an intn */ - int32 status_32, /* returned status for functions returning an int32 */ - sd_id, /* SD interface identifier */ + int32 sd_id, /* SD interface identifier */ sds_id, /* data set identifier */ sds_ref, /* reference number of the data set */ dim_sizes[1], /* dimension of the data set - only one */ @@ -26,12 +24,14 @@ main() /* * Create the HDF file. */ - file_id = Hopen(FILE_NAME, DFACC_CREATE, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_CREATE, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the V interface. */ - status_n = Vstart(file_id); + if (Vstart(file_id) == FAIL) + printf("*** ERROR from Vstart\n"); /* * Initialize the SD interface. @@ -52,8 +52,10 @@ main() * Create a vgroup and set its name and class. */ vgroup_id = Vattach(file_id, -1, "w"); - status_32 = Vsetname(vgroup_id, VG_NAME); - status_32 = Vsetclass(vgroup_id, VG_CLASS); + if (Vsetname(vgroup_id, VG_NAME) == FAIL) + printf("*** ERROR from Vsetname\n"); + if (Vsetclass(vgroup_id, VG_CLASS) == FAIL) + printf("*** ERROR from Vsetclass\n"); /* * Obtain the reference number of the SDS using its identifier. @@ -64,20 +66,27 @@ main() * Add the SDS to the vgroup. Note: the tag DFTAG_NDG is used * when adding an SDS. Refer to Appendix A for the entire list of tags. */ - status_32 = Vaddtagref(vgroup_id, DFTAG_NDG, sds_ref); + if (Vaddtagref(vgroup_id, DFTAG_NDG, sds_ref) == FAIL) + printf("*** ERROR from Vaddtagref\n"); /* * Terminate access to the SDS and to the SD interface. */ - status_n = SDendaccess(sds_id); - status_n = SDend(sd_id); + if (SDendaccess(sds_id) == FAIL) + printf("*** ERROR from SDendaccess\n"); + if (SDend(sd_id) == FAIL) + printf("*** ERROR from SDend\n"); /* * Terminate access to the vgroup and to the V interface, and * close the HDF file. */ - status_32 = Vdetach(vgroup_id); - status_n = Vend(file_id); - status_n = Hclose(file_id); + if (Vdetach(vgroup_id) == FAIL) + printf("*** ERROR from Vdetach\n"); + if (Vend(file_id) == FAIL) + printf("*** ERROR from Vend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/VG/h4ex_VG_create_vgroup.c b/HDF4Examples/C/VG/h4ex_VG_create_vgroup.c index 79c9b3854d..072d4d3e34 100644 --- a/HDF4Examples/C/VG/h4ex_VG_create_vgroup.c +++ b/HDF4Examples/C/VG/h4ex_VG_create_vgroup.c @@ -7,21 +7,22 @@ main() { /************************* Variable declaration **************************/ - intn status_n; /* returned status for functions returning an intn */ - int32 status_32, /* returned status for functions returning an int32 */ - vgroup_ref = -1, vgroup1_id, vgroup2_id, file_id; + int32 vgroup_ref = -1; + int32 vgroup1_id, vgroup2_id, file_id; /********************** End of variable declaration **********************/ /* * Create the HDF file. */ - file_id = Hopen(FILE_NAME, DFACC_CREATE, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_CREATE, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the V interface. */ - status_n = Vstart(file_id); + if (Vstart(file_id) == FAIL) + printf("*** ERROR from Vstart\n"); /* * Create the first vgroup. Note that the vgroup reference number is set @@ -41,17 +42,22 @@ main() /* * Terminate access to the first vgroup. */ - status_32 = Vdetach(vgroup1_id); + if (Vdetach(vgroup1_id) == FAIL) + printf("*** ERROR from Vdetach\n"); /* * Terminate access to the second vgroup. */ - status_32 = Vdetach(vgroup2_id); + if (Vdetach(vgroup2_id) == FAIL) + printf("*** ERROR from Vdetach\n"); /* * Terminate access to the V interface and close the HDF file. */ - status_n = Vend(file_id); - status_n = Hclose(file_id); + if (Vend(file_id) == FAIL) + printf("*** ERROR from Vend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/VG/h4ex_VG_get_vgroup_info.c b/HDF4Examples/C/VG/h4ex_VG_get_vgroup_info.c index fac66276d7..690e177955 100644 --- a/HDF4Examples/C/VG/h4ex_VG_get_vgroup_info.c +++ b/HDF4Examples/C/VG/h4ex_VG_get_vgroup_info.c @@ -7,12 +7,10 @@ main() { /************************* Variable declaration **************************/ - intn status_n; /* returned status for functions returning an intn */ - int32 status_32, /* returned status for functions returning an int32 */ - file_id, vgroup_id; - int32 lone_vg_number, /* current lone vgroup number */ - num_of_lones = 0; /* number of lone vgroups */ - int32 *ref_array; /* buffer to hold the ref numbers of lone vgroups */ + int32 file_id, vgroup_id; + int32 lone_vg_number; /* current lone vgroup number */ + int32 num_of_lones = 0; /* number of lone vgroups */ + int32 *ref_array = NULL; /* buffer to hold the ref numbers of lone vgroups */ char *vgroup_name, *vgroup_class; uint16 name_len; @@ -21,12 +19,14 @@ main() /* * Open the HDF file for reading. */ - file_id = Hopen(FILE_NAME, DFACC_READ, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the V interface. */ - status_n = Vstart(file_id); + if (Vstart(file_id) == FAIL) + printf("*** ERROR from Vstart\n"); /* * Get and print the names and class names of all the lone vgroups. @@ -54,43 +54,48 @@ main() /* * Display the name and class of each lone vgroup. */ - printf("Lone vgroups in this file are:\n"); + fprintf(stderr, "Lone vgroups in this file are:\n"); for (lone_vg_number = 0; lone_vg_number < num_of_lones; lone_vg_number++) { /* * Attach to the current vgroup then get and display its * name and class. Note: the current vgroup must be detached before * moving to the next. */ - vgroup_id = Vattach(file_id, ref_array[lone_vg_number], "r"); - status_32 = Vgetnamelen(vgroup_id, &name_len); - vgroup_name = (char *)HDmalloc(sizeof(char *) * (name_len + 1)); + vgroup_id = Vattach(file_id, ref_array[lone_vg_number], "r"); + if (Vgetnamelen(vgroup_id, &name_len) == FAIL) + printf("*** ERROR from Vgetnamelen\n"); + vgroup_name = (char *)malloc(sizeof(char *) * (name_len + 1)); if (vgroup_name == NULL) { fprintf(stderr, "Not enough memory for vgroup_name!\n"); exit(1); } - status_32 = Vgetname(vgroup_id, vgroup_name); + if (Vgetname(vgroup_id, vgroup_name) == FAIL) + printf("*** ERROR from Vgetname\n"); - status_32 = Vgetclassnamelen(vgroup_id, &name_len); - vgroup_class = (char *)HDmalloc(sizeof(char *) * (name_len + 1)); + if (Vgetclassnamelen(vgroup_id, &name_len) == FAIL) + printf("*** ERROR from Vgetclassnamelen\n"); + vgroup_class = (char *)malloc(sizeof(char *) * (name_len + 1)); if (vgroup_class == NULL) { fprintf(stderr, "Not enough memory for vgroup_class!\n"); exit(1); } - status_32 = Vgetclass(vgroup_id, vgroup_class); - printf(" Vgroup name %s and class %s\n", vgroup_name, vgroup_class); - status_32 = Vdetach(vgroup_id); - if (vgroup_name != NULL) - HDfree(vgroup_name); - if (vgroup_class != NULL) - HDfree(vgroup_class); + if (Vgetclass(vgroup_id, vgroup_class) == FAIL) + printf("*** ERROR from Vgetclass\n"); + fprintf(stderr, " Vgroup name %s and class %s\n", vgroup_name, vgroup_class); + if (Vdetach(vgroup_id) == FAIL) + printf("*** ERROR from Vdetach\n"); + free(vgroup_name); + free(vgroup_class); } /* for */ } /* if */ /* * Terminate access to the V interface and close the file. */ - status_n = Vend(file_id); - status_n = Hclose(file_id); + if (Vend(file_id) == FAIL) + printf("*** ERROR from Vend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); /* * Free the space allocated by this program. diff --git a/HDF4Examples/C/VG/h4ex_VG_insert_vdatas_to_vgroup.c b/HDF4Examples/C/VG/h4ex_VG_insert_vdatas_to_vgroup.c index 4614d58619..db1b02b159 100644 --- a/HDF4Examples/C/VG/h4ex_VG_insert_vdatas_to_vgroup.c +++ b/HDF4Examples/C/VG/h4ex_VG_insert_vdatas_to_vgroup.c @@ -25,17 +25,15 @@ main() { /************************* Variable declaration **************************/ - intn status_n; /* returned status for functions returning an intn */ - int32 status_32, /* returned status for functions returning an int32 */ - file_id, vgroup_id, vdata1_id, vdata2_id, vdata3_id; - int32 num_of_records, /* number of records actually written */ - vd_index; /* position of a vdata in the vgroup */ + int32 file_id, vgroup_id; + int32 vdata1_id, vdata2_id, vdata3_id; int8 i, j, k = 0; float32 pxy[N_RECORDS][2] = /* buffer for data of the first vdata */ - {-1.5, 2.3, -1.5, 1.98, -2.4, .67, -3.4, 1.46, -.65, 3.1, -.62, 1.23, -.4, 3.8, -3.55, - 2.3, -1.43, 2.44, .23, 1.13, -1.4, 5.43, -1.4, 5.8, -3.4, 3.85, -.55, .3, -.21, 1.22, - -1.44, 1.9, -1.4, 2.8, .94, 1.78, -.4, 2.32, -.87, 1.99, -.54, 4.11, -1.5, 1.35, -1.4, - 2.21, -.22, 1.8, -1.1, 4.55, -.44, .54, -1.11, 3.93, -.76, 1.9, -2.34, 1.7, -2.2, 1.21}; + {{-1.5, 2.3}, {-1.5, 1.98}, {-2.4, .67}, {-3.4, 1.46}, {-.65, 3.1}, {-.62, 1.23}, + {-.4, 3.8}, {-3.55, 2.3}, {-1.43, 2.44}, {.23, 1.13}, {-1.4, 5.43}, {-1.4, 5.8}, + {-3.4, 3.85}, {-.55, .3}, {-.21, 1.22}, {-1.44, 1.9}, {-1.4, 2.8}, {.94, 1.78}, + {-.4, 2.32}, {-.87, 1.99}, {-.54, 4.11}, {-1.5, 1.35}, {-1.4, 2.21}, {-.22, 1.8}, + {-1.1, 4.55}, {-.44, .54}, {-1.11, 3.93}, {-.76, 1.9}, {-2.34, 1.7}, {-2.2, 1.21}}; float32 tmp[N_RECORDS]; /* buffer for data of the second vdata */ int16 plist[N_RECORDS][3]; /* buffer for data of the third vdata */ @@ -44,12 +42,14 @@ main() /* * Open the HDF file for writing. */ - file_id = Hopen(FILE_NAME, DFACC_WRITE, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_WRITE, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the V interface. */ - status_n = Vstart(file_id); + if (Vstart(file_id) == FAIL) + printf("*** ERROR from Vstart\n"); /* * Buffer the data for the second and third vdatas. @@ -59,7 +59,7 @@ main() plist[i][j] = ++k; for (i = 0; i < N_RECORDS; i++) - tmp[i] = (float32)(i * 10.0); + tmp[i] = i * 10.0; /* * Create the vgroup then set its name and class. Note that the vgroup's @@ -67,8 +67,10 @@ main() * writing. */ vgroup_id = Vattach(file_id, -1, "w"); - status_32 = Vsetname(vgroup_id, VG_NAME); - status_32 = Vsetclass(vgroup_id, VG_CLASS); + if (Vsetname(vgroup_id, VG_NAME) == FAIL) + printf("*** ERROR from Vsetname\n"); + if (Vsetclass(vgroup_id, VG_CLASS) == FAIL) + printf("*** ERROR from Vsetclass\n"); /* * Create the first vdata then set its name and class. Note that the vdata's @@ -76,66 +78,86 @@ main() * writing. */ vdata1_id = VSattach(file_id, -1, "w"); - status_32 = VSsetname(vdata1_id, VD1_NAME); - status_32 = VSsetclass(vdata1_id, VD1_CLASS); + if (VSsetname(vdata1_id, VD1_NAME) == FAIL) + printf("*** ERROR from VSsetname\n"); + if (VSsetclass(vdata1_id, VD1_CLASS) == FAIL) + printf("*** ERROR from VSsetclass\n"); /* * Introduce and define the fields of the first vdata. */ - status_n = VSfdefine(vdata1_id, FIELD1_VD1, DFNT_FLOAT32, 1); - status_n = VSfdefine(vdata1_id, FIELD2_VD1, DFNT_FLOAT32, 1); - status_n = VSsetfields(vdata1_id, FIELDNAME_LIST); + if (VSfdefine(vdata1_id, FIELD1_VD1, DFNT_FLOAT32, 1) == FAIL) + printf("*** ERROR from VSfdefine\n"); + if (VSfdefine(vdata1_id, FIELD2_VD1, DFNT_FLOAT32, 1) == FAIL) + printf("*** ERROR from VSfdefine\n"); + if (VSsetfields(vdata1_id, FIELDNAME_LIST) == FAIL) + printf("*** ERROR from VSsetfields\n"); /* * Write the buffered data into the first vdata with full interlace mode. */ - num_of_records = VSwrite(vdata1_id, (uint8 *)pxy, N_RECORDS, FULL_INTERLACE); + VSwrite(vdata1_id, (uint8 *)pxy, N_RECORDS, FULL_INTERLACE); /* * Insert the vdata into the vgroup using its identifier. */ - vd_index = Vinsert(vgroup_id, vdata1_id); + Vinsert(vgroup_id, vdata1_id); /* * Detach from the first vdata. */ - status_32 = VSdetach(vdata1_id); + if (VSdetach(vdata1_id) == FAIL) + printf("*** ERROR from VSdetach\n"); /* * Create, write, and insert the second vdata to the vgroup using * steps similar to those used for the first vdata. */ - vdata2_id = VSattach(file_id, -1, "w"); - status_32 = VSsetname(vdata2_id, VD2_NAME); - status_32 = VSsetclass(vdata2_id, VD2_CLASS); - status_n = VSfdefine(vdata2_id, FIELD_VD2, DFNT_FLOAT32, 1); - status_n = VSsetfields(vdata2_id, FIELD_VD2); - num_of_records = VSwrite(vdata2_id, (uint8 *)tmp, N_RECORDS, FULL_INTERLACE); - vd_index = Vinsert(vgroup_id, vdata2_id); - status_32 = VSdetach(vdata2_id); + vdata2_id = VSattach(file_id, -1, "w"); + if (VSsetname(vdata2_id, VD2_NAME) == FAIL) + printf("*** ERROR from VSsetname\n"); + if (VSsetclass(vdata2_id, VD2_CLASS) == FAIL) + printf("*** ERROR from VSsetclass\n"); + if (VSfdefine(vdata2_id, FIELD_VD2, DFNT_FLOAT32, 1) == FAIL) + printf("*** ERROR from VSfdefine\n"); + if (VSsetfields(vdata2_id, FIELD_VD2) == FAIL) + printf("*** ERROR from VSsetfields\n"); + VSwrite(vdata2_id, (uint8 *)tmp, N_RECORDS, FULL_INTERLACE); + Vinsert(vgroup_id, vdata2_id); + if (VSdetach(vdata2_id) == FAIL) + printf("*** ERROR from VSdetach\n"); /* * Create, write, and insert the third vdata to the vgroup using * steps similar to those used for the first and second vdatas. */ - vdata3_id = VSattach(file_id, -1, "w"); - status_32 = VSsetname(vdata3_id, VD3_NAME); - status_32 = VSsetclass(vdata3_id, VD3_CLASS); - status_n = VSfdefine(vdata3_id, FIELD_VD3, DFNT_INT16, 3); - status_n = VSsetfields(vdata3_id, FIELD_VD3); - num_of_records = VSwrite(vdata3_id, (uint8 *)plist, N_RECORDS, FULL_INTERLACE); - vd_index = Vinsert(vgroup_id, vdata3_id); - status_32 = VSdetach(vdata3_id); + vdata3_id = VSattach(file_id, -1, "w"); + if (VSsetname(vdata3_id, VD3_NAME) == FAIL) + printf("*** ERROR from VSsetname\n"); + if (VSsetclass(vdata3_id, VD3_CLASS) == FAIL) + printf("*** ERROR from VSsetclass\n"); + if (VSfdefine(vdata3_id, FIELD_VD3, DFNT_INT16, 3) == FAIL) + printf("*** ERROR from VSfdefine\n"); + if (VSsetfields(vdata3_id, FIELD_VD3) == FAIL) + printf("*** ERROR from VSsetfields\n"); + VSwrite(vdata3_id, (uint8 *)plist, N_RECORDS, FULL_INTERLACE); + Vinsert(vgroup_id, vdata3_id); + if (VSdetach(vdata3_id) == FAIL) + printf("*** ERROR from VSdetach\n"); /* * Terminate access to the vgroup "Vertices". */ - status_32 = Vdetach(vgroup_id); + if (Vdetach(vgroup_id) == FAIL) + printf("*** ERROR from Vdetach\n"); /* * Terminate access to the V interface and close the HDF file. */ - status_n = Vend(file_id); - status_n = Hclose(file_id); + if (Vend(file_id) == FAIL) + printf("*** ERROR from Vend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/VG/h4ex_VG_set_get_vgroup_attr.c b/HDF4Examples/C/VG/h4ex_VG_set_get_vgroup_attr.c index e5426a06b9..d53aa3b942 100644 --- a/HDF4Examples/C/VG/h4ex_VG_set_get_vgroup_attr.c +++ b/HDF4Examples/C/VG/h4ex_VG_set_get_vgroup_attr.c @@ -10,24 +10,24 @@ main() { /************************* Variable declaration **************************/ - intn status_n, /* returned status for functions returning an intn */ - n_attrs; /* number of attributes of the vgroup */ - int32 status_32, /* returned status for functions returning an int32 */ - file_id, vgroup_ref, vgroup_id, attr_index, i, vg_version, data_type, n_values, size; - char vg_attr[N_ATT_VALUES] = {'v', 'g', 'r', 'o', 'u', 'p', '\0'}; - char vgattr_buf[N_ATT_VALUES], attr_name[30]; + intn n_attrs; /* number of attributes of the vgroup */ + int32 file_id, vgroup_ref, vgroup_id, attr_index, i, vg_version, n_values; + char vg_attr[N_ATT_VALUES] = {'v', 'g', 'r', 'o', 'u', 'p', '\0'}; + char vgattr_buf[N_ATT_VALUES], attr_name[30]; /********************** End of variable declaration **********************/ /* * Open the HDF file for writing. */ - file_id = Hopen(FILE_NAME, DFACC_WRITE, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_WRITE, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the V interface. */ - status_n = Vstart(file_id); + if (Vstart(file_id) == FAIL) + printf("*** ERROR from Vstart\n"); /* * Get the reference number of the vgroup named VGROUP_NAME. @@ -60,7 +60,8 @@ main() /* * Add the attribute named VGATTR_NAME to the vgroup. */ - status_n = Vsetattr(vgroup_id, VGATTR_NAME, DFNT_CHAR, N_ATT_VALUES, vg_attr); + if (Vsetattr(vgroup_id, VGATTR_NAME, DFNT_CHAR, N_ATT_VALUES, vg_attr) == FAIL) + printf("*** ERROR from Vsetattr\n"); /* * Get and display the number of attributes attached to this vgroup. @@ -74,13 +75,15 @@ main() * and the size of the attribute are not desired. */ for (attr_index = 0; attr_index < n_attrs; attr_index++) { - status_n = Vattrinfo(vgroup_id, attr_index, attr_name, NULL, &n_values, NULL); + if (Vattrinfo(vgroup_id, attr_index, attr_name, NULL, &n_values, NULL) == FAIL) + printf("*** ERROR from Vattrinfo\n"); printf("\nAttribute #%d is named %s and has %d values: ", attr_index + 1, attr_name, n_values); /* * Get and display the attribute values. */ - status_n = Vgetattr(vgroup_id, attr_index, vgattr_buf); + if (Vgetattr(vgroup_id, attr_index, vgattr_buf) == FAIL) + printf("*** ERROR from Vgetattr\n"); for (i = 0; i < n_values; i++) printf("%c ", vgattr_buf[i]); printf("\n"); @@ -90,8 +93,12 @@ main() * Terminate access to the vgroup and to the V interface, and close * the HDF file. */ - status_32 = Vdetach(vgroup_id); - status_n = Vend(file_id); - status_n = Hclose(file_id); + if (Vdetach(vgroup_id) == FAIL) + printf("*** ERROR from Vdetach\n"); + if (Vend(file_id) == FAIL) + printf("*** ERROR from Vend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/C/VG/h4ex_VG_vgroup_contents.c b/HDF4Examples/C/VG/h4ex_VG_vgroup_contents.c index 6588e3a7dc..26e123be62 100644 --- a/HDF4Examples/C/VG/h4ex_VG_vgroup_contents.c +++ b/HDF4Examples/C/VG/h4ex_VG_vgroup_contents.c @@ -7,24 +7,25 @@ main() { /************************* Variable declaration **************************/ - intn status_n; /* returned status for functions returning an intn */ - int32 status_32, /* returned status for functions returning an int32 */ - file_id, vgroup_id, vgroup_ref, obj_index, /* index of an object within a vgroup */ - num_of_pairs, /* number of tag/ref number pairs, i.e., objects */ - obj_tag, obj_ref, /* tag/ref number of an HDF object */ - vgroup_pos = 0; /* position of a vgroup in the file */ + int32 file_id, vgroup_id, vgroup_ref; + int32 obj_index; /* index of an object within a vgroup */ + int32 num_of_pairs; /* number of tag/ref number pairs, i.e., objects */ + int32 obj_tag, obj_ref; /* tag/ref number of an HDF object */ + int32 vgroup_pos = 0; /* position of a vgroup in the file */ /********************** End of variable declaration ***********************/ /* * Open the HDF file for reading. */ - file_id = Hopen(FILE_NAME, DFACC_READ, 0); + if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) + printf("*** ERROR from Hopen\n"); /* * Initialize the V interface. */ - status_n = Vstart(file_id); + if (Vstart(file_id) == FAIL) + printf("*** ERROR from Vstart\n"); /* * Obtain each vgroup in the file by its reference number, get the @@ -63,7 +64,8 @@ main() * Get the tag/ref number pair of the object specified * by its index, obj_index, and display them. */ - status_n = Vgettagref(vgroup_id, obj_index, &obj_tag, &obj_ref); + if (Vgettagref(vgroup_id, obj_index, &obj_tag, &obj_ref) == FAIL) + printf("*** ERROR from Vgettagref\n"); printf("tag = %d, ref = %d", obj_tag, obj_ref); /* @@ -85,7 +87,8 @@ main() /* * Terminate access to the current vgroup. */ - status_32 = Vdetach(vgroup_id); + if (Vdetach(vgroup_id) == FAIL) + printf("*** ERROR from Vdetach\n"); /* * Move to the next vgroup position. @@ -96,7 +99,10 @@ main() /* * Terminate access to the V interface and close the file. */ - status_n = Vend(file_id); - status_n = Hclose(file_id); + if (Vend(file_id) == FAIL) + printf("*** ERROR from Vend\n"); + if (Hclose(file_id) == FAIL) + printf("*** ERROR from Hclose\n"); + return 0; } diff --git a/HDF4Examples/CMakePresets.json b/HDF4Examples/CMakePresets.json index ff07f8eb42..af284eb781 100644 --- a/HDF4Examples/CMakePresets.json +++ b/HDF4Examples/CMakePresets.json @@ -42,6 +42,8 @@ "description": "MSVC Standard Config for x64 (Release)", "inherits": [ "ci-x64-Release-MSVC", + "ci-StdJava", + "ci-StdFortran", "ci-StdShar" ] }, @@ -50,6 +52,8 @@ "description": "Clang Standard Config for x64 (Release)", "inherits": [ "ci-x64-Release-Clang", + "ci-StdJava", + "ci-StdFortran", "ci-StdShar" ] }, @@ -58,6 +62,8 @@ "description": "GNUC Standard Config for x64 (Release)", "inherits": [ "ci-x64-Release-GNUC", + "ci-StdJava", + "ci-StdFortran", "ci-StdShar" ] }, @@ -66,6 +72,8 @@ "description": "Intel Standard Config for x64 (Release)", "inherits": [ "ci-x64-Release-Intel", + "ci-StdJava", + "ci-StdFortran", "ci-StdShar" ] } @@ -91,7 +99,7 @@ "name": "ci-StdShar-GNUC", "description": "GNUC Standard Build for x64 (Release)", "configurePreset": "ci-StdShar-GNUC", - "verbose": false, + "verbose": true, "inherits": [ "ci-x64-Release-GNUC" ] @@ -100,7 +108,7 @@ "name": "ci-StdShar-Intel", "description": "Intel Standard Build for x64 (Release)", "configurePreset": "ci-StdShar-Intel", - "verbose": false, + "verbose": true, "inherits": [ "ci-x64-Release-Intel" ] @@ -121,6 +129,23 @@ "ci-x64-Release-Clang" ] }, + { + "name": "ci-StdShar-OSX-Clang", + "configurePreset": "ci-StdShar-Clang", + "inherits": [ + "ci-x64-Release-Clang" + ], + "execution": { + "noTestsAction": "error", + "timeout": 180, + "jobs": 2 + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, { "name": "ci-StdShar-GNUC", "configurePreset": "ci-StdShar-GNUC", @@ -128,6 +153,23 @@ "ci-x64-Release-GNUC" ] }, + { + "name": "ci-StdShar-win-Intel", + "configurePreset": "ci-StdShar-Intel", + "inherits": [ + "ci-x64-Release-Intel" + ], + "filter": { + "exclude": { + "name": "HDP-dumpv|h4ex_GR_create|h4ex_GR_write|h4ex_VG_add" + } + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, { "name": "ci-StdShar-Intel", "configurePreset": "ci-StdShar-Intel", @@ -153,6 +195,14 @@ {"type": "test", "name": "ci-StdShar-Clang"} ] }, + { + "name": "ci-StdShar-OSX-Clang", + "steps": [ + {"type": "configure", "name": "ci-StdShar-Clang"}, + {"type": "build", "name": "ci-StdShar-Clang"}, + {"type": "test", "name": "ci-StdShar-OSX-Clang"} + ] + }, { "name": "ci-StdShar-GNUC", "steps": [ @@ -168,6 +218,14 @@ {"type": "build", "name": "ci-StdShar-Intel"}, {"type": "test", "name": "ci-StdShar-Intel"} ] + }, + { + "name": "ci-StdShar-win-Intel", + "steps": [ + {"type": "configure", "name": "ci-StdShar-Intel"}, + {"type": "build", "name": "ci-StdShar-Intel"}, + {"type": "test", "name": "ci-StdShar-win-Intel"} + ] } ] } diff --git a/HDF4Examples/FORTRAN/GR/h4ex_GR_create_and_write_image.f b/HDF4Examples/FORTRAN/GR/h4ex_GR_create_and_write_image.f index 9fed2dbbc8..99132c3536 100644 --- a/HDF4Examples/FORTRAN/GR/h4ex_GR_create_and_write_image.f +++ b/HDF4Examples/FORTRAN/GR/h4ex_GR_create_and_write_image.f @@ -22,7 +22,7 @@ program create_raster_image C Function declaration C integer hopen, hclose - integer mgstart, mgcreat, mgwrimg, mgendac, mgend + integer mgstart, mgcreat, mgwrimg, mgendac, mgend C C**** Variable declaration ******************************************* @@ -32,7 +32,7 @@ program create_raster_image integer gr_id, ri_id, num_type, interlace_mode integer start(2), stride(2), edges(2), dimsizes(2) integer i, j, k - integer*2 image_buf(N_COMPS, X_LENGTH, Y_LENGTH) + integer*2 image_buf(N_COMPS, X_LENGTH, Y_LENGTH) C C**** End of variable declaration ************************************ C @@ -45,19 +45,19 @@ program create_raster_image C gr_id = mgstart(file_id) C -C Set the number type, interlace mode, and dimensions of the image. +C Set the number type, interlace mode, and dimensions of the image. C num_type = DFNT_INT16 interlace_mode = MFGR_INTERLACE_PIXEL dimsizes(1) = X_LENGTH dimsizes(2) = Y_lENGTH C -C Create the raster image array. +C Create the raster image array. C ri_id = mgcreat(gr_id, IMAGE_NAME, N_COMPS, num_type, + interlace_mode, dimsizes) C -C Fill the image data buffer with values. +C Fill the image data buffer with values. C do 30 i = 1, Y_LENGTH do 20 j = 1, X_LENGTH @@ -67,7 +67,7 @@ program create_raster_image 20 continue 30 continue -C +C C Define the size of the data to be written, i.e., start from the origin C and go as long as the length of each dimension. C @@ -83,7 +83,7 @@ program create_raster_image status = mgwrimg(ri_id, start, stride, edges, image_buf) C -C Terminate access to the raster image and to the GR interface, +C Terminate access to the raster image and to the GR interface, C and close the HDF file. C status = mgendac(ri_id) diff --git a/HDF4Examples/FORTRAN/GR/h4ex_GR_get_attribute.f b/HDF4Examples/FORTRAN/GR/h4ex_GR_get_attribute.f index 061c52d120..7e15b0d1af 100644 --- a/HDF4Examples/FORTRAN/GR/h4ex_GR_get_attribute.f +++ b/HDF4Examples/FORTRAN/GR/h4ex_GR_get_attribute.f @@ -17,15 +17,15 @@ program get_attribute C integer hopen, hclose integer mgstart, mgfinfo, mgatinf, mggcatt, mggnatt , mgfndat, - + mgselct, mgendac, mgend + + mgselct, mgendac, mgend C C**** Variable declaration ******************************************* C integer status integer file_id, gr_id, ri_id - integer f_att_index, ri_att_index, data_type, n_values - integer n_rimages, n_file_attrs + integer f_att_index, ri_att_index, data_type, n_values + integer n_rimages, n_file_attrs integer*2 int_buf(10) character*17 attr_name character*80 char_buf @@ -42,7 +42,7 @@ program get_attribute C gr_id = mgstart(file_id) C -C Determine the number of attributes in the file. +C Determine the number of attributes in the file. C status = mgfinfo(gr_id, n_rimages, n_file_attrs) if ((status .NE. -1) .AND. (n_file_attrs .GT. 0)) then @@ -50,21 +50,22 @@ program get_attribute do 10 f_att_index = 0, n_file_attrs-1 C C Get information about the current file attribute. -C +C + attr_name = ' ' status = mgatinf(gr_id, f_att_index, attr_name, data_type, + n_values) C C Check whether data type is DFNT_CHAR8 in order to use allocated buffer. C if(data_type .NE. DFNT_CHAR8) then - write(*,*) + write(*,*) + 'Unable to determine data type to use allocated buffer' else C C Read and display the attribute values. C status = mggcatt(gr_id, f_att_index, char_buf) - write(*,*) 'Attribute ', attr_name, ' : ', + write(*,*) 'Attribute ', attr_name, ' : ', + char_buf(1:n_values) endif 10 continue @@ -73,10 +74,10 @@ program get_attribute C C Select the second image in the file. -C - ri_id = mgselct(gr_id, 1) C -C Find the image attribute named RI_ATTR_NAME. + ri_id = mgselct(gr_id, 1) +C +C Find the image attribute named RI_ATTR_NAME. C ri_att_index = mgfndat(ri_id, RI_ATTR_NAME) C @@ -84,7 +85,7 @@ program get_attribute C status = mgatinf(ri_id, ri_att_index, attr_name, data_type, + n_values) -C +C C Read and display attribute values. C status = mggnatt(ri_id, ri_att_index, int_buf) diff --git a/HDF4Examples/FORTRAN/GR/h4ex_GR_image_info.f b/HDF4Examples/FORTRAN/GR/h4ex_GR_image_info.f index c0fb436db2..00d0099ac2 100644 --- a/HDF4Examples/FORTRAN/GR/h4ex_GR_image_info.f +++ b/HDF4Examples/FORTRAN/GR/h4ex_GR_image_info.f @@ -12,7 +12,7 @@ program image_info C Function declaration C integer hopen, hclose - integer mgstart, mgselct, mgfinfo, mggiinf, mgendac, mgend + integer mgstart, mgselct, mgfinfo, mggiinf, mgendac, mgend C C**** Variable declaration ******************************************* @@ -45,6 +45,7 @@ program image_info C do 100 ri_index = 0, n_rimages-1 ri_id = mgselct(gr_id, ri_index) + name = ' ' status = mggiinf(ri_id, name, n_comps, data_type, + interlace_mode, dim_sizes, n_attrs) C @@ -71,13 +72,13 @@ program image_info C Display the image information for the current image. C write(*,*) 'Image index: ', ri_index - write(*,*) 'Image name: ', name + write(*,*) 'Image name: ', name write(*,*) 'Number of components: ', n_comps - write(*,*) 'Number type: ', type_string + write(*,*) 'Number type: ', type_string write(*,*) 'Interlace mode: ', interlace_string write(*,*) 'Dimnesions: ', dim_sizes(1), dim_sizes(2) write(*,*) 'Number of image attributes: ', n_attrs - write(*,*) + write(*,*) C C Terminate access to the current raster image. C diff --git a/HDF4Examples/FORTRAN/GR/h4ex_GR_modify_image.f b/HDF4Examples/FORTRAN/GR/h4ex_GR_modify_image.f index 684b1c2d70..9348100a93 100644 --- a/HDF4Examples/FORTRAN/GR/h4ex_GR_modify_image.f +++ b/HDF4Examples/FORTRAN/GR/h4ex_GR_modify_image.f @@ -32,7 +32,7 @@ program modify_image C Function declaration C integer hopen, hclose - integer mgstart, mgselct, mgcreat, mgwrimg, mgendac, mgend + integer mgstart, mgselct, mgcreat, mgwrimg, mgendac, mgend C C**** Variable declaration ******************************************* @@ -43,7 +43,7 @@ program modify_image integer start1(2), stride1(2), edges1(2) integer start2(2), stride2(2), edges2(2), dim_sizes(2) integer i, j, k - integer*2 image1_buf(N1_COMPS, X1_LENGTH, Y1_LENGTH) + integer*2 image1_buf(N1_COMPS, X1_LENGTH, Y1_LENGTH) character image2_buf(N2_COMPS, X2_LENGTH, Y2_LENGTH) C C**** End of variable declaration ************************************ @@ -65,8 +65,8 @@ program modify_image C do 20 i = 1, Y1_LENGTH do 10 j = 1, X1_LENGTH - image1_buf(1,j,i) = 0 - image1_buf(2,j,i) = 0 + image1_buf(1,j,i) = 0 + image1_buf(2,j,i) = 0 10 continue 20 continue C @@ -85,7 +85,7 @@ program modify_image status = mgwrimg(ri1_id, start1, stride1, edges1, image1_buf) C -C Set the number type, interlace mode, and dimensions of the second image. +C Set the number type, interlace mode, and dimensions of the second image. C data_type = DFNT_CHAR8 interlace_mode = MFGR_INTERLACE_PIXEL @@ -97,24 +97,24 @@ program modify_image ri2_id = mgcreat(gr_id, IMAGE2_NAME, N2_COMPS, data_type, + interlace_mode, dim_sizes) C -C Fill the image data buffer with values. +C Fill the image data buffer with values. C - do 60 i = 1, Y2_LENGTH + do 60 i = 1, Y2_LENGTH do 50 j = 1, X2_LENGTH - do 40 k = 1, N2_COMPS - image2_buf(k,j,i) = char(65 + k - 1) + do 40 k = 1, N2_COMPS + image2_buf(k,j,i) = char(65 + k - 1) 40 continue 50 continue 60 continue -C +C C Define the size of the data to be written, i.e., start from the origin C and go as long as the length of each dimension. C start2(1) = 0 start2(2) = 0 edges2(1) = dim_sizes(1) - edges2(2) = dim_sizes(2) + edges2(2) = dim_sizes(2) stride2(1) = 1 stride2(2) = 1 C diff --git a/HDF4Examples/FORTRAN/GR/h4ex_GR_read_image.f b/HDF4Examples/FORTRAN/GR/h4ex_GR_read_image.f index fccbfe52ad..7cb4522f7a 100644 --- a/HDF4Examples/FORTRAN/GR/h4ex_GR_read_image.f +++ b/HDF4Examples/FORTRAN/GR/h4ex_GR_read_image.f @@ -27,7 +27,7 @@ program read_raster_image C Function declaration C integer hopen, hclose - integer mgstart, mgselct, mgrdimg, mgendac, mgend + integer mgstart, mgselct, mgrdimg, mgendac, mgend C C**** Variable declaration ******************************************* @@ -37,9 +37,9 @@ program read_raster_image integer gr_id, ri_id integer start(2), stride(2), edges(2) integer i, j - integer*2 entire_image(N_COMPS, X_LENGTH, Y_LENGTH) - integer*2 partial_image(N_COMPS, PART_ROWS, PART_COLS) - integer*2 skipped_image(N_COMPS, SKIP_ROWS, SKIP_COLS) + integer*2 entire_image(N_COMPS, X_LENGTH, Y_LENGTH) + integer*2 partial_image(N_COMPS, PART_ROWS, PART_COLS) + integer*2 skipped_image(N_COMPS, SKIP_ROWS, SKIP_COLS) C C**** End of variable declaration ************************************ C @@ -55,7 +55,7 @@ program read_raster_image C Select the first raster image in the file. C ri_id = mgselct(gr_id, 0) -C +C C Define the size of the data to be read, i.e., start from the origin C and go as long as the length of each dimension. C @@ -66,7 +66,7 @@ program read_raster_image stride(1) = 1 stride(2) = 1 C -C Read the data from the raster image array. +C Read the data from the raster image array. C status = mgrdimg(ri_id, start, stride, edges, entire_image) C @@ -83,17 +83,17 @@ program read_raster_image C Define the size of the data to be read. C start(1) = ROWS_PART_START - start(2) = COLS_PART_START - edges(1) = PART_ROWS - edges(2) = PART_COLS + start(2) = COLS_PART_START + edges(1) = PART_ROWS + edges(2) = PART_COLS stride(1) = 1 stride(2) = 1 C -C Read a subset of the raster image array. +C Read a subset of the raster image array. C status = mgrdimg(ri_id, start, stride, edges, partial_image) C -C Display only the first component of the read sample. +C Display only the first component of the read sample. C write(*,*) + 'Two rows and three columns at 4th row and 2nd column', @@ -107,17 +107,17 @@ program read_raster_image C Define the size and the pattern to read the data. C start(1) = ROWS_SKIP_START - start(2) = COLS_SKIP_START - edges(1) = SKIP_ROWS - edges(2) = SKIP_COLS - stride(1) = N_STRIDES - stride(2) = N_STRIDES + start(2) = COLS_SKIP_START + edges(1) = SKIP_ROWS + edges(2) = SKIP_COLS + stride(1) = N_STRIDES + stride(2) = N_STRIDES C C Read all the odd rows and even columns of the image. C status = mgrdimg(ri_id, start, stride, edges, skipped_image) C -C Display only the first component of the read sample. +C Display only the first component of the read sample. C write(*,*) 'All even rows and odd columns of the first component' write(*,*) @@ -126,7 +126,7 @@ program read_raster_image 30 continue write(*,*) C -C Terminate access to the raster image and to the GR interface, +C Terminate access to the raster image and to the GR interface, C and close the HDF file. C status = mgendac(ri_id) diff --git a/HDF4Examples/FORTRAN/GR/h4ex_GR_read_palette.f b/HDF4Examples/FORTRAN/GR/h4ex_GR_read_palette.f index 0120480959..bf687762e1 100644 --- a/HDF4Examples/FORTRAN/GR/h4ex_GR_read_palette.f +++ b/HDF4Examples/FORTRAN/GR/h4ex_GR_read_palette.f @@ -21,8 +21,8 @@ program read_palette C Function declaration C integer hopen, hclose - integer mgstart, mgn2ndx, mgselct, mggltid, mgglinf, - + mgrclut, mgendac, mgend + integer mgstart, mgn2ndx, mgselct, mggltid, mgglinf, + + mgrclut, mgendac, mgend C C**** Variable declaration ******************************************* C @@ -61,7 +61,7 @@ program read_palette C status = mgglinf(pal_id, n_comps, data_type, interlace_mode, + n_entries_out) - write(*,*) ' Palette: ', n_comps, ' components; ', + write(*,*) ' Palette: ', n_comps, ' components; ', + n_entries_out, ' entries' C C Read the palette. @@ -73,7 +73,7 @@ program read_palette write(*,*) "Palette data" do 10 i = 1, n_entries_out write(*,*) (ichar(palette_data(j,i)), j = 1, n_comps) -10 continue +10 continue C C Terminate access to the raster image and to the GR interface, C and close the HDF file. diff --git a/HDF4Examples/FORTRAN/GR/h4ex_GR_set_attribute.f b/HDF4Examples/FORTRAN/GR/h4ex_GR_set_attribute.f index d8e6387fcf..b7cc2001c8 100644 --- a/HDF4Examples/FORTRAN/GR/h4ex_GR_set_attribute.f +++ b/HDF4Examples/FORTRAN/GR/h4ex_GR_set_attribute.f @@ -39,7 +39,7 @@ program set_attribute C integer hopen, hclose integer mgstart, mgscatt, mgsnatt , mgn2ndx, - + mgselct, mgendac, mgend + + mgselct, mgendac, mgend C C**** Variable declaration ******************************************* @@ -51,7 +51,7 @@ program set_attribute do 10 i = 1, RI_ATT2_N_VALUES ri_attr_2(i) = i -10 continue +10 continue C C**** End of variable declaration ************************************ C @@ -67,25 +67,25 @@ program set_attribute C Set two file attributes to the file with names, data type, numbers of C values, and values of attributes specified. C - status = mgscatt(gr_id, F_ATT1_NAME, DFNT_CHAR8, + status = mgscatt(gr_id, F_ATT1_NAME, DFNT_CHAR8, + F_ATT1_N_VALUES, F_ATT1_VAL) - status = mgscatt(gr_id, F_ATT2_NAME, DFNT_CHAR8, + status = mgscatt(gr_id, F_ATT2_NAME, DFNT_CHAR8, + F_ATT2_N_VALUES, F_ATT2_VAL) C C Obtain the index of the image named IMAGE_NAMR. C ri_index = mgn2ndx(gr_id, IMAGE_NAME) C -C Obtain the identifier of this image. +C Obtain the identifier of this image. C ri_id = mgselct(gr_id, ri_index) C C Set two attributes of the image with names, data types, number of -C values, and values of the attributes specified. +C values, and values of the attributes specified. C - status = mgscatt(ri_id, RI_ATT1_NAME, DFNT_CHAR8, - + RI_ATT1_N_VALUES, RI_ATT1_VAL) - status = mgsnatt(ri_id, RI_ATT2_NAME, DFNT_INT16, + status = mgscatt(ri_id, RI_ATT1_NAME, DFNT_CHAR8, + + RI_ATT1_N_VALUES, RI_ATT1_VAL) + status = mgsnatt(ri_id, RI_ATT2_NAME, DFNT_INT16, + RI_ATT2_N_VALUES, ri_attr_2) C C Terminate access to the image and to the GR interface, diff --git a/HDF4Examples/FORTRAN/GR/h4ex_GR_write_palette.f b/HDF4Examples/FORTRAN/GR/h4ex_GR_write_palette.f index a3e1e4bb0c..42ad6a9214 100644 --- a/HDF4Examples/FORTRAN/GR/h4ex_GR_write_palette.f +++ b/HDF4Examples/FORTRAN/GR/h4ex_GR_write_palette.f @@ -27,8 +27,8 @@ program write_palette C Function declaration C integer hopen, hclose - integer mgstart, mgcreat, mgwcimg, mggltid, mgwclut, - + mgendac, mgend + integer mgstart, mgcreat, mgwcimg, mggltid, mgwclut, + + mgendac, mgend C C**** Variable declaration ******************************************* C @@ -37,7 +37,7 @@ program write_palette integer start(2), stride(2), edges(2), dim_sizes(2) integer status integer i, j - character image_buf(N_COMPS_IMG, X_LENGTH, Y_LENGTH) + character image_buf(N_COMPS_IMG, X_LENGTH, Y_LENGTH) character palette_buf(N_COMPS_PAL, N_ENTRIES) C C**** End of variable declaration ************************************ @@ -51,27 +51,27 @@ program write_palette C gr_id = mgstart(file_id) C -C Define interlace mode and dimensions of the image. +C Define interlace mode and dimensions of the image. C interlace_mode = MFGR_INTERLACE_PIXEL dim_sizes(1) = X_LENGTH dim_sizes(2) = Y_lENGTH C -C Create the raster image array. +C Create the raster image array. C ri_id = mgcreat(gr_id, NEW_IMAGE_NAME, N_COMPS_IMG, DFNT_CHAR8, + interlace_mode, dim_sizes) C -C Fill the image data buffer with values. +C Fill the image data buffer with values. C do 20 i = 1, Y_LENGTH do 10 j = 1, X_LENGTH image_buf(1,j,i) = char(i + j - 1 ) - image_buf(2,j,i) = char(i + j) + image_buf(2,j,i) = char(i + j) 10 continue 20 continue -C +C C Define the size of the data to be written, i.e., start from the origin C and go as long as the length of each dimension. C @@ -92,7 +92,7 @@ program write_palette do 30 j = 1, N_COMPS_PAL palette_buf(j,i) = char(i) 30 continue -40 continue +40 continue C C Get the identifier of the palette attached to the image NEW_IMAGE_NAME. C diff --git a/HDF4Examples/FORTRAN/SD/h4ex_SD_alter_sds_values.f b/HDF4Examples/FORTRAN/SD/h4ex_SD_alter_sds_values.f index 8233885c5b..568c714f65 100644 --- a/HDF4Examples/FORTRAN/SD/h4ex_SD_alter_sds_values.f +++ b/HDF4Examples/FORTRAN/SD/h4ex_SD_alter_sds_values.f @@ -17,7 +17,7 @@ program alter_data integer sd_id, sds_id, sds_index integer start(2), edges(2), stride(2) integer status - integer new_data(2) + integer new_data(2) C C**** End of variable declaration ************************************ C @@ -28,26 +28,26 @@ program alter_data sd_id = sfstart(FILE_NAME, DFACC_WRITE) C C Select the first data set. -C +C sds_index = 0 sds_id = sfselect(sd_id, sds_index) C -C Initialize the start, edge, and stride parameters to write +C Initialize the start, edge, and stride parameters to write C two elements into 2nd row, 10th column and 11th column places. -C +C C Specify 2nd row. C - start(1) = 1 + start(1) = 1 C C Specify 10th column. C - start(2) = 9 - edges(1) = 1 + start(2) = 9 + edges(1) = 1 C C Two elements are written along 2nd row. C - edges(2) = 2 + edges(2) = 2 stride(1) = 1 stride(2) = 1 C @@ -56,7 +56,7 @@ program alter_data new_data(1) = 1000 new_data(2) = 1000 C -C Write the new values. +C Write the new values. C status = sfwdata(sds_id, start, stride, edges, new_data) C diff --git a/HDF4Examples/FORTRAN/SD/h4ex_SD_chunking_example.f b/HDF4Examples/FORTRAN/SD/h4ex_SD_chunking_example.f index 8266dfc55c..3c3471aa2d 100644 --- a/HDF4Examples/FORTRAN/SD/h4ex_SD_chunking_example.f +++ b/HDF4Examples/FORTRAN/SD/h4ex_SD_chunking_example.f @@ -48,7 +48,7 @@ program chunk_examples C C**** Variable declaration ******************************************* C - integer sd_id, sds_id, sds_index, status + integer sd_id, sds_id, sds_index, status integer dim_sizes(2), origin(2) integer fill_value, maxcache, new_maxcache, flag integer start(2), edges(2), stride(2) @@ -86,9 +86,9 @@ program chunk_examples C C Define chunk's dimensions. C - dim_length(1) = 2 - dim_length(2) = 3 -C + dim_length(1) = 2 + dim_length(2) = 3 +C C Create the file and initialize SD interface. C sd_id = sfstart(FILE_NAME, DFACC_CREATE) @@ -96,8 +96,8 @@ program chunk_examples C C Create 4x9 SDS C - dim_sizes(1) = 4 - dim_sizes(2) = 9 + dim_sizes(1) = 4 + dim_sizes(2) = 9 sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT16, + RANK, dim_sizes) C @@ -130,9 +130,9 @@ program chunk_examples C comp_type = COMP_CODE_SKPHUFF C C GZIP: -C comp_prm(1) = value_of(deflate_level) +C comp_prm(1) = value_of(deflate_level) C comp_type = COMP_CODE_DEFLATE -C +C C comp_type = COMP_CODE_NONE status = sfschnk(sds_id, dim_length, comp_type, comp_prm) @@ -141,7 +141,7 @@ program chunk_examples C flag = 0 maxcache = 2 - new_maxcache = sfscchnk(sds_id, maxcache, flag) + new_maxcache = sfscchnk(sds_id, maxcache, flag) C C Write chunks using SDwritechunk function. C Chunks can be written in any order. @@ -150,42 +150,42 @@ program chunk_examples C origin(1) = 1 origin(2) = 1 - status = sfwchnk(sds_id, origin, chunk1) + status = sfwchnk(sds_id, origin, chunk1) C C Write chunk with the coordinates (1,2). C - origin(1) = 1 - origin(2) = 2 - status = sfwchnk(sds_id, origin, chunk3) + origin(1) = 1 + origin(2) = 2 + status = sfwchnk(sds_id, origin, chunk3) C C Write chunk with the coordinates (2,1). C - origin(1) = 2 - origin(2) = 1 - status = sfwchnk(sds_id, origin, chunk2) + origin(1) = 2 + origin(2) = 1 + status = sfwchnk(sds_id, origin, chunk2) C C Write chunk with the coordinates (2,3). C - origin(1) = 2 - origin(2) = 3 - status = sfwchnk(sds_id, origin, chunk6) + origin(1) = 2 + origin(2) = 3 + status = sfwchnk(sds_id, origin, chunk6) C C Fill second row in the chunk with the coordinates (2,2). C start(1) = 3 start(2) = 3 - edges(1) = 1 - edges(2) = 3 + edges(1) = 1 + edges(2) = 3 stride(1) = 1 stride(2) = 1 status = sfwdata(sds_id, start, stride, edges, row) C C Fill second column in the chunk with the coordinates (1,3). C - start(1) = 0 - start(2) = 7 - edges(1) = 2 - edges(2) = 1 + start(1) = 0 + start(2) = 7 + edges(1) = 2 + edges(2) = 1 stride(1) = 1 stride(2) = 1 status = sfwdata(sds_id, start, stride, edges, column) @@ -194,7 +194,7 @@ program chunk_examples C status = sfendacc(sds_id) C -C Terminate access to the SD interface and close the file. +C Terminate access to the SD interface and close the file. C status = sfend(sd_id) C @@ -225,7 +225,7 @@ program chunk_examples C C SDS is chunked C Chunks dimensions are 2 x 3 -C +C C 1 1 1 3 3 3 0 5 0 C 1 1 1 3 3 3 0 5 0 C 2 2 2 0 0 0 6 6 6 @@ -244,7 +244,7 @@ program chunk_examples write(*,*) do 10 i = 1,4 write(*,*) (all_data(i,j), j=1,9) -10 continue +10 continue C C Read chunks with the coordinates (2,2) and (1,3) and display. C The following information will be shown: @@ -253,7 +253,7 @@ program chunk_examples C C 0 0 0 C 4 4 4 -C +C C Chunk (1,3) C C 0 5 0 @@ -262,19 +262,19 @@ program chunk_examples origin(1) = 2 origin(2) = 2 status = sfrchnk(sds_id, origin, chunk_out) - write(*,*) + write(*,*) write(*,*) 'Chunk (2,2)' - write(*,*) + write(*,*) do 20 i = 1,2 write(*,*) (chunk_out(i,j), j=1,3) 20 continue C - origin(1) = 1 - origin(2) = 3 + origin(1) = 1 + origin(2) = 3 status = sfrchnk(sds_id, origin, chunk_out) - write(*,*) + write(*,*) write(*,*) 'Chunk (1,3)' - write(*,*) + write(*,*) do 30 i = 1,2 write(*,*) (chunk_out(i,j), j=1,3) 30 continue @@ -283,7 +283,7 @@ program chunk_examples C status = sfendacc(sds_id) C -C Terminate access to the SD interface and close the file. +C Terminate access to the SD interface and close the file. C status = sfend(sd_id) - end + end diff --git a/HDF4Examples/FORTRAN/SD/h4ex_SD_compress_sds.f b/HDF4Examples/FORTRAN/SD/h4ex_SD_compress_sds.f index 52612a1a72..14cd7f37e9 100644 --- a/HDF4Examples/FORTRAN/SD/h4ex_SD_compress_sds.f +++ b/HDF4Examples/FORTRAN/SD/h4ex_SD_compress_sds.f @@ -18,9 +18,9 @@ program write_compressed_data parameter (COMP_CODE_DEFLATE = 4) integer DEFLATE_LEVEL parameter (DEFLATE_LEVEL = 6) -C To use Skipping Huffman compression method, declare +C To use Skipping Huffman compression method, declare C integer COMP_CODE_SKPHUFF -C parameter(COMP_CODE_SKPHUFF = 3) +C parameter(COMP_CODE_SKPHUFF = 3) C To use RLE compression method, declare C integer COMP_CODE_RLE C parameter(COMP_CODE_RLE = 1) @@ -43,7 +43,7 @@ program write_compressed_data C**** End of variable declaration ************************************ C C -C Buffer array data and define array dimensions. +C Buffer array data and define array dimensions. C do 20 j = 1, Y_LENGTH do 10 i = 1, X_LENGTH @@ -57,15 +57,15 @@ program write_compressed_data C sd_id = sfstart(FILE_NAME, DFACC_CREATE) C -C Create the data set with the name SDS_NAME. +C Create the data set with the name SDS_NAME. C - sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, dim_sizes) + sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, dim_sizes) C C Initialize compression parameter (deflate level) C and call sfscompress function C For Skipping Huffman compression, comp_prm(1) should be set C to skipping sizes value (skp_size). -C +C comp_type = COMP_CODE_DEFLATE comp_prm(1) = deflate_level status = sfscompress(sds_id, comp_type, comp_prm(1)) diff --git a/HDF4Examples/FORTRAN/SD/h4ex_SD_create_sds.f b/HDF4Examples/FORTRAN/SD/h4ex_SD_create_sds.f index 0280fada7c..586416cda5 100644 --- a/HDF4Examples/FORTRAN/SD/h4ex_SD_create_sds.f +++ b/HDF4Examples/FORTRAN/SD/h4ex_SD_create_sds.f @@ -1,4 +1,4 @@ - program create_SDS + program create_SDS implicit none C C Parameter declaration. @@ -38,9 +38,9 @@ program create_SDS C C Create the array with the name defined in SDS_NAME. C Note that DFNT_INT32 indicates that the SDS data is of type -C integer. Refer to Tables 2E and 2I for the definition of other types. +C integer. Refer to Tables 2E and 2I for the definition of other types. C - sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, + sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, . dim_sizes) C C Terminate access to the data set. diff --git a/HDF4Examples/FORTRAN/SD/h4ex_SD_dimscale_vs_sds.f b/HDF4Examples/FORTRAN/SD/h4ex_SD_dimscale_vs_sds.f index e06040adc5..9cb4c57495 100644 --- a/HDF4Examples/FORTRAN/SD/h4ex_SD_dimscale_vs_sds.f +++ b/HDF4Examples/FORTRAN/SD/h4ex_SD_dimscale_vs_sds.f @@ -1,4 +1,4 @@ - program sds_vrs_coordvar + program sds_vrs_coordvar implicit none C C Parameter declaration. @@ -12,7 +12,7 @@ program sds_vrs_coordvar parameter (MAX_VAR_DIMS = 32) C C Function declaration. -C +C integer sfstart, sfselect, sfiscvar, sffinfo, sfginfo integer sfendacc, sfend C @@ -32,14 +32,14 @@ program sds_vrs_coordvar sd_id = sfstart(FILE_NAME, DFACC_READ) C C Obtain information about the file. -C - status = sffinfo(sd_id, n_datasets, n_file_attrs) +C + status = sffinfo(sd_id, n_datasets, n_file_attrs) C C Get information about each SDS in the file. -C Check whether it is a coordinate variable, then display retrieved -C information. +C Check whether it is a coordinate variable, then display retrieved +C information. C Output displayed: -C +C C SDS array with the name SDStemplate C Coordinate variable with the name X_Axis C Coordinate variable with the name Y_Axis @@ -51,10 +51,10 @@ program sds_vrs_coordvar status = sfiscvar(sds_id) if (status .eq. 1) then write(*,*) "Coordinate variable with the name ", - + sds_name(1:6) + + sds_name(1:6) else - write(*,*) "SDS array with the name ", - + sds_name(1:11) + write(*,*) "SDS array with the name ", + + sds_name(1:11) endif C C Terminate access to the data set. diff --git a/HDF4Examples/FORTRAN/SD/h4ex_SD_find_sds_by_name.f b/HDF4Examples/FORTRAN/SD/h4ex_SD_find_sds_by_name.f index c3ac62bd60..c727e30cfb 100644 --- a/HDF4Examples/FORTRAN/SD/h4ex_SD_find_sds_by_name.f +++ b/HDF4Examples/FORTRAN/SD/h4ex_SD_find_sds_by_name.f @@ -22,7 +22,7 @@ program locate_by_name integer sfstart, sfn2index, sfselect, sfrdata, sfendacc, sfend C C**** Variable declaration ******************************************* -C +C integer sd_id, sds_id, sds_index, status integer start(2), edges(2), stride(2) integer data(X_LENGTH, Y_LENGTH) @@ -35,24 +35,24 @@ program locate_by_name C sd_id = sfstart(FILE_NAME, DFACC_READ) C -C Find index of the data set with the name specified in WRONG_NAME. -C Error condition occurs, since a data set with this name +C Find index of the data set with the name specified in WRONG_NAME. +C Error condition occurs, since a data set with this name C does not exist in the file. C sds_index = sfn2index(sd_id, WRONG_NAME) if (sds_index .eq. -1) then write(*,*) "Data set with the name ", WRONG_NAME, - + " does not exist" + + " does not exist" endif C -C Find index of the data set with the name specified in SDS_NAME -C and use the index to attach to the data set. +C Find index of the data set with the name specified in SDS_NAME +C and use the index to attach to the data set. C sds_index = sfn2index(sd_id, SDS_NAME) sds_id = sfselect(sd_id, sds_index) C -C Set elements of start array to 0, elements of edges array -C to SDS dimensions, and elements of stride array to 1 to read entire data. +C Set elements of start array to 0, elements of edges array +C to SDS dimensions, and elements of stride array to 1 to read entire data. C start(1) = 0 start(2) = 0 @@ -61,7 +61,7 @@ program locate_by_name stride(1) = 1 stride(2) = 1 C -C Read entire data into array named data. +C Read entire data into array named data. C status = sfrdata(sds_id, start, stride, edges, data) C @@ -71,7 +71,7 @@ program locate_by_name C write(*,*) (data(j,10), j = 1, X_LENGTH) C -C Terminate access to the data set. +C Terminate access to the data set. C status = sfendacc(sds_id) C diff --git a/HDF4Examples/FORTRAN/SD/h4ex_SD_get_attr.f b/HDF4Examples/FORTRAN/SD/h4ex_SD_get_attr.f index 73cbb64458..2c360fa534 100644 --- a/HDF4Examples/FORTRAN/SD/h4ex_SD_get_attr.f +++ b/HDF4Examples/FORTRAN/SD/h4ex_SD_get_attr.f @@ -26,7 +26,7 @@ program attr_info integer sd_id, sds_id, dim_id integer attr_index, data_type, n_values, status real sds_data(2) - character*20 attr_name + character*20 attr_name character*16 file_data character*7 dim_data integer i @@ -34,7 +34,7 @@ program attr_info C**** End of variable declaration ************************************ C C -C Open the file and initialize SD interface. +C Open the file and initialize SD interface. C sd_id = sfstart(FILE_NAME, DFACC_READ) C @@ -43,47 +43,47 @@ program attr_info C attr_index = sffattr(sd_id, FILE_ATTR_NAME) C -C Get information about the file attribute. +C Get information about the file attribute. C - status = sfgainfo(sd_id, attr_index, attr_name, data_type, - + n_values) + status = sfgainfo(sd_id, attr_index, attr_name, data_type, + + n_values) C -C Read the file attribute data. +C Read the file attribute data. C status = sfrattr(sd_id, attr_index, file_data) C C Print file attribute value. C - write(*,*) "File attribute value is : ", file_data + write(*,*) "File attribute value is : ", file_data C -C Select the first data set. +C Select the first data set. C sds_id = sfselect(sd_id, 0) C C Find the data set attribute defined by SDS_ATTR_NAME. -C Note that the first parameter is a data set identifier. +C Note that the first parameter is a data set identifier. C attr_index = sffattr(sds_id, SDS_ATTR_NAME) C -C Get information about the data set attribute. +C Get information about the data set attribute. C - status = sfgainfo(sds_id, attr_index, attr_name, data_type, - + n_values) + status = sfgainfo(sds_id, attr_index, attr_name, data_type, + + n_values) C -C Read the SDS attribute data. +C Read the SDS attribute data. C status = sfrattr(sds_id, attr_index, sds_data) C -C Print SDS attribute data type and values. +C Print SDS attribute data type and values. C if (data_type .eq. DFNT_FLOAT32) then - write(*,*) "SDS attribute data type is : float32 " + write(*,*) "SDS attribute data type is : float32 " endif - write(*,*) "SDS attribute values are : " - write(*,*) (sds_data(i), i=1, n_values) + write(*,*) "SDS attribute values are : " + write(*,*) (sds_data(i), i=1, n_values) C -C Get the identifier for the first dimension of the SDS. +C Get the identifier for the first dimension of the SDS. C dim_id = sfdimid(sds_id, 0) C @@ -92,24 +92,24 @@ program attr_info C attr_index = sffattr(dim_id, DIM_ATTR_NAME) C -C Get information about dimension attribute. +C Get information about dimension attribute. C - status = sfgainfo(dim_id, attr_index, attr_name, data_type, - + n_values) + status = sfgainfo(dim_id, attr_index, attr_name, data_type, + + n_values) C -C Read the dimension attribute data. +C Read the dimension attribute data. C status = sfrattr(dim_id, attr_index, dim_data) C C Print dimension attribute value. C - write(*,*) "Dimensional attribute value is : ", dim_data + write(*,*) "Dimensional attribute value is : ", dim_data C -C Terminate access to the data set. +C Terminate access to the data set. C status = sfendacc(sds_id) C -C Terminate access to the SD interface and close the file. +C Terminate access to the SD interface and close the file. C status = sfend(sd_id) C @@ -117,8 +117,8 @@ program attr_info C C C File attribute value is : Storm_track_data -C SDS attribute data type is : float32 -C SDS attribute values are : +C SDS attribute data type is : float32 +C SDS attribute values are : C 2.00000 10.00000 C Dimensional attribute value is : Seconds C diff --git a/HDF4Examples/FORTRAN/SD/h4ex_SD_get_info.f b/HDF4Examples/FORTRAN/SD/h4ex_SD_get_info.f index dfc70dbebb..546f3b1d1b 100644 --- a/HDF4Examples/FORTRAN/SD/h4ex_SD_get_info.f +++ b/HDF4Examples/FORTRAN/SD/h4ex_SD_get_info.f @@ -1,4 +1,4 @@ - program get_data_set_info + program get_data_set_info implicit none C C Parameter declaration. @@ -34,8 +34,8 @@ program get_data_set_info C sd_id = sfstart(FILE_NAME, DFACC_READ) C -C Determine the number of data sets in the file and the number of -C file attributes. +C Determine the number of data sets in the file and the number of +C file attributes. C status = sffinfo(sd_id, n_datasets, n_file_attrs) C @@ -43,7 +43,7 @@ program get_data_set_info C dimension sizes, data type, and number of attributes. C The following information should be displayed: C -C name = SDStemplate +C name = SDStemplate C rank = 2 C dimension sizes are : 5 16 C data type is 24 @@ -51,13 +51,13 @@ program get_data_set_info C do 10 index = 0, n_datasets - 1 sds_id = sfselect(sd_id, index) - status = sfginfo(sds_id, name, rank, dim_sizes, data_type, + status = sfginfo(sds_id, name, rank, dim_sizes, data_type, . n_attrs) write(*,*) "name = ", name(1:15) write(*,*) "rank = ", rank write(*,*) "dimension sizes are : ", (dim_sizes(i), i=1, rank) write(*,*) "data type is ", data_type - write(*,*) "number of attributes is ", n_attrs + write(*,*) "number of attributes is ", n_attrs C C Terminate access to the current data set. C diff --git a/HDF4Examples/FORTRAN/SD/h4ex_SD_mv_sds_to_external.f b/HDF4Examples/FORTRAN/SD/h4ex_SD_mv_sds_to_external.f index 5d25aa3486..f15d01f80e 100644 --- a/HDF4Examples/FORTRAN/SD/h4ex_SD_mv_sds_to_external.f +++ b/HDF4Examples/FORTRAN/SD/h4ex_SD_mv_sds_to_external.f @@ -1,5 +1,5 @@ program write_extfile - implicit none + implicit none C C Parameter declaration. C @@ -39,11 +39,11 @@ program write_extfile C status = sfsextf(sds_id, EXT_FILE_NAME, OFFSET) C -C Terminate access to the data set. +C Terminate access to the data set. C status = sfendacc(sds_id) C -C Terminate access to the SD interface and close the file. +C Terminate access to the SD interface and close the file. C status = sfend(sd_id) diff --git a/HDF4Examples/FORTRAN/SD/h4ex_SD_read_from_sds.f b/HDF4Examples/FORTRAN/SD/h4ex_SD_read_from_sds.f index 50e2d7b297..4f802bb877 100644 --- a/HDF4Examples/FORTRAN/SD/h4ex_SD_read_from_sds.f +++ b/HDF4Examples/FORTRAN/SD/h4ex_SD_read_from_sds.f @@ -6,7 +6,7 @@ program read_data character*7 FILE_NAME integer X_LENGTH, Y_LENGTH parameter (FILE_NAME = 'SDS.hdf', - + X_LENGTH = 5, + + X_LENGTH = 5, + Y_LENGTH = 16) integer DFACC_READ, DFNT_INT32 parameter (DFACC_READ = 1, @@ -38,9 +38,9 @@ program read_data sds_id = sfselect(sd_id, sds_index) C -C Set elements of the array start to 0, elements of the array edges to +C Set elements of the array start to 0, elements of the array edges to C SDS dimensions, and elements of the array stride to 1 to read the -C entire data. +C entire data. C start(1) = 0 start(2) = 0 @@ -50,10 +50,10 @@ program read_data stride(2) = 1 C C Read entire data into data array. Note that sfrdata is used -C to read the numeric data. +C to read the numeric data. C status = sfrdata(sds_id, start, stride, edges, data) - + C C Print 10th column; the following numbers are displayed: C diff --git a/HDF4Examples/FORTRAN/SD/h4ex_SD_read_subsets.f b/HDF4Examples/FORTRAN/SD/h4ex_SD_read_subsets.f index 17d96e9b25..16ad8d84bb 100644 --- a/HDF4Examples/FORTRAN/SD/h4ex_SD_read_subsets.f +++ b/HDF4Examples/FORTRAN/SD/h4ex_SD_read_subsets.f @@ -9,9 +9,9 @@ program read_subsets parameter (DFACC_READ = 1, + DFNT_INT32 = 24) integer SUB1_LENGTH, SUB2_LENGTH, SUB3_LENGTH1, - + SUB3_LENGTH2 + + SUB3_LENGTH2 parameter (SUB1_LENGTH = 5, - + SUB2_LENGTH = 4, + + SUB2_LENGTH = 4, + SUB3_LENGTH1 = 2, + SUB3_LENGTH2 = 3) @@ -43,76 +43,76 @@ program read_subsets C C Reading the first subset. C -C Set elements of start, stride, and edges arrays to read -C every 3d element in in the 2nd row starting in the 4th column. +C Set elements of start, stride, and edges arrays to read +C every 3d element in in the 2nd row starting in the 4th column. C - start(1) = 1 - start(2) = 3 - edges(1) = 1 + start(1) = 1 + start(2) = 3 + edges(1) = 1 edges(2) = SUB1_LENGTH stride(1) = 1 - stride(2) = 3 + stride(2) = 3 C -C Read the data from sub1_data array. +C Read the data from sub1_data array. C status = sfrdata(sds_id, start, stride, edges, sub1_data) - + C C Print what we have just read, the following numbers should be displayed: C -C 5 8 1000 14 17 +C 5 8 1000 14 17 C write(*,*) (sub1_data(j), j = 1, SUB1_LENGTH) C C Reading the second subset. C -C Set elements of start, stride, and edges arrays to read -C first 4 elements of 10th column. +C Set elements of start, stride, and edges arrays to read +C first 4 elements of 10th column. C - start(1) = 0 - start(2) = 9 - edges(1) = SUB2_LENGTH - edges(2) = 1 + start(1) = 0 + start(2) = 9 + edges(1) = SUB2_LENGTH + edges(2) = 1 stride(1) = 1 - stride(2) = 1 + stride(2) = 1 C -C Read the data into sub2_data array. +C Read the data into sub2_data array. C status = sfrdata(sds_id, start, stride, edges, sub2_data) - + C C Print what we have just read; the following numbers should be displayed: C -C 10 1000 12 13 +C 10 1000 12 13 C write(*,*) (sub2_data(j), j = 1, SUB2_LENGTH) C C Reading the third subset. C -C Set elements of start, stride and edges arrays to read +C Set elements of start, stride and edges arrays to read C every 6th element in the row and every 4th element in the column -C starting at 1st row, 3rd column. +C starting at 1st row, 3rd column. C - start(1) = 0 - start(2) = 2 - edges(1) = SUB3_LENGTH1 - edges(2) = SUB3_LENGTH2 - stride(1) = 4 - stride(2) = 6 + start(1) = 0 + start(2) = 2 + edges(1) = SUB3_LENGTH1 + edges(2) = SUB3_LENGTH2 + stride(1) = 4 + stride(2) = 6 C -C Read the data from the file into sub3_data array. +C Read the data from the file into sub3_data array. C status = sfrdata(sds_id, start, stride, edges, sub3_data) - + C C Print what we have just read; the following numbers should be displayed: C C 3 9 15 -C 7 13 19 +C 7 13 19 C do 50 i = 1, SUB3_LENGTH1 write(*,*) (sub3_data(i,j), j = 1, SUB3_LENGTH2) -50 continue +50 continue C C Terminate access to the data set. C diff --git a/HDF4Examples/FORTRAN/SD/h4ex_SD_set_attr.f b/HDF4Examples/FORTRAN/SD/h4ex_SD_set_attr.f index a813c64c49..b66a19120e 100644 --- a/HDF4Examples/FORTRAN/SD/h4ex_SD_set_attr.f +++ b/HDF4Examples/FORTRAN/SD/h4ex_SD_set_attr.f @@ -24,7 +24,7 @@ program set_attribs C**** Variable declaration ******************************************* C integer sd_id, sds_id, sds_index, status - integer dim_id, dim_index + integer dim_id, dim_index integer n_values character*16 file_values real sds_values(2) @@ -37,17 +37,17 @@ program set_attribs C**** End of variable declaration ************************************ C C -C Open the file and initialize the SD interface. +C Open the file and initialize the SD interface. C sd_id = sfstart(FILE_NAME, DFACC_WRITE) C -C Set an attribute that describes the file contents. +C Set an attribute that describes the file contents. C n_values = 16 - status = sfscatt(sd_id, FILE_ATTR_NAME, DFNT_CHAR8, n_values, + status = sfscatt(sd_id, FILE_ATTR_NAME, DFNT_CHAR8, n_values, + file_values) C -C Select the first data set. +C Select the first data set. C sds_index = 0 sds_id = sfselect(sd_id, sds_index) @@ -56,22 +56,22 @@ program set_attribs C may have different data type than SDS data. C n_values = 2 - status = sfsnatt(sds_id, SDS_ATTR_NAME, DFNT_FLOAT32, n_values, + status = sfsnatt(sds_id, SDS_ATTR_NAME, DFNT_FLOAT32, n_values, + sds_values) C -C Get the identifier for the first dimension. +C Get the identifier for the first dimension. C - dim_index = 0 + dim_index = 0 dim_id = sfdimid(sds_id, dim_index) C C Set an attribute to the dimension that specifies the -C dimension metric. +C dimension metric. C n_values = 7 - status = sfscatt(dim_id, DIM_ATTR_NAME, DFNT_CHAR8, n_values, + status = sfscatt(dim_id, DIM_ATTR_NAME, DFNT_CHAR8, n_values, + dim_values) C -C Terminate access to the data set. +C Terminate access to the data set. C status = sfendacc(sds_id) C diff --git a/HDF4Examples/FORTRAN/SD/h4ex_SD_set_get_dim_info.f b/HDF4Examples/FORTRAN/SD/h4ex_SD_set_get_dim_info.f index 7466be685d..27597ac571 100644 --- a/HDF4Examples/FORTRAN/SD/h4ex_SD_set_get_dim_info.f +++ b/HDF4Examples/FORTRAN/SD/h4ex_SD_set_get_dim_info.f @@ -1,4 +1,4 @@ - program dimension_info + program dimension_info implicit none C C Parameter declaration. @@ -44,19 +44,19 @@ program dimension_info C C Initialize dimension scales. C - do 10 i = 1, X_LENGTH + do 10 i = 1, X_LENGTH data_X(i) = i - 1 10 continue - do 20 i = 1, Y_LENGTH + do 20 i = 1, Y_LENGTH data_Y(i) = 0.1 * (i - 1) 20 continue C C Open the file and initialize SD interface. -C +C sd_id = sfstart(FILE_NAME, DFACC_WRITE) C -C Get the index of the data set with the name specified in SDS_NAME. +C Get the index of the data set with the name specified in SDS_NAME. C sds_index = sfn2index(sd_id, SDS_NAME) C @@ -69,16 +69,16 @@ program dimension_info C and dimension scales. Note that data type of dimension scale can C be different between dimensions and can be different from SDS data type. C - do 30 dim_index = 0, RANK - 1 + do 30 dim_index = 0, RANK - 1 C C Select the dimension at position dim_index. C dim_id = sfdimid(sds_id, dim_index) C -C Assign name and dimension scale to the dimension. +C Assign name and dimension scale to the dimension. C if (dim_index .eq. 0) then - status = sfsdmname(dim_id, DIM_NAME_X) + status = sfsdmname(dim_id, DIM_NAME_X) n_values = X_LENGTH status = sfsdscale(dim_id, n_values, DFNT_INT16, data_X) end if @@ -119,22 +119,22 @@ program dimension_info write(*,*) "number of scale values is", n_values if (data_type. eq. 22) then write(*,*) "dimension scale data type is int16" - endif + endif if (data_type. eq. 6) then write(*,*) "dimension scale data type is float64" - endif + endif write(*,*) "number of dimension attributes is ", n_attrs C write(*,*) "Scale values are:" if (dim_index .eq. 0) then status = sfgdscale(dim_id, data_X_out) write(*,*) (data_X_out(i), i= 1, X_LENGTH) - endif + endif if (dim_index .eq. 1) then - status = sfgdscale(dim_id, data_Y_out) + status = sfgdscale(dim_id, data_Y_out) write(*,100) (data_Y_out(i), i= 1, Y_LENGTH) 100 format(4(1x,f10.3)/) - endif + endif 30 continue C C Terminate access to the data set. diff --git a/HDF4Examples/FORTRAN/SD/h4ex_SD_unlimited_sds.f b/HDF4Examples/FORTRAN/SD/h4ex_SD_unlimited_sds.f index de637fbc85..3184365827 100644 --- a/HDF4Examples/FORTRAN/SD/h4ex_SD_unlimited_sds.f +++ b/HDF4Examples/FORTRAN/SD/h4ex_SD_unlimited_sds.f @@ -8,7 +8,7 @@ program append_sds integer X_LENGTH, Y_LENGTH, RANK parameter (FILE_NAME = 'SDSUNLIMITED.hdf', + SDS_NAME = 'AppendableData', - + X_LENGTH = 10, + + X_LENGTH = 10, + Y_LENGTH = 10, + RANK = 2) integer DFACC_CREATE, DFACC_WRITE, SD_UNLIMITED, @@ -20,7 +20,7 @@ program append_sds C C Function declaration. C - integer sfstart, sfcreate, sfwdata, sfselect + integer sfstart, sfcreate, sfwdata, sfselect integer sfendacc, sfend C C**** Variable declaration ******************************************* @@ -35,14 +35,14 @@ program append_sds C C C Data initialization. -C +C do 20 j = 1, Y_LENGTH do 10 i = 1, X_LENGTH data(i, j) = i + j 10 continue 20 continue C -C Create the file and initialize the SD interface. +C Create the file and initialize the SD interface. C sd_id = sfstart(FILE_NAME, DFACC_CREATE) C @@ -52,13 +52,13 @@ program append_sds dim_sizes(1) = X_LENGTH dim_sizes(2) = SD_UNLIMITED -C Create the array data set. - sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, +C Create the array data set. + sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, . dim_sizes) C C Define the location and the size of the data to be written C to the data set. Note that the elements of array stride are -C set to 1 for contiguous writing. +C set to 1 for contiguous writing. C start(1) = 0 start(2) = 0 @@ -67,32 +67,32 @@ program append_sds stride(1) = 1 stride(2) = 1 C -C Write the data. +C Write the data. C status = sfwdata(sds_id, start, stride, edges, data) C C Terminate access to the data set, terminate access -C to the SD interface, and close the file. +C to the SD interface, and close the file. C status = sfendacc(sds_id) status = sfend(sd_id) C -C Store the array values to be appended to the data set. +C Store the array values to be appended to the data set. C do 30 i = 1, X_LENGTH - append_data(i) = 1000 + i - 1 + append_data(i) = 1000 + i - 1 30 continue C -C Reopen the file and initialize the SD. +C Reopen the file and initialize the SD. C sd_id = sfstart(FILE_NAME, DFACC_WRITE) C -C Select the first data set. +C Select the first data set. C - sds_index = 0 + sds_index = 0 sds_id = sfselect(sd_id, sds_index) C -C Define the location of the append to start at the 11th +C Define the location of the append to start at the 11th C column of the 1st row and to stop at the end of the 10th row. C start(1) = 0 @@ -100,15 +100,15 @@ program append_sds edges(1) = X_LENGTH edges(2) = 1 C -C Append the data to the data set. +C Append the data to the data set. C status = sfwdata(sds_id, start, stride, edges, append_data) C -C Terminate access to the data set. +C Terminate access to the data set. C status = sfendacc(sds_id) C -C Terminate access to the SD interface and close the file. +C Terminate access to the SD interface and close the file. C status = sfend(sd_id) diff --git a/HDF4Examples/FORTRAN/SD/h4ex_SD_write_slab.f b/HDF4Examples/FORTRAN/SD/h4ex_SD_write_slab.f index 61608295ce..1e7d1d3a41 100644 --- a/HDF4Examples/FORTRAN/SD/h4ex_SD_write_slab.f +++ b/HDF4Examples/FORTRAN/SD/h4ex_SD_write_slab.f @@ -36,7 +36,7 @@ program write_slab do 30 k = 1, Z_LENGTH do 20 j = 1, Y_LENGTH do 10 i = 1, X_LENGTH - data(i, j, k) = i + j + k + data(i, j, k) = i + j + k 10 continue 20 continue 30 continue @@ -45,35 +45,35 @@ program write_slab C sd_id = sfstart(FILE_NAME, DFACC_CREATE) C -C Define dimensions of the array to be created. +C Define dimensions of the array to be created. C - dim_sizes(1) = X_LENGTH - dim_sizes(2) = Y_LENGTH - dim_sizes(3) = Z_LENGTH + dim_sizes(1) = X_LENGTH + dim_sizes(2) = Y_LENGTH + dim_sizes(3) = Z_LENGTH C -C Create the data set with the name defined in SDS_NAME. +C Create the data set with the name defined in SDS_NAME. C - sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, + sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, . dim_sizes) C -C Set the parameters start and edges to write +C Set the parameters start and edges to write C a 4x6 element slab of data to the data set; C note that edges(2) is set to 1 to define a 2 dimensional slab C parallel to the XZ plane; C start(2) (slab position in the array) is initialized inside the C for loop. -C +C edges(1) = X_LENGTH edges(2) = 1 edges(3) = Z_LENGTH - start(1) = 0 + start(1) = 0 start(3) = 0 stride(1) = 1 stride(2) = 1 stride(3) = 1 do 60 j = 1, Y_LENGTH - start(2) = j - 1 + start(2) = j - 1 C C Initialize the buffer xz_data (data slab). C @@ -83,18 +83,18 @@ program write_slab 40 continue 50 continue C -C Write the data slab into SDS array defined in SDS_NAME. +C Write the data slab into SDS array defined in SDS_NAME. C Note that the elements of array stride are set to 1 to C specify that the consecutive slabs in the Y direction are written. C status = sfwdata(sds_id, start, stride, edges, xz_data) 60 continue C -C Terminate access to the data set. +C Terminate access to the data set. C status = sfendacc(sds_id) C -C Terminate access to the SD interface and close the file. +C Terminate access to the SD interface and close the file. C status = sfend(sd_id) diff --git a/HDF4Examples/FORTRAN/SD/h4ex_SD_write_to_sds.f b/HDF4Examples/FORTRAN/SD/h4ex_SD_write_to_sds.f index 7f548c7bae..1cf86dd1b0 100644 --- a/HDF4Examples/FORTRAN/SD/h4ex_SD_write_to_sds.f +++ b/HDF4Examples/FORTRAN/SD/h4ex_SD_write_to_sds.f @@ -31,7 +31,7 @@ program write_data C C -C Data set data initialization. +C Data set data initialization. C do 20 j = 1, Y_LENGTH do 10 i = 1, X_LENGTH @@ -63,7 +63,7 @@ program write_data stride(2) = 1 C C Write the stored data to the data set named in SDS_NAME. -C Note that the routine sfwdata is used instead of sfwcdata +C Note that the routine sfwdata is used instead of sfwcdata C to write the numeric data. C status = sfwdata(sds_id, start, stride, edges, data) diff --git a/HDF4Examples/FORTRAN/VD/h4ex_VD_create_onefield_vdatas.f b/HDF4Examples/FORTRAN/VD/h4ex_VD_create_onefield_vdatas.f index 22e16e0be7..8a21c55627 100644 --- a/HDF4Examples/FORTRAN/VD/h4ex_VD_create_onefield_vdatas.f +++ b/HDF4Examples/FORTRAN/VD/h4ex_VD_create_onefield_vdatas.f @@ -22,8 +22,8 @@ program create_onefield_vdatas + FIELD2_NAME = 'Multi-component Field') parameter (N_RECORDS_1 = 5, + N_RECORDS_2 = 6, - + ORDER_2 = 4) - + + ORDER_2 = 4) + integer DFACC_WRITE, DFNT_CHAR8, DFNT_INT32 parameter (DFACC_WRITE = 2, + DFNT_CHAR8 = 4, @@ -32,14 +32,14 @@ program create_onefield_vdatas C Function declaration C integer hopen, hclose - integer vfstart, vhfscd, vhfsdm, vfend + integer vfstart, vhfscd, vhfsdm, vfend C C**** Variable declaration ******************************************* C integer status integer file_id - integer vdata1_ref, vdata2_ref + integer vdata1_ref, vdata2_ref character vdata1_buf(N_RECORDS_1) integer vdata2_buf(ORDER_2, N_RECORDS_2) data vdata1_buf /'V','D','A','T','A'/ @@ -59,15 +59,15 @@ program create_onefield_vdatas C C Initialize the VS interface. C - status = vfstart(file_id) + status = vfstart(file_id) C C Create the first vdata and populate it with data from vdata1_buf array. -C +C vdata1_ref = vhfscd(file_id, FIELD1_NAME, vdata1_buf, N_RECORDS_1, + DFNT_CHAR8, VDATA1_NAME, CLASS1_NAME) C C Create the second vdata and populate it with data from vdata2_buf array. -C +C vdata2_ref = vhfsdm(file_id, FIELD2_NAME, vdata2_buf, N_RECORDS_2, + DFNT_INT32, VDATA2_NAME, CLASS2_NAME, + ORDER_2) diff --git a/HDF4Examples/FORTRAN/VD/h4ex_VD_create_vdatas.f b/HDF4Examples/FORTRAN/VD/h4ex_VD_create_vdatas.f index c7894751d7..417a3a6786 100644 --- a/HDF4Examples/FORTRAN/VD/h4ex_VD_create_vdatas.f +++ b/HDF4Examples/FORTRAN/VD/h4ex_VD_create_vdatas.f @@ -18,14 +18,14 @@ program create_vdatas C Function declaration C integer hopen, hclose - integer vfstart, vsfatch, vsfsnam, vsfscls, vsfdtch, vfend + integer vfstart, vsfatch, vsfsnam, vsfscls, vsfdtch, vfend C C**** Variable declaration ******************************************* C integer status integer file1_id, file2_id - integer vdata_id, vdata1_id, vdata2_id + integer vdata_id, vdata1_id, vdata2_id integer vdata_ref C C**** End of variable declaration ************************************ @@ -37,7 +37,7 @@ program create_vdatas C C Initialize the VS interface associated with the first HDF file. C - status = vfstart(file1_id) + status = vfstart(file1_id) C C Create a vdata in the first HDF file. C @@ -53,11 +53,11 @@ program create_vdatas C C Create the second HDF file. C - file2_id = hopen(FILE2_NAME, DFACC_CREATE, 0) + file2_id = hopen(FILE2_NAME, DFACC_CREATE, 0) C C Initialize the VS interface associated with the second HDF file. C - status = vfstart(file2_id) + status = vfstart(file2_id) C C Create the first vdata in the second HDF file. C diff --git a/HDF4Examples/FORTRAN/VD/h4ex_VD_get_vdata_info.f b/HDF4Examples/FORTRAN/VD/h4ex_VD_get_vdata_info.f index 3f1e8ae9d0..561ae4b080 100644 --- a/HDF4Examples/FORTRAN/VD/h4ex_VD_get_vdata_info.f +++ b/HDF4Examples/FORTRAN/VD/h4ex_VD_get_vdata_info.f @@ -1,4 +1,4 @@ - program vdata_info + program vdata_info implicit none C C Parameter declaration @@ -11,13 +11,13 @@ program vdata_info + DFACC_READ = 1, + FULL_INTERLACE = 0, + FIELD_SIZE = 80) - + C C Function declaration C integer hopen, hclose integer vfstart, vsfatch, vsfgid, vsfinq, - + vsfisat, vsfdtch, vfend + + vsfisat, vsfdtch, vfend C C**** Variable declaration ******************************************* @@ -26,7 +26,7 @@ program vdata_info integer file_id, vdata_id, vdata_ref integer n_records, interlace_mode, vdata_size character*64 vdata_name - character*80 fieldname_list + character*80 fieldname_list C C**** End of variable declaration ************************************ C @@ -37,11 +37,11 @@ program vdata_info C C Initialize the VS interface. C - status = vfstart(file_id) + status = vfstart(file_id) C C Set the reference number to -1 to start the search from the beginning -C of the file. -C +C of the file. +C vdata_ref = -1 10 continue C @@ -59,24 +59,31 @@ program vdata_info C Test whether the current vdata is not a storage for an attribute, C then obtain and display its information. if (vsfisat(vdata_id) .ne. 1) then +C Initialize buffers before getting values back. + vdata_name = ' ' + fieldname_list = ' ' + n_records = -1 + vdata_size = -1 status = vsfinq(vdata_id, n_records, interlace_mode, + fieldname_list, vdata_size, vdata_name) - write(*,*) 'Vdata: ', vdata_name - write(*,*) 'contains ', n_records, ' records' - if (interlace_mode .eq. 0) then - write(*,*) 'Interlace mode: FULL' - else - write(*,*) 'Interlace mode: NONE' + if (status .eq. 0) then + write(*,*) 'Vdata: ', vdata_name + write(*,*) 'contains ', n_records, ' records' + if (interlace_mode .eq. 0) then + write(*,*) 'Interlace mode: FULL' + else + write(*,*) 'Interlace mode: NONE' + endif + write(*,*) 'Fields: ', fieldname_list(1:30) + write(*,*) 'Vdata record size in bytes :', vdata_size + write(*,*) endif - write(*,*) 'Fields: ', fieldname_list(1:30) - write(*,*) 'Vdata record size in bytes :', vdata_size - write(*,*) endif C C Detach from the current vdata. C status = vsfdtch(vdata_id) - goto 10 + goto 10 100 continue C C Terminate access to the vdata and to the VS interface, and diff --git a/HDF4Examples/FORTRAN/VD/h4ex_VD_locate_vdata.f b/HDF4Examples/FORTRAN/VD/h4ex_VD_locate_vdata.f index 4861a641c6..0f4b7af520 100644 --- a/HDF4Examples/FORTRAN/VD/h4ex_VD_locate_vdata.f +++ b/HDF4Examples/FORTRAN/VD/h4ex_VD_locate_vdata.f @@ -1,10 +1,10 @@ - program locate_vdata + program locate_vdata implicit none C C Parameter declaration C character*18 FILE_NAME - character*20 SEARCHED_FIELDS + character*20 SEARCHED_FIELDS C parameter (FILE_NAME = 'General_Vdatas.hdf', + SEARCHED_FIELDS = 'Position,Temperature') @@ -14,15 +14,15 @@ program locate_vdata C Function declaration C integer hopen, hclose - integer vfstart, vsfatch, vsfgid, vsfex, vsfdtch, vfend + integer vfstart, vsfatch, vsfgid, vsfex, vsfdtch, vfend C C**** Variable declaration ******************************************* C integer status integer file_id, vdata_id, vdata_ref - integer index - logical found_fields + integer index + logical found_fields C C**** End of variable declaration ************************************ C @@ -33,12 +33,12 @@ program locate_vdata C C Initialize the VS interface. C - status = vfstart(file_id) + status = vfstart(file_id) index = 0 C C Set the reference number to -1 to start the search from the beginning -C of the file. -C +C of the file. +C vdata_ref = -1 C C Assume that the specified fields are not found in the current vdata. @@ -60,7 +60,7 @@ program locate_vdata goto 100 endif status = vsfdtch(vdata_id) - index = index + 1 + index = index + 1 goto 10 100 continue C @@ -77,7 +77,7 @@ program locate_vdata C Terminate access to the vdata C status = vsfdtch(vdata_id) - endif + endif C C Terminate access to the VS interface and close the HDF file. C diff --git a/HDF4Examples/FORTRAN/VD/h4ex_VD_read_from_vdata.f b/HDF4Examples/FORTRAN/VD/h4ex_VD_read_from_vdata.f index 17d6abac7c..3274450cb9 100644 --- a/HDF4Examples/FORTRAN/VD/h4ex_VD_read_from_vdata.f +++ b/HDF4Examples/FORTRAN/VD/h4ex_VD_read_from_vdata.f @@ -1,4 +1,4 @@ - program read_from_vdata + program read_from_vdata implicit none C C Parameter declaration @@ -17,8 +17,8 @@ program read_from_vdata + RECORD_INDEX = 3, + ORDER_1 = 3, + ORDER_2 = 2, - + N_VALS_PER_REC = ORDER_1 + ORDER_2 ) - + + N_VALS_PER_REC = ORDER_1 + ORDER_2 ) + integer DFACC_READ, FULL_INTERLACE parameter (DFACC_READ = 1, + FULL_INTERLACE = 0) @@ -27,7 +27,7 @@ program read_from_vdata C integer hopen, hclose integer vfstart, vsffnd, vsfatch, vsfsfld, vsfrd, vsfseek, - + vsfdtch, vfend + + vsfdtch, vfend C C**** Variable declaration ******************************************* @@ -47,29 +47,29 @@ program read_from_vdata C C Initialize the VS interface. C - status = vfstart(file_id) + status = vfstart(file_id) C C Get the reference number of the vdata, whose name is specified in -C VDATA_NAME, using vsffnd, which will be discussed in Section 4.7.3. -C +C VDATA_NAME, using vsffnd, which will be discussed in Section 4.7.3. +C vdata_ref = vsffnd(file_id, VDATA_NAME) C -C Attach to the vdata for reading if it is found, +C Attach to the vdata for reading if it is found, C otherwise exit the program. C if (vdata_ref .eq. 0) stop - vdata_id = vsfatch(file_id, vdata_ref, 'r') + vdata_id = vsfatch(file_id, vdata_ref, 'r') C -C Specify the fields that will be read. +C Specify the fields that will be read. C status = vsfsfld(vdata_id, FIELDNAME_LIST) C C Place the current point to the position specified in RECORD_INDEX. C - rec_pos = vsfseek(vdata_id, RECORD_INDEX) + rec_pos = vsfseek(vdata_id, RECORD_INDEX) C -C Read the next N_RECORDS from the vdata and store the data in the buffer -C databuf with fully interlace mode. +C Read the next N_RECORDS from the vdata and store the data in the buffer +C databuf with fully interlace mode. C num_of_records = vsfrd(vdata_id, databuf, N_RECORDS, + FULL_INTERLACE) @@ -81,7 +81,7 @@ program read_from_vdata write(*,*) do 10 rec_num = 1, num_of_records write(*,1000) (databuf(i, rec_num), i = 1, N_VALS_PER_REC) -10 continue +10 continue 1000 format(1x,3(f6.2), 8x,2(f6.2)) C C Terminate access to the vdata and to the VS interface, and diff --git a/HDF4Examples/FORTRAN/VD/h4ex_VD_read_mixed_vdata.f b/HDF4Examples/FORTRAN/VD/h4ex_VD_read_mixed_vdata.f index b08ab73734..a71841a36a 100644 --- a/HDF4Examples/FORTRAN/VD/h4ex_VD_read_mixed_vdata.f +++ b/HDF4Examples/FORTRAN/VD/h4ex_VD_read_mixed_vdata.f @@ -1,4 +1,4 @@ - program read_mixed_vdata + program read_mixed_vdata implicit none C C Parameter declaration @@ -9,7 +9,7 @@ program read_mixed_vdata character*5 FIELD2_NAME character*10 FIELDNAME_LIST integer N_RECORDS, N_FIELDS - integer BUFFER_SIZE + integer BUFFER_SIZE C parameter (FILE_NAME = 'Packed_Vdata.hdf', + VDATA_NAME = 'Mixed Data Vdata', @@ -17,11 +17,11 @@ program read_mixed_vdata + FIELD2_NAME = 'Ident', + FIELDNAME_LIST = 'Temp,Ident') parameter (N_RECORDS = 20, - + N_FIELDS = 2, - + BUFFER_SIZE = (4 + 1)*N_RECORDS) - + + N_FIELDS = 2, + + BUFFER_SIZE = (4 + 1)*N_RECORDS) + integer DFACC_READ, DFNT_FLOAT32, DFNT_CHAR8, - + FULL_INTERLACE, HDF_VSUNPACK + + FULL_INTERLACE, HDF_VSUNPACK parameter (DFACC_READ = 1, + DFNT_FLOAT32 = 5, + DFNT_CHAR8 = 4, @@ -32,7 +32,7 @@ program read_mixed_vdata C integer hopen, hclose integer vfstart, vsfatch, vsffnd, vsfsfld, - + vsfnpak, vsfcpak, vsfread, vsfdtch, vfend + + vsfnpak, vsfcpak, vsfread, vsfdtch, vfend C C**** Variable declaration ******************************************* @@ -41,7 +41,7 @@ program read_mixed_vdata integer file_id, vdata_id integer vdata_ref, num_of_records real temp(N_RECORDS) - character ident(N_RECORDS) + character ident(N_RECORDS) integer i C C Buffer for read packed data should be big enough to hold N_RECORDS. @@ -57,20 +57,20 @@ program read_mixed_vdata C C Initialize the VS interface. C - status = vfstart(file_id) + status = vfstart(file_id) C C Get the reference number of the vdata, whose name is specified in -C VDATA_NAME, using vsffnd, which will be discussed in Section 4.7.3. -C +C VDATA_NAME, using vsffnd, which will be discussed in Section 4.7.3. +C vdata_ref = vsffnd(file_id, VDATA_NAME) C -C Attach to the vdata for reading if it is found, +C Attach to the vdata for reading if it is found, C otherwise exit the program. C if (vdata_ref .eq. 0) stop - vdata_id = vsfatch(file_id, vdata_ref, 'r') + vdata_id = vsfatch(file_id, vdata_ref, 'r') C -C Specify the fields that will be read. +C Specify the fields that will be read. C status = vsfsfld(vdata_id, FIELDNAME_LIST) @@ -81,20 +81,20 @@ program read_mixed_vdata + FULL_INTERLACE) C C Unpack N_RECORDS from databuf into temp and ident arrays. -C In Fortran, each field is unpacked using separate calls to +C In Fortran, each field is unpacked using separate calls to C vsfnpak or vsfcpak. C status = vsfnpak(vdata_id, HDF_VSUNPACK, FIELDNAME_LIST, databuf, - + BUFFER_SIZE, num_of_records, FIELD1_NAME, temp) + + BUFFER_SIZE, num_of_records, FIELD1_NAME, temp) status = vsfcpak(vdata_id, HDF_VSUNPACK, FIELDNAME_LIST, databuf, - + BUFFER_SIZE, num_of_records, FIELD2_NAME, ident) + + BUFFER_SIZE, num_of_records, FIELD2_NAME, ident) C C Display the read data being stored in the field databufs. C write (*,*) ' Temp Ident' do 10 i = 1, num_of_records write(*,1000) temp(i), ident(i) -10 continue +10 continue 1000 format (3x,F6.2, 4x, a) C C Terminate access to the vdata and to the VS interface, and diff --git a/HDF4Examples/FORTRAN/VD/h4ex_VD_set_get_vdata_attr.f b/HDF4Examples/FORTRAN/VD/h4ex_VD_set_get_vdata_attr.f index ffdbf73782..77b7656f5d 100644 --- a/HDF4Examples/FORTRAN/VD/h4ex_VD_set_get_vdata_attr.f +++ b/HDF4Examples/FORTRAN/VD/h4ex_VD_set_get_vdata_attr.f @@ -1,4 +1,4 @@ - program vdata_attributes + program vdata_attributes implicit none C C Parameter declaration @@ -8,7 +8,7 @@ program vdata_attributes character*4 FIELD_NAME character*10 VATTR_NAME character*6 FATTR_NAME - integer VATTR_N_VALUES, FATTR_N_VALUES + integer VATTR_N_VALUES, FATTR_N_VALUES C parameter (FILE_NAME = 'General_Vdatas.hdf', + VDATA_NAME = 'Solid Particle', @@ -17,7 +17,7 @@ program vdata_attributes + FATTR_NAME = 'Scales') parameter (VATTR_N_VALUES = 3, + FATTR_N_VALUES = 4) - + integer DFACC_WRITE, FULL_INTERLACE, HDF_VDATA integer DFNT_INT32, DFNT_CHAR8 parameter (DFACC_WRITE = 2, @@ -29,9 +29,9 @@ program vdata_attributes C Function declaration C integer hopen, hclose - integer vfstart, vsffnd, vsfatch, vsfscat, vsfsnat, + integer vfstart, vsffnd, vsfatch, vsfscat, vsfsnat, + vsffnas, vsffidx, vsfnats, vsfainf, vsfgcat, vsfgnat, - + vsfdtch, vfend + + vsfdtch, vfend C C**** Variable declaration ******************************************* @@ -40,7 +40,7 @@ program vdata_attributes integer file_id, vdata_id, vdata_ref integer field_index, n_vdattrs, n_fldattrs integer vdata_type, vdata_n_values, vdata_size - integer field_type, field_n_values, field_size + integer field_type, field_n_values, field_size character vd_attr(VATTR_N_VALUES) integer fld_attr(FATTR_N_VALUES) character vattr_buf(VATTR_N_VALUES) @@ -58,15 +58,15 @@ program vdata_attributes C C Initialize the VS interface. C - status = vfstart(file_id) + status = vfstart(file_id) C C Get the reference number of the vdata named VDATA_NAME. -C +C vdata_ref = vsffnd(file_id, VDATA_NAME) C -C Attach to the vdata for writing. +C Attach to the vdata for writing. C - vdata_id = vsfatch(file_id, vdata_ref, 'w') + vdata_id = vsfatch(file_id, vdata_ref, 'w') C C Attach an attribute to the vdata, as it is indicated by second parameter. C @@ -81,13 +81,13 @@ program vdata_attributes C status = vsfsnat(vdata_id, field_index, FATTR_NAME, DFNT_INT32, + FATTR_N_VALUES, fld_attr) - + C C Get the number of attributes attached to the vdata's first C field - should be 0. C n_fldattrs = vsffnas(vdata_id, 0) - write(*,*) 'Number of attributes of the first field' + write(*,*) 'Number of attributes of the first field' write(*,*) ' of the vdata: ', n_fldattrs C C Get the number of the attributes attached to the field specified by @@ -103,7 +103,7 @@ program vdata_attributes write(*,*) 'Number of attributes of the vdata and its fields: ', + n_vdattrs C -C Get information about the vdata's first attribute, indicated by +C Get information about the vdata's first attribute, indicated by C the third parameter, which is the index of the attribute. C status = vsfainf(vdata_id, HDF_VDATA, 0, vattr_name_out, @@ -112,7 +112,7 @@ program vdata_attributes C Get information about the first attribute of the field specified by C field_index. C - status = vsfainf(vdata_id, field_index, 0, fattr_name_out, + status = vsfainf(vdata_id, field_index, 0, fattr_name_out, + field_type, field_n_values, field_size) C C Get the vdata's first attribute. @@ -124,7 +124,7 @@ program vdata_attributes C status = vsfgnat(vdata_id, field_index, 0, fattr_buf) write(*,*) 'Values of the field attribute = ', fattr_buf -C +C C Terminate access to the vdata and to the VS interface, and C close the HDF file. C diff --git a/HDF4Examples/FORTRAN/VD/h4ex_VD_write_mixed_vdata.f b/HDF4Examples/FORTRAN/VD/h4ex_VD_write_mixed_vdata.f index 76e1e02dfe..17e2b9e29e 100644 --- a/HDF4Examples/FORTRAN/VD/h4ex_VD_write_mixed_vdata.f +++ b/HDF4Examples/FORTRAN/VD/h4ex_VD_write_mixed_vdata.f @@ -1,4 +1,4 @@ - program write_mixed_vdata + program write_mixed_vdata implicit none C C Parameter declaration @@ -12,7 +12,7 @@ program write_mixed_vdata character*5 FIELD4_NAME character*23 FIELDNAME_LIST integer N_RECORDS, N_FIELDS, ORDER - integer BUF_SIZE + integer BUF_SIZE C parameter (FILE_NAME = 'Packed_Vdata.hdf', + CLASS_NAME = 'General Data Class', @@ -23,12 +23,12 @@ program write_mixed_vdata + FIELD4_NAME = 'Ident', + FIELDNAME_LIST = 'Temp,Height,Speed,Ident') parameter (N_RECORDS = 20, - + N_FIELDS = 4, + + N_FIELDS = 4, + ORDER = 1, - + BUF_SIZE = (4 + 2 + 4 + 1)*N_RECORDS) - + + BUF_SIZE = (4 + 2 + 4 + 1)*N_RECORDS) + integer DFACC_WRITE, DFNT_FLOAT32, DFNT_INT16, DFNT_CHAR8, - + FULL_INTERLACE, HDF_VSPACK + + FULL_INTERLACE, HDF_VSPACK parameter (DFACC_WRITE = 2, + DFNT_FLOAT32 = 5, + DFNT_INT16 = 22, @@ -40,7 +40,7 @@ program write_mixed_vdata C integer hopen, hclose integer vfstart, vsfatch, vsfsnam, vsfscls, vsffdef, vsfsfld, - + vsfnpak, vsfcpak, vsfwrit, vsfdtch, vfend + + vsfnpak, vsfcpak, vsfwrit, vsfdtch, vfend C C**** Variable declaration ******************************************* @@ -51,7 +51,7 @@ program write_mixed_vdata real temp(N_RECORDS) integer*2 height(N_RECORDS) real speed(N_RECORDS) - character ident(N_RECORDS) + character ident(N_RECORDS) integer i C C Buffer for packed data should be big enough to hold N_RECORDS. @@ -67,12 +67,12 @@ program write_mixed_vdata C C Initialize the VS interface. C - status = vfstart(file_id) + status = vfstart(file_id) C C Create a new vdata. -C +C vdata_ref = -1 - vdata_id = vsfatch(file_id, vdata_ref, 'w') + vdata_id = vsfatch(file_id, vdata_ref, 'w') C C Set name and class name of the vdata. C @@ -100,17 +100,17 @@ program write_mixed_vdata ident(i) = char(64+i) 10 continue C -C Pack N_RECORDS of data into databuf. In Fortran, each field is packed +C Pack N_RECORDS of data into databuf. In Fortran, each field is packed C using separate calls to vsfnpak or vsfcpak. C status = vsfnpak(vdata_id, HDF_VSPACK, ' ', databuf, BUF_SIZE, - + N_RECORDS, FIELD1_NAME, temp) + + N_RECORDS, FIELD1_NAME, temp) status = vsfnpak(vdata_id, HDF_VSPACK, ' ', databuf, BUF_SIZE, - + N_RECORDS, FIELD2_NAME, height) + + N_RECORDS, FIELD2_NAME, height) status = vsfnpak(vdata_id, HDF_VSPACK, ' ', databuf, BUF_SIZE, - + N_RECORDS, FIELD3_NAME, speed) + + N_RECORDS, FIELD3_NAME, speed) status = vsfcpak(vdata_id, HDF_VSPACK, ' ', databuf, BUF_SIZE, - + N_RECORDS, FIELD4_NAME, ident) + + N_RECORDS, FIELD4_NAME, ident) C C Write all the records of the packed data to the vdata. C diff --git a/HDF4Examples/FORTRAN/VD/h4ex_VD_write_to_vdata.f b/HDF4Examples/FORTRAN/VD/h4ex_VD_write_to_vdata.f index f6ac90b3c7..914718354a 100644 --- a/HDF4Examples/FORTRAN/VD/h4ex_VD_write_to_vdata.f +++ b/HDF4Examples/FORTRAN/VD/h4ex_VD_write_to_vdata.f @@ -1,4 +1,4 @@ - program write_to_vdata + program write_to_vdata implicit none C C Parameter declaration @@ -25,8 +25,8 @@ program write_to_vdata + ORDER_1 = 3, + ORDER_2 = 1, + ORDER_3 = 2, - + N_VALS_PER_REC = ORDER_1 + ORDER_2 + ORDER_3) - + + N_VALS_PER_REC = ORDER_1 + ORDER_2 + ORDER_3) + integer DFACC_WRITE, DFNT_FLOAT32, FULL_INTERLACE parameter (DFACC_WRITE = 2, + DFNT_FLOAT32 = 5, @@ -36,7 +36,7 @@ program write_to_vdata C integer hopen, hclose integer vfstart, vsfatch, vsfsnam, vsfscls, vsffdef, vsfsfld, - + vsfwrt, vsfdtch, vfend + + vsfwrt, vsfdtch, vfend C C**** Variable declaration ******************************************* @@ -55,12 +55,12 @@ program write_to_vdata C C Initialize the VS interface. C - status = vfstart(file_id) + status = vfstart(file_id) C C Create a new vdata. -C +C vdata_ref = -1 - vdata_id = vsfatch(file_id, vdata_ref, 'w') + vdata_id = vsfatch(file_id, vdata_ref, 'w') C C Set name and class name of the vdata. C diff --git a/HDF4Examples/FORTRAN/VG/h4ex_VG_add_sds_to_vgroup.f b/HDF4Examples/FORTRAN/VG/h4ex_VG_add_sds_to_vgroup.f index 9f0063ad72..54f9085bf1 100644 --- a/HDF4Examples/FORTRAN/VG/h4ex_VG_add_sds_to_vgroup.f +++ b/HDF4Examples/FORTRAN/VG/h4ex_VG_add_sds_to_vgroup.f @@ -12,7 +12,7 @@ program add_SDS_to_a_vgroup + SDS_NAME = 'Test SD', + VG_NAME = 'SD Vgroup', + VG_CLASS = 'Common Vgroups') - integer DFACC_CREATE, DFACC_WRITE + integer DFACC_CREATE, DFACC_WRITE parameter (DFACC_CREATE = 4, DFACC_WRITE = 2) integer DFNT_INT32 parameter (DFNT_INT32 = 24) @@ -44,11 +44,11 @@ program add_SDS_to_a_vgroup C Initialize the V interface. C status = vfstart(file_id) - + C -C Initialize SD interface. +C Initialize SD interface. C - sd_id = sfstart(FILE_NAME, DFACC_WRITE) + sd_id = sfstart(FILE_NAME, DFACC_WRITE) C C Set the rank and the size of SDS's dimension. C diff --git a/HDF4Examples/FORTRAN/VG/h4ex_VG_get_vgroup_info.f b/HDF4Examples/FORTRAN/VG/h4ex_VG_get_vgroup_info.f index 40cc1d4463..0232060c7b 100644 --- a/HDF4Examples/FORTRAN/VG/h4ex_VG_get_vgroup_info.f +++ b/HDF4Examples/FORTRAN/VG/h4ex_VG_get_vgroup_info.f @@ -46,7 +46,7 @@ program getinfo_about_vgroup C C Get and print the name and class name of all lone vgroups. C First, call vflone with num_of_lones set to 0 to get the number of -C lone vgroups in the file and check whether size of ref_array is +C lone vgroups in the file and check whether size of ref_array is C big enough to hold reference numbers of ALL lone groups. C If ref_array is not big enough, exit the program after displaying an C informative message. @@ -75,7 +75,7 @@ program getinfo_about_vgroup do 20 lone_vg_number = 1, num_of_lones C C Attach to the current vgroup, then get and display its name and class. -C Note: the current vgroup must be detached before moving to the next. +C Note: the current vgroup must be detached before moving to the next. C vgroup_name = ' ' vgroup_class = ' ' diff --git a/HDF4Examples/FORTRAN/VG/h4ex_VG_insert_vdatas_to_vgroup.f b/HDF4Examples/FORTRAN/VG/h4ex_VG_insert_vdatas_to_vgroup.f index 57258cc4c9..84b5095bd5 100644 --- a/HDF4Examples/FORTRAN/VG/h4ex_VG_insert_vdatas_to_vgroup.f +++ b/HDF4Examples/FORTRAN/VG/h4ex_VG_insert_vdatas_to_vgroup.f @@ -34,19 +34,19 @@ program add_vdatas_to_a_vgroup + FIELDNAME_LIST = 'PX,PY') integer N_RECORDS parameter (N_RECORDS = 30) - - integer DFACC_WRITE + + integer DFACC_WRITE parameter (DFACC_WRITE = 2) integer DFNT_FLOAT32, DFNT_INT16 parameter (DFNT_FLOAT32 = 5, DFNT_INT16 = 22) - integer FULL_INTERLACE + integer FULL_INTERLACE parameter (FULL_INTERLACE = 0) C C Function declaration C integer hopen, hclose integer vfstart, vfatch, vfsnam, vfscls, vfinsrt, vfdtch, vfend - integer vsfatch, vsfsnam, vsfscls, vsffdef, vsfsfld, + integer vsfatch, vsfsnam, vsfscls, vsffdef, vsfsfld, + vsfwrt, vsfwrtc, vsfdtch C @@ -55,7 +55,7 @@ program add_vdatas_to_a_vgroup integer status integer file_id integer vgroup_id - integer vdata1_id, vdata2_id, vdata3_id, vd_index + integer vdata1_id, vdata2_id, vdata3_id, vd_index integer num_of_records integer i, j, k real pxy(2,N_RECORDS), tmp(N_RECORDS) @@ -85,11 +85,11 @@ program add_vdatas_to_a_vgroup C Buffer the data for the third and second vdatas. C do 20 i = 1, N_RECORDS - do 10 j = 1, 3 - plist(j,i) = k + do 10 j = 1, 3 + plist(j,i) = k k = k+1 10 continue -20 continue +20 continue do 30 i = 1, N_RECORDS tmp(i) = (i-1) * 10.0 30 continue @@ -142,7 +142,7 @@ program add_vdatas_to_a_vgroup vd_index = vfinsrt(vgroup_id, vdata2_id) status = vsfdtch(vdata2_id) C -C Create, write, and insert the third vdata to the vgroup using +C Create, write, and insert the third vdata to the vgroup using C steps similar to those used for the first and second vdatas. C vdata3_id = vsfatch(file_id, -1, 'w') @@ -154,7 +154,7 @@ program add_vdatas_to_a_vgroup + FULL_INTERLACE) vd_index = vfinsrt(vgroup_id, vdata3_id) status = vsfdtch(vdata3_id) - + C C Terminate access to the vgroup 'Vertices'. C diff --git a/HDF4Examples/FORTRAN/VG/h4ex_VG_set_get_vgroup_attr.f b/HDF4Examples/FORTRAN/VG/h4ex_VG_set_get_vgroup_attr.f index cb14aa1ec1..d7c7892654 100644 --- a/HDF4Examples/FORTRAN/VG/h4ex_VG_set_get_vgroup_attr.f +++ b/HDF4Examples/FORTRAN/VG/h4ex_VG_set_get_vgroup_attr.f @@ -13,8 +13,8 @@ program vgroup_attribute integer VSET_NEW_VERSION, VSET_VERSION, VSET_OLD_VERSION parameter (VSET_NEW_VERSION = 4, + VSET_VERSION = 3, - + VSET_OLD_VERSION = 2) - integer DFACC_WRITE + + VSET_OLD_VERSION = 2) + integer DFACC_WRITE parameter (DFACC_WRITE = 2) integer DFNT_CHAR parameter (DFNT_CHAR = 4) @@ -33,7 +33,7 @@ program vgroup_attribute integer file_id integer vgroup_id, vgroup_ref, vg_version integer attr_index, i - integer data_type, n_values, size + integer data_type, n_values, size character vg_attr(N_ATT_VALUES) character vgattr_buf(N_ATT_VALUES), attr_name(30) data vg_attr /'v','g','r','o','u','p'/ @@ -68,7 +68,7 @@ program vgroup_attribute + VGROUP_NAME, ' is of version before 3.2' if ((vg_version .ne. VSET_NEW_VERSION) .and. + (vg_version .ne. VSET_VERSION) .and. - + (vg_version .ne. VSET_OLD_VERSION)) write(*,*) + + (vg_version .ne. VSET_OLD_VERSION)) write(*,*) + 'Unknown version' C C Add the attribute named VGATTR_NAME to the vgroup. @@ -84,6 +84,7 @@ program vgroup_attribute C Get and display the name and the number of values of each attribute. C do 10 attr_index=1, n_attrs + attr_name = ' ' status = vfainfo(vgroup_id, attr_index-1, attr_name, data_type, + n_values, size) write(*,*) 'Attribute #', attr_index-1, ' is named ', attr_name diff --git a/HDF4Examples/FORTRAN/VG/h4ex_VG_vgroup_contents.f b/HDF4Examples/FORTRAN/VG/h4ex_VG_vgroup_contents.f index 336fa1487b..42fca3668a 100644 --- a/HDF4Examples/FORTRAN/VG/h4ex_VG_vgroup_contents.f +++ b/HDF4Examples/FORTRAN/VG/h4ex_VG_vgroup_contents.f @@ -21,8 +21,8 @@ program vgroup_contents integer status integer file_id integer vgroup_id, vgroup_ref, vgroup_pos - integer obj_index, num_of_pairs - integer obj_tag, obj_ref + integer obj_index, num_of_pairs + integer obj_tag, obj_ref C C**** End of variable declaration ************************************ C @@ -64,7 +64,7 @@ program vgroup_contents write(*,*) 'Vgroup # ', vgroup_pos, ' contains:' do 20 obj_index = 1, num_of_pairs C -C Get the tag/ref number pair of the object specified by its index +C Get the tag/ref number pair of the object specified by its index C and display them. C status = vfgttr(vgroup_id, obj_index-1, obj_tag, obj_ref) @@ -88,8 +88,8 @@ program vgroup_contents endif write(*,*) vgroup_pos = vgroup_pos + 1 - goto 10 -100 continue + goto 10 +100 continue C C Terminate access to the vgroup. C diff --git a/HDF4Examples/config/cmake-presets/hidden-presets.json b/HDF4Examples/config/cmake-presets/hidden-presets.json index e89dc54ac5..4c7f087678 100644 --- a/HDF4Examples/config/cmake-presets/hidden-presets.json +++ b/HDF4Examples/config/cmake-presets/hidden-presets.json @@ -98,17 +98,6 @@ "strategy": "external" } }, - { - "name": "ci-Java", - "hidden": true, - "cacheVariables": { - "HDF_BUILD_JAVA": "ON" - }, - "toolset": { - "value": "host=x64", - "strategy": "external" - } - }, { "name": "ci-x64-Debug-MSVC", "description": "MSVC for x64 (Debug)", @@ -405,4 +394,3 @@ } ] } - diff --git a/HDF4Examples/config/cmake/HDFExampleMacros.cmake b/HDF4Examples/config/cmake/HDFExampleMacros.cmake index 7db4ace952..b9cf3ff137 100644 --- a/HDF4Examples/config/cmake/HDFExampleMacros.cmake +++ b/HDF4Examples/config/cmake/HDFExampleMacros.cmake @@ -170,21 +170,23 @@ macro (HDF4_SUPPORT) set (H4EX_HDF4_LINK_LIBS ${H4EX_HDF4_LINK_LIBS} ${HDF4_C_STATIC_LIBRARY}) set_property (TARGET ${HDF4_NAMESPACE}hdp PROPERTY IMPORTED_LOCATION "${HDF4_TOOLS_DIR}/hdp") endif () - if (HDF_BUILD_FORTRAN AND ${HDF4_BUILD_FORTRAN}) - if (BUILD_SHARED_LIBS AND HDF4_shared_Fortran_FOUND) - set (H4EX_HDF4_LINK_LIBS ${H4EX_HDF4_LINK_LIBS} ${HDF4_FORTRAN_SHARED_LIBRARY}) - elseif (HDF4_static_Fortran_FOUND) - set (H4EX_HDF4_LINK_LIBS ${H4EX_HDF4_LINK_LIBS} ${HDF4_FORTRAN_STATIC_LIBRARY}) - else () - set (HDF_BUILD_FORTRAN OFF CACHE BOOL "Build FORTRAN support" FORCE) - message (STATUS "HDF4 Fortran libs not found - disable build of Fortran examples") - endif () - else () + if (NOT HDF4_static_Fortran_FOUND AND NOT HDF4_shared_Fortran_FOUND) set (HDF_BUILD_FORTRAN OFF CACHE BOOL "Build FORTRAN support" FORCE) message (STATUS "HDF4 Fortran libs not found - disable build of Fortran examples") + else () + if (HDF_BUILD_FORTRAN AND ${HDF4_BUILD_FORTRAN}) + if (BUILD_SHARED_LIBS AND HDF4_shared_Fortran_FOUND) + set (H4EX_HDF4_LINK_LIBS ${H4EX_HDF4_LINK_LIBS} ${HDF4_FORTRAN_SHARED_LIBRARY}) + elseif (HDF4_static_Fortran_FOUND) + set (H4EX_HDF4_LINK_LIBS ${H4EX_HDF4_LINK_LIBS} ${HDF4_FORTRAN_STATIC_LIBRARY}) + else () + set (HDF_BUILD_FORTRAN OFF CACHE BOOL "Build FORTRAN support" FORCE) + message (STATUS "HDF4 Fortran libs not found - disable build of Fortran examples") + endif () + endif () endif () - if (HDF_BUILD_JAVA) - if (${HDF4_BUILD_JAVA} AND HDF4_Java_FOUND) + if (HDF_BUILD_JAVA AND HDF4_Java_FOUND) + if (${HDF4_BUILD_JAVA}) set (CMAKE_JAVA_INCLUDE_PATH "${CMAKE_JAVA_INCLUDE_PATH};${HDF4_JAVA_INCLUDE_DIRS}") set (H4EX_JAVA_LIBRARY ${HDF4_JAVA_LIBRARY}) set (H4EX_JAVA_LIBRARIES ${HDF4_JAVA_LIBRARY}) diff --git a/Makefile.am b/Makefile.am index fd5330ac7d..1c667b7f9d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,21 +23,12 @@ if BUILD_DOXYGEN_CONDITIONAL doxygen: doxygen-doc endif -# 'make install' will now install examples, the same as 'make install-all'. # 'make-install-all' will be redundant but will still work. -install: install-recursive install-examples -uninstall: uninstall-recursive uninstall-examples +install: install-recursive +uninstall: uninstall-recursive -# 'make install-all' also installs examples +# 'make install-all' install-all: @$(MAKE) $(AM_MAKEFLAGS) install - @$(MAKE) $(AM_MAKEFLAGS) install-examples uninstall-all: @$(MAKE) $(AM_MAKEFLAGS) uninstall - @$(MAKE) $(AM_MAKEFLAGS) uninstall-examples - -# Install examples recursively -install-examples uninstall-examples: - @@SETX@; for d in hdf mfhdf; do \ - (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ - done diff --git a/configure.ac b/configure.ac index 4eda96d5ee..3919fc2c02 100644 --- a/configure.ac +++ b/configure.ac @@ -1204,9 +1204,7 @@ AC_CONFIG_FILES([Makefile doxygen/Doxyfile libhdf4.settings hdf/Makefile - hdf/examples/Makefile hdf/fortran/Makefile - hdf/fortran/examples/Makefile hdf/src/Makefile hdf/test/Makefile hdf/util/Makefile @@ -1221,10 +1219,7 @@ AC_CONFIG_FILES([Makefile mfhdf/Makefile mfhdf/dumper/Makefile mfhdf/dumper/testhdp.sh - mfhdf/examples/Makefile - mfhdf/examples/testexamples.sh mfhdf/fortran/Makefile - mfhdf/fortran/examples/Makefile mfhdf/fortran/testfortran.sh mfhdf/hdfimport/Makefile mfhdf/hdfimport/testutil.sh diff --git a/hdf/Makefile.am b/hdf/Makefile.am index a5f6cdcca6..11aa1dc47d 100644 --- a/hdf/Makefile.am +++ b/hdf/Makefile.am @@ -9,22 +9,10 @@ endif # src folder in root Makefile, build other folders now SUBDIRS = src $(FORTRAN_DIR) test util -DIST_SUBDIRS = src fortran test util examples +DIST_SUBDIRS = src fortran test util -installcheck-local: - @(cd examples && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; - -# 'make install-all' also installs examples +# 'make install-all' install-all: @$(MAKE) $(AM_MAKEFLAGS) install - @$(MAKE) $(AM_MAKEFLAGS) install-examples uninstall-all: @$(MAKE) $(AM_MAKEFLAGS) uninstall - @$(MAKE) $(AM_MAKEFLAGS) uninstall-examples - - -# Install examples recursively -install-examples uninstall-examples: - @@SETX@; for d in examples $(FORTRAN_DIR); do \ - (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ - done diff --git a/hdf/examples/AN_create_annotation.c b/hdf/examples/AN_create_annotation.c deleted file mode 100644 index 629b97aa04..0000000000 --- a/hdf/examples/AN_create_annotation.c +++ /dev/null @@ -1,134 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "General_HDFobjects.hdf" -#define VG_NAME "AN Vgroup" -#define FILE_LABEL_TXT "General HDF objects" -#define FILE_DESC_TXT "This is an HDF file that contains general HDF objects" -#define DATA_LABEL_TXT "Common AN Vgroup" -#define DATA_DESC_TXT "This is a vgroup that is used to test data annotations" - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 file_id, /* HDF file identifier */ - an_id, /* AN interface identifier */ - file_label_id, /* file label identifier */ - file_desc_id, /* file description identifier */ - data_label_id, /* data label identifier */ - data_desc_id, /* data description identifier */ - vgroup_id; - uint16 vgroup_tag, vgroup_ref; - - /********************** End of variable declaration **********************/ - - /* - * Create the HDF file. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_CREATE, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the AN interface. - */ - if ((an_id = ANstart(file_id)) == FAIL) - printf("*** ERROR from ANstart\n"); - - /* - * Create the file label. - */ - if ((file_label_id = ANcreatef(an_id, AN_FILE_LABEL)) == FAIL) - printf("*** ERROR from ANcreatef\n"); - - /* - * Write the annotations to the file label. - */ - if (ANwriteann(file_label_id, FILE_LABEL_TXT, strlen(FILE_LABEL_TXT)) == FAIL) - printf("*** ERROR from ANwriteann\n"); - - /* - * Create file description. - */ - if ((file_desc_id = ANcreatef(an_id, AN_FILE_DESC)) == FAIL) - printf("*** ERROR from ANcreatef\n"); - - /* - * Write the annotation to the file description. - */ - if (ANwriteann(file_desc_id, FILE_DESC_TXT, strlen(FILE_DESC_TXT)) == FAIL) - printf("*** ERROR from ANwriteann\n"); - - /* - * Create a vgroup in the V interface. Note that the vgroup's ref number - * is set to -1 for creating and the access mode is "w" for writing. - */ - if (Vstart(file_id) == FAIL) - printf("*** ERROR from Vstart\n"); - if ((vgroup_id = Vattach(file_id, -1, "w")) == FAIL) - printf("*** ERROR from Vattach\n"); - if (Vsetname(vgroup_id, VG_NAME) == FAIL) - printf("*** ERROR from Vsetname\n"); - - /* - * Obtain the tag and ref number of the vgroup for subsequent - * references. - */ - vgroup_tag = (uint16)VQuerytag(vgroup_id); - vgroup_ref = (uint16)VQueryref(vgroup_id); - - /* - * Create the data label for the vgroup identified by its tag - * and ref number. - */ - if ((data_label_id = ANcreate(an_id, vgroup_tag, vgroup_ref, AN_DATA_LABEL)) == FAIL) - printf("*** ERROR from ANcreate\n"); - - /* - * Write the annotation text to the data label. - */ - if (ANwriteann(data_label_id, DATA_LABEL_TXT, strlen(DATA_LABEL_TXT)) == FAIL) - printf("*** ERROR from ANwriteann\n"); - - /* - * Create the data description for the vgroup identified by its tag - * and ref number. - */ - if ((data_desc_id = ANcreate(an_id, vgroup_tag, vgroup_ref, AN_DATA_DESC)) == FAIL) - printf("*** ERROR from ANcreate\n"); - - /* - * Write the annotation text to the data description. - */ - if (ANwriteann(data_desc_id, DATA_DESC_TXT, strlen(DATA_DESC_TXT)) == FAIL) - printf("*** ERROR from ANwriteann\n"); - - /* - * Terminate access to the vgroup and to the V interface. - */ - if (Vdetach(vgroup_id) == FAIL) - printf("*** ERROR from Vdetach\n"); - if (Vend(file_id) == FAIL) - printf("*** ERROR from Vend\n"); - - /* - * Terminate access to each annotation explicitly. - */ - if (ANendaccess(file_label_id) == FAIL) - printf("*** ERROR from ANendaccess(file_label_id)\n"); - if (ANendaccess(file_desc_id) == FAIL) - printf("*** ERROR from ANendaccess(file_desc_id)\n"); - if (ANendaccess(data_label_id) == FAIL) - printf("*** ERROR from ANendaccess(data_label_id)\n"); - if (ANendaccess(data_desc_id) == FAIL) - printf("*** ERROR from ANendaccess(data_desc_id)\n"); - - /* - * Terminate access to the AN interface and close the HDF file. - */ - if (ANend(an_id) == FAIL) - printf("*** ERROR from ANend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - return 0; -} diff --git a/hdf/examples/AN_get_annotation_info.c b/hdf/examples/AN_get_annotation_info.c deleted file mode 100644 index 352eead838..0000000000 --- a/hdf/examples/AN_get_annotation_info.c +++ /dev/null @@ -1,109 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "General_HDFobjects.hdf" -#define VG_NAME "AN Vgroup" - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 file_id, an_id; - int32 n_annots; /* number of annotations */ - int32 *ann_list = NULL; /* list of annotation identifiers */ - int32 vgroup_ref; /* reference number of the vgroup */ - int32 index; /* index of an annotation in the annotation list */ - ann_type annot_type = AN_DATA_DESC; /* annotation to be obtained*/ - uint16 ann_tag, ann_ref, /* tag/ref number of an annotation */ - vgroup_tag = DFTAG_VG; /* tag of the vgroup */ - - /********************** End of variable declaration **********************/ - - /* - * Create the HDF file. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the V interface. - */ - if (Vstart(file_id) == FAIL) - printf("*** ERROR from Vstart\n"); - - /* - * Get the vgroup named VG_NAME. - */ - if ((vgroup_ref = Vfind(file_id, VG_NAME)) == FAIL) - printf("*** ERROR from Vfind\n"); - - /* - * Initialize the AN interface and obtain an interface id. - */ - if ((an_id = ANstart(file_id)) == FAIL) - printf("*** ERROR from ANstart\n"); - - /* - * Get the number of object descriptions. Note that, since ANnumann takes - * the tag and reference number as being of type unit16, vgroup_ref must be - * safely cast to uint16 by checking for FAIL value first. - */ - if (vgroup_ref != FAIL) { - n_annots = ANnumann(an_id, annot_type, vgroup_tag, (uint16)vgroup_ref); - - /* - * Allocate space to hold the annotation identifiers. - */ - ann_list = malloc(n_annots * sizeof(int32)); - - /* - * Get the list of identifiers of the annotations attached to the - * vgroup and of type annot_type. - */ - n_annots = ANannlist(an_id, annot_type, vgroup_tag, (uint16)vgroup_ref, ann_list); - - /* - * Get each annotation identifier from the list then display the - * tag/ref number pair of the corresponding annotation. - */ - printf("List of annotations of type AN_DATA_DESC:\n"); - for (index = 0; index < n_annots; index++) { - /* - * Get and display the ref number of the annotation from - * its identifier. - */ - if (ANid2tagref(ann_list[index], &ann_tag, &ann_ref) == FAIL) - printf("*** ERROR from ANid2tagref\n"); - printf("Annotation index %d: tag = %s\nreference number= %d\n", index, - ann_tag == DFTAG_DIA ? "DFTAG_DIA (data description)" : "Incorrect", ann_ref); - } /* for */ - } /* for */ - - /* - * Get and display an annotation type from an annotation tag. - */ - annot_type = ANtag2atype(DFTAG_FID); - printf("\nAnnotation type of DFTAG_FID (file label) is %s\n", - annot_type == AN_FILE_LABEL ? "AN_FILE_LABEL" : "Incorrect"); - - /* - * Get and display an annotation tag from an annotation type. - */ - ann_tag = ANatype2tag(AN_DATA_LABEL); - printf("\nAnnotation tag of AN_DATA_LABEL is %s\n", - ann_tag == DFTAG_DIL ? "DFTAG_DIL (data label)" : "Incorrect"); - - /* - * Terminate access to the AN interface and close the HDF file. - */ - if (ANend(an_id) == FAIL) - printf("*** ERROR from ANend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - /* - * Free the space allocated for the annotation identifier list. - */ - free(ann_list); - return 0; -} diff --git a/hdf/examples/AN_read_annotation.c b/hdf/examples/AN_read_annotation.c deleted file mode 100644 index a107d61be4..0000000000 --- a/hdf/examples/AN_read_annotation.c +++ /dev/null @@ -1,97 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "General_HDFobjects.hdf" - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 file_id, /* HDF file identifier */ - an_id, /* AN interface identifier */ - ann_id, /* an annotation identifier */ - index, /* position of an annotation in all of the same type*/ - ann_length, /* length of the text in an annotation */ - n_file_labels, n_file_descs, n_data_labels, n_data_descs; - char *ann_buf; /* buffer to hold the read annotation */ - - /********************** End of variable declaration **********************/ - - /* - * Open the HDF file. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the AN interface. - */ - if ((an_id = ANstart(file_id)) == FAIL) - printf("*** ERROR from ANstart\n"); - - /* - * Get the annotation information, e.g., the numbers of file labels, file - * descriptions, data labels, and data descriptions. - */ - if (ANfileinfo(an_id, &n_file_labels, &n_file_descs, &n_data_labels, &n_data_descs) == FAIL) - printf("*** ERROR from ANfileinfo\n"); - - /* - * Get the data labels. Note that this for loop can be used to - * obtain the contents of each kind of annotation with the appropriate - * number of annotations and the type of annotation, i.e., replace - * n_data_labels with n_file_labels, n_file_descs, or n_data_descs, and - * AN_DATA_LABEL with AN_FILE_LABEL, AN_FILE_DESC, or AN_DATA_DESC, - * respectively. - */ - for (index = 0; index < n_data_labels; index++) { - /* - * Get the identifier of the current data label. - */ - if ((ann_id = ANselect(an_id, index, AN_DATA_LABEL)) == FAIL) - printf("*** ERROR from ANselect\n"); - - /* - * Get the length of the data label. - */ - ann_length = ANannlen(ann_id); - - /* - * Allocate space for the buffer to hold the data label text. - */ - ann_buf = malloc((ann_length + 1) * sizeof(char)); - - /* - * Read and display the data label. Note that the size of the buffer, - * i.e., the third parameter, is 1 character more than the length of - * the data label; that is for the null character. It is not the case - * when a description is retrieved because the description does not - * necessarily end with a null character. - * - */ - if (ANreadann(ann_id, ann_buf, ann_length + 1) == FAIL) - printf("*** ERROR from ANreadann\n"); - printf("Data label index: %d\n", index); - printf("Data label contents: %s\n", ann_buf); - - /* - * Terminate access to the current data label. - */ - if (ANendaccess(ann_id) == FAIL) - printf("*** ERROR from ANendaccess\n"); - - /* - * Free the space allocated for the annotation buffer. - */ - free(ann_buf); - } - - /* - * Terminate access to the AN interface and close the HDF file. - */ - if (ANend(an_id) == FAIL) - printf("*** ERROR from ANend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - return 0; -} diff --git a/hdf/examples/CMakeLists.txt b/hdf/examples/CMakeLists.txt deleted file mode 100644 index 791126a7c6..0000000000 --- a/hdf/examples/CMakeLists.txt +++ /dev/null @@ -1,60 +0,0 @@ -cmake_minimum_required (VERSION 3.12) -project (HDF4_HDF_EXAMPLES C) - -#----------------------------------------------------------------------------- -# Define Sources -#----------------------------------------------------------------------------- -set (examples - VD_create_vdatas - VD_write_mixed_vdata - VD_write_mixed_vdata_struct - VD_write_to_vdata - VD_read_from_vdata - VD_read_mixed_vdata - VD_set_get_vdata_attr - VD_create_onefield_vdatas - VD_get_vdata_info - VD_locate_vdata - VG_create_vgroup -# VG_add_sds_to_vgroup - VG_insert_vdatas_to_vgroup - VG_set_get_vgroup_attr - VG_vgroup_contents - VG_get_vgroup_info - GR_create_and_write_image - GR_modify_image - GR_set_attribute - GR_get_attribute - GR_write_chunks - GR_write_palette - GR_image_info - GR_read_chunks - GR_read_image - AN_create_annotation - AN_get_annotation_info - AN_read_annotation -) - -foreach (example ${examples}) - add_executable (hdf_${example} ${HDF4_HDF_EXAMPLES_SOURCE_DIR}/${example}.c) - if (NOT BUILD_SHARED_LIBS) - TARGET_C_PROPERTIES (hdf_${example} STATIC) - target_link_libraries (hdf_${example} PRIVATE ${HDF4_SRC_LIB_TARGET}) - else () - TARGET_C_PROPERTIES (hdf_${example} SHARED) - target_link_libraries (hdf_${example} PRIVATE ${HDF4_SRC_LIBSH_TARGET}) - endif () -endforeach () - -add_executable (hdf_VG_add_sds_to_vgroup ${HDF4_HDF_EXAMPLES_SOURCE_DIR}/VG_add_sds_to_vgroup.c) -if (NOT BUILD_SHARED_LIBS) - TARGET_C_PROPERTIES (hdf_VG_add_sds_to_vgroup STATIC) - target_link_libraries (hdf_VG_add_sds_to_vgroup PRIVATE ${HDF4_MF_LIB_TARGET}) -else () - TARGET_C_PROPERTIES (hdf_VG_add_sds_to_vgroup SHARED) - target_link_libraries (hdf_VG_add_sds_to_vgroup PRIVATE ${HDF4_MF_LIBSH_TARGET}) -endif () - -if (BUILD_TESTING) - include (CMakeTests.cmake) -endif () diff --git a/hdf/examples/CMakeTests.cmake b/hdf/examples/CMakeTests.cmake deleted file mode 100644 index eed6603dbc..0000000000 --- a/hdf/examples/CMakeTests.cmake +++ /dev/null @@ -1,44 +0,0 @@ - -############################################################################## -############################################################################## -### T E S T I N G ### -############################################################################## -############################################################################## - -# Remove any output file left over from previous test run -add_test ( - NAME HDF_EXAMPLES-clearall-objects - COMMAND ${CMAKE_COMMAND} -E remove - General_HDFobjects.hdf - General_Rimages.hdf - General_Vdatas.hdf - General_Vgroups.hdf - Image_with_Palette.hdf - Packed_Vdata.hdf - Two_Vdatas.hdf - Two_Vgroups.hdf -) -if (NOT "${last_test}" STREQUAL "") - set_tests_properties (HDF_EXAMPLES-clearall-objects PROPERTIES DEPENDS ${last_test} LABELS EXAMPLES) -else () - set_tests_properties (HDF_EXAMPLES-clearall-objects PROPERTIES LABELS EXAMPLES) -endif () -set (last_test "HDF_EXAMPLES-clearall-objects") - -foreach (example ${examples}) - add_test (NAME HDF_EXAMPLES-${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (HDF_EXAMPLES-${example} PROPERTIES DEPENDS ${last_test} LABELS EXAMPLES) - else () - set_tests_properties (HDF_EXAMPLES-${example} PROPERTIES LABELS EXAMPLES) - endif () - set (last_test "HDF_EXAMPLES-${example}") -endforeach () - -add_test (NAME HDF_EXAMPLES-VG_add_sds_to_vgroup COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) -if (NOT "${last_test}" STREQUAL "") - set_tests_properties (HDF_EXAMPLES-VG_add_sds_to_vgroup PROPERTIES DEPENDS ${last_test} LABELS EXAMPLES) -else () - set_tests_properties (HDF_EXAMPLES-VG_add_sds_to_vgroup PROPERTIES LABELS EXAMPLES) -endif () -set (last_test "HDF_EXAMPLES-VG_add_sds_to_vgroup") diff --git a/hdf/examples/GR_create_and_write_image.c b/hdf/examples/GR_create_and_write_image.c deleted file mode 100644 index f9b710b2a1..0000000000 --- a/hdf/examples/GR_create_and_write_image.c +++ /dev/null @@ -1,89 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "General_RImages.hdf" -#define IMAGE_NAME "Image Array 1" -#define X_LENGTH 10 /* number of columns in the image */ -#define Y_LENGTH 5 /* number of rows in the image */ -#define N_COMPS 2 /* number of components in the image */ - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 file_id, /* HDF file identifier */ - gr_id, /* GR interface identifier */ - ri_id, /* raster image identifier */ - start[2], /* start position to write for each dimension */ - edges[2], /* number of elements to be written - along each dimension */ - dim_sizes[2], /* dimension sizes of the image array */ - interlace_mode, /* interlace mode of the image */ - data_type, /* data type of the image data */ - i, j; - int16 image_buf[Y_LENGTH][X_LENGTH][N_COMPS]; - - /********************** End of variable declaration **********************/ - - /* - * Create and open the file. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_CREATE, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the GR interface. - */ - if ((gr_id = GRstart(file_id)) == FAIL) - printf("*** ERROR from GRstart\n"); - - /* - * Set the data type, interlace mode, and dimensions of the image. - */ - data_type = DFNT_INT16; - interlace_mode = MFGR_INTERLACE_PIXEL; - dim_sizes[0] = X_LENGTH; - dim_sizes[1] = Y_LENGTH; - - /* - * Create the raster image array. - */ - if ((ri_id = GRcreate(gr_id, IMAGE_NAME, N_COMPS, data_type, interlace_mode, dim_sizes)) == FAIL) - printf("*** ERROR from GRcreate\n"); - - /* - * Fill the image data buffer with values. - */ - for (i = 0; i < Y_LENGTH; i++) { - for (j = 0; j < X_LENGTH; j++) { - image_buf[i][j][0] = (i + j) + 1; /* first component */ - image_buf[i][j][1] = (i + j) + 1; /* second component */ - } - } - - /* - * Define the size of the data to be written, i.e., start from the origin - * and go as long as the length of each dimension. - */ - start[0] = start[1] = 0; - edges[0] = X_LENGTH; - edges[1] = Y_LENGTH; - - /* - * Write the data in the buffer into the image array. - */ - if (GRwriteimage(ri_id, start, NULL, edges, (void *)image_buf) == FAIL) - printf("*** ERROR from GRwriteimage\n"); - - /* - * Terminate access to the raster image and to the GR interface and, - * close the HDF file. - */ - if (GRendaccess(ri_id) == FAIL) - printf("*** ERROR from GRendaccess\n"); - if (GRend(gr_id) == FAIL) - printf("*** ERROR from GRend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - return 0; -} diff --git a/hdf/examples/GR_get_attribute.c b/hdf/examples/GR_get_attribute.c deleted file mode 100644 index 809699b5be..0000000000 --- a/hdf/examples/GR_get_attribute.c +++ /dev/null @@ -1,148 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "General_RImages.hdf" -#define RI_ATTR_NAME "Image Attribute 2" - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 gr_id, ri_id, file_id; - int32 f_att_index; /* index of file attributes */ - int32 ri_att_index; /* index of raster image attributes */ - int32 data_type; /* image data type */ - int32 n_values; /* number of values in an attribute */ - int32 value_index; /* index of values in an attribute */ - int32 n_rimages; /* number of raster images in the file */ - int32 n_file_attrs; /* number of file attributes */ - char attr_name[H4_MAX_GR_NAME]; /* buffer to hold the attribute name */ - void *data_buf = NULL; /* buffer to hold the attribute values */ - int16 *int_ptr; /* int16 pointer to point to a void data buffer */ - char8 *char_ptr; /* char8 pointer to point to a void data buffer */ - - /********************** End of variable declaration **********************/ - - /* - * Open the HDF file. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the GR interface. - */ - if ((gr_id = GRstart(file_id)) == FAIL) - printf("*** ERROR from GRstart\n"); - - /* - * Determine the number of attributes in the file. - */ - if (GRfileinfo(gr_id, &n_rimages, &n_file_attrs) == FAIL) - printf("*** ERROR from GRfileinfo\n"); - else if (n_file_attrs > 0) { - for (f_att_index = 0; f_att_index < n_file_attrs; f_att_index++) { - /* - * Get information about the current file attribute. - */ - if (GRattrinfo(gr_id, f_att_index, attr_name, &data_type, &n_values) == FAIL) - printf("*** ERROR from GRattrinfo\n"); - - /* - * Allocate a buffer to hold the file attribute data. In this example, - * knowledge about the data type is assumed to be available from - * the previous example for simplicity. In reality, the size - * of the type must be determined based on the machine where the - * program resides. - */ - if (data_type == DFNT_CHAR8) { - data_buf = malloc(n_values * sizeof(char8)); - if (data_buf == NULL) { - printf("Unable to allocate space for attribute data.\n"); - exit(1); - } - } - else { - printf("Unable to determine data type to allocate data buffer.\n"); - exit(1); - } - - /* - * Read and display the attribute values. - */ - if (GRgetattr(gr_id, f_att_index, (void *)data_buf) == FAIL) - printf("*** ERROR from GRgetattr\n"); - - char_ptr = (char8 *)data_buf; - printf("Attribute %s: ", attr_name); - for (value_index = 0; value_index < n_values; value_index++) - printf("%c", char_ptr[value_index]); - printf("\n"); - - /* - * Free the space allocated for the data buffer. - */ - - free(data_buf); - - } /* for */ - } /* if */ - - /* - * Select the second image in the file. - */ - if ((ri_id = GRselect(gr_id, 1)) == FAIL) - printf("*** ERROR from GRselect\n"); - - /* - * Find the image attribute named RI_ATTR_NAME. - */ - if ((ri_att_index = GRfindattr(ri_id, RI_ATTR_NAME)) == FAIL) - printf("*** ERROR from GRfindattr\n"); - - /* - * Get information about the attribute. - */ - if (GRattrinfo(ri_id, ri_att_index, attr_name, &data_type, &n_values) == FAIL) - printf("*** ERROR from GRattrinfo\n"); - - /* - * Allocate a buffer to hold the file attribute data. As mentioned above, - * knowledge about the data type is assumed to be available from - * the previous example for simplicity. In reality, the size of the - * type must be determined based on the machine where the program resides. - */ - if (data_type == DFNT_INT16) - data_buf = malloc(n_values * sizeof(int16)); - - /* - * Read and display the attribute values. - */ - if (GRgetattr(ri_id, ri_att_index, (void *)data_buf) == FAIL) - printf("*** ERROR from GRgetattr\n"); - - printf("\nAttribute %s: ", RI_ATTR_NAME); - int_ptr = (int16 *)data_buf; - for (value_index = 0; value_index < n_values; value_index++) - printf("%d ", int_ptr[value_index]); - printf("\n"); - - /* - * Free the space allocated for the data buffer. - */ - free(data_buf); - - /* - * Terminate access to the raster image and to the GR interface, and - * close the file. - */ - - if (GRendaccess(ri_id) == FAIL) - printf("*** ERROR from GRendaccess\n"); - if (GRend(gr_id) == FAIL) - printf("*** ERROR from GRend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/GR_image_info.c b/hdf/examples/GR_image_info.c deleted file mode 100644 index 8feeddde4d..0000000000 --- a/hdf/examples/GR_image_info.c +++ /dev/null @@ -1,104 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "General_RImages.hdf" - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 file_id, gr_id, ri_id; - int32 n_rimages, /* number of raster images in the file */ - n_file_attrs, /* number of file attributes */ - ri_index, /* index of a image */ - dim_sizes[2], /* dimensions of an image */ - n_comps, /* number of components an image contains */ - interlace_mode, /* interlace mode of an image */ - data_type, /* number type of an image */ - n_attrs; /* number of attributes belong to an image */ - char name[H4_MAX_GR_NAME], /* name of an image */ - *type_string, /* mapped text of a number type */ - *interlace_string; /* mapped text of an interlace mode */ - - /********************** End of variable declaration **********************/ - - /* - * Open the file for reading. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the GR interface. - */ - if ((gr_id = GRstart(file_id)) == FAIL) - printf("*** ERROR from GRstart\n"); - - /* - * Determine the contents of the file. - */ - if (GRfileinfo(gr_id, &n_rimages, &n_file_attrs) == FAIL) - printf("*** ERROR from GRfileinfo\n"); - - /* - * For each image in the file, get and display the image information. - */ - printf("RI# Name Components Type Interlace \ - Dimensions Attributes\n\n"); - for (ri_index = 0; ri_index < n_rimages; ri_index++) { - ri_id = GRselect(gr_id, ri_index); - if (GRgetiminfo(ri_id, name, &n_comps, &data_type, &interlace_mode, dim_sizes, &n_attrs) == FAIL) - printf("*** ERROR from GRgetiminfo\n"); - /* - * Map the number type and interlace mode into text strings for output - * readability. Note that, in this example, only two possible types - * are considered because of the simplicity of the example. For real - * problems, all possible types should be checked and, if reading the - * data is desired, the size of the type must be determined based on the - * machine where the program resides. - */ - if (data_type == DFNT_CHAR8) - type_string = "Char8"; - else if (data_type == DFNT_INT16) - type_string = "Int16"; - else - type_string = "Unknown"; - - switch (interlace_mode) { - case MFGR_INTERLACE_PIXEL: - interlace_string = "MFGR_INTERLACE_PIXEL"; - break; - case MFGR_INTERLACE_LINE: - interlace_string = "MFGR_INTERLACE_LINE"; - break; - case MFGR_INTERLACE_COMPONENT: - interlace_string = "MFGR_INTERLACE_COMPONENT"; - break; - default: - interlace_string = "Unknown"; - break; - } /* switch */ - - /* - * Display the image information for the current raster image. - */ - printf("%d %s %d %s %s %2d,%2d %d\n", ri_index, name, n_comps, type_string, - interlace_string, dim_sizes[0], dim_sizes[1], n_attrs); - - /* - * Terminate access to the current raster image. - */ - if (GRendaccess(ri_id) == FAIL) - printf("*** ERROR from GRendaccess\n"); - } - - /* - * Terminate access to the GR interface and close the HDF file. - */ - if (GRend(gr_id) == FAIL) - printf("*** ERROR from GRend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/GR_modify_image.c b/hdf/examples/GR_modify_image.c deleted file mode 100644 index f5f57016b3..0000000000 --- a/hdf/examples/GR_modify_image.c +++ /dev/null @@ -1,129 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "General_RImages.hdf" -#define X1_LENGTH 5 /* number of columns in the first image being modified */ -#define Y1_LENGTH 2 /* number of rows in the first image being modified */ -#define N1_COMPS 2 /* number of components in the first image */ -#define IMAGE1_NAME "Image Array 1" -#define IMAGE2_NAME "Image Array 2" -#define X2_LENGTH 6 /* number of columns in the second image */ -#define Y2_LENGTH 4 /* number of rows in the second image */ -#define N2_COMPS 3 /* number of components in the second image */ - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 file_id, /* HDF file identifier */ - gr_id, /* GR interface identifier */ - ri1_id, /* raster image identifier */ - start1[2], /* start position to write for each dimension */ - edges1[2], /* number of elements to be written along each dimension */ - ri2_id, /* raster image identifier */ - start2[2], /* start position to write for each dimension */ - edges2[2], /* number of elements to be written along each dimension */ - dims_sizes[2], /* sizes of the two dimensions of the image array */ - data_type, /* data type of the image data */ - interlace_mode; /* interlace mode of the image */ - int16 i, j; /* indices for the dimensions */ - int16 image1_buf[Y1_LENGTH][X1_LENGTH][N1_COMPS]; /* data of first image */ - char image2_buf[Y2_LENGTH][X2_LENGTH][N2_COMPS]; /* data of second image*/ - - /********************** End of variable declaration **********************/ - - /* - * Open the HDF file for writing. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_WRITE, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the GR interface. - */ - if ((gr_id = GRstart(file_id)) == FAIL) - printf("*** ERROR from GRstart\n"); - - /* - * Select the first raster image in the file. - */ - ri1_id = GRselect(gr_id, 0); - - /* - * Fill the first image data buffer with values. - */ - for (i = 0; i < Y1_LENGTH; i++) { - for (j = 0; j < X1_LENGTH; j++) { - image1_buf[i][j][0] = 0; /* first component */ - image1_buf[i][j][1] = 0; /* second component */ - } - } - - /* - * Define the size of the data to be written, i.e., start from the origin - * and go as long as the length of each dimension. - */ - start1[0] = start1[1] = 0; - edges1[0] = X1_LENGTH; - edges1[1] = Y1_LENGTH; - - /* - * Write the data in the buffer into the image array. - */ - if (GRwriteimage(ri1_id, start1, NULL, edges1, (void *)image1_buf) == FAIL) - printf("*** ERROR from GRwriteimage\n"); - - /* - * Set the interlace mode and dimensions of the second image. - */ - data_type = DFNT_CHAR8; - interlace_mode = MFGR_INTERLACE_PIXEL; - dims_sizes[0] = X2_LENGTH; - dims_sizes[1] = Y2_LENGTH; - - /* - * Create the second image in the file. - */ - ri2_id = GRcreate(gr_id, IMAGE2_NAME, N2_COMPS, data_type, interlace_mode, dims_sizes); - - /* - * Fill the second image data buffer with values. - */ - for (i = 0; i < Y2_LENGTH; i++) { - for (j = 0; j < X2_LENGTH; j++) { - image2_buf[i][j][0] = 'A'; /* first component */ - image2_buf[i][j][1] = 'B'; /* second component */ - image2_buf[i][j][2] = 'C'; /* third component */ - } - } - - /* - * Define the size of the data to be written, i.e., start from the origin - * and go as long as the length of each dimension. - */ - for (i = 0; i < 2; i++) { - start2[i] = 0; - edges2[i] = dims_sizes[i]; - } - - /* - * Write the data in the buffer into the second image array. - */ - if (GRwriteimage(ri2_id, start2, NULL, edges2, (void *)image2_buf) == FAIL) - printf("*** ERROR from GRwriteimage\n"); - - /* - * Terminate access to the raster images and to the GR interface, and - * close the HDF file. - */ - if (GRendaccess(ri1_id) == FAIL) - printf("*** ERROR from GRendaccess\n"); - if (GRendaccess(ri2_id) == FAIL) - printf("*** ERROR from GRendaccess\n"); - if (GRend(gr_id) == FAIL) - printf("*** ERROR from GRend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/GR_read_image.c b/hdf/examples/GR_read_image.c deleted file mode 100644 index 775c941157..0000000000 --- a/hdf/examples/GR_read_image.c +++ /dev/null @@ -1,136 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "General_RImages.hdf" -#define N_COMPS 2 -#define X_LENGTH 10 /* number of columns of the entire image */ -#define Y_LENGTH 5 /* number of rows of the entire image */ -#define PART_COLS 2 /* number of columns read for partial image */ -#define PART_ROWS 3 /* number of rows read for partial image */ -#define SKIP_COLS 5 /* number of columns read for skipped image */ -#define SKIP_ROWS 3 /* number of rows read for skipped image */ -#define COLS_PART_START 3 /* starting column to read partial image */ -#define ROWS_PART_START 1 /* starting row to read partial image */ -#define COLS_SKIP_START 1 /* starting column to read skipped image */ -#define ROWS_SKIP_START 0 /* starting row to read skipped image */ -#define N_STRIDES 2 /* number of elements to skip on each dim. */ - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 file_id, gr_id, ri_id; - int32 start[2]; /* start position to write for each dimension */ - int32 edges[2]; /* number of elements to bewritten along each dimension */ - int32 stride[2]; /* number of elements to skip on each dimension */ - int16 entire_image[Y_LENGTH][X_LENGTH][N_COMPS]; - int16 partial_image[PART_ROWS][PART_COLS][N_COMPS]; - int16 skipped_image[SKIP_ROWS][SKIP_COLS][N_COMPS]; - int32 i, j; - - /********************** End of variable declaration **********************/ - - /* - * Open the HDF file for reading. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the GR interface. - */ - gr_id = GRstart(file_id); - - /* - * Select the first raster image in the file. - */ - ri_id = GRselect(gr_id, 0); - - /* - * Define the size of the data to be read, i.e., start from the origin - * and go as long as the length of each dimension. - */ - start[0] = start[1] = 0; - edges[0] = X_LENGTH; - edges[1] = Y_LENGTH; - - /* - * Read the data from the raster image array. - */ - if (GRreadimage(ri_id, start, NULL, edges, (void *)entire_image) == FAIL) - printf("*** ERROR from GRreadimage\n"); - - /* - * Display only the first component of the image since the two components - * have the same data in this example. - */ - printf("First component of the entire image:\n"); - for (i = 0; i < Y_LENGTH; i++) { - for (j = 0; j < X_LENGTH; j++) - printf("%d ", entire_image[i][j][0]); - printf("\n"); - } - - /* - * Define the size of the data to be read. - */ - start[0] = COLS_PART_START; - start[1] = ROWS_PART_START; - edges[0] = PART_COLS; - edges[1] = PART_ROWS; - - /* - * Read a subset of the raster image array. - */ - if (GRreadimage(ri_id, start, NULL, edges, (void *)partial_image) == FAIL) - printf("*** ERROR from GRreadimage\n"); - - /* - * Display the first component of the read sample. - */ - printf("\nThree rows & two cols at 2nd row and 4th column"); - printf(" of the first component:\n"); - for (i = 0; i < PART_ROWS; i++) { - for (j = 0; j < PART_COLS; j++) - printf("%d ", partial_image[i][j][0]); - printf("\n"); - } - - /* - * Define the size and the pattern to read the data. - */ - start[0] = COLS_SKIP_START; - start[1] = ROWS_SKIP_START; - edges[0] = SKIP_COLS; - edges[1] = SKIP_ROWS; - stride[0] = stride[1] = N_STRIDES; - - /* - * Read all the odd rows and even columns of the image. - */ - if (GRreadimage(ri_id, start, stride, edges, (void *)skipped_image) == FAIL) - printf("*** ERROR from GRreadimage\n"); - - /* - * Display the first component of the read sample. - */ - printf("\nAll odd rows and even columns of the first component:\n"); - for (i = 0; i < SKIP_ROWS; i++) { - for (j = 0; j < SKIP_COLS; j++) - printf("%d ", skipped_image[i][j][0]); - printf("\n"); - } - - /* - * Terminate access to the raster image and to the GR interface, and - * close the HDF file. - */ - if (GRendaccess(ri_id) == FAIL) - printf("*** ERROR from GRendaccess\n"); - if (GRend(gr_id) == FAIL) - printf("*** ERROR from GRend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/GR_read_palette.c b/hdf/examples/GR_read_palette.c deleted file mode 100644 index 4c26b633c2..0000000000 --- a/hdf/examples/GR_read_palette.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "Image_with_Palette.hdf" -#define IMAGE_NAME "Image with Palette" -#define N_ENTRIES 256 /* number of elements of each color */ - -int -main() -{ - /************************* Variable declaration **************************/ - - intn i, j; - int32 file_id, gr_id, ri_id, pal_id, ri_index; - int32 data_type, n_comps, n_entries, interlace_mode; - uint8 palette_data[N_ENTRIES][3]; /* static because of fixed size */ - - /************************* Variable declaration **************************/ - - /* - * Open the file. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initiate the GR interface. - */ - gr_id = GRstart(file_id); - - /* - * Get the index of the image IMAGR_NAME. - */ - ri_index = GRnametoindex(gr_id, IMAGE_NAME); - - /* - * Get image identifier. - */ - ri_id = GRselect(gr_id, ri_index); - - /* - * Get the identifier of the palette attached to the image. - */ - pal_id = GRgetlutid(ri_id, ri_index); - - /* - * Obtain and display information about the palette. - */ - if (GRgetlutinfo(pal_id, &n_comps, &data_type, &interlace_mode, &n_entries) == FAIL) - printf("*** ERROR from GRgetlutinfo\n"); - printf("Palette: %d components; %d entries\n", n_comps, n_entries); - - /* - * Read the palette data. - */ - if (GRreadlut(pal_id, (void *)palette_data) == FAIL) - printf("*** ERROR from GRreadlut\n"); - - /* - * Display the palette data. Recall that HDF supports only 256 colors. - * Each color is defined by its 3 components. Therefore, - * verifying the value of n_entries and n_comps is not necessary and - * the buffer to hold the palette data can be static. However, - * if more values or colors are added to the model, these parameters - * must be checked to allocate sufficient space when reading a palette. - */ - printf(" Palette Data: \n"); - for (i = 0; i < n_entries; i++) { - for (j = 0; j < n_comps; j++) - printf("%i ", palette_data[i][j]); - printf("\n"); - } - printf("\n"); - - /* - * Terminate access to the image and to the GR interface, and - * close the HDF file. - */ - if (GRendaccess(ri_id) == FAIL) - printf("*** ERROR from GRendaccess\n"); - if (GRend(gr_id) == FAIL) - printf("*** ERROR from GRend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/GR_set_attribute.c b/hdf/examples/GR_set_attribute.c deleted file mode 100644 index 866ce0f2fc..0000000000 --- a/hdf/examples/GR_set_attribute.c +++ /dev/null @@ -1,80 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "General_RImages.hdf" -#define IMAGE_NAME "Image Array 2" -#define F_ATT1_NAME "File Attribute 1" -#define F_ATT2_NAME "File Attribute 2" -#define RI_ATT1_NAME "Image Attribute 1" -#define RI_ATT2_NAME "Image Attribute 2" -#define F_ATT1_VAL "Contents of First FILE Attribute" -#define F_ATT2_VAL "Contents of Second FILE Attribute" -#define F_ATT1_N_VALUES 32 -#define F_ATT2_N_VALUES 33 -#define RI_ATT1_VAL "Contents of IMAGE's First Attribute" -#define RI_ATT1_N_VALUES 35 -#define RI_ATT2_N_VALUES 6 - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 gr_id, ri_id, file_id, ri_index; - int16 ri_attr_2[RI_ATT2_N_VALUES] = {1, 2, 3, 4, 5, 6}; - - /********************** End of variable declaration **********************/ - - /* - * Open the HDF file. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_WRITE, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the GR interface. - */ - gr_id = GRstart(file_id); - - /* - * Set two file attributes to the file with names, data types, numbers of - * values, and values of the attributes specified. - */ - if (GRsetattr(gr_id, F_ATT1_NAME, DFNT_CHAR8, F_ATT1_N_VALUES, (void *)F_ATT1_VAL) == FAIL) - printf("*** ERROR from GRsetattr\n"); - - if (GRsetattr(gr_id, F_ATT2_NAME, DFNT_CHAR8, F_ATT2_N_VALUES, (void *)F_ATT2_VAL) == FAIL) - printf("*** ERROR from GRsetattr\n"); - - /* - * Obtain the index of the image named IMAGE_NAME. - */ - ri_index = GRnametoindex(gr_id, IMAGE_NAME); - - /* - * Obtain the identifier of this image. - */ - ri_id = GRselect(gr_id, ri_index); - - /* - * Set two attributes to the image with names, data types, numbers of - * values, and values of the attributes specified. - */ - if (GRsetattr(ri_id, RI_ATT1_NAME, DFNT_CHAR8, RI_ATT1_N_VALUES, (void *)RI_ATT1_VAL) == FAIL) - printf("*** ERROR from GRsetattr\n"); - - if (GRsetattr(ri_id, RI_ATT2_NAME, DFNT_INT16, RI_ATT2_N_VALUES, (void *)ri_attr_2) == FAIL) - printf("*** ERROR from GRsetattr\n"); - - /* - * Terminate access to the image and to the GR interface, and close the - * HDF file. - */ - if (GRendaccess(ri_id) == FAIL) - printf("*** ERROR from GRendaccess\n"); - if (GRend(gr_id) == FAIL) - printf("*** ERROR from GRend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/GR_write_palette.c b/hdf/examples/GR_write_palette.c deleted file mode 100644 index 5bc86ef76e..0000000000 --- a/hdf/examples/GR_write_palette.c +++ /dev/null @@ -1,110 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "Image_with_Palette.hdf" -#define NEW_IMAGE_NAME "Image with Palette" -#define N_COMPS_IMG 2 /* number of image components */ -#define X_LENGTH 5 /* number of rows in the image */ -#define Y_LENGTH 5 /* number of columns in the image */ -#define N_ENTRIES 256 /* number of entries in the palette */ -#define N_COMPS_PAL 3 /* number of palette's components */ - -int -main() -{ - /************************* Variable declaration **************************/ - - intn i, j; - int32 file_id, gr_id, ri_id, pal_id, interlace_mode, - start[2], /* holds where to start to write for each dimension */ - edges[2], /* holds how long to write for each dimension */ - dim_sizes[2]; /* sizes of the two dimensions of the image array */ - uint8 image_buf[Y_LENGTH][X_LENGTH][N_COMPS_IMG]; /* data of first image */ - uint8 palette_buf[N_ENTRIES][N_COMPS_PAL]; - - /********************** End of variable declaration **********************/ - - /* - * Open the HDF file. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_CREATE, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the GR interface. - */ - gr_id = GRstart(file_id); - - /* - * Define the dimensions and interlace mode of the image. - */ - dim_sizes[0] = X_LENGTH; - dim_sizes[1] = Y_LENGTH; - interlace_mode = MFGR_INTERLACE_PIXEL; - - /* - * Create the image named NEW_IMAGE_NAME. - */ - ri_id = GRcreate(gr_id, NEW_IMAGE_NAME, N_COMPS_IMG, DFNT_UINT8, interlace_mode, dim_sizes); - - /* - * Fill the image data buffer with values. - */ - for (i = 0; i < Y_LENGTH; i++) { - for (j = 0; j < X_LENGTH; j++) { - image_buf[i][j][0] = (i + j) + 1; - image_buf[i][j][1] = (i + j) + 2; - } - } - - /* - * Define the size of the data to be written, i.e., start from the origin - * and go as long as the length of each dimension. - */ - start[0] = start[1] = 0; - edges[0] = X_LENGTH; - edges[1] = Y_LENGTH; - - /* - * Write the data in the buffer into the image array. - */ - if (GRwriteimage(ri_id, start, NULL, edges, (void *)image_buf) == FAIL) - printf("*** ERROR from GRwriteimage\n"); - - /* - * Initialize the palette to grayscale. - */ - for (i = 0; i < N_ENTRIES; i++) { - palette_buf[i][0] = i; - palette_buf[i][1] = i; - palette_buf[i][2] = i; - } - - /* - * Define palette interlace mode. - */ - interlace_mode = MFGR_INTERLACE_PIXEL; - - /* - * Get the identifier of the palette attached to the image NEW_IMAGE_NAME. - */ - pal_id = GRgetlutid(ri_id, 0); - - /* - * Write data to the palette. - */ - if (GRwritelut(pal_id, N_COMPS_PAL, DFNT_UINT8, interlace_mode, N_ENTRIES, (void *)palette_buf) == FAIL) - printf("*** ERROR from GRwritelut\n"); - - /* - * Terminate access to the image and to the GR interface, and - * close the HDF file. - */ - if (GRendaccess(ri_id) == FAIL) - printf("*** ERROR from GRendaccess\n"); - if (GRend(gr_id) == FAIL) - printf("*** ERROR from GRend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/Makefile.am b/hdf/examples/Makefile.am deleted file mode 100644 index 24430fe1d8..0000000000 --- a/hdf/examples/Makefile.am +++ /dev/null @@ -1,98 +0,0 @@ -############################################################################# -## Setup for building programs ## -############################################################################# - -include $(top_srcdir)/config/commence.am - -DEFINES=-DHDF - -############################################################################# -## Programs to build ## -############################################################################# - -EXAMPLE_PROG = VD_create_vdatas VD_write_mixed_vdata \ - VD_write_mixed_vdata_struct VD_write_to_vdata \ - VD_read_from_vdata VD_read_mixed_vdata \ - VD_set_get_vdata_attr VD_create_onefield_vdatas \ - VD_get_vdata_info VD_locate_vdata VG_create_vgroup \ - VG_add_sds_to_vgroup VG_insert_vdatas_to_vgroup \ - VG_set_get_vgroup_attr VG_vgroup_contents \ - VG_get_vgroup_info GR_create_and_write_image \ - GR_modify_image GR_set_attribute GR_get_attribute \ - GR_write_palette GR_read_palette GR_image_info \ - GR_read_image GR_write_chunks GR_read_chunks \ - AN_create_annotation AN_get_annotation_info AN_read_annotation -TEST_PROG = $(EXAMPLE_PROG) - -# These are the C example files to be installed -INSTALL_FILES= VD_read_from_vdata.c VD_read_mixed_vdata.c \ - VD_set_get_vdata_attr.c VD_write_mixed_vdata.c \ - VD_write_mixed_vdata_struct.c VD_write_to_vdata.c \ - VD_create_onefield_vdatas.c VD_create_vdatas.c \ - VD_get_vdata_info.c VD_locate_vdata.c \ - VG_insert_vdatas_to_vgroup.c VG_set_get_vgroup_attr.c \ - VG_vgroup_contents.c VG_add_sds_to_vgroup.c \ - VG_create_vgroup.c VG_get_vgroup_info.c \ - GR_create_and_write_image.c GR_get_attribute.c \ - GR_image_info.c GR_modify_image.c GR_read_image.c \ - GR_read_palette.c GR_set_attribute.c \ - GR_write_palette.c GR_write_chunks.c GR_read_chunks.c \ - AN_create_annotation.c AN_get_annotation_info.c \ - AN_read_annotation.c - -INSTALL_SCRIPT_FILES = run-c-ex.sh - -INSTALL_TOP_SCRIPT_FILES = run-all-ex.sh -INSTALL_TOP_FILES = README - -# Where to install example files -EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf4_examples/c -EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf4_examples - -# How to build C programs using h4cc -$(EXTRA_PROG): $(H4CC) - $(H4CC) $(H4CCFLAGS) $(CFLAGS) -o $@ $(srcdir)/$@.c; - -# List dependencies for each program. Normally, automake would take -# care of this for us, but if we tell automake about the programs it -# will try to build them with the normal C compiler, not h4cc. - -# C Programs -VD_read_from_vdata: $(srcdir)/VD_read_from_vdata.c -VD_read_mixed_vdata: $(srcdir)/VD_read_mixed_vdata.c -VD_set_get_vdata_attr: $(srcdir)/VD_set_get_vdata_attr.c -VD_write_mixed_vdata: $(srcdir)/VD_write_mixed_vdata.c -VD_write_mixed_vdata_struct: $(srcdir)/VD_write_mixed_vdata_struct.c -VD_write_to_vdata: $(srcdir)/VD_write_to_vdata.c -VD_create_onefield_vdatas: $(srcdir)/VD_create_onefield_vdatas.c -VD_create_vdatas: $(srcdir)/VD_create_vdatas.c -VD_get_vdata_info: $(srcdir)/VD_get_vdata_info.c -VD_locate_vdata: $(srcdir)/VD_locate_vdata.c -VG_insert_vdatas_to_vgroup: $(srcdir)/VG_insert_vdatas_to_vgroup.c -VG_set_get_vgroup_attr: $(srcdir)/VG_set_get_vgroup_attr.c -VG_vgroup_contents: $(srcdir)/VG_vgroup_contents.c -VG_add_sds_to_vgroup: $(srcdir)/VG_add_sds_to_vgroup.c -VG_create_vgroup: $(srcdir)/VG_create_vgroup.c -VG_get_vgroup_info: $(srcdir)/VG_get_vgroup_info.c -GR_create_and_write_image: $(srcdir)/GR_create_and_write_image.c -GR_get_attribute: $(srcdir)/GR_get_attribute.c -GR_image_info: $(srcdir)/GR_image_info.c -GR_modify_image: $(srcdir)/GR_modify_image.c -GR_read_chunks: $(srcdir)/GR_read_chunks.c -GR_read_image: $(srcdir)/GR_read_image.c -GR_read_palette: $(srcdir)/GR_read_palette.c -GR_set_attribute: $(srcdir)/GR_set_attribute.c -GR_write_chunks: $(srcdir)/GR_write_chunks.c -GR_write_palette: $(srcdir)/GR_write_palette.c -AN_create_annotation: $(srcdir)/AN_create_annotation.c -AN_get_annotation_info: $(srcdir)/AN_get_annotation_info.c -AN_read_annotation: $(srcdir)/AN_read_annotation.c - -DISTCLEANFILES = *.chkexe *.chklog - -if BUILD_SHARED_SZIP_CONDITIONAL -LD_LIBRARY_PATH=$(LL_PATH) -endif - -include $(top_srcdir)/config/examples.am -include $(top_srcdir)/config/conclude.am diff --git a/hdf/examples/README b/hdf/examples/README deleted file mode 100644 index 999fe20c4b..0000000000 --- a/hdf/examples/README +++ /dev/null @@ -1,29 +0,0 @@ - HDF4 Examples - -Code Examples -============= -This directory contains example programs for the installed APIs and scripts to -compile and run them. Examples in the c subdirectory are always -installed, and those in the fortran subdirectory will be installed -when fortran is enabled. - -Running the run-all-ex.sh script in this directory will run the scripts and in -turn the examples in the subdirectories where examples are installed. The -scripts can also be run individually. The appropriate compile scripts in the -bin directory for this install will be used by default to compile and link the -example programs. Note that h4redeploy must be run if these binaries are -copied or extracted in a directory other than the one where they were initially -installed. Compile scripts from other locations can be used by setting an -environment variable prefix to the path of the directory containing the bin -directory with the compile scripts h4cc and h4fc. For example, export -prefix=/usr/local/hdf4 to use h4cc and h4fc in /usr/local/hdf4/bin. - -Running HDF4 examples built with shared libraries not in system locations may -result in an error message "...error while loading shared libraries: ...". -Setting LD_LIBRARY_PATH to include the directory containing the missing library -should allow the examples to run. - - -HDF4 Data File Examples -======================= -Examples of HDF4 data files (with extension .hdf) may be found in the source directory mfhdf/dumper/testfiles. Also, running the run-all-ex.sh script produces HDF4 data files that are automatically deleted by the scripts. The scripts in the c and fortran subdirectories can be modified to not delete those data files by commenting with "#" the line "rm *.hdf" in the last 5 lines of the scripts in those subdirectories. diff --git a/hdf/examples/VD_create_onefield_vdatas.c b/hdf/examples/VD_create_onefield_vdatas.c deleted file mode 100644 index ffe43d794f..0000000000 --- a/hdf/examples/VD_create_onefield_vdatas.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "General_Vdatas.hdf" -#define CLASS1_NAME "5x1 Array" -#define CLASS2_NAME "6x4 Array" -#define VDATA1_NAME "First Vdata" -#define VDATA2_NAME "Second Vdata" -#define FIELD1_NAME "Single-component Field" -#define FIELD2_NAME "Multi-component Field" -#define N_RECORDS_1 5 /* number of records the first vdata contains */ -#define N_RECORDS_2 6 /* number of records the second vdata contains */ -#define ORDER_2 4 /* order of the field in the second vdata */ - /* Note that the order of the field in the first vdata is 1 */ - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 file_id; - - /* - * Define an array to buffer the data of the first vdata. - */ - char8 vdata1_buf[N_RECORDS_1] = {'V', 'D', 'A', 'T', 'A'}; - - /* - * Define an array to buffer the data of the second vdata. - */ - int32 vdata2_buf[N_RECORDS_2][ORDER_2] = {{1, 2, 3, 4}, {2, 4, 6, 8}, {3, 6, 9, 12}, - {4, 8, 12, 16}, {5, 10, 15, 20}, {6, 12, 18, 24}}; - - /********************** End of variable declaration **********************/ - - /* - * Open the HDF file for writing. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_WRITE, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the VS interface. - */ - if (Vstart(file_id) == FAIL) - printf("*** ERROR from Vstart\n"); - - /* - * Create the first vdata and populate it with data from the vdata1_buf - * array. Note that the buffer vdata1_buf is cast to (uint8 *) for the - * benefit of generic data type. - */ - VHstoredata(file_id, FIELD1_NAME, (uint8 *)vdata1_buf, N_RECORDS_1, DFNT_CHAR8, VDATA1_NAME, CLASS1_NAME); - - /* - * Create the second vdata and populate it with data from the vdata2_buf - * array. - */ - VHstoredatam(file_id, FIELD2_NAME, (uint8 *)vdata2_buf, N_RECORDS_2, DFNT_INT32, VDATA2_NAME, CLASS2_NAME, - ORDER_2); - - /* - * Terminate access to the VS interface and close the HDF file. - */ - if (Vend(file_id) == FAIL) - printf("*** ERROR from Vend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/VD_create_vdatas.c b/hdf/examples/VD_create_vdatas.c deleted file mode 100644 index 2a94bb8932..0000000000 --- a/hdf/examples/VD_create_vdatas.c +++ /dev/null @@ -1,121 +0,0 @@ -#include "hdf.h" - -#define FILE1_NAME "General_Vdatas.hdf" -#define FILE2_NAME "Two_Vdatas.hdf" -#define VDATA_NAME "Vdata 1" -#define VDATA_CLASS "Empty Vdatas" - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 file1_id, file2_id, vdata_id, vdata1_id, vdata2_id, - vdata_ref = -1; /* ref number of a vdata, set to -1 to create */ - - /********************** End of variable declaration **********************/ - - /* - * Create the first HDF file. - */ - if ((file1_id = Hopen(FILE1_NAME, DFACC_CREATE, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the VS interface associated with the first HDF file. - */ - if (Vstart(file1_id) == FAIL) - printf("*** ERROR from Vstart\n"); - - /* - * Create a vdata in the first HDF file. - */ - vdata_id = VSattach(file1_id, vdata_ref, "w"); - - /* - * Assign a name to the vdata. - */ - if (VSsetname(vdata_id, VDATA_NAME) == FAIL) - printf("*** ERROR from VSsetname\n"); - - /* - * Other operations on the vdata identified by vdata_id can be carried - * out starting from this point. - */ - - /* - * Create the second HDF file. - */ - if ((file2_id = Hopen(FILE2_NAME, DFACC_CREATE, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the VS interface associated with the second HDF file. - */ - if (Vstart(file2_id) == FAIL) - printf("*** ERROR from Vstart\n"); - - /* - * Create the first vdata in the second HDF file. - */ - vdata1_id = VSattach(file2_id, vdata_ref, "w"); - - /* - * Create the second vdata in the second HDF file. - */ - vdata2_id = VSattach(file2_id, vdata_ref, "w"); - - /* - * Assign a class name to these vdatas. - */ - if (VSsetclass(vdata1_id, VDATA_CLASS) == FAIL) - printf("*** ERROR from VSsetclass\n"); - if (VSsetclass(vdata2_id, VDATA_CLASS) == FAIL) - printf("*** ERROR from VSsetclass\n"); - - /* - * Other operations on the vdatas identified by vdata1_id and vdata2_id - * can be carried out starting from this point. - */ - - /* - * Terminate access to the first vdata in the second HDF file. - */ - if (VSdetach(vdata1_id) == FAIL) - printf("*** ERROR from VSdetach\n"); - - /* - * Terminate access to the second vdata in the second HDF file. - */ - if (VSdetach(vdata2_id) == FAIL) - printf("*** ERROR from VSdetach\n"); - - /* - * From this point on, any operations on the vdatas identified by vdata1_id - and vdata2_id are invalid but not on the vdata identified by vdata_id. - */ - - /* - * Terminate access to the VS interface associated with the second HDF file. - */ - if (Vend(file2_id) == FAIL) - printf("*** ERROR from Vend\n"); - if (Hclose(file2_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - /* - * Terminate access to the vdata in the first HDF file. - */ - if (VSdetach(vdata_id) == FAIL) - printf("*** ERROR from VSdetach\n"); - - /* - * Terminate access to the VS interface associated with the first HDF file. - */ - if (Vend(file1_id) == FAIL) - printf("*** ERROR from Vend\n"); - if (Hclose(file1_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/VD_get_vdata_info.c b/hdf/examples/VD_get_vdata_info.c deleted file mode 100644 index 9ee6678df2..0000000000 --- a/hdf/examples/VD_get_vdata_info.c +++ /dev/null @@ -1,78 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "General_Vdatas.hdf" -#define FIELD_SIZE 80 /* maximum length of all the field names */ - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 n_records, /* to retrieve the number of records in the vdata */ - interlace_mode, /* to retrieve the interlace mode of the vdata */ - vdata_size, /* to retrieve the size of all specified fields */ - file_id, vdata_ref, vdata_id; - char fieldname_list[FIELD_SIZE], /* buffer to retrieve the vdata data */ - vdata_name[VSNAMELENMAX]; /* buffer to retrieve the vdata name */ - - /********************** End of variable declaration **********************/ - - /* - * Open the HDF file for reading. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the VS interface. - */ - if (Vstart(file_id) == FAIL) - printf("*** ERROR from Vstart\n"); - - /* - * Set vdata_ref to -1 to start the search from the beginning of file. - */ - vdata_ref = -1; - - /* - * Use VSgetid to obtain each vdata by its reference number then attach - * to the vdata and get its information. The loop terminates when - * the last vdata is reached. - */ - while ((vdata_ref = VSgetid(file_id, vdata_ref)) != FAIL) { - /* - * Attach to the current vdata for reading. - */ - vdata_id = VSattach(file_id, vdata_ref, "r"); - - /* - * Test whether the current vdata is not a storage of an attribute, then - * obtain and display its information. - */ - if (VSisattr(vdata_id) != TRUE) { - if (VSinquire(vdata_id, &n_records, &interlace_mode, fieldname_list, &vdata_size, vdata_name) == - FAIL) - printf("*** ERROR from VSinquire\n"); - printf("Vdata %s: - contains %d records\n\tInterlace mode: %s \ - \n\tFields: %s - %d bytes\n\t\n", - vdata_name, n_records, interlace_mode == FULL_INTERLACE ? "FULL" : "NONE", fieldname_list, - vdata_size); - } - - /* - * Detach from the current vdata. - */ - if (VSdetach(vdata_id) == FAIL) - printf("*** ERROR from VSdetach\n"); - } /* while */ - - /* - * Terminate access to the VS interface and close the HDF file. - */ - if (Vend(file_id) == FAIL) - printf("*** ERROR from Vend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/VD_locate_vdata.c b/hdf/examples/VD_locate_vdata.c deleted file mode 100644 index 8a548a300b..0000000000 --- a/hdf/examples/VD_locate_vdata.c +++ /dev/null @@ -1,83 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "General_Vdatas.hdf" -#define SEARCHED_FIELDS "Position,Temperature" - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 file_id, vdata_id, vdata_ref; - int32 index = 0; /* index of the vdata in the file - manually kept */ - int8 found_fields; /* TRUE if the specified fields exist in the vdata */ - - /********************** End of variable declaration **********************/ - - /* - * Open the HDF file for reading. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the VS interface. - */ - if (Vstart(file_id) == FAIL) - printf("*** ERROR from Vstart\n"); - - /* - * Set the reference number to -1 to start the search from - * the beginning of file. - */ - vdata_ref = -1; - - /* - * Assume that the specified fields are not found in the current vdata. - */ - found_fields = FALSE; - - /* - * Use VSgetid to obtain each vdata by its reference number then - * attach to the vdata and search for the fields. The loop - * terminates when the last vdata is reached or when a vdata which - * contains the fields listed in SEARCHED_FIELDS is found. - */ - while ((vdata_ref = VSgetid(file_id, vdata_ref)) != FAIL) { - vdata_id = VSattach(file_id, vdata_ref, "r"); - if (VSfexist(vdata_id, SEARCHED_FIELDS) != FAIL) { - found_fields = TRUE; - break; - } - - /* - * Detach from the current vdata before continuing searching. - */ - if (VSdetach(vdata_id) == FAIL) - printf("*** ERROR from VSdetach\n"); - - index++; /* advance the index by 1 for the next vdata */ - } - - /* - * Print the index of the vdata containing the fields or a "not found" - * message if no such vdata is found. Also detach from the vdata found. - */ - if (!found_fields) - printf("Fields Position and Temperature were not found.\n"); - else { - printf("Fields Position and Temperature found in the vdata at position %d\n", index); - if (VSdetach(vdata_id) == FAIL) - printf("*** ERROR from VSdetach\n"); - } - - /* - * Terminate access to the VS interface and close the HDF file. - */ - if (Vend(file_id) == FAIL) - printf("*** ERROR from Vend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/VD_read_from_vdata.c b/hdf/examples/VD_read_from_vdata.c deleted file mode 100644 index 256a3b2d77..0000000000 --- a/hdf/examples/VD_read_from_vdata.c +++ /dev/null @@ -1,91 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "General_Vdatas.hdf" -#define VDATA_NAME "Solid Particle" -#define N_RECORDS 5 /* number of records the vdata contains */ -#define RECORD_INDEX 3 /* position where reading starts - 4th record */ -#define ORDER_1 3 /* order of first field to be read */ -#define ORDER_2 2 /* order of second field to be read */ -#define FIELDNAME_LIST "Position,Temperature" /* only two fields are read */ -#define N_VALS_PER_REC (ORDER_1 + ORDER_2) -/* number of values per record */ - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 file_id, vdata_id; - int32 vdata_ref; /* vdata's reference number */ - int32 num_of_records; /* number of records actually written to the vdata */ - int16 rec_num; /* current record number in the vdata */ - float32 databuf[N_RECORDS][N_VALS_PER_REC]; /* buffer for vdata values */ - - /********************** End of variable declaration **********************/ - - /* - * Open the HDF file for reading. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the VS interface. - */ - if (Vstart(file_id) == FAIL) - printf("*** ERROR from Vstart\n"); - - /* - * Get the reference number of the vdata, whose name is specified in - * VDATA_NAME, using VSfind, which will be discussed in Section 4.7.3. - */ - vdata_ref = VSfind(file_id, VDATA_NAME); - - /* - * Attach to the vdata for reading if it is found, otherwise - * exit the program. - */ - if (vdata_ref == 0) - return 0; - vdata_id = VSattach(file_id, vdata_ref, "r"); - - /* - * Specify the fields that will be read. - */ - if (VSsetfields(vdata_id, FIELDNAME_LIST) == FAIL) - printf("*** ERROR from VSsetfields\n"); - - /* - * Place the current point to the position specified in RECORD_INDEX. - */ - VSseek(vdata_id, RECORD_INDEX); - - /* - * Read the next N_RECORDS records from the vdata and store the data - * in the buffer databuf with fully interlaced mode. - */ - num_of_records = VSread(vdata_id, (uint8 *)databuf, N_RECORDS, FULL_INTERLACE); - - /* - * Display the read data as many records as the number of records - * returned by VSread. - */ - printf("\n Particle Position Temperature Range\n\n"); - for (rec_num = 0; rec_num < num_of_records; rec_num++) { - printf(" %6.2f, %6.2f, %6.2f %6.2f, %6.2f\n", databuf[rec_num][0], databuf[rec_num][1], - databuf[rec_num][2], databuf[rec_num][3], databuf[rec_num][4]); - } - - /* - * Terminate access to the vdata and to the VS interface, then close - * the HDF file. - */ - if (VSdetach(vdata_id) == FAIL) - printf("*** ERROR from VSdetach\n"); - if (Vend(file_id) == FAIL) - printf("*** ERROR from Vend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/VD_read_mixed_vdata.c b/hdf/examples/VD_read_mixed_vdata.c deleted file mode 100644 index 527147a9f2..0000000000 --- a/hdf/examples/VD_read_mixed_vdata.c +++ /dev/null @@ -1,99 +0,0 @@ -#include "hdf.h" - -#define N_RECORDS 20 /* number of records to be read */ -#define N_FIELDS 2 /* number of fields to be read */ -#define FILE_NAME "Packed_Vdata.hdf" -#define VDATA_NAME "Mixed Data Vdata" -#define FIELDNAME_LIST "Temp,Ident" - -/* number of bytes of the data to be read */ -#define BUFFER_SIZE (sizeof(float32) + sizeof(char)) * N_RECORDS - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 file_id, vdata_id; - int32 num_of_records; /* number of records actually read */ - int32 vdata_ref; /* reference number of the vdata to be read */ - float32 itemp[N_RECORDS]; /* buffer to hold values of first field */ - char idents[N_RECORDS]; /* buffer to hold values of fourth field */ - uint8 databuf[BUFFER_SIZE]; /* buffer to hold read data, still packed */ - void *fldbufptrs[N_FIELDS]; /*pointers to be pointing to the field buffers*/ - int i; - - /********************** End of variable declaration **********************/ - - /* - * Open the HDF file for reading. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the VS interface. - */ - if (Vstart(file_id) == FAIL) - printf("*** ERROR from Vstart\n"); - - /* - * Get the reference number of the vdata, whose name is specified in - * VDATA_NAME, using VSfind, which will be discussed in Section 4.7.3. - */ - vdata_ref = VSfind(file_id, VDATA_NAME); - - /* - * Attach to the vdata for reading. - */ - vdata_id = VSattach(file_id, vdata_ref, "r"); - - /* - * Specify the fields that will be read. - */ - if (VSsetfields(vdata_id, FIELDNAME_LIST) == FAIL) - printf("*** ERROR from VSsetfields\n"); - - /* - * Read N_RECORDS records of the vdata and store the values into the - * buffer databuf. - */ - num_of_records = VSread(vdata_id, (uint8 *)databuf, N_RECORDS, FULL_INTERLACE); - - /* - * Build an array of pointers each of which points to an array that - * will hold all values of a field after being unpacked. - */ - fldbufptrs[0] = &itemp[0]; - fldbufptrs[1] = &idents[0]; - - /* - * Unpack the data from the buffer databuf and store the values into the - * appropriate field buffers pointed to by the set of pointers fldbufptrs. - * Note that the second parameter is _HDF_VSUNPACK for unpacking and the - * number of records is the one returned by VSread. - */ - if (VSfpack(vdata_id, _HDF_VSUNPACK, FIELDNAME_LIST, (void *)databuf, BUFFER_SIZE, num_of_records, NULL, - (void *)fldbufptrs) == FAIL) - printf("*** ERROR from VSfpack\n"); - - /* - * Display the read data being stored in the field buffers. - */ - printf("\n Temp Ident\n"); - for (i = 0; i < num_of_records; i++) - printf(" %6.2f %c\n", itemp[i], idents[i]); - - /* - * Terminate access to the vdata and the VS interface, then close - * the HDF file. - */ - if (VSdetach(vdata_id) == FAIL) - printf("*** ERROR from VSdetach\n"); - if (Vend(file_id) == FAIL) - printf("*** ERROR from Vend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/VD_set_get_vdata_attr.c b/hdf/examples/VD_set_get_vdata_attr.c deleted file mode 100644 index 354c41db1a..0000000000 --- a/hdf/examples/VD_set_get_vdata_attr.c +++ /dev/null @@ -1,136 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "General_Vdatas.hdf" -#define VDATA_NAME "Solid Particle" -#define FIELD_NAME "Mass" -#define VATTR_NAME "Site Ident" /* name of the vdata attribute */ -#define FATTR_NAME "Scales" /* name of the field attribute */ -#define VATTR_N_VALUES 3 /* number of values in the vdata attribute */ -#define FATTR_N_VALUES 4 /* number of values in the field attribute */ - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 file_id, vdata_ref, vdata_id; - int32 field_index, /* index of a field within the vdata */ - n_vdattrs, /* number of vdata attributes */ - n_fldattrs, /* number of field attributes */ - vdata_type, /* to hold the type of vdata's attribute */ - vdata_n_values, /* to hold the number of vdata's attribute values */ - vdata_size, /* to hold the size of vdata's attribute values */ - field_type, /* to hold the type of field's attribute */ - field_n_values, /* to hold the number of field's attribute values */ - field_size; /* to hold the size of field's attribute values */ - char vd_attr[VATTR_N_VALUES] = {'A', 'B', 'C'}; /* vdata attribute values*/ - int32 fld_attr[FATTR_N_VALUES] = {2, 4, 6, 8}; /* field attribute values*/ - char vattr_buf[VATTR_N_VALUES]; /* to hold vdata attribute's values */ - int32 fattr_buf[FATTR_N_VALUES]; /* to hold field attribute's values */ - char vattr_name[30], /* name of vdata attribute */ - fattr_name[30]; /* name of field attribute */ - - /********************** End of variable declaration **********************/ - - /* - * Open the HDF file for writing. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_WRITE, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the VS interface. - */ - if (Vstart(file_id) == FAIL) - printf("*** ERROR from Vstart\n"); - - /* - * Get the reference number of the vdata named VDATA_NAME. - */ - vdata_ref = VSfind(file_id, VDATA_NAME); - - /* - * Attach to the vdata for writing. - */ - vdata_id = VSattach(file_id, vdata_ref, "w"); - - /* - * Attach an attribute to the vdata, i.e., indicated by the second parameter. - */ - if (VSsetattr(vdata_id, _HDF_VDATA, VATTR_NAME, DFNT_CHAR, VATTR_N_VALUES, vd_attr) == FAIL) - printf("*** ERROR from VSsetattr\n"); - - /* - * Get the index of the field FIELD_NAME within the vdata. - */ - if (VSfindex(vdata_id, FIELD_NAME, &field_index) == FAIL) - printf("*** ERROR from VSfindex\n"); - - /* - * Attach an attribute to the field field_index. - */ - if (VSsetattr(vdata_id, field_index, FATTR_NAME, DFNT_INT32, FATTR_N_VALUES, fld_attr) == FAIL) - printf("*** ERROR from VSsetattr\n"); - - /* - * Get the number of attributes attached to the vdata's first - * field - should be 0. - */ - n_fldattrs = VSfnattrs(vdata_id, 0); - printf("Number of attributes of the first field of the vdata: %d\n", n_fldattrs); - - /* - * Get the number of attributes attached to the field specified by - * field_index - should be 1. - */ - n_fldattrs = VSfnattrs(vdata_id, field_index); - printf("Number of attributes of field %s: %d\n", FIELD_NAME, n_fldattrs); - - /* - * Get the total number of the field's and vdata's attributes - should be 2. - */ - n_vdattrs = VSnattrs(vdata_id); - printf("Number of attributes of the vdata and its fields: %d\n", n_vdattrs); - - /* - * Get information about the vdata's first attribute, indicated - * by the third parameter which is the index of the attribute. - */ - if (VSattrinfo(vdata_id, _HDF_VDATA, 0, vattr_name, &vdata_type, &vdata_n_values, &vdata_size) == FAIL) - printf("*** ERROR from VSattrinfo\n"); - - /* - * Get information about the first attribute of the field specified by - * field_index. - */ - if (VSattrinfo(vdata_id, field_index, 0, fattr_name, &field_type, &field_n_values, &field_size) == FAIL) - printf("*** ERROR from VSattrinfo\n"); - - /* - * Get the vdata's first attribute. - */ - if (VSgetattr(vdata_id, _HDF_VDATA, 0, vattr_buf) == FAIL) - printf("*** ERROR from VSgetattr\n"); - printf("Values of the vdata attribute = %c %c %c\n", vattr_buf[0], vattr_buf[1], vattr_buf[2]); - - /* - * Get the first attribute of the field specified by field_index. - */ - if (VSgetattr(vdata_id, field_index, 0, fattr_buf) == FAIL) - printf("*** ERROR from VSgetattr\n"); - printf("Values of the field attribute = %d %d %d %d\n", fattr_buf[0], fattr_buf[1], fattr_buf[2], - fattr_buf[3]); - - /* - * Terminate access to the vdata and to the VS interface, then close - * the HDF file. - */ - if (VSdetach(vdata_id) == FAIL) - printf("*** ERROR from VSdetach\n"); - if (Vend(file_id) == FAIL) - printf("*** ERROR from Vend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/VD_write_mixed_vdata.c b/hdf/examples/VD_write_mixed_vdata.c deleted file mode 100644 index a45902fb24..0000000000 --- a/hdf/examples/VD_write_mixed_vdata.c +++ /dev/null @@ -1,125 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "Packed_Vdata.hdf" -#define VDATA_NAME "Mixed Data Vdata" -#define CLASS_NAME "General Data Class" -#define FIELD1_NAME "Temp" -#define FIELD2_NAME "Height" -#define FIELD3_NAME "Speed" -#define FIELD4_NAME "Ident" -#define ORDER 1 /* number of values in the field */ -#define N_RECORDS 20 /* number of records the vdata contains */ -#define N_FIELDS 4 /* number of fields in the vdata */ -#define FIELDNAME_LIST "Temp,Height,Speed,Ident" /* No spaces b/w names */ - -/* number of bytes of the data to be written, i.e., the size of all the - field values combined times the number of records */ -#define BUF_SIZE (2 * sizeof(float32) + sizeof(int16) + sizeof(char)) * N_RECORDS - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 file_id, vdata_id; - int32 vdata_ref = -1; /* vdata's reference number, set to -1 to create */ - float32 temp[N_RECORDS]; /* buffer to hold values of first field */ - int16 height[N_RECORDS]; /* buffer to hold values of second field */ - float32 speed[N_RECORDS]; /* buffer to hold values of third field */ - char8 ident[N_RECORDS]; /* buffer to hold values of fourth field */ - void *fldbufptrs[N_FIELDS]; /*pointers to be pointing to the field buffers*/ - uint16 databuf[BUF_SIZE]; /* buffer to hold the data after being packed*/ - int i; - - /********************** End of variable declaration **********************/ - - /* - * Create an HDF file. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_CREATE, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the VS interface. - */ - if (Vstart(file_id) == FAIL) - printf("*** ERROR from Vstart\n"); - - /* - * Create a new vdata. - */ - vdata_id = VSattach(file_id, vdata_ref, "w"); - - /* - * Set name and class name of the vdata. - */ - if (VSsetname(vdata_id, VDATA_NAME) == FAIL) - printf("*** ERROR from VSsetname\n"); - if (VSsetclass(vdata_id, CLASS_NAME) == FAIL) - printf("*** ERROR from VSsetclass\n"); - - /* - * Introduce each field's name, data type, and order. This is the first - * part in defining a vdata field. - */ - if (VSfdefine(vdata_id, FIELD1_NAME, DFNT_FLOAT32, ORDER) == FAIL) - printf("*** ERROR from VSfdefine\n"); - if (VSfdefine(vdata_id, FIELD2_NAME, DFNT_INT16, ORDER) == FAIL) - printf("*** ERROR from VSfdefine\n"); - if (VSfdefine(vdata_id, FIELD3_NAME, DFNT_FLOAT32, ORDER) == FAIL) - printf("*** ERROR from VSfdefine\n"); - if (VSfdefine(vdata_id, FIELD4_NAME, DFNT_CHAR8, ORDER) == FAIL) - printf("*** ERROR from VSfdefine\n"); - - /* - * Finalize the definition of the fields of the vdata. - */ - if (VSsetfields(vdata_id, FIELDNAME_LIST) == FAIL) - printf("*** ERROR from VSsetfields\n"); - - /* - * Enter data values into the field buffers by the records. - */ - for (i = 0; i < N_RECORDS; i++) { - temp[i] = 1.11 * (i + 1); - height[i] = i; - speed[i] = 1.11 * (i + 1); - ident[i] = 'A' + i; - } - - /* - * Build an array of pointers each of which points to a field buffer that - * holds all values of the field. - */ - fldbufptrs[0] = &temp[0]; - fldbufptrs[1] = &height[0]; - fldbufptrs[2] = &speed[0]; - fldbufptrs[3] = &ident[0]; - - /* - * Pack all data in the field buffers that are pointed to by the set of - * pointers fldbufptrs, and store the packed data into the buffer - * databuf. Note that the second parameter is _HDF_VSPACK for packing. - */ - if (VSfpack(vdata_id, _HDF_VSPACK, NULL, (void *)databuf, BUF_SIZE, N_RECORDS, NULL, - (void *)fldbufptrs) == FAIL) - printf("*** ERROR from VSfpack\n"); - - /* - * Write all records of the packed data to the vdata. - */ - VSwrite(vdata_id, (uint8 *)databuf, N_RECORDS, FULL_INTERLACE); - - /* - * Terminate access to the vdata and the VS interface, then close - * the HDF file. - */ - if (VSdetach(vdata_id) == FAIL) - printf("*** ERROR from VSdetach\n"); - if (Vend(file_id) == FAIL) - printf("*** ERROR from Vend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/VD_write_mixed_vdata_struct.c b/hdf/examples/VD_write_mixed_vdata_struct.c deleted file mode 100644 index 576918af6f..0000000000 --- a/hdf/examples/VD_write_mixed_vdata_struct.c +++ /dev/null @@ -1,164 +0,0 @@ -/* Example 4_struct. Writing a multi-field and mixed-type vdata -with packing - using struct instead of array to buffer field values. - -This example illustrates the use of VSfpack and VSwrite to write a -vdata with data of different types. The problem in this example is -identical to that in Example 4 of Chapter Vdata in the User's Guide. -However, the two programs differ in the implementation of the -data structures that hold the user's data. - -In this example, the program creates an HDF file named -"Packed_Vdata.hdf" then defines a vdata, which is named "Mixed -Data Vdata" and belongs to class "General Data Class". The vdata -contains four order-1 fields, "Temp", "Height", "Speed", and "Ident" of -type float32, int16, float32, and char, respectively. The program then -packs the data in fully interlaced mode into a buffer and writes the -packed data to the vdata. Note that, in this example, each VSfpack -call packs 1 record while in Example 4, a VSfpack call packs all -N_RECORDS. This difference is the result of using an array of -structs in this example to hold the field values instead of -individual arrays as in Example 4. */ - -#include "hdf.h" - -#define FILE_NAME "Packed_Vdata.hdf" -#define VDATA_NAME "Mixed Data Vdata" -#define CLASS_NAME "General Data Class" -#define N_RECORDS 20 /* number of records the vdata contains */ -#define N_FIELDS 4 /* number of fields in the vdata */ -#define FIELD1_NAME "Temp" -#define FIELD2_NAME "Height" -#define FIELD3_NAME "Speed" -#define FIELD4_NAME "Ident" -#define FIELDNAME_LIST "Temp,Height,Speed,Ident" /* No spaces b/w names */ - -/* RECORD_SIZE is the number of bytes of all the field values combined and - BUFFER_SIZE is the number of bytes of data to be written */ -#define RECORD_SIZE (2 * sizeof(float32) + sizeof(int16) + sizeof(char)) -#define BUFFER_SIZE (RECORD_SIZE * N_RECORDS) - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 file_id, vdata_id; - uint8 databuf[BUFFER_SIZE]; /* buffer to hold the data after being packed */ - uint8 *pntr; /* pointer pointing to the current record in the data buffer*/ - int16 rec_num; /* current record number */ - - struct { - float32 temp; /* to hold value of the first field of the vdata */ - int16 height; /* to hold value of the second field of the vdata */ - float32 speed; /* to hold value of the third field of the vdata */ - char ident; /* to hold value of the fourth field of the vdata */ - } source[N_RECORDS]; - - /* pointers to be pointing to the fields in the struct buffer */ - void *fldbufptrs[N_FIELDS]; - - /********************** End of variable declaration **********************/ - - /* - * Create the HDF file. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_CREATE, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the VS interface. - */ - if (Vstart(file_id) == FAIL) - printf("*** ERROR from Vstart\n"); - - /* - * Create a new vdata. - */ - vdata_id = VSattach(file_id, -1, "w"); - - /* - * Set name and class name of the vdata. - */ - if (VSsetname(vdata_id, VDATA_NAME) == FAIL) - printf("*** ERROR from VSsetname\n"); - if (VSsetclass(vdata_id, CLASS_NAME) == FAIL) - printf("*** ERROR from VSsetclass\n"); - - /* - * Introduce each field's name, data type, and order. This is the first - * part in defining a vdata field. - */ - if (VSfdefine(vdata_id, FIELD1_NAME, DFNT_FLOAT32, 1) == FAIL) - printf("*** ERROR from VSfdefine\n"); - if (VSfdefine(vdata_id, FIELD2_NAME, DFNT_INT16, 1) == FAIL) - printf("*** ERROR from VSfdefine\n"); - if (VSfdefine(vdata_id, FIELD3_NAME, DFNT_FLOAT32, 1) == FAIL) - printf("*** ERROR from VSfdefine\n"); - if (VSfdefine(vdata_id, FIELD4_NAME, DFNT_CHAR8, 1) == FAIL) - printf("*** ERROR from VSfdefine\n"); - - /* - * Finalize the definition of the fields to be written to. - */ - if (VSsetfields(vdata_id, FIELDNAME_LIST) == FAIL) - printf("*** ERROR from VSsetfields\n"); - - /* - * Initialize pointer for traversing the buffer to pack each record. - */ - pntr = &databuf[0]; - - /* - * Enter data values into each record. - */ - for (rec_num = 0; rec_num < N_RECORDS; rec_num++) { - source[rec_num].temp = 1.11 * (rec_num + 1); - source[rec_num].height = rec_num; - source[rec_num].speed = 1.11 * (rec_num + 1); - source[rec_num].ident = 'A' + rec_num; - } - - /* - * Pack one record at a time. - */ - for (rec_num = 0; rec_num < N_RECORDS; rec_num++) { - /* - * Build an array of pointers each of which points to a space that - * holds the value of the corresponding field in this record. - */ - fldbufptrs[0] = &source[rec_num].temp; - fldbufptrs[1] = &source[rec_num].height; - fldbufptrs[2] = &source[rec_num].speed; - fldbufptrs[3] = &source[rec_num].ident; - - /* - * Pack the data in the field buffers into the data buffer at the - * current record, i.e. indicated by "pntr". - */ - if (VSfpack(vdata_id, _HDF_VSPACK, NULL, (void *)pntr, RECORD_SIZE, 1, NULL, fldbufptrs) == FAIL) - printf("*** ERROR from VSfpack\n"); - - /* - * Advance the current position in the buffer. - */ - pntr = pntr + RECORD_SIZE; - } - - /* - * Write all records of the packed data to the vdata. - */ - VSwrite(vdata_id, (uint8 *)databuf, N_RECORDS, FULL_INTERLACE); - - /* - * Terminate access to the Vdata and the VS interface, - * then close the HDF file. - */ - if (VSdetach(vdata_id) == FAIL) - printf("*** ERROR from VSdetach\n"); - if (Vend(file_id) == FAIL) - printf("*** ERROR from Vend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/VD_write_to_vdata.c b/hdf/examples/VD_write_to_vdata.c deleted file mode 100644 index f9a2f95c5a..0000000000 --- a/hdf/examples/VD_write_to_vdata.c +++ /dev/null @@ -1,104 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "General_Vdatas.hdf" -#define N_RECORDS 10 /* number of records the vdata contains */ -#define ORDER_1 3 /* order of first field */ -#define ORDER_2 1 /* order of second field */ -#define ORDER_3 2 /* order of third field */ -#define CLASS_NAME "Particle Data" -#define VDATA_NAME "Solid Particle" -#define FIELD1_NAME "Position" /* contains x, y, z values */ -#define FIELD2_NAME "Mass" /* contains weight values */ -#define FIELD3_NAME "Temperature" /* contains min and max values */ -#define FIELDNAME_LIST "Position,Mass,Temperature" /* No spaces b/w names */ - -/* number of values per record */ -#define N_VALS_PER_REC (ORDER_1 + ORDER_2 + ORDER_3) - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 file_id, vdata_id; - int32 vdata_ref = -1; /* ref number of a vdata, set to -1 to create */ - int16 rec_num; /* current record number */ - float32 data_buf[N_RECORDS][N_VALS_PER_REC]; /* buffer for vdata values */ - - /********************** End of variable declaration **********************/ - - /* - * Open the HDF file for writing. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_WRITE, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the VS interface. - */ - if (Vstart(file_id) == FAIL) - printf("*** ERROR from Vstart\n"); - - /* - * Create a new vdata. - */ - vdata_id = VSattach(file_id, vdata_ref, "w"); - - /* - * Set name and class name of the vdata. - */ - if (VSsetname(vdata_id, VDATA_NAME) == FAIL) - printf("*** ERROR from VSsetname\n"); - if (VSsetclass(vdata_id, CLASS_NAME) == FAIL) - printf("*** ERROR from VSsetclass\n"); - - /* - * Introduce each field's name, data type, and order. This is the first - * part in defining a field. - */ - if (VSfdefine(vdata_id, FIELD1_NAME, DFNT_FLOAT32, ORDER_1) == FAIL) - printf("*** ERROR from VSfdefine\n"); - if (VSfdefine(vdata_id, FIELD2_NAME, DFNT_FLOAT32, ORDER_2) == FAIL) - printf("*** ERROR from VSfdefine\n"); - if (VSfdefine(vdata_id, FIELD3_NAME, DFNT_FLOAT32, ORDER_3) == FAIL) - printf("*** ERROR from VSfdefine\n"); - - /* - * Finalize the definition of the fields. - */ - if (VSsetfields(vdata_id, FIELDNAME_LIST) == FAIL) - printf("*** ERROR from VSsetfields\n"); - - /* - * Buffer the data by the record for fully interlaced mode. Note that the - * first three elements contain the three values of the first field, the - * fourth element contains the value of the second field, and the last two - * elements contain the two values of the third field. - */ - for (rec_num = 0; rec_num < N_RECORDS; rec_num++) { - data_buf[rec_num][0] = 1.0 * rec_num; - data_buf[rec_num][1] = 2.0 * rec_num; - data_buf[rec_num][2] = 3.0 * rec_num; - data_buf[rec_num][3] = 0.1 + rec_num; - data_buf[rec_num][4] = 0.0; - data_buf[rec_num][5] = 65.0; - } - - /* - * Write the data from data_buf to the vdata with full interlacing mode. - */ - VSwrite(vdata_id, (uint8 *)data_buf, N_RECORDS, FULL_INTERLACE); - - /* - * Terminate access to the vdata and to the VS interface, then close - * the HDF file. - */ - if (VSdetach(vdata_id) == FAIL) - printf("*** ERROR from VSdetach\n"); - if (Vend(file_id) == FAIL) - printf("*** ERROR from Vend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/VG_add_sds_to_vgroup.c b/hdf/examples/VG_add_sds_to_vgroup.c deleted file mode 100644 index f2690a6dba..0000000000 --- a/hdf/examples/VG_add_sds_to_vgroup.c +++ /dev/null @@ -1,92 +0,0 @@ -#include "hdf.h" /* Note: in this example, hdf.h can be omitted...*/ -#include "mfhdf.h" /* ...since mfhdf.h already includes hdf.h */ - -#define FILE_NAME "General_Vgroups.hdf" -#define SDS_NAME "Test SD" -#define VG_NAME "SD Vgroup" -#define VG_CLASS "Common Vgroups" - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 sd_id, /* SD interface identifier */ - sds_id, /* data set identifier */ - sds_ref, /* reference number of the data set */ - dim_sizes[1], /* dimension of the data set - only one */ - rank = 1, /* rank of the data set array */ - vgroup_id, /* vgroup identifier */ - file_id; /* HDF file identifier, same for V interface */ - - /********************** End of variable declaration **********************/ - - /* - * Create the HDF file. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_CREATE, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the V interface. - */ - if (Vstart(file_id) == FAIL) - printf("*** ERROR from Vstart\n"); - - /* - * Initialize the SD interface. - */ - sd_id = SDstart(FILE_NAME, DFACC_WRITE); - - /* - * Set the size of the SDS's dimension. - */ - dim_sizes[0] = 10; - - /* - * Create the SDS. - */ - sds_id = SDcreate(sd_id, SDS_NAME, DFNT_INT32, rank, dim_sizes); - - /* - * Create a vgroup and set its name and class. - */ - vgroup_id = Vattach(file_id, -1, "w"); - if (Vsetname(vgroup_id, VG_NAME) == FAIL) - printf("*** ERROR from Vsetname\n"); - if (Vsetclass(vgroup_id, VG_CLASS) == FAIL) - printf("*** ERROR from Vsetclass\n"); - - /* - * Obtain the reference number of the SDS using its identifier. - */ - sds_ref = SDidtoref(sds_id); - - /* - * Add the SDS to the vgroup. Note: the tag DFTAG_NDG is used - * when adding an SDS. Refer to Appendix A for the entire list of tags. - */ - if (Vaddtagref(vgroup_id, DFTAG_NDG, sds_ref) == FAIL) - printf("*** ERROR from Vaddtagref\n"); - - /* - * Terminate access to the SDS and to the SD interface. - */ - if (SDendaccess(sds_id) == FAIL) - printf("*** ERROR from SDendaccess\n"); - if (SDend(sd_id) == FAIL) - printf("*** ERROR from SDend\n"); - - /* - * Terminate access to the vgroup and to the V interface, and - * close the HDF file. - */ - if (Vdetach(vgroup_id) == FAIL) - printf("*** ERROR from Vdetach\n"); - if (Vend(file_id) == FAIL) - printf("*** ERROR from Vend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/VG_create_vgroup.c b/hdf/examples/VG_create_vgroup.c deleted file mode 100644 index 6ca402d59f..0000000000 --- a/hdf/examples/VG_create_vgroup.c +++ /dev/null @@ -1,63 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "Two_Vgroups.hdf" - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 vgroup_ref = -1; - int32 vgroup1_id, vgroup2_id, file_id; - - /********************** End of variable declaration **********************/ - - /* - * Create the HDF file. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_CREATE, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the V interface. - */ - if (Vstart(file_id) == FAIL) - printf("*** ERROR from Vstart\n"); - - /* - * Create the first vgroup. Note that the vgroup reference number is set - * to -1 for creating and the access mode is "w" for writing. - */ - vgroup1_id = Vattach(file_id, vgroup_ref, "w"); - - /* - * Create the second vgroup. - */ - vgroup2_id = Vattach(file_id, vgroup_ref, "w"); - - /* - * Any operations on the vgroups. - */ - - /* - * Terminate access to the first vgroup. - */ - if (Vdetach(vgroup1_id) == FAIL) - printf("*** ERROR from Vdetach\n"); - - /* - * Terminate access to the second vgroup. - */ - if (Vdetach(vgroup2_id) == FAIL) - printf("*** ERROR from Vdetach\n"); - - /* - * Terminate access to the V interface and close the HDF file. - */ - if (Vend(file_id) == FAIL) - printf("*** ERROR from Vend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/VG_get_vgroup_info.c b/hdf/examples/VG_get_vgroup_info.c deleted file mode 100644 index 690e177955..0000000000 --- a/hdf/examples/VG_get_vgroup_info.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "General_Vgroups.hdf" - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 file_id, vgroup_id; - int32 lone_vg_number; /* current lone vgroup number */ - int32 num_of_lones = 0; /* number of lone vgroups */ - int32 *ref_array = NULL; /* buffer to hold the ref numbers of lone vgroups */ - char *vgroup_name, *vgroup_class; - uint16 name_len; - - /********************** End of variable declaration **********************/ - - /* - * Open the HDF file for reading. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the V interface. - */ - if (Vstart(file_id) == FAIL) - printf("*** ERROR from Vstart\n"); - - /* - * Get and print the names and class names of all the lone vgroups. - * First, call Vlone with num_of_lones set to 0 to get the number of - * lone vgroups in the file, but not to get their reference numbers. - */ - num_of_lones = Vlone(file_id, NULL, num_of_lones); - - /* - * Then, if there are any lone vgroups, - */ - if (num_of_lones > 0) { - /* - * use the num_of_lones returned to allocate sufficient space for the - * buffer ref_array to hold the reference numbers of all lone vgroups, - */ - ref_array = (int32 *)malloc(sizeof(int32) * num_of_lones); - - /* - * and call Vlone again to retrieve the reference numbers into - * the buffer ref_array. - */ - num_of_lones = Vlone(file_id, ref_array, num_of_lones); - - /* - * Display the name and class of each lone vgroup. - */ - fprintf(stderr, "Lone vgroups in this file are:\n"); - for (lone_vg_number = 0; lone_vg_number < num_of_lones; lone_vg_number++) { - /* - * Attach to the current vgroup then get and display its - * name and class. Note: the current vgroup must be detached before - * moving to the next. - */ - vgroup_id = Vattach(file_id, ref_array[lone_vg_number], "r"); - if (Vgetnamelen(vgroup_id, &name_len) == FAIL) - printf("*** ERROR from Vgetnamelen\n"); - vgroup_name = (char *)malloc(sizeof(char *) * (name_len + 1)); - if (vgroup_name == NULL) { - fprintf(stderr, "Not enough memory for vgroup_name!\n"); - exit(1); - } - if (Vgetname(vgroup_id, vgroup_name) == FAIL) - printf("*** ERROR from Vgetname\n"); - - if (Vgetclassnamelen(vgroup_id, &name_len) == FAIL) - printf("*** ERROR from Vgetclassnamelen\n"); - vgroup_class = (char *)malloc(sizeof(char *) * (name_len + 1)); - if (vgroup_class == NULL) { - fprintf(stderr, "Not enough memory for vgroup_class!\n"); - exit(1); - } - if (Vgetclass(vgroup_id, vgroup_class) == FAIL) - printf("*** ERROR from Vgetclass\n"); - fprintf(stderr, " Vgroup name %s and class %s\n", vgroup_name, vgroup_class); - if (Vdetach(vgroup_id) == FAIL) - printf("*** ERROR from Vdetach\n"); - free(vgroup_name); - free(vgroup_class); - } /* for */ - } /* if */ - - /* - * Terminate access to the V interface and close the file. - */ - if (Vend(file_id) == FAIL) - printf("*** ERROR from Vend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - /* - * Free the space allocated by this program. - */ - free(ref_array); - return 0; -} diff --git a/hdf/examples/VG_insert_vdatas_to_vgroup.c b/hdf/examples/VG_insert_vdatas_to_vgroup.c deleted file mode 100644 index 591f8636de..0000000000 --- a/hdf/examples/VG_insert_vdatas_to_vgroup.c +++ /dev/null @@ -1,163 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "General_Vgroups.hdf" -#define N_RECORDS 30 /* number of records in the vdatas */ -#define ORDER 3 /* order of field FIELD_VD2 */ -#define VG_NAME "Vertices" -#define VG_CLASS "Vertex Set" -#define VD1_NAME "X,Y Coordinates" /* first vdata to hold X,Y...*/ -#define VD1_CLASS "Position" /*...values of the vertices */ -#define VD2_NAME "Temperature" /* second vdata to hold the...*/ -#define VD2_CLASS "Property List" /*...temperature field */ -#define VD3_NAME "Node List" /* third vdata to hold...*/ -#define VD3_CLASS "Mesh" /*...the list of nodes */ -#define FIELD1_VD1 "PX" /* first field of first vdata - X values */ -#define FIELD2_VD1 "PY" /* second field of first vdata - Y values */ -#define FIELD_VD2 "TMP" /* field of third vdata */ -#define FIELD_VD3 "PLIST" /* field of second vdata */ -#define FIELDNAME_LIST "PX,PY" /* field name list for first vdata */ -/* Note that the second and third vdatas can use the field names as - the field name lists unless more fields are added to a vdata. - Then a field name list is needed for that vdata */ - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 file_id, vgroup_id; - int32 vdata1_id, vdata2_id, vdata3_id; - int8 i, j, k = 0; - float32 pxy[N_RECORDS][2] = /* buffer for data of the first vdata */ - {{-1.5, 2.3}, {-1.5, 1.98}, {-2.4, .67}, {-3.4, 1.46}, {-.65, 3.1}, {-.62, 1.23}, - {-.4, 3.8}, {-3.55, 2.3}, {-1.43, 2.44}, {.23, 1.13}, {-1.4, 5.43}, {-1.4, 5.8}, - {-3.4, 3.85}, {-.55, .3}, {-.21, 1.22}, {-1.44, 1.9}, {-1.4, 2.8}, {.94, 1.78}, - {-.4, 2.32}, {-.87, 1.99}, {-.54, 4.11}, {-1.5, 1.35}, {-1.4, 2.21}, {-.22, 1.8}, - {-1.1, 4.55}, {-.44, .54}, {-1.11, 3.93}, {-.76, 1.9}, {-2.34, 1.7}, {-2.2, 1.21}}; - float32 tmp[N_RECORDS]; /* buffer for data of the second vdata */ - int16 plist[N_RECORDS][3]; /* buffer for data of the third vdata */ - - /********************** End of variable declaration ***********************/ - - /* - * Open the HDF file for writing. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_WRITE, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the V interface. - */ - if (Vstart(file_id) == FAIL) - printf("*** ERROR from Vstart\n"); - - /* - * Buffer the data for the second and third vdatas. - */ - for (i = 0; i < N_RECORDS; i++) - for (j = 0; j < ORDER; j++) - plist[i][j] = ++k; - - for (i = 0; i < N_RECORDS; i++) - tmp[i] = i * 10.0; - - /* - * Create the vgroup then set its name and class. Note that the vgroup's - * reference number is set to -1 for creating and the access mode is "w" for - * writing. - */ - vgroup_id = Vattach(file_id, -1, "w"); - if (Vsetname(vgroup_id, VG_NAME) == FAIL) - printf("*** ERROR from Vsetname\n"); - if (Vsetclass(vgroup_id, VG_CLASS) == FAIL) - printf("*** ERROR from Vsetclass\n"); - - /* - * Create the first vdata then set its name and class. Note that the vdata's - * reference number is set to -1 for creating and the access mode is "w" for - * writing. - */ - vdata1_id = VSattach(file_id, -1, "w"); - if (VSsetname(vdata1_id, VD1_NAME) == FAIL) - printf("*** ERROR from VSsetname\n"); - if (VSsetclass(vdata1_id, VD1_CLASS) == FAIL) - printf("*** ERROR from VSsetclass\n"); - - /* - * Introduce and define the fields of the first vdata. - */ - if (VSfdefine(vdata1_id, FIELD1_VD1, DFNT_FLOAT32, 1) == FAIL) - printf("*** ERROR from VSfdefine\n"); - if (VSfdefine(vdata1_id, FIELD2_VD1, DFNT_FLOAT32, 1) == FAIL) - printf("*** ERROR from VSfdefine\n"); - if (VSsetfields(vdata1_id, FIELDNAME_LIST) == FAIL) - printf("*** ERROR from VSsetfields\n"); - - /* - * Write the buffered data into the first vdata with full interlace mode. - */ - VSwrite(vdata1_id, (uint8 *)pxy, N_RECORDS, FULL_INTERLACE); - - /* - * Insert the vdata into the vgroup using its identifier. - */ - Vinsert(vgroup_id, vdata1_id); - - /* - * Detach from the first vdata. - */ - if (VSdetach(vdata1_id) == FAIL) - printf("*** ERROR from VSdetach\n"); - - /* - * Create, write, and insert the second vdata to the vgroup using - * steps similar to those used for the first vdata. - */ - vdata2_id = VSattach(file_id, -1, "w"); - if (VSsetname(vdata2_id, VD2_NAME) == FAIL) - printf("*** ERROR from VSsetname\n"); - if (VSsetclass(vdata2_id, VD2_CLASS) == FAIL) - printf("*** ERROR from VSsetclass\n"); - if (VSfdefine(vdata2_id, FIELD_VD2, DFNT_FLOAT32, 1) == FAIL) - printf("*** ERROR from VSfdefine\n"); - if (VSsetfields(vdata2_id, FIELD_VD2) == FAIL) - printf("*** ERROR from VSsetfields\n"); - VSwrite(vdata2_id, (uint8 *)tmp, N_RECORDS, FULL_INTERLACE); - Vinsert(vgroup_id, vdata2_id); - if (VSdetach(vdata2_id) == FAIL) - printf("*** ERROR from VSdetach\n"); - - /* - * Create, write, and insert the third vdata to the vgroup using - * steps similar to those used for the first and second vdatas. - */ - vdata3_id = VSattach(file_id, -1, "w"); - if (VSsetname(vdata3_id, VD3_NAME) == FAIL) - printf("*** ERROR from VSsetname\n"); - if (VSsetclass(vdata3_id, VD3_CLASS) == FAIL) - printf("*** ERROR from VSsetclass\n"); - if (VSfdefine(vdata3_id, FIELD_VD3, DFNT_INT16, 3) == FAIL) - printf("*** ERROR from VSfdefine\n"); - if (VSsetfields(vdata3_id, FIELD_VD3) == FAIL) - printf("*** ERROR from VSsetfields\n"); - VSwrite(vdata3_id, (uint8 *)plist, N_RECORDS, FULL_INTERLACE); - Vinsert(vgroup_id, vdata3_id); - if (VSdetach(vdata3_id) == FAIL) - printf("*** ERROR from VSdetach\n"); - - /* - * Terminate access to the vgroup "Vertices". - */ - if (Vdetach(vgroup_id) == FAIL) - printf("*** ERROR from Vdetach\n"); - - /* - * Terminate access to the V interface and close the HDF file. - */ - if (Vend(file_id) == FAIL) - printf("*** ERROR from Vend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/VG_set_get_vgroup_attr.c b/hdf/examples/VG_set_get_vgroup_attr.c deleted file mode 100644 index a31d82bde4..0000000000 --- a/hdf/examples/VG_set_get_vgroup_attr.c +++ /dev/null @@ -1,104 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "General_Vgroups.hdf" -#define VGROUP_NAME "SD Vgroup" -#define VGATTR_NAME "First Attribute" -#define N_ATT_VALUES 7 /* number of values in the attribute */ - -int -main() -{ - /************************* Variable declaration **************************/ - - intn n_attrs; /* number of attributes of the vgroup */ - int32 file_id, vgroup_ref, vgroup_id, attr_index, i, vg_version, n_values; - char vg_attr[N_ATT_VALUES] = {'v', 'g', 'r', 'o', 'u', 'p', '\0'}; - char vgattr_buf[N_ATT_VALUES], attr_name[30]; - - /********************** End of variable declaration **********************/ - - /* - * Open the HDF file for writing. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_WRITE, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the V interface. - */ - if (Vstart(file_id) == FAIL) - printf("*** ERROR from Vstart\n"); - - /* - * Get the reference number of the vgroup named VGROUP_NAME. - */ - vgroup_ref = Vfind(file_id, VGROUP_NAME); - - /* - * Attach to the vgroup found. - */ - vgroup_id = Vattach(file_id, vgroup_ref, "w"); - - /* - * Get and display the version of the attached vgroup. - */ - vg_version = Vgetversion(vgroup_id); - switch (vg_version) { - case VSET_NEW_VERSION: - printf("\nVgroup %s is of the newest version, version 4\n", VGROUP_NAME); - break; - case VSET_VERSION: - printf("Vgroup %s is of a version between 3.2 and 4.0r2\n", VGROUP_NAME); - break; - case VSET_OLD_VERSION: - printf("Vgroup %s is of version before 3.2\n", VGROUP_NAME); - break; - default: - printf("Unknown version = %d\n", vg_version); - } /* switch */ - - /* - * Add the attribute named VGATTR_NAME to the vgroup. - */ - if (Vsetattr(vgroup_id, VGATTR_NAME, DFNT_CHAR, N_ATT_VALUES, vg_attr) == FAIL) - printf("*** ERROR from Vsetattr\n"); - - /* - * Get and display the number of attributes attached to this vgroup. - */ - n_attrs = Vnattrs(vgroup_id); - printf("\nThis vgroup has %d attribute(s)\n", n_attrs); - - /* - * Get and display the name and the number of values of each attribute. - * Note that the fourth and last parameters are set to NULL because the type - * and the size of the attribute are not desired. - */ - for (attr_index = 0; attr_index < n_attrs; attr_index++) { - if (Vattrinfo(vgroup_id, attr_index, attr_name, NULL, &n_values, NULL) == FAIL) - printf("*** ERROR from Vattrinfo\n"); - printf("\nAttribute #%d is named %s and has %d values: ", attr_index + 1, attr_name, n_values); - - /* - * Get and display the attribute values. - */ - if (Vgetattr(vgroup_id, attr_index, vgattr_buf) == FAIL) - printf("*** ERROR from Vgetattr\n"); - for (i = 0; i < n_values; i++) - printf("%c ", vgattr_buf[i]); - printf("\n"); - } - - /* - * Terminate access to the vgroup and to the V interface, and close - * the HDF file. - */ - if (Vdetach(vgroup_id) == FAIL) - printf("*** ERROR from Vdetach\n"); - if (Vend(file_id) == FAIL) - printf("*** ERROR from Vend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/VG_vgroup_contents.c b/hdf/examples/VG_vgroup_contents.c deleted file mode 100644 index 916a67d7a7..0000000000 --- a/hdf/examples/VG_vgroup_contents.c +++ /dev/null @@ -1,108 +0,0 @@ -#include "hdf.h" - -#define FILE_NAME "General_Vgroups.hdf" - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 file_id, vgroup_id, vgroup_ref; - int32 obj_index; /* index of an object within a vgroup */ - int32 num_of_pairs; /* number of tag/ref number pairs, i.e., objects */ - int32 obj_tag, obj_ref; /* tag/ref number of an HDF object */ - int32 vgroup_pos = 0; /* position of a vgroup in the file */ - - /********************** End of variable declaration ***********************/ - - /* - * Open the HDF file for reading. - */ - if ((file_id = Hopen(FILE_NAME, DFACC_READ, 0)) == FAIL) - printf("*** ERROR from Hopen\n"); - - /* - * Initialize the V interface. - */ - if (Vstart(file_id) == FAIL) - printf("*** ERROR from Vstart\n"); - - /* - * Obtain each vgroup in the file by its reference number, get the - * number of objects in the vgroup, and display the information about - * that vgroup. - */ - vgroup_ref = -1; /* set to -1 to search from the beginning of file */ - while (TRUE) { - /* - * Get the reference number of the next vgroup in the file. - */ - vgroup_ref = Vgetid(file_id, vgroup_ref); - - /* - * Attach to the vgroup for reading or exit the loop if no more vgroups - * are found. - */ - if (vgroup_ref == -1) - break; - vgroup_id = Vattach(file_id, vgroup_ref, "r"); - - /* - * Get the total number of objects in the vgroup. - */ - num_of_pairs = Vntagrefs(vgroup_id); - - /* - * If the vgroup contains any object, print the tag/ref number - * pair of each object in the vgroup, in the order they appear in the - * file, and indicate whether the object is a vdata, vgroup, or neither. - */ - if (num_of_pairs > 0) { - printf("\nVgroup #%d contains:\n", vgroup_pos); - for (obj_index = 0; obj_index < num_of_pairs; obj_index++) { - /* - * Get the tag/ref number pair of the object specified - * by its index, obj_index, and display them. - */ - if (Vgettagref(vgroup_id, obj_index, &obj_tag, &obj_ref) == FAIL) - printf("*** ERROR from Vgettagref\n"); - printf("tag = %d, ref = %d", obj_tag, obj_ref); - - /* - * State whether the HDF object referred to by obj_ref is a vdata, - * a vgroup, or neither. - */ - if (Visvg(vgroup_id, obj_ref)) - printf(" <-- is a vgroup\n"); - else if (Visvs(vgroup_id, obj_ref)) - printf(" <-- is a vdata\n"); - else - printf(" <-- neither vdata nor vgroup\n"); - } /* for */ - } /* if */ - - else - printf("Vgroup #%d contains no HDF objects\n", vgroup_pos); - - /* - * Terminate access to the current vgroup. - */ - if (Vdetach(vgroup_id) == FAIL) - printf("*** ERROR from Vdetach\n"); - - /* - * Move to the next vgroup position. - */ - vgroup_pos++; - } /* while */ - - /* - * Terminate access to the V interface and close the file. - */ - if (Vend(file_id) == FAIL) - printf("*** ERROR from Vend\n"); - if (Hclose(file_id) == FAIL) - printf("*** ERROR from Hclose\n"); - - return 0; -} diff --git a/hdf/examples/run-all-ex.sh b/hdf/examples/run-all-ex.sh deleted file mode 100755 index 454cb31229..0000000000 --- a/hdf/examples/run-all-ex.sh +++ /dev/null @@ -1,38 +0,0 @@ -#! /bin/sh -# -# Copyright by The HDF Group. -# All rights reserved. -# -# This file is part of HDF4. The full HDF4 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the COPYING file, which can be found at the root of the source code -# distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. - -# -# This file: run-all-ex.sh -# Written by: Larry Knox -# Date: January 17, 2014 -# -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -# # -# This script will run the scripts to compile and run the installed hdf4 # -# examples. # -# # -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - -echo "Run c examples" -LD_LIBRARY_PATH=../../../lib:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH -if ((cd c; sh ./run-c-ex.sh) && \ - (if test -d fortran; then - echo "Run fortran examples" - cd fortran; sh ./run-fortran-ex.sh - fi)); then - echo "Done" - exit 0 -else - exit 1 -fi - diff --git a/hdf/examples/run-c-ex.sh b/hdf/examples/run-c-ex.sh deleted file mode 100644 index cea16a67a6..0000000000 --- a/hdf/examples/run-c-ex.sh +++ /dev/null @@ -1,171 +0,0 @@ -#! /bin/sh -# -# Copyright by The HDF Group. -# All rights reserved. -# -# This file is part of HDF4. The full HDF4 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the COPYING file, which can be found at the root of the source code -# distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. - -# -# This file: run-hdf-c-ex.sh -# Written by: Larry Knox -# Date: Jan 17, 2014 -# -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -# # -# This script will compile and run the c examples from source files installed # -# in .../examples/c using h4cc. The order for running # -# programs with RunTest in the MAIN section below is taken from the Makefile. # -# The order is important since some of the test programs use data files created # -# by earlier test programs. Any future additions should be placed accordingly. # -# # -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - -# Initializations -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -# Where the tool is installed. -# default is relative path to installed location of the tools -prefix="${prefix:-../../../}" -AR="@AR@" -RANLIB="@RANLIB@" -H4TOOL="h4cc" # The tool name -H4TOOL_BIN="${prefix}/bin/${H4TOOL}" # The path of the tool binary - -#### Run test #### -RunTest() -{ - TEST_EXEC=$1 - Test=$1".c" - - echo - echo "################# $1 #################" - ${H4TOOL_BIN} -o $TEST_EXEC $Test - if [ $? -ne 0 ] - then - echo "messed up compiling $Test" - exit 1 - fi - ./$TEST_EXEC -} - - - -################## MAIN ################## - -# Run tests -if [ $? -eq 0 ] -then - if ( - #### hdf examples #### - RunTest VD_create_vdatas &&\ - rm VD_create_vdatas &&\ - RunTest VD_write_mixed_vdata &&\ - rm VD_write_mixed_vdata &&\ - RunTest VD_write_mixed_vdata_struct &&\ - rm VD_write_mixed_vdata_struct &&\ - RunTest VD_write_to_vdata &&\ - rm VD_write_to_vdata &&\ - RunTest VD_read_from_vdata &&\ - rm VD_read_from_vdata &&\ - RunTest VD_read_mixed_vdata &&\ - rm VD_read_mixed_vdata &&\ - RunTest VD_set_get_vdata_attr &&\ - rm VD_set_get_vdata_attr &&\ - RunTest VD_create_onefield_vdatas &&\ - rm VD_create_onefield_vdatas &&\ - RunTest VD_get_vdata_info &&\ - rm VD_get_vdata_info &&\ - RunTest VD_locate_vdata &&\ - rm VD_locate_vdata &&\ - RunTest VG_create_vgroup &&\ - rm VG_create_vgroup &&\ - RunTest VG_add_sds_to_vgroup &&\ - rm VG_add_sds_to_vgroup &&\ - RunTest VG_insert_vdatas_to_vgroup &&\ - rm VG_insert_vdatas_to_vgroup &&\ - RunTest VG_set_get_vgroup_attr &&\ - rm VG_set_get_vgroup_attr &&\ - RunTest VG_vgroup_contents &&\ - rm VG_vgroup_contents &&\ - RunTest VG_get_vgroup_info &&\ - rm VG_get_vgroup_info &&\ - RunTest GR_create_and_write_image &&\ - rm GR_create_and_write_image &&\ - RunTest GR_modify_image &&\ - rm GR_modify_image &&\ - RunTest GR_set_attribute &&\ - rm GR_set_attribute &&\ - RunTest GR_get_attribute &&\ - rm GR_get_attribute &&\ - RunTest GR_write_palette &&\ - rm GR_write_palette &&\ - RunTest GR_read_palette &&\ - rm GR_read_palette &&\ - RunTest GR_image_info &&\ - rm GR_image_info &&\ - RunTest GR_read_image &&\ - rm GR_read_image &&\ - RunTest GR_write_chunks &&\ - rm GR_write_chunks &&\ - RunTest GR_read_chunks &&\ - rm GR_read_chunks &&\ - RunTest AN_create_annotation &&\ - rm AN_create_annotation &&\ - RunTest AN_get_annotation_info &&\ - rm AN_get_annotation_info &&\ - RunTest AN_read_annotation &&\ - rm AN_read_annotation &&\ - #### mfhdf examples #### - RunTest SD_create_sds &&\ - rm SD_create_sds &&\ - RunTest SD_write_to_sds &&\ - rm SD_write_to_sds &&\ - RunTest SD_write_slab &&\ - rm SD_write_slab &&\ - RunTest SD_alter_sds_values &&\ - rm SD_alter_sds_values &&\ - RunTest SD_unlimited_sds &&\ - rm SD_unlimited_sds &&\ - RunTest SD_compress_sds &&\ - rm SD_compress_sds &&\ - RunTest SD_mv_sds_to_external &&\ - rm SD_mv_sds_to_external &&\ - RunTest SD_read_from_sds &&\ - rm SD_read_from_sds &&\ - RunTest SD_read_subsets &&\ - rm SD_read_subsets &&\ - RunTest SD_get_info &&\ - rm SD_get_info &&\ - RunTest SD_find_sds_by_name &&\ - rm SD_find_sds_by_name &&\ - RunTest SD_set_get_dim_info &&\ - rm SD_set_get_dim_info &&\ - RunTest SD_dimscale_vs_sds &&\ - rm SD_dimscale_vs_sds &&\ - RunTest SD_set_attr &&\ - rm SD_set_attr &&\ - RunTest SD_get_attr &&\ - rm SD_get_attr &&\ - RunTest SD_chunking_example &&\ - rm SD_chunking_example - ); then - EXIT_VALUE=${EXIT_SUCCESS} - else - EXIT_VALUE=${EXIT_FAILURE} - fi -fi - -# Cleanup -rm *.o -rm *.hdf -rm ExternalSDS -echo - -exit $EXIT_VALUE - diff --git a/hdf/fortran/Makefile.am b/hdf/fortran/Makefile.am index 1d63ec7e96..c08be041d3 100644 --- a/hdf/fortran/Makefile.am +++ b/hdf/fortran/Makefile.am @@ -1,20 +1,9 @@ include $(top_srcdir)/config/commence.am -DIST_SUBDIRS = examples +DIST_SUBDIRS = -installcheck-local: - @(cd examples && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; - -# 'make install-all' also installs examples +# 'make install-all' install-all: @$(MAKE) $(AM_MAKEFLAGS) install - @$(MAKE) $(AM_MAKEFLAGS) install-examples uninstall-all: @$(MAKE) $(AM_MAKEFLAGS) uninstall - @$(MAKE) $(AM_MAKEFLAGS) uninstall-examples - -# Install examples recursively -install-examples uninstall-examples: - @@SETX@; for d in examples; do \ - (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ - done diff --git a/hdf/fortran/examples/AN_create_annotation.f b/hdf/fortran/examples/AN_create_annotation.f deleted file mode 100644 index b1a1dc860d..0000000000 --- a/hdf/fortran/examples/AN_create_annotation.f +++ /dev/null @@ -1,125 +0,0 @@ - program create_annotation - implicit none -C -C Parameter declaration -C - character*22 FILE_NAME - character*9 VG_NAME - character*19 FILE_LABEL_TXT - character*53 FILE_DESC_TXT - character*16 DATA_LABEL_TXT - character*54 DATA_DESC_TXT -C - parameter (FILE_NAME = 'General_HDFobjects.hdf', - + VG_NAME = 'AN Vgroup', - + FILE_LABEL_TXT = 'General HDF objects', - + DATA_LABEL_TXT = 'Common AN Vgroup', - + FILE_DESC_TXT = - + 'This is an HDF file that contains general HDF objects', - + DATA_DESC_TXT = - + 'This is a vgroup that is used to test data annotations') - integer DFACC_CREATE - parameter (DFACC_CREATE = 4) - integer AN_FILE_LABEL, AN_FILE_DESC, AN_DATA_LABEL, AN_DATA_DESC - parameter (AN_FILE_LABEL = 2, - + AN_FILE_DESC = 3, - + AN_DATA_LABEL = 0, - + AN_DATA_DESC = 1) -C -C Function declaration -C - integer hopen, hclose - integer afstart, affcreate, afwriteann, afcreate, - + afendaccess, afend - integer vfstart, vfatch, vfsnam, vqref, vqtag, vfdtch, vfend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id, an_id - integer file_label_id, file_desc_id - integer data_label_id, data_desc_id - integer vgroup_id, vgroup_tag, vgroup_ref -C -C**** End of variable declaration ************************************ -C -C -C Create the HDF file. -C - file_id = hopen(FILE_NAME, DFACC_CREATE, 0) -C -C Initialize the AN interface. -C - an_id = afstart(file_id) -C -C Create the file label. -C - file_label_id = affcreate(an_id, AN_FILE_LABEL) -C -C Write the annotation to the file label. -C - status = afwriteann(file_label_id, FILE_LABEL_TXT, - + len(FILE_LABEL_TXT)) -C -C Create file description. -C - file_desc_id = affcreate(an_id, AN_FILE_DESC) -C -C Write the annotation to the file description. -C - status = afwriteann(file_desc_id, FILE_DESC_TXT, - + len(FILE_DESC_TXT)) -C -C Create a vgroup in the file. Note that the vgroup's ref number is -C set to -1 for creating and the access mode is 'w' for writing. -C - status = vfstart(file_id) - vgroup_id = vfatch(file_id, -1, 'w') - status = vfsnam(vgroup_id, VG_NAME) -C -C Obtain the tag and reference number of the vgroup for subsequent -C references. -C - vgroup_ref = vqref(vgroup_id) - vgroup_tag = vqtag(vgroup_id) -C -C Create the data label for the vgroup identified by its tag and ref -C number. -C - data_label_id = afcreate(an_id, vgroup_tag, vgroup_ref, - + AN_DATA_LABEL) -C -C Write the annotation text to the data label. -C - status = afwriteann(data_label_id, DATA_LABEL_TXT, - + len(DATA_LABEL_TXT)) - -C -C Create the data description for the vgroup identified by its tag and ref. -C - data_desc_id = afcreate(an_id, vgroup_tag, vgroup_ref, - + AN_DATA_DESC) -C -C Write the annotation text to the data description. -C - status = afwriteann(data_desc_id, DATA_DESC_TXT, - + len(DATA_DESC_TXT)) -C -C Terminate access to the vgroup and to the V interface. -C - status = vfdtch(vgroup_id) - status = vfend(file_id) -C -C Terminate access to each annotation explicitly. -C - status = afendaccess(file_label_id) - status = afendaccess(file_desc_id) - status = afendaccess(data_label_id) - status = afendaccess(data_desc_id) -C -C Terminate access to the AN interface and close the HDF file. -C - status = afend(an_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/AN_get_annotation_info.f b/hdf/fortran/examples/AN_get_annotation_info.f deleted file mode 100644 index 34438d6456..0000000000 --- a/hdf/fortran/examples/AN_get_annotation_info.f +++ /dev/null @@ -1,121 +0,0 @@ - program annotation_info - implicit none -C -C Parameter declaration -C - character*22 FILE_NAME - character*9 VG_NAME -C - parameter (FILE_NAME = 'General_HDFobjects.hdf', - + VG_NAME = 'AN Vgroup') - integer DFACC_READ - parameter (DFACC_READ = 1) - integer AN_FILE_LABEL, AN_DATA_LABEL, AN_DATA_DESC - parameter (AN_FILE_LABEL = 2, - + AN_DATA_LABEL = 0, - + AN_DATA_DESC = 1) - integer DFTAG_DIA, DFTAG_FID, DFTAG_DIL - parameter (DFTAG_DIA = 105, - + DFTAG_FID = 100, - + DFTAG_DIL = 104) - integer DFTAG_VG - parameter (DFTAG_VG = 1965) -C -C Function declaration -C - integer hopen, hclose - integer afstart, afnumann, afannlist, afidtagref, aftagatype, - + afatypetag, afend - integer vfstart, vfind - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id, an_id - integer n_annots, ann_index, annot_type, ann_tag, ann_ref - integer ann_list(10) - integer vgroup_tag, vgroup_ref -C -C**** End of variable declaration ************************************ -C - annot_type = AN_DATA_DESC - vgroup_tag = DFTAG_VG -C -C Open the HDF file for reading. -C - file_id = hopen(FILE_NAME, DFACC_READ, 0) -C -C Initialize the V interface. -C - status = vfstart(file_id) -C -C Get the group named VG_NAME. -C - vgroup_ref = vfind(file_id, VG_NAME) -C -C Initialize the AN interface. -C - an_id = afstart(file_id) - -C -C Get the number of object descriptions. -C - if (vgroup_ref .eq. -1) goto 100 - n_annots = afnumann(an_id, annot_type, vgroup_tag, vgroup_ref) -C -C Get the list of identifiers of the annotations attached to the -C vgroup and of type annot_type. Identifiers are read into ann_list -C buffer. One has to make sure that ann_list has the size big enough -C to hold the list of identifiers. -C - n_annots = afannlist(an_id, annot_type, vgroup_tag, vgroup_ref, - + ann_list) -C -C Get each annotation identifier from the list then display the -C tag/ref number pair of the corresponding annotation. -C - write(*,*) 'List of annotations of type AN_DATA_DESC' - do 10 ann_index = 0, n_annots - 1 -C -C Get and display the ref number of the annotation from its -C identifier. -C - status = afidtagref(ann_list(ann_index+1), ann_tag, ann_ref) - write(*,*) 'Annotation index: ', ann_index - if (ann_tag .eq. DFTAG_DIA) then - write(*,*) 'tag = DFTAG_DIA (data description)' - else - write(*,*) ' tag = Incorrect' - endif - write(*,*) 'reference number = ', ann_ref -10 continue -C -C Get and display an annotation type from an annotation tag. -C - annot_type = aftagatype(DFTAG_FID) - if (annot_type .eq. AN_FILE_LABEL) then - write(*,*) 'Annotation type of DFTAG_FID (file label) is ', - + 'AN_FILE_LABEL ' - else - write(*,*) 'Annotation type of DFTAG_FID (file label) is ', - + 'Incorrect' - endif -C -C Get and display an annotation tag from an annotation type. -C - ann_tag = afatypetag(AN_DATA_LABEL) - if (ann_tag .eq. DFTAG_DIL ) then - write(*,*) 'Annotation tag of AN_DATA_LABEL is ', - + 'DFTAG_DIL (data label)' - else - write(*,*) 'Annotation type of DFTAG_FID (file label) is ', - + 'Incorrect' - endif -C -C Terminate access to the AN interface and close the HDF file. -C -100 continue - status = afend(an_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/AN_read_annotation.f b/hdf/fortran/examples/AN_read_annotation.f deleted file mode 100644 index c9074d3c32..0000000000 --- a/hdf/fortran/examples/AN_read_annotation.f +++ /dev/null @@ -1,82 +0,0 @@ - program read_annotation - implicit none -C -C Parameter declaration -C - character*22 FILE_NAME -C - parameter (FILE_NAME = 'General_HDFobjects.hdf') - integer DFACC_READ - parameter (DFACC_READ = 1) - integer AN_DATA_LABEL - parameter (AN_DATA_LABEL = 0) -C -C Function declaration -C - integer hopen, hclose - integer afstart, affileinfo, afselect, afannlen, afreadann, - + afendaccess, afend -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id, an_id, ann_id - integer index, ann_length - integer n_file_labels, n_file_descs, n_data_labels, n_data_descs - character*256 ann_buf -C -C**** End of variable declaration ************************************ -C -C -C Open the HDF file for reading. -C - file_id = hopen(FILE_NAME, DFACC_READ, 0) -C -C Initialize the AN interface. -C - an_id = afstart(file_id) -C -C Get the annotation information, i.e., the number of file labels, -C file descriptions, data labels, and data descriptions. -C - status = affileinfo(an_id, n_file_labels, n_file_descs, - + n_data_labels, n_data_descs) -C -C Get the data labels. Note that this DO loop can be used to obtain -C the contents of each kind of annotation with the appropriate number -C of annotations and the type of annotation, i.e., replace -C n_data_labels with n_file_labels, n_files_descs, or n_data_descs, and -C AN_DATA_LABEL with AN_FILE_LABEL, AN_FILE_DESC, or AN_DATA_DESC, -C respectively. -C - do 10 index = 0, n_data_labels-1 -C -C Get the identifier of the current data label. -C - ann_id = afselect(an_id, index, AN_DATA_LABEL) -C -C Get the length of the data label. -C - ann_length = afannlen(ann_id) -C -C Read and display the data label. The data label is read into buffer -C ann_buf. One has to make sure that ann_buf has sufficient size to hold -C the data label. Also note, that the third argument to afreadann is -C 1 greater that the actual length of the data label (see comment to -C C example). -C - status = afreadann(ann_id, ann_buf, ann_length+1) - write(*,*) 'Data label index: ', index - write(*,*) 'Data label contents: ', ann_buf(1:ann_length) -10 continue -C -C Terminate access to the current data label. -C - status = afendaccess(ann_id) -C -C Terminate access to the AN interface and close the HDF file. -C - status = afend(an_id) - status = hclose(file_id) - end - diff --git a/hdf/fortran/examples/CMakeLists.txt b/hdf/fortran/examples/CMakeLists.txt deleted file mode 100644 index 6bee629909..0000000000 --- a/hdf/fortran/examples/CMakeLists.txt +++ /dev/null @@ -1,130 +0,0 @@ -cmake_minimum_required (VERSION 3.12) -project (HDF4_HDF_FORTRAN_EXAMPLES C Fortran) -# -------------------------------------------------------------------- -# Notes: When creating examples they should be prefixed -# with "f_ex_". This allows for easier filtering of the examples. -# -------------------------------------------------------------------- - -#----------------------------------------------------------------------------- -# Add debug information (intel Fortran : JB) -#----------------------------------------------------------------------------- -if (CMAKE_Fortran_COMPILER MATCHES ifort) - if (WIN32) - set (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE STRING "flags" FORCE) - set (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE STRING "flags" FORCE) - endif () -endif () - -#----------------------------------------------------------------------------- -# Setup include Directories -#----------------------------------------------------------------------------- -LINK_DIRECTORIES ( - ${HDF4_HDF_BINARY_DIR} - ${HDF4_MFHDF_BINARY_DIR} - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -) - -#----------------------------------------------------------------------------- -# Define Sources -#----------------------------------------------------------------------------- -set (examples - VD_create_vdatas - VD_write_mixed_vdata - VD_write_to_vdata - VD_create_onefield_vdatas - VD_read_from_vdata - VD_read_mixed_vdata - VD_get_vdata_info - VD_locate_vdata - VG_create_vgroup - #VG_add_sds_to_vgroup - VG_insert_vdatas_to_vgroup - VG_set_get_vgroup_attr - VG_vgroup_contents - VG_get_vgroup_info - GR_create_and_write_image - GR_modify_image - GR_set_attribute - GR_get_attribute - GR_write_palette - GR_image_info - GR_read_image - AN_create_annotation - AN_get_annotation_info - AN_read_annotation - #VD_set_get_vdata_attr -) -set (mf_examples - VG_add_sds_to_vgroup -) -set (skip_examples - VD_set_get_vdata_attr -) - -foreach (example ${examples}) - add_executable (f_ex_${example} ${HDF4_HDF_FORTRAN_EXAMPLES_SOURCE_DIR}/${example}.f) - target_include_directories (f_ex_${example} - PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY};${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR}" - ) - target_compile_options(f_ex_${example} - PRIVATE $<$:${WIN_COMPILE_FLAGS}> - ) - if(MSVC) - set_property(TARGET f_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (f_ex_${example} PROPERTIES - LINKER_LANGUAGE Fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} - ) - if (NOT BUILD_SHARED_LIBS) - target_link_libraries (f_ex_${example} PRIVATE ${HDF4_SRC_FORTRAN_LIB_TARGET}) - else () - target_link_libraries (f_ex_${example} PRIVATE ${HDF4_SRC_FORTRAN_LIBSH_TARGET}) - endif () -endforeach () - -add_executable (f_ex_VG_add_sds_to_vgroup ${HDF4_HDF_FORTRAN_EXAMPLES_SOURCE_DIR}/VG_add_sds_to_vgroup.f) -target_include_directories (f_ex_VG_add_sds_to_vgroup - PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY};${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR}" -) -target_compile_options(f_ex_VG_add_sds_to_vgroup - PRIVATE $<$:${WIN_COMPILE_FLAGS}> -) -if(MSVC) - set_property(TARGET f_ex_VG_add_sds_to_vgroup PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") -endif() -set_target_properties (f_ex_VG_add_sds_to_vgroup PROPERTIES - LINKER_LANGUAGE Fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} -) -if (NOT BUILD_SHARED_LIBS) - target_link_libraries (f_ex_VG_add_sds_to_vgroup PRIVATE ${HDF4_MF_FORTRAN_LIB_TARGET} ${HDF4_SRC_FORTRAN_LIB_TARGET}) -else () - target_link_libraries (f_ex_VG_add_sds_to_vgroup PRIVATE ${HDF4_MF_FORTRAN_LIBSH_TARGET} ${HDF4_SRC_FORTRAN_LIBSH_TARGET}) -endif () - -foreach (example ${skip_examples}) - add_executable (f_ex_${example} ${HDF4_HDF_FORTRAN_EXAMPLES_SOURCE_DIR}/${example}.f) - target_include_directories (f_ex_${example} - PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY};${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR}" - ) - target_compile_options(f_ex_${example} - PRIVATE $<$:${WIN_COMPILE_FLAGS}> - ) - if(MSVC) - set_property(TARGET f_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (f_ex_${example} PROPERTIES - LINKER_LANGUAGE Fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} - ) - if (NOT BUILD_SHARED_LIBS) - target_link_libraries (f_ex_${example} PRIVATE ${HDF4_SRC_FORTRAN_LIB_TARGET}) - else () - target_link_libraries (f_ex_${example} PRIVATE ${HDF4_SRC_FORTRAN_LIBSH_TARGET}) - endif () -endforeach () - -if (BUILD_TESTING) - include (CMakeTests.cmake) -endif () diff --git a/hdf/fortran/examples/CMakeTests.cmake b/hdf/fortran/examples/CMakeTests.cmake deleted file mode 100644 index b28f81b067..0000000000 --- a/hdf/fortran/examples/CMakeTests.cmake +++ /dev/null @@ -1,48 +0,0 @@ - -############################################################################## -############################################################################## -### T E S T I N G ### -############################################################################## -############################################################################## - -# Remove any output file left over from previous test run -add_test ( - NAME HDF_FORTRAN_EXAMPLES-clearall-objects - COMMAND ${CMAKE_COMMAND} -E remove - General_HDFobjects.hdf - General_RImages.hdf - General_Vdatas.hdf - General_Vgroups.hdf - Image_with_Palette.hdf - Packed_Vdata.hdf - Two_Vdatas.hdf - Two_Vgroups.hdf -) -if (NOT "${last_test}" STREQUAL "") - set_tests_properties (HDF_FORTRAN_EXAMPLES-clearall-objects PROPERTIES DEPENDS ${last_test} LABELS EXAMPLES) -else () - set_tests_properties (HDF_FORTRAN_EXAMPLES-clearall-objects PROPERTIES LABELS EXAMPLES) -endif () -set (last_test "HDF_FORTRAN_EXAMPLES-clearall-objects") - -foreach (example ${examples}) - add_test (NAME f_extest_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (f_extest_${example} PROPERTIES DEPENDS ${last_test} LABELS EXAMPLES) - else () - set_tests_properties (f_extest_${example} PROPERTIES LABELS EXAMPLES) - endif () - set (last_test "f_extest_${example}") -endforeach () - -add_test (NAME f_extest_VG_add_sds_to_vgroup COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) -if (NOT "${last_test}" STREQUAL "") - set_tests_properties (f_extest_VG_add_sds_to_vgroup PROPERTIES DEPENDS ${last_test} LABELS EXAMPLES) -else () - set_tests_properties (f_extest_VG_add_sds_to_vgroup PROPERTIES LABELS EXAMPLES) -endif () -set (last_test "f_extest_VG_add_sds_to_vgroup") - -foreach (example ${skip_examples}) - add_test (NAME f_extest_${example} COMMAND ${CMAKE_COMMAND} -E echo "SKIP f_extest_${example}") -endforeach () diff --git a/hdf/fortran/examples/GR_create_and_write_image.f b/hdf/fortran/examples/GR_create_and_write_image.f deleted file mode 100644 index 99132c3536..0000000000 --- a/hdf/fortran/examples/GR_create_and_write_image.f +++ /dev/null @@ -1,92 +0,0 @@ - program create_raster_image - implicit none -C -C Parameter declaration -C - character*19 FILE_NAME - character*13 IMAGE_NAME - integer X_LENGTH - integer Y_LENGTH - integer N_COMPS -C - parameter (FILE_NAME = 'General_RImages.hdf', - + IMAGE_NAME = 'Image Array 1', - + X_LENGTH = 10, - + Y_LENGTH = 5, - + N_COMPS = 2) - integer DFACC_CREATE, DFNT_INT16, MFGR_INTERLACE_PIXEL - parameter (DFACC_CREATE = 4, - + DFNT_INT16 = 22, - + MFGR_INTERLACE_PIXEL = 0) -C -C Function declaration -C - integer hopen, hclose - integer mgstart, mgcreat, mgwrimg, mgendac, mgend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id - integer gr_id, ri_id, num_type, interlace_mode - integer start(2), stride(2), edges(2), dimsizes(2) - integer i, j, k - integer*2 image_buf(N_COMPS, X_LENGTH, Y_LENGTH) -C -C**** End of variable declaration ************************************ -C -C -C Create and open the file. -C - file_id = hopen(FILE_NAME, DFACC_CREATE, 0) -C -C Initialize the GR interface. -C - gr_id = mgstart(file_id) -C -C Set the number type, interlace mode, and dimensions of the image. -C - num_type = DFNT_INT16 - interlace_mode = MFGR_INTERLACE_PIXEL - dimsizes(1) = X_LENGTH - dimsizes(2) = Y_lENGTH -C -C Create the raster image array. -C - ri_id = mgcreat(gr_id, IMAGE_NAME, N_COMPS, num_type, - + interlace_mode, dimsizes) -C -C Fill the image data buffer with values. -C - do 30 i = 1, Y_LENGTH - do 20 j = 1, X_LENGTH - do 10 k = 1, N_COMPS - image_buf(k,j,i) = (i+j) - 1 -10 continue -20 continue -30 continue - -C -C Define the size of the data to be written, i.e., start from the origin -C and go as long as the length of each dimension. -C - start(1) = 0 - start(2) = 0 - edges(1) = X_LENGTH - edges(2) = Y_LENGTH - stride(1) = 1 - stride(2) = 1 -C -C Write the data in the buffer into the image array. -C - status = mgwrimg(ri_id, start, stride, edges, image_buf) - -C -C Terminate access to the raster image and to the GR interface, -C and close the HDF file. -C - status = mgendac(ri_id) - status = mgend(gr_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/GR_get_attribute.f b/hdf/fortran/examples/GR_get_attribute.f deleted file mode 100644 index 7e15b0d1af..0000000000 --- a/hdf/fortran/examples/GR_get_attribute.f +++ /dev/null @@ -1,100 +0,0 @@ - program get_attribute - implicit none -C -C Parameter declaration -C - character*19 FILE_NAME - character*17 RI_ATTR_NAME -C - parameter (FILE_NAME = 'General_RImages.hdf', - + RI_ATTR_NAME = 'Image Attribute 2') - integer DFACC_READ, DFNT_INT16, DFNT_CHAR8 - parameter (DFACC_READ = 1, - + DFNT_CHAR8 = 4, - + DFNT_INT16 = 22) -C -C Function declaration -C - integer hopen, hclose - integer mgstart, mgfinfo, mgatinf, mggcatt, mggnatt , mgfndat, - + mgselct, mgendac, mgend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id, gr_id, ri_id - integer f_att_index, ri_att_index, data_type, n_values - integer n_rimages, n_file_attrs - integer*2 int_buf(10) - character*17 attr_name - character*80 char_buf - integer i -C -C**** End of variable declaration ************************************ -C -C -C Open the HDF file. -C - file_id = hopen(FILE_NAME, DFACC_READ, 0) -C -C Initialize the GR interface. -C - gr_id = mgstart(file_id) -C -C Determine the number of attributes in the file. -C - status = mgfinfo(gr_id, n_rimages, n_file_attrs) - if ((status .NE. -1) .AND. (n_file_attrs .GT. 0)) then - - do 10 f_att_index = 0, n_file_attrs-1 -C -C Get information about the current file attribute. -C - attr_name = ' ' - status = mgatinf(gr_id, f_att_index, attr_name, data_type, - + n_values) -C -C Check whether data type is DFNT_CHAR8 in order to use allocated buffer. -C - if(data_type .NE. DFNT_CHAR8) then - write(*,*) - + 'Unable to determine data type to use allocated buffer' - else -C -C Read and display the attribute values. -C - status = mggcatt(gr_id, f_att_index, char_buf) - write(*,*) 'Attribute ', attr_name, ' : ', - + char_buf(1:n_values) - endif -10 continue - - endif - -C -C Select the second image in the file. -C - ri_id = mgselct(gr_id, 1) -C -C Find the image attribute named RI_ATTR_NAME. -C - ri_att_index = mgfndat(ri_id, RI_ATTR_NAME) -C -C Get information about the attribute. -C - status = mgatinf(ri_id, ri_att_index, attr_name, data_type, - + n_values) -C -C Read and display attribute values. -C - status = mggnatt(ri_id, ri_att_index, int_buf) - write(*,*) 'Attributes :', (int_buf(i), i = 1, n_values) -C -C Terminate access to the image and to the GR interface, -C and close the HDF file. -C - status = mgendac(ri_id) - status = mgend(gr_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/GR_image_info.f b/hdf/fortran/examples/GR_image_info.f deleted file mode 100644 index 00d0099ac2..0000000000 --- a/hdf/fortran/examples/GR_image_info.f +++ /dev/null @@ -1,91 +0,0 @@ - program image_info - implicit none -C -C Parameter declaration -C - character*19 FILE_NAME -C - parameter (FILE_NAME = 'General_RImages.hdf') - integer DFACC_READ - parameter (DFACC_READ = 1) -C -C Function declaration -C - integer hopen, hclose - integer mgstart, mgselct, mgfinfo, mggiinf, mgendac, mgend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id, gr_id, ri_id - integer n_rimages, n_file_attrs, ri_index - integer n_comps, interlace_mode, n_attrs, data_type - integer dim_sizes(2) - character*10 type_string - character*24 interlace_string - character*64 name -C -C**** End of variable declaration ************************************ -C -C -C Open the HDF file for reading. -C - file_id = hopen(FILE_NAME, DFACC_READ, 0) -C -C Initialize the GR interface. -C - gr_id = mgstart(file_id) -C -C Determine the contents of the file. -C - status = mgfinfo(gr_id, n_rimages, n_file_attrs) -C -C For each image in the file, get and display image information. -C - do 100 ri_index = 0, n_rimages-1 - ri_id = mgselct(gr_id, ri_index) - name = ' ' - status = mggiinf(ri_id, name, n_comps, data_type, - + interlace_mode, dim_sizes, n_attrs) -C -C Map the number type and interlace mode into text strings for -C output readability. -C - if(data_type .eq. 4) then - type_string = 'DFNT_CHAR8' - else if(data_type .eq. 22) then - type_string = 'DFNT_INT16' - else - type_string = 'Unknown' - endif - if (interlace_mode .eq. 0) then - interlace_string = 'MFGR_INTERLACE_PIXEL' - else if(interlace_mode .eq. 1) then - interlace_string = 'MFGR_INTERLACE_LINE' - else if(interlace_mode .eq. 2) then - interlace_string = 'MFGR_INTERLACE_COMPONENT' - else - interlace_string = 'Unknown' - endif -C -C Display the image information for the current image. -C - write(*,*) 'Image index: ', ri_index - write(*,*) 'Image name: ', name - write(*,*) 'Number of components: ', n_comps - write(*,*) 'Number type: ', type_string - write(*,*) 'Interlace mode: ', interlace_string - write(*,*) 'Dimnesions: ', dim_sizes(1), dim_sizes(2) - write(*,*) 'Number of image attributes: ', n_attrs - write(*,*) -C -C Terminate access to the current raster image. -C - status = mgendac(ri_id) -100 continue -C -C Terminate access to the GR interface and close the HDF file. - status = mgend(gr_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/GR_modify_image.f b/hdf/fortran/examples/GR_modify_image.f deleted file mode 100644 index 9348100a93..0000000000 --- a/hdf/fortran/examples/GR_modify_image.f +++ /dev/null @@ -1,133 +0,0 @@ - program modify_image - implicit none -C -C Parameter declaration -C - character*19 FILE_NAME - character*13 IMAGE1_NAME - integer X1_LENGTH - integer Y1_LENGTH - integer N1_COMPS - character*13 IMAGE2_NAME - integer X2_LENGTH - integer Y2_LENGTH - integer N2_COMPS -C - parameter (FILE_NAME = 'General_RImages.hdf', - + IMAGE1_NAME = 'Image Array 1', - + IMAGE2_NAME = 'Image Array 2', - + X1_LENGTH = 5, - + Y1_LENGTH = 2, - + N1_COMPS = 2, - + X2_LENGTH = 6, - + Y2_LENGTH = 4, - + N2_COMPS = 3) - integer DFACC_WRITE, DFNT_INT16, DFNT_CHAR8, - + MFGR_INTERLACE_PIXEL - parameter (DFACC_WRITE = 2, - + DFNT_CHAR8 = 4, - + DFNT_INT16 = 22, - + MFGR_INTERLACE_PIXEL = 0) -C -C Function declaration -C - integer hopen, hclose - integer mgstart, mgselct, mgcreat, mgwrimg, mgendac, mgend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id - integer gr_id, ri1_id, ri2_id, data_type, interlace_mode - integer start1(2), stride1(2), edges1(2) - integer start2(2), stride2(2), edges2(2), dim_sizes(2) - integer i, j, k - integer*2 image1_buf(N1_COMPS, X1_LENGTH, Y1_LENGTH) - character image2_buf(N2_COMPS, X2_LENGTH, Y2_LENGTH) -C -C**** End of variable declaration ************************************ -C -C -C Open the HDF file for writing. -C - file_id = hopen(FILE_NAME, DFACC_WRITE, 0) -C -C Initialize the GR interface. -C - gr_id = mgstart(file_id) -C -C Select the first raster image in the file. -C - ri1_id = mgselct(gr_id, 0) -C -C Fill the buffer with values. -C - do 20 i = 1, Y1_LENGTH - do 10 j = 1, X1_LENGTH - image1_buf(1,j,i) = 0 - image1_buf(2,j,i) = 0 -10 continue -20 continue -C -C Define the part of the data in the first image that will be overwritten -C with the new values from image1_buf. -C - start1(1) = 0 - start1(2) = 0 - edges1(1) = X1_LENGTH - edges1(2) = Y1_LENGTH - stride1(1) = 1 - stride1(2) = 1 -C -C Write the data in the buffer into the image array. -C - status = mgwrimg(ri1_id, start1, stride1, edges1, image1_buf) - -C -C Set the number type, interlace mode, and dimensions of the second image. -C - data_type = DFNT_CHAR8 - interlace_mode = MFGR_INTERLACE_PIXEL - dim_sizes(1) = X2_LENGTH - dim_sizes(2) = Y2_LENGTH -C -C Create the second image in the file. -C - ri2_id = mgcreat(gr_id, IMAGE2_NAME, N2_COMPS, data_type, - + interlace_mode, dim_sizes) -C -C Fill the image data buffer with values. -C - do 60 i = 1, Y2_LENGTH - do 50 j = 1, X2_LENGTH - do 40 k = 1, N2_COMPS - image2_buf(k,j,i) = char(65 + k - 1) -40 continue -50 continue -60 continue - -C -C Define the size of the data to be written, i.e., start from the origin -C and go as long as the length of each dimension. -C - start2(1) = 0 - start2(2) = 0 - edges2(1) = dim_sizes(1) - edges2(2) = dim_sizes(2) - stride2(1) = 1 - stride2(2) = 1 -C -C Write the data in the buffer into the image array. -C - status = mgwrimg(ri2_id, start2, stride2, edges2, image2_buf) - -C -C Terminate access to the raster images and to the GR interface, -C and close the HDF file. -C - status = mgendac(ri1_id) - status = mgendac(ri2_id) - status = mgend(gr_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/GR_read_image.f b/hdf/fortran/examples/GR_read_image.f deleted file mode 100644 index 7cb4522f7a..0000000000 --- a/hdf/fortran/examples/GR_read_image.f +++ /dev/null @@ -1,136 +0,0 @@ - program read_raster_image - implicit none -C -C Parameter declaration -C - character*19 FILE_NAME - integer X_LENGTH - integer Y_LENGTH - integer N_COMPS -C - parameter (FILE_NAME = 'General_RImages.hdf', - + X_LENGTH = 10, - + Y_LENGTH = 5, - + N_COMPS = 2) - integer PART_COLS, PART_ROWS, SKIP_COLS, SKIP_ROWS - integer COLS_PART_START, ROWS_PART_START - integer COLS_SKIP_START, ROWS_SKIP_START - integer N_STRIDES - parameter (PART_COLS = 3, PART_ROWS = 2, - + SKIP_COLS = 3, SKIP_ROWS = 5, - + COLS_PART_START = 1, ROWS_PART_START = 3, - + COLS_SKIP_START = 0, ROWS_SKIP_START = 1, - + N_STRIDES = 2) - integer DFACC_READ - parameter (DFACC_READ = 1) -C -C Function declaration -C - integer hopen, hclose - integer mgstart, mgselct, mgrdimg, mgendac, mgend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id - integer gr_id, ri_id - integer start(2), stride(2), edges(2) - integer i, j - integer*2 entire_image(N_COMPS, X_LENGTH, Y_LENGTH) - integer*2 partial_image(N_COMPS, PART_ROWS, PART_COLS) - integer*2 skipped_image(N_COMPS, SKIP_ROWS, SKIP_COLS) -C -C**** End of variable declaration ************************************ -C -C -C Open the HDF file for reading. -C - file_id = hopen(FILE_NAME, DFACC_READ, 0) -C -C Initialize the GR interface. -C - gr_id = mgstart(file_id) -C -C Select the first raster image in the file. -C - ri_id = mgselct(gr_id, 0) -C -C Define the size of the data to be read, i.e., start from the origin -C and go as long as the length of each dimension. -C - start(1) = 0 - start(2) = 0 - edges(1) = X_LENGTH - edges(2) = Y_LENGTH - stride(1) = 1 - stride(2) = 1 -C -C Read the data from the raster image array. -C - status = mgrdimg(ri_id, start, stride, edges, entire_image) -C -C Display only the first component of the image since the two components -C have the same data in this example. -C - write(*,*) 'First component of the entire image' - write(*,*) - do 10 i = 1, X_LENGTH - write(*,1000) (entire_image(1,i,j), j = 1, Y_LENGTH) -10 continue - write(*,*) -C -C Define the size of the data to be read. -C - start(1) = ROWS_PART_START - start(2) = COLS_PART_START - edges(1) = PART_ROWS - edges(2) = PART_COLS - stride(1) = 1 - stride(2) = 1 -C -C Read a subset of the raster image array. -C - status = mgrdimg(ri_id, start, stride, edges, partial_image) -C -C Display only the first component of the read sample. -C - write(*,*) - + 'Two rows and three columns at 4th row and 2nd column', - + ' of the first component' - write(*,*) - do 20 i = 1, PART_ROWS - write(*,1000) (partial_image(1,i,j), j = 1, PART_COLS) -20 continue - write(*,*) -C -C Define the size and the pattern to read the data. -C - start(1) = ROWS_SKIP_START - start(2) = COLS_SKIP_START - edges(1) = SKIP_ROWS - edges(2) = SKIP_COLS - stride(1) = N_STRIDES - stride(2) = N_STRIDES -C -C Read all the odd rows and even columns of the image. -C - status = mgrdimg(ri_id, start, stride, edges, skipped_image) -C -C Display only the first component of the read sample. -C - write(*,*) 'All even rows and odd columns of the first component' - write(*,*) - do 30 i = 1, SKIP_ROWS - write(*,1000) (skipped_image(1,i,j), j = 1, SKIP_COLS) -30 continue - write(*,*) -C -C Terminate access to the raster image and to the GR interface, -C and close the HDF file. -C - status = mgendac(ri_id) - status = mgend(gr_id) - status = hclose(file_id) -1000 format(1x, 5(I4)) - end diff --git a/hdf/fortran/examples/GR_read_palette.f b/hdf/fortran/examples/GR_read_palette.f deleted file mode 100644 index bf687762e1..0000000000 --- a/hdf/fortran/examples/GR_read_palette.f +++ /dev/null @@ -1,84 +0,0 @@ - program read_palette - implicit none -C -C Parameter declaration -C - character*22 FILE_NAME - character*18 IMAGE_NAME - integer N_ENTRIES - integer N_COMPS_PAL -C - parameter (FILE_NAME = 'Image_with_Palette.hdf', - + IMAGE_NAME = 'Image with Palette', - + N_COMPS_PAL = 3, - + N_ENTRIES = 256) - integer DFACC_READ, DFNT_CHAR8, DFNT_UINT8, MFGR_INTERLACE_PIXEL - parameter (DFACC_READ = 1, - + DFNT_CHAR8 = 4, - + DFNT_UINT8 = 21, - + MFGR_INTERLACE_PIXEL = 0) -C -C Function declaration -C - integer hopen, hclose - integer mgstart, mgn2ndx, mgselct, mggltid, mgglinf, - + mgrclut, mgendac, mgend -C -C**** Variable declaration ******************************************* -C - integer file_id, gr_id, ri_id, ri_index, pal_id, pal_index - integer interlace_mode - integer data_type, n_comps, n_entries_out - integer status - integer i, j - character palette_data(N_COMPS_PAL, N_ENTRIES) -C -C**** End of variable declaration ************************************ -C -C -C Open the file. -C - file_id = hopen(FILE_NAME, DFACC_READ, 0) -C -C Initialize the GR interface. -C - gr_id = mgstart(file_id) -C -C Get the index of the image IMAGE_NAME. -C - ri_index = mgn2ndx(gr_id, IMAGE_NAME) -C -C Get the image identifier. -C - ri_id = mgselct(gr_id, 0) -C -C Get the identifier of the palette attached to the image. -C - pal_index = 0 - pal_id = mggltid(ri_id, pal_index) -C -C Obtain information about the palette. -C - status = mgglinf(pal_id, n_comps, data_type, interlace_mode, - + n_entries_out) - write(*,*) ' Palette: ', n_comps, ' components; ', - + n_entries_out, ' entries' -C -C Read the palette. -C - status = mgrclut(pal_id, palette_data) -C -C Display the palette data. -C - write(*,*) "Palette data" - do 10 i = 1, n_entries_out - write(*,*) (ichar(palette_data(j,i)), j = 1, n_comps) -10 continue -C -C Terminate access to the raster image and to the GR interface, -C and close the HDF file. -C - status = mgendac(ri_id) - status = mgend(gr_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/GR_set_attribute.f b/hdf/fortran/examples/GR_set_attribute.f deleted file mode 100644 index b7cc2001c8..0000000000 --- a/hdf/fortran/examples/GR_set_attribute.f +++ /dev/null @@ -1,97 +0,0 @@ - program set_attribute - implicit none -C -C Parameter declaration -C - character*19 FILE_NAME - character*13 IMAGE_NAME - character*16 F_ATT1_NAME - character*16 F_ATT2_NAME - character*17 RI_ATT1_NAME - character*17 RI_ATT2_NAME - character*32 F_ATT1_VAL - character*33 F_ATT2_VAL - integer F_ATT1_N_VALUES - integer F_ATT2_N_VALUES - character*35 RI_ATT1_VAL - integer RI_ATT1_N_VALUES - integer RI_ATT2_N_VALUES -C - parameter (FILE_NAME = 'General_RImages.hdf', - + IMAGE_NAME = 'Image Array 2', - + F_ATT1_NAME = 'File Attribute 1', - + F_ATT2_NAME = 'File Attribute 2', - + RI_ATT1_NAME = 'Image Attribute 1', - + RI_ATT2_NAME = 'Image Attribute 2', - + F_ATT1_VAL = 'Contents of First FILE Attribute', - + F_ATT2_VAL = 'Contents of Second FILE Attribute', - + F_ATT1_N_VALUES = 32, - + F_ATT2_N_VALUES = 33, - + RI_ATT1_VAL = 'Contents of IMAGE''s First Attribute', - + RI_ATT1_N_VALUES = 35, - + RI_ATT2_N_VALUES = 6) - integer DFACC_WRITE, DFNT_INT16, DFNT_CHAR8 - parameter (DFACC_WRITE = 2, - + DFNT_CHAR8 = 4, - + DFNT_INT16 = 22) -C -C Function declaration -C - integer hopen, hclose - integer mgstart, mgscatt, mgsnatt , mgn2ndx, - + mgselct, mgendac, mgend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id, gr_id, ri_id, ri_index - integer*2 ri_attr_2(RI_ATT2_N_VALUES) - integer i - - do 10 i = 1, RI_ATT2_N_VALUES - ri_attr_2(i) = i -10 continue -C -C**** End of variable declaration ************************************ -C -C -C Open the HDF file. -C - file_id = hopen(FILE_NAME, DFACC_WRITE, 0) -C -C Initialize the GR interface. -C - gr_id = mgstart(file_id) -C -C Set two file attributes to the file with names, data type, numbers of -C values, and values of attributes specified. -C - status = mgscatt(gr_id, F_ATT1_NAME, DFNT_CHAR8, - + F_ATT1_N_VALUES, F_ATT1_VAL) - status = mgscatt(gr_id, F_ATT2_NAME, DFNT_CHAR8, - + F_ATT2_N_VALUES, F_ATT2_VAL) -C -C Obtain the index of the image named IMAGE_NAMR. -C - ri_index = mgn2ndx(gr_id, IMAGE_NAME) -C -C Obtain the identifier of this image. -C - ri_id = mgselct(gr_id, ri_index) -C -C Set two attributes of the image with names, data types, number of -C values, and values of the attributes specified. -C - status = mgscatt(ri_id, RI_ATT1_NAME, DFNT_CHAR8, - + RI_ATT1_N_VALUES, RI_ATT1_VAL) - status = mgsnatt(ri_id, RI_ATT2_NAME, DFNT_INT16, - + RI_ATT2_N_VALUES, ri_attr_2) -C -C Terminate access to the image and to the GR interface, -C and close the HDF file. -C - status = mgendac(ri_id) - status = mgend(gr_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/GR_write_palette.f b/hdf/fortran/examples/GR_write_palette.f deleted file mode 100644 index 42ad6a9214..0000000000 --- a/hdf/fortran/examples/GR_write_palette.f +++ /dev/null @@ -1,116 +0,0 @@ - program write_palette - implicit none -C -C Parameter declaration -C - character*22 FILE_NAME - character*18 NEW_IMAGE_NAME - integer X_LENGTH - integer Y_LENGTH - integer N_ENTRIES - integer N_COMPS_IMG - integer N_COMPS_PAL -C - parameter (FILE_NAME = 'Image_with_Palette.hdf', - + NEW_IMAGE_NAME = 'Image with Palette', - + X_LENGTH = 5, - + Y_LENGTH = 5, - + N_ENTRIES = 256, - + N_COMPS_IMG = 2, - + N_COMPS_PAL = 3) - integer DFACC_CREATE, DFNT_CHAR8, DFNT_UINT8, MFGR_INTERLACE_PIXEL - parameter (DFACC_CREATE = 4, - + DFNT_CHAR8 = 4, - + DFNT_UINT8 = 21, - + MFGR_INTERLACE_PIXEL = 0) -C -C Function declaration -C - integer hopen, hclose - integer mgstart, mgcreat, mgwcimg, mggltid, mgwclut, - + mgendac, mgend -C -C**** Variable declaration ******************************************* -C - integer file_id, gr_id, ri_id, pal_id - integer interlace_mode - integer start(2), stride(2), edges(2), dim_sizes(2) - integer status - integer i, j - character image_buf(N_COMPS_IMG, X_LENGTH, Y_LENGTH) - character palette_buf(N_COMPS_PAL, N_ENTRIES) -C -C**** End of variable declaration ************************************ -C -C -C Create and open the file. -C - file_id = hopen(FILE_NAME, DFACC_CREATE, 0) -C -C Initialize the GR interface. -C - gr_id = mgstart(file_id) -C -C Define interlace mode and dimensions of the image. -C - interlace_mode = MFGR_INTERLACE_PIXEL - dim_sizes(1) = X_LENGTH - dim_sizes(2) = Y_lENGTH -C -C Create the raster image array. -C - ri_id = mgcreat(gr_id, NEW_IMAGE_NAME, N_COMPS_IMG, DFNT_CHAR8, - + interlace_mode, dim_sizes) -C -C Fill the image data buffer with values. -C - do 20 i = 1, Y_LENGTH - do 10 j = 1, X_LENGTH - image_buf(1,j,i) = char(i + j - 1 ) - image_buf(2,j,i) = char(i + j) -10 continue -20 continue - -C -C Define the size of the data to be written, i.e., start from the origin -C and go as long as the length of each dimension. -C - start(1) = 0 - start(2) = 0 - edges(1) = X_LENGTH - edges(2) = Y_LENGTH - stride(1) = 1 - stride(2) = 1 -C -C Write the data in the buffer into the image array. -C - status = mgwcimg(ri_id, start, stride, edges, image_buf) -C -C Initilaize the palette buffer to grayscale. -C - do 40 i = 1, N_ENTRIES - do 30 j = 1, N_COMPS_PAL - palette_buf(j,i) = char(i) -30 continue -40 continue -C -C Get the identifier of the palette attached to the image NEW_IMAGE_NAME. -C - pal_id = mggltid(ri_id, 0) -C -C Set palette interlace mode. -C - interlace_mode = MFGR_INTERLACE_PIXEL -C -C Write data to the palette. -C - status = mgwclut(pal_id, N_COMPS_PAL, DFNT_UINT8, interlace_mode, - + N_ENTRIES, palette_buf) -C -C Terminate access to the raster image and to the GR interface, -C and close the HDF file. -C - status = mgendac(ri_id) - status = mgend(gr_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/Makefile.am b/hdf/fortran/examples/Makefile.am deleted file mode 100644 index d5abe77407..0000000000 --- a/hdf/fortran/examples/Makefile.am +++ /dev/null @@ -1,89 +0,0 @@ -############################################################################# -## Setup for building programs ## -############################################################################# - -include $(top_srcdir)/config/commence.am - -DEFINES=-DHDF - -############################################################################# -## Programs to build ## -############################################################################# - -EXAMPLE_PROG = VD_create_vdatas VD_write_mixed_vdata \ - VD_write_to_vdata VD_create_onefield_vdatas \ - VD_read_from_vdata VD_read_mixed_vdata \ - VD_get_vdata_info VD_locate_vdata VG_create_vgroup \ - VG_add_sds_to_vgroup VG_insert_vdatas_to_vgroup \ - VG_set_get_vgroup_attr VG_vgroup_contents \ - VG_get_vgroup_info GR_create_and_write_image \ - GR_modify_image GR_set_attribute GR_get_attribute \ - GR_write_palette GR_image_info GR_read_image \ - AN_create_annotation AN_get_annotation_info AN_read_annotation - # VD_set_get_vdata_attr -TEST_PROG = $(EXAMPLE_PROG) - -# These are the Fortran example files to be installed -INSTALL_FILES= VD_read_from_vdata.f VD_read_mixed_vdata.f \ - VD_write_mixed_vdata.f VD_write_to_vdata.f \ - VD_create_onefield_vdatas.f VD_create_vdatas.f \ - VD_get_vdata_info.f VD_locate_vdata.f \ - VG_insert_vdatas_to_vgroup.f VG_set_get_vgroup_attr.f \ - VG_vgroup_contents.f VG_add_sds_to_vgroup.f \ - VG_create_vgroup.f VG_get_vgroup_info.f \ - GR_create_and_write_image.f GR_get_attribute.f \ - GR_image_info.f GR_modify_image.f GR_read_image.f \ - GR_read_palette.f GR_set_attribute.f \ - GR_write_palette.f AN_create_annotation.f \ - AN_get_annotation_info.f AN_read_annotation.f \ - #VD_set_get_vdata_attr.f - -INSTALL_SCRIPT_FILES = run-fortran-ex.sh - -# Where to install Fortran example files -EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf4_examples/fortran - -# How to build Fortran programs using h4fc -$(EXTRA_PROG): $(H4FC) - $(H4FC) $(H4FCFLAGS) $(FFLAGS) -o $@ $(srcdir)/$@.f; - -# List dependencies for each program. Normally, automake would take -# care of this for us, but if we tell automake about the programs it -# will try to build them with the normal Fortran compiler, not h4fc. - -# Fortran Programs -VD_read_from_vdata: $(srcdir)/VD_read_from_vdata.f -VD_read_mixed_vdata: $(srcdir)/VD_read_mixed_vdata.f -#VD_set_get_vdata_attr: $(srcdir)/VD_set_get_vdata_attr.f -VD_write_mixed_vdata: $(srcdir)/VD_write_mixed_vdata.f -VD_write_to_vdata: $(srcdir)/VD_write_to_vdata.f -VD_create_onefield_vdatas: $(srcdir)/VD_create_onefield_vdatas.f -VD_create_vdatas: $(srcdir)/VD_create_vdatas.f -VD_get_vdata_info: $(srcdir)/VD_get_vdata_info.f -VD_locate_vdata: $(srcdir)/VD_locate_vdata.f -VG_insert_vdatas_to_vgroup: $(srcdir)/VG_insert_vdatas_to_vgroup.f -VG_set_get_vgroup_attr: $(srcdir)/VG_set_get_vgroup_attr.f -VG_vgroup_contents: $(srcdir)/VG_vgroup_contents.f -VG_add_sds_to_vgroup: $(srcdir)/VG_add_sds_to_vgroup.f -VG_create_vgroup: $(srcdir)/VG_create_vgroup.f -VG_get_vgroup_info: $(srcdir)/VG_get_vgroup_info.f -GR_create_and_write_image: $(srcdir)/GR_create_and_write_image.f -GR_get_attribute: $(srcdir)/GR_get_attribute.f -GR_image_info: $(srcdir)/GR_image_info.f -GR_modify_image: $(srcdir)/GR_modify_image.f -GR_read_image: $(srcdir)/GR_read_image.f -GR_read_palette: $(srcdir)/GR_read_palette.f -GR_set_attribute: $(srcdir)/GR_set_attribute.f -GR_write_palette: $(srcdir)/GR_write_palette.f -AN_create_annotation: $(srcdir)/AN_create_annotation.f -AN_get_annotation_info: $(srcdir)/AN_get_annotation_info.f -AN_read_annotation: $(srcdir)/AN_read_annotation.f - -DISTCLEANFILES = *.chkexe *.chklog - -if BUILD_SHARED_SZIP_CONDITIONAL -LD_LIBRARY_PATH=$(LL_PATH) -endif - -include $(top_srcdir)/config/examples.am -include $(top_srcdir)/config/conclude.am diff --git a/hdf/fortran/examples/VD_create_onefield_vdatas.f b/hdf/fortran/examples/VD_create_onefield_vdatas.f deleted file mode 100644 index 8a21c55627..0000000000 --- a/hdf/fortran/examples/VD_create_onefield_vdatas.f +++ /dev/null @@ -1,79 +0,0 @@ - program create_onefield_vdatas - implicit none -C -C Parameter declaration -C - character*18 FILE_NAME - character*9 CLASS1_NAME - character*9 CLASS2_NAME - character*11 VDATA1_NAME - character*12 VDATA2_NAME - character*22 FIELD1_NAME - character*21 FIELD2_NAME - integer N_RECORDS_1, N_RECORDS_2 - integer ORDER_2 -C - parameter (FILE_NAME = 'General_Vdatas.hdf', - + CLASS1_NAME = '5x1 Array', - + CLASS2_NAME = '6x4 Array', - + VDATA1_NAME = 'First Vdata', - + VDATA2_NAME = 'Second Vdata', - + FIELD1_NAME = 'Single-component Field', - + FIELD2_NAME = 'Multi-component Field') - parameter (N_RECORDS_1 = 5, - + N_RECORDS_2 = 6, - + ORDER_2 = 4) - - integer DFACC_WRITE, DFNT_CHAR8, DFNT_INT32 - parameter (DFACC_WRITE = 2, - + DFNT_CHAR8 = 4, - + DFNT_INT32 = 24) -C -C Function declaration -C - integer hopen, hclose - integer vfstart, vhfscd, vhfsdm, vfend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id - integer vdata1_ref, vdata2_ref - character vdata1_buf(N_RECORDS_1) - integer vdata2_buf(ORDER_2, N_RECORDS_2) - data vdata1_buf /'V','D','A','T','A'/ - data vdata2_buf / 1, 2, 3, 4, - + 2, 4, 6, 8, - + 3, 6, 9, 12, - + 4, 8, 12, 16, - + 5, 10, 15, 20, - + 6, 12, 18, 24/ -C -C**** End of variable declaration ************************************ -C -C -C Open the HDF file for writing. -C - file_id = hopen(FILE_NAME, DFACC_WRITE, 0) -C -C Initialize the VS interface. -C - status = vfstart(file_id) -C -C Create the first vdata and populate it with data from vdata1_buf array. -C - vdata1_ref = vhfscd(file_id, FIELD1_NAME, vdata1_buf, N_RECORDS_1, - + DFNT_CHAR8, VDATA1_NAME, CLASS1_NAME) -C -C Create the second vdata and populate it with data from vdata2_buf array. -C - vdata2_ref = vhfsdm(file_id, FIELD2_NAME, vdata2_buf, N_RECORDS_2, - + DFNT_INT32, VDATA2_NAME, CLASS2_NAME, - + ORDER_2) -C -C Terminate access to the VS interface and close the HDF file. -C - status = vfend(file_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/VD_create_vdatas.f b/hdf/fortran/examples/VD_create_vdatas.f deleted file mode 100644 index 417a3a6786..0000000000 --- a/hdf/fortran/examples/VD_create_vdatas.f +++ /dev/null @@ -1,106 +0,0 @@ - program create_vdatas - implicit none -C -C Parameter declaration -C - character*18 FILE1_NAME - character*14 FILE2_NAME - character*7 VDATA_NAME - character*12 VDATA_CLASS -C - parameter (FILE1_NAME = 'General_Vdatas.hdf', - + FILE2_NAME = 'Two_Vdatas.hdf', - + VDATA_NAME = 'Vdata 1', - + VDATA_CLASS = 'Empty Vdatas') - integer DFACC_CREATE - parameter (DFACC_CREATE = 4) -C -C Function declaration -C - integer hopen, hclose - integer vfstart, vsfatch, vsfsnam, vsfscls, vsfdtch, vfend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file1_id, file2_id - integer vdata_id, vdata1_id, vdata2_id - integer vdata_ref -C -C**** End of variable declaration ************************************ -C -C -C Create the first HDF file. -C - file1_id = hopen(FILE1_NAME, DFACC_CREATE, 0) -C -C Initialize the VS interface associated with the first HDF file. -C - status = vfstart(file1_id) -C -C Create a vdata in the first HDF file. -C - vdata_ref = -1 - vdata_id = vsfatch(file1_id, vdata_ref, 'w') -C -C Assign a name to the vdata. -C - status = vsfsnam(vdata_id, VDATA_NAME) -C -C Other operations on the vdata identified by vdata_id can be carried out -C starting from this point. -C -C Create the second HDF file. -C - file2_id = hopen(FILE2_NAME, DFACC_CREATE, 0) -C -C Initialize the VS interface associated with the second HDF file. -C - status = vfstart(file2_id) -C -C Create the first vdata in the second HDF file. -C - vdata1_id = vsfatch(file2_id, vdata_ref, 'w') -C -C Create the second vdata in the second HDF file. -C - vdata2_id = vsfatch(file2_id, vdata_ref, 'w') -C -C Assign a class name to these vdatas. -C - status = vsfscls(vdata1_id, VDATA_CLASS) - status = vsfscls(vdata2_id, VDATA_CLASS) -C -C Other operations on the vdatas identified by vdata1_id and vdata2_id -C can be carried out starting from this point. -C -C -C Terminate access to the first vdata in the second HDF file. -C - status = vsfdtch(vdata1_id) -C -C Terminate access to the second vdata in the second HDF file. -C - status = vsfdtch(vdata2_id) -C -C Terminate access to the VS interface associated with the second HDF file. -C - status = vfend(file2_id) -C -C Close the second HDF file. -C - status = hclose(file2_id) -C -C Terminate access to the vdata in the first HDF file. -C - status = vsfdtch(vdata_id) -C -C terminate access to the VS interface associated with the first HDF file. -C - status = vfend(file1_id) -C -C Close the first HDF file. -C - status = hclose(file1_id) - end diff --git a/hdf/fortran/examples/VD_get_vdata_info.f b/hdf/fortran/examples/VD_get_vdata_info.f deleted file mode 100644 index 561ae4b080..0000000000 --- a/hdf/fortran/examples/VD_get_vdata_info.f +++ /dev/null @@ -1,95 +0,0 @@ - program vdata_info - implicit none -C -C Parameter declaration -C - character*18 FILE_NAME - integer DFACC_READ, FULL_INTERLACE - integer FIELD_SIZE -C - parameter (FILE_NAME = 'General_Vdatas.hdf', - + DFACC_READ = 1, - + FULL_INTERLACE = 0, - + FIELD_SIZE = 80) - -C -C Function declaration -C - integer hopen, hclose - integer vfstart, vsfatch, vsfgid, vsfinq, - + vsfisat, vsfdtch, vfend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id, vdata_id, vdata_ref - integer n_records, interlace_mode, vdata_size - character*64 vdata_name - character*80 fieldname_list -C -C**** End of variable declaration ************************************ -C -C -C Open the HDF file for reading. -C - file_id = hopen(FILE_NAME, DFACC_READ, 0) -C -C Initialize the VS interface. -C - status = vfstart(file_id) -C -C Set the reference number to -1 to start the search from the beginning -C of the file. -C - vdata_ref = -1 -10 continue -C -C Use vsfgid to obtain each vdata by its reference number then -C attach to the vdata and get information. The loop terminates -C when the last vdata is reached. -C - vdata_ref = vsfgid(file_id, vdata_ref) - if (vdata_ref .eq. -1) goto 100 -C -C Attach to the current vdata for reading. -C - vdata_id = vsfatch(file_id, vdata_ref, 'r') -C -C Test whether the current vdata is not a storage for an attribute, -C then obtain and display its information. - if (vsfisat(vdata_id) .ne. 1) then -C Initialize buffers before getting values back. - vdata_name = ' ' - fieldname_list = ' ' - n_records = -1 - vdata_size = -1 - status = vsfinq(vdata_id, n_records, interlace_mode, - + fieldname_list, vdata_size, vdata_name) - if (status .eq. 0) then - write(*,*) 'Vdata: ', vdata_name - write(*,*) 'contains ', n_records, ' records' - if (interlace_mode .eq. 0) then - write(*,*) 'Interlace mode: FULL' - else - write(*,*) 'Interlace mode: NONE' - endif - write(*,*) 'Fields: ', fieldname_list(1:30) - write(*,*) 'Vdata record size in bytes :', vdata_size - write(*,*) - endif - endif -C -C Detach from the current vdata. -C - status = vsfdtch(vdata_id) - goto 10 -100 continue -C -C Terminate access to the vdata and to the VS interface, and -C close the HDF file. -C - status = vsfdtch(vdata_id) - status = vfend(file_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/VD_locate_vdata.f b/hdf/fortran/examples/VD_locate_vdata.f deleted file mode 100644 index 0f4b7af520..0000000000 --- a/hdf/fortran/examples/VD_locate_vdata.f +++ /dev/null @@ -1,87 +0,0 @@ - program locate_vdata - implicit none -C -C Parameter declaration -C - character*18 FILE_NAME - character*20 SEARCHED_FIELDS -C - parameter (FILE_NAME = 'General_Vdatas.hdf', - + SEARCHED_FIELDS = 'Position,Temperature') - integer DFACC_READ - parameter (DFACC_READ = 1) -C -C Function declaration -C - integer hopen, hclose - integer vfstart, vsfatch, vsfgid, vsfex, vsfdtch, vfend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id, vdata_id, vdata_ref - integer index - logical found_fields -C -C**** End of variable declaration ************************************ -C -C -C Open the HDF file for reading. -C - file_id = hopen(FILE_NAME, DFACC_READ, 0) -C -C Initialize the VS interface. -C - status = vfstart(file_id) - index = 0 -C -C Set the reference number to -1 to start the search from the beginning -C of the file. -C - vdata_ref = -1 -C -C Assume that the specified fields are not found in the current vdata. -C - found_fields = .FALSE. -10 continue -C -C Use vsfgid to obtain each vdata by its reference number then -C attach to the vdata and search for the fields. The loop terminates -C when the last vdata is reached or when a vdata which contains the -C fields listed in SEARCHED_FIELDS is found. -C - vdata_ref = vsfgid(file_id, vdata_ref) - if (vdata_ref .eq. -1) goto 100 - vdata_id = vsfatch(file_id, vdata_ref, 'r') - status = vsfex(vdata_id, SEARCHED_FIELDS) - if (status .ne. -1) then - found_fields = .TRUE. - goto 100 - endif - status = vsfdtch(vdata_id) - index = index + 1 - goto 10 -100 continue -C -C Print the index of the vdata containing the fields or a 'not found' -C message if no such vdata is found. Also detach from the vdata found. -C - if(.NOT.found_fields) then - write(*,*) 'Fields Positions and Temperature were not found' - else - write(*,*) - + 'Fields Positions and Temperature were found in the vdata', - + ' at position ', index -C -C Terminate access to the vdata -C - status = vsfdtch(vdata_id) - endif -C -C Terminate access to the VS interface and close the HDF file. -C - status = vsfdtch(vdata_id) - status = vfend(file_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/VD_read_from_vdata.f b/hdf/fortran/examples/VD_read_from_vdata.f deleted file mode 100644 index 3274450cb9..0000000000 --- a/hdf/fortran/examples/VD_read_from_vdata.f +++ /dev/null @@ -1,93 +0,0 @@ - program read_from_vdata - implicit none -C -C Parameter declaration -C - character*18 FILE_NAME - character*14 VDATA_NAME - character*20 FIELDNAME_LIST - integer N_RECORDS, RECORD_INDEX - integer ORDER_1, ORDER_2 - integer N_VALS_PER_REC -C - parameter (FILE_NAME = 'General_Vdatas.hdf', - + VDATA_NAME = 'Solid Particle', - + FIELDNAME_LIST = 'Position,Temperature') - parameter (N_RECORDS = 5, - + RECORD_INDEX = 3, - + ORDER_1 = 3, - + ORDER_2 = 2, - + N_VALS_PER_REC = ORDER_1 + ORDER_2 ) - - integer DFACC_READ, FULL_INTERLACE - parameter (DFACC_READ = 1, - + FULL_INTERLACE = 0) -C -C Function declaration -C - integer hopen, hclose - integer vfstart, vsffnd, vsfatch, vsfsfld, vsfrd, vsfseek, - + vsfdtch, vfend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id, vdata_id - integer vdata_ref, rec_num, num_of_records, rec_pos - real databuf(N_VALS_PER_REC, N_RECORDS) - integer i -C -C**** End of variable declaration ************************************ -C -C -C Open the HDF file for reading. -C - file_id = hopen(FILE_NAME, DFACC_READ, 0) -C -C Initialize the VS interface. -C - status = vfstart(file_id) -C -C Get the reference number of the vdata, whose name is specified in -C VDATA_NAME, using vsffnd, which will be discussed in Section 4.7.3. -C - vdata_ref = vsffnd(file_id, VDATA_NAME) -C -C Attach to the vdata for reading if it is found, -C otherwise exit the program. -C - if (vdata_ref .eq. 0) stop - vdata_id = vsfatch(file_id, vdata_ref, 'r') -C -C Specify the fields that will be read. -C - status = vsfsfld(vdata_id, FIELDNAME_LIST) -C -C Place the current point to the position specified in RECORD_INDEX. -C - rec_pos = vsfseek(vdata_id, RECORD_INDEX) -C -C Read the next N_RECORDS from the vdata and store the data in the buffer -C databuf with fully interlace mode. -C - num_of_records = vsfrd(vdata_id, databuf, N_RECORDS, - + FULL_INTERLACE) -C -C Display the read data as many records as the number of records returned -C by vsfrd. -C - write(*,*) ' Particle Position Temperature Range' - write(*,*) - do 10 rec_num = 1, num_of_records - write(*,1000) (databuf(i, rec_num), i = 1, N_VALS_PER_REC) -10 continue -1000 format(1x,3(f6.2), 8x,2(f6.2)) -C -C Terminate access to the vdata and to the VS interface, and -C close the HDF file. -C - status = vsfdtch(vdata_id) - status = vfend(file_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/VD_read_mixed_vdata.f b/hdf/fortran/examples/VD_read_mixed_vdata.f deleted file mode 100644 index a71841a36a..0000000000 --- a/hdf/fortran/examples/VD_read_mixed_vdata.f +++ /dev/null @@ -1,106 +0,0 @@ - program read_mixed_vdata - implicit none -C -C Parameter declaration -C - character*16 FILE_NAME - character*16 VDATA_NAME - character*4 FIELD1_NAME - character*5 FIELD2_NAME - character*10 FIELDNAME_LIST - integer N_RECORDS, N_FIELDS - integer BUFFER_SIZE -C - parameter (FILE_NAME = 'Packed_Vdata.hdf', - + VDATA_NAME = 'Mixed Data Vdata', - + FIELD1_NAME = 'Temp', - + FIELD2_NAME = 'Ident', - + FIELDNAME_LIST = 'Temp,Ident') - parameter (N_RECORDS = 20, - + N_FIELDS = 2, - + BUFFER_SIZE = (4 + 1)*N_RECORDS) - - integer DFACC_READ, DFNT_FLOAT32, DFNT_CHAR8, - + FULL_INTERLACE, HDF_VSUNPACK - parameter (DFACC_READ = 1, - + DFNT_FLOAT32 = 5, - + DFNT_CHAR8 = 4, - + FULL_INTERLACE = 0, - + HDF_VSUNPACK = 1) -C -C Function declaration -C - integer hopen, hclose - integer vfstart, vsfatch, vsffnd, vsfsfld, - + vsfnpak, vsfcpak, vsfread, vsfdtch, vfend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id, vdata_id - integer vdata_ref, num_of_records - real temp(N_RECORDS) - character ident(N_RECORDS) - integer i -C -C Buffer for read packed data should be big enough to hold N_RECORDS. -C - integer databuf(BUFFER_SIZE/4 + 1) -C -C**** End of variable declaration ************************************ -C -C -C Open the HDF file for reading. -C - file_id = hopen(FILE_NAME, DFACC_READ, 0) -C -C Initialize the VS interface. -C - status = vfstart(file_id) -C -C Get the reference number of the vdata, whose name is specified in -C VDATA_NAME, using vsffnd, which will be discussed in Section 4.7.3. -C - vdata_ref = vsffnd(file_id, VDATA_NAME) -C -C Attach to the vdata for reading if it is found, -C otherwise exit the program. -C - if (vdata_ref .eq. 0) stop - vdata_id = vsfatch(file_id, vdata_ref, 'r') -C -C Specify the fields that will be read. -C - status = vsfsfld(vdata_id, FIELDNAME_LIST) - -C -C Read N_RECORDS records of the vdata and store the values into the databuf. -C - num_of_records = vsfread(vdata_id, databuf, N_RECORDS, - + FULL_INTERLACE) -C -C Unpack N_RECORDS from databuf into temp and ident arrays. -C In Fortran, each field is unpacked using separate calls to -C vsfnpak or vsfcpak. -C - status = vsfnpak(vdata_id, HDF_VSUNPACK, FIELDNAME_LIST, databuf, - + BUFFER_SIZE, num_of_records, FIELD1_NAME, temp) - status = vsfcpak(vdata_id, HDF_VSUNPACK, FIELDNAME_LIST, databuf, - + BUFFER_SIZE, num_of_records, FIELD2_NAME, ident) -C -C Display the read data being stored in the field databufs. -C - write (*,*) ' Temp Ident' - do 10 i = 1, num_of_records - write(*,1000) temp(i), ident(i) -10 continue -1000 format (3x,F6.2, 4x, a) -C -C Terminate access to the vdata and to the VS interface, and -C close the HDF file. -C - status = vsfdtch(vdata_id) - status = vfend(file_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/VD_set_get_vdata_attr.f b/hdf/fortran/examples/VD_set_get_vdata_attr.f deleted file mode 100644 index 77b7656f5d..0000000000 --- a/hdf/fortran/examples/VD_set_get_vdata_attr.f +++ /dev/null @@ -1,134 +0,0 @@ - program vdata_attributes - implicit none -C -C Parameter declaration -C - character*18 FILE_NAME - character*14 VDATA_NAME - character*4 FIELD_NAME - character*10 VATTR_NAME - character*6 FATTR_NAME - integer VATTR_N_VALUES, FATTR_N_VALUES -C - parameter (FILE_NAME = 'General_Vdatas.hdf', - + VDATA_NAME = 'Solid Particle', - + FIELD_NAME = 'Mass', - + VATTR_NAME = 'Site Ident', - + FATTR_NAME = 'Scales') - parameter (VATTR_N_VALUES = 3, - + FATTR_N_VALUES = 4) - - integer DFACC_WRITE, FULL_INTERLACE, HDF_VDATA - integer DFNT_INT32, DFNT_CHAR8 - parameter (DFACC_WRITE = 2, - + FULL_INTERLACE = 0, - + HDF_VDATA = -1, - + DFNT_INT32 = 24, - + DFNT_CHAR8 = 4) -C -C Function declaration -C - integer hopen, hclose - integer vfstart, vsffnd, vsfatch, vsfscat, vsfsnat, - + vsffnas, vsffidx, vsfnats, vsfainf, vsfgcat, vsfgnat, - + vsfdtch, vfend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id, vdata_id, vdata_ref - integer field_index, n_vdattrs, n_fldattrs - integer vdata_type, vdata_n_values, vdata_size - integer field_type, field_n_values, field_size - character vd_attr(VATTR_N_VALUES) - integer fld_attr(FATTR_N_VALUES) - character vattr_buf(VATTR_N_VALUES) - integer fattr_buf(FATTR_N_VALUES) - character vattr_name_out(30), fattr_name_out(30) - data vd_attr /'A', 'B', 'C'/ - data fld_attr /2, 4, 6, 8/ -C -C**** End of variable declaration ************************************ -C -C -C Open the HDF file for writing. -C - file_id = hopen(FILE_NAME, DFACC_WRITE, 0) -C -C Initialize the VS interface. -C - status = vfstart(file_id) -C -C Get the reference number of the vdata named VDATA_NAME. -C - vdata_ref = vsffnd(file_id, VDATA_NAME) -C -C Attach to the vdata for writing. -C - vdata_id = vsfatch(file_id, vdata_ref, 'w') -C -C Attach an attribute to the vdata, as it is indicated by second parameter. -C - status = vsfscat(vdata_id, HDF_VDATA, VATTR_NAME, DFNT_CHAR8, - + VATTR_N_VALUES, vd_attr) -C -C Get the index of the field FIELD_NAME within the vdata. -C - status = vsffidx(vdata_id, FIELD_NAME, field_index) -C -C Attach an attribute to the field with the index field_index. -C - status = vsfsnat(vdata_id, field_index, FATTR_NAME, DFNT_INT32, - + FATTR_N_VALUES, fld_attr) - -C -C Get the number of attributes attached to the vdata's first -C field - should be 0. -C - n_fldattrs = vsffnas(vdata_id, 0) - write(*,*) 'Number of attributes of the first field' - write(*,*) ' of the vdata: ', n_fldattrs -C -C Get the number of the attributes attached to the field specified by -C index field_index - should be 1. -C - n_fldattrs = vsffnas(vdata_id, field_index) - write(*,*) 'Number of attributes of field ', FIELD_NAME, - + n_fldattrs -C -C Get the total number of the field's and vdata's attributes - should be 2. -C - n_vdattrs = vsfnats(vdata_id) - write(*,*) 'Number of attributes of the vdata and its fields: ', - + n_vdattrs -C -C Get information about the vdata's first attribute, indicated by -C the third parameter, which is the index of the attribute. -C - status = vsfainf(vdata_id, HDF_VDATA, 0, vattr_name_out, - + vdata_type, vdata_n_values, vdata_size) -C -C Get information about the first attribute of the field specified by -C field_index. -C - status = vsfainf(vdata_id, field_index, 0, fattr_name_out, - + field_type, field_n_values, field_size) -C -C Get the vdata's first attribute. -C - status = vsfgcat(vdata_id, HDF_VDATA, 0, vattr_buf) - write(*,*) 'Values of vdata attribute ', vattr_buf -C -C Get the first attribute of the field specified by field_index. -C - status = vsfgnat(vdata_id, field_index, 0, fattr_buf) - write(*,*) 'Values of the field attribute = ', fattr_buf -C -C Terminate access to the vdata and to the VS interface, and -C close the HDF file. -C - status = vsfdtch(vdata_id) - status = vfend(file_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/VD_write_mixed_vdata.f b/hdf/fortran/examples/VD_write_mixed_vdata.f deleted file mode 100644 index 17e2b9e29e..0000000000 --- a/hdf/fortran/examples/VD_write_mixed_vdata.f +++ /dev/null @@ -1,126 +0,0 @@ - program write_mixed_vdata - implicit none -C -C Parameter declaration -C - character*16 FILE_NAME - character*18 CLASS_NAME - character*16 VDATA_NAME - character*4 FIELD1_NAME - character*6 FIELD2_NAME - character*5 FIELD3_NAME - character*5 FIELD4_NAME - character*23 FIELDNAME_LIST - integer N_RECORDS, N_FIELDS, ORDER - integer BUF_SIZE -C - parameter (FILE_NAME = 'Packed_Vdata.hdf', - + CLASS_NAME = 'General Data Class', - + VDATA_NAME = 'Mixed Data Vdata', - + FIELD1_NAME = 'Temp', - + FIELD2_NAME = 'Height', - + FIELD3_NAME = 'Speed', - + FIELD4_NAME = 'Ident', - + FIELDNAME_LIST = 'Temp,Height,Speed,Ident') - parameter (N_RECORDS = 20, - + N_FIELDS = 4, - + ORDER = 1, - + BUF_SIZE = (4 + 2 + 4 + 1)*N_RECORDS) - - integer DFACC_WRITE, DFNT_FLOAT32, DFNT_INT16, DFNT_CHAR8, - + FULL_INTERLACE, HDF_VSPACK - parameter (DFACC_WRITE = 2, - + DFNT_FLOAT32 = 5, - + DFNT_INT16 = 22, - + DFNT_CHAR8 = 4, - + FULL_INTERLACE = 0, - + HDF_VSPACK = 0) -C -C Function declaration -C - integer hopen, hclose - integer vfstart, vsfatch, vsfsnam, vsfscls, vsffdef, vsfsfld, - + vsfnpak, vsfcpak, vsfwrit, vsfdtch, vfend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id, vdata_id - integer vdata_ref, num_of_records - real temp(N_RECORDS) - integer*2 height(N_RECORDS) - real speed(N_RECORDS) - character ident(N_RECORDS) - integer i -C -C Buffer for packed data should be big enough to hold N_RECORDS. -C - integer databuf(BUF_SIZE/4 + 1) -C -C**** End of variable declaration ************************************ -C -C -C Open the HDF file for writing. -C - file_id = hopen(FILE_NAME, DFACC_WRITE, 0) -C -C Initialize the VS interface. -C - status = vfstart(file_id) -C -C Create a new vdata. -C - vdata_ref = -1 - vdata_id = vsfatch(file_id, vdata_ref, 'w') -C -C Set name and class name of the vdata. -C - status = vsfsnam(vdata_id, VDATA_NAME) - status = vsfscls(vdata_id, CLASS_NAME) -C -C Introduce each field's name, data type, and order. This is the -C first part in defining a field. -C - status = vsffdef(vdata_id, FIELD1_NAME, DFNT_FLOAT32, ORDER) - status = vsffdef(vdata_id, FIELD2_NAME, DFNT_INT16, ORDER) - status = vsffdef(vdata_id, FIELD3_NAME, DFNT_FLOAT32, ORDER) - status = vsffdef(vdata_id, FIELD4_NAME, DFNT_CHAR8, ORDER) -C -C Finalize the definition of the fields. -C - status = vsfsfld(vdata_id, FIELDNAME_LIST) -C -C Enter data values into the field databufs by the records. -C - do 10 i = 1, N_RECORDS - temp(i) = 1.11 * i - height(i) = i - 1 - speed(i) = 1.11 * i - ident(i) = char(64+i) -10 continue -C -C Pack N_RECORDS of data into databuf. In Fortran, each field is packed -C using separate calls to vsfnpak or vsfcpak. -C - status = vsfnpak(vdata_id, HDF_VSPACK, ' ', databuf, BUF_SIZE, - + N_RECORDS, FIELD1_NAME, temp) - status = vsfnpak(vdata_id, HDF_VSPACK, ' ', databuf, BUF_SIZE, - + N_RECORDS, FIELD2_NAME, height) - status = vsfnpak(vdata_id, HDF_VSPACK, ' ', databuf, BUF_SIZE, - + N_RECORDS, FIELD3_NAME, speed) - status = vsfcpak(vdata_id, HDF_VSPACK, ' ', databuf, BUF_SIZE, - + N_RECORDS, FIELD4_NAME, ident) -C -C Write all the records of the packed data to the vdata. -C - num_of_records = vsfwrit(vdata_id, databuf, N_RECORDS, - + FULL_INTERLACE) -C -C Terminate access to the vdata and to the VS interface, and -C close the HDF file. -C - status = vsfdtch(vdata_id) - status = vfend(file_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/VD_write_to_vdata.f b/hdf/fortran/examples/VD_write_to_vdata.f deleted file mode 100644 index 914718354a..0000000000 --- a/hdf/fortran/examples/VD_write_to_vdata.f +++ /dev/null @@ -1,106 +0,0 @@ - program write_to_vdata - implicit none -C -C Parameter declaration -C - character*18 FILE_NAME - character*13 CLASS_NAME - character*14 VDATA_NAME - character*8 FIELD1_NAME - character*4 FIELD2_NAME - character*11 FIELD3_NAME - character*27 FIELDNAME_LIST - integer N_RECORDS - integer ORDER_1, ORDER_2, ORDER_3 - integer N_VALS_PER_REC -C - parameter (FILE_NAME = 'General_Vdatas.hdf', - + CLASS_NAME = 'Particle Data', - + VDATA_NAME = 'Solid Particle', - + FIELD1_NAME = 'Position', - + FIELD2_NAME = 'Mass', - + FIELD3_NAME = 'Temperature', - + FIELDNAME_LIST = 'Position,Mass,Temperature') - parameter (N_RECORDS = 10, - + ORDER_1 = 3, - + ORDER_2 = 1, - + ORDER_3 = 2, - + N_VALS_PER_REC = ORDER_1 + ORDER_2 + ORDER_3) - - integer DFACC_WRITE, DFNT_FLOAT32, FULL_INTERLACE - parameter (DFACC_WRITE = 2, - + DFNT_FLOAT32 = 5, - + FULL_INTERLACE = 0) -C -C Function declaration -C - integer hopen, hclose - integer vfstart, vsfatch, vsfsnam, vsfscls, vsffdef, vsfsfld, - + vsfwrt, vsfdtch, vfend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id, vdata_id - integer vdata_ref, rec_num, num_of_records - real data_buf(N_VALS_PER_REC, N_RECORDS) -C -C**** End of variable declaration ************************************ -C -C -C Open the HDF file for writing. -C - file_id = hopen(FILE_NAME, DFACC_WRITE, 0) -C -C Initialize the VS interface. -C - status = vfstart(file_id) -C -C Create a new vdata. -C - vdata_ref = -1 - vdata_id = vsfatch(file_id, vdata_ref, 'w') -C -C Set name and class name of the vdata. -C - status = vsfsnam(vdata_id, VDATA_NAME) - status = vsfscls(vdata_id, CLASS_NAME) -C -C Introduce each field's name, data type, and order. This is the -C first part in defining a field. -C - status = vsffdef(vdata_id, FIELD1_NAME, DFNT_FLOAT32, ORDER_1) - status = vsffdef(vdata_id, FIELD2_NAME, DFNT_FLOAT32, ORDER_2) - status = vsffdef(vdata_id, FIELD3_NAME, DFNT_FLOAT32, ORDER_3) -C -C Finalize the definition of the fields. -C - status = vsfsfld(vdata_id, FIELDNAME_LIST) -C -C Buffer the data by the record for fully interlaced mode. Note that the -C first three elements contain the three values of the first field, -C the forth element contains the value of the second field, and the last two -C elements contain the two values of the third field. -C - do 10 rec_num = 1, N_RECORDS - data_buf(1, rec_num) = 1.0 * rec_num - data_buf(2, rec_num) = 2.0 * rec_num - data_buf(3, rec_num) = 3.0 * rec_num - data_buf(4, rec_num) = 0.1 + rec_num - data_buf(5, rec_num) = 0.0 - data_buf(6, rec_num) = 65.0 -10 continue -C -C Write the data from data_buf to the vdata with the full interlacing mode. -C - num_of_records = vsfwrt(vdata_id, data_buf, N_RECORDS, - + FULL_INTERLACE) -C -C Terminate access to the vdata and to the VS interface, and -C close the HDF file. -C - status = vsfdtch(vdata_id) - status = vfend(file_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/VG_add_sds_to_vgroup.f b/hdf/fortran/examples/VG_add_sds_to_vgroup.f deleted file mode 100644 index 54f9085bf1..0000000000 --- a/hdf/fortran/examples/VG_add_sds_to_vgroup.f +++ /dev/null @@ -1,91 +0,0 @@ - program add_SDS_to_a_vgroup - implicit none -C -C Parameter declaration -C - character*19 FILE_NAME - character*7 SDS_NAME - character*9 VG_NAME - character*13 VG_CLASS -C - parameter (FILE_NAME = 'General_Vgroups.hdf', - + SDS_NAME = 'Test SD', - + VG_NAME = 'SD Vgroup', - + VG_CLASS = 'Common Vgroups') - integer DFACC_CREATE, DFACC_WRITE - parameter (DFACC_CREATE = 4, DFACC_WRITE = 2) - integer DFNT_INT32 - parameter (DFNT_INT32 = 24) - integer DFTAG_NDG - parameter (DFTAG_NDG = 720) -C -C Function declaration -C - integer hopen, hclose - integer vfstart, vfatch, vfsnam, vfscls, vfadtr, vfdtch, vfend - integer sfstart, sfcreate, sfid2ref, sfendacc, sfend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id - integer vgroup_id - integer sd_id, sds_id, sds_ref - integer dim_sizes(1), rank -C -C**** End of variable declaration ************************************ -C -C -C Create the HDF file. -C - file_id = hopen(FILE_NAME, DFACC_CREATE, 0) -C -C Initialize the V interface. -C - status = vfstart(file_id) - -C -C Initialize SD interface. -C - sd_id = sfstart(FILE_NAME, DFACC_WRITE) -C -C Set the rank and the size of SDS's dimension. -C - rank = 1 - dim_sizes(1) = 10 -C -C Create the SDS. -C - sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT32, rank, dim_sizes) -C -C Create a vgroup and set its name and class. -C - vgroup_id = vfatch(file_id, -1 , 'w') - status = vfsnam(vgroup_id, VG_NAME) - status = vfscls(vgroup_id, VG_CLASS) -C -C Obtain the reference number of the SDS using its identifier. -C - sds_ref = sfid2ref(sds_id) -C -C Add the SDS to the vgroup. Note: the tag DFTAG_NDG is used -C when adding an SDS. Refer to HDF Reference Manual, Section III, Table 3K, -C for the entire list of tags. -C - status = vfadtr(vgroup_id, DFTAG_NDG, sds_ref) -C -C Terminate access to the SDS and to the SD interface. -C - status = sfendacc(sds_id) - status = sfend(sd_id) -C -C Terminate access to the vgroup. -C - status = vfdtch(vgroup_id) -C -C Terminate access to the V interface and close the HDF file. -C - status = vfend(file_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/VG_create_vgroup.f b/hdf/fortran/examples/VG_create_vgroup.f deleted file mode 100644 index bb894ca155..0000000000 --- a/hdf/fortran/examples/VG_create_vgroup.f +++ /dev/null @@ -1,61 +0,0 @@ - program create_vgroup - implicit none -C -C Parameter declaration -C - character*15 FILE_NAME -C - parameter (FILE_NAME = 'Two_Vgroups.hdf') - integer DFACC_CREATE - parameter (DFACC_CREATE = 4) -C -C Function declaration -C - integer hopen, hclose - integer vfstart, vfatch, vfdtch, vfend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id - integer vgroup1_id, vgroup2_id, vgroup_ref -C -C**** End of variable declaration ************************************ -C -C -C Create the HDF file. -C - file_id = hopen(FILE_NAME, DFACC_CREATE, 0) -C -C Initialize the V interface. -C - status = vfstart(file_id) -C -C Create the first vgroup. Note that the vgroup reference number is set -C to -1 for creating and the access mode is 'w' for writing. -C - vgroup_ref = -1 - vgroup1_id = vfatch(file_id, vgroup_ref, 'w') -C -C Create the second vgroup. -C - vgroup2_id = vfatch(file_id, vgroup_ref, 'w') -C -C Any operations on the vgroups. -C -C .............................. -C -C Terminate access to the first vgroup. -C - status = vfdtch(vgroup1_id) -C -C Terminate access to the second vgroup. -C - status = vfdtch(vgroup2_id) -C -C Terminate access to the V interface and close the HDF file. -C - status = vfend(file_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/VG_get_vgroup_info.f b/hdf/fortran/examples/VG_get_vgroup_info.f deleted file mode 100644 index 0232060c7b..0000000000 --- a/hdf/fortran/examples/VG_get_vgroup_info.f +++ /dev/null @@ -1,97 +0,0 @@ - program getinfo_about_vgroup - implicit none -C -C Parameter declaration -C - character*19 FILE_NAME -C - parameter (FILE_NAME = 'General_Vgroups.hdf') - integer DFACC_READ - parameter (DFACC_READ = 1) - integer SIZE - parameter(SIZE = 10) -C -C Function declaration -C - integer hopen, hclose - integer vfstart, vfatch, vfgnam, vfgcls, vflone, vfdtch, vfend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id - integer vgroup_id - integer lone_vg_number, num_of_lones - character*64 vgroup_name, vgroup_class - integer ref_array(SIZE) - integer i -C -C**** End of variable declaration ************************************ -C -C -C Initialize ref_array. -C - do 10 i = 1, SIZE - ref_array(i) = 0 -10 continue -C -C Open the HDF file for reading. -C - file_id = hopen(FILE_NAME, DFACC_READ, 0) -C -C Initialize the V interface. -C - status = vfstart(file_id) -C -C Get and print the name and class name of all lone vgroups. -C First, call vflone with num_of_lones set to 0 to get the number of -C lone vgroups in the file and check whether size of ref_array is -C big enough to hold reference numbers of ALL lone groups. -C If ref_array is not big enough, exit the program after displaying an -C informative message. -C - num_of_lones = 0 - num_of_lones = vflone(file_id, ref_array, num_of_lones) - if (num_of_lones .gt. SIZE) then - write(*,*) num_of_lones, 'lone vgroups is found' - write(*,*) 'increase the size of ref_array to hold reference ' - write(*,*) 'numbers of all lone vgroups in the file' - stop - endif -C -C If there are any lone groups in the file, -C - if (num_of_lones .gt. 0) then -C -C call vflone again to retrieve the reference numbers into ref_array. -C - num_of_lones = vflone(file_id, ref_array, num_of_lones) -C -C Display the name and class of each vgroup. -C - write(*,*) 'Lone vgroups in the file are:' - - do 20 lone_vg_number = 1, num_of_lones -C -C Attach to the current vgroup, then get and display its name and class. -C Note: the current vgroup must be detached before moving to the next. -C - vgroup_name = ' ' - vgroup_class = ' ' - vgroup_id = vfatch(file_id, ref_array(lone_vg_number), 'r') - status = vfgnam(vgroup_id, vgroup_name) - status = vfgcls(vgroup_id, vgroup_class) - write(*,*) 'Vgroup name ' , vgroup_name - write(*,*) 'Vgroup class ' , vgroup_class - write(*,*) - status = vfdtch(vgroup_id) -20 continue - - endif -C -C Terminate access to the V interface and close the HDF file. -C - status = vfend(file_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/VG_insert_vdatas_to_vgroup.f b/hdf/fortran/examples/VG_insert_vdatas_to_vgroup.f deleted file mode 100644 index 84b5095bd5..0000000000 --- a/hdf/fortran/examples/VG_insert_vdatas_to_vgroup.f +++ /dev/null @@ -1,167 +0,0 @@ - program add_vdatas_to_a_vgroup - implicit none -C -C Parameter declaration -C - character*19 FILE_NAME - character*8 VG_NAME - character*10 VG_CLASS - character*15 VD1_NAME - character*8 VD1_CLASS - character*11 VD2_NAME - character*13 VD2_CLASS - character*9 VD3_NAME - character*4 VD3_CLASS -C - parameter (FILE_NAME = 'General_Vgroups.hdf', - + VG_NAME = 'Vertices', - + VG_CLASS = 'Vertex Set') - parameter (VD1_NAME = 'X,Y Coordinates', - + VD2_NAME = 'Temperature', - + VD3_NAME = 'Node List') - parameter (VD1_CLASS = 'Position', - + VD2_CLASS = 'Property List', - + VD3_CLASS = 'Mesh') - character*2 FIELD1_VD1 - character*2 FIELD2_VD1 - character*3 FIELD_VD2 - character*4 FIELD_VD3 - character*5 FIELDNAME_LIST - parameter (FIELD1_VD1 = 'PX', - + FIELD2_VD1 = 'PY', - + FIELD_VD2 = 'TMP', - + FIELD_VD3 = 'PLIST', - + FIELDNAME_LIST = 'PX,PY') - integer N_RECORDS - parameter (N_RECORDS = 30) - - integer DFACC_WRITE - parameter (DFACC_WRITE = 2) - integer DFNT_FLOAT32, DFNT_INT16 - parameter (DFNT_FLOAT32 = 5, DFNT_INT16 = 22) - integer FULL_INTERLACE - parameter (FULL_INTERLACE = 0) -C -C Function declaration -C - integer hopen, hclose - integer vfstart, vfatch, vfsnam, vfscls, vfinsrt, vfdtch, vfend - integer vsfatch, vsfsnam, vsfscls, vsffdef, vsfsfld, - + vsfwrt, vsfwrtc, vsfdtch - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id - integer vgroup_id - integer vdata1_id, vdata2_id, vdata3_id, vd_index - integer num_of_records - integer i, j, k - real pxy(2,N_RECORDS), tmp(N_RECORDS) - integer plist(3,N_RECORDS) - data pxy /-1.5, 2.3, -1.5, 1.98, -2.4, .67, - + -3.4, 1.46, -.65, 3.1, -.62, 1.23, - + -.4, 3.8, -3.55, 2.3, -1.43, 2.44, - + .23, 1.13, -1.4, 5.43, -1.4, 5.8, - + -3.4, 3.85, -.55, .3, -.21, 1.22, - + -1.44, 1.9, -1.4, 2.8, .94, 1.78, - + -.4, 2.32, -.87, 1.99, -.54, 4.11, - + -1.5, 1.35, -1.4, 2.21, -.22, 1.8, - + -1.1, 4.55, -.44, .54, -1.11, 3.93, - + -.76, 1.9, -2.34, 1.7, -2.2, 1.21/ -C -C**** End of variable declaration ************************************ -C -C -C Open the HDF file for writing. -C - file_id = hopen(FILE_NAME, DFACC_WRITE, 0) -C -C Initialize the V interface. -C - status = vfstart(file_id) -C -C Buffer the data for the third and second vdatas. -C - do 20 i = 1, N_RECORDS - do 10 j = 1, 3 - plist(j,i) = k - k = k+1 -10 continue -20 continue - do 30 i = 1, N_RECORDS - tmp(i) = (i-1) * 10.0 -30 continue -C -C Create a vgroup and set its name and class. -C Note that the vgroup's reference number is set to -1 for creating -C and the access mode is 'w' for writing. -C - vgroup_id = vfatch(file_id, -1 , 'w') - status = vfsnam(vgroup_id, VG_NAME) - status = vfscls(vgroup_id, VG_CLASS) -C -C Create the first vdata then set its name and class. Note that the vdata's -C reference number is set to -1 for creating and the access mode is 'w' for -C writing. -C - vdata1_id = vsfatch(file_id, -1, 'w') - status = vsfsnam(vdata1_id, VD1_NAME) - status = vsfscls(vdata1_id, VD1_CLASS) -C -C Introduce and define the fields of the first vdata. -C - status = vsffdef(vdata1_id, FIELD1_VD1, DFNT_FLOAT32, 1) - status = vsffdef(vdata1_id, FIELD2_VD1, DFNT_FLOAT32, 1) - status = vsfsfld(vdata1_id, FIELDNAME_LIST) -C -C Write the buffered data into the first vdata. -C - num_of_records = vsfwrt(vdata1_id, pxy, N_RECORDS, - + FULL_INTERLACE) -C -C Insert the vdata into the vgroup using its identifier. -C - vd_index = vfinsrt(vgroup_id, vdata1_id) -C -C Detach from the first vdata. -C - status = vsfdtch(vdata1_id) -C -C Create, write, and insert the second vdata to the vgroup using -C steps similar to those used for the first vdata. -C - vdata2_id = vsfatch(file_id, -1, 'w') - status = vsfsnam(vdata2_id, VD2_NAME) - status = vsfscls(vdata2_id, VD2_CLASS) - status = vsffdef(vdata2_id, FIELD_VD2, DFNT_FLOAT32, 1) - status = vsfsfld(vdata2_id, FIELD_VD2) - num_of_records = vsfwrt(vdata2_id, tmp, N_RECORDS, - + FULL_INTERLACE) - vd_index = vfinsrt(vgroup_id, vdata2_id) - status = vsfdtch(vdata2_id) -C -C Create, write, and insert the third vdata to the vgroup using -C steps similar to those used for the first and second vdatas. -C - vdata3_id = vsfatch(file_id, -1, 'w') - status = vsfsnam(vdata3_id, VD3_NAME) - status = vsfscls(vdata3_id, VD3_CLASS) - status = vsffdef(vdata3_id, FIELD_VD3, DFNT_INT16, 3) - status = vsfsfld(vdata3_id, FIELD_VD3) - num_of_records = vsfwrtc(vdata3_id, plist, N_RECORDS, - + FULL_INTERLACE) - vd_index = vfinsrt(vgroup_id, vdata3_id) - status = vsfdtch(vdata3_id) - -C -C Terminate access to the vgroup 'Vertices'. -C - status = vfdtch(vgroup_id) -C -C Terminate access to the V interface and close the HDF file. -C - status = vfend(file_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/VG_set_get_vgroup_attr.f b/hdf/fortran/examples/VG_set_get_vgroup_attr.f deleted file mode 100644 index d7c7892654..0000000000 --- a/hdf/fortran/examples/VG_set_get_vgroup_attr.f +++ /dev/null @@ -1,107 +0,0 @@ - program vgroup_attribute - implicit none -C -C Parameter declaration -C - character*19 FILE_NAME - character*9 VGROUP_NAME - character*15 VGATTR_NAME -C - parameter (FILE_NAME = 'General_Vgroups.hdf', - + VGROUP_NAME = 'SD Vgroup', - + VGATTR_NAME = 'First Attribute') - integer VSET_NEW_VERSION, VSET_VERSION, VSET_OLD_VERSION - parameter (VSET_NEW_VERSION = 4, - + VSET_VERSION = 3, - + VSET_OLD_VERSION = 2) - integer DFACC_WRITE - parameter (DFACC_WRITE = 2) - integer DFNT_CHAR - parameter (DFNT_CHAR = 4) - integer N_ATT_VALUES - parameter (N_ATT_VALUES = 6) -C -C Function declaration -C - integer hopen, hclose - integer vfstart, vfatch, vfgver, vfscatt, vfnatts, vfainfo, - + vfind, vfgcatt, vfdtch, vfend -C -C**** Variable declaration ******************************************* -C - integer status, n_attrs - integer file_id - integer vgroup_id, vgroup_ref, vg_version - integer attr_index, i - integer data_type, n_values, size - character vg_attr(N_ATT_VALUES) - character vgattr_buf(N_ATT_VALUES), attr_name(30) - data vg_attr /'v','g','r','o','u','p'/ -C -C**** End of variable declaration ************************************ -C -C -C Open the HDF file for reading/writing. -C - file_id = hopen(FILE_NAME, DFACC_WRITE, 0) -C -C Initialize the V interface. -C - status = vfstart(file_id) -C -C Get the reference number of the vgroup named VGROUP_NAME. -C - vgroup_ref = vfind(file_id, VGROUP_NAME) -C -C Attach to the vgroup found. -C - vgroup_id = vfatch(file_id, vgroup_ref , 'w') -C -C Get and display the version of the attached vgroup. -C - vg_version = vfgver(vgroup_id) - if (vg_version .eq. VSET_NEW_VERSION) write(*,*) - + VGROUP_NAME, ' is of the newest version, version 4' - if (vg_version .eq. VSET_VERSION) write(*,*) - + VGROUP_NAME, ' is of a version between 3.2 and 4.0r2' - if(vg_version .eq. VSET_OLD_VERSION) write(*,*) - + VGROUP_NAME, ' is of version before 3.2' - if ((vg_version .ne. VSET_NEW_VERSION) .and. - + (vg_version .ne. VSET_VERSION) .and. - + (vg_version .ne. VSET_OLD_VERSION)) write(*,*) - + 'Unknown version' -C -C Add the attribute named VGATTR_NAME to the vgroup. -C - status = vfscatt(vgroup_id, VGATTR_NAME, DFNT_CHAR, N_ATT_VALUES, - + vg_attr) -C -C Get and display the number of attributes attached to this group. -C - n_attrs = vfnatts(vgroup_id) - write(*,*) 'This group has', n_attrs, ' attributes' -C -C Get and display the name and the number of values of each attribute. -C - do 10 attr_index=1, n_attrs - attr_name = ' ' - status = vfainfo(vgroup_id, attr_index-1, attr_name, data_type, - + n_values, size) - write(*,*) 'Attribute #', attr_index-1, ' is named ', attr_name - write(*,*) 'and has', n_values, ' values: ' -C -C Get and display the attribute values. -C - status = vfgcatt(vgroup_id, attr_index-1, vgattr_buf) - write(*,*) (vgattr_buf(i), i=1,n_values) -10 continue -C -C Terminate access to the vgroup. -C - status = vfdtch(vgroup_id) -C -C Terminate accessto the V interface and close the HDF file. -C - status = vfend(file_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/VG_vgroup_contents.f b/hdf/fortran/examples/VG_vgroup_contents.f deleted file mode 100644 index 42fca3668a..0000000000 --- a/hdf/fortran/examples/VG_vgroup_contents.f +++ /dev/null @@ -1,102 +0,0 @@ - program vgroup_contents - implicit none -C -C Parameter declaration -C - character*19 FILE_NAME -C - parameter (FILE_NAME = 'General_Vgroups.hdf') - integer DFACC_ READ - parameter (DFACC_READ = 1) -C -C Function declaration -C - integer hopen, hclose - integer vfstart, vfatch, vfgid, vntrc, vfgttr, vfisvg, - + vfisvs, vfdtch, vfend - -C -C**** Variable declaration ******************************************* -C - integer status - integer file_id - integer vgroup_id, vgroup_ref, vgroup_pos - integer obj_index, num_of_pairs - integer obj_tag, obj_ref -C -C**** End of variable declaration ************************************ -C -C -C Open the HDF file for reading. -C - file_id = hopen(FILE_NAME, DFACC_READ, 0) -C -C Initialize the V interface. -C - status = vfstart(file_id) -C -C Obtain each vgroup in the file by its reference number, get the -C number of objects in the vgroup, and display the information -C about that vgroup. -C - vgroup_ref = -1 - vgroup_pos = 0 -10 continue -C -C Get the reference number of the next vgroup in the file. -C - vgroup_ref = vfgid(file_id, vgroup_ref) -C -C Attach to the vgroup or go to the end if no additional vgroup is found. -C - if(vgroup_ref. eq. -1) goto 100 - vgroup_id = vfatch(file_id, vgroup_ref , 'r') -C -C Get the total number of objects in the vgroup. -C - num_of_pairs = vntrc(vgroup_id) -C -C If the vgroup contains any object, print the tag/ref number -C pair of each object in vgroup, in the order they appear in the -C file, and indicate whether the object is a vdata, vgroup, or neither. -C - if (num_of_pairs .gt. 0) then - write(*,*) 'Vgroup # ', vgroup_pos, ' contains:' - do 20 obj_index = 1, num_of_pairs -C -C Get the tag/ref number pair of the object specified by its index -C and display them. -C - status = vfgttr(vgroup_id, obj_index-1, obj_tag, obj_ref) -C -C State whether the HDF object referred to by obj_ref is a vdata, -C a vgroup, or neither. -C - if( vfisvg(vgroup_id, obj_ref) .eq. 1) then - write(*,*) 'tag = ', obj_tag, ' ref = ', obj_ref, - + ' <--- is a vgroup ' - else if ( vfisvs(vgroup_id, obj_ref) .eq. 1) then - write(*,*) 'tag = ', obj_tag, ' ref = ', obj_ref, - + ' <--- is a vdata ' - else - write(*,*) 'tag = ', obj_tag, ' ref = ', obj_ref, - + ' <--- neither vdata nor vgroup ' - endif -20 continue - else - write (*,*) 'Vgroup #', vgroup_pos, ' contains no HDF objects' - endif - write(*,*) - vgroup_pos = vgroup_pos + 1 - goto 10 -100 continue -C -C Terminate access to the vgroup. -C - status = vfdtch(vgroup_id) -C -C Terminate access to the V interface and close the HDF file. -C - status = vfend(file_id) - status = hclose(file_id) - end diff --git a/hdf/fortran/examples/run-fortran-ex.sh b/hdf/fortran/examples/run-fortran-ex.sh deleted file mode 100644 index bfdddcf107..0000000000 --- a/hdf/fortran/examples/run-fortran-ex.sh +++ /dev/null @@ -1,160 +0,0 @@ -#! /bin/sh -# -# Copyright by The HDF Group. -# All rights reserved. -# -# This file is part of HDF4. The full HDF4 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the COPYING file, which can be found at the root of the source code -# distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. -# If you do not have access to either file, you may request a copy from -# help@hdfgroup.org. - -# -# This file: run-hdf-c-ex.sh -# Written by: Larry Knox -# Date: Jan 17, 2014 -# -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -# # -# This script will compile and run the c examples from source files installed # -# in .../examples/c using h4cc. The order for running # -# programs with RunTest in the MAIN section below is taken from the Makefile. # -# The order is important since some of the test programs use data files created # -# by earlier test programs. Any future additions should be placed accordingly. # -# # -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - -# Initializations -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -# Where the tool is installed. -# default is relative path to installed location of the tools -prefix="${prefix:-../../../}" -AR="@AR@" -RANLIB="@RANLIB@" -H4TOOL="h4fc" # The tool name -H4TOOL_BIN="${prefix}/bin/${H4TOOL}" # The path of the tool binary - -#### Run test #### -RunTest() -{ - TEST_EXEC=$1 - Test=$1".f" - - echo - echo "################# $1 #################" - ${H4TOOL_BIN} -o $TEST_EXEC $Test - if [ $? -ne 0 ] - then - echo "messed up compiling $Test" - exit 1 - fi - ./$TEST_EXEC -} - - - -################## MAIN ################## - -# Run tests -if [ $? -eq 0 ] -then - if ( - #### hdf examples #### - RunTest VD_create_vdatas &&\ - rm VD_create_vdatas &&\ - RunTest VD_write_mixed_vdata &&\ - rm VD_write_mixed_vdata &&\ - RunTest VD_write_to_vdata &&\ - rm VD_write_to_vdata &&\ - RunTest VD_create_onefield_vdatas &&\ - rm VD_create_onefield_vdatas &&\ - RunTest VD_read_from_vdata &&\ - rm VD_read_from_vdata &&\ - RunTest VD_read_mixed_vdata &&\ - rm VD_read_mixed_vdata &&\ - RunTest VD_get_vdata_info &&\ - rm VD_get_vdata_info &&\ - RunTest VD_locate_vdata &&\ - rm VD_locate_vdata &&\ - RunTest VG_create_vgroup &&\ - rm VG_create_vgroup &&\ - RunTest VG_add_sds_to_vgroup &&\ - rm VG_add_sds_to_vgroup &&\ - RunTest VG_insert_vdatas_to_vgroup &&\ - rm VG_insert_vdatas_to_vgroup &&\ - RunTest VG_set_get_vgroup_attr &&\ - rm VG_set_get_vgroup_attr &&\ - RunTest VG_vgroup_contents &&\ - rm VG_vgroup_contents &&\ - RunTest VG_get_vgroup_info &&\ - rm VG_get_vgroup_info &&\ - RunTest GR_create_and_write_image &&\ - rm GR_create_and_write_image &&\ - RunTest GR_modify_image &&\ - rm GR_modify_image &&\ - RunTest GR_set_attribute &&\ - rm GR_set_attribute &&\ - RunTest GR_get_attribute &&\ - rm GR_get_attribute &&\ - RunTest GR_write_palette &&\ - rm GR_write_palette &&\ - RunTest GR_image_info &&\ - rm GR_image_info &&\ - RunTest GR_read_image &&\ - rm GR_read_image &&\ - RunTest AN_create_annotation &&\ - rm AN_create_annotation &&\ - RunTest AN_get_annotation_info &&\ - rm AN_get_annotation_info &&\ - RunTest AN_read_annotation &&\ - rm AN_read_annotation &&\ - #### mfhdf examples #### - RunTest SD_create_sds &&\ - rm SD_create_sds &&\ - RunTest SD_write_to_sds &&\ - rm SD_write_to_sds &&\ - RunTest SD_write_slab &&\ - rm SD_write_slab &&\ - RunTest SD_alter_sds_values &&\ - rm SD_alter_sds_values &&\ - RunTest SD_unlimited_sds &&\ - rm SD_unlimited_sds &&\ - RunTest SD_mv_sds_to_external &&\ - rm SD_mv_sds_to_external &&\ - RunTest SD_read_from_sds &&\ - rm SD_read_from_sds &&\ - RunTest SD_read_subsets &&\ - rm SD_read_subsets &&\ - RunTest SD_get_info &&\ - rm SD_get_info &&\ - RunTest SD_find_sds_by_name &&\ - rm SD_find_sds_by_name &&\ - RunTest SD_set_get_dim_info &&\ - rm SD_set_get_dim_info &&\ - RunTest SD_dimscale_vs_sds &&\ - rm SD_dimscale_vs_sds &&\ - RunTest SD_set_attr &&\ - rm SD_set_attr &&\ - RunTest SD_get_attr &&\ - rm SD_get_attr &&\ - RunTest SD_compress_sds &&\ - rm SD_compress_sds &&\ - RunTest SD_chunking_example &&\ - rm SD_chunking_example - ); then - EXIT_VALUE=${EXIT_SUCCESS} - else - EXIT_VALUE=${EXIT_FAILURE} - fi -fi - -# Cleanup -rm *.o -rm *.hdf -echo - -exit $EXIT_VALUE - diff --git a/java/src/Makefile.am b/java/src/Makefile.am index 2d4b5d7c1f..a2e7433ec4 100644 --- a/java/src/Makefile.am +++ b/java/src/Makefile.am @@ -67,7 +67,7 @@ clean: rm -f classhdf_java.stamp -# Clean examples when check-clean is invoked +# Clean when check-clean is invoked check-clean :: ; #include $(top_srcdir)/config/conclude.am diff --git a/mfhdf/Makefile.am b/mfhdf/Makefile.am index 3e37caca3a..96583b5679 100644 --- a/mfhdf/Makefile.am +++ b/mfhdf/Makefile.am @@ -15,21 +15,10 @@ endif # src folder in root Makefile, build other folders now SUBDIRS = libsrc $(FORTRAN_DIR) test $(NETCDF_DIRS) dumper hdfimport hdiff hrepack -DIST_SUBDIRS = libsrc fortran test $(NETCDF_DIRS) dumper hdfimport hdiff hrepack examples +DIST_SUBDIRS = libsrc fortran test $(NETCDF_DIRS) dumper hdfimport hdiff hrepack -installcheck-local: - @(cd examples && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; - -# 'make install-all' also installs examples +# 'make install-all' install-all: @$(MAKE) $(AM_MAKEFLAGS) install - @$(MAKE) $(AM_MAKEFLAGS) install-examples uninstall-all: @$(MAKE) $(AM_MAKEFLAGS) uninstall - @$(MAKE) $(AM_MAKEFLAGS) uninstall-examples - -# Install examples recursively -install-examples uninstall-examples: - @@SETX@; for d in examples $(FORTRAN_DIR); do \ - (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ - done diff --git a/mfhdf/examples/CMakeLists.txt b/mfhdf/examples/CMakeLists.txt deleted file mode 100644 index bfb5c62b19..0000000000 --- a/mfhdf/examples/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -cmake_minimum_required (VERSION 3.12) -project (HDF4_MFHDF_EXAMPLES C) - -#----------------------------------------------------------------------------- -# Define Sources -#----------------------------------------------------------------------------- -set (examples - SD_create_sds - SD_write_to_sds - SD_write_slab - SD_alter_sds_values - SD_unlimited_sds - SD_compress_sds - SD_mv_sds_to_external - SD_read_from_sds - SD_read_subsets - SD_get_info - SD_find_sds_by_name - SD_set_get_dim_info - SD_dimscale_vs_sds - SD_set_attr - SD_get_attr - SD_chunking_example -) - -foreach (example ${examples}) - add_executable (mf_${example} ${HDF4_MFHDF_EXAMPLES_SOURCE_DIR}/${example}.c) - if (NOT BUILD_SHARED_LIBS) - TARGET_C_PROPERTIES (mf_${example} STATIC) - target_link_libraries (mf_${example} PRIVATE ${HDF4_MF_LIB_TARGET}) - else () - TARGET_C_PROPERTIES (mf_${example} SHARED) - target_link_libraries (mf_${example} PRIVATE ${HDF4_MF_LIBSH_TARGET}) - endif () -endforeach (example ${examples}) - -if (BUILD_TESTING) - include (CMakeTests.cmake) -endif () diff --git a/mfhdf/examples/CMakeTests.cmake b/mfhdf/examples/CMakeTests.cmake deleted file mode 100644 index 389340c62b..0000000000 --- a/mfhdf/examples/CMakeTests.cmake +++ /dev/null @@ -1,30 +0,0 @@ - -############################################################################## -############################################################################## -### T E S T I N G ### -############################################################################## -############################################################################## - -# Remove any output file left over from previous test run -add_test ( - NAME MFHDF_EXAMPLES-clearall-objects - COMMAND ${CMAKE_COMMAND} -E remove - SDS.hdf - SDSchunked.hdf - SDScompressed.hdf - SDSUNLIMITED.hdf - SLABS.hdf - ExternalSDS -) -set_tests_properties (MFHDF_EXAMPLES-clearall-objects PROPERTIES LABELS ${PROJECT_NAME}) -set (last_test "MFHDF_EXAMPLES-clearall-objects") - -foreach (example ${examples}) - add_test (NAME MFHDF_EXAMPLES-${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (MFHDF_EXAMPLES-${example} PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME}) - else () - set_tests_properties (MFHDF_EXAMPLES-${example} PROPERTIES LABELS ${PROJECT_NAME}) - endif () - set (last_test "MFHDF_EXAMPLES-${example}") -endforeach () diff --git a/mfhdf/examples/Makefile.am b/mfhdf/examples/Makefile.am deleted file mode 100644 index 5b6597ae2a..0000000000 --- a/mfhdf/examples/Makefile.am +++ /dev/null @@ -1,62 +0,0 @@ -############################################################################# -## Setup for building programs ## -############################################################################# - -include $(top_srcdir)/config/commence.am - -DEFINES=-DHDF - -############################################################################# -## Programs to build ## -############################################################################# - -EXAMPLE_PROG = SD_create_sds SD_write_to_sds SD_write_slab \ - SD_alter_sds_values SD_unlimited_sds SD_compress_sds \ - SD_mv_sds_to_external SD_read_from_sds SD_read_subsets \ - SD_get_info SD_find_sds_by_name SD_set_get_dim_info \ - SD_dimscale_vs_sds SD_set_attr SD_get_attr SD_chunking_example -TEST_PROG = $(EXAMPLE_PROG) - -INSTALL_FILES = SD_create_sds.c SD_write_to_sds.c SD_write_slab.c \ - SD_alter_sds_values.c SD_unlimited_sds.c SD_compress_sds.c \ - SD_mv_sds_to_external.c SD_read_from_sds.c SD_read_subsets.c \ - SD_get_info.c SD_find_sds_by_name.c SD_set_get_dim_info.c \ - SD_dimscale_vs_sds.c SD_set_attr.c SD_get_attr.c SD_chunking_example.c - -EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf4_examples/c - -# How to build programs using h4cc -$(EXTRA_PROG): $(H4CC) - $(H4CC) $(H4CCFLAGS) $(CFLAGS) -o $@ $(srcdir)/$@.c; - -# List dependencies for each program. Normally, automake would take -# care of this for us, but if we tell automake about the programs it -# will try to build them with the normal C++ compiler, not h4cc. This is -# an inelegant way of solving the problem, unfortunately. -create_sds: $(srcdir)/SD_create_sds.c -write_to_sds: $(srcdir)/SD_write_to_sds.c -write_slab: $(srcdir)/SD_write_slab.c -alter_sds_values: $(srcdir)/SD_alter_sds_values.c -unlimited_sds: $(srcdir)/SD_unlimited_sds.c -compress_sds: $(srcdir)/SD_compress_sds.c -mv_sds_to_external: $(srcdir)/SD_mv_sds_to_external.c -read_from_sds: $(srcdir)/SD_read_from_sds.c -read_subsets: $(srcdir)/SD_read_subsets.c -get_info: $(srcdir)/SD_get_info.c -find_sds_by_name: $(srcdir)/SD_find_sds_by_name.c -set_get_dim_info: $(srcdir)/SD_set_get_dim_info.c -dimscale_vs_sds: $(srcdir)/SD_dimscale_vs_sds.c -set_attr: $(srcdir)/SD_set_attr.c -get_attr: $(srcdir)/SD_get_attr.c -chunking_example: $(srcdir)/SD_chunking_example.c - -CHECK_CLEANFILES += ExternalSDS - -DISTCLEANFILES = *.chklog *.chkexe .deps - -if BUILD_SHARED_SZIP_CONDITIONAL -LD_LIBRARY_PATH=$(LL_PATH) -endif - -include $(top_srcdir)/config/examples.am -include $(top_srcdir)/config/conclude.am diff --git a/mfhdf/examples/SD_alter_sds_values.c b/mfhdf/examples/SD_alter_sds_values.c deleted file mode 100644 index 893f9f2e0e..0000000000 --- a/mfhdf/examples/SD_alter_sds_values.c +++ /dev/null @@ -1,60 +0,0 @@ -#include "mfhdf.h" - -#define FILE_NAME "SDS.hdf" - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 sd_id, sds_id, sds_index; - int32 start[2], edges[2]; - int32 new_data[2]; - - /********************* End of variable declaration ***********************/ - /* - * Open the file and initialize the SD interface with write access. - */ - if ((sd_id = SDstart(FILE_NAME, DFACC_WRITE)) == FAIL) - printf("*** ERROR from SDstart\n"); - - /* - * Select the first data set. - */ - sds_index = 0; - sds_id = SDselect(sd_id, sds_index); - - /* - * Set up the start and edge parameters to write new element values - * into 10th row, 2nd column place, and 11th row, 2nd column place. - */ - start[0] = 9; /* starting at 10th row */ - start[1] = 1; /* starting at 2nd column */ - edges[0] = 2; /* rows 10th and 11th */ - edges[1] = 1; /* column 2nd only */ - - /* - * Initialize buffer with the new values to be written. - */ - new_data[0] = new_data[1] = 1000; - - /* - * Write the new values. - */ - if (SDwritedata(sds_id, start, NULL, edges, (void *)new_data) == FAIL) - printf("*** ERROR from SDwritedata\n"); - - /* - * Terminate access to the data set. - */ - if (SDendaccess(sds_id) == FAIL) - printf("*** ERROR from SDendaccess\n"); - - /* - * Terminate access to the SD interface and close the file. - */ - if (SDend(sd_id) == FAIL) - printf("*** ERROR from SDend\n"); - - return 0; -} diff --git a/mfhdf/examples/SD_chunking_example.c b/mfhdf/examples/SD_chunking_example.c deleted file mode 100644 index 9bc43bc1f5..0000000000 --- a/mfhdf/examples/SD_chunking_example.c +++ /dev/null @@ -1,301 +0,0 @@ -#include "mfhdf.h" - -#define FILE_NAME "SDSchunked.hdf" -#define SDS_NAME "ChunkedData" -#define RANK 2 - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 sd_id, sds_id, sds_index; - int32 flag, maxcache; - int32 dim_sizes[2], origin[2]; - HDF_CHUNK_DEF c_def, c_def_out; /* Chunking definitions */ - int32 comp_flag, c_flags; - int16 all_data[9][4]; - int32 start[2], edges[2]; - int16 chunk_out[3][2]; - int16 row[2] = {5, 5}; - int16 column[3] = {4, 4, 4}; - int16 fill_value = 0; /* Fill value */ - int i, j; - /* - * Declare chunks data type and initialize some of them. - */ - int16 chunk1[3][2] = {{1, 1}, {1, 1}, {1, 1}}; - - int16 chunk2[3][2] = {{2, 2}, {2, 2}, {2, 2}}; - - int16 chunk3[3][2] = {{3, 3}, {3, 3}, {3, 3}}; - - int16 chunk6[3][2] = {{6, 6}, {6, 6}, {6, 6}}; - - /********************* End of variable declaration ***********************/ - /* - * Define chunk's dimensions. - * - * In this example we do not use compression. - * To use chunking with RLE, Skipping Huffman, and GZIP - * compression, initialize - * - * c_def.comp.chunk_lengths[0] = 3; - * c_def.comp.chunk_lengths[1] = 2; - * - * To use chunking with NBIT, initialize - * - * c_def.nbit.chunk_lengths[0] = 3; - * c_def.nbit.chunk_lengths[1] = 2; - * - */ - c_def.chunk_lengths[0] = 3; - c_def.chunk_lengths[1] = 2; - - /* - * Create the file and initialize SD interface. - */ - if ((sd_id = SDstart(FILE_NAME, DFACC_CREATE)) == FAIL) - printf("*** ERROR from SDstart\n"); - - /* - * Create 9x4 SDS. - */ - dim_sizes[0] = 9; - dim_sizes[1] = 4; - sds_id = SDcreate(sd_id, SDS_NAME, DFNT_INT16, RANK, dim_sizes); - - /* - * Fill the SDS array with the fill value. - */ - if (SDsetfillvalue(sds_id, (void *)&fill_value) == FAIL) - printf("*** ERROR from SDsetfillvalue\n"); - - /* - * Create chunked SDS. - * In this example we do not use compression ( third - * parameter of SDsetchunk is set to HDF_CHUNK). - * - * To use RLE compression, set compression type and flag - * - * c_def.comp.comp_type = COMP_CODE_RLE; - * comp_flag = HDF_CHUNK | HDF_COMP; - * - * To use Skipping Huffman compression, set compression type, flag - * and skipping size skp_size - * - * c_def.comp.comp_type = COMP_CODE_SKPHUFF; - * c_def.comp.cinfo.skphuff.skp_size = value; - * comp_flag = HDF_CHUNK | HDF_COMP; - * - * To use GZIP compression, set compression type, flag and - * deflate level - * - * c_def.comp.comp_type = COMP_CODE_DEFLATE; - * c_def.comp.cinfo.deflate.level = value; - * comp_flag = HDF_CHUNK | HDF_COMP; - * - * To use NBIT compression, set compression flag and - * compression parameters - * - * comp_flag = HDF_CHUNK | HDF_NBIT; - * c_def.nbit.start_bit = value1; - * c_def.nbit.bit_len = value2; - * c_def.nbit.sign_ext = value3; - * c_def.nbit.fill_one = value4; - */ - comp_flag = HDF_CHUNK; - if (SDsetchunk(sds_id, c_def, comp_flag) == FAIL) - printf("*** ERROR from SDsetchunk\n"); - - /* - * Set chunk cache to hold maximum of 3 chunks. - */ - maxcache = 3; - flag = 0; - SDsetchunkcache(sds_id, maxcache, flag); - - /* - * Write chunks using SDwritechunk function. - * Chunks can be written in any order. - */ - - /* - * Write the chunk with the coordinates (0,0). - */ - origin[0] = 0; - origin[1] = 0; - if (SDwritechunk(sds_id, origin, (void *)chunk1) == FAIL) - printf("*** ERROR from SDwritechunk\n"); - - /* - * Write the chunk with the coordinates (1,0). - */ - origin[0] = 1; - origin[1] = 0; - if (SDwritechunk(sds_id, origin, (void *)chunk3) == FAIL) - printf("*** ERROR from SDwritechunk\n"); - - /* - * Write the chunk with the coordinates (0,1). - */ - origin[0] = 0; - origin[1] = 1; - if (SDwritechunk(sds_id, origin, (void *)chunk2) == FAIL) - printf("*** ERROR from SDwritechunk\n"); - - /* - * Write chunk with the coordinates (1,2) using - * SDwritedata function. - */ - start[0] = 6; - start[1] = 2; - edges[0] = 3; - edges[1] = 2; - if (SDwritedata(sds_id, start, NULL, edges, (void *)chunk6) == FAIL) - printf("*** ERROR from SDwritedata\n"); - - /* - * Fill second column in the chunk with the coordinates (1,1) - * using SDwritedata function. - */ - start[0] = 3; - start[1] = 3; - edges[0] = 3; - edges[1] = 1; - if (SDwritedata(sds_id, start, NULL, edges, (void *)column) == FAIL) - printf("*** ERROR from SDwritedata\n"); - - /* - * Fill second row in the chunk with the coordinates (0,2) - * using SDwritedata function. - */ - start[0] = 7; - start[1] = 0; - edges[0] = 1; - edges[1] = 2; - if (SDwritedata(sds_id, start, NULL, edges, (void *)row) == FAIL) - printf("*** ERROR from SDwritedata\n"); - - /* - * Terminate access to the data set. - */ - if (SDendaccess(sds_id) == FAIL) - printf("*** ERROR from SDendaccess\n"); - - /* - * Terminate access to the SD interface and close the file. - */ - if (SDend(sd_id) == FAIL) - printf("*** ERROR from SDend\n"); - - /* - * Reopen the file and access the first data set. - */ - sd_id = SDstart(FILE_NAME, DFACC_READ); - sds_index = 0; - sds_id = SDselect(sd_id, sds_index); - - /* - * Get information about the SDS. Only chunk lengths and compression - * flag can be returned. Compression information is not available if - * NBIT, Skipping Huffman, or GZIP compression is used. - */ - if (SDgetchunkinfo(sds_id, &c_def_out, &c_flags) == FAIL) - printf("*** ERROR from SDgetchunkinfo\n"); - if (c_flags == HDF_CHUNK) - printf(" SDS is chunked\nChunk's dimensions %dx%d\n", c_def_out.chunk_lengths[0], - c_def_out.chunk_lengths[1]); - else if (c_flags == (HDF_CHUNK | HDF_COMP)) - printf("SDS is chunked and compressed\nChunk's dimensions %dx%d\n", c_def_out.comp.chunk_lengths[0], - c_def_out.comp.chunk_lengths[1]); - else if (c_flags == (HDF_CHUNK | HDF_NBIT)) - printf("SDS is chunked (NBIT)\nChunk's dimensions %dx%d\n", c_def_out.nbit.chunk_lengths[0], - c_def_out.nbit.chunk_lengths[1]); - - /* - * Read the entire data set using SDreaddata function. - */ - start[0] = 0; - start[1] = 0; - edges[0] = 9; - edges[1] = 4; - if (SDreaddata(sds_id, start, NULL, edges, (void *)all_data) == FAIL) - printf("*** ERROR from SDreaddata\n"); - - /* - * Print out what we have read. - * The following information should be displayed: - * - * SDS is chunked - * Chunk's dimensions 3x2 - * 1 1 2 - * 1 1 2 2 - * 1 1 2 2 - * 3 3 0 4 - * 3 3 0 4 - * 3 3 0 4 - * 0 0 6 6 - * 5 5 6 6 - * 0 0 6 6 - */ - for (j = 0; j < 9; j++) { - for (i = 0; i < 4; i++) - printf(" %d", all_data[j][i]); - printf("\n"); - } - - /* - * Read chunk with the coordinates (2,0) and display it. - */ - origin[0] = 2; - origin[1] = 0; - if (SDreadchunk(sds_id, origin, chunk_out) == FAIL) - printf("*** ERROR from SDreadchunk\n"); - printf(" Chunk (2,0) \n"); - for (j = 0; j < 3; j++) { - for (i = 0; i < 2; i++) - printf(" %d", chunk_out[j][i]); - printf("\n"); - } - - /* - * Read chunk with the coordinates (1,1) and display it. - */ - origin[0] = 1; - origin[1] = 1; - if (SDreadchunk(sds_id, origin, chunk_out) == FAIL) - printf("*** ERROR from SDreadchunk\n"); - printf(" Chunk (1,1) \n"); - for (j = 0; j < 3; j++) { - for (i = 0; i < 2; i++) - printf(" %d", chunk_out[j][i]); - printf("\n"); - } - - /* The following information is displayed: - * - * Chunk (2,0) - * 0 0 - * 5 5 - * 0 0 - * Chunk (1,1) - * 0 4 - * 0 4 - * 0 4 - */ - - /* - * Terminate access to the data set. - */ - if (SDendaccess(sds_id) == FAIL) - printf("*** ERROR from SDendaccess\n"); - - /* - * Terminate access to the SD interface and close the file. - */ - if (SDend(sd_id) == FAIL) - printf("*** ERROR from SDend\n"); - - return 0; -} diff --git a/mfhdf/examples/SD_compress_sds.c b/mfhdf/examples/SD_compress_sds.c deleted file mode 100644 index 0c4e7fe2b2..0000000000 --- a/mfhdf/examples/SD_compress_sds.c +++ /dev/null @@ -1,91 +0,0 @@ -#include "mfhdf.h" - -#define FILE_NAME "SDScompressed.hdf" -#define SDS_NAME "SDSgzip" -#define X_LENGTH 5 -#define Y_LENGTH 16 -#define RANK 2 - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 sd_id, sds_id; - int32 comp_type; /* Compression flag */ - comp_info c_info; /* Compression structure */ - int32 start[2], edges[2], dim_sizes[2]; - int32 data[Y_LENGTH][X_LENGTH]; - int i, j; - - /********************* End of variable declaration ***********************/ - - /* - * Buffer array data and define array dimensions. - */ - for (j = 0; j < Y_LENGTH; j++) { - for (i = 0; i < X_LENGTH; i++) - data[j][i] = (i + j) + 1; - } - dim_sizes[0] = Y_LENGTH; - dim_sizes[1] = X_LENGTH; - - /* - * Create the file and initialize the SD interface. - */ - if ((sd_id = SDstart(FILE_NAME, DFACC_CREATE)) == FAIL) - printf("*** ERROR from SDstart\n"); - - /* - * Create the data set with the name defined in SDS_NAME. - */ - sds_id = SDcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, dim_sizes); - - /* - * Ininitialize compression structure element and compression - * flag for GZIP compression and call SDsetcompress. - * - * To use the Skipping Huffman compression method, initialize - * comp_type = COMP_CODE_SKPHUFF - * c_info.skphuff.skp_size = value - * - * To use the RLE compression method, initialize - * comp_type = COMP_CODE_RLE - * No structure element needs to be initialized. - */ - comp_type = COMP_CODE_DEFLATE; - c_info.deflate.level = 6; - if (SDsetcompress(sds_id, comp_type, &c_info) == FAIL) - printf("*** ERROR from SDsetcompress\n"); - - /* - * Define the location and size of the data set - * to be written to the file. - */ - start[0] = 0; - start[1] = 0; - edges[0] = Y_LENGTH; - edges[1] = X_LENGTH; - - /* - * Write the stored data to the data set. The last argument - * must be explicitly cast to a generic pointer since SDwritedata - * is designed to write generic data. - */ - if (SDwritedata(sds_id, start, NULL, edges, (void *)data) == FAIL) - printf("*** ERROR from SDwritedata\n"); - - /* - * Terminate access to the data set. - */ - if (SDendaccess(sds_id) == FAIL) - printf("*** ERROR from SDendaccess\n"); - - /* - * Terminate access to the SD interface and close the file. - */ - if (SDend(sd_id) == FAIL) - printf("*** ERROR from SDend\n"); - - return 0; -} diff --git a/mfhdf/examples/SD_create_sds.c b/mfhdf/examples/SD_create_sds.c deleted file mode 100644 index 67ad60d639..0000000000 --- a/mfhdf/examples/SD_create_sds.c +++ /dev/null @@ -1,52 +0,0 @@ -#include "mfhdf.h" - -#define FILE_NAME "SDS.hdf" -#define SDS_NAME "SDStemplate" -#define X_LENGTH 5 -#define Y_LENGTH 16 -#define RANK 2 /* Number of dimensions of the SDS */ - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 sd_id, sds_id; /* SD interface and data set identifiers */ - int32 dim_sizes[2]; /* sizes of the SDS dimensions */ - - /********************* End of variable declaration ***********************/ - - /* - * Create the file and initialize the SD interface. - */ - if ((sd_id = SDstart(FILE_NAME, DFACC_CREATE)) == FAIL) - printf("*** ERROR from SDstart\n"); - - /* - * Define the dimensions of the array to be created. - */ - dim_sizes[0] = Y_LENGTH; - dim_sizes[1] = X_LENGTH; - - /* - * Create the data set with the name defined in SDS_NAME. Note that - * DFNT_INT32 indicates that the SDS data is of type int32. Refer to - * Table 2F, "Standard HDF Data Types and Flags," for definitions of - * other types. - */ - sds_id = SDcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, dim_sizes); - - /* - * Terminate access to the data set. - */ - if (SDendaccess(sds_id) == FAIL) - printf("*** ERROR from SDendaccess\n"); - - /* - * Terminate access to the SD interface and close the file. - */ - if (SDend(sd_id) == FAIL) - printf("*** ERROR from SDend\n"); - - return 0; -} diff --git a/mfhdf/examples/SD_dimscale_vs_sds.c b/mfhdf/examples/SD_dimscale_vs_sds.c deleted file mode 100644 index 8bc71bb6d5..0000000000 --- a/mfhdf/examples/SD_dimscale_vs_sds.c +++ /dev/null @@ -1,62 +0,0 @@ -#include "mfhdf.h" - -#define FILE_NAME "SDS.hdf" - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 sd_id, sds_id, sds_index; - int32 rank, data_type, dim_sizes[H4_MAX_VAR_DIMS]; - int32 n_datasets, n_file_attr, n_attrs; - char sds_name[H4_MAX_NC_NAME]; - - /********************* End of variable declaration ***********************/ - - /* - * Open the file and initialize the SD interface. - */ - if ((sd_id = SDstart(FILE_NAME, DFACC_READ)) == FAIL) - printf("*** ERROR from SDstart\n"); - - /* - * Obtain information about the file. - */ - if (SDfileinfo(sd_id, &n_datasets, &n_file_attr) == FAIL) - printf("*** ERROR from SDfileinfo\n"); - - /* Get information about each SDS in the file. - * Check whether it is a coordinate variable, then display retrieved - * information. - * Output displayed: - * - * SDS array with the name SDStemplate - * Coordinate variable with the name Y_Axis - * Coordinate variable with the name X_Axis - * - */ - for (sds_index = 0; sds_index < n_datasets; sds_index++) { - sds_id = SDselect(sd_id, sds_index); - if (SDgetinfo(sds_id, sds_name, &rank, dim_sizes, &data_type, &n_attrs) == FAIL) - printf("*** ERROR from SDgetinfo\n"); - if (SDiscoordvar(sds_id)) - printf(" Coordinate variable with the name %s\n", sds_name); - else - printf(" SDS array with the name %s\n", sds_name); - - /* - * Terminate access to the selected data set. - */ - if (SDendaccess(sds_id) == FAIL) - printf("*** ERROR from SDendaccess\n"); - } - - /* - * Terminate access to the SD interface and close the file. - */ - if (SDend(sd_id) == FAIL) - printf("*** ERROR from SDend\n"); - - return 0; -} diff --git a/mfhdf/examples/SD_find_sds_by_name.c b/mfhdf/examples/SD_find_sds_by_name.c deleted file mode 100644 index 520076be76..0000000000 --- a/mfhdf/examples/SD_find_sds_by_name.c +++ /dev/null @@ -1,81 +0,0 @@ -#include "mfhdf.h" - -#define FILE_NAME "SDS.hdf" -#define SDS_NAME "SDStemplate" -#define WRONG_NAME "WrongName" -#define X_LENGTH 5 -#define Y_LENGTH 16 - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 sd_id, sds_id, sds_index; - int32 start[2], edges[2]; - int32 data[Y_LENGTH][X_LENGTH]; - int j; - - /********************* End of variable declaration ***********************/ - - /* - * Open the file for reading and initialize the SD interface. - */ - if ((sd_id = SDstart(FILE_NAME, DFACC_READ)) == FAIL) - printf("*** ERROR from SDstart\n"); - - /* - * Find index of the data set with the name specified in WRONG_NAME. - * Error condition occurs, since the data set with that name does not exist - * in the file. - */ - sds_index = SDnametoindex(sd_id, WRONG_NAME); - if (sds_index == FAIL) - printf("Data set with the name \"WrongName\" does not exist\n"); - - /* - * Find index of the data set with the name specified in SDS_NAME and use - * the index to select the data set. - */ - sds_index = SDnametoindex(sd_id, SDS_NAME); - sds_id = SDselect(sd_id, sds_index); - - /* - * Set elements of the array start to 0, elements of the array edges to - * SDS dimensions, and use NULL for stride argument in SDreaddata to read - * the entire data. - */ - start[0] = 0; - start[1] = 0; - edges[0] = Y_LENGTH; - edges[1] = X_LENGTH; - - /* - * Read the entire data into the buffer named data. - */ - if (SDreaddata(sds_id, start, NULL, edges, (void *)data) == FAIL) - printf("*** ERROR from SDreaddata\n"); - - /* - * Print 10th row; the following numbers should be displayed: - * - * 10 1000 12 13 14 - */ - for (j = 0; j < X_LENGTH; j++) - printf("%d ", data[9][j]); - printf("\n"); - - /* - * Terminate access to the data set. - */ - if (SDendaccess(sds_id) == FAIL) - printf("*** ERROR from SDendaccess\n"); - - /* - * Terminate access to the SD interface and close the file. - */ - if (SDend(sd_id) == FAIL) - printf("*** ERROR from SDend\n"); - - return 0; -} diff --git a/mfhdf/examples/SD_get_attr.c b/mfhdf/examples/SD_get_attr.c deleted file mode 100644 index 086550b41c..0000000000 --- a/mfhdf/examples/SD_get_attr.c +++ /dev/null @@ -1,165 +0,0 @@ -#include "mfhdf.h" - -#define FILE_NAME "SDS.hdf" -#define FILE_ATTR_NAME "File_contents" -#define SDS_ATTR_NAME "Valid_range" -#define DIM_ATTR_NAME "Dim_metric" - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 sd_id, sds_id, dim_id; - int32 attr_index, data_type, n_values; - char attr_name[H4_MAX_NC_NAME]; - int i; - - /********************* End of variable declaration ***********************/ - - /* - * Open the file and initialize SD interface. - */ - if ((sd_id = SDstart(FILE_NAME, DFACC_READ)) == FAIL) - printf("*** ERROR from SDstart\n"); - - /* - * Find the file attribute defined by FILE_ATTR_NAME. - */ - attr_index = SDfindattr(sd_id, FILE_ATTR_NAME); - - /* - * Get information about the file attribute. Note that the first - * parameter is an SD interface identifier. - */ - if (SDattrinfo(sd_id, attr_index, attr_name, &data_type, &n_values) == FAIL) - printf("*** ERROR from SDattrinfo\n"); - - /* The data type should be DFNT_CHAR, from SD_set_attr.c */ - if (data_type == DFNT_CHAR) { - char *fileattr_data; - - /* - * Allocate a buffer to hold the attribute data. - */ - fileattr_data = (char *)malloc((n_values + 1) * DFKNTsize(data_type)); - - /* - * Read the file attribute data. - */ - if (SDreadattr(sd_id, attr_index, fileattr_data) == FAIL) - printf("*** ERROR from SDreadattr\n"); - fileattr_data[n_values] = '\0'; - - /* - * Print out file attribute value and free buffer. - */ - printf("File attribute value is : %s\n", fileattr_data); - free(fileattr_data); - } - - /* - * Select the first data set. - */ - sds_id = SDselect(sd_id, 0); - - /* - * Find the data set attribute defined by SDS_ATTR_NAME. Note that the - * first parameter is a data set identifier. - */ - attr_index = SDfindattr(sds_id, SDS_ATTR_NAME); - - /* - * Get information about the data set attribute. - */ - if (SDattrinfo(sds_id, attr_index, attr_name, &data_type, &n_values) == FAIL) - printf("*** ERROR from SDattrinfo\n"); - - /* - * The data type should be DFNT_FLOAT32, from SD_set_attr.c. - */ - if (data_type == DFNT_FLOAT32) { - float32 *sds_data; - - /* - * Allocate a buffer to hold the data set attribute data. - */ - sds_data = (float32 *)malloc(n_values * DFKNTsize(data_type)); - - /* - * Read the SDS attribute data. - */ - if (SDreadattr(sds_id, attr_index, sds_data) == FAIL) - printf("*** ERROR from SDreadattr\n"); - - /* - * Print out SDS attribute data type and values and free buffer. - */ - printf("SDS attribute data type is : float32\n"); - printf("SDS attribute values are : "); - for (i = 0; i < n_values; i++) - printf(" %f", sds_data[i]); - printf("\n"); - free(sds_data); - } - - /* - * Get the identifier for the second dimension of the SDS. - */ - dim_id = SDgetdimid(sds_id, 1); - - /* - * Find dimension attribute defined by DIM_ATTR_NAME. - */ - attr_index = SDfindattr(dim_id, DIM_ATTR_NAME); - - /* - * Get information about the dimension attribute. - */ - if (SDattrinfo(dim_id, attr_index, attr_name, &data_type, &n_values) == FAIL) - printf("*** ERROR from SDattrinfo\n"); - - /* - * The data type should be DFNT_CHAR, from SD_set_attr.c. - */ - if (data_type == DFNT_CHAR) { - char *dimattr_data; - - /* - * Allocate a buffer to hold the dimension attribute data. - */ - dimattr_data = (char *)malloc((n_values + 1) * DFKNTsize(data_type)); - - /* - * Read the dimension attribute data. - */ - if (SDreadattr(dim_id, attr_index, dimattr_data) == FAIL) - printf("*** ERROR from SDreadattr\n"); - dimattr_data[n_values] = '\0'; - - /* - * Print out dimension attribute value and free buffer. - */ - printf("Dimensional attribute values is : %s\n", dimattr_data); - free(dimattr_data); - } - - /* - * Terminate access to the data set and to the SD interface and - * close the file. - */ - if (SDendaccess(sds_id) == FAIL) - printf("*** ERROR from SDendaccess\n"); - if (SDend(sd_id) == FAIL) - printf("*** ERROR from SDend\n"); - - /* Output of this program is : - * - * File attribute value is : Storm_track_data - * SDS attribute data type is : float32 - * SDS attribute values are : 2.000000 10.000000 - * Dimensional attribute values is : Seconds - */ - - return 0; -} diff --git a/mfhdf/examples/SD_get_info.c b/mfhdf/examples/SD_get_info.c deleted file mode 100644 index 7ce512f545..0000000000 --- a/mfhdf/examples/SD_get_info.c +++ /dev/null @@ -1,71 +0,0 @@ -#include "mfhdf.h" - -#define FILE_NAME "SDS.hdf" - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 sd_id, sds_id; - int32 n_datasets, n_file_attrs, index; - int32 dim_sizes[H4_MAX_VAR_DIMS]; - int32 rank, data_type, n_attrs; - char name[H4_MAX_NC_NAME]; - int i; - - /********************* End of variable declaration ***********************/ - - /* - * Open the file and initialize the SD interface. - */ - if ((sd_id = SDstart(FILE_NAME, DFACC_READ)) == FAIL) - printf("*** ERROR from SDstart\n"); - - /* - * Determine the number of data sets in the file and the number - * of file attributes. - */ - if (SDfileinfo(sd_id, &n_datasets, &n_file_attrs) == FAIL) - printf("*** ERROR from SDfileinfo\n"); - - /* - * Access every data set and print its name, rank, dimension sizes, - * data type, and number of attributes. - * The following information should be displayed: - * - * name = SDStemplate - * rank = 2 - * dimension sizes are : 16 5 - * data type is 24 - * number of attributes is 0 - */ - for (index = 0; index < n_datasets; index++) { - sds_id = SDselect(sd_id, index); - if (SDgetinfo(sds_id, name, &rank, dim_sizes, &data_type, &n_attrs) == FAIL) - printf("*** ERROR from SDgetinfo\n"); - - printf("name = %s\n", name); - printf("rank = %d\n", rank); - printf("dimension sizes are : "); - for (i = 0; i < rank; i++) - printf("%d ", dim_sizes[i]); - printf("\n"); - printf("data type is %d\n", data_type); - printf("number of attributes is %d\n", n_attrs); - - /* - * Terminate access to the data set. - */ - if (SDendaccess(sds_id) == FAIL) - printf("*** ERROR from SDendaccess\n"); - } - - /* - * Terminate access to the SD interface and close the file. - */ - if (SDend(sd_id) == FAIL) - printf("*** ERROR from SDend\n"); - - return 0; -} diff --git a/mfhdf/examples/SD_mv_sds_to_external.c b/mfhdf/examples/SD_mv_sds_to_external.c deleted file mode 100644 index 3136320778..0000000000 --- a/mfhdf/examples/SD_mv_sds_to_external.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "mfhdf.h" - -#define FILE_NAME "SDS.hdf" -#define EXT_FILE_NAME "ExternalSDS" -#define OFFSET 24 - -int -main() -{ - - /************************* Variable declaration **************************/ - - int32 sd_id, sds_id, sds_index; - - /********************* End of variable declaration ***********************/ - - /* - * Open the file and initialize the SD interface. - */ - if ((sd_id = SDstart(FILE_NAME, DFACC_WRITE)) == FAIL) - printf("*** ERROR from SDstart\n"); - - /* - * Select the first data set. - */ - sds_index = 0; - sds_id = SDselect(sd_id, sds_index); - - /* - * Create a file with the name EXT_FILE_NAME and move the data set - * values into it, starting at byte location OFFSET. - */ - if (SDsetexternalfile(sds_id, EXT_FILE_NAME, OFFSET) == FAIL) - printf("*** ERROR from SDsetexternalfile\n"); - - /* - * Terminate access to the data set, SD interface, and file. - */ - if (SDendaccess(sds_id) == FAIL) - printf("*** ERROR from SDendaccess\n"); - if (SDend(sd_id) == FAIL) - printf("*** ERROR from SDend\n"); - - return 0; -} diff --git a/mfhdf/examples/SD_read_from_sds.c b/mfhdf/examples/SD_read_from_sds.c deleted file mode 100644 index e96819a52a..0000000000 --- a/mfhdf/examples/SD_read_from_sds.c +++ /dev/null @@ -1,69 +0,0 @@ -#include "mfhdf.h" - -#define FILE_NAME "SDS.hdf" -#define X_LENGTH 5 -#define Y_LENGTH 16 - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 sd_id, sds_id, sds_index; - int32 start[2], edges[2]; - int32 data[Y_LENGTH][X_LENGTH]; - int j; - - /********************* End of variable declaration ***********************/ - - /* - * Open the file for reading and initialize the SD interface. - */ - if ((sd_id = SDstart(FILE_NAME, DFACC_READ)) == FAIL) - printf("*** ERROR from SDstart\n"); - - /* - * Select the first data set. - */ - sds_index = 0; - sds_id = SDselect(sd_id, sds_index); - - /* - * Set elements of array start to 0, elements of array edges - * to SDS dimensions,and use NULL for the argument stride in SDreaddata - * to read the entire data. - */ - start[0] = 0; - start[1] = 0; - edges[0] = Y_LENGTH; - edges[1] = X_LENGTH; - - /* - * Read entire data into data array. - */ - if (SDreaddata(sds_id, start, NULL, edges, (void *)data) == FAIL) - printf("*** ERROR from SDreaddata\n"); - - /* - * Print 10th row; the following numbers should be displayed. - * - * 10 1000 12 13 14 - */ - for (j = 0; j < X_LENGTH; j++) - printf("%d ", data[9][j]); - printf("\n"); - - /* - * Terminate access to the data set. - */ - if (SDendaccess(sds_id) == FAIL) - printf("*** ERROR from SDendaccess\n"); - - /* - * Terminate access to the SD interface and close the file. - */ - if (SDend(sd_id) == FAIL) - printf("*** ERROR from SDend\n"); - - return 0; -} diff --git a/mfhdf/examples/SD_read_subsets.c b/mfhdf/examples/SD_read_subsets.c deleted file mode 100644 index 1ead1cd525..0000000000 --- a/mfhdf/examples/SD_read_subsets.c +++ /dev/null @@ -1,136 +0,0 @@ -#include "mfhdf.h" - -#define FILE_NAME "SDS.hdf" -#define SUB1_LENGTH 5 -#define SUB2_LENGTH 4 -#define SUB3_LENGTH1 2 -#define SUB3_LENGTH2 3 - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 sd_id, sds_id, sds_index; - int32 start[2], edges[2], stride[2]; - int32 sub1_data[SUB1_LENGTH]; - int32 sub2_data[SUB2_LENGTH]; - int32 sub3_data[SUB3_LENGTH2][SUB3_LENGTH1]; - int i, j; - - /********************* End of variable declaration ***********************/ - - /* - * Open the file for reading and initialize the SD interface. - */ - if ((sd_id = SDstart(FILE_NAME, DFACC_READ)) == FAIL) - printf("*** ERROR from SDstart\n"); - - /* - * Select the first data set. - */ - sds_index = 0; - sds_id = SDselect(sd_id, sds_index); - /* - * Reading the first subset. - * - * Set elements of start, edges, and stride arrays to read - * every 3rd element in the 2nd column starting at 4th row. - */ - start[0] = 3; /* 4th row */ - start[1] = 1; /* 2nd column */ - edges[0] = SUB1_LENGTH; /* SUB1_LENGTH elements are read along 2nd column*/ - edges[1] = 1; - stride[0] = 3; /* every 3rd element is read along 2nd column */ - stride[1] = 1; - - /* - * Read the data from the file into sub1_data array. - */ - if (SDreaddata(sds_id, start, stride, edges, (void *)sub1_data) == FAIL) - printf("*** ERROR from SDreaddata\n"); - - /* - * Print what we have just read; the following numbers should be displayed: - * - * 5 8 1000 14 17 - */ - for (j = 0; j < SUB1_LENGTH; j++) - printf("%d ", sub1_data[j]); - printf("\n"); - - /* - * Reading the second subset. - * - * Set elements of start and edges arrays to read - * first 4 elements of the 10th row. - */ - start[0] = 9; /* 10th row */ - start[1] = 0; /* 1st column */ - edges[0] = 1; - edges[1] = SUB2_LENGTH; /* SUB2_LENGTH elements are read along 10th row */ - - /* - * Read data from the file into sub2_data array. Note that the third - * parameter is set to NULL for contiguous reading. - */ - if (SDreaddata(sds_id, start, NULL, edges, (void *)sub2_data) == FAIL) - printf("*** ERROR from SDreaddata\n"); - - /* - * Print what we have just read; the following numbers should be displayed: - * - * 10 1000 12 13 - */ - for (j = 0; j < SUB2_LENGTH; j++) - printf("%d ", sub2_data[j]); - printf("\n"); - - /* - * Reading the third subset. - * - * Set elements of the arrays start, edges, and stride to read - * every 6th element in the column and 4th element in the row - * starting at 1st column, 3d row. - */ - start[0] = 2; /* 3d row */ - start[1] = 0; /* 1st column */ - edges[0] = SUB3_LENGTH2; /* SUB3_LENGTH2 elements are read along - each column */ - edges[1] = SUB3_LENGTH1; /* SUB3_LENGTH1 elements are read along - each row */ - stride[0] = 6; /* read every 6th element along each column */ - stride[1] = 4; /* read every 4th element along each row */ - - /* - * Read the data from the file into sub3_data array. - */ - if (SDreaddata(sds_id, start, stride, edges, (void *)sub3_data) == FAIL) - printf("*** ERROR from SDreaddata\n"); - - /* - * Print what we have just read; the following numbers should be displayed: - * - * 3 7 - * 9 13 - * 15 19 - */ - for (j = 0; j < SUB3_LENGTH2; j++) { - for (i = 0; i < SUB3_LENGTH1; i++) - printf("%d ", sub3_data[j][i]); - printf("\n"); - } - /* - * Terminate access to the data set. - */ - if (SDendaccess(sds_id) == FAIL) - printf("*** ERROR from SDendaccess\n"); - - /* - * Terminate access to the SD interface and close the file. - */ - if (SDend(sd_id) == FAIL) - printf("*** ERROR from SDend\n"); - - return 0; -} diff --git a/mfhdf/examples/SD_set_attr.c b/mfhdf/examples/SD_set_attr.c deleted file mode 100644 index 607c8bae56..0000000000 --- a/mfhdf/examples/SD_set_attr.c +++ /dev/null @@ -1,79 +0,0 @@ -#include "mfhdf.h" - -#define FILE_NAME "SDS.hdf" -#define FILE_ATTR_NAME "File_contents" -#define SDS_ATTR_NAME "Valid_range" -#define DIM_ATTR_NAME "Dim_metric" - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 sd_id, sds_id, sds_index; - int32 dim_id, dim_index; - int32 n_values; /* number of values of the file, SDS or - dimension attribute */ - char8 file_values[] = "Storm_track_data"; - /* values of the file attribute */ - float32 sds_values[2] = {2., 10.}; - /* values of the SDS attribute */ - char8 dim_values[] = "Seconds"; - /* values of the dimension attribute */ - - /********************* End of variable declaration ***********************/ - - /* - * Open the file and initialize the SD interface. - */ - if ((sd_id = SDstart(FILE_NAME, DFACC_WRITE)) == FAIL) - printf("*** ERROR from SDstart\n"); - - /* - * Set an attribute that describes the file contents. - */ - n_values = 16; - if (SDsetattr(sd_id, FILE_ATTR_NAME, DFNT_CHAR, n_values, (void *)file_values) == FAIL) - printf("*** ERROR from SDsetattr\n"); - - /* - * Select the first data set. - */ - sds_index = 0; - sds_id = SDselect(sd_id, sds_index); - - /* - * Assign attribute to the first SDS. Note that attribute values - * may have different data type than SDS data. - */ - n_values = 2; - if (SDsetattr(sds_id, SDS_ATTR_NAME, DFNT_FLOAT32, n_values, (void *)sds_values) == FAIL) - printf("*** ERROR from SDsetattr\n"); - - /* - * Get the the second dimension identifier of the SDS. - */ - dim_index = 1; - dim_id = SDgetdimid(sds_id, dim_index); - - /* - * Set an attribute of the dimension that specifies the dimension metric. - */ - n_values = 7; - if (SDsetattr(dim_id, DIM_ATTR_NAME, DFNT_CHAR, n_values, (void *)dim_values) == FAIL) - printf("*** ERROR from SDsetattr\n"); - - /* - * Terminate access to the data set. - */ - if (SDendaccess(sds_id) == FAIL) - printf("*** ERROR from SDendaccess\n"); - - /* - * Terminate access to the SD interface and close the file. - */ - if (SDend(sd_id) == FAIL) - printf("*** ERROR from SDend\n"); - - return 0; -} diff --git a/mfhdf/examples/SD_set_get_dim_info.c b/mfhdf/examples/SD_set_get_dim_info.c deleted file mode 100644 index 27b8db9ba2..0000000000 --- a/mfhdf/examples/SD_set_get_dim_info.c +++ /dev/null @@ -1,159 +0,0 @@ -#include "mfhdf.h" - -#define FILE_NAME "SDS.hdf" -#define SDS_NAME "SDStemplate" -#define DIM_NAME_X "X_Axis" -#define DIM_NAME_Y "Y_Axis" -#define NAME_LENGTH 6 -#define X_LENGTH 5 -#define Y_LENGTH 16 -#define RANK 2 - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 sd_id, sds_id, sds_index; - int32 dim_index, dim_id; - int32 n_values, data_type, n_attrs; - int16 data_X[X_LENGTH]; /* X dimension dimension scale */ - int16 data_X_out[X_LENGTH]; - float64 data_Y[Y_LENGTH]; /* Y dimension dimension scale */ - float64 data_Y_out[Y_LENGTH]; - char dim_name[NAME_LENGTH + 1]; - int i, j, nrow; - - /********************* End of variable declaration ***********************/ - - /* - * Initialize dimension scales. - */ - for (i = 0; i < X_LENGTH; i++) - data_X[i] = i; - for (i = 0; i < Y_LENGTH; i++) - data_Y[i] = 0.1 * i; - - /* - * Open the file and initialize SD interface. - */ - if ((sd_id = SDstart(FILE_NAME, DFACC_WRITE)) == FAIL) - printf("*** ERROR from SDstart\n"); - - /* - * Get the index of the data set specified in SDS_NAME. - */ - sds_index = SDnametoindex(sd_id, SDS_NAME); - - /* - * Select the data set corresponding to the returned index. - */ - sds_id = SDselect(sd_id, sds_index); - - /* For each dimension of the data set specified in SDS_NAME, - * get its dimension identifier and set dimension name - * and dimension scale. Note that data type of dimension scale - * can be different between dimensions and can be different from - * SDS data type. - */ - for (dim_index = 0; dim_index < RANK; dim_index++) { - /* - * Select the dimension at position dim_index. - */ - dim_id = SDgetdimid(sds_id, dim_index); - - /* - * Assign name and dimension scale to selected dimension. - */ - switch (dim_index) { - case 0: - if (SDsetdimname(dim_id, DIM_NAME_Y) == FAIL) - printf("*** ERROR from SDsetdimname\n"); - n_values = Y_LENGTH; - SDsetdimscale(dim_id, n_values, DFNT_FLOAT64, (void *)data_Y); - break; - case 1: - if (SDsetdimname(dim_id, DIM_NAME_X) == FAIL) - printf("*** ERROR from SDsetdimname\n"); - n_values = X_LENGTH; - SDsetdimscale(dim_id, n_values, DFNT_INT16, (void *)data_X); - break; - default: - break; - } - - /* - * Get and display info about the dimension and its scale values. - * The following information is displayed: - * - * Information about 1 dimension: - * dimension name is Y_Axis - * number of scale values is 16 - * dimension scale data type is float64 - * number of dimension attributes is 0 - * - * Scale values are : - * 0.000 0.100 0.200 0.300 - * 0.400 0.500 0.600 0.700 - * 0.800 0.900 1.000 1.100 - * 1.200 1.300 1.400 1.500 - * - * Information about 2 dimension: - * dimension name is X_Axis - * number of scale values is 5 - * dimension scale data type is int16 - * number of dimension attributes is 0 - * - * Scale values are : - * 0 1 2 3 4 - */ - - if (SDdiminfo(dim_id, dim_name, &n_values, &data_type, &n_attrs) == FAIL) - printf("*** ERROR from SDdiminfo\n"); - printf("Information about %d dimension:\n", dim_index + 1); - printf("dimension name is %s\n", dim_name); - printf("number of scale values is %d\n", n_values); - if (data_type == DFNT_FLOAT64) - printf("dimension scale data type is float64\n"); - if (data_type == DFNT_INT16) - printf("dimension scale data type is int16\n"); - printf("number of dimension attributes is %d\n", n_attrs); - printf("\n"); - printf("Scale values are :\n"); - switch (dim_index) { - case 0: - if (SDgetdimscale(dim_id, (void *)data_Y_out) == FAIL) - printf("*** ERROR from SDgetdimscale\n"); - nrow = 4; - for (i = 0; i < n_values / nrow; i++) { - for (j = 0; j < nrow; j++) - printf(" %-6.3f", data_Y_out[i * nrow + j]); - printf("\n"); - } - break; - case 1: - if (SDgetdimscale(dim_id, (void *)data_X_out) == FAIL) - printf("*** ERROR from SDgetdimscale\n"); - for (i = 0; i < n_values; i++) - printf(" %d", data_X_out[i]); - break; - default: - break; - } - printf("\n"); - } /*for dim_index */ - - /* - * Terminate access to the data set. - */ - if (SDendaccess(sds_id) == FAIL) - printf("*** ERROR from SDendaccess\n"); - - /* - * Terminate access to the SD interface and close the file. - */ - if (SDend(sd_id) == FAIL) - printf("*** ERROR from SDend\n"); - - return 0; -} diff --git a/mfhdf/examples/SD_unlimited_sds.c b/mfhdf/examples/SD_unlimited_sds.c deleted file mode 100644 index 119eeacc3c..0000000000 --- a/mfhdf/examples/SD_unlimited_sds.c +++ /dev/null @@ -1,124 +0,0 @@ -#include "mfhdf.h" - -#define FILE_NAME "SDSUNLIMITED.hdf" -#define SDS_NAME "AppendableData" -#define X_LENGTH 10 -#define Y_LENGTH 10 -#define RANK 2 - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 sd_id, sds_id, sds_index; - int32 dim_sizes[2]; - int32 data[Y_LENGTH][X_LENGTH], append_data[X_LENGTH]; - int32 start[2], edges[2]; - int i, j; - - /********************* End of variable declaration ***********************/ - - /* - * Data initialization. - */ - for (j = 0; j < Y_LENGTH; j++) { - for (i = 0; i < X_LENGTH; i++) - data[j][i] = (i + 1) + (j + 1); - } - - /* - * Create the file and initialize the SD interface. - */ - if ((sd_id = SDstart(FILE_NAME, DFACC_CREATE)) == FAIL) - printf("*** ERROR from SDstart\n"); - - /* - * Define dimensions of the array. Make the first dimension - * appendable by defining its length to be unlimited. - */ - dim_sizes[0] = SD_UNLIMITED; - dim_sizes[1] = X_LENGTH; - - /* - * Create the array data set. - */ - sds_id = SDcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, dim_sizes); - - /* - * Define the location and the size of the data to be written - * to the data set. - */ - start[0] = start[1] = 0; - edges[0] = Y_LENGTH; - edges[1] = X_LENGTH; - - /* - * Write the data. - */ - if (SDwritedata(sds_id, start, NULL, edges, (void *)data) == FAIL) - printf("*** ERROR from SDwritedata\n"); - - /* - * Terminate access to the array data set, terminate access - * to the SD interface, and close the file. - */ - if (SDendaccess(sds_id) == FAIL) - printf("*** ERROR from SDendaccess\n"); - if (SDend(sd_id) == FAIL) - printf("*** ERROR from SDend\n"); - - /* - * Store the array values to be appended to the data set. - */ - for (i = 0; i < X_LENGTH; i++) - append_data[i] = 1000 + i; - - /* - * Reopen the file and initialize the SD interface. - */ - sd_id = SDstart(FILE_NAME, DFACC_WRITE); - - /* - * Select the first data set. - */ - sds_index = 0; - sds_id = SDselect(sd_id, sds_index); - - /* - * Check if selected SDS is unlimited. If it is not, then terminate access - * to the SD interface and close the file. - */ - if (SDisrecord(sds_id)) { - - /* - * Define the location of the append to start at the first column - * of the 11th row of the data set and to stop at the end of the - * eleventh row. - */ - start[0] = Y_LENGTH; - start[1] = 0; - edges[0] = 1; - edges[1] = X_LENGTH; - - /* - * Append data to the data set. - */ - if (SDwritedata(sds_id, start, NULL, edges, (void *)append_data) == FAIL) - printf("*** ERROR from SDwritedata\n"); - } - - /* - * Terminate access to the data set. - */ - if (SDendaccess(sds_id) == FAIL) - printf("*** ERROR from SDendaccess\n"); - - /* - * Terminate access to the SD interface and close the file. - */ - if (SDend(sd_id) == FAIL) - printf("*** ERROR from SDend\n"); - - return 0; -} diff --git a/mfhdf/examples/SD_write_slab.c b/mfhdf/examples/SD_write_slab.c deleted file mode 100644 index 9355407880..0000000000 --- a/mfhdf/examples/SD_write_slab.c +++ /dev/null @@ -1,95 +0,0 @@ -#include "mfhdf.h" - -#define FILE_NAME "SLABS.hdf" -#define SDS_NAME "FilledBySlabs" -#define X_LENGTH 4 -#define Y_LENGTH 5 -#define Z_LENGTH 6 -#define RANK 3 - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 sd_id, sds_id; - int32 dim_sizes[3], start[3], edges[3]; - int32 data[Z_LENGTH][Y_LENGTH][X_LENGTH]; - int32 zx_data[Z_LENGTH][X_LENGTH]; - int i, j, k; - - /********************* End of variable declaration ***********************/ - - /* - * Data initialization. - */ - for (k = 0; k < Z_LENGTH; k++) - for (j = 0; j < Y_LENGTH; j++) - for (i = 0; i < X_LENGTH; i++) - data[k][j][i] = (i + 1) + (j + 1) + (k + 1); - - /* - * Create the file and initialize the SD interface. - */ - if ((sd_id = SDstart(FILE_NAME, DFACC_CREATE)) == FAIL) - printf("*** ERROR from SDstart\n"); - - /* - * Define dimensions of the array to be created. - */ - dim_sizes[0] = Z_LENGTH; - dim_sizes[1] = Y_LENGTH; - dim_sizes[2] = X_LENGTH; - - /* - * Create the array with the name defined in SDS_NAME. - */ - sds_id = SDcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, dim_sizes); - - /* - * Set the parameters start and edges to write - * a 6x4 element slab of data to the data set; note - * that edges[1] is set to 1 to define a 2-dimensional slab - * parallel to the ZX plane. - * start[1] (slab position in the array) is initialized inside - * the for loop. - */ - edges[0] = Z_LENGTH; - edges[1] = 1; - edges[2] = X_LENGTH; - start[0] = start[2] = 0; - for (j = 0; j < Y_LENGTH; j++) { - start[1] = j; - - /* - * Initialize zx_data buffer (data slab). - */ - for (k = 0; k < Z_LENGTH; k++) { - for (i = 0; i < X_LENGTH; i++) { - zx_data[k][i] = data[k][j][i]; - } - } - - /* - * Write the data slab into the SDS array defined in SDS_NAME. - * Note that the 3rd parameter is NULL which indicates that consecutive - * slabs in the Y direction are written. - */ - if (SDwritedata(sds_id, start, NULL, edges, (void *)zx_data) == FAIL) - printf("*** ERROR from SDwritedata\n"); - } - - /* - * Terminate access to the data set. - */ - if (SDendaccess(sds_id) == FAIL) - printf("*** ERROR from SDendaccess\n"); - - /* - * Terminate access to the SD interface and close the file. - */ - if (SDend(sd_id) == FAIL) - printf("*** ERROR from SDend\n"); - - return 0; -} diff --git a/mfhdf/examples/SD_write_to_sds.c b/mfhdf/examples/SD_write_to_sds.c deleted file mode 100644 index f0317eee07..0000000000 --- a/mfhdf/examples/SD_write_to_sds.c +++ /dev/null @@ -1,69 +0,0 @@ -#include "mfhdf.h" - -#define FILE_NAME "SDS.hdf" -#define X_LENGTH 5 -#define Y_LENGTH 16 - -int -main() -{ - /************************* Variable declaration **************************/ - - int32 sd_id, sds_id, sds_index; - int32 start[2], edges[2]; - int32 data[Y_LENGTH][X_LENGTH]; - int i, j; - - /********************* End of variable declaration ***********************/ - - /* - * Data set data initialization. - */ - for (j = 0; j < Y_LENGTH; j++) { - for (i = 0; i < X_LENGTH; i++) - data[j][i] = (i + j) + 1; - } - - /* - * Open the file and initialize the SD interface. - */ - if ((sd_id = SDstart(FILE_NAME, DFACC_WRITE)) == FAIL) - printf("*** ERROR from SDstart\n"); - - /* - * Attach to the first data set. - */ - sds_index = 0; - sds_id = SDselect(sd_id, sds_index); - - /* - * Define the location and size of the data to be written to the data set. - */ - start[0] = 0; - start[1] = 0; - edges[0] = Y_LENGTH; - edges[1] = X_LENGTH; - - /* - * Write the stored data to the data set. The third argument is set to NULL - * to specify contiguous data elements. The last argument must - * be explicitly cast to a generic pointer since SDwritedata is designed - * to write generic data. - */ - if (SDwritedata(sds_id, start, NULL, edges, (void *)data) == FAIL) - printf("*** ERROR from SDwritedata\n"); - - /* - * Terminate access to the data set. - */ - if (SDendaccess(sds_id) == FAIL) - printf("*** ERROR from SDendaccess\n"); - - /* - * Terminate access to the SD interface and close the file. - */ - if (SDend(sd_id) == FAIL) - printf("*** ERROR from SDend\n"); - - return 0; -} diff --git a/mfhdf/examples/testexamples.sh.in b/mfhdf/examples/testexamples.sh.in deleted file mode 100644 index f3bd51e968..0000000000 --- a/mfhdf/examples/testexamples.sh.in +++ /dev/null @@ -1,18 +0,0 @@ -# This test script only runs all the examples right now. It needs -# a lot of work. It should use h4cc to build the examples too. -./create_sds -./write_to_sds -./write_slab -./read_from_sds -./alter_sds_values -./chunking_example -./compress_sds -./dimscale_vs_sds -./find_sds_by_name -./set_attr -./get_attr -./get_info -./mv_sds_to_external -./read_subsets -./set_get_dim_info -./unlimited_sds diff --git a/mfhdf/fortran/Makefile.am b/mfhdf/fortran/Makefile.am index 7b4174a9fd..d90c28d8c5 100644 --- a/mfhdf/fortran/Makefile.am +++ b/mfhdf/fortran/Makefile.am @@ -11,7 +11,7 @@ fort_INCLUDES=-I$(top_srcdir)/hdf/src \ DEFINES=-DHDF AM_CPPFLAGS=$(fort_INCLUDES) $(DEFINES) -DIST_SUBDIRS = examples +DIST_SUBDIRS = ############################################################################# ## Testing -- Here there be dragons. ## @@ -55,23 +55,11 @@ SUFFIXES = .inc .f90 .inc.f90: sed -e 's/^[cC]/!/' -e 's/^ [^ ]/ \&/' < $< > $*.f90 -# Recurse into examples directory for examples tests. -installcheck-local: - @(cd examples && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; - -# 'make install-all' also installs examples +# 'make install-all' install-all: @$(MAKE) $(AM_MAKEFLAGS) install - @$(MAKE) $(AM_MAKEFLAGS) install-examples uninstall-all: @$(MAKE) $(AM_MAKEFLAGS) uninstall - @$(MAKE) $(AM_MAKEFLAGS) uninstall-examples - -# Install examples recursively -install-examples uninstall-examples: - @@SETX@; for d in examples; do \ - (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ - done ############################################################################# ## And the cleanup ## diff --git a/mfhdf/fortran/examples/CMakeLists.txt b/mfhdf/fortran/examples/CMakeLists.txt deleted file mode 100644 index 5f18cd36bf..0000000000 --- a/mfhdf/fortran/examples/CMakeLists.txt +++ /dev/null @@ -1,87 +0,0 @@ -cmake_minimum_required (VERSION 3.12) -project (HDF4_MFHDF_FORTRAN_EXAMPLES C Fortran) -# -------------------------------------------------------------------- -# Notes: When creating examples they should be prefixed -# with "f_ex_". This allows for easier filtering of the examples. -# -------------------------------------------------------------------- - -LINK_DIRECTORIES ( - ${HDF4_MFHDF_BINARY_DIR} - ${HDF4_HDF_BINARY_DIR} - ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -) - -#----------------------------------------------------------------------------- -# Define Sources -#----------------------------------------------------------------------------- -set (examples - SD_create_sds - SD_write_to_sds - SD_write_slab - SD_alter_sds_values - SD_unlimited_sds - SD_mv_sds_to_external - SD_read_from_sds - SD_read_subsets - #SD_get_info - SD_find_sds_by_name - SD_set_get_dim_info - #SD_dimscale_vs_sds - SD_set_attr - #SD_get_attr - SD_compress_sds - SD_chunking_example -) -set (skip_examples - SD_get_info - SD_dimscale_vs_sds - SD_get_attr -) - -foreach (example ${examples}) - add_executable (f_exmf_${example} ${HDF4_MFHDF_FORTRAN_EXAMPLES_SOURCE_DIR}/${example}.f) - target_include_directories (f_exmf_${example} - PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY};${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR}" - ) - target_compile_options(f_exmf_${example} - PRIVATE $<$:${WIN_COMPILE_FLAGS}> - ) - if(MSVC) - set_property(TARGET f_exmf_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (f_exmf_${example} PROPERTIES - LINKER_LANGUAGE Fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} - ) - if (NOT BUILD_SHARED_LIBS) - target_link_libraries (f_exmf_${example} PRIVATE ${HDF4_MF_FORTRAN_LIB_TARGET}) - else () - target_link_libraries (f_exmf_${example} PRIVATE ${HDF4_MF_FORTRAN_LIBSH_TARGET}) - endif () -endforeach () - -foreach (example ${skip_examples}) - add_executable (f_exmf_${example} ${HDF4_MFHDF_FORTRAN_EXAMPLES_SOURCE_DIR}/${example}.f) - target_include_directories (f_exmf_${example} - PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY};${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR}" - ) - target_compile_options(f_exmf_${example} - PRIVATE $<$:${WIN_COMPILE_FLAGS}> - ) - if(MSVC) - set_property(TARGET f_exmf_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") - endif() - set_target_properties (f_exmf_${example} PROPERTIES - LINKER_LANGUAGE Fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} - ) - if (NOT BUILD_SHARED_LIBS) - target_link_libraries (f_exmf_${example} PRIVATE ${HDF4_MF_FORTRAN_LIB_TARGET}) - else () - target_link_libraries (f_exmf_${example} PRIVATE ${HDF4_MF_FORTRAN_LIBSH_TARGET}) - endif () -endforeach () - -if (BUILD_TESTING) - include (CMakeTests.cmake) -endif () diff --git a/mfhdf/fortran/examples/CMakeTests.cmake b/mfhdf/fortran/examples/CMakeTests.cmake deleted file mode 100644 index 1fbb8e5d10..0000000000 --- a/mfhdf/fortran/examples/CMakeTests.cmake +++ /dev/null @@ -1,34 +0,0 @@ - -############################################################################## -############################################################################## -### T E S T I N G ### -############################################################################## -############################################################################## - -# Remove any output file left over from previous test run -add_test ( - NAME MFHDF_FORTRAN_EXAMPLES-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - SDS.hdf - SDSchunked.hdf - SDScompressed.hdf - SDSUNLIMITED.hdf - SLABS.hdf -) -set_tests_properties (MFHDF_FORTRAN_EXAMPLES-clearall-objects PROPERTIES LABELS ${PROJECT_NAME}) -set (last_test "MFHDF_FORTRAN_EXAMPLES-clearall-objects") - -foreach (example ${examples}) - add_test (NAME f_exmftest_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (f_exmftest_${example} PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME}) - else () - set_tests_properties (f_exmftest_${example} PROPERTIES LABELS ${PROJECT_NAME}) - endif () - set (last_test "f_exmftest_${example}") -endforeach () - -foreach (example ${skip_examples}) - add_test (NAME f_exmftest_${example} COMMAND ${CMAKE_COMMAND} -E echo "SKIP f_exmftest_${example}") -endforeach () diff --git a/mfhdf/fortran/examples/Makefile.am b/mfhdf/fortran/examples/Makefile.am deleted file mode 100644 index ac8555482c..0000000000 --- a/mfhdf/fortran/examples/Makefile.am +++ /dev/null @@ -1,62 +0,0 @@ -############################################################################# -## Setup for building programs ## -############################################################################# - -include $(top_srcdir)/config/commence.am - -DEFINES=-DHDF - -############################################################################# -## Programs to build ## -############################################################################# - -# These are the Fortran test programs to build. -EXAMPLE_PROG=SD_create_sds SD_write_to_sds SD_write_slab SD_alter_sds_values SD_unlimited_sds \ - SD_mv_sds_to_external SD_read_from_sds SD_read_subsets SD_get_info \ - SD_find_sds_by_name SD_set_get_dim_info SD_dimscale_vs_sds SD_set_attr \ - SD_get_attr SD_compress_sds SD_chunking_example -TEST_PROG = $(EXAMPLE_PROG) - -# These are the Fortran example files to be installed -INSTALL_FILES=SD_create_sds.f SD_write_to_sds.f SD_write_slab.f SD_alter_sds_values.f \ - SD_unlimited_sds.f SD_mv_sds_to_external.f SD_read_from_sds.f SD_read_subsets.f \ - SD_get_info.f SD_find_sds_by_name.f SD_set_get_dim_info.f SD_dimscale_vs_sds.f \ - SD_set_attr.f SD_get_attr.f SD_compress_sds.f SD_chunking_example.f - -# Where to install example files -EXAMPLEDIR=${DESTDIR}$(exec_prefix)/share/hdf4_examples/fortran - -# How to build Fortran programs using h4fc -$(EXTRA_PROG): $(H4FC) - $(H4FC) $(H4FCFLAGS) $(FCFLAGS) -o $@ $(srcdir)/$@.f; - -# List dependencies for each program. Normally, automake would take -# care of this for us, but if we tell automake about the programs it -# will try to build them with the normal Fortran compiler, not h4fc. -SD_create_sds: $(srcdir)/SD_create_sds.f -SD_write_to_sds: $(srcdir)/SD_write_to_sds.f -SD_write_slab: $(srcdir)/SD_write_slab.f -SD_alter_sds_values: $(srcdir)/SD_alter_sds_values.f -SD_unlimited_sds: $(srcdir)/SD_unlimited_sds.f -SD_mv_sds_to_external: $(srcdir)/SD_mv_sds_to_external.f -SD_read_from_sds: $(srcdir)/SD_read_from_sds.f -SD_read_subsets: $(srcdir)/SD_read_subsets.f -SD_get_info: $(srcdir)/SD_get_info.f -SD_find_sds_by_name: $(srcdir)/SD_find_sds_by_name.f -SD_set_get_dim_info: $(srcdir)/SD_set_get_dim_info.f -SD_dimscale_vs_sds: $(srcdir)/SD_dimscale_vs_sds.f -SD_set_attr: $(srcdir)/SD_set_attr.f -SD_get_attr: $(srcdir)/SD_get_attr.f -SD_compress_sds: $(srcdir)/SD_compress_sds.f -SD_chunking_example: $(srcdir)/SD_chunking_example.f - -CHECK_CLEANFILES += ExternalSDS - -DISTCLEANFILES = *.chkexe *.chklog - -if BUILD_SHARED_SZIP_CONDITIONAL -LD_LIBRARY_PATH=$(LL_PATH) -endif - -include $(top_srcdir)/config/examples.am -include $(top_srcdir)/config/conclude.am diff --git a/mfhdf/fortran/examples/SD_alter_sds_values.f b/mfhdf/fortran/examples/SD_alter_sds_values.f deleted file mode 100644 index 568c714f65..0000000000 --- a/mfhdf/fortran/examples/SD_alter_sds_values.f +++ /dev/null @@ -1,71 +0,0 @@ - program alter_data - implicit none -C -C Parameter declaration. -C - character*7 FILE_NAME - integer DFACC_WRITE - parameter (FILE_NAME = 'SDS.hdf', - + DFACC_WRITE = 2) -C -C Function declaration. -C - integer sfstart, sfselect, sfwdata, sfendacc, sfend -C -C**** Variable declaration ******************************************* -C - integer sd_id, sds_id, sds_index - integer start(2), edges(2), stride(2) - integer status - integer new_data(2) -C -C**** End of variable declaration ************************************ -C - -C -C Open the file and initialize the SD interface. -C - sd_id = sfstart(FILE_NAME, DFACC_WRITE) -C -C Select the first data set. -C - sds_index = 0 - sds_id = sfselect(sd_id, sds_index) - -C -C Initialize the start, edge, and stride parameters to write -C two elements into 2nd row, 10th column and 11th column places. -C -C Specify 2nd row. -C - start(1) = 1 -C -C Specify 10th column. -C - start(2) = 9 - edges(1) = 1 -C -C Two elements are written along 2nd row. -C - edges(2) = 2 - stride(1) = 1 - stride(2) = 1 -C -C Initialize the new values to be written. -C - new_data(1) = 1000 - new_data(2) = 1000 -C -C Write the new values. -C - status = sfwdata(sds_id, start, stride, edges, new_data) -C -C Terminate access to the data set. -C - status = sfendacc(sds_id) -C -C Terminate access to the SD interface and close the file. -C - status = sfend(sd_id) - - end diff --git a/mfhdf/fortran/examples/SD_chunking_example.f b/mfhdf/fortran/examples/SD_chunking_example.f deleted file mode 100644 index 3c3471aa2d..0000000000 --- a/mfhdf/fortran/examples/SD_chunking_example.f +++ /dev/null @@ -1,289 +0,0 @@ - program chunk_examples - implicit none -C -C Parameter declaration. -C - character*14 FILE_NAME - character*11 SDS_NAME - integer RANK - parameter (FILE_NAME = 'SDSchunked.hdf', - + SDS_NAME = 'ChunkedData', - + RANK = 2) - integer DFACC_CREATE, DFACC_READ, DFNT_INT16 - parameter (DFACC_CREATE = 4, - + DFACC_READ = 1, - + DFNT_INT16 = 22) - integer COMP_CODE_NONE - parameter (COMP_CODE_NONE = 0) -C -C This example does not use compression. -C -C To use RLE compression, declare: -C -C integer COMP_CODE_RLE -C parameter (COMP_CODE_RLE = 1) -C -C To use NBIT compression, declare: -C -C integer COMP_CODE_NBIT -C parameter (COMP_CODE_NBIT = 2) -C -C To use Skipping Huffman compression, declare: -C -C integer COMP_CODE_SKPHUFF -C parameter (COMP_CODE_SKPHUFF = 3) -C -C To use GZIP compression, declare: -C -C integer COMP_CODE_DEFLATE -C parameter (COMP_CODE_DEFLATE = 4) -C -C -C Function declaration. -C - integer sfstart, sfcreate, sfendacc, sfend, - + sfselect, sfsfill, sfschnk, sfwchnk, - + sfrchnk, sfgichnk, sfwdata, sfrdata, - + sfscchnk -C -C**** Variable declaration ******************************************* -C - integer sd_id, sds_id, sds_index, status - integer dim_sizes(2), origin(2) - integer fill_value, maxcache, new_maxcache, flag - integer start(2), edges(2), stride(2) - integer*2 all_data(4,9) - integer*2 row(3), column(2) - integer*2 chunk_out(2,3) - integer*2 chunk1(2,3), - + chunk2(2,3), - + chunk3(2,3), - + chunk6(2,3) - integer i, j -C -C Compression flag and parameters. -C - integer comp_type, comp_flag, comp_prm(4) -C -C Chunk's dimensions. -C - integer dim_length(2), dim_length_out(2) -C -C Initialize four chunks -C - data chunk1 /6*1/ - data chunk2 /6*2/ - data chunk3 /6*3/ - data chunk6 /6*6/ -C -C Initialize row and column arrays. -C - data row /3*4/ - data column /2*5/ -C -C**** End of variable declaration ************************************ -C -C -C Define chunk's dimensions. -C - dim_length(1) = 2 - dim_length(2) = 3 -C -C Create the file and initialize SD interface. -C - sd_id = sfstart(FILE_NAME, DFACC_CREATE) - -C -C Create 4x9 SDS -C - dim_sizes(1) = 4 - dim_sizes(2) = 9 - sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT16, - + RANK, dim_sizes) -C -C Fill SDS array with the fill value. -C - fill_value = 0 - status = sfsfill( sds_id, fill_value) -C -C Create chunked SDS. -C -C In this example we do not use compression. -C -C To use RLE compression, initialize comp_type parameter -C before the call to sfschnk function. -C comp_type = COMP_CODE_RLE -C -C To use NBIT, Skipping Huffman, or GZIP compression, -C initialize comp_prm array and comp type parameter -C before call to sfschnk function -C -C NBIT: -C comp_prm(1) = value_of(sign_ext) -C comp_prm(2) = value_of(fill_one) -C comp_prm(3) = value_of(start_bit) -C comp_prm(4) = value_of(bit_len) -C comp_type = COMP_CODE_NBIT -C -C Skipping Huffman: -C comp_prm(1) = value_of(skp_size) -C comp_type = COMP_CODE_SKPHUFF -C -C GZIP: -C comp_prm(1) = value_of(deflate_level) -C comp_type = COMP_CODE_DEFLATE -C -C - comp_type = COMP_CODE_NONE - status = sfschnk(sds_id, dim_length, comp_type, comp_prm) -C -C Set chunk cache to hold maximum 2 chunks. -C - flag = 0 - maxcache = 2 - new_maxcache = sfscchnk(sds_id, maxcache, flag) -C -C Write chunks using SDwritechunk function. -C Chunks can be written in any order. -C -C Write chunk with the coordinates (1,1). -C - origin(1) = 1 - origin(2) = 1 - status = sfwchnk(sds_id, origin, chunk1) -C -C Write chunk with the coordinates (1,2). -C - origin(1) = 1 - origin(2) = 2 - status = sfwchnk(sds_id, origin, chunk3) -C -C Write chunk with the coordinates (2,1). -C - origin(1) = 2 - origin(2) = 1 - status = sfwchnk(sds_id, origin, chunk2) -C -C Write chunk with the coordinates (2,3). -C - origin(1) = 2 - origin(2) = 3 - status = sfwchnk(sds_id, origin, chunk6) -C -C Fill second row in the chunk with the coordinates (2,2). -C - start(1) = 3 - start(2) = 3 - edges(1) = 1 - edges(2) = 3 - stride(1) = 1 - stride(2) = 1 - status = sfwdata(sds_id, start, stride, edges, row) -C -C Fill second column in the chunk with the coordinates (1,3). -C - start(1) = 0 - start(2) = 7 - edges(1) = 2 - edges(2) = 1 - stride(1) = 1 - stride(2) = 1 - status = sfwdata(sds_id, start, stride, edges, column) -C -C Terminate access to the data set. -C - status = sfendacc(sds_id) -C -C Terminate access to the SD interface and close the file. -C - status = sfend(sd_id) -C -C Reopen the file and access the first data set. -C - sd_id = sfstart(FILE_NAME, DFACC_READ) - sds_index = 0 - sds_id = sfselect(sd_id, sds_index) -C -C Get information about the SDS. -C - status = sfgichnk(sds_id, dim_length_out, comp_flag) - if (comp_flag .eq. 0) then - write(*,*) 'SDS is chunked' - endif - if (comp_flag .eq. 1) then - write(*,*) 'SDS is chunked and compressed' - endif - if (comp_flag .eq. 2) then - write(*,*) 'SDS is chunked and NBIT compressed' - endif - write(*,*) 'Chunks dimensions are ', dim_length_out(1), - + ' x' ,dim_length_out(2) -C -C Read the whole SDS using sfrdata function and display -C what we have read. The following information will be displayed: -C -C -C SDS is chunked -C Chunks dimensions are 2 x 3 -C -C 1 1 1 3 3 3 0 5 0 -C 1 1 1 3 3 3 0 5 0 -C 2 2 2 0 0 0 6 6 6 -C 2 2 2 4 4 4 6 6 6 -C - start(1) = 0 - start(2) = 0 - edges(1) = 4 - edges(2) = 9 - stride(1) = 1 - stride(2) = 1 - status = sfrdata(sds_id, start, stride, edges, all_data) -C -C Display the SDS. -C - write(*,*) - do 10 i = 1,4 - write(*,*) (all_data(i,j), j=1,9) -10 continue -C -C Read chunks with the coordinates (2,2) and (1,3) and display. -C The following information will be shown: -C -C Chunk (2,2) -C -C 0 0 0 -C 4 4 4 -C -C Chunk (1,3) -C -C 0 5 0 -C 0 5 0 -C - origin(1) = 2 - origin(2) = 2 - status = sfrchnk(sds_id, origin, chunk_out) - write(*,*) - write(*,*) 'Chunk (2,2)' - write(*,*) - do 20 i = 1,2 - write(*,*) (chunk_out(i,j), j=1,3) -20 continue -C - origin(1) = 1 - origin(2) = 3 - status = sfrchnk(sds_id, origin, chunk_out) - write(*,*) - write(*,*) 'Chunk (1,3)' - write(*,*) - do 30 i = 1,2 - write(*,*) (chunk_out(i,j), j=1,3) -30 continue -C -C Terminate access to the data set. -C - status = sfendacc(sds_id) -C -C Terminate access to the SD interface and close the file. -C - status = sfend(sd_id) - end diff --git a/mfhdf/fortran/examples/SD_compress_sds.f b/mfhdf/fortran/examples/SD_compress_sds.f deleted file mode 100644 index 14cd7f37e9..0000000000 --- a/mfhdf/fortran/examples/SD_compress_sds.f +++ /dev/null @@ -1,95 +0,0 @@ - program write_compressed_data - implicit none -C -C Parameter declaration. -C - character*17 FILE_NAME - character*7 SDS_NAME - integer X_LENGTH, Y_LENGTH, RANK - parameter (FILE_NAME = 'SDScompressed.hdf', - + SDS_NAME = 'SDSgzip', - + X_LENGTH = 5, - + Y_LENGTH = 16, - + RANK = 2) - integer DFACC_CREATE, DFNT_INT32 - parameter (DFACC_CREATE = 4, - + DFNT_INT32 = 24) - integer COMP_CODE_DEFLATE - parameter (COMP_CODE_DEFLATE = 4) - integer DEFLATE_LEVEL - parameter (DEFLATE_LEVEL = 6) -C To use Skipping Huffman compression method, declare -C integer COMP_CODE_SKPHUFF -C parameter(COMP_CODE_SKPHUFF = 3) -C To use RLE compression method, declare -C integer COMP_CODE_RLE -C parameter(COMP_CODE_RLE = 1) -C -C -C Function declaration. -C - integer sfstart, sfcreate, sfwdata, sfendacc, sfend, - + sfscompress -C -C**** Variable declaration ******************************************* -C - integer sd_id, sds_id, status - integer start(2), edges(2), stride(2), dim_sizes(2) - integer comp_type - integer comp_prm(1) - integer data(X_LENGTH, Y_LENGTH) - integer i, j -C -C**** End of variable declaration ************************************ -C -C -C Buffer array data and define array dimensions. -C - do 20 j = 1, Y_LENGTH - do 10 i = 1, X_LENGTH - data(i, j) = i + j - 1 -10 continue -20 continue - dim_sizes(1) = X_LENGTH - dim_sizes(2) = Y_LENGTH -C -C Open the file and initialize the SD interface. -C - sd_id = sfstart(FILE_NAME, DFACC_CREATE) -C -C Create the data set with the name SDS_NAME. -C - sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, dim_sizes) -C -C Initialize compression parameter (deflate level) -C and call sfscompress function -C For Skipping Huffman compression, comp_prm(1) should be set -C to skipping sizes value (skp_size). -C - comp_type = COMP_CODE_DEFLATE - comp_prm(1) = deflate_level - status = sfscompress(sds_id, comp_type, comp_prm(1)) -C -C Define the location and size of the data that will be written to -C the data set. -C - start(1) = 0 - start(2) = 0 - edges(1) = X_LENGTH - edges(2) = Y_LENGTH - stride(1) = 1 - stride(2) = 1 -C -C Write the stored data to the data set. -C - status = sfwdata(sds_id, start, stride, edges, data) -C -C Terminate access to the data set. -C - status = sfendacc(sds_id) -C -C Terminate access to the SD interface and close the file. -C - status = sfend(sd_id) - - end diff --git a/mfhdf/fortran/examples/SD_create_sds.f b/mfhdf/fortran/examples/SD_create_sds.f deleted file mode 100644 index 586416cda5..0000000000 --- a/mfhdf/fortran/examples/SD_create_sds.f +++ /dev/null @@ -1,54 +0,0 @@ - program create_SDS - implicit none -C -C Parameter declaration. -C - character*7 FILE_NAME - character*11 SDS_NAME - integer X_LENGTH, Y_LENGTH, RANK - parameter (FILE_NAME = 'SDS.hdf', - + SDS_NAME = 'SDStemplate', - + X_LENGTH = 5, - + Y_LENGTH = 16, - + RANK = 2) - integer DFACC_CREATE, DFNT_INT32 - parameter (DFACC_CREATE = 4, - + DFNT_INT32 = 24) -C -C Function declaration. -C - integer sfstart, sfcreate, sfendacc, sfend -C -C**** Variable declaration ******************************************* -C - integer sd_id, sds_id, dim_sizes(2) - integer status -C -C**** End of variable declaration ************************************ -C -C -C Create the file and initialize the SD interface. -C - sd_id = sfstart(FILE_NAME, DFACC_CREATE) -C -C Define dimensions of the array to be created. -C - dim_sizes(1) = X_LENGTH - dim_sizes(2) = Y_LENGTH -C -C Create the array with the name defined in SDS_NAME. -C Note that DFNT_INT32 indicates that the SDS data is of type -C integer. Refer to Tables 2E and 2I for the definition of other types. -C - sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, - . dim_sizes) -C -C Terminate access to the data set. -C - status = sfendacc(sds_id) -C -C Terminate access to the SD interface and close the file. -C - status = sfend(sd_id) - - end diff --git a/mfhdf/fortran/examples/SD_dimscale_vs_sds.f b/mfhdf/fortran/examples/SD_dimscale_vs_sds.f deleted file mode 100644 index 9cb4c57495..0000000000 --- a/mfhdf/fortran/examples/SD_dimscale_vs_sds.f +++ /dev/null @@ -1,68 +0,0 @@ - program sds_vrs_coordvar - implicit none -C -C Parameter declaration. -C - character*7 FILE_NAME - parameter (FILE_NAME = 'SDS.hdf') - integer DFACC_READ, DFNT_INT32 - parameter (DFACC_READ = 1, - + DFNT_INT32 = 24) - integer MAX_VAR_DIMS - parameter (MAX_VAR_DIMS = 32) -C -C Function declaration. -C - integer sfstart, sfselect, sfiscvar, sffinfo, sfginfo - integer sfendacc, sfend -C -C**** Variable declaration ******************************************* -C - integer sd_id, sds_id, sds_index, status - integer rank, data_type - integer n_datasets, n_file_attrs, n_attrs - integer dim_sizes(MAX_VAR_DIMS) - character*256 sds_name -C -C**** End of variable declaration ************************************ -C -C -C Open the file and initialize the SD interface. -C - sd_id = sfstart(FILE_NAME, DFACC_READ) -C -C Obtain information about the file. -C - status = sffinfo(sd_id, n_datasets, n_file_attrs) -C -C Get information about each SDS in the file. -C Check whether it is a coordinate variable, then display retrieved -C information. -C Output displayed: -C -C SDS array with the name SDStemplate -C Coordinate variable with the name X_Axis -C Coordinate variable with the name Y_Axis -C - do 10 sds_index = 0, n_datasets-1 - sds_id = sfselect(sd_id, sds_index) - status = sfginfo(sds_id, sds_name, rank, dim_sizes, - + data_type, n_attrs) - status = sfiscvar(sds_id) - if (status .eq. 1) then - write(*,*) "Coordinate variable with the name ", - + sds_name(1:6) - else - write(*,*) "SDS array with the name ", - + sds_name(1:11) - endif -C -C Terminate access to the data set. -C - status = sfendacc(sds_id) -10 continue -C -C Terminate access to the SD interface and close the file. -C - status = sfend(sd_id) - end diff --git a/mfhdf/fortran/examples/SD_find_sds_by_name.f b/mfhdf/fortran/examples/SD_find_sds_by_name.f deleted file mode 100644 index c727e30cfb..0000000000 --- a/mfhdf/fortran/examples/SD_find_sds_by_name.f +++ /dev/null @@ -1,82 +0,0 @@ - program locate_by_name - implicit none -C -C Parameter declaration. -C - character*7 FILE_NAME - character*11 SDS_NAME - character*9 WRONG_NAME - integer X_LENGTH, Y_LENGTH - parameter (FILE_NAME = 'SDS.hdf', - + SDS_NAME = 'SDStemplate', - + WRONG_NAME = 'WrongName', - + X_LENGTH = 5, - + Y_LENGTH = 16) - integer DFACC_READ, DFNT_INT32 - parameter (DFACC_READ = 1, - + DFNT_INT32 = 24) - -C -C Function declaration. -C - integer sfstart, sfn2index, sfselect, sfrdata, sfendacc, sfend -C -C**** Variable declaration ******************************************* -C - integer sd_id, sds_id, sds_index, status - integer start(2), edges(2), stride(2) - integer data(X_LENGTH, Y_LENGTH) - integer j -C -C**** End of variable declaration ************************************ -C -C -C Open the file and initialize the SD interface. -C - sd_id = sfstart(FILE_NAME, DFACC_READ) -C -C Find index of the data set with the name specified in WRONG_NAME. -C Error condition occurs, since a data set with this name -C does not exist in the file. -C - sds_index = sfn2index(sd_id, WRONG_NAME) - if (sds_index .eq. -1) then - write(*,*) "Data set with the name ", WRONG_NAME, - + " does not exist" - endif -C -C Find index of the data set with the name specified in SDS_NAME -C and use the index to attach to the data set. -C - sds_index = sfn2index(sd_id, SDS_NAME) - sds_id = sfselect(sd_id, sds_index) -C -C Set elements of start array to 0, elements of edges array -C to SDS dimensions, and elements of stride array to 1 to read entire data. -C - start(1) = 0 - start(2) = 0 - edges(1) = X_LENGTH - edges(2) = Y_LENGTH - stride(1) = 1 - stride(2) = 1 -C -C Read entire data into array named data. -C - status = sfrdata(sds_id, start, stride, edges, data) -C -C Print 10th column; the following numbers should be displayed: -C -C 10 1000 12 13 14 -C - write(*,*) (data(j,10), j = 1, X_LENGTH) -C -C Terminate access to the data set. -C - status = sfendacc(sds_id) -C -C Terminate access to the SD interface and close the file. -C - status = sfend(sd_id) - - end diff --git a/mfhdf/fortran/examples/SD_get_attr.f b/mfhdf/fortran/examples/SD_get_attr.f deleted file mode 100644 index 2c360fa534..0000000000 --- a/mfhdf/fortran/examples/SD_get_attr.f +++ /dev/null @@ -1,125 +0,0 @@ - program attr_info - implicit none -C -C Parameter declaration. -C - character*7 FILE_NAME - character*13 FILE_ATTR_NAME - character*11 SDS_ATTR_NAME - character*10 DIM_ATTR_NAME - parameter (FILE_NAME = 'SDS.hdf', - + FILE_ATTR_NAME = 'File_contents', - + SDS_ATTR_NAME = 'Valid_range', - + DIM_ATTR_NAME = 'Dim_metric') - integer DFACC_READ, DFNT_FLOAT32 - parameter (DFACC_READ = 1, - + DFNT_FLOAT32 = 5) - -C -C Function declaration. -C - integer sfstart, sffattr, sfgainfo, sfrattr, sfselect - integer sfdimid, sfendacc, sfend -C -C**** Variable declaration ******************************************* -C - integer sd_id, sds_id, dim_id - integer attr_index, data_type, n_values, status - real sds_data(2) - character*20 attr_name - character*16 file_data - character*7 dim_data - integer i -C -C**** End of variable declaration ************************************ -C -C -C Open the file and initialize SD interface. -C - sd_id = sfstart(FILE_NAME, DFACC_READ) -C -C Find the file attribute defined by FILE_ATTR_NAME. -C Note that the first parameter is an SD interface identifier. -C - attr_index = sffattr(sd_id, FILE_ATTR_NAME) -C -C Get information about the file attribute. -C - status = sfgainfo(sd_id, attr_index, attr_name, data_type, - + n_values) -C -C Read the file attribute data. -C - status = sfrattr(sd_id, attr_index, file_data) -C -C Print file attribute value. -C - write(*,*) "File attribute value is : ", file_data -C -C Select the first data set. -C - sds_id = sfselect(sd_id, 0) -C -C Find the data set attribute defined by SDS_ATTR_NAME. -C Note that the first parameter is a data set identifier. -C - attr_index = sffattr(sds_id, SDS_ATTR_NAME) -C -C Get information about the data set attribute. -C - status = sfgainfo(sds_id, attr_index, attr_name, data_type, - + n_values) -C -C Read the SDS attribute data. -C - status = sfrattr(sds_id, attr_index, sds_data) - -C -C Print SDS attribute data type and values. -C - if (data_type .eq. DFNT_FLOAT32) then - write(*,*) "SDS attribute data type is : float32 " - endif - write(*,*) "SDS attribute values are : " - write(*,*) (sds_data(i), i=1, n_values) -C -C Get the identifier for the first dimension of the SDS. -C - dim_id = sfdimid(sds_id, 0) -C -C Find the dimensional attribute defined by DIM_ATTR_NAME. -C Note that the first parameter is a dimension identifier. -C - attr_index = sffattr(dim_id, DIM_ATTR_NAME) -C -C Get information about dimension attribute. -C - status = sfgainfo(dim_id, attr_index, attr_name, data_type, - + n_values) -C -C Read the dimension attribute data. -C - status = sfrattr(dim_id, attr_index, dim_data) -C -C Print dimension attribute value. -C - write(*,*) "Dimensional attribute value is : ", dim_data -C -C Terminate access to the data set. -C - status = sfendacc(sds_id) -C -C Terminate access to the SD interface and close the file. -C - status = sfend(sd_id) -C -C Output of this program is : -C -C -C File attribute value is : Storm_track_data -C SDS attribute data type is : float32 -C SDS attribute values are : -C 2.00000 10.00000 -C Dimensional attribute value is : Seconds -C - end diff --git a/mfhdf/fortran/examples/SD_get_info.f b/mfhdf/fortran/examples/SD_get_info.f deleted file mode 100644 index 546f3b1d1b..0000000000 --- a/mfhdf/fortran/examples/SD_get_info.f +++ /dev/null @@ -1,71 +0,0 @@ - program get_data_set_info - implicit none -C -C Parameter declaration. -C - character*7 FILE_NAME - parameter (FILE_NAME = 'SDS.hdf') - integer DFACC_READ, DFNT_INT32 - parameter (DFACC_READ = 1, - + DFNT_INT32 = 24) - integer MAX_NC_NAME, MAX_VAR_DIMS - parameter (MAX_NC_NAME = 256, - + MAX_VAR_DIMS = 32) -C -C Function declaration. -C - integer sfstart, sffinfo, sfselect, sfginfo - integer sfendacc, sfend -C -C**** Variable declaration ******************************************* -C - integer sd_id, sds_id - integer n_datasets, n_file_attrs, index - integer status, n_attrs - integer rank, data_type - integer dim_sizes(MAX_VAR_DIMS) - character name *(MAX_NC_NAME) - integer i -C -C**** End of variable declaration ************************************ -C -C -C Open the file and initialize the SD interface. -C - sd_id = sfstart(FILE_NAME, DFACC_READ) -C -C Determine the number of data sets in the file and the number of -C file attributes. -C - status = sffinfo(sd_id, n_datasets, n_file_attrs) -C -C Access every data set in the file and print its name, rank, -C dimension sizes, data type, and number of attributes. -C The following information should be displayed: -C -C name = SDStemplate -C rank = 2 -C dimension sizes are : 5 16 -C data type is 24 -C number of attributes is 0 -C - do 10 index = 0, n_datasets - 1 - sds_id = sfselect(sd_id, index) - status = sfginfo(sds_id, name, rank, dim_sizes, data_type, - . n_attrs) - write(*,*) "name = ", name(1:15) - write(*,*) "rank = ", rank - write(*,*) "dimension sizes are : ", (dim_sizes(i), i=1, rank) - write(*,*) "data type is ", data_type - write(*,*) "number of attributes is ", n_attrs -C -C Terminate access to the current data set. -C - status = sfendacc(sds_id) -10 continue -C -C Terminate access to the SD interface and close the file. -C - status = sfend(sd_id) - - end diff --git a/mfhdf/fortran/examples/SD_mv_sds_to_external.f b/mfhdf/fortran/examples/SD_mv_sds_to_external.f deleted file mode 100644 index f15d01f80e..0000000000 --- a/mfhdf/fortran/examples/SD_mv_sds_to_external.f +++ /dev/null @@ -1,50 +0,0 @@ - program write_extfile - implicit none -C -C Parameter declaration. -C - character*7 FILE_NAME - character*11 EXT_FILE_NAME - integer OFFSET - integer DFACC_WRITE - parameter (FILE_NAME = 'SDS.hdf', - + EXT_FILE_NAME = 'ExternalSDS', - + OFFSET = 24, - + DFACC_WRITE = 2) - -C -C Function declaration. -C - integer sfstart, sfselect, sfsextf, sfendacc, sfend -C -C**** Variable declaration ******************************************* -C - integer sd_id, sds_id, sds_index - integer status -C -C**** End of variable declaration ************************************ -C -C -C Open the HDF file and initialize the SD interface. -C - sd_id = sfstart(FILE_NAME, DFACC_WRITE) -C -C Select the first data set. -C - sds_index = 0 - sds_id = sfselect(sd_id, sds_index) -C -C Create a file with the name EXT_FILE_NAME and move the data set -C into it, starting at byte location OFFSET. -C - status = sfsextf(sds_id, EXT_FILE_NAME, OFFSET) -C -C Terminate access to the data set. -C - status = sfendacc(sds_id) -C -C Terminate access to the SD interface and close the file. -C - status = sfend(sd_id) - - end diff --git a/mfhdf/fortran/examples/SD_read_from_sds.f b/mfhdf/fortran/examples/SD_read_from_sds.f deleted file mode 100644 index 4f802bb877..0000000000 --- a/mfhdf/fortran/examples/SD_read_from_sds.f +++ /dev/null @@ -1,72 +0,0 @@ - program read_data - implicit none -C -C Parameter declaration. -C - character*7 FILE_NAME - integer X_LENGTH, Y_LENGTH - parameter (FILE_NAME = 'SDS.hdf', - + X_LENGTH = 5, - + Y_LENGTH = 16) - integer DFACC_READ, DFNT_INT32 - parameter (DFACC_READ = 1, - + DFNT_INT32 = 24) - -C -C Function declaration. -C - integer sfstart, sfselect, sfrdata, sfendacc, sfend -C -C**** Variable declaration ******************************************* -C - integer sd_id, sds_id, sds_index, status - integer start(2), edges(2), stride(2) - integer data(X_LENGTH, Y_LENGTH) - integer j -C -C**** End of variable declaration ************************************ -C -C -C Open the file and initialize the SD interface. -C - sd_id = sfstart(FILE_NAME, DFACC_READ) - -C -C Select the first data set. -C - sds_index = 0 - sds_id = sfselect(sd_id, sds_index) - -C -C Set elements of the array start to 0, elements of the array edges to -C SDS dimensions, and elements of the array stride to 1 to read the -C entire data. -C - start(1) = 0 - start(2) = 0 - edges(1) = X_LENGTH - edges(2) = Y_LENGTH - stride(1) = 1 - stride(2) = 1 -C -C Read entire data into data array. Note that sfrdata is used -C to read the numeric data. -C - status = sfrdata(sds_id, start, stride, edges, data) - -C -C Print 10th column; the following numbers are displayed: -C -C 10 1000 12 13 14 -C - write(*,*) (data(j,10), j = 1, X_LENGTH) -C -C Terminate access to the data set. -C - status = sfendacc(sds_id) -C -C Terminate access to the SD interface and close the file. -C - status = sfend(sd_id) - - end diff --git a/mfhdf/fortran/examples/SD_read_subsets.f b/mfhdf/fortran/examples/SD_read_subsets.f deleted file mode 100644 index 16ad8d84bb..0000000000 --- a/mfhdf/fortran/examples/SD_read_subsets.f +++ /dev/null @@ -1,125 +0,0 @@ - program read_subsets - implicit none -C -C Parameter declaration. -C - character*7 FILE_NAME - parameter (FILE_NAME = 'SDS.hdf') - integer DFACC_READ, DFNT_INT32 - parameter (DFACC_READ = 1, - + DFNT_INT32 = 24) - integer SUB1_LENGTH, SUB2_LENGTH, SUB3_LENGTH1, - + SUB3_LENGTH2 - parameter (SUB1_LENGTH = 5, - + SUB2_LENGTH = 4, - + SUB3_LENGTH1 = 2, - + SUB3_LENGTH2 = 3) - -C -C Function declaration. -C - integer sfstart, sfselect, sfrdata, sfendacc, sfend -C -C**** Variable declaration ******************************************* -C - integer sd_id, sds_id, sds_index, status - integer start(2), edges(2), stride(2) - integer sub1_data(SUB1_LENGTH) - integer sub2_data(SUB2_LENGTH) - integer sub3_data(SUB3_LENGTH1,SUB3_LENGTH2) - integer i, j -C -C**** End of variable declaration ************************************ -C -C -C Open the file and initialize the SD interface. -C - sd_id = sfstart(FILE_NAME, DFACC_READ) -C -C Select the first data set. -C - sds_index = 0 - sds_id =sfselect(sd_id, sds_index) -C -C Reading the first subset. -C -C Set elements of start, stride, and edges arrays to read -C every 3d element in in the 2nd row starting in the 4th column. -C - start(1) = 1 - start(2) = 3 - edges(1) = 1 - edges(2) = SUB1_LENGTH - stride(1) = 1 - stride(2) = 3 -C -C Read the data from sub1_data array. -C - status = sfrdata(sds_id, start, stride, edges, sub1_data) - -C -C Print what we have just read, the following numbers should be displayed: -C -C 5 8 1000 14 17 -C - write(*,*) (sub1_data(j), j = 1, SUB1_LENGTH) -C -C Reading the second subset. -C -C Set elements of start, stride, and edges arrays to read -C first 4 elements of 10th column. -C - start(1) = 0 - start(2) = 9 - edges(1) = SUB2_LENGTH - edges(2) = 1 - stride(1) = 1 - stride(2) = 1 -C -C Read the data into sub2_data array. -C - status = sfrdata(sds_id, start, stride, edges, sub2_data) - -C -C Print what we have just read; the following numbers should be displayed: -C -C 10 1000 12 13 -C - write(*,*) (sub2_data(j), j = 1, SUB2_LENGTH) -C -C Reading the third subset. -C -C Set elements of start, stride and edges arrays to read -C every 6th element in the row and every 4th element in the column -C starting at 1st row, 3rd column. -C - start(1) = 0 - start(2) = 2 - edges(1) = SUB3_LENGTH1 - edges(2) = SUB3_LENGTH2 - stride(1) = 4 - stride(2) = 6 -C -C Read the data from the file into sub3_data array. -C - status = sfrdata(sds_id, start, stride, edges, sub3_data) - -C -C Print what we have just read; the following numbers should be displayed: -C -C 3 9 15 -C 7 13 19 -C - do 50 i = 1, SUB3_LENGTH1 - write(*,*) (sub3_data(i,j), j = 1, SUB3_LENGTH2) -50 continue -C -C Terminate access to the data set. -C - status = sfendacc(sds_id) -C -C Terminate access to the SD interface and close the file. -C - status = sfend(sd_id) - - end diff --git a/mfhdf/fortran/examples/SD_set_attr.f b/mfhdf/fortran/examples/SD_set_attr.f deleted file mode 100644 index b66a19120e..0000000000 --- a/mfhdf/fortran/examples/SD_set_attr.f +++ /dev/null @@ -1,82 +0,0 @@ - program set_attribs - implicit none -C -C Parameter declaration. -C - character*7 FILE_NAME - character*13 FILE_ATTR_NAME - character*11 SDS_ATTR_NAME - character*10 DIM_ATTR_NAME - parameter (FILE_NAME = 'SDS.hdf', - + FILE_ATTR_NAME = 'File_contents', - + SDS_ATTR_NAME = 'Valid_range', - + DIM_ATTR_NAME = 'Dim_metric') - integer DFACC_WRITE, DFNT_CHAR8, DFNT_FLOAT32 - parameter (DFACC_WRITE = 2, - + DFNT_CHAR8 = 4, - + DFNT_FLOAT32 = 5) -C -C Function declaration. -C - integer sfstart, sfscatt, sfsnatt, sfselect, sfdimid - integer sfendacc, sfend -C -C**** Variable declaration ******************************************* -C - integer sd_id, sds_id, sds_index, status - integer dim_id, dim_index - integer n_values - character*16 file_values - real sds_values(2) - character*7 dim_values - file_values = 'Storm_track_data' - sds_values(1) = 2. - sds_values(2) = 10. - dim_values = 'Seconds' -C -C**** End of variable declaration ************************************ -C -C -C Open the file and initialize the SD interface. -C - sd_id = sfstart(FILE_NAME, DFACC_WRITE) -C -C Set an attribute that describes the file contents. -C - n_values = 16 - status = sfscatt(sd_id, FILE_ATTR_NAME, DFNT_CHAR8, n_values, - + file_values) -C -C Select the first data set. -C - sds_index = 0 - sds_id = sfselect(sd_id, sds_index) -C -C Assign attribute to the first SDS. Note that attribute values -C may have different data type than SDS data. -C - n_values = 2 - status = sfsnatt(sds_id, SDS_ATTR_NAME, DFNT_FLOAT32, n_values, - + sds_values) -C -C Get the identifier for the first dimension. -C - dim_index = 0 - dim_id = sfdimid(sds_id, dim_index) -C -C Set an attribute to the dimension that specifies the -C dimension metric. -C - n_values = 7 - status = sfscatt(dim_id, DIM_ATTR_NAME, DFNT_CHAR8, n_values, - + dim_values) -C -C Terminate access to the data set. -C - status = sfendacc(sds_id) -C -C Terminate access to the SD interface and close the file. -C - status = sfend(sd_id) - - end diff --git a/mfhdf/fortran/examples/SD_set_get_dim_info.f b/mfhdf/fortran/examples/SD_set_get_dim_info.f deleted file mode 100644 index 27597ac571..0000000000 --- a/mfhdf/fortran/examples/SD_set_get_dim_info.f +++ /dev/null @@ -1,147 +0,0 @@ - program dimension_info - implicit none -C -C Parameter declaration. -C - character*7 FILE_NAME - character*11 SDS_NAME - character*6 DIM_NAME_X - character*6 DIM_NAME_Y - integer X_LENGTH, Y_LENGTH, RANK - parameter (FILE_NAME = 'SDS.hdf', - + SDS_NAME = 'SDStemplate', - + DIM_NAME_X = 'X_Axis', - + DIM_NAME_Y = 'Y_Axis', - + X_LENGTH = 5, - + Y_LENGTH = 16, - + RANK = 2) - integer DFACC_WRITE, DFNT_INT16, DFNT_FLOAT64 - parameter (DFACC_WRITE = 2, - + DFNT_INT16 = 22, - + DFNT_FLOAT64 = 6) - -C -C Function declaration. -C - integer sfstart, sfn2index, sfdimid, sfgdinfo - integer sfsdscale, sfgdscale, sfsdmname, sfendacc - integer sfend, sfselect -C -C**** Variable declaration ******************************************* -C - integer sd_id, sds_id, sds_index, status - integer dim_index, dim_id - integer n_values, n_attrs, data_type - integer*2 data_X(X_LENGTH) - integer*2 data_X_out(X_LENGTH) - real*8 data_Y(Y_LENGTH) - real*8 data_Y_out(Y_LENGTH) - character*6 dim_name - integer i -C -C**** End of variable declaration ************************************ -C -C -C Initialize dimension scales. -C - do 10 i = 1, X_LENGTH - data_X(i) = i - 1 -10 continue - - do 20 i = 1, Y_LENGTH - data_Y(i) = 0.1 * (i - 1) -20 continue -C -C Open the file and initialize SD interface. -C - sd_id = sfstart(FILE_NAME, DFACC_WRITE) -C -C Get the index of the data set with the name specified in SDS_NAME. -C - sds_index = sfn2index(sd_id, SDS_NAME) -C -C Select the data set corresponding to the returned index. -C - sds_id = sfselect(sd_id, sds_index) -C -C For each dimension of the data set, -C get its dimension identifier and set dimension name -C and dimension scales. Note that data type of dimension scale can -C be different between dimensions and can be different from SDS data type. -C - do 30 dim_index = 0, RANK - 1 -C -C Select the dimension at position dim_index. -C - dim_id = sfdimid(sds_id, dim_index) -C -C Assign name and dimension scale to the dimension. -C - if (dim_index .eq. 0) then - status = sfsdmname(dim_id, DIM_NAME_X) - n_values = X_LENGTH - status = sfsdscale(dim_id, n_values, DFNT_INT16, data_X) - end if - if (dim_index .eq. 1) then - status = sfsdmname(dim_id, DIM_NAME_Y) - n_values = Y_LENGTH - status = sfsdscale(dim_id, n_values, DFNT_FLOAT64, data_Y) - end if -C -C Get and display information about dimension and its scale values. -C The following information is displayed: -C -C Information about 1 dimension : -C dimension name is X_Axis -C number of scale values is 5 -C dimension scale data type is int16 -C -C number of dimension attributes is 0 -C Scale values are: -C 0 1 2 3 4 -C -C Information about 2 dimension : -C dimension name is Y_Axis -C number of scale values is 16 -C dimension scale data type is float64 -C number of dimension attributes is 0 -C -C Scale values are: -C 0.000 0.100 0.200 0.300 -C 0.400 0.500 0.600 0.700 -C 0.800 0.900 1.000 1.100 -C 1.200 1.300 1.400 1.500 -C - status = sfgdinfo(dim_id, dim_name, n_values, data_type, n_attrs) -C - write(*,*) "Information about ", dim_index+1," dimension :" - write(*,*) "dimension name is ", dim_name - write(*,*) "number of scale values is", n_values - if (data_type. eq. 22) then - write(*,*) "dimension scale data type is int16" - endif - if (data_type. eq. 6) then - write(*,*) "dimension scale data type is float64" - endif - write(*,*) "number of dimension attributes is ", n_attrs -C - write(*,*) "Scale values are:" - if (dim_index .eq. 0) then - status = sfgdscale(dim_id, data_X_out) - write(*,*) (data_X_out(i), i= 1, X_LENGTH) - endif - if (dim_index .eq. 1) then - status = sfgdscale(dim_id, data_Y_out) - write(*,100) (data_Y_out(i), i= 1, Y_LENGTH) -100 format(4(1x,f10.3)/) - endif -30 continue -C -C Terminate access to the data set. -C - status = sfendacc(sds_id) -C -C Terminate access to the SD interface and close the file. -C - status = sfend(sd_id) - end diff --git a/mfhdf/fortran/examples/SD_unlimited_sds.f b/mfhdf/fortran/examples/SD_unlimited_sds.f deleted file mode 100644 index 3184365827..0000000000 --- a/mfhdf/fortran/examples/SD_unlimited_sds.f +++ /dev/null @@ -1,115 +0,0 @@ - program append_sds - implicit none -C -C Parameter declaration. -C - character*16 FILE_NAME - character*14 SDS_NAME - integer X_LENGTH, Y_LENGTH, RANK - parameter (FILE_NAME = 'SDSUNLIMITED.hdf', - + SDS_NAME = 'AppendableData', - + X_LENGTH = 10, - + Y_LENGTH = 10, - + RANK = 2) - integer DFACC_CREATE, DFACC_WRITE, SD_UNLIMITED, - + DFNT_INT32 - parameter (DFACC_CREATE = 4, - + DFACC_WRITE = 2, - + SD_UNLIMITED = 0, - + DFNT_INT32 = 24) -C -C Function declaration. -C - integer sfstart, sfcreate, sfwdata, sfselect - integer sfendacc, sfend -C -C**** Variable declaration ******************************************* -C - integer sd_id, sds_id, sds_index, status - integer dim_sizes(2) - integer start(2), edges(2), stride(2) - integer i, j - integer data (X_LENGTH, Y_LENGTH), append_data(X_LENGTH) -C -C**** End of variable declaration ************************************ -C -C -C Data initialization. -C - do 20 j = 1, Y_LENGTH - do 10 i = 1, X_LENGTH - data(i, j) = i + j -10 continue -20 continue -C -C Create the file and initialize the SD interface. -C - sd_id = sfstart(FILE_NAME, DFACC_CREATE) -C -C Define dimensions of the array. Make the -C last dimension appendable by defining its length as unlimited. -C - dim_sizes(1) = X_LENGTH - dim_sizes(2) = SD_UNLIMITED - -C Create the array data set. - sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, - . dim_sizes) -C -C Define the location and the size of the data to be written -C to the data set. Note that the elements of array stride are -C set to 1 for contiguous writing. -C - start(1) = 0 - start(2) = 0 - edges(1) = X_LENGTH - edges(2) = Y_LENGTH - stride(1) = 1 - stride(2) = 1 -C -C Write the data. -C - status = sfwdata(sds_id, start, stride, edges, data) -C -C Terminate access to the data set, terminate access -C to the SD interface, and close the file. -C - status = sfendacc(sds_id) - status = sfend(sd_id) -C -C Store the array values to be appended to the data set. -C - do 30 i = 1, X_LENGTH - append_data(i) = 1000 + i - 1 -30 continue -C -C Reopen the file and initialize the SD. -C - sd_id = sfstart(FILE_NAME, DFACC_WRITE) -C -C Select the first data set. -C - sds_index = 0 - sds_id = sfselect(sd_id, sds_index) -C -C Define the location of the append to start at the 11th -C column of the 1st row and to stop at the end of the 10th row. -C - start(1) = 0 - start(2) = Y_LENGTH - edges(1) = X_LENGTH - edges(2) = 1 -C -C Append the data to the data set. -C - status = sfwdata(sds_id, start, stride, edges, append_data) -C -C Terminate access to the data set. -C - status = sfendacc(sds_id) -C -C Terminate access to the SD interface and close the file. -C - status = sfend(sd_id) - - end diff --git a/mfhdf/fortran/examples/SD_write_slab.f b/mfhdf/fortran/examples/SD_write_slab.f deleted file mode 100644 index 1e7d1d3a41..0000000000 --- a/mfhdf/fortran/examples/SD_write_slab.f +++ /dev/null @@ -1,101 +0,0 @@ - program write_slab - implicit none -C -C Parameter declaration. -C - character*9 FILE_NAME - character*13 SDS_NAME - integer X_LENGTH, Y_LENGTH, Z_LENGTH, RANK - parameter (FILE_NAME = 'SLABS.hdf', - + SDS_NAME = 'FilledBySlabs', - + X_LENGTH = 4, - + Y_LENGTH = 5, - + Z_LENGTH = 6, - + RANK = 3) - integer DFACC_CREATE, DFNT_INT32 - parameter (DFACC_CREATE = 4, - + DFNT_INT32 = 24) -C -C Function declaration. -C - integer sfstart, sfcreate, sfwdata, sfendacc, sfend -C -C**** Variable declaration ******************************************* -C - integer sd_id, sds_id - integer dim_sizes(3), start(3), edges(3), stride(3) - integer i, j, k, status - integer data(X_LENGTH, Y_LENGTH, Z_LENGTH) - integer xz_data(X_LENGTH, Z_LENGTH) -C -C**** End of variable declaration ************************************ -C -C -C Data initialization. -C - do 30 k = 1, Z_LENGTH - do 20 j = 1, Y_LENGTH - do 10 i = 1, X_LENGTH - data(i, j, k) = i + j + k -10 continue -20 continue -30 continue -C -C Create the file and initialize the SD interface. -C - sd_id = sfstart(FILE_NAME, DFACC_CREATE) -C -C Define dimensions of the array to be created. -C - dim_sizes(1) = X_LENGTH - dim_sizes(2) = Y_LENGTH - dim_sizes(3) = Z_LENGTH -C -C Create the data set with the name defined in SDS_NAME. -C - sds_id = sfcreate(sd_id, SDS_NAME, DFNT_INT32, RANK, - . dim_sizes) -C -C Set the parameters start and edges to write -C a 4x6 element slab of data to the data set; -C note that edges(2) is set to 1 to define a 2 dimensional slab -C parallel to the XZ plane; -C start(2) (slab position in the array) is initialized inside the -C for loop. -C - edges(1) = X_LENGTH - edges(2) = 1 - edges(3) = Z_LENGTH - start(1) = 0 - start(3) = 0 - stride(1) = 1 - stride(2) = 1 - stride(3) = 1 - - do 60 j = 1, Y_LENGTH - start(2) = j - 1 -C -C Initialize the buffer xz_data (data slab). -C - do 50 k = 1, Z_LENGTH - do 40 i = 1, X_LENGTH - xz_data(i, k) = data(i, j, k) -40 continue -50 continue -C -C Write the data slab into SDS array defined in SDS_NAME. -C Note that the elements of array stride are set to 1 to -C specify that the consecutive slabs in the Y direction are written. -C - status = sfwdata(sds_id, start, stride, edges, xz_data) -60 continue -C -C Terminate access to the data set. -C - status = sfendacc(sds_id) -C -C Terminate access to the SD interface and close the file. -C - status = sfend(sd_id) - - end diff --git a/mfhdf/fortran/examples/SD_write_to_sds.f b/mfhdf/fortran/examples/SD_write_to_sds.f deleted file mode 100644 index 1cf86dd1b0..0000000000 --- a/mfhdf/fortran/examples/SD_write_to_sds.f +++ /dev/null @@ -1,79 +0,0 @@ - program write_data - implicit none -C -C Parameter declaration. -C - character*7 FILE_NAME - character*11 SDS_NAME - integer X_LENGTH, Y_LENGTH, RANK - parameter (FILE_NAME = 'SDS.hdf', - + SDS_NAME = 'SDStemplate', - + X_LENGTH = 5, - + Y_LENGTH = 16, - + RANK = 2) - integer DFACC_WRITE, DFNT_INT32 - parameter (DFACC_WRITE = 2, - + DFNT_INT32 = 24) -C -C Function declaration. -C - - integer sfstart, sfselect, sfwdata, sfendacc, sfend -C -C**** Variable declaration ******************************************* -C - integer sd_id, sds_id, sds_index, status - integer start(2), edges(2), stride(2) - integer i, j - integer data(X_LENGTH, Y_LENGTH) -C -C**** End of variable declaration ************************************ -C - -C -C Data set data initialization. -C - do 20 j = 1, Y_LENGTH - do 10 i = 1, X_LENGTH - data(i, j) = i + j - 1 -10 continue -20 continue - -C -C Open the file and initialize the SD interface. -C - sd_id = sfstart(FILE_NAME, DFACC_WRITE) - -C -C Attach to the first data set. -C - sds_index = 0 - sds_id = sfselect(sd_id, sds_index) - -C -C Define the location and size of the data to be written -C to the data set. Note that setting values of the array stride to 1 -C specifies the contiguous writing of data. -C - start(1) = 0 - start(2) = 0 - edges(1) = X_LENGTH - edges(2) = Y_LENGTH - stride(1) = 1 - stride(2) = 1 -C -C Write the stored data to the data set named in SDS_NAME. -C Note that the routine sfwdata is used instead of sfwcdata -C to write the numeric data. -C - status = sfwdata(sds_id, start, stride, edges, data) -C -C Terminate access to the data set. -C - status = sfendacc(sds_id) -C -C Terminate access to the SD interface and close the file. -C - status = sfend(sd_id) - - end From 84ed1500410fa1a32c205a38ac0ce53aca622537 Mon Sep 17 00:00:00 2001 From: bmribler <39579120+bmribler@users.noreply.github.com> Date: Mon, 12 Feb 2024 23:06:59 -0500 Subject: [PATCH 04/65] Corrected malloc statements (#514) Changed sizeof(char *) to sizeof(char) to malloc an array of chars. --- hdf/test/tvnameclass.c | 8 ++++---- hdf/test/tvset.c | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/hdf/test/tvnameclass.c b/hdf/test/tvnameclass.c index ee39ced603..64ec6ad226 100644 --- a/hdf/test/tvnameclass.c +++ b/hdf/test/tvnameclass.c @@ -102,7 +102,7 @@ test_vglongnames(void) status = Vgetnamelen(vg1, &name_len); CHECK_VOID(status, FAIL, "Vgetnamelen"); - vgname = (char *)malloc(sizeof(char *) * (name_len + 1)); + vgname = (char *)malloc(sizeof(char) * (name_len + 1)); CHECK_ALLOC(vgname, "vgname", "test_vglongnames"); status = Vgetname(vg1, vgname); @@ -115,7 +115,7 @@ test_vglongnames(void) status = Vgetclassnamelen(vg1, &name_len); CHECK_VOID(status, FAIL, "Vgetnamelen"); - vgclass = (char *)malloc(sizeof(char *) * (name_len + 1)); + vgclass = (char *)malloc(sizeof(char) * (name_len + 1)); CHECK_ALLOC(vgclass, "vgclass", "test_vglongnames"); status = Vgetclass(vg1, vgclass); @@ -138,7 +138,7 @@ test_vglongnames(void) status = Vgetnamelen(vg1, &name_len); CHECK_VOID(status, FAIL, "Vgetnamelen"); - vgname = (char *)malloc(sizeof(char *) * (name_len + 1)); + vgname = (char *)malloc(sizeof(char) * (name_len + 1)); CHECK_ALLOC(vgname, "vgname", "test_vglongnames"); status = Vgetname(vg1, vgname); @@ -155,7 +155,7 @@ test_vglongnames(void) status = Vgetclassnamelen(vg1, &name_len); CHECK_VOID(status, FAIL, "Vgetnamelen"); - vgclass = (char *)malloc(sizeof(char *) * (name_len + 1)); + vgclass = (char *)malloc(sizeof(char) * (name_len + 1)); CHECK_ALLOC(vgclass, "vgclass", "test_vglongnames"); status = Vgetclass(vg1, vgclass); diff --git a/hdf/test/tvset.c b/hdf/test/tvset.c index 15e6a34c49..b6e01a5aa1 100644 --- a/hdf/test/tvset.c +++ b/hdf/test/tvset.c @@ -595,7 +595,7 @@ read_vset_stuff(void) status = Vgetnamelen(vg1, &name_len); CHECK(status, FAIL, "Vgetnamelen:vg1"); - vgname = (char *)malloc(sizeof(char *) * (name_len + 1)); + vgname = (char *)malloc(sizeof(char) * (name_len + 1)); CHECK_ALLOC(vgname, "vgname", "read_vset_stuff"); status = Vgetname(vg1, vgname); @@ -604,7 +604,7 @@ read_vset_stuff(void) status = Vgetclassnamelen(vg1, &name_len); CHECK(status, FAIL, "Vgetclassnamelen:vg1"); - vgclass = (char *)malloc(sizeof(char *) * (name_len + 1)); + vgclass = (char *)malloc(sizeof(char) * (name_len + 1)); CHECK_ALLOC(vgclass, "vgclass", "read_vset_stuff"); status = Vgetclass(vg1, vgclass); @@ -1823,7 +1823,7 @@ test_vglongnames(void) status = Vgetnamelen(vg1, &name_len); CHECK_VOID(status, FAIL, "Vgetnamelen"); - vgname = (char *)malloc(sizeof(char *) * (name_len + 1)); + vgname = (char *)malloc(sizeof(char) * (name_len + 1)); CHECK_ALLOC(vgname, "vgname", "test_vglongnames"); status = Vgetname(vg1, vgname); @@ -1840,7 +1840,7 @@ test_vglongnames(void) status = Vgetclassnamelen(vg1, &name_len); CHECK_VOID(status, FAIL, "Vgetnamelen"); - vgclass = (char *)malloc(sizeof(char *) * (name_len + 1)); + vgclass = (char *)malloc(sizeof(char) * (name_len + 1)); CHECK_ALLOC(vgclass, "vgclass", "test_vglongnames"); status = Vgetclass(vg1, vgclass); @@ -1867,7 +1867,7 @@ test_vglongnames(void) status = Vgetnamelen(vg1, &name_len); CHECK_VOID(status, FAIL, "Vgetnamelen"); - vgname = (char *)malloc(sizeof(char *) * (name_len + 1)); + vgname = (char *)malloc(sizeof(char) * (name_len + 1)); CHECK_ALLOC(vgname, "vgname", "test_vglongnames"); status = Vgetname(vg1, vgname); @@ -1884,7 +1884,7 @@ test_vglongnames(void) status = Vgetclassnamelen(vg1, &name_len); CHECK_VOID(status, FAIL, "Vgetnamelen"); - vgclass = (char *)malloc(sizeof(char *) * (name_len + 1)); + vgclass = (char *)malloc(sizeof(char) * (name_len + 1)); CHECK_ALLOC(vgclass, "vgclass", "test_vglongnames"); status = Vgetclass(vg1, vgclass); @@ -2749,7 +2749,7 @@ test_extfile(void) name_len = VSgetexternalfile(vdata1_id, 0, NULL, NULL); VERIFY_VOID(name_len, (intn)strlen(EXTERNAL_FILE), "VSgetexternalfile"); - extfile_name = (char *)malloc(sizeof(char *) * (name_len + 1)); + extfile_name = (char *)malloc(sizeof(char) * (name_len + 1)); CHECK_ALLOC(extfile_name, "extfile_name", "test_extfile"); /* Old function: Get the external file name - VSgetexternalfile @@ -2764,7 +2764,7 @@ test_extfile(void) name_len = VSgetexternalinfo(vdata1_id, 0, NULL, NULL, NULL); VERIFY_VOID(name_len, (intn)strlen(EXTERNAL_FILE), "VSgetexternalinfo"); - extfile_name = (char *)malloc(sizeof(char *) * (name_len + 1)); + extfile_name = (char *)malloc(sizeof(char) * (name_len + 1)); CHECK_ALLOC(extfile_name, "extfile_name", "test_extfile"); /* Get the external file name */ @@ -2777,13 +2777,13 @@ test_extfile(void) name should be truncated */ { /* Make a shorter string to verify later */ - char *short_name = (char *)malloc(sizeof(char *) * (name_len)); + char *short_name = (char *)malloc(sizeof(char) * (name_len)); memset(short_name, '\0', name_len); strncpy(short_name, EXTERNAL_FILE, name_len - 2); /* Prepare buffer for external file name in the following test */ - extfile_name = (char *)malloc(sizeof(char *) * (name_len - 1)); - memset(extfile_name, '\0', name_len); + extfile_name = (char *)malloc(sizeof(char) * (name_len - 1)); + memset(extfile_name, '\0', name_len - 1); /* Call VSgetexternalinfo again with smaller buffer size and make sure VSgetexternalinfo reads the name truncated to the given buffer size*/ From 45481c17df764925e042b0f43a48670bdeda973a Mon Sep 17 00:00:00 2001 From: bmribler <39579120+bmribler@users.noreply.github.com> Date: Mon, 12 Feb 2024 23:09:16 -0500 Subject: [PATCH 05/65] Fixed SZIP availability check (#510) * Fix HDFFR-1529 The line hcomp.c:157 fixes this issue. The rest of the changes fix typos. * Fixed dumper for no SZIP case When the SZIP library is not available, HDF4 library is unable to retrieve the SZIP c ompression information. This issue was revealed after the fix of HDFFR-1529 because before that, the HDF4 library did not detect that SZIP library was unavailable. hdp now displays appropriate information when SZIP library is not available and stops trying to obtain SZIP compression information. --- hdf/src/hcomp.c | 56 +++++++++++---------------- hdf/src/mfgr.c | 2 +- mfhdf/dumper/hdp_sds.c | 16 +++++++- mfhdf/dumper/testfiles/dumpsds-15.out | 6 +-- 4 files changed, 38 insertions(+), 42 deletions(-) diff --git a/hdf/src/hcomp.c b/hdf/src/hcomp.c index f16bb5b7fe..01ff374074 100644 --- a/hdf/src/hcomp.c +++ b/hdf/src/hcomp.c @@ -65,11 +65,7 @@ LOCAL ROUTINES AUTHOR Quincey Koziol -MODIFICATION HISTORY - 9/21/93 - Starting writing specs & coding prototype - 10/09/93 - Finished initial testing. First version with only stdio - modeling and RLE coding done. - */ +*/ /* General HDF includes */ #include "hdf.h" @@ -129,7 +125,8 @@ funclist_t comp_funcs = { NAME HCIinit_coder -- Set the coder function pointers USAGE - int32 HCIinit_coder(cinfo,coder_type,coder_info) + int32 HCIinit_coder(acc_mode, cinfo, coder_type, c_info) + int16 acc_mode IN: file access mode comp_coder_info_t *cinfo; IN/OUT: pointer to coder information to modify comp_coder_t coder_type; IN: the type of encoding to use comp_info *coder_info; IN: setup information for some encoding types @@ -157,12 +154,8 @@ HCIinit_coder(int16 acc_mode, comp_coder_info_t *cinfo, comp_coder_t coder_type, uint32 comp_config_info; HCget_config_info(coder_type, &comp_config_info); - /* TODO: This construct S.B. - * (comp_info & (COMP_DECODER_ENABLED|COMP_ENCODER_ENABLED)) - * but the calling code does not handle it correctly - */ - if ((comp_config_info & COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED) == 0) { - /* coder not present?? */ + if ((comp_config_info & (COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED)) == 0) { + /* coder not present */ HRETURN_ERROR(DFE_BADCODER, FAIL); } @@ -204,10 +197,7 @@ HCIinit_coder(int16 acc_mode, comp_coder_info_t *cinfo, comp_coder_t coder_type, break; case COMP_CODE_DEFLATE: /* gzip 'deflate' encoding */ - /* valid deflate levels are from 0 to 9, this error checking - caused the problem in HDF4r1.2 , fixed by Apu Kapadia - if(c_info->deflate.level<1 || c_info->deflate.level>9) - */ + /* valid deflate levels are from 0 to 9 */ if (c_info->deflate.level < 0 || c_info->deflate.level > 9) HRETURN_ERROR(DFE_BADCODER, FAIL); @@ -224,11 +214,6 @@ HCIinit_coder(int16 acc_mode, comp_coder_info_t *cinfo, comp_coder_t coder_type, /* set the coding type */ cinfo->coder_type = COMP_CODE_SZIP; - /* when libsz presents, initialize other info - BMR, 08/25/2007 - (changed from eliminating this case completely) */ - /* completely removed the libsz limitation, we shouldn't need - szip library to initialize here - BMR, 10/21/2008 */ - /* set the szip func. ptrs */ cinfo->coder_funcs = cszip_funcs; @@ -255,7 +240,8 @@ HCIinit_coder(int16 acc_mode, comp_coder_info_t *cinfo, comp_coder_t coder_type, NAME HCIinit_model -- Set the model function pointers USAGE - int32 HCIinit_model(minfo,model_type,m_info) + int32 HCIinit_model(acc_mode, minfo, model_type, m_info) + int16 acc_mode IN: file access mode comp_model_info_t *minfo; IN/OUT: pointer to model information to modify comp_model_t model_type; IN: the type of encoding to use model_info *m_info; IN: modeling information @@ -294,7 +280,7 @@ HCIinit_model(int16 acc_mode, comp_model_info_t *minfo, comp_model_t model_type, NAME HCPquery_encode_header -- Query the length of compression header for a memory buffer USAGE - int32 HCPquery_encode_header(model_type, model_info, coder_type, coder_info) + int32 HCPquery_encode_header(model_type, m_info, coder_type, c_info) comp_model_t model_type; IN: the type of modeling to use model_info *m_info; IN: Information needed for the modeling type chosen comp_coder_t coder_type; IN: the type of encoding to use @@ -366,8 +352,8 @@ HCPquery_encode_header(comp_model_t model_type, model_info *m_info, comp_coder_t NAME HCPencode_header -- Encode the compression header info to a memory buffer USAGE - intn HCPencode_header(model_type, model_info, coder_type, coder_info) - void * buf; OUT: encoded compression info header + intn HCPencode_header(p, model_type, model_info, coder_type, coder_info) + uint8 * p; OUT: encoded compression info header comp_model_t model_type; IN: the type of modeling to use model_info *m_info; IN: Information needed for the modeling type chosen comp_coder_t coder_type; IN: the type of encoding to use @@ -463,8 +449,8 @@ HCPencode_header(uint8 *p, comp_model_t model_type, model_info *m_info, comp_cod NAME HCPdecode_header -- Decode the compression header info from a memory buffer USAGE - intn HCPdecode_header(model_type, model_info, coder_type, coder_info) - void * buf; IN: encoded compression info header + intn HCPdecode_header(p, model_type, model_info, coder_type, coder_info) + void * p; IN: encoded compression info header comp_model_t *model_type; OUT: the type of modeling to use model_info *m_info; OUT: Information needed for the modeling type chosen comp_coder_t *coder_type; OUT: the type of encoding to use @@ -573,7 +559,7 @@ HCPdecode_header(uint8 *p, comp_model_t *model_type, model_info *m_info, comp_co NAME HCIwrite_header -- Write the compression header info to a file USAGE - int32 HCIwrite_header(access_rec,info,special_tag,ref) + int32 HCIwrite_header(file_id, info, special_tag, ref, c_info, m_info) atom_t file_id; IN: File ID of the file to write the header to compinfo_t *info; IN: ptr the compression information uint16 special_tag,ref; IN: the tag/ref of the compressed element @@ -629,7 +615,7 @@ HCIwrite_header(atom_t file_id, compinfo_t *info, uint16 special_tag, uint16 ref NAME HCIread_header -- Read the compression header info from a file USAGE - int32 HCIread_header(file_rec,access_rec,info,comp_info,model_info) + int32 HCIread_header(access_rec, info, c_info, m_info) accrec_t *access_rec; IN: ptr to the access element record compinfo_t *info; IN: ptr the compression information comp_info *comp_info; IN/OUT: ptr to encoding info @@ -676,8 +662,8 @@ HCIread_header(accrec_t *access_rec, compinfo_t *info, comp_info *c_info, model_ NAME HCcreate -- Create a compressed data element USAGE - int32 HCcreate(id,tag,ref,model_type,coder_type) - int32 id; IN: the file id to create the data in + int32 HCcreate(file_id, tag, ref, model_type, m_info, coder_type, c_info) + int32 file_id; IN: the file id to create the data in uint16 tag,ref; IN: the tag/ref pair which is to be compressed comp_model_t model_type; IN: the type of modeling to use model_info *m_info; IN: Information needed for the modeling type chosen @@ -812,10 +798,12 @@ HCcreate(int32 file_id, uint16 tag, uint16 ref, comp_model_t model_type, model_i NAME HCPgetcompinfo -- Retrieves compression information of an element USAGE - intn HCPgetcompinfo(aid, coder_type, c_info) + intn HCPgetcompinfo(file_id, data_tag, data_ref, comp_type, c_info) int32 aid; IN: access record ID - comp_coder_t* coder_type; OUT: the type of compression - comp_info* c_info; OUT: ptr to compression information + uint16 data_tag; IN: element tag + uint16 data_ref; IN: element ref + comp_coder_t* comp_type; OUT: the type of compression + comp_info* c_info; OUT: ptr to compression information structure for storing the retrieved info RETURNS SUCCEED/FAIL diff --git a/hdf/src/mfgr.c b/hdf/src/mfgr.c index f0b12a421f..ad597b5d44 100644 --- a/hdf/src/mfgr.c +++ b/hdf/src/mfgr.c @@ -4884,7 +4884,7 @@ GRIgetaid(ri_info_t *ri_ptr, intn acc_perm) pixel_size = (uintn)(ri_ptr->img_dim.ncomps * DFKNTsize(ri_ptr->img_dim.nt)); - /* BMR: HRPconvert made access_rec->special = SPECIAL_COMPRAS */ + /* Wraps an existing compressed raster image with the special element*/ if ((ri_ptr->img_aid = HRPconvert(hdf_file_id, ri_ptr->img_tag, ri_ptr->img_ref, ri_ptr->img_dim.xdim, ri_ptr->img_dim.ydim, ri_ptr->img_dim.comp_tag, &(ri_ptr->cinfo), pixel_size)) == diff --git a/mfhdf/dumper/hdp_sds.c b/mfhdf/dumper/hdp_sds.c index f13c65754c..428ed4600c 100644 --- a/mfhdf/dumper/hdp_sds.c +++ b/mfhdf/dumper/hdp_sds.c @@ -755,8 +755,20 @@ print_comp_info(FILE *fp, int32 sds_id, comp_coder_t *comp_type) break; } /* switch */ } - else - fprintf(fp, "\t Compression method = \n"); + else { + /* It's likely that SDgetcompinfo failed because SZIP library is not avail */ + /* Only get compression type and if it's SZIP, display appropriate info */ + status = SDgetcomptype(sds_id, comp_type); + if (status != FAIL && *comp_type == COMP_CODE_SZIP) { + fprintf(fp, "\t Compression method = %s\n", comp_method_txt(*comp_type)); + fprintf(fp, "\t\t Compression information is unavailable (no SZIP library)\n"); + } + /* Failed to get compression type, do not proceed */ + else { + fprintf(fp, "\t Compression method = \n"); + return (status); + } + } /* print compression ratio */ if (*comp_type != COMP_CODE_NONE) { diff --git a/mfhdf/dumper/testfiles/dumpsds-15.out b/mfhdf/dumper/testfiles/dumpsds-15.out index 5024ed018c..e21c84daf5 100644 --- a/mfhdf/dumper/testfiles/dumpsds-15.out +++ b/mfhdf/dumper/testfiles/dumpsds-15.out @@ -79,11 +79,7 @@ Variable Name = SDSszip Type= 32-bit signed integer Ref. = 6 Compression method = SZIP - Option mask = H4_SZ_EC_OPTION_MASK|H4_SZ_RAW_OPTION_MASK (132) - Pixels per block = 2 - Pixels per scanline = 5 - Bits per pixel = 32 - Pixels = 80 + Compression information is unavailable (no SZIP library) Compression ratio (original:compressed) = 2.67:1 Rank = 2 Number of attributes = 0 From a8db534f5f53d7d0d96e24135083db77087e77aa Mon Sep 17 00:00:00 2001 From: bmribler <39579120+bmribler@users.noreply.github.com> Date: Mon, 12 Feb 2024 23:11:20 -0500 Subject: [PATCH 06/65] Cleaned up datainfo header files (#512) Moved prototypes of hdf datainfo functions into hproto.h and mfhdf datainfo functions into mfhdf.h. The header files hdatainfo.h and mfdatainfo.h should no longer be used in applications. --- hdf/src/hdatainfo.h | 39 ++++++++------------------------- hdf/src/hproto.h | 45 ++++++++++++++++++++++++++++++++++----- mfhdf/libsrc/mfdatainfo.h | 19 +++++++---------- mfhdf/libsrc/mfhdf.h | 15 ++++++++++++- 4 files changed, 71 insertions(+), 47 deletions(-) diff --git a/hdf/src/hdatainfo.h b/hdf/src/hdatainfo.h index efdba92923..f4fd47ef24 100644 --- a/hdf/src/hdatainfo.h +++ b/hdf/src/hdatainfo.h @@ -14,40 +14,19 @@ #ifndef H4_HDATAINFO_H #define H4_HDATAINFO_H -#include "H4api_adpt.h" - #ifdef __cplusplus extern "C" { #endif -/* Structure that holds a data descriptor. First added for GRgetpalinfo. */ -typedef struct hdf_ddinfo_t { - uint16 tag; - uint16 ref; - int32 offset; - int32 length; -} hdf_ddinfo_t; - -/* Public functions for getting raw data information */ - -HDFLIBAPI intn ANgetdatainfo(int32 ann_id, int32 *offset, int32 *length); - -HDFLIBAPI intn HDgetdatainfo(int32 file_id, uint16 data_tag, uint16 data_ref, int32 *chk_coord, - uintn start_block, uintn info_count, int32 *offsetarray, int32 *lengtharray); - -HDFLIBAPI intn VSgetdatainfo(int32 vsid, uintn start_block, uintn info_count, int32 *offsetarray, - int32 *lengtharray); - -HDFLIBAPI intn VSgetattdatainfo(int32 vsid, int32 findex, intn attrindex, int32 *offset, int32 *length); - -HDFLIBAPI intn Vgetattdatainfo(int32 vgid, intn attrindex, int32 *offset, int32 *length); - -HDFLIBAPI intn GRgetdatainfo(int32 riid, uintn start_block, uintn info_count, int32 *offsetarray, - int32 *lengtharray); - -HDFLIBAPI intn GRgetattdatainfo(int32 id, int32 attrindex, int32 *offset, int32 *length); - -HDFLIBAPI intn GRgetpalinfo(int32 gr_id, uintn pal_count, hdf_ddinfo_t *palinfo_array); +/***************************************************************************** + * + * hdatainfo.h + * + * The public structure and APIs in this file were moved into hproto.h in + * version 4.3.0. Applications don't need to and should no longer include this + * header file. + * + ******************************************************************************/ #ifdef __cplusplus } diff --git a/hdf/src/hproto.h b/hdf/src/hproto.h index c8dc9857c5..b8890863f2 100644 --- a/hdf/src/hproto.h +++ b/hdf/src/hproto.h @@ -440,6 +440,40 @@ HDFLIBAPI int32 Hendbitaccess(int32 bitfile_id, intn flushbit); HDFLIBAPI intn HPbitshutdown(void); +/* + ** from hdatainfo.c + */ + +/* Structure that holds a data descriptor */ +typedef struct hdf_ddinfo_t { + uint16 tag; + uint16 ref; + int32 offset; + int32 length; +} hdf_ddinfo_t; + +/* + ** Public functions for getting raw data information - from hdatainfo.c + */ +HDFLIBAPI intn ANgetdatainfo(int32 ann_id, int32 *offset, int32 *length); + +HDFLIBAPI intn HDgetdatainfo(int32 file_id, uint16 data_tag, uint16 data_ref, int32 *chk_coord, + uintn start_block, uintn info_count, int32 *offsetarray, int32 *lengtharray); + +HDFLIBAPI intn VSgetdatainfo(int32 vsid, uintn start_block, uintn info_count, int32 *offsetarray, + int32 *lengtharray); + +HDFLIBAPI intn VSgetattdatainfo(int32 vsid, int32 findex, intn attrindex, int32 *offset, int32 *length); + +HDFLIBAPI intn Vgetattdatainfo(int32 vgid, intn attrindex, int32 *offset, int32 *length); + +HDFLIBAPI intn GRgetdatainfo(int32 riid, uintn start_block, uintn info_count, int32 *offsetarray, + int32 *lengtharray); + +HDFLIBAPI intn GRgetattdatainfo(int32 id, int32 attrindex, int32 *offset, int32 *length); + +HDFLIBAPI intn GRgetpalinfo(int32 gr_id, uintn pal_count, hdf_ddinfo_t *palinfo_array); + /* ** from dfutil.c */ @@ -808,7 +842,9 @@ HDFLIBAPI intn DFKsb4b(void *s, void *d, uint32 num_elm, uint32 source_stride, u HDFLIBAPI intn DFKsb8b(void *s, void *d, uint32 num_elm, uint32 source_stride, uint32 dest_stride); -/* Multi-file Annotation C-routines found in mfan.c */ +/* + ** Multi-file Annotation - from mfan.c + */ HDFLIBAPI int32 ANstart(int32 file_id); HDFLIBAPI intn ANfileinfo(int32 an_id, int32 *n_file_label, int32 *n_file_desc, int32 *n_obj_label, @@ -844,10 +880,9 @@ HDFLIBAPI uint16 ANatype2tag(ann_type atype); HDFLIBAPI ann_type ANtag2atype(uint16 atag); -/* BMR: Removed because this function is meant to be private. -HDFLIBAPI intn ANdestroy(void); */ - -/* Multi-file Raster C-routines found in mfgr.c */ +/* + ** Multi-file General Raster - from mfgr.c + */ HDFLIBAPI intn rigcompare(void *k1, void *k2, intn cmparg); HDFLIBAPI int32 GRstart(int32 hdf_file_id); diff --git a/mfhdf/libsrc/mfdatainfo.h b/mfhdf/libsrc/mfdatainfo.h index a7558fa840..4bb77c7e14 100644 --- a/mfhdf/libsrc/mfdatainfo.h +++ b/mfhdf/libsrc/mfdatainfo.h @@ -20,17 +20,14 @@ extern "C" { #endif -/* Public functions for getting raw data information */ - -HDFLIBAPI intn SDgetdatainfo(int32 sdsid, int32 *chk_coord, uintn start_block, uintn info_count, - int32 *offsetarray, int32 *lengtharray); - -HDFLIBAPI intn SDgetattdatainfo(int32 id, int32 attrindex, int32 *offset, int32 *length); - -HDFLIBAPI intn SDgetoldattdatainfo(int32 dimid, int32 sdsid, char *attr_name, int32 *offset, int32 *length); - -HDFLIBAPI intn SDgetanndatainfo(int32 sdsid, ann_type annot_type, uintn size, int32 *offsetarray, - int32 *lengtharray); +/***************************************************************************** + * + * mfdatainfo.h + * + * The public APIs in this file were moved into mfhdf.h in version 4.3.0. + * Applications don't need to and should no longer include this header file. + * + ******************************************************************************/ #ifdef __cplusplus } diff --git a/mfhdf/libsrc/mfhdf.h b/mfhdf/libsrc/mfhdf.h index 3c77650f75..ff3e3e4bfb 100644 --- a/mfhdf/libsrc/mfhdf.h +++ b/mfhdf/libsrc/mfhdf.h @@ -28,7 +28,6 @@ #endif #include "mfhdfi.h" -#include "mfdatainfo.h" #define SD_UNLIMITED NC_UNLIMITED /* use this as marker for unlimited dimension */ #define SD_NOFILL NC_NOFILL @@ -413,6 +412,20 @@ HDFLIBAPI intn SDsetchunkcache(int32 sdsid, /* IN: sds access id */ int32 maxcache, /* IN: max number of chunks to cache */ int32 flags /* IN: flags = 0, HDF_CACHEALL */); +/* + ** Public functions for getting raw data information - from mfdatainfo.c + */ + +HDFLIBAPI intn SDgetdatainfo(int32 sdsid, int32 *chk_coord, uintn start_block, uintn info_count, + int32 *offsetarray, int32 *lengtharray); + +HDFLIBAPI intn SDgetattdatainfo(int32 id, int32 attrindex, int32 *offset, int32 *length); + +HDFLIBAPI intn SDgetoldattdatainfo(int32 dimid, int32 sdsid, char *attr_name, int32 *offset, int32 *length); + +HDFLIBAPI intn SDgetanndatainfo(int32 sdsid, ann_type annot_type, uintn size, int32 *offsetarray, + int32 *lengtharray); + #ifdef __cplusplus } #endif From cc8d58d3b830349482856154662767a2ba07dc4f Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 12 Feb 2024 20:27:38 -0800 Subject: [PATCH 07/65] Remove unused symbols from hdf2gif.c (#516) --- hdf/util/hdf2gif.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hdf/util/hdf2gif.c b/hdf/util/hdf2gif.c index 99c81d9443..0370cd82df 100644 --- a/hdf/util/hdf2gif.c +++ b/hdf/util/hdf2gif.c @@ -15,10 +15,6 @@ #include "gif.h" -#define HDFNAME "laser.hdf" -#define VGROUPCLASS "RIG0.0" -#define GIFNAME "temp.gif" - extern int hdfWriteGIF(FILE *fp, BYTE *pic, int ptype, int w, int h, BYTE *rmap, BYTE *gmap, BYTE *bmap, BYTE *pc2ncmap, int numcols, int colorstyle, int BitsPerPixel); From d84875c56e1364e1c924af1af06e7c7fd7408fdc Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 12 Feb 2024 20:42:19 -0800 Subject: [PATCH 08/65] Removes remanants of FNAME scheme (#517) In the past, Fortran names were decorated using FNAME macros. This is no longer true and this PR removes the unused macros. Removed from hdfi.h: * FNAME() * FNAME_POST_UNDERSCORE --- hdf/src/hdfi.h | 23 ----------------------- hdf/src/mfanf.c | 7 ------- hdf/src/vgf.c | 8 -------- mfhdf/fortran/mfsdf.c | 7 ------- 4 files changed, 45 deletions(-) diff --git a/hdf/src/hdfi.h b/hdf/src/hdfi.h index 36963d8241..e49af84ca3 100644 --- a/hdf/src/hdfi.h +++ b/hdf/src/hdfi.h @@ -163,8 +163,6 @@ typedef int intf; /* Integer that is the same size as a pointer */ typedef intptr_t hdf_pint_t; -#define FNAME_POST_UNDERSCORE - /*-----------------------------------------------------*/ /* encode and decode macros */ /*-----------------------------------------------------*/ @@ -289,27 +287,6 @@ typedef intptr_t hdf_pint_t; #define FRETVAL(x) x #endif -/*---------------------------------------------------------------- -** MACRO FNAME for any fortran callable routine name. -** -** This macro prepends, appends, or does not modify a name -** passed as a macro parameter to it based on the FNAME_PRE_UNDERSCORE, -** FNAME_POST_UNDERSCORE macros set for a specific system. -** -**---------------------------------------------------------------*/ -#if defined(FNAME_PRE_UNDERSCORE) && defined(FNAME_POST_UNDERSCORE) -#define FNAME(x) _##x##_ -#endif -#if defined(FNAME_PRE_UNDERSCORE) && !defined(FNAME_POST_UNDERSCORE) -#define FNAME(x) _##x -#endif -#if !defined(FNAME_PRE_UNDERSCORE) && defined(FNAME_POST_UNDERSCORE) -#define FNAME(x) x##_ -#endif -#if !defined(FNAME_PRE_UNDERSCORE) && !defined(FNAME_POST_UNDERSCORE) -#define FNAME(x) x -#endif - /************************************************************************** * Generally useful macro definitions **************************************************************************/ diff --git a/hdf/src/mfanf.c b/hdf/src/mfanf.c index 4c2c9b1ffb..ef29b212d8 100644 --- a/hdf/src/mfanf.c +++ b/hdf/src/mfanf.c @@ -58,13 +58,6 @@ interface. They call the corresponding C-functions in "mfan.c" The basic routines called by fortran will be of the form afxxxx - - If only a C stub is needed it will be named nafxxxx have the FNAME() - function applied to it. - - If a Fortran stub is also required the fortran stub will be called - afxxxx(mfanff.f) and the one in here will be nacxxx and again be FNAME()ed - -----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------- diff --git a/hdf/src/vgf.c b/hdf/src/vgf.c index 5b78ae8406..193d0db9a1 100644 --- a/hdf/src/vgf.c +++ b/hdf/src/vgf.c @@ -19,14 +19,6 @@ the Vxxx interfaces. The basic routines called by fortran will be of the form vfxxx. - - If only a C stub is needed it will be named nvfxxx and have the FNAME() - function applied to it. There are a few exceptions where C stub is - named for example ndfixxx or ndfxxx, oh well. - - If a Fortran stub is also required the fortran stub will be called - vfxxx(vgff.f) and the one in here will be nvfxxxc and again be FNAME()ed - -----------------------------------------------------------------------------*/ /* diff --git a/mfhdf/fortran/mfsdf.c b/mfhdf/fortran/mfsdf.c index 9cb4f92445..1b39b9d247 100644 --- a/mfhdf/fortran/mfsdf.c +++ b/mfhdf/fortran/mfsdf.c @@ -17,13 +17,6 @@ interface. The basic routines called by fortran will be of the form sfxxxx - - If only a C stub is needed it will be named nsfxxxx have the FNAME() - function applied to it. - - If a Fortran stub is also required the fortran stub will be called - sfxxxx and the one in here will be nscxxx and again be FNAME()ed - */ #include "mfsdf.h" From 156afa5a260c7755fb5d53a930758512af0aaf01 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 12 Feb 2024 21:34:15 -0800 Subject: [PATCH 09/65] Remove Fortran FRETVAL macros (#518) These are no longer necessary. The FCALLKEYW macro they enable is not used, the logic makes no sense, and many functions already omit FRETVAL(). --- hdf/src/df24f.c | 36 +- hdf/src/dfanf.c | 36 +- hdf/src/dff.c | 38 +- hdf/src/dfpf.c | 18 +- hdf/src/dfr8f.c | 34 +- hdf/src/dfsdf.c | 108 ++--- hdf/src/dfufp2if.c | 2 +- hdf/src/dfutilf.c | 4 +- hdf/src/hdfi.h | 18 - hdf/src/herrf.c | 6 +- hdf/src/hfilef.c | 20 +- hdf/src/hproto_fortran.h | 828 +++++++++++++++++++-------------------- hdf/src/mfanf.c | 34 +- hdf/src/mfgrf.c | 84 ++-- hdf/src/vattrf.c | 36 +- hdf/src/vgf.c | 172 ++++---- hdf/test/forsupf.c | 6 +- hdf/test/fortest.h | 6 +- mfhdf/fortran/mfsdf.c | 208 +++++----- mfhdf/fortran/mfsdf.h | 142 ++++--- 20 files changed, 900 insertions(+), 936 deletions(-) diff --git a/hdf/src/df24f.c b/hdf/src/df24f.c index 326d9fa7d9..1f83fd9408 100644 --- a/hdf/src/df24f.c +++ b/hdf/src/df24f.c @@ -56,7 +56,7 @@ static int dimsset = 0; * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd2reqil(intf *il) { return DFGRIreqil((intn)*il, (intn)IMAGE); @@ -73,7 +73,7 @@ nd2reqil(intf *il) * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd2sdims(intf *xdim, intf *ydim) { dimsset = 1; @@ -94,7 +94,7 @@ nd2sdims(intf *xdim, intf *ydim) * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd2igdim(_fcd filename, intf *pxdim, intf *pydim, intf *pil, intf *fnlen) { char *fn; @@ -121,7 +121,7 @@ nd2igdim(_fcd filename, intf *pxdim, intf *pydim, intf *pil, intf *fnlen) * Remarks: space is assumed to be xdim * ydim * 3 bytes *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd2igimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, intf *fnlen) { char *fn; @@ -148,7 +148,7 @@ nd2igimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, intf *fnlen) * Remarks: array image is assumed to be xdim * ydim * ncomps bytes *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd2iaimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, intf *fnlen, intf *newfile) { char *fn; @@ -176,7 +176,7 @@ nd2iaimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, intf *fnlen, intf *n * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd2setil(intf *il) { return DFGRIsetil((intn)*il, IMAGE); @@ -192,7 +192,7 @@ nd2setil(intf *il) * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd2first(void) { return DFGRIrestart(); @@ -208,7 +208,7 @@ nd2first(void) * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd2lref(void) { return (intf)DFGRIlastref(); @@ -227,7 +227,7 @@ nd2lref(void) * must be called. *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd2scomp(intf *scheme) { comp_info cinfo; /* Structure containing compression parameters */ @@ -251,7 +251,7 @@ nd2scomp(intf *scheme) * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd2sjpeg(intf *quality, intf *force_baseline) { comp_info cinfo; /* Structure containing compression parameters */ @@ -271,7 +271,7 @@ nd2sjpeg(intf *quality, intf *force_baseline) * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndf24reqil(intf *il) { return DFGRIreqil((intn)*il, IMAGE); @@ -288,7 +288,7 @@ ndf24reqil(intf *il) * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndf24setdims(intf *xdim, intf *ydim) { dimsset = 1; @@ -305,7 +305,7 @@ ndf24setdims(intf *xdim, intf *ydim) * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndf24setil(intf *il) { return DFGRIsetil((intn)*il, IMAGE); @@ -321,7 +321,7 @@ ndf24setil(intf *il) * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndf24restart(void) { return DFGRIrestart(); @@ -340,7 +340,7 @@ ndf24restart(void) * must be called. *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndf24scompress(intf *scheme) { comp_info cinfo; /* Structure containing compression parameters */ @@ -364,7 +364,7 @@ ndf24scompress(intf *scheme) * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndf24sjpeg(intf *quality, intf *force_baseline) { comp_info cinfo; /* Structure containing compression parameters */ @@ -386,7 +386,7 @@ ndf24sjpeg(intf *quality, intf *force_baseline) * Remarks: *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd2irref(_fcd filename, intf *ref, intf *fnlen) { char *fn; @@ -411,7 +411,7 @@ nd2irref(_fcd filename, intf *ref, intf *fnlen) * Remarks: *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd2inimg(_fcd filename, intf *fnlen) { char *fn; diff --git a/hdf/src/dfanf.c b/hdf/src/dfanf.c index f4e2bd3917..316e505c4f 100644 --- a/hdf/src/dfanf.c +++ b/hdf/src/dfanf.c @@ -70,7 +70,7 @@ * Invokes: DFSDIclear *-------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndaclear(void) { return DFANIclear(); @@ -88,7 +88,7 @@ ndaclear(void) * Invokes: DFANIgetannlen, HDf2cstring, DFIfreespace *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndaiganl(_fcd filename, intf *tag, intf *ref, intf *type, intf *fnlen) { char *fn; @@ -117,7 +117,7 @@ ndaiganl(_fcd filename, intf *tag, intf *ref, intf *type, intf *fnlen) * Invokes: DFANIgetann *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndaigann(_fcd filename, intf *tag, intf *ref, _fcd annotation, intf *maxlen, intf *type, intf *fnlen) { char *fn; @@ -147,7 +147,7 @@ ndaigann(_fcd filename, intf *tag, intf *ref, _fcd annotation, intf *maxlen, int * Invokes: DFANIgetann *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndaipann(_fcd filename, intf *tag, intf *ref, _fcd annotation, intf *annlen, intf *type, intf *fnlen) { char *fn; @@ -181,7 +181,7 @@ ndaipann(_fcd filename, intf *tag, intf *ref, _fcd annotation, intf *annlen, int * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndailist(_fcd filename, intf *tag, intf reflist[], _fcd labellist, intf *listsize, intf *maxlen, intf *startpos, intf *fnlen) { @@ -225,7 +225,7 @@ ndailist(_fcd filename, intf *tag, intf reflist[], _fcd labellist, intf *listsiz * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndalref(void) { return (intf)DFANlastref(); @@ -242,7 +242,7 @@ ndalref(void) * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfanlastref(void) { return (intf)DFANlastref(); @@ -263,7 +263,7 @@ ndfanlastref(void) * Invokes: DFANaddfileann *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfanaddfds(intf *dfile, _fcd desc, intf *desclen) { return DFANIaddfann(*dfile, _fcdtocp(desc), *desclen, DFAN_DESC); @@ -279,7 +279,7 @@ ndfanaddfds(intf *dfile, _fcd desc, intf *desclen) * Invokes: DFANIgetfannlen *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfangetfidlen(intf *dfile, intf *isfirst) { return DFANIgetfannlen(*dfile, DFAN_LABEL, (intn)*isfirst); @@ -295,7 +295,7 @@ ndfangetfidlen(intf *dfile, intf *isfirst) * Invokes: DFANIgetfannlen *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfangetfdslen(intf *dfile, intf *isfirst) { return DFANIgetfannlen(*dfile, DFAN_DESC, (intn)*isfirst); @@ -312,7 +312,7 @@ ndfangetfdslen(intf *dfile, intf *isfirst) * Invokes: DFANgetfann *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfangetfid(intf *dfile, _fcd id, intf *maxlen, intf *isfirst) { return DFANIgetfann(*dfile, _fcdtocp(id), *maxlen, DFAN_LABEL, (intn)*isfirst); @@ -329,7 +329,7 @@ ndfangetfid(intf *dfile, _fcd id, intf *maxlen, intf *isfirst) * Invokes: DFANgetfann *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfangetfds(intf *dfile, _fcd id, intf *maxlen, intf *isfirst) { return DFANIgetfann(*dfile, _fcdtocp(id), *maxlen, DFAN_DESC, (intn)*isfirst); @@ -350,7 +350,7 @@ ndfangetfds(intf *dfile, _fcd id, intf *maxlen, intf *isfirst) * Invokes: DFANaddfileann *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndaafds(intf *dfile, _fcd desc, intf *desclen) { return DFANIaddfann(*dfile, _fcdtocp(desc), *desclen, DFAN_DESC); @@ -366,7 +366,7 @@ ndaafds(intf *dfile, _fcd desc, intf *desclen) * Invokes: DFANIgetfannlen *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndagfidl(intf *dfile, intf *isfirst) { return DFANIgetfannlen(*dfile, DFAN_LABEL, (intn)*isfirst); @@ -382,7 +382,7 @@ ndagfidl(intf *dfile, intf *isfirst) * Invokes: DFANIgetfannlen *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndagfdsl(intf *dfile, intf *isfirst) { return DFANIgetfannlen(*dfile, DFAN_DESC, (intn)*isfirst); @@ -399,7 +399,7 @@ ndagfdsl(intf *dfile, intf *isfirst) * Invokes: DFANIgetfann *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndagfid(intf *dfile, _fcd id, intf *maxlen, intf *isfirst) { return DFANIgetfann(*dfile, _fcdtocp(id), *maxlen, DFAN_LABEL, (intn)*isfirst); @@ -417,7 +417,7 @@ ndagfid(intf *dfile, _fcd id, intf *maxlen, intf *isfirst) * Invokes: DFANgetfann *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndagfds(intf *dfile, _fcd id, intf *maxlen, intf *isfirst) { return DFANIgetfann(*dfile, _fcdtocp(id), *maxlen, DFAN_DESC, (intn)*isfirst); @@ -438,7 +438,7 @@ ndagfds(intf *dfile, _fcd id, intf *maxlen, intf *isfirst) * Invokes: DFANaddfann *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndaiafid(intf *dfile, _fcd id, intf *idlen) { return DFANIaddfann(*dfile, _fcdtocp(id), *idlen, DFAN_LABEL); diff --git a/hdf/src/dff.c b/hdf/src/dff.c index 0dd15d02b3..39f684c56e 100644 --- a/hdf/src/dff.c +++ b/hdf/src/dff.c @@ -56,7 +56,7 @@ * This is a design error and has no easy portable solution. *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfiopen(_fcd name, intf *acc_mode, intf *defdds, intf *namelen) { char *fn; @@ -78,7 +78,7 @@ ndfiopen(_fcd name, intf *acc_mode, intf *defdds, intf *namelen) * Invokes: DFclose *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfclose(intf *dfile) { return DFclose((DF *)*dfile); @@ -94,7 +94,7 @@ ndfclose(intf *dfile) * Invokes: DFdesc *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfdesc(intf *dfile, intf ptr[][4], intf *begin, intf *num) { DFdesc *ptr1; @@ -131,7 +131,7 @@ ndfdesc(intf *dfile, intf ptr[][4], intf *begin, intf *num) * Invokes: DFdup *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfdup(intf *dfile, intf *tag, intf *ref, intf *otag, intf *oref) { return DFdup((DF *)*dfile, (uint16)*tag, (uint16)*ref, (uint16)*otag, (uint16)*oref); @@ -147,7 +147,7 @@ ndfdup(intf *dfile, intf *tag, intf *ref, intf *otag, intf *oref) * Invokes: DFdel *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfdel(intf *dfile, intf *tag, intf *ref) { return DFdel((DF *)*dfile, (uint16)*tag, (uint16)*ref); @@ -164,7 +164,7 @@ ndfdel(intf *dfile, intf *tag, intf *ref) * Invokes: DFaccess *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfiaccess(intf *dfile, intf *tag, intf *ref, _fcd acc_mode, intf *acclen) { char *acc; @@ -187,7 +187,7 @@ ndfiaccess(intf *dfile, intf *tag, intf *ref, _fcd acc_mode, intf *acclen) * Invokes: DFread *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfread(intf *dfile, _fcd ptr, intf *len) { return DFread((DF *)*dfile, (char *)_fcdtocp(ptr), *len); @@ -203,7 +203,7 @@ ndfread(intf *dfile, _fcd ptr, intf *len) * Invokes: DFseek *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfseek(intf *dfile, intf *offset) { return DFseek((DF *)*dfile, *offset); @@ -220,7 +220,7 @@ ndfseek(intf *dfile, intf *offset) * Invokes: DFwrite *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfwrite(intf *dfile, _fcd ptr, intf *len) { return DFwrite((DF *)*dfile, (char *)_fcdtocp(ptr), *len); @@ -235,7 +235,7 @@ ndfwrite(intf *dfile, _fcd ptr, intf *len) * Invokes: DFupdate *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfupdate(intf *dfile) { return DFupdate((DF *)*dfile); @@ -252,7 +252,7 @@ ndfupdate(intf *dfile) * Invokes: DFgetelement *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfget(intf *dfile, intf *tag, intf *ref, _fcd ptr) { return DFgetelement((DF *)*dfile, (uint16)*tag, (uint16)*ref, (char *)_fcdtocp(ptr)); @@ -270,7 +270,7 @@ ndfget(intf *dfile, intf *tag, intf *ref, _fcd ptr) * Invokes: DFputelement *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfput(intf *dfile, intf *tag, intf *ref, _fcd ptr, intf *len) { return DFputelement((DF *)*dfile, (uint16)*tag, (uint16)*ref, (char *)_fcdtocp(ptr), *len); @@ -286,7 +286,7 @@ ndfput(intf *dfile, intf *tag, intf *ref, _fcd ptr, intf *len) * Invokes: DFsetfind *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfsfind(intf *dfile, intf *tag, intf *ref) { return DFsetfind((DF *)*dfile, (uint16)*tag, (uint16)*ref); @@ -303,7 +303,7 @@ ndfsfind(intf *dfile, intf *tag, intf *ref) * Invokes: DFfind *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndffind(intf *dfile, intf *itag, intf *iref, intf *len) { DFdesc *ptr1; @@ -332,7 +332,7 @@ ndffind(intf *dfile, intf *itag, intf *iref, intf *len) * Invokes: DFerrno *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndferrno(void) { return DFerrno(); @@ -347,7 +347,7 @@ ndferrno(void) * Invokes: DFnewref *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfnewref(intf *dfile) { return (intf)DFnewref((DF *)*dfile); @@ -363,7 +363,7 @@ ndfnewref(intf *dfile) * Invokes: DFnumber *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfnumber(intf *dfile, intf *tag) { return DFnumber((DF *)*dfile, (uint16)*tag); @@ -379,7 +379,7 @@ ndfnumber(intf *dfile, intf *tag) * Invokes: DFstat *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfstat(intf *dfile, DFdata *dfinfo) { return DFstat((DF *)*dfile, dfinfo); @@ -395,7 +395,7 @@ ndfstat(intf *dfile, DFdata *dfinfo) * Invokes: DFishdf *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfiishdf(_fcd name, intf *namelen) { char *fn; diff --git a/hdf/src/dfpf.c b/hdf/src/dfpf.c index 3eff468c8a..994e178833 100644 --- a/hdf/src/dfpf.c +++ b/hdf/src/dfpf.c @@ -41,7 +41,7 @@ * Invokes: DFPgetpal *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndpigpal(_fcd filename, _fcd pal, intf *fnlen) { char *fn; @@ -72,7 +72,7 @@ ndpigpal(_fcd filename, _fcd pal, intf *fnlen) * call *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndpippal(_fcd filename, _fcd pal, intf *overwrite, _fcd filemode, intf *fnlen) { char *fn; @@ -95,7 +95,7 @@ ndpippal(_fcd filename, _fcd pal, intf *overwrite, _fcd filemode, intf *fnlen) * Invokes: DFPnpals *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndpinpal(_fcd filename, intf *fnlen) { char *fn; @@ -120,7 +120,7 @@ ndpinpal(_fcd filename, intf *fnlen) * Remarks: checks if palette with this ref exists *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndpirref(_fcd filename, intf *ref, intf *fnlen) { char *fn; @@ -145,7 +145,7 @@ ndpirref(_fcd filename, intf *ref, intf *fnlen) * Invokes: DFPwriteref *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndpiwref(_fcd filename, intf *ref, intf *fnlen) { @@ -169,7 +169,7 @@ ndpiwref(_fcd filename, intf *ref, intf *fnlen) * Remarks: Invokes DFPrestart *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndprest(void) { return DFPrestart(); @@ -186,7 +186,7 @@ ndprest(void) * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndplref(void) { return (intf)DFPlastref(); @@ -201,7 +201,7 @@ ndplref(void) * Remarks: Invokes DFPrestart *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfprestart(void) { return DFPrestart(); @@ -218,7 +218,7 @@ ndfprestart(void) * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfplastref(void) { return (intf)DFPlastref(); diff --git a/hdf/src/dfr8f.c b/hdf/src/dfr8f.c index 137ea3bbc9..1cdd2c83d1 100644 --- a/hdf/src/dfr8f.c +++ b/hdf/src/dfr8f.c @@ -44,7 +44,7 @@ * Invokes: DFR8setpalette *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd8spal(_fcd pal) { return DFR8setpalette((uint8 *)_fcdtocp(pal)); @@ -59,7 +59,7 @@ nd8spal(_fcd pal) * Invokes: DFR8restart *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd8first(void) { return DFR8restart(); @@ -77,7 +77,7 @@ nd8first(void) * Invokes: DFR8getdims *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd8igdim(_fcd filename, intf *xdim, intf *ydim, intf *ispal, intf *lenfn) { char *fn; @@ -111,7 +111,7 @@ nd8igdim(_fcd filename, intf *xdim, intf *ydim, intf *ispal, intf *lenfn) * Invokes: DFR8getimage *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd8igimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, _fcd pal, intf *lenfn) { char *fn; @@ -138,7 +138,7 @@ nd8igimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, _fcd pal, intf *lenf * Invokes: DFR8putimage *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd8ipimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, intf *compress, intf *lenfn) { char *fn; @@ -165,7 +165,7 @@ nd8ipimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, intf *compress, intf * Invokes: DFR8addimage *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd8iaimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, intf *compress, intf *lenfn) { char *fn; @@ -190,7 +190,7 @@ nd8iaimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, intf *compress, intf * Remarks: checks if image with this ref exists *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd8irref(_fcd filename, intf *ref, intf *fnlen) { char *fn; @@ -218,7 +218,7 @@ nd8irref(_fcd filename, intf *ref, intf *fnlen) * Remarks: *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd8iwref(_fcd filename, intf *ref, intf *fnlen) { char *fn; @@ -246,7 +246,7 @@ nd8iwref(_fcd filename, intf *ref, intf *fnlen) * Remarks: *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd8inims(_fcd filename, intf *fnlen) { char *fn; @@ -269,7 +269,7 @@ nd8inims(_fcd filename, intf *fnlen) * Invokes: DFR8lastref *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd8lref(void) { return (intf)DFR8lastref(); @@ -288,7 +288,7 @@ nd8lref(void) * must be called. *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd8scomp(intf *scheme) { comp_info cinfo; /* Structure containing compression parameters */ @@ -312,7 +312,7 @@ nd8scomp(intf *scheme) * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nd8sjpeg(intf *quality, intf *force_baseline) { comp_info cinfo; /* Structure containing compression parameters */ @@ -332,7 +332,7 @@ nd8sjpeg(intf *quality, intf *force_baseline) * Remarks: *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfr8lastref(void) { return (intf)DFR8lastref(); @@ -347,7 +347,7 @@ ndfr8lastref(void) * Invokes: DFR8setpalette *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfr8setpalette(_fcd pal) { return DFR8setpalette((uint8 *)_fcdtocp(pal)); @@ -362,7 +362,7 @@ ndfr8setpalette(_fcd pal) * Invokes: DFR8restart *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfr8restart(void) { return DFR8restart(); @@ -381,7 +381,7 @@ ndfr8restart(void) * must be called. *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfr8scompress(intf *scheme) { comp_info cinfo; /* Structure containing compression parameters */ @@ -405,7 +405,7 @@ ndfr8scompress(intf *scheme) * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfr8sjpeg(intf *quality, intf *force_baseline) { comp_info cinfo; /* Structure containing compression parameters */ diff --git a/hdf/src/dfsdf.c b/hdf/src/dfsdf.c index c35c02bec6..8619a2de02 100644 --- a/hdf/src/dfsdf.c +++ b/hdf/src/dfsdf.c @@ -83,7 +83,7 @@ * Invokes: DFSDgetdimscale *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsgdisc(intf *dim, intf *maxsize, void *scale) { intn rank, cdim; @@ -112,7 +112,7 @@ ndsgdisc(intf *dim, intf *maxsize, void *scale) * Invokes: DFSDgetrange *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsgrang(void *pmax, void *pmin) { return DFSDgetrange(pmax, pmin); @@ -128,7 +128,7 @@ ndsgrang(void *pmax, void *pmin) * Invokes: DFSDsetdims *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndssdims(intf *rank, intf dimsizes[]) { int32 i, *cdims, *p; @@ -159,7 +159,7 @@ ndssdims(intf *rank, intf dimsizes[]) * Invokes: DFSDsetdimscale *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndssdisc(intf *dim, intf *dimsize, void *scale) { int cdim; @@ -183,7 +183,7 @@ ndssdisc(intf *dim, intf *dimsize, void *scale) * Remarks: Max and Min are set only for next SDG, reset to NULL after *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndssrang(void *max, void *min) { return DFSDsetrange(max, min); @@ -198,7 +198,7 @@ ndssrang(void *max, void *min) * Invokes: DFSDclear *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsclear(void) { return DFSDclear(); @@ -213,7 +213,7 @@ ndsclear(void) * Invokes: DFSDsetlengths *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsslens(intf *maxlen_label, intf *maxlen_unit, intf *maxlen_format, intf *maxlen_coordsys) { return (DFSDsetlengths((intn)*maxlen_label, (intn)*maxlen_unit, (intn)*maxlen_format, @@ -230,7 +230,7 @@ ndsslens(intf *maxlen_label, intf *maxlen_unit, intf *maxlen_format, intf *maxle * Invokes: DFSDgetdimlen *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsgdiln(intf *dim, intf *llabel, intf *lunit, intf *lformat) { intn rank, cdim; @@ -266,7 +266,7 @@ ndsgdiln(intf *dim, intf *llabel, intf *lunit, intf *lformat) * Invokes: DFSDgetdatalen *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsgdaln(intf *llabel, intf *lunit, intf *lformat, intf *lcoordsys) { intf ret; @@ -290,7 +290,7 @@ ndsgdaln(intf *llabel, intf *lunit, intf *lformat, intf *lcoordsys) * Invokes: DFSDrestart *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsfirst(void) { @@ -308,7 +308,7 @@ ndsfirst(void) * Invokes: DFSDIputslice *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndspslc(intf windims[], void *data, intf dims[]) { int32 *cdims, *cwindims, *p, *wp; @@ -348,7 +348,7 @@ ndspslc(intf windims[], void *data, intf dims[]) * Invokes: DFSDIendslice *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndseslc(void) { @@ -366,7 +366,7 @@ ndseslc(void) * Remarks: 0 specifies default value *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndssnt(intf *numbertype) { return DFSDsetNT(*numbertype); @@ -382,7 +382,7 @@ ndssnt(intf *numbertype) * Remarks: 0 specifies default value *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsgnt(intf *pnumbertype) { return DFSDgetNT((int32 *)pnumbertype); @@ -401,7 +401,7 @@ ndsgnt(intf *pnumbertype) * Invokes: DFSDgetdims *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsigdim(_fcd filename, intf *prank, intf sizes[], intf *maxrank, intf *lenfn) { char *fn; @@ -437,7 +437,7 @@ ndsigdim(_fcd filename, intf *prank, intf sizes[], intf *maxrank, intf *lenfn) * Invokes: DFSDIgetdata,DFSDIrefresh,DFSDIisndg *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsigdat(_fcd filename, intf *rank, intf maxsizes[], void *data, intf *fnlen) { int32 i; @@ -486,7 +486,7 @@ ndsigdat(_fcd filename, intf *rank, intf maxsizes[], void *data, intf *fnlen) * Invokes: DFSDIputdata *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsipdat(_fcd filename, intf *rank, intf dimsizes[], void *data, intf *fnlen) { char *fn; @@ -528,7 +528,7 @@ ndsipdat(_fcd filename, intf *rank, intf dimsizes[], void *data, intf *fnlen) * Invokes: DFSDIputdata *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsiadat(_fcd filename, intf *rank, intf dimsizes[], void *data, intf *fnlen) { char *fn; @@ -571,7 +571,7 @@ ndsiadat(_fcd filename, intf *rank, intf dimsizes[], void *data, intf *fnlen) * Invokes: DFSDIgetslice *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsigslc(_fcd filename, intf winst[], intf windims[], void *data, intf dims[], intf *fnlen) { char *fn; @@ -634,7 +634,7 @@ ndsigslc(_fcd filename, intf winst[], intf windims[], void *data, intf dims[], i * Invokes: DFSDstartslice *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsisslc(_fcd filename, intf *fnlen) { char *fn; @@ -659,7 +659,7 @@ ndsisslc(_fcd filename, intf *fnlen) * Invokes: DFSDstartslice *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsirref(_fcd filename, intf *ref, intf *fnlen) { char *fn; @@ -684,7 +684,7 @@ ndsirref(_fcd filename, intf *ref, intf *fnlen) * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndslref(void) { return (intf)DFSDlastref(); @@ -701,7 +701,7 @@ ndslref(void) * Method: convert string, call DFSDndatasets *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsinum(_fcd filename, intf *len) { char *cname; @@ -729,7 +729,7 @@ ndsinum(_fcd filename, intf *len) * Users: HDF Fortran programmers *------------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsip32s(_fcd filename, intf *ref, intf *ispre32, intf *len) { char *cname; @@ -753,7 +753,7 @@ ndsip32s(_fcd filename, intf *ref, intf *ispre32, intf *len) * Invokes: DFSDgetdatastrs *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfsdgetdatastrs(_fcd label, _fcd unit, _fcd format, _fcd coordsys) { return (DFSDgetdatastrs((char *)_fcdtocp(label), (char *)_fcdtocp(unit), (char *)_fcdtocp(format), @@ -769,7 +769,7 @@ ndfsdgetdatastrs(_fcd label, _fcd unit, _fcd format, _fcd coordsys) * Invokes: DFSDgetdimstrs *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfsdgetdimstrs(intf *dim, _fcd label, _fcd unit, _fcd format) { intn isndg; @@ -799,7 +799,7 @@ ndfsdgetdimstrs(intf *dim, _fcd label, _fcd unit, _fcd format) * Invokes: DFSDgetdimscale *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfsdgetdimscale(intf *dim, intf *maxsize, void *scale) { @@ -829,7 +829,7 @@ ndfsdgetdimscale(intf *dim, intf *maxsize, void *scale) * Invokes: DFSDgetrange *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfsdgetrange(void *pmax, void *pmin) { return DFSDgetrange(pmax, pmin); @@ -845,7 +845,7 @@ ndfsdgetrange(void *pmax, void *pmin) * Invokes: DFSDsetdims *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfsdsetdims(intf *rank, intf dimsizes[]) { @@ -877,7 +877,7 @@ ndfsdsetdims(intf *rank, intf dimsizes[]) * Invokes: DFSDsetdimscale *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfsdsetdimscale(intf *dim, intf *dimsize, void *scale) { intn rank, cdim; @@ -900,7 +900,7 @@ ndfsdsetdimscale(intf *dim, intf *dimsize, void *scale) * Remarks: Max and Min are set only for next SDG, reset to NULL after *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfsdsetrange(void *max, void *min) { return DFSDsetrange(max, min); @@ -915,7 +915,7 @@ ndfsdsetrange(void *max, void *min) * Invokes: DFSDclear *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfsdclear(void) { return DFSDclear(); @@ -930,7 +930,7 @@ ndfsdclear(void) * Invokes: DFSDsetlengths *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfsdsetlengths(intf *maxlen_label, intf *maxlen_unit, intf *maxlen_format, intf *maxlen_coordsys) { return (DFSDsetlengths((intn)*maxlen_label, (intn)*maxlen_unit, (intn)*maxlen_format, @@ -947,7 +947,7 @@ ndfsdsetlengths(intf *maxlen_label, intf *maxlen_unit, intf *maxlen_format, intf * Invokes: DFSDgetdimlen *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfsdgetdimlen(intf *dim, intf *llabel, intf *lunit, intf *lformat) { intn isndg; @@ -983,7 +983,7 @@ ndfsdgetdimlen(intf *dim, intf *llabel, intf *lunit, intf *lformat) * Invokes: DFSDgetdatalen *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfsdgetdatalen(intf *llabel, intf *lunit, intf *lformat, intf *lcoordsys) { intf ret; @@ -1008,7 +1008,7 @@ ndfsdgetdatalen(intf *llabel, intf *lunit, intf *lformat, intf *lcoordsys) * Invokes: DFSDrestart *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfsdrestart(void) { return DFSDrestart(); @@ -1026,7 +1026,7 @@ ndfsdrestart(void) * Invokes: DFSDIputslice *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfsdputslice(intf windims[], void *data, intf dims[]) { intn rank, i; @@ -1064,7 +1064,7 @@ ndfsdputslice(intf windims[], void *data, intf dims[]) * Invokes: DFSDIendslice *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfsdendslice(void) { return DFSDIendslice(1); @@ -1081,7 +1081,7 @@ ndfsdendslice(void) * Remarks: 0 specifies default value *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfsdsetnt(intf *numbertype) { return DFSDsetNT(*numbertype); @@ -1097,7 +1097,7 @@ ndfsdsetnt(intf *numbertype) * Remarks: 0 specifies default value *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfsdgetnt(intf *pnumbertype) { return DFSDgetNT((int32 *)pnumbertype); @@ -1114,7 +1114,7 @@ ndfsdgetnt(intf *pnumbertype) * Remarks: none *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfsdlastref(void) { return (intf)DFSDlastref(); @@ -1137,7 +1137,7 @@ ndfsdlastref(void) * Method: *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsisdis(intf *dim, _fcd flabel, _fcd funit, _fcd fformat, intf *llabel, intf *lunit, intf *lformat) { char *label = HDf2cstring(flabel, (intn)*llabel); @@ -1176,7 +1176,7 @@ ndsisdis(intf *dim, _fcd flabel, _fcd funit, _fcd fformat, intf *llabel, intf *l * Invokes: DFSDgetdimstrs *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsigdis(intf *dim, _fcd label, _fcd unit, _fcd format, intf *llabel, intf *lunit, intf *lformat) { char *ilabel, *iunit, *iformat; @@ -1229,7 +1229,7 @@ ndsigdis(intf *dim, _fcd label, _fcd unit, _fcd format, intf *llabel, intf *luni * Method: Stores values in global structure Writesdg * Remarks: *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsisdas(_fcd flabel, _fcd funit, _fcd fformat, _fcd fcoordsys, intf *isfortran, intf *llabel, intf *lunit, intf *lformat, intf *lcoordsys) { @@ -1267,7 +1267,7 @@ ndsisdas(_fcd flabel, _fcd funit, _fcd fformat, _fcd fcoordsys, intf *isfortran, * Invokes: DFSDgetdatastrs *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsigdas(_fcd label, _fcd unit, _fcd format, _fcd coordsys, intf *llabel, intf *lunit, intf *lformat, intf *lcoord) { @@ -1310,7 +1310,7 @@ ndsigdas(_fcd label, _fcd unit, _fcd format, _fcd coordsys, intf *llabel, intf * * Users: HDF Fortran programmers * Invokes: DFSDgetdatastrs *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsscal(float64 *cal, float64 *cal_err, float64 *ioff, float64 *ioff_err, intf *cal_type) { intf ret; @@ -1340,7 +1340,7 @@ ndsscal(float64 *cal, float64 *cal_err, float64 *ioff, float64 *ioff_err, intf * * Invokes: DFSDgetcal *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsgcal(float64 *cal, float64 *cal_err, float64 *ioff, float64 *ioff_err, intf *cal_type) { intf ret; @@ -1370,7 +1370,7 @@ ndsgcal(float64 *cal, float64 *cal_err, float64 *ioff, float64 *ioff_err, intf * * Invokes: DFSDwriteref *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsiwref(_fcd filename, intf *fnlen, intf *ref) { char *fn; @@ -1393,7 +1393,7 @@ ndsiwref(_fcd filename, intf *fnlen, intf *ref) * Invokes: DFSDsetfillvalue *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndssfill(void *fill_value) { return DFSDsetfillvalue(fill_value); @@ -1408,7 +1408,7 @@ ndssfill(void *fill_value) * Invokes: DFSDgetfillvalue *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsgfill(void *fill_value) { return DFSDgetfillvalue(fill_value); @@ -1425,7 +1425,7 @@ ndsgfill(void *fill_value) * Remarks: *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsisslab(_fcd filename, intf *fnlen) { char *fn; @@ -1451,7 +1451,7 @@ ndsisslab(_fcd filename, intf *fnlen) * Invokes: DFSDIgetwrank, malloc, free, HDf2cstring, DFSDwriteslab *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndswslab(intf start[], intf stride[], intf count[], void *data) { int32 *lstart, *lstride, *lcount, *aptr, *bptr, *cptr; @@ -1499,7 +1499,7 @@ ndswslab(intf start[], intf stride[], intf count[], void *data) * Remarks: *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndseslab(void) { return DFSDendslab(); @@ -1520,7 +1520,7 @@ ndseslab(void) * Invokes: DFSDreadslab *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndsirslab(_fcd filename, intf *fnlen, intf start[], intf slab_size[], intf stride[], void *buffer, intf buffer_size[]) { diff --git a/hdf/src/dfufp2if.c b/hdf/src/dfufp2if.c index 974d05e901..e02ae3e0a7 100644 --- a/hdf/src/dfufp2if.c +++ b/hdf/src/dfufp2if.c @@ -24,7 +24,7 @@ * Invokes: DFUfptoimage *---------------------------------------------------------------------------*/ -FRETVAL(int) +int nduif2i(int32 *hdim, int32 *vdim, float32 *max, float32 *min, float32 hscale[], float32 vscale[], float32 data[], _fcd palette, _fcd outfile, int *ct_method, int32 *hres, int32 *vres, int *compress, int *lenfn) diff --git a/hdf/src/dfutilf.c b/hdf/src/dfutilf.c index 300e2e8fdc..8797a29116 100644 --- a/hdf/src/dfutilf.c +++ b/hdf/src/dfutilf.c @@ -33,7 +33,7 @@ * Invokes: DFfindnextref *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfindnr(intf *dfile, intf *tag, intf *lref) { return (intf)DFfindnextref(*dfile, (uint16)*tag, (uint16)*lref); @@ -55,7 +55,7 @@ ndfindnr(intf *dfile, intf *tag, intf *lref) * Invokes: DFfindnextref *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndffindnextref(intf *dfile, intf *tag, intf *lref) { return (intf)DFfindnextref(*dfile, (uint16)*tag, (uint16)*lref); diff --git a/hdf/src/hdfi.h b/hdf/src/hdfi.h index e49af84ca3..379f07230a 100644 --- a/hdf/src/hdfi.h +++ b/hdf/src/hdfi.h @@ -269,24 +269,6 @@ typedef intptr_t hdf_pint_t; p += n \ } -/*---------------------------------------------------------------- -** MACRO FCALLKEYW for any special fortran-C stub keyword -** -** Microsoft C and Fortran need __fortran for Fortran callable C -** routines. -** -** MACRO FRETVAL for any return value from a fortran-C stub function -** Replaces the older FCALLKEYW macro. -**---------------------------------------------------------------*/ -#ifdef FRETVAL -#undef FRETVAL -#endif - -#ifndef FRETVAL /* !MAC */ -#define FCALLKEYW /*NONE*/ -#define FRETVAL(x) x -#endif - /************************************************************************** * Generally useful macro definitions **************************************************************************/ diff --git a/hdf/src/herrf.c b/hdf/src/herrf.c index 95271cc7d9..440c3a7e45 100644 --- a/hdf/src/herrf.c +++ b/hdf/src/herrf.c @@ -35,7 +35,7 @@ * Instead it prints automatically to stdout. *---------------------------------------------------------------------------*/ -FRETVAL(VOID) +void nheprnt(intf *print_levels) { HEprint(stderr, *print_levels); @@ -52,7 +52,7 @@ nheprnt(intf *print_levels) * Instead it prints automatically to stdout. *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nheprntc(_fcd filename, intf *print_levels, intf *namelen) { FILE *err_file; @@ -82,7 +82,7 @@ nheprntc(_fcd filename, intf *print_levels, intf *namelen) * Outputs: error_message - error message assocoated with the error code * Returns: SUCCEED (0) if successful and FAIL(-1) otherwise *----------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nhestringc(intf *error_code, _fcd error_message, intf *len) { char *cstring = NULL; diff --git a/hdf/src/hfilef.c b/hdf/src/hfilef.c index 6fa0b36239..96f141e9ef 100644 --- a/hdf/src/hfilef.c +++ b/hdf/src/hfilef.c @@ -36,7 +36,7 @@ * Method: Convert filename to C string, call Hopen *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nhiopen(_fcd name, intf *acc_mode, intf *defdds, intf *namelen) { char *fn; @@ -59,7 +59,7 @@ nhiopen(_fcd name, intf *acc_mode, intf *defdds, intf *namelen) * Invokes: Hclose *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nhclose(intf *file_id) { return Hclose(*file_id); @@ -74,7 +74,7 @@ nhclose(intf *file_id) * Invokes: Hnumber *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nhnumber(intf *file_id, intf *tag) { return Hnumber((int32)*file_id, (uint16)*tag); @@ -90,7 +90,7 @@ nhnumber(intf *file_id, intf *tag) * Method: Convert dir to C string, call HXsetdir *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nhxisdir(_fcd dir, intf *dirlen) { char *fn; @@ -114,7 +114,7 @@ nhxisdir(_fcd dir, intf *dirlen) * Method: Convert dir to C string, call HXsetcdir *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nhxiscdir(_fcd dir, intf *dirlen) { char *fn; @@ -137,7 +137,7 @@ nhxiscdir(_fcd dir, intf *dirlen) * Invokes: HDdont_atexit *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nhddontatexit(void) { return (intf)(HDdont_atexit()); @@ -152,7 +152,7 @@ nhddontatexit(void) * string - version number text string * Returns: SUCCEED (0) if successful and FAIL(-1) otherwise *----------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nhglibverc(intf *major_v, intf *minor_v, intf *release, _fcd string, intf *len) { char *cstring; @@ -186,7 +186,7 @@ nhglibverc(intf *major_v, intf *minor_v, intf *release, _fcd string, intf *len) * string - version number text string * Returns: SUCCEED (0) if successful and FAIL(-1) otherwise *----------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nhgfilverc(intf *file_id, intf *major_v, intf *minor_v, intf *release, _fcd string, intf *len) { char *cstring; @@ -220,7 +220,7 @@ nhgfilverc(intf *file_id, intf *major_v, intf *minor_v, intf *release, _fcd stri * Method: Convert filename to C string, call Hishdf *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nhiishdf(_fcd name, intf *namelen) { char *fn; @@ -244,7 +244,7 @@ nhiishdf(_fcd name, intf *namelen) * Returns: SUCCEED (0) on success, FALSE (-1) on failure *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nhconfinfc(intf *coder_type, intf *info) { comp_coder_t coder_type_c; diff --git a/hdf/src/hproto_fortran.h b/hdf/src/hproto_fortran.h index e0fa273f93..669ca600e3 100644 --- a/hdf/src/hproto_fortran.h +++ b/hdf/src/hproto_fortran.h @@ -43,44 +43,44 @@ extern "C" { #define ndagfds H4_F77_FUNC(dagfds, DAGFDS) #define ndaiafid H4_F77_FUNC(daiafid, DAIAFID) -HDFFCLIBAPI FRETVAL(intf) ndaiganl(_fcd filename, intf *tag, intf *ref, intf *type, intf *fnlen); +HDFFCLIBAPI intf ndaiganl(_fcd filename, intf *tag, intf *ref, intf *type, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) - ndaigann(_fcd filename, intf *tag, intf *ref, _fcd annotation, intf *maxlen, intf *type, intf *fnlen); +HDFFCLIBAPI intf ndaigann(_fcd filename, intf *tag, intf *ref, _fcd annotation, intf *maxlen, intf *type, + intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) - ndaipann(_fcd filename, intf *tag, intf *ref, _fcd annotation, intf *annlen, intf *type, intf *fnlen); +HDFFCLIBAPI intf ndaipann(_fcd filename, intf *tag, intf *ref, _fcd annotation, intf *annlen, intf *type, + intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) ndailist(_fcd filename, intf *tag, intf reflist[], _fcd labellist, intf *listsize, - intf *maxlen, intf *startpos, intf *fnlen); +HDFFCLIBAPI intf ndailist(_fcd filename, intf *tag, intf reflist[], _fcd labellist, intf *listsize, + intf *maxlen, intf *startpos, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) ndalref(void); +HDFFCLIBAPI intf ndalref(void); -HDFFCLIBAPI FRETVAL(intf) ndaclear(void); +HDFFCLIBAPI intf ndaclear(void); -HDFFCLIBAPI FRETVAL(intf) ndfanlastref(void); +HDFFCLIBAPI intf ndfanlastref(void); -HDFFCLIBAPI FRETVAL(intf) ndfanaddfds(intf *dfile, _fcd desc, intf *desclen); +HDFFCLIBAPI intf ndfanaddfds(intf *dfile, _fcd desc, intf *desclen); -HDFFCLIBAPI FRETVAL(intf) ndfangetfidlen(intf *dfile, intf *isfirst); +HDFFCLIBAPI intf ndfangetfidlen(intf *dfile, intf *isfirst); -HDFFCLIBAPI FRETVAL(intf) ndfangetfdslen(intf *dfile, intf *isfirst); +HDFFCLIBAPI intf ndfangetfdslen(intf *dfile, intf *isfirst); -HDFFCLIBAPI FRETVAL(intf) ndfangetfid(intf *dfile, _fcd id, intf *maxlen, intf *isfirst); +HDFFCLIBAPI intf ndfangetfid(intf *dfile, _fcd id, intf *maxlen, intf *isfirst); -HDFFCLIBAPI FRETVAL(intf) ndfangetfds(intf *dfile, _fcd id, intf *maxlen, intf *isfirst); +HDFFCLIBAPI intf ndfangetfds(intf *dfile, _fcd id, intf *maxlen, intf *isfirst); -HDFFCLIBAPI FRETVAL(intf) ndaafds(intf *dfile, _fcd desc, intf *desclen); +HDFFCLIBAPI intf ndaafds(intf *dfile, _fcd desc, intf *desclen); -HDFFCLIBAPI FRETVAL(intf) ndagfidl(intf *dfile, intf *isfirst); +HDFFCLIBAPI intf ndagfidl(intf *dfile, intf *isfirst); -HDFFCLIBAPI FRETVAL(intf) ndagfdsl(intf *dfile, intf *isfirst); +HDFFCLIBAPI intf ndagfdsl(intf *dfile, intf *isfirst); -HDFFCLIBAPI FRETVAL(intf) ndagfid(intf *dfile, _fcd id, intf *maxlen, intf *isfirst); +HDFFCLIBAPI intf ndagfid(intf *dfile, _fcd id, intf *maxlen, intf *isfirst); -HDFFCLIBAPI FRETVAL(intf) ndagfds(intf *dfile, _fcd id, intf *maxlen, intf *isfirst); +HDFFCLIBAPI intf ndagfds(intf *dfile, _fcd id, intf *maxlen, intf *isfirst); -HDFFCLIBAPI FRETVAL(intf) ndaiafid(intf *dfile, _fcd id, intf *idlen); +HDFFCLIBAPI intf ndaiafid(intf *dfile, _fcd id, intf *idlen); /* ** from dfr8F.c @@ -103,41 +103,39 @@ HDFFCLIBAPI FRETVAL(intf) ndaiafid(intf *dfile, _fcd id, intf *idlen); #define nd8sjpeg H4_F77_FUNC(d8sjpeg, D8SJPEG) #define ndfr8sjpeg H4_F77_FUNC(dfr8sjpeg, DFR8SJPEG) -HDFFCLIBAPI FRETVAL(intf) nd8spal(_fcd pal); +HDFFCLIBAPI intf nd8spal(_fcd pal); -HDFFCLIBAPI FRETVAL(intf) nd8first(void); +HDFFCLIBAPI intf nd8first(void); -HDFFCLIBAPI FRETVAL(intf) nd8igdim(_fcd filename, intf *xdim, intf *ydim, intf *ispal, intf *lenfn); +HDFFCLIBAPI intf nd8igdim(_fcd filename, intf *xdim, intf *ydim, intf *ispal, intf *lenfn); -HDFFCLIBAPI FRETVAL(intf) nd8igimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, _fcd pal, intf *lenfn); +HDFFCLIBAPI intf nd8igimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, _fcd pal, intf *lenfn); -HDFFCLIBAPI FRETVAL(intf) - nd8ipimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, intf *compress, intf *lenfn); +HDFFCLIBAPI intf nd8ipimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, intf *compress, intf *lenfn); -HDFFCLIBAPI FRETVAL(intf) - nd8iaimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, intf *compress, intf *lenfn); +HDFFCLIBAPI intf nd8iaimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, intf *compress, intf *lenfn); -HDFFCLIBAPI FRETVAL(intf) nd8irref(_fcd filename, intf *ref, intf *fnlen); +HDFFCLIBAPI intf nd8irref(_fcd filename, intf *ref, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) nd8iwref(_fcd filename, intf *ref, intf *fnlen); +HDFFCLIBAPI intf nd8iwref(_fcd filename, intf *ref, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) nd8inims(_fcd filename, intf *fnlen); +HDFFCLIBAPI intf nd8inims(_fcd filename, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) nd8lref(void); +HDFFCLIBAPI intf nd8lref(void); -HDFFCLIBAPI FRETVAL(intf) ndfr8lastref(void); +HDFFCLIBAPI intf ndfr8lastref(void); -HDFFCLIBAPI FRETVAL(intf) ndfr8setpalette(_fcd pal); +HDFFCLIBAPI intf ndfr8setpalette(_fcd pal); -HDFFCLIBAPI FRETVAL(intf) ndfr8restart(void); +HDFFCLIBAPI intf ndfr8restart(void); -HDFFCLIBAPI FRETVAL(intf) nd8scomp(intf *scheme); +HDFFCLIBAPI intf nd8scomp(intf *scheme); -HDFFCLIBAPI FRETVAL(intf) ndfr8scompress(intf *scheme); +HDFFCLIBAPI intf ndfr8scompress(intf *scheme); -HDFFCLIBAPI FRETVAL(intf) nd8sjpeg(intf *quality, intf *force_baseline); +HDFFCLIBAPI intf nd8sjpeg(intf *quality, intf *force_baseline); -HDFFCLIBAPI FRETVAL(intf) ndfr8sjpeg(intf *quality, intf *force_baseline); +HDFFCLIBAPI intf ndfr8sjpeg(intf *quality, intf *force_baseline); /* ** from dfsdF.c @@ -197,127 +195,123 @@ HDFFCLIBAPI FRETVAL(intf) ndfr8sjpeg(intf *quality, intf *force_baseline); #define ndseslab H4_F77_FUNC(dseslab, DSESLAB) #define ndsirslab H4_F77_FUNC(dsirslab, DSIRSLAB) -HDFFCLIBAPI FRETVAL(intf) ndsgdisc(intf *dim, intf *maxsize, void *scale); +HDFFCLIBAPI intf ndsgdisc(intf *dim, intf *maxsize, void *scale); -HDFFCLIBAPI FRETVAL(intf) ndsgrang(void *pmax, void *pmin); +HDFFCLIBAPI intf ndsgrang(void *pmax, void *pmin); -HDFFCLIBAPI FRETVAL(intf) ndssdims(intf *rank, intf dimsizes[]); +HDFFCLIBAPI intf ndssdims(intf *rank, intf dimsizes[]); -HDFFCLIBAPI FRETVAL(intf) ndssdisc(intf *dim, intf *dimsize, void *scale); +HDFFCLIBAPI intf ndssdisc(intf *dim, intf *dimsize, void *scale); -HDFFCLIBAPI FRETVAL(intf) ndssrang(void *max, void *min); +HDFFCLIBAPI intf ndssrang(void *max, void *min); -HDFFCLIBAPI FRETVAL(intf) ndsclear(void); +HDFFCLIBAPI intf ndsclear(void); -HDFFCLIBAPI FRETVAL(intf) - ndsslens(intf *maxlen_label, intf *maxlen_unit, intf *maxlen_format, intf *maxlen_coordsys); +HDFFCLIBAPI intf ndsslens(intf *maxlen_label, intf *maxlen_unit, intf *maxlen_format, intf *maxlen_coordsys); -HDFFCLIBAPI FRETVAL(intf) ndsgdiln(intf *dim, intf *llabel, intf *lunit, intf *lformat); +HDFFCLIBAPI intf ndsgdiln(intf *dim, intf *llabel, intf *lunit, intf *lformat); -HDFFCLIBAPI FRETVAL(intf) ndsgdaln(intf *llabel, intf *lunit, intf *lformat, intf *lcoordsys); +HDFFCLIBAPI intf ndsgdaln(intf *llabel, intf *lunit, intf *lformat, intf *lcoordsys); -HDFFCLIBAPI FRETVAL(intf) ndsfirst(void); +HDFFCLIBAPI intf ndsfirst(void); -HDFFCLIBAPI FRETVAL(intf) ndspslc(intf windims[], void *data, intf dims[]); +HDFFCLIBAPI intf ndspslc(intf windims[], void *data, intf dims[]); -HDFFCLIBAPI FRETVAL(intf) ndseslc(void); +HDFFCLIBAPI intf ndseslc(void); -HDFFCLIBAPI FRETVAL(intf) ndssnt(intf *numbertype); +HDFFCLIBAPI intf ndssnt(intf *numbertype); -HDFFCLIBAPI FRETVAL(intf) ndsgnt(intf *pnumbertype); +HDFFCLIBAPI intf ndsgnt(intf *pnumbertype); -HDFFCLIBAPI FRETVAL(intf) ndsigdim(_fcd filename, intf *prank, intf sizes[], intf *maxrank, intf *lenfn); +HDFFCLIBAPI intf ndsigdim(_fcd filename, intf *prank, intf sizes[], intf *maxrank, intf *lenfn); -HDFFCLIBAPI FRETVAL(intf) ndsigdat(_fcd filename, intf *rank, intf maxsizes[], void *data, intf *fnlen); +HDFFCLIBAPI intf ndsigdat(_fcd filename, intf *rank, intf maxsizes[], void *data, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) ndsipdat(_fcd filename, intf *rank, intf dimsizes[], void *data, intf *fnlen); +HDFFCLIBAPI intf ndsipdat(_fcd filename, intf *rank, intf dimsizes[], void *data, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) ndsiadat(_fcd filename, intf *rank, intf dimsizes[], void *data, intf *fnlen); +HDFFCLIBAPI intf ndsiadat(_fcd filename, intf *rank, intf dimsizes[], void *data, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) - ndsigslc(_fcd filename, intf winst[], intf windims[], void *data, intf dims[], intf *fnlen); +HDFFCLIBAPI intf ndsigslc(_fcd filename, intf winst[], intf windims[], void *data, intf dims[], intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) ndsisslc(_fcd filename, intf *fnlen); +HDFFCLIBAPI intf ndsisslc(_fcd filename, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) ndsirref(_fcd filename, intf *ref, intf *fnlen); +HDFFCLIBAPI intf ndsirref(_fcd filename, intf *ref, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) ndslref(void); +HDFFCLIBAPI intf ndslref(void); -HDFFCLIBAPI FRETVAL(intf) ndsinum(_fcd filename, intf *len); +HDFFCLIBAPI intf ndsinum(_fcd filename, intf *len); -HDFFCLIBAPI FRETVAL(intf) ndsip32s(_fcd filename, intf *ref, intf *ispre32, intf *len); +HDFFCLIBAPI intf ndsip32s(_fcd filename, intf *ref, intf *ispre32, intf *len); -HDFFCLIBAPI FRETVAL(intf) ndfsdgetdatastrs(_fcd label, _fcd unit, _fcd format, _fcd coordsys); +HDFFCLIBAPI intf ndfsdgetdatastrs(_fcd label, _fcd unit, _fcd format, _fcd coordsys); -HDFFCLIBAPI FRETVAL(intf) ndfsdgetdimstrs(intf *dim, _fcd label, _fcd unit, _fcd format); +HDFFCLIBAPI intf ndfsdgetdimstrs(intf *dim, _fcd label, _fcd unit, _fcd format); -HDFFCLIBAPI FRETVAL(intf) ndfsdgetdimscale(intf *dim, intf *maxsize, void *scale); +HDFFCLIBAPI intf ndfsdgetdimscale(intf *dim, intf *maxsize, void *scale); -HDFFCLIBAPI FRETVAL(intf) ndfsdgetrange(void *pmax, void *pmin); +HDFFCLIBAPI intf ndfsdgetrange(void *pmax, void *pmin); -HDFFCLIBAPI FRETVAL(intf) ndfsdsetdims(intf *rank, intf dimsizes[]); +HDFFCLIBAPI intf ndfsdsetdims(intf *rank, intf dimsizes[]); -HDFFCLIBAPI FRETVAL(intf) ndfsdsetdimscale(intf *dim, intf *dimsize, void *scale); +HDFFCLIBAPI intf ndfsdsetdimscale(intf *dim, intf *dimsize, void *scale); -HDFFCLIBAPI FRETVAL(intf) ndfsdsetrange(void *max, void *min); +HDFFCLIBAPI intf ndfsdsetrange(void *max, void *min); -HDFFCLIBAPI FRETVAL(intf) ndfsdclear(void); +HDFFCLIBAPI intf ndfsdclear(void); -HDFFCLIBAPI FRETVAL(intf) - ndfsdsetlengths(intf *maxlen_label, intf *maxlen_unit, intf *maxlen_format, intf *maxlen_coordsys); +HDFFCLIBAPI intf ndfsdsetlengths(intf *maxlen_label, intf *maxlen_unit, intf *maxlen_format, + intf *maxlen_coordsys); -HDFFCLIBAPI FRETVAL(intf) ndfsdgetdimlen(intf *dim, intf *llabel, intf *lunit, intf *lformat); +HDFFCLIBAPI intf ndfsdgetdimlen(intf *dim, intf *llabel, intf *lunit, intf *lformat); -HDFFCLIBAPI FRETVAL(intf) ndfsdgetdatalen(intf *llabel, intf *lunit, intf *lformat, intf *lcoordsys); +HDFFCLIBAPI intf ndfsdgetdatalen(intf *llabel, intf *lunit, intf *lformat, intf *lcoordsys); -HDFFCLIBAPI FRETVAL(intf) ndfsdrestart(void); +HDFFCLIBAPI intf ndfsdrestart(void); -HDFFCLIBAPI FRETVAL(intf) ndfsdputslice(intf windims[], void *data, intf dims[]); +HDFFCLIBAPI intf ndfsdputslice(intf windims[], void *data, intf dims[]); -HDFFCLIBAPI FRETVAL(intf) ndfsdendslice(void); +HDFFCLIBAPI intf ndfsdendslice(void); -HDFFCLIBAPI FRETVAL(intf) ndfsdsetnt(intf *numbertype); +HDFFCLIBAPI intf ndfsdsetnt(intf *numbertype); -HDFFCLIBAPI FRETVAL(intf) ndfsdgetnt(intf *pnumbertype); +HDFFCLIBAPI intf ndfsdgetnt(intf *pnumbertype); -HDFFCLIBAPI FRETVAL(intf) ndfsdlastref(void); +HDFFCLIBAPI intf ndfsdlastref(void); -HDFFCLIBAPI FRETVAL(intf) - ndsisdis(intf *dim, _fcd flabel, _fcd funit, _fcd fformat, intf *llabel, intf *lunit, intf *lformat); +HDFFCLIBAPI intf ndsisdis(intf *dim, _fcd flabel, _fcd funit, _fcd fformat, intf *llabel, intf *lunit, + intf *lformat); -HDFFCLIBAPI FRETVAL(intf) - ndsigdis(intf *dim, _fcd label, _fcd unit, _fcd format, intf *llabel, intf *lunit, intf *lformat); +HDFFCLIBAPI intf ndsigdis(intf *dim, _fcd label, _fcd unit, _fcd format, intf *llabel, intf *lunit, + intf *lformat); -HDFFCLIBAPI FRETVAL(intf) ndsisdas(_fcd flabel, _fcd funit, _fcd fformat, _fcd fcoordsys, intf *isfortran, - intf *llabel, intf *lunit, intf *lformat, intf *lcoordsys); +HDFFCLIBAPI intf ndsisdas(_fcd flabel, _fcd funit, _fcd fformat, _fcd fcoordsys, intf *isfortran, + intf *llabel, intf *lunit, intf *lformat, intf *lcoordsys); -HDFFCLIBAPI FRETVAL(intf) ndsigdas(_fcd label, _fcd unit, _fcd format, _fcd coordsys, intf *llabel, - intf *lunit, intf *lformat, intf *lcoord); +HDFFCLIBAPI intf ndsigdas(_fcd label, _fcd unit, _fcd format, _fcd coordsys, intf *llabel, intf *lunit, + intf *lformat, intf *lcoord); -HDFFCLIBAPI FRETVAL(intf) - ndsscal(float64 *cal, float64 *cal_err, float64 *ioff, float64 *ioff_err, intf *cal_type); +HDFFCLIBAPI intf ndsscal(float64 *cal, float64 *cal_err, float64 *ioff, float64 *ioff_err, intf *cal_type); -HDFFCLIBAPI FRETVAL(intf) - ndsgcal(float64 *cal, float64 *cal_err, float64 *ioff, float64 *ioff_err, intf *cal_type); +HDFFCLIBAPI intf ndsgcal(float64 *cal, float64 *cal_err, float64 *ioff, float64 *ioff_err, intf *cal_type); -HDFFCLIBAPI FRETVAL(intf) ndswref(_fcd filename, intf *fnlen, intf *ref); +HDFFCLIBAPI intf ndswref(_fcd filename, intf *fnlen, intf *ref); -HDFFCLIBAPI FRETVAL(intf) ndssfill(void *fill_value); +HDFFCLIBAPI intf ndssfill(void *fill_value); -HDFFCLIBAPI FRETVAL(intf) ndsgfill(void *fill_value); +HDFFCLIBAPI intf ndsgfill(void *fill_value); -HDFFCLIBAPI FRETVAL(intf) ndssslab(_fcd filename, intf *fnlen); +HDFFCLIBAPI intf ndssslab(_fcd filename, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) ndswslab(intf start[], intf stride[], intf cont[], void *data); +HDFFCLIBAPI intf ndswslab(intf start[], intf stride[], intf cont[], void *data); -HDFFCLIBAPI FRETVAL(intf) ndseslab(void); +HDFFCLIBAPI intf ndseslab(void); -HDFFCLIBAPI FRETVAL(intf) ndsiwref(_fcd filename, intf *fnlen, intf *ref); +HDFFCLIBAPI intf ndsiwref(_fcd filename, intf *fnlen, intf *ref); -HDFFCLIBAPI FRETVAL(intf) ndsisslab(_fcd filename, intf *fnlen); +HDFFCLIBAPI intf ndsisslab(_fcd filename, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) ndsirslab(_fcd filename, intf *fnlen, intf start[], intf slab_size[], intf stride[], - void *buffer, intf buffer_size[]); +HDFFCLIBAPI intf ndsirslab(_fcd filename, intf *fnlen, intf start[], intf slab_size[], intf stride[], + void *buffer, intf buffer_size[]); /* ** from dfpF.c @@ -333,23 +327,23 @@ HDFFCLIBAPI FRETVAL(intf) ndsirslab(_fcd filename, intf *fnlen, intf start[], in #define ndfprestart H4_F77_FUNC(dfprestart, DFPRESTART) #define ndfplastref H4_F77_FUNC(dfplastref, DFPLASTREF) -HDFFCLIBAPI FRETVAL(intf) ndpigpal(_fcd filename, _fcd pal, intf *fnlen); +HDFFCLIBAPI intf ndpigpal(_fcd filename, _fcd pal, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) ndpippal(_fcd filename, _fcd pal, intf *overwrite, _fcd filemode, intf *fnlen); +HDFFCLIBAPI intf ndpippal(_fcd filename, _fcd pal, intf *overwrite, _fcd filemode, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) ndpinpal(_fcd filename, intf *fnlen); +HDFFCLIBAPI intf ndpinpal(_fcd filename, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) ndpirref(_fcd filename, intf *ref, intf *fnlen); +HDFFCLIBAPI intf ndpirref(_fcd filename, intf *ref, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) ndpiwref(_fcd filename, intf *ref, intf *fnlen); +HDFFCLIBAPI intf ndpiwref(_fcd filename, intf *ref, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) ndprest(void); +HDFFCLIBAPI intf ndprest(void); -HDFFCLIBAPI FRETVAL(intf) ndplref(void); +HDFFCLIBAPI intf ndplref(void); -HDFFCLIBAPI FRETVAL(intf) ndfprestart(void); +HDFFCLIBAPI intf ndfprestart(void); -HDFFCLIBAPI FRETVAL(intf) ndfplastref(void); +HDFFCLIBAPI intf ndfplastref(void); /* ** from df24F.c @@ -373,42 +367,41 @@ HDFFCLIBAPI FRETVAL(intf) ndfplastref(void); #define nd2sjpeg H4_F77_FUNC(d2sjpeg, D2SJPEG) #define ndf24sjpeg H4_F77_FUNC(df24sjpeg, DF24SJPEG) -HDFFCLIBAPI FRETVAL(intf) nd2reqil(intf *il); +HDFFCLIBAPI intf nd2reqil(intf *il); -HDFFCLIBAPI FRETVAL(intf) nd2sdims(intf *xdim, intf *ydim); +HDFFCLIBAPI intf nd2sdims(intf *xdim, intf *ydim); -HDFFCLIBAPI FRETVAL(intf) nd2igdim(_fcd filename, intf *pxdim, intf *pydim, intf *pil, intf *fnlen); +HDFFCLIBAPI intf nd2igdim(_fcd filename, intf *pxdim, intf *pydim, intf *pil, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) nd2igimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, intf *fnlen); +HDFFCLIBAPI intf nd2igimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) - nd2iaimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, intf *fnlen, intf *newfile); +HDFFCLIBAPI intf nd2iaimg(_fcd filename, _fcd image, intf *xdim, intf *ydim, intf *fnlen, intf *newfile); -HDFFCLIBAPI FRETVAL(intf) nd2setil(intf *il); +HDFFCLIBAPI intf nd2setil(intf *il); -HDFFCLIBAPI FRETVAL(intf) nd2first(void); +HDFFCLIBAPI intf nd2first(void); -HDFFCLIBAPI FRETVAL(intf) ndf24reqil(intf *il); +HDFFCLIBAPI intf ndf24reqil(intf *il); -HDFFCLIBAPI FRETVAL(intf) ndf24setdims(intf *xdim, intf *ydim); +HDFFCLIBAPI intf ndf24setdims(intf *xdim, intf *ydim); -HDFFCLIBAPI FRETVAL(intf) ndf24setil(intf *il); +HDFFCLIBAPI intf ndf24setil(intf *il); -HDFFCLIBAPI FRETVAL(intf) ndf24restart(void); +HDFFCLIBAPI intf ndf24restart(void); -HDFFCLIBAPI FRETVAL(intf) nd2irref(_fcd filename, intf *ref, intf *fnlen); +HDFFCLIBAPI intf nd2irref(_fcd filename, intf *ref, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) nd2inimg(_fcd filename, intf *fnlen); +HDFFCLIBAPI intf nd2inimg(_fcd filename, intf *fnlen); -HDFFCLIBAPI FRETVAL(intf) nd2lref(void); +HDFFCLIBAPI intf nd2lref(void); -HDFFCLIBAPI FRETVAL(intf) nd2scomp(intf *scheme); +HDFFCLIBAPI intf nd2scomp(intf *scheme); -HDFFCLIBAPI FRETVAL(intf) ndf24scompress(intf *scheme); +HDFFCLIBAPI intf ndf24scompress(intf *scheme); -HDFFCLIBAPI FRETVAL(intf) nd2sjpeg(intf *quality, intf *force_baseline); +HDFFCLIBAPI intf nd2sjpeg(intf *quality, intf *force_baseline); -HDFFCLIBAPI FRETVAL(intf) ndf24sjpeg(intf *quality, intf *force_baseline); +HDFFCLIBAPI intf ndf24sjpeg(intf *quality, intf *force_baseline); /* ** from dfF.c @@ -434,45 +427,45 @@ HDFFCLIBAPI FRETVAL(intf) ndf24sjpeg(intf *quality, intf *force_baseline); #define ndfstat H4_F77_FUNC(dfstat, DFSTAT) #define ndfiishdf H4_F77_FUNC(dfiishdf, DFIISHDF) -HDFFCLIBAPI FRETVAL(intf) ndfiopen(_fcd name, intf *acc_mode, intf *defdds, intf *namelen); +HDFFCLIBAPI intf ndfiopen(_fcd name, intf *acc_mode, intf *defdds, intf *namelen); -HDFFCLIBAPI FRETVAL(intf) ndfclose(intf *dfile); +HDFFCLIBAPI intf ndfclose(intf *dfile); -HDFFCLIBAPI FRETVAL(intf) ndfdesc(intf *dfile, intf ptr[][4], intf *begin, intf *num); +HDFFCLIBAPI intf ndfdesc(intf *dfile, intf ptr[][4], intf *begin, intf *num); -HDFFCLIBAPI FRETVAL(intf) ndfdup(intf *dfile, intf *tag, intf *ref, intf *otag, intf *oref); +HDFFCLIBAPI intf ndfdup(intf *dfile, intf *tag, intf *ref, intf *otag, intf *oref); -HDFFCLIBAPI FRETVAL(intf) ndfdel(intf *dfile, intf *tag, intf *ref); +HDFFCLIBAPI intf ndfdel(intf *dfile, intf *tag, intf *ref); -HDFFCLIBAPI FRETVAL(intf) ndfiaccess(intf *dfile, intf *tag, intf *ref, _fcd acc_mode, intf *acclen); +HDFFCLIBAPI intf ndfiaccess(intf *dfile, intf *tag, intf *ref, _fcd acc_mode, intf *acclen); -HDFFCLIBAPI FRETVAL(intf) ndfstart(intf *dfile, intf *tag, intf *ref, char *acc_mode); +HDFFCLIBAPI intf ndfstart(intf *dfile, intf *tag, intf *ref, char *acc_mode); -HDFFCLIBAPI FRETVAL(intf) ndfread(intf *dfile, _fcd ptr, intf *len); +HDFFCLIBAPI intf ndfread(intf *dfile, _fcd ptr, intf *len); -HDFFCLIBAPI FRETVAL(intf) ndfseek(intf *dfile, intf *offset); +HDFFCLIBAPI intf ndfseek(intf *dfile, intf *offset); -HDFFCLIBAPI FRETVAL(intf) ndfwrite(intf *dfile, _fcd ptr, intf *len); +HDFFCLIBAPI intf ndfwrite(intf *dfile, _fcd ptr, intf *len); -HDFFCLIBAPI FRETVAL(intf) ndfupdate(intf *dfile); +HDFFCLIBAPI intf ndfupdate(intf *dfile); -HDFFCLIBAPI FRETVAL(intf) ndfget(intf *dfile, intf *tag, intf *ref, _fcd ptr); +HDFFCLIBAPI intf ndfget(intf *dfile, intf *tag, intf *ref, _fcd ptr); -HDFFCLIBAPI FRETVAL(intf) ndfput(intf *dfile, intf *tag, intf *ref, _fcd ptr, intf *len); +HDFFCLIBAPI intf ndfput(intf *dfile, intf *tag, intf *ref, _fcd ptr, intf *len); -HDFFCLIBAPI FRETVAL(intf) ndfsfind(intf *dfile, intf *tag, intf *ref); +HDFFCLIBAPI intf ndfsfind(intf *dfile, intf *tag, intf *ref); -HDFFCLIBAPI FRETVAL(intf) ndffind(intf *dfile, intf *itag, intf *iref, intf *len); +HDFFCLIBAPI intf ndffind(intf *dfile, intf *itag, intf *iref, intf *len); -HDFFCLIBAPI FRETVAL(intf) ndferrno(void); +HDFFCLIBAPI intf ndferrno(void); -HDFFCLIBAPI FRETVAL(intf) ndfnewref(intf *dfile); +HDFFCLIBAPI intf ndfnewref(intf *dfile); -HDFFCLIBAPI FRETVAL(intf) ndfnumber(intf *dfile, intf *tag); +HDFFCLIBAPI intf ndfnumber(intf *dfile, intf *tag); -HDFFCLIBAPI FRETVAL(intf) ndfstat(intf *dfile, DFdata *dfinfo); +HDFFCLIBAPI intf ndfstat(intf *dfile, DFdata *dfinfo); -HDFFCLIBAPI FRETVAL(intf) ndfiishdf(_fcd name, intf *namelen); +HDFFCLIBAPI intf ndfiishdf(_fcd name, intf *namelen); /* ** from dfutilF.c @@ -480,9 +473,9 @@ HDFFCLIBAPI FRETVAL(intf) ndfiishdf(_fcd name, intf *namelen); #define ndfindnr H4_F77_FUNC(dfindnr, DFINDNR) #define ndffindnextref H4_F77_FUNC(dffindnextref, DFFINDNEXTREF) -HDFFCLIBAPI FRETVAL(intf) ndfindnr(intf *dfile, intf *tag, intf *lref); +HDFFCLIBAPI intf ndfindnr(intf *dfile, intf *tag, intf *lref); -HDFFCLIBAPI FRETVAL(intf) ndffindnextref(intf *dfile, intf *tag, intf *lref); +HDFFCLIBAPI intf ndffindnextref(intf *dfile, intf *tag, intf *lref); /* ** from herrF.c @@ -491,11 +484,11 @@ HDFFCLIBAPI FRETVAL(intf) ndffindnextref(intf *dfile, intf *tag, intf *lref); #define nheprntc H4_F77_FUNC(heprntc, HEPRNTC) #define nhestringc H4_F77_FUNC(hestringc, HESTRINGC) -HDFFCLIBAPI FRETVAL(void) nheprnt(intf *print_levels); +HDFFCLIBAPI void nheprnt(intf *print_levels); -HDFFCLIBAPI FRETVAL(intf) nheprntc(_fcd filename, intf *print_levels, intf *namelen); +HDFFCLIBAPI intf nheprntc(_fcd filename, intf *print_levels, intf *namelen); -HDFFCLIBAPI FRETVAL(intf) nhestringc(intf *error_code, _fcd error_message, intf *len); +HDFFCLIBAPI intf nhestringc(intf *error_code, _fcd error_message, intf *len); /* ** from hfilef.c */ @@ -518,38 +511,38 @@ HDFFCLIBAPI FRETVAL(intf) nhestringc(intf *error_code, _fcd error_message, intf #define nhiishdf H4_F77_FUNC(hiishdf, HIISHDF) #define nhconfinfc H4_F77_FUNC(hconfinfc, HCONFINFC) -HDFFCLIBAPI FRETVAL(intf) nhiopen(_fcd name, intf *acc_mode, intf *defdds, intf *namelen); +HDFFCLIBAPI intf nhiopen(_fcd name, intf *acc_mode, intf *defdds, intf *namelen); -HDFFCLIBAPI FRETVAL(intf) nhclose(intf *file_id); +HDFFCLIBAPI intf nhclose(intf *file_id); -HDFFCLIBAPI FRETVAL(intf) nhnumber(intf *file_id, intf *tag); +HDFFCLIBAPI intf nhnumber(intf *file_id, intf *tag); -HDFFCLIBAPI FRETVAL(intf) nhxisdir(_fcd dir, intf *dirlen); +HDFFCLIBAPI intf nhxisdir(_fcd dir, intf *dirlen); -HDFFCLIBAPI FRETVAL(intf) nhxiscdir(_fcd dir, intf *dirlen); +HDFFCLIBAPI intf nhxiscdir(_fcd dir, intf *dirlen); -HDFFCLIBAPI FRETVAL(intf) nhddontatexit(void); +HDFFCLIBAPI intf nhddontatexit(void); -HDFFCLIBAPI FRETVAL(intf) nhglibverc(intf *major_v, intf *minor_v, intf *release, _fcd string, intf *len); +HDFFCLIBAPI intf nhglibverc(intf *major_v, intf *minor_v, intf *release, _fcd string, intf *len); -HDFFCLIBAPI FRETVAL(intf) - nhgfilverc(intf *file_id, intf *major_v, intf *minor_v, intf *release, _fcd string, intf *len); +HDFFCLIBAPI intf nhgfilverc(intf *file_id, intf *major_v, intf *minor_v, intf *release, _fcd string, + intf *len); -HDFFCLIBAPI FRETVAL(intf) nhiishdf(_fcd name, intf *namelen); +HDFFCLIBAPI intf nhiishdf(_fcd name, intf *namelen); -HDFFCLIBAPI FRETVAL(intf) nhiclose(intf *file_id); +HDFFCLIBAPI intf nhiclose(intf *file_id); -HDFFCLIBAPI FRETVAL(intf) nhinumbr(int32 file_id, uint16 tag); +HDFFCLIBAPI intf nhinumbr(int32 file_id, uint16 tag); -HDFFCLIBAPI FRETVAL(intf) nhconfinfc(intf *coder_type, intf *info); +HDFFCLIBAPI intf nhconfinfc(intf *coder_type, intf *info); /* ** from dfufp2im.c */ #define nduif2i H4_F77_FUNC(duif2i, DUIF2I) -HDFFCLIBAPI FRETVAL(int) nduif2i(int32 *hdim, int32 *vdim, float32 *max, float32 *min, float32 hscale[], - float32 vscale[], float32 data[], _fcd palette, _fcd outfile, int *ct_method, - int32 *hres, int32 *vres, int *compress, int *lenfn); +HDFFCLIBAPI int nduif2i(int32 *hdim, int32 *vdim, float32 *max, float32 *min, float32 hscale[], + float32 vscale[], float32 data[], _fcd palette, _fcd outfile, int *ct_method, + int32 *hres, int32 *vres, int *compress, int *lenfn); HDFFCLIBAPI int DFUfptoimage(int32 hdim, int32 vdim, float32 max, float32 min, float32 *hscale, float32 *vscale, float32 *data, uint8 *palette, char *outfile, int ct_method, @@ -585,78 +578,77 @@ HDFFCLIBAPI int DFUfptoimage(int32 hdim, int32 vdim, float32 max, float32 min, f /* Multi-file Annotation C-stubs for Fortran interface found in mfanf.c */ -HDFFCLIBAPI FRETVAL(intf) nafstart(intf *file_id); +HDFFCLIBAPI intf nafstart(intf *file_id); -HDFFCLIBAPI FRETVAL(intf) - naffileinfo(intf *an_id, intf *num_flabel, intf *num_fdesc, intf *num_olabel, intf *num_odesc); +HDFFCLIBAPI intf naffileinfo(intf *an_id, intf *num_flabel, intf *num_fdesc, intf *num_olabel, + intf *num_odesc); -HDFFCLIBAPI FRETVAL(intf) nafend(intf *an_id); +HDFFCLIBAPI intf nafend(intf *an_id); -HDFFCLIBAPI FRETVAL(intf) nafcreate(intf *an_id, intf *etag, intf *eref, intf *atype); +HDFFCLIBAPI intf nafcreate(intf *an_id, intf *etag, intf *eref, intf *atype); -HDFFCLIBAPI FRETVAL(intf) naffcreate(intf *an_id, intf *atype); +HDFFCLIBAPI intf naffcreate(intf *an_id, intf *atype); -HDFFCLIBAPI FRETVAL(intf) nafselect(intf *an_id, intf *idx, intf *atype); +HDFFCLIBAPI intf nafselect(intf *an_id, intf *idx, intf *atype); -HDFFCLIBAPI FRETVAL(intf) nafnumann(intf *an_id, intf *atype, intf *etag, intf *eref); +HDFFCLIBAPI intf nafnumann(intf *an_id, intf *atype, intf *etag, intf *eref); -HDFFCLIBAPI FRETVAL(intf) nafannlist(intf *an_id, intf *atype, intf *etag, intf *eref, intf alist[]); +HDFFCLIBAPI intf nafannlist(intf *an_id, intf *atype, intf *etag, intf *eref, intf alist[]); -HDFFCLIBAPI FRETVAL(intf) nafannlen(intf *ann_id); +HDFFCLIBAPI intf nafannlen(intf *ann_id); -HDFFCLIBAPI FRETVAL(intf) nafwriteann(intf *ann_id, _fcd ann, intf *annlen); +HDFFCLIBAPI intf nafwriteann(intf *ann_id, _fcd ann, intf *annlen); -HDFFCLIBAPI FRETVAL(intf) nafreadann(intf *ann_id, _fcd ann, intf *maxlen); +HDFFCLIBAPI intf nafreadann(intf *ann_id, _fcd ann, intf *maxlen); -HDFFCLIBAPI FRETVAL(intf) nafendaccess(intf *ann_id); +HDFFCLIBAPI intf nafendaccess(intf *ann_id); -HDFFCLIBAPI FRETVAL(intf) nafgettagref(intf *an_id, intf *idx, intf *type, intf *tag, intf *ref); +HDFFCLIBAPI intf nafgettagref(intf *an_id, intf *idx, intf *type, intf *tag, intf *ref); -HDFFCLIBAPI FRETVAL(intf) nafidtagref(intf *ann_id, intf *tag, intf *ref); +HDFFCLIBAPI intf nafidtagref(intf *ann_id, intf *tag, intf *ref); -HDFFCLIBAPI FRETVAL(intf) naftagrefid(intf *an_id, intf *tag, intf *ref); +HDFFCLIBAPI intf naftagrefid(intf *an_id, intf *tag, intf *ref); -HDFFCLIBAPI FRETVAL(intf) nafatypetag(intf *atype); +HDFFCLIBAPI intf nafatypetag(intf *atype); -HDFFCLIBAPI FRETVAL(intf) naftagatype(intf *tag); +HDFFCLIBAPI intf naftagatype(intf *tag); /* if defined Windows */ /* Multi-file Annotation C-stubs for Fortran interface found in mfanf.c */ -HDFFCLIBAPI FRETVAL(intf) nafistart(intf *file_id); +HDFFCLIBAPI intf nafistart(intf *file_id); -HDFFCLIBAPI FRETVAL(intf) - nafifinf(intf *an_id, intf *num_flabel, intf *num_fdesc, intf *num_olabel, intf *num_odesc); +HDFFCLIBAPI intf nafifinf(intf *an_id, intf *num_flabel, intf *num_fdesc, intf *num_olabel, intf *num_odesc); -HDFFCLIBAPI FRETVAL(intf) nafiend(intf *an_id); +HDFFCLIBAPI intf nafiend(intf *an_id); -HDFFCLIBAPI FRETVAL(intf) naficreat(intf *an_id, intf *etag, intf *eref, intf *atype); +HDFFCLIBAPI intf naficreat(intf *an_id, intf *etag, intf *eref, intf *atype); -HDFFCLIBAPI FRETVAL(intf) nafifcreat(intf *an_id, intf *atype); +HDFFCLIBAPI intf nafifcreat(intf *an_id, intf *atype); -HDFFCLIBAPI FRETVAL(intf) nafiselct(intf *an_id, intf *index, intf *atype); +HDFFCLIBAPI intf nafiselct(intf *an_id, intf *index, intf *atype); -HDFFCLIBAPI FRETVAL(intf) nafinann(intf *an_id, intf *atype, intf *etag, intf *eref); +HDFFCLIBAPI intf nafinann(intf *an_id, intf *atype, intf *etag, intf *eref); -HDFFCLIBAPI FRETVAL(intf) nafialst(intf *an_id, intf *atype, intf *etag, intf *eref, intf alist[]); +HDFFCLIBAPI intf nafialst(intf *an_id, intf *atype, intf *etag, intf *eref, intf alist[]); -HDFFCLIBAPI FRETVAL(intf) nafialen(intf *ann_id); +HDFFCLIBAPI intf nafialen(intf *ann_id); -HDFFCLIBAPI FRETVAL(intf) nafiwann(intf *ann_id, _fcd ann, intf *annlen); +HDFFCLIBAPI intf nafiwann(intf *ann_id, _fcd ann, intf *annlen); -HDFFCLIBAPI FRETVAL(intf) nafirann(intf *ann_id, _fcd ann, intf *maxlen); +HDFFCLIBAPI intf nafirann(intf *ann_id, _fcd ann, intf *maxlen); -HDFFCLIBAPI FRETVAL(intf) nafiendac(intf *ann_id); +HDFFCLIBAPI intf nafiendac(intf *ann_id); -HDFFCLIBAPI FRETVAL(intf) nafigtr(intf *an_id, intf *index, intf *type, intf *tag, intf *ref); +HDFFCLIBAPI intf nafigtr(intf *an_id, intf *index, intf *type, intf *tag, intf *ref); -HDFFCLIBAPI FRETVAL(intf) nafiid2tr(intf *ann_id, intf *tag, intf *ref); +HDFFCLIBAPI intf nafiid2tr(intf *ann_id, intf *tag, intf *ref); -HDFFCLIBAPI FRETVAL(intf) nafitr2id(intf *an_id, intf *tag, intf *ref); +HDFFCLIBAPI intf nafitr2id(intf *an_id, intf *tag, intf *ref); -HDFFCLIBAPI FRETVAL(intf) nafitp2tg(intf *atype); +HDFFCLIBAPI intf nafitp2tg(intf *atype); -HDFFCLIBAPI FRETVAL(intf) nafitg2tp(intf *tag); +HDFFCLIBAPI intf nafitg2tp(intf *tag); /* endif defined Windows */ @@ -752,99 +744,99 @@ HDFLIBAPI intn ANdestroy(void); */ /* Multi-file GR C-stubs for FORTRAN interface found in mfgrf.c */ -HDFFCLIBAPI FRETVAL(intf) /* !sl */ - nmgiwimg(intf *riid, intf *start, intf *stride, intf *count, void *data); +HDFFCLIBAPI intf /* !sl */ +nmgiwimg(intf *riid, intf *start, intf *stride, intf *count, void *data); -HDFFCLIBAPI FRETVAL(intf) /* !sl */ - nmgirimg(intf *riid, intf *start, intf *stride, intf *count, void *data); +HDFFCLIBAPI intf /* !sl */ +nmgirimg(intf *riid, intf *start, intf *stride, intf *count, void *data); -HDFFCLIBAPI FRETVAL(intf) /* !sl */ - nmgignat(intf *riid, intf *idx, void *data); +HDFFCLIBAPI intf /* !sl */ +nmgignat(intf *riid, intf *idx, void *data); -HDFFCLIBAPI FRETVAL(intf) nmgstart(intf *fid); +HDFFCLIBAPI intf nmgstart(intf *fid); -HDFFCLIBAPI FRETVAL(intf) nmgfinfo(intf *grid, intf *n_datasets, intf *n_attrs); +HDFFCLIBAPI intf nmgfinfo(intf *grid, intf *n_datasets, intf *n_attrs); -HDFFCLIBAPI FRETVAL(intf) nmgend(intf *grid); +HDFFCLIBAPI intf nmgend(intf *grid); -HDFFCLIBAPI FRETVAL(intf) - nmgicreat(intf *grid, _fcd name, intf *ncomp, intf *nt, intf *il, intf dimsizes[2], intf *nlen); +HDFFCLIBAPI intf nmgicreat(intf *grid, _fcd name, intf *ncomp, intf *nt, intf *il, intf dimsizes[2], + intf *nlen); -HDFFCLIBAPI FRETVAL(intf) nmgselct(intf *grid, intf *idx); +HDFFCLIBAPI intf nmgselct(intf *grid, intf *idx); -HDFFCLIBAPI FRETVAL(intf) nmgin2ndx(intf *grid, _fcd name, intf *nlen); +HDFFCLIBAPI intf nmgin2ndx(intf *grid, _fcd name, intf *nlen); -HDFFCLIBAPI FRETVAL(intf) - nmggiinf(intf *riid, _fcd name, intf *ncomp, intf *nt, intf *il, intf *dimsizes, intf *nattr); +HDFFCLIBAPI intf nmggiinf(intf *riid, _fcd name, intf *ncomp, intf *nt, intf *il, intf *dimsizes, + intf *nattr); -HDFFCLIBAPI FRETVAL(intf) nmgwcimg(intf *riid, intf *start, intf *stride, intf *count, _fcd data); +HDFFCLIBAPI intf nmgwcimg(intf *riid, intf *start, intf *stride, intf *count, _fcd data); -HDFFCLIBAPI FRETVAL(intf) nmgrcimg(intf *riid, intf *start, intf *stride, intf *count, _fcd data); +HDFFCLIBAPI intf nmgrcimg(intf *riid, intf *start, intf *stride, intf *count, _fcd data); -HDFFCLIBAPI FRETVAL(intf) nmgwrimg(intf *riid, intf *start, intf *stride, intf *count, void *data); +HDFFCLIBAPI intf nmgwrimg(intf *riid, intf *start, intf *stride, intf *count, void *data); -HDFFCLIBAPI FRETVAL(intf) nmgrdimg(intf *riid, intf *start, intf *stride, intf *count, void *data); +HDFFCLIBAPI intf nmgrdimg(intf *riid, intf *start, intf *stride, intf *count, void *data); -HDFFCLIBAPI FRETVAL(intf) nmgendac(intf *riid); +HDFFCLIBAPI intf nmgendac(intf *riid); -HDFFCLIBAPI FRETVAL(intf) nmgid2rf(intf *riid); +HDFFCLIBAPI intf nmgid2rf(intf *riid); -HDFFCLIBAPI FRETVAL(intf) nmgr2idx(intf *grid, intf *ref); +HDFFCLIBAPI intf nmgr2idx(intf *grid, intf *ref); -HDFFCLIBAPI FRETVAL(intf) nmgrltil(intf *riid, intf *il); +HDFFCLIBAPI intf nmgrltil(intf *riid, intf *il); -HDFFCLIBAPI FRETVAL(intf) nmgrimil(intf *riid, intf *il); +HDFFCLIBAPI intf nmgrimil(intf *riid, intf *il); -HDFFCLIBAPI FRETVAL(intf) nmggltid(intf *riid, intf *lut_index); +HDFFCLIBAPI intf nmggltid(intf *riid, intf *lut_index); -HDFFCLIBAPI FRETVAL(intf) nmgglinf(intf *lutid, intf *ncomp, intf *nt, intf *il, intf *nentries); +HDFFCLIBAPI intf nmgglinf(intf *lutid, intf *ncomp, intf *nt, intf *il, intf *nentries); -HDFFCLIBAPI FRETVAL(intf) nmgwrlut(intf *lutid, intf *ncomp, intf *nt, intf *il, intf *nentries, void *data); +HDFFCLIBAPI intf nmgwrlut(intf *lutid, intf *ncomp, intf *nt, intf *il, intf *nentries, void *data); -HDFFCLIBAPI FRETVAL(intf) nmgwclut(intf *lutid, intf *ncomp, intf *nt, intf *il, intf *nentries, _fcd data); +HDFFCLIBAPI intf nmgwclut(intf *lutid, intf *ncomp, intf *nt, intf *il, intf *nentries, _fcd data); -HDFFCLIBAPI FRETVAL(intf) nmgrdlut(intf *lutid, void *data); +HDFFCLIBAPI intf nmgrdlut(intf *lutid, void *data); -HDFFCLIBAPI FRETVAL(intf) nmgrclut(intf *lutid, _fcd data); +HDFFCLIBAPI intf nmgrclut(intf *lutid, _fcd data); -HDFFCLIBAPI FRETVAL(intf) nmgisxfil(intf *riid, _fcd filename, intf *offset, intf *nlen); +HDFFCLIBAPI intf nmgisxfil(intf *riid, _fcd filename, intf *offset, intf *nlen); -HDFFCLIBAPI FRETVAL(intf) nmgsactp(intf *riid, intf *accesstype); +HDFFCLIBAPI intf nmgsactp(intf *riid, intf *accesstype); -HDFFCLIBAPI FRETVAL(intf) nmgiscatt(intf *riid, _fcd name, intf *nt, intf *count, _fcd data, intf *nlen); +HDFFCLIBAPI intf nmgiscatt(intf *riid, _fcd name, intf *nt, intf *count, _fcd data, intf *nlen); -HDFFCLIBAPI FRETVAL(intf) nmgisattr(intf *riid, _fcd name, intf *nt, intf *count, void *data, intf *nlen); +HDFFCLIBAPI intf nmgisattr(intf *riid, _fcd name, intf *nt, intf *count, void *data, intf *nlen); -HDFFCLIBAPI FRETVAL(intf) nmgatinf(intf *riid, intf *idx, _fcd name, intf *nt, intf *count); +HDFFCLIBAPI intf nmgatinf(intf *riid, intf *idx, _fcd name, intf *nt, intf *count); -HDFFCLIBAPI FRETVAL(intf) nmggcatt(intf *riid, intf *idx, _fcd data); +HDFFCLIBAPI intf nmggcatt(intf *riid, intf *idx, _fcd data); -HDFFCLIBAPI FRETVAL(intf) nmggnatt(intf *riid, intf *idx, void *data); +HDFFCLIBAPI intf nmggnatt(intf *riid, intf *idx, void *data); -HDFFCLIBAPI FRETVAL(intf) nmggattr(intf *riid, intf *idx, void *data); +HDFFCLIBAPI intf nmggattr(intf *riid, intf *idx, void *data); -HDFFCLIBAPI FRETVAL(intf) nmgifndat(intf *riid, _fcd name, intf *nlen); +HDFFCLIBAPI intf nmgifndat(intf *riid, _fcd name, intf *nlen); -HDFFCLIBAPI FRETVAL(intf) nmgcgichnk(intf *id, intf *dim_length, intf *flags); +HDFFCLIBAPI intf nmgcgichnk(intf *id, intf *dim_length, intf *flags); -HDFFCLIBAPI FRETVAL(intf) nmgcrcchnk(intf *id, intf *start, _fcd char_data); +HDFFCLIBAPI intf nmgcrcchnk(intf *id, intf *start, _fcd char_data); -HDFFCLIBAPI FRETVAL(intf) nmgcrchnk(intf *id, intf *start, void *num_data); +HDFFCLIBAPI intf nmgcrchnk(intf *id, intf *start, void *num_data); -HDFFCLIBAPI FRETVAL(intf) nmgcscchnk(intf *id, intf *maxcache, intf *flags); +HDFFCLIBAPI intf nmgcscchnk(intf *id, intf *maxcache, intf *flags); -HDFFCLIBAPI FRETVAL(intf) nmgcschnk(intf *id, intf *dim_length, intf *comp_type, intf *comp_prm); -HDFFCLIBAPI FRETVAL(intf) nmgcwcchnk(intf *id, intf *start, _fcd char_data); +HDFFCLIBAPI intf nmgcschnk(intf *id, intf *dim_length, intf *comp_type, intf *comp_prm); +HDFFCLIBAPI intf nmgcwcchnk(intf *id, intf *start, _fcd char_data); -HDFFCLIBAPI FRETVAL(intf) nmgcwchnk(intf *id, intf *start, void *num_data); +HDFFCLIBAPI intf nmgcwchnk(intf *id, intf *start, void *num_data); -HDFFCLIBAPI FRETVAL(intf) nmgcscompress(intf *id, intf *comp_type, intf *comp_prm); +HDFFCLIBAPI intf nmgcscompress(intf *id, intf *comp_type, intf *comp_prm); -HDFFCLIBAPI FRETVAL(intf) nmgcgcompress(intf *id, intf *comp_type, intf *comp_prm); +HDFFCLIBAPI intf nmgcgcompress(intf *id, intf *comp_type, intf *comp_prm); -HDFFCLIBAPI FRETVAL(intf) nmglt2rf(intf *id); +HDFFCLIBAPI intf nmglt2rf(intf *id); -HDFFCLIBAPI FRETVAL(intf) nmgcgnluts(intf *id); +HDFFCLIBAPI intf nmgcgnluts(intf *id); /* ** from vgF.c @@ -944,229 +936,227 @@ HDFFCLIBAPI FRETVAL(intf) nmgcgnluts(intf *id); #define nvcgvgrp H4_F77_FUNC(vcgvgrp, VCGVGRP) #define nvscgvdatas H4_F77_FUNC(vscgvdatas, VSCGVDATAS) -HDFFCLIBAPI FRETVAL(intf) ndfivopn(_fcd filename, intf *acc_mode, intf *defdds, intf *namelen); +HDFFCLIBAPI intf ndfivopn(_fcd filename, intf *acc_mode, intf *defdds, intf *namelen); -HDFFCLIBAPI FRETVAL(intf) ndfvclos(intf *file_id); +HDFFCLIBAPI intf ndfvclos(intf *file_id); -HDFFCLIBAPI FRETVAL(intf) nvatchc(intf *f, intf *vgid, _fcd accesstype); +HDFFCLIBAPI intf nvatchc(intf *f, intf *vgid, _fcd accesstype); -HDFFCLIBAPI FRETVAL(intf) nvdtchc(intf *vkey); +HDFFCLIBAPI intf nvdtchc(intf *vkey); -HDFFCLIBAPI FRETVAL(intf) nvgnamc(intf *vkey, _fcd vgname); +HDFFCLIBAPI intf nvgnamc(intf *vkey, _fcd vgname); -HDFFCLIBAPI FRETVAL(intf) nvgclsc(intf *vkey, _fcd vgclass); +HDFFCLIBAPI intf nvgclsc(intf *vkey, _fcd vgclass); -HDFFCLIBAPI FRETVAL(intf) nvinqc(intf *vkey, intf *nentries, _fcd vgname); +HDFFCLIBAPI intf nvinqc(intf *vkey, intf *nentries, _fcd vgname); -HDFFCLIBAPI FRETVAL(intf) nvdeletec(intf *f, intf *vkey); +HDFFCLIBAPI intf nvdeletec(intf *f, intf *vkey); -HDFFCLIBAPI FRETVAL(intf) nvgidc(intf *f, intf *vgid); +HDFFCLIBAPI intf nvgidc(intf *f, intf *vgid); -HDFFCLIBAPI FRETVAL(intf) nvgnxtc(intf *vkey, intf *id); +HDFFCLIBAPI intf nvgnxtc(intf *vkey, intf *id); -HDFFCLIBAPI FRETVAL(intf) nvsnamc(intf *vkey, _fcd vgname, intf *vgnamelen); +HDFFCLIBAPI intf nvsnamc(intf *vkey, _fcd vgname, intf *vgnamelen); -HDFFCLIBAPI FRETVAL(intf) nvsclsc(intf *vkey, _fcd vgclass, intf *vgclasslen); +HDFFCLIBAPI intf nvsclsc(intf *vkey, _fcd vgclass, intf *vgclasslen); -HDFFCLIBAPI FRETVAL(intf) nvinsrtc(intf *vkey, intf *vobjptr); +HDFFCLIBAPI intf nvinsrtc(intf *vkey, intf *vobjptr); -HDFFCLIBAPI FRETVAL(intf) nvisvgc(intf *vkey, intf *id); +HDFFCLIBAPI intf nvisvgc(intf *vkey, intf *id); -HDFFCLIBAPI FRETVAL(intf) nvfstart(intf *f); +HDFFCLIBAPI intf nvfstart(intf *f); -HDFFCLIBAPI FRETVAL(intf) nvfend(intf *f); +HDFFCLIBAPI intf nvfend(intf *f); -HDFFCLIBAPI FRETVAL(intf) nvisvsc(intf *vkey, intf *id); +HDFFCLIBAPI intf nvisvsc(intf *vkey, intf *id); -HDFFCLIBAPI FRETVAL(intf) nvsatchc(intf *f, intf *vsref, _fcd accesstype); +HDFFCLIBAPI intf nvsatchc(intf *f, intf *vsref, _fcd accesstype); -HDFFCLIBAPI FRETVAL(intf) nvsdtchc(intf *vkey); +HDFFCLIBAPI intf nvsdtchc(intf *vkey); -HDFFCLIBAPI FRETVAL(intf) nvsqref(intf *vkey); +HDFFCLIBAPI intf nvsqref(intf *vkey); -HDFFCLIBAPI FRETVAL(intf) nvsqtag(intf *vkey); +HDFFCLIBAPI intf nvsqtag(intf *vkey); -HDFFCLIBAPI FRETVAL(intf) nvsgver(intf *vkey); +HDFFCLIBAPI intf nvsgver(intf *vkey); -HDFFCLIBAPI FRETVAL(intf) nvsseekc(intf *vkey, intf *eltpos); +HDFFCLIBAPI intf nvsseekc(intf *vkey, intf *eltpos); -HDFFCLIBAPI FRETVAL(intf) nvsgnamc(intf *vkey, _fcd vsname, intf *vsnamelen); +HDFFCLIBAPI intf nvsgnamc(intf *vkey, _fcd vsname, intf *vsnamelen); -HDFFCLIBAPI FRETVAL(intf) nvsgclsc(intf *vkey, _fcd vsclass, intf *vsclasslen); +HDFFCLIBAPI intf nvsgclsc(intf *vkey, _fcd vsclass, intf *vsclasslen); -HDFFCLIBAPI FRETVAL(intf) nvsinqc(intf *vkey, intf *nelt, intf *interlace, _fcd fields, intf *eltsize, - _fcd vsname, intf *fieldslen, intf *vsnamelen); +HDFFCLIBAPI intf nvsinqc(intf *vkey, intf *nelt, intf *interlace, _fcd fields, intf *eltsize, _fcd vsname, + intf *fieldslen, intf *vsnamelen); -HDFFCLIBAPI FRETVAL(intf) nvsfexc(intf *vkey, _fcd fields, intf *fieldslen); +HDFFCLIBAPI intf nvsfexc(intf *vkey, _fcd fields, intf *fieldslen); -HDFFCLIBAPI FRETVAL(intf) nvsfndc(intf *f, _fcd name, intf *namelen); +HDFFCLIBAPI intf nvsfndc(intf *f, _fcd name, intf *namelen); -HDFFCLIBAPI FRETVAL(intf) nvsgidc(intf *f, intf *vsref); +HDFFCLIBAPI intf nvsgidc(intf *f, intf *vsref); -HDFFCLIBAPI FRETVAL(intf) nvsdltc(intf *f, intf *vsref); +HDFFCLIBAPI intf nvsdltc(intf *f, intf *vsref); -HDFFCLIBAPI FRETVAL(intf) nvsapp(intf *vkey, intf *blk); +HDFFCLIBAPI intf nvsapp(intf *vkey, intf *blk); -HDFFCLIBAPI FRETVAL(intf) nvssnamc(intf *vkey, _fcd vsname, intf *vsnamelen); +HDFFCLIBAPI intf nvssnamc(intf *vkey, _fcd vsname, intf *vsnamelen); -HDFFCLIBAPI FRETVAL(intf) nvssclsc(intf *vkey, _fcd vsclass, intf *vsclasslen); +HDFFCLIBAPI intf nvssclsc(intf *vkey, _fcd vsclass, intf *vsclasslen); -HDFFCLIBAPI FRETVAL(intf) nvssfldc(intf *vkey, _fcd fields, intf *fieldslen); +HDFFCLIBAPI intf nvssfldc(intf *vkey, _fcd fields, intf *fieldslen); -HDFFCLIBAPI FRETVAL(intf) nvssintc(intf *vkey, intf *interlace); +HDFFCLIBAPI intf nvssintc(intf *vkey, intf *interlace); -HDFFCLIBAPI FRETVAL(intf) nvsfdefc(intf *vkey, _fcd field, intf *localtype, intf *order, intf *fieldlen); +HDFFCLIBAPI intf nvsfdefc(intf *vkey, _fcd field, intf *localtype, intf *order, intf *fieldlen); -HDFFCLIBAPI FRETVAL(intf) nvssextfc(intf *vkey, _fcd fname, intf *offset, intf *fnamelen); +HDFFCLIBAPI intf nvssextfc(intf *vkey, _fcd fname, intf *offset, intf *fnamelen); -HDFFCLIBAPI FRETVAL(intf) nvfnflds(intf *vkey); +HDFFCLIBAPI intf nvfnflds(intf *vkey); -HDFFCLIBAPI FRETVAL(intf) nvffnamec(intf *vkey, intf *idx, _fcd fname, intf *len); +HDFFCLIBAPI intf nvffnamec(intf *vkey, intf *idx, _fcd fname, intf *len); -HDFFCLIBAPI FRETVAL(intf) nvfftype(intf *vkey, intf *idx); +HDFFCLIBAPI intf nvfftype(intf *vkey, intf *idx); -HDFFCLIBAPI FRETVAL(intf) nvffisiz(intf *vkey, intf *idx); +HDFFCLIBAPI intf nvffisiz(intf *vkey, intf *idx); -HDFFCLIBAPI FRETVAL(intf) nvffesiz(intf *vkey, intf *idx); +HDFFCLIBAPI intf nvffesiz(intf *vkey, intf *idx); -HDFFCLIBAPI FRETVAL(intf) nvffordr(intf *vkey, intf *idx); +HDFFCLIBAPI intf nvffordr(intf *vkey, intf *idx); -HDFFCLIBAPI FRETVAL(intf) nvsfrdc(intf *vkey, _fcd cbuf, intf *nelt, intf *interlace); +HDFFCLIBAPI intf nvsfrdc(intf *vkey, _fcd cbuf, intf *nelt, intf *interlace); -HDFFCLIBAPI FRETVAL(intf) nvsfrd(intf *vkey, intf *buf, intf *nelt, intf *interlace); +HDFFCLIBAPI intf nvsfrd(intf *vkey, intf *buf, intf *nelt, intf *interlace); -HDFFCLIBAPI FRETVAL(intf) nvsreadc(intf *vkey, uint8 *buf, intf *nelt, intf *interlace); +HDFFCLIBAPI intf nvsreadc(intf *vkey, uint8 *buf, intf *nelt, intf *interlace); -HDFFCLIBAPI FRETVAL(intf) nvsfwrtc(intf *vkey, _fcd cbuf, intf *nelt, intf *interlace); +HDFFCLIBAPI intf nvsfwrtc(intf *vkey, _fcd cbuf, intf *nelt, intf *interlace); -HDFFCLIBAPI FRETVAL(intf) nvsfwrt(intf *vkey, intf *buf, intf *nelt, intf *interlace); +HDFFCLIBAPI intf nvsfwrt(intf *vkey, intf *buf, intf *nelt, intf *interlace); -HDFFCLIBAPI FRETVAL(intf) nvswritc(intf *vkey, uint8 *buf, intf *nelt, intf *interlace); +HDFFCLIBAPI intf nvswritc(intf *vkey, uint8 *buf, intf *nelt, intf *interlace); -HDFFCLIBAPI FRETVAL(intf) nvsgintc(intf *vkey); +HDFFCLIBAPI intf nvsgintc(intf *vkey); -HDFFCLIBAPI FRETVAL(intf) nvseltsc(intf *vkey); +HDFFCLIBAPI intf nvseltsc(intf *vkey); -HDFFCLIBAPI FRETVAL(intf) nvsgfldc(intf *vkey, _fcd fields); +HDFFCLIBAPI intf nvsgfldc(intf *vkey, _fcd fields); -HDFFCLIBAPI FRETVAL(intf) nvssizc(intf *vkey, _fcd fields, intf *fieldslen); +HDFFCLIBAPI intf nvssizc(intf *vkey, _fcd fields, intf *fieldslen); -HDFFCLIBAPI FRETVAL(intf) nventsc(intf *f, intf *vgid); +HDFFCLIBAPI intf nventsc(intf *f, intf *vgid); -HDFFCLIBAPI FRETVAL(intf) nvlonec(intf *f, intf *idarray, intf *asize); +HDFFCLIBAPI intf nvlonec(intf *f, intf *idarray, intf *asize); -HDFFCLIBAPI FRETVAL(intf) nvslonec(intf *f, intf *idarray, intf *asize); +HDFFCLIBAPI intf nvslonec(intf *f, intf *idarray, intf *asize); -HDFFCLIBAPI FRETVAL(intf) nvfindc(intf *f, _fcd name, intf *namelen); +HDFFCLIBAPI intf nvfindc(intf *f, _fcd name, intf *namelen); -HDFFCLIBAPI FRETVAL(intf) nvfndclsc(intf *f, _fcd vgclass, intf *classlen); +HDFFCLIBAPI intf nvfndclsc(intf *f, _fcd vgclass, intf *classlen); -HDFFCLIBAPI FRETVAL(intf) nvhscdc(intf *f, _fcd field, _fcd cbuf, intf *n, intf *datatype, _fcd vsname, - _fcd vsclass, intf *fieldlen, intf *vsnamelen, intf *vsclasslen); +HDFFCLIBAPI intf nvhscdc(intf *f, _fcd field, _fcd cbuf, intf *n, intf *datatype, _fcd vsname, _fcd vsclass, + intf *fieldlen, intf *vsnamelen, intf *vsclasslen); -HDFFCLIBAPI FRETVAL(intf) nvhsdc(intf *f, _fcd field, uint8 *buf, intf *n, intf *datatype, _fcd vsname, - _fcd vsclass, intf *fieldlen, intf *vsnamelen, intf *vsclasslen); +HDFFCLIBAPI intf nvhsdc(intf *f, _fcd field, uint8 *buf, intf *n, intf *datatype, _fcd vsname, _fcd vsclass, + intf *fieldlen, intf *vsnamelen, intf *vsclasslen); -HDFFCLIBAPI FRETVAL(intf) - nvhscdmc(intf *f, _fcd field, _fcd cbuf, intf *n, intf *datatype, _fcd vsname, _fcd vsclass, intf *order, - intf *fieldlen, intf *vsnamelen, intf *vsclasslen); +HDFFCLIBAPI intf nvhscdmc(intf *f, _fcd field, _fcd cbuf, intf *n, intf *datatype, _fcd vsname, _fcd vsclass, + intf *order, intf *fieldlen, intf *vsnamelen, intf *vsclasslen); -HDFFCLIBAPI FRETVAL(intf) - nvhsdmc(intf *f, _fcd field, uint8 *buf, intf *n, intf *datatype, _fcd vsname, _fcd vsclass, intf *order, - intf *fieldlen, intf *vsnamelen, intf *vsclasslen); +HDFFCLIBAPI intf nvhsdmc(intf *f, _fcd field, uint8 *buf, intf *n, intf *datatype, _fcd vsname, _fcd vsclass, + intf *order, intf *fieldlen, intf *vsnamelen, intf *vsclasslen); -HDFFCLIBAPI FRETVAL(intf) nvhmkgpc(intf *f, intf *tagarray, intf *refarray, intf *n, _fcd vgname, - _fcd vgclass, intf *vgnamelen, intf *vgclasslen); +HDFFCLIBAPI intf nvhmkgpc(intf *f, intf *tagarray, intf *refarray, intf *n, _fcd vgname, _fcd vgclass, + intf *vgnamelen, intf *vgclasslen); -HDFFCLIBAPI FRETVAL(intf) nvflocc(intf *vkey, _fcd field, intf *fieldlen); +HDFFCLIBAPI intf nvflocc(intf *vkey, _fcd field, intf *fieldlen); -HDFFCLIBAPI FRETVAL(intf) nvinqtrc(intf *vkey, intf *tag, intf *ref); +HDFFCLIBAPI intf nvinqtrc(intf *vkey, intf *tag, intf *ref); -HDFFCLIBAPI FRETVAL(intf) nvntrc(intf *vkey); +HDFFCLIBAPI intf nvntrc(intf *vkey); -HDFFCLIBAPI FRETVAL(intf) nvnrefs(intf *vkey, intf *tag); +HDFFCLIBAPI intf nvnrefs(intf *vkey, intf *tag); -HDFFCLIBAPI FRETVAL(intf) nvqref(intf *vkey); +HDFFCLIBAPI intf nvqref(intf *vkey); -HDFFCLIBAPI FRETVAL(intf) nvqtag(intf *vkey); +HDFFCLIBAPI intf nvqtag(intf *vkey); -HDFFCLIBAPI FRETVAL(intf) nvgttrsc(intf *vkey, intf *tagarray, intf *refarray, intf *n); +HDFFCLIBAPI intf nvgttrsc(intf *vkey, intf *tagarray, intf *refarray, intf *n); -HDFFCLIBAPI FRETVAL(intf) nvgttrc(intf *vkey, intf *which, intf *tag, intf *ref); +HDFFCLIBAPI intf nvgttrc(intf *vkey, intf *which, intf *tag, intf *ref); -HDFFCLIBAPI FRETVAL(intf) nvadtrc(intf *vkey, intf *tag, intf *ref); +HDFFCLIBAPI intf nvadtrc(intf *vkey, intf *tag, intf *ref); -HDFFCLIBAPI FRETVAL(intf) nvdtrc(intf *vkey, intf *tag, intf *ref); +HDFFCLIBAPI intf nvdtrc(intf *vkey, intf *tag, intf *ref); -HDFFCLIBAPI FRETVAL(intf) nvsqfnelt(intf *vkey, intf *nelt); +HDFFCLIBAPI intf nvsqfnelt(intf *vkey, intf *nelt); -HDFFCLIBAPI FRETVAL(intf) nvsqfintr(intf *vkey, intf *interlace); +HDFFCLIBAPI intf nvsqfintr(intf *vkey, intf *interlace); -HDFFCLIBAPI FRETVAL(intf) nvsqfldsc(intf *vkey, _fcd fields, intf *fieldslen); +HDFFCLIBAPI intf nvsqfldsc(intf *vkey, _fcd fields, intf *fieldslen); -HDFFCLIBAPI FRETVAL(intf) nvsqfvsiz(intf *vkey, intf *size); +HDFFCLIBAPI intf nvsqfvsiz(intf *vkey, intf *size); -HDFFCLIBAPI FRETVAL(intf) nvsqnamec(intf *vkey, _fcd name, intf *namelen); +HDFFCLIBAPI intf nvsqnamec(intf *vkey, _fcd name, intf *namelen); -HDFFCLIBAPI FRETVAL(intf) nvsfccpk(intf *vs, intf *packtype, _fcd buflds, intf *buf, intf *bufsz, intf *nrecs, - _fcd pckfld, _fcd fldbuf, intf *buflds_len, intf *fld_len); +HDFFCLIBAPI intf nvsfccpk(intf *vs, intf *packtype, _fcd buflds, intf *buf, intf *bufsz, intf *nrecs, + _fcd pckfld, _fcd fldbuf, intf *buflds_len, intf *fld_len); -HDFFCLIBAPI FRETVAL(intf) nvsfncpk(intf *vs, intf *packtype, _fcd buflds, intf *buf, intf *bufsz, intf *nrecs, - _fcd pckfld, intf *fldbuf, intf *buflds_len, intf *fld_len); +HDFFCLIBAPI intf nvsfncpk(intf *vs, intf *packtype, _fcd buflds, intf *buf, intf *bufsz, intf *nrecs, + _fcd pckfld, intf *fldbuf, intf *buflds_len, intf *fld_len); -HDFFCLIBAPI FRETVAL(intf) nvscsetblsz(intf *id, intf *block_size); +HDFFCLIBAPI intf nvscsetblsz(intf *id, intf *block_size); -HDFFCLIBAPI FRETVAL(intf) nvscsetnmbl(intf *id, intf *num_blocks); +HDFFCLIBAPI intf nvscsetnmbl(intf *id, intf *num_blocks); -HDFFCLIBAPI FRETVAL(intf) nvscgblinfo(intf *id, intf *block_size, intf *num_blocks); +HDFFCLIBAPI intf nvscgblinfo(intf *id, intf *block_size, intf *num_blocks); -HDFFCLIBAPI FRETVAL(intf) nvcgvgrp(intf *id, intf *start_vg, intf *vg_count, intf *refarray); +HDFFCLIBAPI intf nvcgvgrp(intf *id, intf *start_vg, intf *vg_count, intf *refarray); -HDFFCLIBAPI FRETVAL(intf) nvscgvdatas(intf *id, intf *start_vd, intf *vd_count, intf *refarray); +HDFFCLIBAPI intf nvscgvdatas(intf *id, intf *start_vd, intf *vd_count, intf *refarray); -HDFFCLIBAPI FRETVAL(intf) nvscfcls(intf *id, _fcd name, intf *namelen); +HDFFCLIBAPI intf nvscfcls(intf *id, _fcd name, intf *namelen); -HDFFCLIBAPI FRETVAL(intf) nvfistart(intf *f); +HDFFCLIBAPI intf nvfistart(intf *f); -HDFFCLIBAPI FRETVAL(intf) nvfiend(intf *f); +HDFFCLIBAPI intf nvfiend(intf *f); -HDFFCLIBAPI FRETVAL(intf) nvsiqref(intf *vkey); +HDFFCLIBAPI intf nvsiqref(intf *vkey); -HDFFCLIBAPI FRETVAL(intf) nvsiqtag(intf *vkey); +HDFFCLIBAPI intf nvsiqtag(intf *vkey); -HDFFCLIBAPI FRETVAL(intf) nvsigver(intf *vkey); +HDFFCLIBAPI intf nvsigver(intf *vkey); -HDFFCLIBAPI FRETVAL(intf) nvfinflds(intf *vkey); +HDFFCLIBAPI intf nvfinflds(intf *vkey); -HDFFCLIBAPI FRETVAL(intf) nvfifnm(intf *vkey, intf *index, _fcd fname); +HDFFCLIBAPI intf nvfifnm(intf *vkey, intf *index, _fcd fname); -HDFFCLIBAPI FRETVAL(intf) nvfiftp(intf *vkey, intf *index); +HDFFCLIBAPI intf nvfiftp(intf *vkey, intf *index); -HDFFCLIBAPI FRETVAL(intf) nvfifisz(intf *vkey, intf *index); -HDFFCLIBAPI FRETVAL(intf) nvfifesz(intf *vkey, intf *index); -HDFFCLIBAPI FRETVAL(intf) nvfifodr(intf *vkey, intf *index); +HDFFCLIBAPI intf nvfifisz(intf *vkey, intf *index); +HDFFCLIBAPI intf nvfifesz(intf *vkey, intf *index); +HDFFCLIBAPI intf nvfifodr(intf *vkey, intf *index); -HDFFCLIBAPI FRETVAL(intf) nvsfirdc(intf *vkey, _fcd cbuf, intf *nelt, intf *interlace); +HDFFCLIBAPI intf nvsfirdc(intf *vkey, _fcd cbuf, intf *nelt, intf *interlace); -HDFFCLIBAPI FRETVAL(intf) nvsfird(intf *vkey, intf *buf, intf *nelt, intf *interlace); +HDFFCLIBAPI intf nvsfird(intf *vkey, intf *buf, intf *nelt, intf *interlace); -HDFFCLIBAPI FRETVAL(intf) nvsfiwrc(intf *vkey, _fcd cbuf, intf *nelt, intf *interlace); +HDFFCLIBAPI intf nvsfiwrc(intf *vkey, _fcd cbuf, intf *nelt, intf *interlace); -HDFFCLIBAPI FRETVAL(intf) nvsfiwr(intf *vkey, intf *buf, intf *nelt, intf *interlace); +HDFFCLIBAPI intf nvsfiwr(intf *vkey, intf *buf, intf *nelt, intf *interlace); -HDFFCLIBAPI FRETVAL(intf) nvfirefs(intf *vkey, intf *tag); +HDFFCLIBAPI intf nvfirefs(intf *vkey, intf *tag); -HDFFCLIBAPI FRETVAL(intf) nvfiqref(intf *vkey); +HDFFCLIBAPI intf nvfiqref(intf *vkey); -HDFFCLIBAPI FRETVAL(intf) nvfiqtag(intf *vkey); +HDFFCLIBAPI intf nvfiqtag(intf *vkey); -HDFFCLIBAPI FRETVAL(intf) nvsiqnelt(intf *vkey, intf *nelt); +HDFFCLIBAPI intf nvsiqnelt(intf *vkey, intf *nelt); -HDFFCLIBAPI FRETVAL(intf) nvsiqintr(intf *vkey, intf *interlace); +HDFFCLIBAPI intf nvsiqintr(intf *vkey, intf *interlace); -HDFFCLIBAPI FRETVAL(intf) nvsqfldsc(intf *vkey, _fcd fields, intf *fieldslen); +HDFFCLIBAPI intf nvsqfldsc(intf *vkey, _fcd fields, intf *fieldslen); -HDFFCLIBAPI FRETVAL(intf) nvsiqvsz(intf *vkey, intf *ret_size); +HDFFCLIBAPI intf nvsiqvsz(intf *vkey, intf *ret_size); /* ** from vattrf.c @@ -1198,58 +1188,54 @@ HDFFCLIBAPI FRETVAL(intf) nvsiqvsz(intf *vkey, intf *ret_size); #define nvfgcatt H4_F77_FUNC(vfgcatt, VFGCATT) #define nvfgver H4_F77_FUNC(vfgver, VFGVER) -HDFFCLIBAPI FRETVAL(intf) nvsfcfdx(intf *vsid, _fcd fldnm, intf *findex, intf *fldnmlen); -HDFFCLIBAPI FRETVAL(intf) - nvsfcsat(intf *vsid, intf *findex, _fcd attrnm, intf *dtype, intf *count, intf *values, intf *attrnmlen); -HDFFCLIBAPI FRETVAL(intf) - nvsfcsca(intf *vsid, intf *findex, _fcd attrnm, intf *dtype, intf *count, _fcd values, intf *attrnmlen); -HDFFCLIBAPI FRETVAL(intf) nvsfnats(intf *vsid); -HDFFCLIBAPI FRETVAL(intf) nvsffnas(intf *vsid, intf *findex); -HDFFCLIBAPI FRETVAL(intf) nvsfcfda(intf *vsid, intf *findex, _fcd attrnm, intf *attrnmlen); -HDFFCLIBAPI FRETVAL(intf) nvsfcain(intf *vsid, intf *findex, intf *aindex, _fcd attrname, intf *dtype, - intf *count, intf *size, intf *attrnamelen); -HDFFCLIBAPI FRETVAL(intf) nvsfgnat(intf *vsid, intf *findex, intf *aindex, intf *values); -HDFFCLIBAPI FRETVAL(intf) nvsfgcat(intf *vsid, intf *findex, intf *aindex, _fcd values); -HDFFCLIBAPI FRETVAL(intf) nvsfisat(intf *vsid); -HDFFCLIBAPI FRETVAL(intf) - nvfcsatt(intf *vgid, _fcd attrnm, intf *dtype, intf *count, intf *values, intf *attrnmlen); -HDFFCLIBAPI FRETVAL(intf) - nvfcscat(intf *vgid, _fcd attrnm, intf *dtype, intf *count, _fcd values, intf *attrnmlen); -HDFFCLIBAPI FRETVAL(intf) nvfnatts(intf *vgid); -HDFFCLIBAPI FRETVAL(intf) nvfcfdat(intf *vgid, _fcd attrnm, intf *attrnmlen); -HDFFCLIBAPI FRETVAL(intf) - nvfainfo(intf *vgid, intf *aindex, _fcd attrname, intf *dtype, intf *count, intf *size); -HDFFCLIBAPI FRETVAL(intf) nvfgnatt(intf *vgid, intf *aindex, intf *values); -HDFFCLIBAPI FRETVAL(intf) nvfgcatt(intf *vgid, intf *aindex, _fcd values); -HDFFCLIBAPI FRETVAL(intf) nvfgver(intf *vgid); +HDFFCLIBAPI intf nvsfcfdx(intf *vsid, _fcd fldnm, intf *findex, intf *fldnmlen); +HDFFCLIBAPI intf nvsfcsat(intf *vsid, intf *findex, _fcd attrnm, intf *dtype, intf *count, intf *values, + intf *attrnmlen); +HDFFCLIBAPI intf nvsfcsca(intf *vsid, intf *findex, _fcd attrnm, intf *dtype, intf *count, _fcd values, + intf *attrnmlen); +HDFFCLIBAPI intf nvsfnats(intf *vsid); +HDFFCLIBAPI intf nvsffnas(intf *vsid, intf *findex); +HDFFCLIBAPI intf nvsfcfda(intf *vsid, intf *findex, _fcd attrnm, intf *attrnmlen); +HDFFCLIBAPI intf nvsfcain(intf *vsid, intf *findex, intf *aindex, _fcd attrname, intf *dtype, intf *count, + intf *size, intf *attrnamelen); +HDFFCLIBAPI intf nvsfgnat(intf *vsid, intf *findex, intf *aindex, intf *values); +HDFFCLIBAPI intf nvsfgcat(intf *vsid, intf *findex, intf *aindex, _fcd values); +HDFFCLIBAPI intf nvsfisat(intf *vsid); +HDFFCLIBAPI intf nvfcsatt(intf *vgid, _fcd attrnm, intf *dtype, intf *count, intf *values, intf *attrnmlen); +HDFFCLIBAPI intf nvfcscat(intf *vgid, _fcd attrnm, intf *dtype, intf *count, _fcd values, intf *attrnmlen); +HDFFCLIBAPI intf nvfnatts(intf *vgid); +HDFFCLIBAPI intf nvfcfdat(intf *vgid, _fcd attrnm, intf *attrnmlen); +HDFFCLIBAPI intf nvfainfo(intf *vgid, intf *aindex, _fcd attrname, intf *dtype, intf *count, intf *size); +HDFFCLIBAPI intf nvfgnatt(intf *vgid, intf *aindex, intf *values); +HDFFCLIBAPI intf nvfgcatt(intf *vgid, intf *aindex, _fcd values); +HDFFCLIBAPI intf nvfgver(intf *vgid); /* Added for windows */ -HDFFCLIBAPI FRETVAL(intf) - nvsfainf(intf *vsid, intf *findex, intf *aindex, _fcd attrname, intf *dtype, intf *count, intf *size); +HDFFCLIBAPI intf nvsfainf(intf *vsid, intf *findex, intf *aindex, _fcd attrname, intf *dtype, intf *count, + intf *size); -HDFFCLIBAPI FRETVAL(intf) nvsfcnats(intf *vsid); +HDFFCLIBAPI intf nvsfcnats(intf *vsid); -HDFFCLIBAPI FRETVAL(intf) nvsfcfnas(intf *vsid, intf *findex); +HDFFCLIBAPI intf nvsfcfnas(intf *vsid, intf *findex); -HDFFCLIBAPI FRETVAL(intf) - nvsfcainf(intf *vsid, intf *findex, intf *aindex, _fcd attrname, intf *dtype, intf *count, intf *size); +HDFFCLIBAPI intf nvsfcainf(intf *vsid, intf *findex, intf *aindex, _fcd attrname, intf *dtype, intf *count, + intf *size); -HDFFCLIBAPI FRETVAL(intf) nvsfcgna(intf *vsid, intf *findex, intf *aindex, intf *values); +HDFFCLIBAPI intf nvsfcgna(intf *vsid, intf *findex, intf *aindex, intf *values); -HDFFCLIBAPI FRETVAL(intf) nvsfcgca(intf *vsid, intf *findex, intf *aindex, _fcd values); +HDFFCLIBAPI intf nvsfcgca(intf *vsid, intf *findex, intf *aindex, _fcd values); -HDFFCLIBAPI FRETVAL(intf) nvsfcisa(intf *vsid); +HDFFCLIBAPI intf nvsfcisa(intf *vsid); -HDFFCLIBAPI FRETVAL(intf) nvfcnats(intf *vgid); +HDFFCLIBAPI intf nvfcnats(intf *vgid); -HDFFCLIBAPI FRETVAL(intf) - nvfcainf(intf *vgid, intf *aindex, _fcd attrname, intf *dtype, intf *count, intf *size); +HDFFCLIBAPI intf nvfcainf(intf *vgid, intf *aindex, _fcd attrname, intf *dtype, intf *count, intf *size); -HDFFCLIBAPI FRETVAL(intf) nvfcgnat(intf *vgid, intf *aindex, intf *values); +HDFFCLIBAPI intf nvfcgnat(intf *vgid, intf *aindex, intf *values); -HDFFCLIBAPI FRETVAL(intf) nvfcgcat(intf *vgid, intf *aindex, _fcd values); +HDFFCLIBAPI intf nvfcgcat(intf *vgid, intf *aindex, _fcd values); -HDFFCLIBAPI FRETVAL(intf) nvfcgver(intf *vgid); +HDFFCLIBAPI intf nvfcgver(intf *vgid); /* End of windows */ /* @@ -1258,9 +1244,9 @@ HDFFCLIBAPI FRETVAL(intf) nvfcgver(intf *vgid); #define nduif2i H4_F77_FUNC(duif2i, DUIF2I) -HDFFCLIBAPI FRETVAL(int) nduif2i(int32 *hdim, int32 *vdim, float32 *max, float32 *min, float32 hscale[], - float32 vscale[], float32 data[], _fcd palette, _fcd outfile, int *ct_method, - int32 *hres, int32 *vres, int *compress, int *lenfn); +HDFFCLIBAPI int nduif2i(int32 *hdim, int32 *vdim, float32 *max, float32 *min, float32 hscale[], + float32 vscale[], float32 data[], _fcd palette, _fcd outfile, int *ct_method, + int32 *hres, int32 *vres, int *compress, int *lenfn); #ifdef __cplusplus } diff --git a/hdf/src/mfanf.c b/hdf/src/mfanf.c index ef29b212d8..eb01f369ea 100644 --- a/hdf/src/mfanf.c +++ b/hdf/src/mfanf.c @@ -68,7 +68,7 @@ * Users: * Invokes: ANstart() *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nafstart(intf *file_id) { intf ret; @@ -90,7 +90,7 @@ nafstart(intf *file_id) * Users: Fortran Users * Invokes: ANfileinfo() *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf naffileinfo(intf *an_id, intf *num_flabel, intf *num_fdesc, intf *num_olabel, intf *num_odesc) { intf ret; @@ -115,7 +115,7 @@ naffileinfo(intf *an_id, intf *num_flabel, intf *num_fdesc, intf *num_olabel, in * Users: Fortran Users * Invokes: ANend() *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nafend(intf *an_id) { return (intf)ANend((int32)*an_id); @@ -132,7 +132,7 @@ nafend(intf *an_id) * Users: Fortran Users * Invokes: ANcreate() *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nafcreate(intf *an_id, intf *etag, intf *eref, intf *atype) { return (intf)ANcreate((int32)*an_id, (uint16)*etag, (uint16)*eref, (ann_type)*atype); @@ -147,7 +147,7 @@ nafcreate(intf *an_id, intf *etag, intf *eref, intf *atype) * Users: Fortran Users * Invokes: ANcreatf() *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf naffcreate(intf *an_id, intf *atype) { return (intf)ANcreatef((int32)*an_id, (ann_type)*atype); @@ -168,7 +168,7 @@ naffcreate(intf *an_id, intf *atype) * Users: Fortran Users * Invokes: ANselect() *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nafselect(intf *an_id, intf *index, intf *atype) { return (intf)ANselect((int32)*an_id, (int32)*index, (ann_type)*atype); @@ -185,7 +185,7 @@ nafselect(intf *an_id, intf *index, intf *atype) * Users: Fortran Users * Invokes: ANnumann() *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nafnumann(intf *an_id, intf *atype, intf *etag, intf *eref) { return (intf)ANnumann((int32)*an_id, (ann_type)*atype, (uint16)*etag, (uint16)*eref); @@ -203,7 +203,7 @@ nafnumann(intf *an_id, intf *atype, intf *etag, intf *eref) * Users: Fortran Users * Invokes: ANnumann(), ANannlist() *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nafannlist(intf *an_id, intf *atype, intf *etag, intf *eref, intf alist[]) { intf ret; @@ -243,7 +243,7 @@ nafannlist(intf *an_id, intf *atype, intf *etag, intf *eref, intf alist[]) * Users: Fortran Users * Invokes: ANannlen() *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nafannlen(intf *an_id) { return (intf)ANannlen((int32)*an_id); @@ -259,7 +259,7 @@ nafannlen(intf *an_id) * Users: Fortran Users * Invokes: ANwriteann() *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nafwriteann(intf *ann_id, _fcd ann, intf *annlen) { char *iann = NULL; @@ -287,7 +287,7 @@ nafwriteann(intf *ann_id, _fcd ann, intf *annlen) * Users: Fortran Users * Invokes: ANreadann() *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nafreadann(intf *ann_id, _fcd ann, intf *maxlen) { char *iann = NULL; @@ -318,7 +318,7 @@ nafreadann(intf *ann_id, _fcd ann, intf *maxlen) * Users: Fortran Users * Invokes: ANendaccess() *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nafendaccess(intf *ann_id) { return (intf)ANendaccess((int32)*ann_id); @@ -332,7 +332,7 @@ nafendaccess(intf *ann_id) * Users: Fortran Users * Invokes: ANget_tagref() *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nafgettagref(intf *an_id, intf *index, intf *type, intf *tag, intf *ref) { intf ret; @@ -354,7 +354,7 @@ nafgettagref(intf *an_id, intf *index, intf *type, intf *tag, intf *ref) * Users: Fortran Users * Invokes: ANid2tagerf() *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nafidtagref(intf *ann_id, intf *tag, intf *ref) { intf ret; @@ -376,7 +376,7 @@ nafidtagref(intf *ann_id, intf *tag, intf *ref) * Users: Fortran Users * Invokes: ANtagref2id() *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf naftagrefid(intf *an_id, intf *tag, intf *ref) { return (intf)ANtagref2id((int32)*an_id, (uint16)*tag, (uint16)*ref); @@ -390,7 +390,7 @@ naftagrefid(intf *an_id, intf *tag, intf *ref) * Users: Fortran Users * Invokes: ANatype2tag() *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nafatypetag(intf *atype) { return (intf)ANatype2tag((ann_type)*atype); @@ -404,7 +404,7 @@ nafatypetag(intf *atype) * Users: Fortran Users * Invokes: ANtag2atype() *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf naftagatype(intf *tag) { return (intf)ANtag2atype((uint16)*tag); diff --git a/hdf/src/mfgrf.c b/hdf/src/mfgrf.c index 681fa9fbf6..31f126dd2f 100644 --- a/hdf/src/mfgrf.c +++ b/hdf/src/mfgrf.c @@ -71,7 +71,7 @@ * Invokes: GRstart *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgstart(intf *fid) { return (intf)GRstart((int32)*fid); @@ -88,7 +88,7 @@ nmgstart(intf *fid) * Invokes: GRfileinfo *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgfinfo(intf *grid, intf *n_datasets, intf *n_attrs) { int32 n_data, n_attr; @@ -109,7 +109,7 @@ nmgfinfo(intf *grid, intf *n_datasets, intf *n_attrs) * Invokes: GRend *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgend(intf *grid) { return (intf)GRend((int32)*grid); @@ -131,7 +131,7 @@ nmgend(intf *grid) * Invokes: GRcreate *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgicreat(intf *grid, _fcd name, intf *ncomp, intf *nt, intf *il, intf dimsizes[2], intf *nlen) { char *fn; @@ -163,7 +163,7 @@ nmgicreat(intf *grid, _fcd name, intf *ncomp, intf *nt, intf *il, intf dimsizes[ * Invokes: GRselect *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgselct(intf *grid, intf *index) { return (intf)GRselect((int32)*grid, (int32)*index); @@ -181,7 +181,7 @@ nmgselct(intf *grid, intf *index) * Invokes: GRnametoindex *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgin2ndx(intf *grid, _fcd name, intf *nlen) { char *fn; @@ -215,7 +215,7 @@ nmgin2ndx(intf *grid, _fcd name, intf *nlen) * Invokes: GRgetiminfo *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmggiinf(intf *riid, _fcd name, intf *ncomp, intf *nt, intf *il, intf *dimsizes, intf *nattr) { int32 t_ncomp, t_nt, t_il, t_dimsizes[2], t_nattr; @@ -248,7 +248,7 @@ nmggiinf(intf *riid, _fcd name, intf *ncomp, intf *nt, intf *il, intf *dimsizes, * Invokes: GRwriteimage *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgwcimg(intf *riid, intf *start, intf *stride, intf *count, _fcd data) { return nmgwrimg(riid, start, stride, count, (void *)_fcdtocp(data)); @@ -268,7 +268,7 @@ nmgwcimg(intf *riid, intf *start, intf *stride, intf *count, _fcd data) * Invokes: GRwriteimage *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgwrimg(intf *riid, intf *start, intf *stride, intf *count, void *data) { int32 t_start[2], t_stride[2], t_count[2]; @@ -298,7 +298,7 @@ nmgwrimg(intf *riid, intf *start, intf *stride, intf *count, void *data) * Invokes: GRreadimage *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgrcimg(intf *riid, intf *start, intf *stride, intf *count, _fcd data) { return nmgrdimg(riid, start, stride, count, (void *)_fcdtocp(data)); @@ -318,7 +318,7 @@ nmgrcimg(intf *riid, intf *start, intf *stride, intf *count, _fcd data) * Invokes: GRreadimage *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgrdimg(intf *riid, intf *start, intf *stride, intf *count, void *data) { int32 t_start[2], t_stride[2], t_count[2]; @@ -344,7 +344,7 @@ nmgrdimg(intf *riid, intf *start, intf *stride, intf *count, void *data) * Invokes: GRendaccess *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgendac(intf *riid) { return (intf)GRendaccess((int32)*riid); @@ -360,7 +360,7 @@ nmgendac(intf *riid) * Invokes: GRidtoref *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgid2rf(intf *riid) { return (intf)GRidtoref((int32)*riid); @@ -377,7 +377,7 @@ nmgid2rf(intf *riid) * Invokes: GRreftoindex *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgr2idx(intf *grid, intf *ref) { return (intf)GRreftoindex((int32)*grid, (uint16)*ref); @@ -394,7 +394,7 @@ nmgr2idx(intf *grid, intf *ref) * Invokes: GRreqlutil *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgrltil(intf *riid, intf *il) { return (intf)GRreqlutil((int32)*riid, (intn)*il); @@ -411,7 +411,7 @@ nmgrltil(intf *riid, intf *il) * Invokes: GRreqimageil *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgrimil(intf *riid, intf *il) { return (intf)GRreqimageil((int32)*riid, (intn)*il); @@ -428,7 +428,7 @@ nmgrimil(intf *riid, intf *il) * Invokes: GRgetlutid *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmggltid(intf *riid, intf *lut_index) { return (intf)GRgetlutid((int32)*riid, (intn)*lut_index); @@ -448,7 +448,7 @@ nmggltid(intf *riid, intf *lut_index) * Invokes: GRgetlutinfo *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgglinf(intf *lutid, intf *ncomp, intf *nt, intf *il, intf *nentries) { int32 t_ncomp, t_nt, t_il, t_nentries; @@ -477,7 +477,7 @@ nmgglinf(intf *lutid, intf *ncomp, intf *nt, intf *il, intf *nentries) * Invokes: GRwritelut *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgwclut(intf *lutid, intf *ncomp, intf *nt, intf *il, intf *nentries, _fcd data) { return (intf)GRwritelut((int32)*lutid, (int32)*ncomp, (int32)*nt, (int32)*il, (int32)*nentries, @@ -499,7 +499,7 @@ nmgwclut(intf *lutid, intf *ncomp, intf *nt, intf *il, intf *nentries, _fcd data * Invokes: GRwritelut *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgwrlut(intf *lutid, intf *ncomp, intf *nt, intf *il, intf *nentries, void *data) { return (intf)GRwritelut((int32)*lutid, (int32)*ncomp, (int32)*nt, (int32)*il, (int32)*nentries, data); @@ -516,7 +516,7 @@ nmgwrlut(intf *lutid, intf *ncomp, intf *nt, intf *il, intf *nentries, void *dat * Invokes: GRreadlut *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgrclut(intf *lutid, _fcd data) { return (intf)GRreadlut((int32)*lutid, (void *)_fcdtocp(data)); @@ -533,7 +533,7 @@ nmgrclut(intf *lutid, _fcd data) * Invokes: GRreadlut *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgrdlut(intf *lutid, void *data) { return (intf)GRreadlut((int32)*lutid, data); @@ -552,7 +552,7 @@ nmgrdlut(intf *lutid, void *data) * Invokes: GRsetexternalfile *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgisxfil(intf *riid, _fcd filename, intf *offset, intf *nlen) { char *fn; @@ -580,7 +580,7 @@ nmgisxfil(intf *riid, _fcd filename, intf *offset, intf *nlen) * Invokes: GRsetaccesstype *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgsactp(intf *riid, intf *accesstype) { return (intf)GRsetaccesstype((int32)*riid, (uintn)*accesstype); @@ -600,7 +600,7 @@ nmgsactp(intf *riid, intf *accesstype) * Users: HDF Fortran programmers * Invokes: GRsetattr *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgiscatt(intf *riid, _fcd name, intf *nt, intf *count, _fcd data, intf *nlen) { return nmgisattr(riid, name, nt, count, (void *)_fcdtocp(data), nlen); @@ -620,7 +620,7 @@ nmgiscatt(intf *riid, _fcd name, intf *nt, intf *count, _fcd data, intf *nlen) * Invokes: GRsetattr *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgisattr(intf *riid, _fcd name, intf *nt, intf *count, void *data, intf *nlen) { char *fn; @@ -651,7 +651,7 @@ nmgisattr(intf *riid, _fcd name, intf *nt, intf *count, void *data, intf *nlen) * Invokes: GRattrinfo *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgatinf(intf *riid, intf *index, _fcd name, intf *nt, intf *count) { int32 t_nt, t_count; @@ -676,7 +676,7 @@ nmgatinf(intf *riid, intf *index, _fcd name, intf *nt, intf *count) * Invokes: GRgetattr *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmggcatt(intf *riid, intf *index, _fcd data) { return nmggnatt(riid, index, (void *)_fcdtocp(data)); @@ -694,7 +694,7 @@ nmggcatt(intf *riid, intf *index, _fcd data) * Invokes: GRgetattr *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmggnatt(intf *riid, intf *index, void *data) { return (intf)GRgetattr((int32)*riid, (int32)*index, data); @@ -713,7 +713,7 @@ nmggnatt(intf *riid, intf *index, void *data) * Remarks: This routine is replaced by mggcatt and mggmatt *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmggattr(intf *riid, intf *index, void *data) { return (intf)GRgetattr((int32)*riid, (int32)*index, data); @@ -731,7 +731,7 @@ nmggattr(intf *riid, intf *index, void *data) * Invokes: GRfindattr *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgifndat(intf *riid, _fcd name, intf *nlen) { char *fn; @@ -759,7 +759,7 @@ nmgifndat(intf *riid, _fcd name, intf *nlen) * Returns: 0 on success, -1 on failure with error set * Users: HDF Fortran programmers *-------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgcgichnk(intf *id, intf *dim_length, intf *flags) { @@ -818,7 +818,7 @@ nmgcgichnk(intf *id, intf *dim_length, intf *flags) * Reamrks: dimensions will be flipped in scrchnk function * Returns: 0 on success, -1 on failure with error set *----------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgcrcchnk(intf *id, intf *start, _fcd char_data) { intf ret; @@ -840,7 +840,7 @@ nmgcrcchnk(intf *id, intf *start, _fcd char_data) * If performance becomes an issue, use static cstart * Returns: 0 on success, -1 on failure with error set *----------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgcrchnk(intf *id, intf *start, void *num_data) { intf ret; @@ -880,7 +880,7 @@ nmgcrchnk(intf *id, intf *start, void *num_data) * Calls: GRsetchunkcache * Returns: 0 on success, -1 on failure with error set *----------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgcscchnk(intf *id, intf *maxcache, intf *flags) { intf ret; @@ -908,7 +908,7 @@ nmgcscchnk(intf *id, intf *maxcache, intf *flags) * Returns: 0 on success, -1 on failure with error set * Users: HDF Fortran programmers *-------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgcschnk(intf *id, intf *dim_length, intf *comp_type, intf *comp_prm) { @@ -992,7 +992,7 @@ nmgcschnk(intf *id, intf *dim_length, intf *comp_type, intf *comp_prm) * Reamrks: dimensions will be flipped in scrchnk function * Returns: 0 on success, -1 on failure with error set *----------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgcwcchnk(intf *id, intf *start, _fcd char_data) { intf ret; @@ -1014,7 +1014,7 @@ nmgcwcchnk(intf *id, intf *start, _fcd char_data) * If performance becomes an issue, use static cstart * Returns: 0 on success, -1 on failure with error set *----------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgcwchnk(intf *id, intf *start, void *num_data) { intf ret; @@ -1063,7 +1063,7 @@ nmgcwchnk(intf *id, intf *start, void *num_data) * Returns: 0 on success, -1 on failure with error set * Users: HDF Fortran programmers *-------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgcscompress(intf *id, intf *comp_type, intf *comp_prm) { int32 riid; /* GR id */ @@ -1126,7 +1126,7 @@ nmgcscompress(intf *id, intf *comp_type, intf *comp_prm) * Returns: 0 on success, -1 on failure with error set * Users: HDF Fortran programmers *-------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgcgcompress(intf *id, intf *comp_type, intf *comp_prm) { comp_info c_info; /* compression info */ @@ -1185,7 +1185,7 @@ nmgcgcompress(intf *id, intf *comp_type, intf *comp_prm) * if one doesn't / FAIL * Users: HDF Fortran programmers *-------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmglt2rf(intf *id) { intf ret; @@ -1200,7 +1200,7 @@ nmglt2rf(intf *id) * Returns: number of palettes on success and -1 if fails. * Users: HDF Fortran programmers *-------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nmgcgnluts(intf *id) { intf ret = -1; diff --git a/hdf/src/vattrf.c b/hdf/src/vattrf.c index dcd0e2b0df..6241f65861 100644 --- a/hdf/src/vattrf.c +++ b/hdf/src/vattrf.c @@ -30,7 +30,7 @@ * VSfindex -- vsfcfdx -- vsffidx */ -FRETVAL(intf) +intf nvsfcfdx(intf *vsid, _fcd fldnm, intf *findex, intf *fldnmlen) { intf ret; @@ -50,7 +50,7 @@ nvsfcfdx(intf *vsid, _fcd fldnm, intf *findex, intf *fldnmlen) * VSsetattr -- vsfcsat -- vsfsnat */ -FRETVAL(intf) +intf nvsfcsat(intf *vsid, intf *findex, _fcd attrnm, intf *dtype, intf *count, intf *values, intf *attrnmlen) { intf ret; @@ -73,7 +73,7 @@ nvsfcsat(intf *vsid, intf *findex, _fcd attrnm, intf *dtype, intf *count, intf * * VSsetattr -- vsfcsca -- vsfscat */ -FRETVAL(intf) +intf nvsfcsca(intf *vsid, intf *findex, _fcd attrnm, intf *dtype, intf *count, _fcd values, intf *attrnmlen) { intf ret; @@ -96,7 +96,7 @@ nvsfcsca(intf *vsid, intf *findex, _fcd attrnm, intf *dtype, intf *count, _fcd v * VSnattrs -- vsfnats */ -FRETVAL(intf) +intf nvsfnats(intf *vsid) { intf ret; @@ -111,7 +111,7 @@ nvsfnats(intf *vsid) * VSfnattrs -- vsffnas */ -FRETVAL(intf) +intf nvsffnas(intf *vsid, intf *findex) { intf ret; @@ -128,7 +128,7 @@ nvsffnas(intf *vsid, intf *findex) * VSfindattr -- vsfcfda -- vsffdat */ -FRETVAL(intf) +intf nvsfcfda(intf *vsid, intf *findex, _fcd attrnm, intf *attrnmlen) { intf ret; @@ -150,7 +150,7 @@ nvsfcfda(intf *vsid, intf *findex, _fcd attrnm, intf *attrnmlen) * VSattrinfo -- vsfcain -- vsfainf */ -FRETVAL(intf) +intf nvsfcain(intf *vsid, intf *findex, intf *aindex, _fcd attrname, intf *dtype, intf *count, intf *size, intf *attrnamelen) { @@ -184,7 +184,7 @@ nvsfcain(intf *vsid, intf *findex, intf *aindex, _fcd attrname, intf *dtype, int * VSgetattr -- vsfgnat */ -FRETVAL(intf) +intf nvsfgnat(intf *vsid, intf *findex, intf *aindex, intf *values) { intf ret; @@ -200,7 +200,7 @@ nvsfgnat(intf *vsid, intf *findex, intf *aindex, intf *values) * VSgetattr -- vsfgcat */ -FRETVAL(intf) +intf nvsfgcat(intf *vsid, intf *findex, intf *aindex, _fcd values) { intf ret; @@ -216,7 +216,7 @@ nvsfgcat(intf *vsid, intf *findex, intf *aindex, _fcd values) * VSisattr -- vsfisat */ -FRETVAL(intf) +intf nvsfisat(intf *vsid) { intf ret; @@ -229,7 +229,7 @@ nvsfisat(intf *vsid) * Vsetattr -- vfcsatt -- vfsnatt */ -FRETVAL(intf) +intf nvfcsatt(intf *vgid, _fcd attrnm, intf *dtype, intf *count, intf *values, intf *attrnmlen) { intf ret; @@ -249,7 +249,7 @@ nvfcsatt(intf *vgid, _fcd attrnm, intf *dtype, intf *count, intf *values, intf * * Vsetattr -- vfcscat -- vfscatt */ -FRETVAL(intf) +intf nvfcscat(intf *vgid, _fcd attrnm, intf *dtype, intf *count, _fcd values, intf *attrnmlen) { intf ret; @@ -268,7 +268,7 @@ nvfcscat(intf *vgid, _fcd attrnm, intf *dtype, intf *count, _fcd values, intf *a * Vnattrs -- vfnatts */ -FRETVAL(intf) +intf nvfnatts(intf *vgid) { intf ret; @@ -282,7 +282,7 @@ nvfnatts(intf *vgid) * Vfindattr -- vfcfdat -- vffdatt */ -FRETVAL(intf) +intf nvfcfdat(intf *vgid, _fcd attrnm, intf *attrnmlen) { intf ret; @@ -301,7 +301,7 @@ nvfcfdat(intf *vgid, _fcd attrnm, intf *attrnmlen) * Vattrinfo -- vfainfo */ -FRETVAL(intf) +intf nvfainfo(intf *vgid, intf *aindex, _fcd attrname, intf *dtype, intf *count, intf *size) { intf ret; @@ -315,7 +315,7 @@ nvfainfo(intf *vgid, intf *aindex, _fcd attrname, intf *dtype, intf *count, intf * Vgetattr -- vfgnatt */ -FRETVAL(intf) +intf nvfgnatt(intf *vgid, intf *aindex, intf *values) { intf ret; @@ -328,7 +328,7 @@ nvfgnatt(intf *vgid, intf *aindex, intf *values) * Vgetattr -- vfgcatt */ -FRETVAL(intf) +intf nvfgcatt(intf *vgid, intf *aindex, _fcd values) { intf ret; @@ -341,7 +341,7 @@ nvfgcatt(intf *vgid, intf *aindex, _fcd values) * Vgetversion -- vfgver */ -FRETVAL(intf) +intf nvfgver(intf *vgid) { intf ret; diff --git a/hdf/src/vgf.c b/hdf/src/vgf.c index 193d0db9a1..451a94dc00 100644 --- a/hdf/src/vgf.c +++ b/hdf/src/vgf.c @@ -73,7 +73,7 @@ trimendblanks(char *ss) * Method: Convert filename to C string, call Hopen *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfivopn(_fcd name, intf *acc_mode, intf *defdds, intf *namelen) { char *fn; @@ -96,7 +96,7 @@ ndfivopn(_fcd name, intf *acc_mode, intf *defdds, intf *namelen) * Invokes: Hclose *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ndfvclos(intf *file_id) { return Vclose((int32)*file_id); @@ -107,7 +107,7 @@ ndfvclos(intf *file_id) ** related: Vattach--vatchc--VFATCH */ -FRETVAL(intf) +intf nvatchc(intf *f, intf *vgid, _fcd accesstype) { int32 vkey; @@ -130,7 +130,7 @@ nvatchc(intf *f, intf *vgid, _fcd accesstype) ** related: Vdetach--vdtchc--VFDTCH */ -FRETVAL(intf) +intf nvdtchc(intf *vkey) { return Vdetach(*vkey); @@ -142,7 +142,7 @@ nvdtchc(intf *vkey) ** related: Vgetname--vgnamc--VFGNAM */ -FRETVAL(intf) +intf nvgnamc(intf *vkey, _fcd vgname) { return Vgetname(*vkey, _fcdtocp(vgname)); @@ -154,7 +154,7 @@ nvgnamc(intf *vkey, _fcd vgname) ** related: Vgetclass--vgclsc--VFGCLS */ -FRETVAL(intf) +intf nvgclsc(intf *vkey, _fcd vgclass) { return Vgetclass(*vkey, _fcdtocp(vgclass)); @@ -166,7 +166,7 @@ nvgclsc(intf *vkey, _fcd vgclass) ** related: Vinquire--vinqc--VFINQ */ -FRETVAL(intf) +intf nvinqc(intf *vkey, intf *nentries, _fcd vgname) { return (intf)Vinquire(*vkey, (int32 *)nentries, _fcdtocp(vgname)); @@ -178,7 +178,7 @@ nvinqc(intf *vkey, intf *nentries, _fcd vgname) ** related: Vdelete--vdelete-- */ -FRETVAL(intf) +intf nvdelete(intf *f, intf *vkey) { return (intf)Vdelete((int32)*f, (int32)*vkey); @@ -190,7 +190,7 @@ nvdelete(intf *f, intf *vkey) ** related: Vgetid--vgidc--VFGID */ -FRETVAL(intf) +intf nvgidc(intf *f, intf *vgid) { return (intf)Vgetid((int32)*f, *vgid); @@ -202,7 +202,7 @@ nvgidc(intf *f, intf *vgid) ** related: Vgetnext--vgnxtc--VFGNXT */ -FRETVAL(intf) +intf nvgnxtc(intf *vkey, intf *id) { return Vgetnext(*vkey, *id); @@ -214,7 +214,7 @@ nvgnxtc(intf *vkey, intf *id) ** related: Vsetname--vsnamc--VFSNAM */ -FRETVAL(intf) +intf nvsnamc(intf *vkey, _fcd vgname, intf *vgnamelen) { char *name; @@ -236,7 +236,7 @@ nvsnamc(intf *vkey, _fcd vgname, intf *vgnamelen) ** related: Vsetclass--vsclsc--VFSCLS */ -FRETVAL(intf) +intf nvsclsc(intf *vkey, _fcd vgclass, intf *vgclasslen) { char *tclass; @@ -258,7 +258,7 @@ nvsclsc(intf *vkey, _fcd vgclass, intf *vgclasslen) ** related: Vinsert--vinsrtc--VFINSRT */ -FRETVAL(intf) +intf nvinsrtc(intf *vkey, intf *vobjptr) { return (intf)Vinsert(*vkey, *vobjptr); @@ -270,7 +270,7 @@ nvinsrtc(intf *vkey, intf *vobjptr) ** related: Visvg--visvgc--VFISVG */ -FRETVAL(intf) +intf nvisvgc(intf *vkey, intf *id) { return (intf)Visvg(*vkey, *id); @@ -281,7 +281,7 @@ nvisvgc(intf *vkey, intf *id) ** wrapper for Vstart */ -FRETVAL(intf) +intf nvfstart(intf *f) { return Vstart((int32)*f); @@ -292,7 +292,7 @@ nvfstart(intf *f) ** wrapper for Vend */ -FRETVAL(intf) +intf nvfend(intf *f) { return (intf)Vend((int32)*f); @@ -304,7 +304,7 @@ nvfend(intf *f) ** related: Visvs--visvsc--VFISVS */ -FRETVAL(intf) +intf nvisvsc(intf *vkey, intf *id) { return (intf)Visvs(*vkey, *id); @@ -319,7 +319,7 @@ nvisvsc(intf *vkey, intf *id) ** related: VSattach--vsatchc--VFATCH */ -FRETVAL(intf) +intf nvsatchc(intf *f, intf *vsid, _fcd accesstype) { /* need not HDf2cstring since only first char is accessed. */ @@ -332,7 +332,7 @@ nvsatchc(intf *f, intf *vsid, _fcd accesstype) ** related: VSdetach--vsdtchc--VFDTCH */ -FRETVAL(intf) +intf nvsdtchc(intf *vkey) { return VSdetach(*vkey); @@ -344,7 +344,7 @@ nvsdtchc(intf *vkey) ** related: VSQueryref--vsqref-- */ -FRETVAL(intf) +intf nvsqref(intf *vkey) { return (intf)VSQueryref((int32)*vkey); @@ -356,7 +356,7 @@ nvsqref(intf *vkey) ** related: VSQuerytag--vsqtag-- */ -FRETVAL(intf) +intf nvsqtag(intf *vkey) { return (intf)VSQuerytag((int32)*vkey); @@ -368,7 +368,7 @@ nvsqtag(intf *vkey) ** related: VSgetversion--vsgver-- */ -FRETVAL(intf) +intf nvsgver(intf *vkey) { return (intf)VSgetversion((int32)*vkey); @@ -380,7 +380,7 @@ nvsgver(intf *vkey) ** related: VSseek--vsseekc--VSFSEEK */ -FRETVAL(intf) +intf nvsseekc(intf *vkey, intf *eltpos) { return (intf)VSseek(*vkey, *eltpos); @@ -392,7 +392,7 @@ nvsseekc(intf *vkey, intf *eltpos) ** related: VSgetname--vsgnamc--VSFGNAM */ -FRETVAL(intf) +intf nvsgnamc(intf *vkey, _fcd vsname, intf *vsnamelen) { char *tvsname = NULL; @@ -418,7 +418,7 @@ nvsgnamc(intf *vkey, _fcd vsname, intf *vsnamelen) ** related: VSgetclass--vsgclsc--VSFGCLS */ -FRETVAL(intf) +intf nvsgclsc(intf *vkey, _fcd vsclass, intf *vsclasslen) { char *tvsclass = NULL; @@ -444,7 +444,7 @@ nvsgclsc(intf *vkey, _fcd vsclass, intf *vsclasslen) ** related: VSinquire--vsinqc--VSFINQ */ -FRETVAL(intf) +intf nvsinqc(intf *vkey, intf *nelt, intf *interlace, _fcd fields, intf *eltsize, _fcd vsname, intf *fieldslen, intf *vsnamelen) { @@ -486,7 +486,7 @@ nvsinqc(intf *vkey, intf *nelt, intf *interlace, _fcd fields, intf *eltsize, _fc ** related: VSfexist--vsfexc--VSFEX */ -FRETVAL(intf) +intf nvsfexc(intf *vkey, _fcd fields, intf *fieldslen) { intf ret; @@ -508,7 +508,7 @@ nvsfexc(intf *vkey, _fcd fields, intf *fieldslen) ** related: VSfind--vsfndc--VSFFND */ -FRETVAL(intf) +intf nvsfndc(intf *f, _fcd name, intf *namelen) { intf ret; @@ -530,7 +530,7 @@ nvsfndc(intf *f, _fcd name, intf *namelen) ** related: VSgetid--vsgidc--VSFGID */ -FRETVAL(intf) +intf nvsgidc(intf *f, intf *vsid) { return (intf)VSgetid(*f, *vsid); @@ -542,7 +542,7 @@ nvsgidc(intf *f, intf *vsid) ** related: VSdelete--vsdltc--VSFDLTE */ -FRETVAL(intf) +intf nvsdltc(intf *f, intf *vsid) { return (intf)VSdelete(*f, *vsid); @@ -554,7 +554,7 @@ nvsdltc(intf *f, intf *vsid) ** related: VSappendable--vsapp-- */ -FRETVAL(intf) +intf nvsapp(intf *vkey, intf *blk) { return (intf)VSappendable((int32)*vkey, (int32)*blk); @@ -566,7 +566,7 @@ nvsapp(intf *vkey, intf *blk) ** related: VSsetname--vssnamc--VSFSNAM */ -FRETVAL(intf) +intf nvssnamc(intf *vkey, _fcd vsname, intf *vsnamelen) { char *name; @@ -588,7 +588,7 @@ nvssnamc(intf *vkey, _fcd vsname, intf *vsnamelen) ** related: VSsetclass--vssclsc--VSFSCLS */ -FRETVAL(intf) +intf nvssclsc(intf *vkey, _fcd vsclass, intf *vsclasslen) { char *tclass; @@ -610,7 +610,7 @@ nvssclsc(intf *vkey, _fcd vsclass, intf *vsclasslen) ** related: VSsetfields--vssfldc--VSFSFLD */ -FRETVAL(intf) +intf nvssfldc(intf *vkey, _fcd fields, intf *fieldslen) { char *flds; @@ -632,7 +632,7 @@ nvssfldc(intf *vkey, _fcd fields, intf *fieldslen) ** related: VSsetinterlace--vssintc--VSFSINT */ -FRETVAL(intf) +intf nvssintc(intf *vkey, intf *interlace) { return (intf)VSsetinterlace(*vkey, *interlace); @@ -644,7 +644,7 @@ nvssintc(intf *vkey, intf *interlace) ** related: VSfdefine--vsfdefc--VSFFDEF */ -FRETVAL(intf) +intf nvsfdefc(intf *vkey, _fcd field, intf *localtype, intf *order, intf *fieldlen) { intf ret; @@ -670,7 +670,7 @@ nvsfdefc(intf *vkey, _fcd field, intf *localtype, intf *order, intf *fieldlen) * Returns: 0 on success, -1 on failure with error set *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nvssextfc(intf *id, _fcd name, intf *offset, intf *namelen) { char *fn; @@ -690,7 +690,7 @@ nvssextfc(intf *id, _fcd name, intf *offset, intf *namelen) ** related: VFnfields--vfnflds-- */ -FRETVAL(intf) +intf nvfnflds(intf *vkey) { return (intf)VFnfields((int32)*vkey); @@ -702,7 +702,7 @@ nvfnflds(intf *vkey) ** related: VFfieldname--vffname--vffnamec */ -FRETVAL(intf) +intf nvffnamec(intf *vkey, intf *index, _fcd fname, intf *len) { char *fieldname = NULL; @@ -723,7 +723,7 @@ nvffnamec(intf *vkey, intf *index, _fcd fname, intf *len) ** related: VFfieldtype--vfftype-- */ -FRETVAL(intf) +intf nvfftype(intf *vkey, intf *index) { return (intf)VFfieldtype((int32)*vkey, (int32)*index); @@ -735,7 +735,7 @@ nvfftype(intf *vkey, intf *index) ** related: VFfieldisize--vffisiz-- */ -FRETVAL(intf) +intf nvffisiz(intf *vkey, intf *index) { return (intf)VFfieldisize((int32)*vkey, (int32)*index); @@ -747,7 +747,7 @@ nvffisiz(intf *vkey, intf *index) ** related: VFfieldesize--vffesiz-- */ -FRETVAL(intf) +intf nvffesiz(intf *vkey, intf *index) { return (intf)VFfieldesize((int32)*vkey, (int32)*index); @@ -759,7 +759,7 @@ nvffesiz(intf *vkey, intf *index) ** related: VFfieldorder--vffordr-- */ -FRETVAL(intf) +intf nvffordr(intf *vkey, intf *index) { return (intf)VFfieldorder((int32)*vkey, (int32)*index); @@ -771,7 +771,7 @@ nvffordr(intf *vkey, intf *index) ** related: VSread--vsfrdc */ -FRETVAL(intf) +intf nvsfrdc(intf *vkey, _fcd cbuf, intf *nelt, intf *interlace) { return (intf)VSread(*vkey, (uint8 *)_fcdtocp(cbuf), *nelt, *interlace); @@ -782,7 +782,7 @@ nvsfrdc(intf *vkey, _fcd cbuf, intf *nelt, intf *interlace) ** related: VSread--vsfrd */ -FRETVAL(intf) +intf nvsfrd(intf *vkey, intf *buf, intf *nelt, intf *interlace) { return (intf)VSread(*vkey, (uint8 *)buf, *nelt, *interlace); @@ -794,7 +794,7 @@ nvsfrd(intf *vkey, intf *buf, intf *nelt, intf *interlace) ** related: VSread--vsreadc--VSFREAD */ -FRETVAL(intf) +intf nvsreadc(intf *vkey, uint8 *buf, intf *nelt, intf *interlace) { return (intf)VSread(*vkey, buf, *nelt, *interlace); @@ -806,7 +806,7 @@ nvsreadc(intf *vkey, uint8 *buf, intf *nelt, intf *interlace) ** related: VSwrite--vsfwrtc */ -FRETVAL(intf) +intf nvsfwrtc(intf *vkey, _fcd cbuf, intf *nelt, intf *interlace) { return (intf)VSwrite(*vkey, (uint8 *)_fcdtocp(cbuf), *nelt, *interlace); @@ -818,7 +818,7 @@ nvsfwrtc(intf *vkey, _fcd cbuf, intf *nelt, intf *interlace) ** related: VSwrite--vsfwrt */ -FRETVAL(intf) +intf nvsfwrt(intf *vkey, intf *buf, intf *nelt, intf *interlace) { return (intf)VSwrite(*vkey, (uint8 *)buf, *nelt, *interlace); @@ -830,7 +830,7 @@ nvsfwrt(intf *vkey, intf *buf, intf *nelt, intf *interlace) ** related: VSwrite--vswritc--VSFWRIT */ -FRETVAL(intf) +intf nvswritc(intf *vkey, uint8 *buf, intf *nelt, intf *interlace) { return (intf)VSwrite(*vkey, buf, *nelt, *interlace); @@ -847,7 +847,7 @@ nvswritc(intf *vkey, uint8 *buf, intf *nelt, intf *interlace) ** related: VSgetinterlace--vsgintc--VSFGINT */ -FRETVAL(intf) +intf nvsgintc(intf *vkey) { return (intf)VSgetinterlace(*vkey); @@ -859,7 +859,7 @@ nvsgintc(intf *vkey) ** related: VSelts--vseltsc--VSFELTS */ -FRETVAL(intf) +intf nvseltsc(intf *vkey) { return (intf)VSelts(*vkey); @@ -871,7 +871,7 @@ nvseltsc(intf *vkey) ** related: VSgetfields--vsgfldc--VSFGFLD */ -FRETVAL(intf) +intf nvsgfldc(intf *vkey, _fcd fields) { return (intf)VSgetfields(*vkey, _fcdtocp(fields)); @@ -883,7 +883,7 @@ nvsgfldc(intf *vkey, _fcd fields) ** related: VSsizeof--vssizc--VSFSIZ */ -FRETVAL(intf) +intf nvssizc(intf *vkey, _fcd fields, intf *fieldslen) { char *flds; @@ -904,7 +904,7 @@ nvssizc(intf *vkey, _fcd fields, intf *fieldslen) ** related: Ventries--ventsc--VFENTS */ -FRETVAL(intf) +intf nventsc(intf *f, intf *vgid) { return (intf)Ventries(*f, *vgid); @@ -916,7 +916,7 @@ nventsc(intf *f, intf *vgid) ** related: Vlone--vlonec--VFLONE */ -FRETVAL(intf) +intf nvlonec(intf *f, intf *idarray, intf *asize) { return (intf)Vlone(*f, (int32 *)idarray, (int32)*asize); @@ -928,7 +928,7 @@ nvlonec(intf *f, intf *idarray, intf *asize) ** related: VSlone--vslonec--VSFLONE */ -FRETVAL(intf) +intf nvslonec(intf *f, intf *idarray, intf *asize) { return VSlone(*f, (int32 *)idarray, (int32)*asize); @@ -940,7 +940,7 @@ nvslonec(intf *f, intf *idarray, intf *asize) ** related: Vfind--vfindc--VFIND */ -FRETVAL(intf) +intf nvfindc(intf *f, _fcd name, intf *namelen) { char *tmp_name; @@ -962,7 +962,7 @@ nvfindc(intf *f, _fcd name, intf *namelen) ** related: Vfindclass--vfclassc--VFNDCLS */ -FRETVAL(intf) +intf nvfndclsc(intf *f, _fcd vgclass, intf *classlen) { char *t_class; @@ -989,7 +989,7 @@ nvfndclsc(intf *f, _fcd vgclass, intf *classlen) ** related: VHstoredata--vhsdc--vhfsd */ -FRETVAL(intf) +intf nvhsdc(intf *f, _fcd field, uint8 *buf, intf *n, intf *datatype, _fcd vsname, _fcd vsclass, intf *fieldlen, intf *vsnamelen, intf *vsclasslen) { @@ -1024,7 +1024,7 @@ nvhsdc(intf *f, _fcd field, uint8 *buf, intf *n, intf *datatype, _fcd vsname, _f ** related: VHstoredata--vhscdc--vhfscd */ -FRETVAL(intf) +intf nvhscdc(intf *f, _fcd field, _fcd cbuf, intf *n, intf *datatype, _fcd vsname, _fcd vsclass, intf *fieldlen, intf *vsnamelen, intf *vsclasslen) { @@ -1040,7 +1040,7 @@ nvhscdc(intf *f, _fcd field, _fcd cbuf, intf *n, intf *datatype, _fcd vsname, _f ** related: VHstoredatam--vhscdmc--vhfscdm */ -FRETVAL(intf) +intf nvhscdmc(intf *f, _fcd field, _fcd cbuf, intf *n, intf *datatype, _fcd vsname, _fcd vsclass, intf *order, intf *fieldlen, intf *vsnamelen, intf *vsclasslen) { @@ -1056,7 +1056,7 @@ nvhscdmc(intf *f, _fcd field, _fcd cbuf, intf *n, intf *datatype, _fcd vsname, _ ** related: VHstoredatam--vhsdmc--vhfsdm */ -FRETVAL(intf) +intf nvhsdmc(intf *f, _fcd field, uint8 *buf, intf *n, intf *datatype, _fcd vsname, _fcd vsclass, intf *order, intf *fieldlen, intf *vsnamelen, intf *vsclasslen) { @@ -1092,7 +1092,7 @@ nvhsdmc(intf *f, _fcd field, uint8 *buf, intf *n, intf *datatype, _fcd vsname, _ ** related: VHmakegroup--vhmkgpc--vhfmkgp */ -FRETVAL(intf) +intf nvhmkgpc(intf *f, intf *tagarray, intf *refarray, intf *n, _fcd vgname, _fcd vgclass, intf *vgnamelen, intf *vgclasslen) { @@ -1121,7 +1121,7 @@ nvhmkgpc(intf *f, intf *tagarray, intf *refarray, intf *n, _fcd vgname, _fcd vgc ** related: Vflocate--vffloc--vflocc */ -FRETVAL(intf) +intf nvflocc(intf *vkey, _fcd field, intf *fieldlen) { char *fld; @@ -1143,7 +1143,7 @@ nvflocc(intf *vkey, _fcd field, intf *fieldlen) ** related: Vinqtagref--vinqtrc--vfinqtr */ -FRETVAL(intf) +intf nvinqtrc(intf *vkey, intf *tag, intf *ref) { return (intf)Vinqtagref(*vkey, *tag, *ref); @@ -1154,7 +1154,7 @@ nvinqtrc(intf *vkey, intf *tag, intf *ref) ** related: Vntagrefs--vntrc--VFNTR */ -FRETVAL(intf) +intf nvntrc(intf *vkey) { return (intf)Vntagrefs(*vkey); @@ -1166,7 +1166,7 @@ nvntrc(intf *vkey) ** related: Vnrefs--vnrefs-- */ -FRETVAL(intf) +intf nvnrefs(intf *vkey, intf *tag) { return (intf)Vnrefs((int32)*vkey, (int32)*tag); @@ -1178,7 +1178,7 @@ nvnrefs(intf *vkey, intf *tag) ** related: VQueryref--vqref-- */ -FRETVAL(intf) +intf nvqref(intf *vkey) { return (intf)VQueryref((int32)*vkey); @@ -1190,7 +1190,7 @@ nvqref(intf *vkey) ** related: VQuerytag--vqtag-- */ -FRETVAL(intf) +intf nvqtag(intf *vkey) { return (intf)VQuerytag((int32)*vkey); @@ -1203,7 +1203,7 @@ nvqtag(intf *vkey) ** related: Vgettagrefs--vgttrsc--vfgttrs */ -FRETVAL(intf) +intf nvgttrsc(intf *vkey, intf *tagarray, intf *refarray, intf *n) { return (intf)Vgettagrefs(*vkey, (int32 *)tagarray, (int32 *)refarray, *n); @@ -1215,7 +1215,7 @@ nvgttrsc(intf *vkey, intf *tagarray, intf *refarray, intf *n) ** related: Vgettagref--vgttrc--vfgttr */ -FRETVAL(intf) +intf nvgttrc(intf *vkey, intf *which, intf *tag, intf *ref) { return (intf)Vgettagref(*vkey, *which, (int32 *)tag, (int32 *)ref); @@ -1227,7 +1227,7 @@ nvgttrc(intf *vkey, intf *which, intf *tag, intf *ref) ** related: Vinqtagref--vinqtrc--vfinqtr */ -FRETVAL(intf) +intf nvadtrc(intf *vkey, intf *tag, intf *ref) { return (intf)Vaddtagref(*vkey, *tag, *ref); @@ -1239,7 +1239,7 @@ nvadtrc(intf *vkey, intf *tag, intf *ref) ** related: VSQuerycount--vsqfnelt */ -FRETVAL(intf) +intf nvsqfnelt(intf *vkey, intf *nelt) { int32 ret_nelt = 0; @@ -1257,7 +1257,7 @@ nvsqfnelt(intf *vkey, intf *nelt) ** related: VSQueryinterlace--vsqfintr */ -FRETVAL(intf) +intf nvsqfintr(intf *vkey, intf *interlace) { int32 ret_inter = 0; @@ -1275,7 +1275,7 @@ nvsqfintr(intf *vkey, intf *interlace) ** related: VSQueryfields--vsqfflds */ -FRETVAL(intf) +intf nvsqfldsc(intf *vkey, _fcd fields, intf *fieldslen) { char *fld; @@ -1296,7 +1296,7 @@ nvsqfldsc(intf *vkey, _fcd fields, intf *fieldslen) ** related: VSQueryvsize--vsqfvsiz */ -FRETVAL(intf) +intf nvsqfvsiz(intf *vkey, intf *size) { int32 ret_size = 0; @@ -1314,7 +1314,7 @@ nvsqfvsiz(intf *vkey, intf *size) ** related: VSQueryname--vsqfname */ -FRETVAL(intf) +intf nvsqnamec(intf *vkey, _fcd name, intf *namelen) { char *nam; @@ -1330,7 +1330,7 @@ nvsqnamec(intf *vkey, _fcd name, intf *namelen) } /* ------------------------------------------------------------------ */ -FRETVAL(intf) +intf nvsfccpk(intf *vs, intf *packtype, _fcd buflds, intf *buf, intf *bufsz, intf *nrecs, _fcd pckfld, _fcd fldbuf, intf *buflds_len, intf *fld_len) { @@ -1367,7 +1367,7 @@ nvsfccpk(intf *vs, intf *packtype, _fcd buflds, intf *buf, intf *bufsz, intf *nr } /* ------------------------------------------------------------------ */ -FRETVAL(intf) +intf nvsfncpk(intf *vs, intf *packtype, _fcd buflds, intf *buf, intf *bufsz, intf *nrecs, _fcd pckfld, intf *fldbuf, intf *buflds_len, intf *fld_len) { @@ -1409,7 +1409,7 @@ nvsfncpk(intf *vs, intf *packtype, _fcd buflds, intf *buf, intf *bufsz, intf *nr ** */ -FRETVAL(intf) +intf nvdtrc(intf *vkey, intf *tag, intf *ref) { return (intf)Vdeletetagref(*vkey, *tag, *ref); @@ -1425,7 +1425,7 @@ nvdtrc(intf *vkey, intf *tag, intf *ref) * Related functions: vffcls, VSfindclass * Users: HDF Fortran programmers ---------------------------------------------------------------------*/ -FRETVAL(intf) +intf nvscfcls(intf *id, _fcd name, intf *namelen) { intf fi_id; @@ -1449,7 +1449,7 @@ nvscfcls(intf *id, _fcd name, intf *namelen) * Returns: 0 if succeeds, -1 if fails * Users: HDF Fortran programmers ---------------------------------------------------------------------*/ -FRETVAL(intf) +intf nvscsetblsz(intf *id, intf *block_size) { intf ret = -1; @@ -1468,7 +1468,7 @@ nvscsetblsz(intf *id, intf *block_size) * Returns: 0 if succeeds, -1 if fails * Users: HDF Fortran programmers ---------------------------------------------------------------------*/ -FRETVAL(intf) +intf nvscsetnmbl(intf *id, intf *num_blocks) { intf ret; @@ -1488,7 +1488,7 @@ nvscsetnmbl(intf *id, intf *num_blocks) * Returns: 0 if succeeds, -1 if fails * Users: HDF Fortran programmers ---------------------------------------------------------------------*/ -FRETVAL(intf) +intf nvscgblinfo(intf *id, intf *block_size, intf *num_blocks) { intf ret = -1; @@ -1515,7 +1515,7 @@ nvscgblinfo(intf *id, intf *block_size, intf *num_blocks) * Returns: 0 if succeeds, -1 if fails * Users: HDF Fortran programmers ---------------------------------------------------------------------*/ -FRETVAL(intf) +intf nvcgvgrp(intf *id, intf *start_vg, intf *vg_count, intf *refarray) { intf ret = -1; @@ -1549,7 +1549,7 @@ nvcgvgrp(intf *id, intf *start_vg, intf *vg_count, intf *refarray) * Returns: 0 if succeeds, -1 if fails * Users: HDF Fortran programmers ---------------------------------------------------------------------*/ -FRETVAL(intf) +intf nvscgvdatas(intf *id, intf *start_vd, intf *vd_count, intf *refarray) { intf ret = -1; diff --git a/hdf/test/forsupf.c b/hdf/test/forsupf.c index 01d4d68838..b9a0571ede 100644 --- a/hdf/test/forsupf.c +++ b/hdf/test/forsupf.c @@ -23,7 +23,7 @@ * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf ngetverb(void) { char *verb_str; @@ -45,7 +45,7 @@ ngetverb(void) * Invokes: system *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nhisystem(_fcd cmd, intf *cmdlen) { char *fn; @@ -71,7 +71,7 @@ nhisystem(_fcd cmd, intf *cmdlen) * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nfixnamec(_fcd name, intf *name_len, _fcd name_out, intf *name_len_out) { char *c_name; diff --git a/hdf/test/fortest.h b/hdf/test/fortest.h index 738a0f7359..9e7a63185c 100644 --- a/hdf/test/fortest.h +++ b/hdf/test/fortest.h @@ -26,8 +26,8 @@ /* FORTRAN support C-stubs for FORTRAN interface tests */ -HDFFCLIBAPI FRETVAL(intf) ngetverb(void); -HDFFCLIBAPI FRETVAL(intf) nhisystem(_fcd cmd, intf *cmdlen); -HDFFCLIBAPI FRETVAL(intf) nfixnamec(_fcd name, intf *name_len, _fcd name_out, intf *name_len_out); +HDFFCLIBAPI intf ngetverb(void); +HDFFCLIBAPI intf nhisystem(_fcd cmd, intf *cmdlen); +HDFFCLIBAPI intf nfixnamec(_fcd name, intf *name_len, _fcd name_out, intf *name_len_out); #endif /* H4_FORTEST_H */ diff --git a/mfhdf/fortran/mfsdf.c b/mfhdf/fortran/mfsdf.c index 1b39b9d247..d2c5abab6e 100644 --- a/mfhdf/fortran/mfsdf.c +++ b/mfhdf/fortran/mfsdf.c @@ -20,12 +20,12 @@ */ #include "mfsdf.h" -FRETVAL(intf) nsfscfill(intf *id, _fcd val); -FRETVAL(intf) nsfsfill(intf *id, void *val); -FRETVAL(intf) nsfgfill(intf *id, void *val); -FRETVAL(intf) nsfrnatt(intf *id, intf *index, void *buf); -FRETVAL(intf) nscsnatt(intf *id, _fcd name, intf *nt, intf *count, void *data, intf *len); -FRETVAL(intf) nsfsflmd(intf *id, intf *fillmode); +intf nsfscfill(intf *id, _fcd val); +intf nsfsfill(intf *id, void *val); +intf nsfgfill(intf *id, void *val); +intf nsfrnatt(intf *id, intf *index, void *buf); +intf nscsnatt(intf *id, _fcd name, intf *nt, intf *count, void *data, intf *len); +intf nsfsflmd(intf *id, intf *fillmode); #if defined H4_HAVE_WIN32_API && !defined CMAKE_INTDIR @@ -36,7 +36,7 @@ FRETVAL(intf) nsfsflmd(intf *id, intf *fillmode); * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscend(intf *file_id) { return (SDend(*file_id)); @@ -49,7 +49,7 @@ nscend(intf *file_id) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscendacc(intf *id) { return (SDendaccess(*id)); @@ -62,7 +62,7 @@ nscendacc(intf *id) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscfinfo(intf *file_id, intf *datasets, intf *gattr) { int32 dset, nattr, status; @@ -83,7 +83,7 @@ nscfinfo(intf *file_id, intf *datasets, intf *gattr) * Returns: sdsid on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscselct(intf *file_id, intf *index) { return (SDselect(*file_id, *index)); @@ -97,7 +97,7 @@ nscselct(intf *file_id, intf *index) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscdimid(intf *id, intf *index) { int32 rank, nt, dims[100], status, cdim, nattrs; @@ -119,7 +119,7 @@ nscdimid(intf *id, intf *index) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscgcal(intf *id, float64 *cal, float64 *cale, float64 *ioff, float64 *ioffe, intf *nt) { int32 nt32, status; @@ -140,7 +140,7 @@ nscgcal(intf *id, float64 *cal, float64 *cale, float64 *ioff, float64 *ioffe, in * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscscal(intf *id, float64 *cal, float64 *cale, float64 *ioff, float64 *ioffe, intf *nt) { return (SDsetcal(*id, *cal, *cale, *ioff, *ioffe, *nt)); @@ -156,7 +156,7 @@ nscscal(intf *id, float64 *cal, float64 *cale, float64 *ioff, float64 *ioffe, in * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscsdscale(intf *id, intf *count, intf *nt, void *values) { return (SDsetdimscale(*id, *count, *nt, values)); @@ -170,7 +170,7 @@ nscsdscale(intf *id, intf *count, intf *nt, void *values) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscgdscale(intf *id, void *values) { return (SDgetdimscale(*id, values)); @@ -184,7 +184,7 @@ nscgdscale(intf *id, void *values) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *----------------------------------------------------------*/ -FRETVAL(intf) +intf nscscfill(intf *id, _fcd val) { return (nscsfill(id, (void *)_fcdtocp(val))); @@ -198,7 +198,7 @@ nscscfill(intf *id, _fcd val) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *-----------------------------------------------------------*/ -FRETVAL(intf) +intf nscgcfill(intf *id, _fcd val) { return (nscgfill(id, (void *)_fcdtocp(val))); @@ -212,7 +212,7 @@ nscgcfill(intf *id, _fcd val) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *------------------------------------------------------------*/ -FRETVAL(intf) +intf nscsfill(intf *id, void *val) { return (SDsetfillvalue(*id, val)); @@ -226,7 +226,7 @@ nscsfill(intf *id, void *val) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *------------------------------------------------------*/ -FRETVAL(intf) +intf nscgfill(intf *id, void *val) { return (SDgetfillvalue(*id, val)); @@ -241,7 +241,7 @@ nscgfill(intf *id, void *val) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscgrange(intf *id, void *max, void *min) { return (SDgetrange(*id, max, min)); @@ -256,7 +256,7 @@ nscgrange(intf *id, void *max, void *min) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscsrange(intf *id, void *max, void *min) { return (SDsetrange(*id, max, min)); @@ -271,7 +271,7 @@ nscsrange(intf *id, void *max, void *min) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscrcatt(intf *id, intf *index, _fcd buf) { return (nscrnatt(id, index, (void *)_fcdtocp(buf))); @@ -286,7 +286,7 @@ nscrcatt(intf *id, intf *index, _fcd buf) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscrnatt(intf *id, intf *index, void *buf) { return (SDreadattr(*id, *index, buf)); @@ -301,7 +301,7 @@ nscrnatt(intf *id, intf *index, void *buf) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscrattr(intf *id, intf *index, void *buf) { return (nscrnatt(id, index, buf)); @@ -319,7 +319,7 @@ nscrattr(intf *id, intf *index, void *buf) * differences * Returns: 0 on success, -1 on failure with error set *----------------------------------------------------------*/ -FRETVAL(intf) +intf nscrdata(intf *id, intf *start, intf *stride, intf *end, void *values) { intf ret; @@ -356,7 +356,7 @@ nscrdata(intf *id, intf *start, intf *stride, intf *end, void *values) * differences * Returns: 0 on success, -1 on failure with error set *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscwdata(intf *id, intf *start, intf *stride, intf *end, void *values) { intf ret; @@ -393,7 +393,7 @@ nscwdata(intf *id, intf *start, intf *stride, intf *end, void *values) * differences * Returns: 0 on success, -1 on failure with error set *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscrcdata(intf *id, intf *start, intf *stride, intf *end, _fcd values) { return (nscrdata(id, start, stride, end, (void *)_fcdtocp(values))); @@ -411,7 +411,7 @@ nscrcdata(intf *id, intf *start, intf *stride, intf *end, _fcd values) * differences * Returns: 0 on success, -1 on failure with error set *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscwcdata(intf *id, intf *start, intf *stride, intf *end, _fcd values) { return (nscwdata(id, start, stride, end, (void *)_fcdtocp(values))); @@ -423,7 +423,7 @@ nscwcdata(intf *id, intf *start, intf *stride, intf *end, _fcd values) * Inputs: id: variable id * Returns: reference number of a NDG representing this dataset *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscid2ref(intf *id) { return ((intf)SDidtoref(*id)); @@ -437,7 +437,7 @@ nscid2ref(intf *id) * ref: reference number to look up * Returns: index of a NDG representing this dataset *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscr2idx(intf *id, intf *ref) { return ((intf)SDreftoindex(*id, (int32)*ref)); @@ -450,7 +450,7 @@ nscr2idx(intf *id, intf *ref) * Inputs: id: sds id * Returns: TRUE/FALSE *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsciscvar(intf *id) { return ((intf)SDiscoordvar(*id)); @@ -466,7 +466,7 @@ nsciscvar(intf *id) * fill_one: whether to fill the "background bits" with ones * Returns: 0 on success, -1 on failure with error set *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscsnbit(intf *id, intf *start_bit, intf *bit_len, intf *sign_ext, intf *fill_one) { return ((intf)SDsetnbitdataset((int32)*id, (intn)*start_bit, (intn)*bit_len, (intn)*sign_ext, @@ -481,7 +481,7 @@ nscsnbit(intf *id, intf *start_bit, intf *bit_len, intf *sign_ext, intf *fill_on * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscsacct(intf *id, intf *type) { return ((intf)SDsetaccesstype(*id, *type)); @@ -498,7 +498,7 @@ nscsacct(intf *id, intf *type) * Returns: SUCCESS on success, FAIL on failure * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscsdmvc(intf *id, intf *compmode) { return ((intf)SDsetdimval_comp(*id, *compmode)); @@ -515,7 +515,7 @@ nscsdmvc(intf *id, intf *compmode) FAIL (-1) for error. * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscisdmvc(intf *id) { return ((intf)SDisdimval_bwcomp(*id)); @@ -534,7 +534,7 @@ nscisdmvc(intf *id) * FAIL (-1) for error. * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscsflmd(intf *id, intf *fillmode) { return ((intf)SDsetfillmode(*id, *fillmode)); @@ -545,7 +545,7 @@ nscsflmd(intf *id, intf *fillmode) * Inputs: id: sds id * Returns: TRUE/FALSE (1/0)) *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfisrcrd(intf *id) { return ((intf)SDisrecord(*id)); @@ -557,7 +557,7 @@ nsfisrcrd(intf *id) block_size: block size in bytes * Returns: SUCCEED/FAIL (0/-1) *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscsblsz(intf *id, intf *block_size) { return ((intf)SDsetblocksize(*id, *block_size)); @@ -572,7 +572,7 @@ nscsblsz(intf *id, intf *block_size) * namelen: length of name * Returns: 0 on success, -1 on failure with error set *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscstart(_fcd name, intf *access, intf *namelen) { char *fn; @@ -593,7 +593,7 @@ nscstart(_fcd name, intf *access, intf *namelen) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfend(intf *file_id) { return (SDend(*file_id)); @@ -606,7 +606,7 @@ nsfend(intf *file_id) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfendacc(intf *id) { return (SDendaccess(*id)); @@ -618,7 +618,7 @@ nsfendacc(intf *id) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsffinfo(intf *file_id, intf *datasets, intf *gattr) { int32 dset, nattr, status; @@ -639,7 +639,7 @@ nsffinfo(intf *file_id, intf *datasets, intf *gattr) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfselect(intf *file_id, intf *index) { return (SDselect(*file_id, *index)); @@ -653,7 +653,7 @@ nsfselect(intf *file_id, intf *index) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfdimid(intf *id, intf *index) { int32 rank, nt, dims[100], status, cdim, nattrs; @@ -678,7 +678,7 @@ nsfdimid(intf *id, intf *index) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscginfo(intf *id, _fcd name, intf *rank, intf *dimsizes, intf *nt, intf *nattr, intf *len) { char *iname; @@ -715,7 +715,7 @@ nscginfo(intf *id, _fcd name, intf *rank, intf *dimsizes, intf *nt, intf *nattr, * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfgcal(intf *id, float64 *cal, float64 *cale, float64 *ioff, float64 *ioffe, intf *nt) { int32 nt32, status; @@ -736,7 +736,7 @@ nsfgcal(intf *id, float64 *cal, float64 *cale, float64 *ioff, float64 *ioffe, in * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfscal(intf *id, float64 *cal, float64 *cale, float64 *ioff, float64 *ioffe, intf *nt) { return (SDsetcal(*id, *cal, *cale, *ioff, *ioffe, *nt)); @@ -752,7 +752,7 @@ nsfscal(intf *id, float64 *cal, float64 *cale, float64 *ioff, float64 *ioffe, in * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfsdscale(intf *id, intf *count, intf *nt, void *values) { return (SDsetdimscale(*id, *count, *nt, values)); @@ -766,7 +766,7 @@ nsfsdscale(intf *id, intf *count, intf *nt, void *values) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfgdscale(intf *id, void *values) { return (SDgetdimscale(*id, values)); @@ -780,7 +780,7 @@ nsfgdscale(intf *id, void *values) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *----------------------------------------------------------*/ -FRETVAL(intf) +intf nsfscfill(intf *id, _fcd val) { return (nsfsfill(id, (void *)_fcdtocp(val))); @@ -794,7 +794,7 @@ nsfscfill(intf *id, _fcd val) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *-----------------------------------------------------------*/ -FRETVAL(intf) +intf nsfgcfill(intf *id, _fcd val) { return (nsfgfill(id, (void *)_fcdtocp(val))); @@ -808,7 +808,7 @@ nsfgcfill(intf *id, _fcd val) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfsfill(intf *id, void *val) { return (SDsetfillvalue(*id, val)); @@ -822,7 +822,7 @@ nsfsfill(intf *id, void *val) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *------------------------------------------------------*/ -FRETVAL(intf) +intf nsfgfill(intf *id, void *val) { return (SDgetfillvalue(*id, val)); @@ -837,7 +837,7 @@ nsfgfill(intf *id, void *val) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfgrange(intf *id, void *max, void *min) { return (SDgetrange(*id, max, min)); @@ -852,7 +852,7 @@ nsfgrange(intf *id, void *max, void *min) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfsrange(intf *id, void *max, void *min) { return (SDsetrange(*id, max, min)); @@ -866,7 +866,7 @@ nsfsrange(intf *id, void *max, void *min) * namelen: length of name * Returns: 0 on success, -1 on failure with error set *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscn2index(intf *id, _fcd name, intf *namelen) { char *fn; @@ -891,7 +891,7 @@ nscn2index(intf *id, _fcd name, intf *namelen) * differences * Returns: 0 on success, -1 on failure with error set *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsccreate(intf *id, _fcd name, intf *nt, intf *rank, intf *dims, intf *namelen) { char *fn; @@ -920,7 +920,7 @@ nsccreate(intf *id, _fcd name, intf *nt, intf *rank, intf *dims, intf *namelen) * label, unit and format strings and their lengths * Returns: 0 on success, -1 on failure with error set *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscsdimstr(intf *id, _fcd l, _fcd u, _fcd f, intf *ll, intf *ul, intf *fl) { char *lstr; @@ -960,7 +960,7 @@ nscsdimstr(intf *id, _fcd l, _fcd u, _fcd f, intf *ll, intf *ul, intf *fl) * name and its length * Returns: 0 on success, -1 on failure with error set *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscsdimname(intf *id, _fcd name, intf *len) { char *nstr; @@ -984,7 +984,7 @@ nscsdimname(intf *id, _fcd name, intf *len) * label, unit and format strings and their lengths * Returns: 0 on success, -1 on failure with error set *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscsdatstr(intf *id, _fcd l, _fcd u, _fcd f, _fcd c, intf *ll, intf *ul, intf *fl, intf *cl) { char *lstr; @@ -1034,7 +1034,7 @@ nscsdatstr(intf *id, _fcd l, _fcd u, _fcd f, _fcd c, intf *ll, intf *ul, intf *f * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfrcatt(intf *id, intf *index, _fcd buf) { return (nsfrnatt(id, index, (void *)_fcdtocp(buf))); @@ -1049,7 +1049,7 @@ nsfrcatt(intf *id, intf *index, _fcd buf) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfrnatt(intf *id, intf *index, void *buf) { return (SDreadattr(*id, *index, buf)); @@ -1064,7 +1064,7 @@ nsfrnatt(intf *id, intf *index, void *buf) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfrattr(intf *id, intf *index, void *buf) { return (nsfrnatt(id, index, buf)); @@ -1082,7 +1082,7 @@ nsfrattr(intf *id, intf *index, void *buf) * differences * Returns: 0 on success, -1 on failure with error set *----------------------------------------------------------*/ -FRETVAL(intf) +intf nsfrdata(intf *id, intf *start, intf *stride, intf *end, void *values) { intf ret; @@ -1119,7 +1119,7 @@ nsfrdata(intf *id, intf *start, intf *stride, intf *end, void *values) * differences * Returns: 0 on success, -1 on failure with error set *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfwdata(intf *id, intf *start, intf *stride, intf *end, void *values) { intf ret; @@ -1151,7 +1151,7 @@ nsfwdata(intf *id, intf *start, intf *stride, intf *end, void *values) * Returns: 0 on success, -1 on failure with DFerror set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscgdimstrs(intf *dim, _fcd label, _fcd unit, _fcd format, intf *llabel, intf *lunit, intf *lformat, intf *mlen) { @@ -1191,7 +1191,7 @@ nscgdimstrs(intf *dim, _fcd label, _fcd unit, _fcd format, intf *llabel, intf *l * differences * Returns: 0 on success, -1 on failure with error set *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfrcdata(intf *id, intf *start, intf *stride, intf *end, _fcd values) { return (nsfrdata(id, start, stride, end, (void *)_fcdtocp(values))); @@ -1209,7 +1209,7 @@ nsfrcdata(intf *id, intf *start, intf *stride, intf *end, _fcd values) * differences * Returns: 0 on success, -1 on failure with error set *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfwcdata(intf *id, intf *start, intf *stride, intf *end, _fcd values) { return (nsfwdata(id, start, stride, end, (void *)_fcdtocp(values))); @@ -1222,7 +1222,7 @@ nsfwcdata(intf *id, intf *start, intf *stride, intf *end, _fcd values) * Returns: 0 on success, -1 on failure with DFerror set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscgdatstrs(intf *id, _fcd label, _fcd unit, _fcd format, _fcd coord, intf *llabel, intf *lunit, intf *lformat, intf *lcoord, intf *len) { @@ -1265,7 +1265,7 @@ nscgdatstrs(intf *id, _fcd label, _fcd unit, _fcd format, _fcd coord, intf *llab * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscgainfo(intf *id, intf *number, _fcd name, intf *nt, intf *count, intf *len) { char *iname; @@ -1299,7 +1299,7 @@ nscgainfo(intf *id, intf *number, _fcd name, intf *nt, intf *count, intf *len) * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscgdinfo(intf *id, _fcd name, intf *sz, intf *nt, intf *nattr, intf *len) { char *iname; @@ -1335,7 +1335,7 @@ nscgdinfo(intf *id, _fcd name, intf *sz, intf *nt, intf *nattr, intf *len) * Remarks: * Returns: 0 on success, -1 on failure with error set *--------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscscatt(intf *id, _fcd name, intf *nt, intf *count, _fcd data, intf *len) { return (nscsnatt(id, name, nt, count, (void *)_fcdtocp(data), len)); @@ -1353,7 +1353,7 @@ nscscatt(intf *id, _fcd name, intf *nt, intf *count, _fcd data, intf *len) * Remarks: This routine and scscattr are used to replace scsattr * Returns: 0 on success, -1 on failure with error set *--------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscsnatt(intf *id, _fcd name, intf *nt, intf *count, void *data, intf *len) { char *an; @@ -1382,7 +1382,7 @@ nscsnatt(intf *id, _fcd name, intf *nt, intf *count, void *data, intf *len) * sfsattr declairs data as char *, scscatt assumes * data as void *. *--------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscsattr(intf *id, _fcd name, intf *nt, intf *count, void *data, intf *len) { char *an; @@ -1401,7 +1401,7 @@ nscsattr(intf *id, _fcd name, intf *nt, intf *count, void *data, intf *len) * name: name of attribute to find * Returns: attribute id on success, -1 on failure with error set *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscfattr(intf *id, _fcd name, intf *namelen) { char *fn; @@ -1421,7 +1421,7 @@ nscfattr(intf *id, _fcd name, intf *namelen) * Inputs: id: variable id * Returns: reference number of a NDG representing this dataset *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfid2ref(intf *id) { return ((intf)SDidtoref(*id)); @@ -1435,7 +1435,7 @@ nsfid2ref(intf *id) * ref: reference number to look up * Returns: reference number of a NDG representing this dataset *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfref2index(intf *id, intf *ref) { return ((intf)SDreftoindex(*id, (int32)*ref)); @@ -1448,7 +1448,7 @@ nsfref2index(intf *id, intf *ref) * Inputs: id: sds id * Returns: TRUE/FALSE *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfiscvar(intf *id) { return ((intf)SDiscoordvar(*id)); @@ -1464,7 +1464,7 @@ nsfiscvar(intf *id) * namelen: length of name * Returns: 0 on success, -1 on failure with error set *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscsextf(intf *id, _fcd name, intf *offset, intf *namelen) { char *fn; @@ -1488,7 +1488,7 @@ nscsextf(intf *id, _fcd name, intf *offset, intf *namelen) * fill_one: whether to fill the "background bits" with ones * Returns: 0 on success, -1 on failure with error set *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfsnbit(intf *id, intf *start_bit, intf *bit_len, intf *sign_ext, intf *fill_one) { return ((intf)SDsetnbitdataset((int32)*id, (intn)*start_bit, (intn)*bit_len, (intn)*sign_ext, @@ -1503,7 +1503,7 @@ nsfsnbit(intf *id, intf *start_bit, intf *bit_len, intf *sign_ext, intf *fill_on * Returns: 0 on success, FAIL on failure with error set * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfsacct(intf *id, intf *type) { return ((intf)SDsetaccesstype(*id, *type)); @@ -1521,7 +1521,7 @@ nsfsacct(intf *id, intf *type) * Returns: SUCCESS on success, FAIL on failure * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfsdmvc(intf *id, intf *compmode) { return ((intf)SDsetdimval_comp(*id, *compmode)); @@ -1538,7 +1538,7 @@ nsfsdmvc(intf *id, intf *compmode) FAIL (-1) for error. * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfisdmvc(intf *id) { return ((intf)SDisdimval_bwcomp(*id)); @@ -1557,7 +1557,7 @@ nsfisdmvc(intf *id) * FAIL (-1) for error. * Users: HDF Fortran programmers *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfsflmd(intf *id, intf *fillmode) { return ((intf)SDsetfillmode(*id, *fillmode)); @@ -1585,7 +1585,7 @@ nsfsflmd(intf *id, intf *fillmode) * Returns: 0 on success, -1 on failure with error set * Users: HDF Fortran programmers *-------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscgichnk(intf *id, intf *dim_length, intf *flags) { @@ -1662,7 +1662,7 @@ nscgichnk(intf *id, intf *dim_length, intf *flags) * If performance becomes an issue, use static cstart * Returns: 0 on success, -1 on failure with error set *----------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscrchnk(intf *id, intf *start, void *num_data) { intf ret; @@ -1708,7 +1708,7 @@ nscrchnk(intf *id, intf *start, void *num_data) * Reamrks: dimensions will be flipped in scrchnk function * Returns: 0 on success, -1 on failure with error set *----------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscrcchnk(intf *id, intf *start, _fcd char_data) { intf ret; @@ -1728,7 +1728,7 @@ nscrcchnk(intf *id, intf *start, _fcd char_data) * Calls: SDsetchunkcache * Returns: 0 on success, -1 on failure with error set *----------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscscchnk(intf *id, intf *maxcache, intf *flags) { intf ret; @@ -1763,7 +1763,7 @@ nscscchnk(intf *id, intf *maxcache, intf *flags) * Returns: 0 on success, -1 on failure with error set * Users: HDF Fortran programmers *-------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscschnk(intf *id, intf *dim_length, intf *comp_type, intf *comp_prm) { @@ -1866,7 +1866,7 @@ nscschnk(intf *id, intf *dim_length, intf *comp_type, intf *comp_prm) * If performance becomes an issue, use static cstart * Returns: 0 on success, -1 on failure with error set *----------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscwchnk(intf *id, intf *start, void *num_data) { intf ret; @@ -1913,7 +1913,7 @@ nscwchnk(intf *id, intf *start, void *num_data) * Reamrks: dimensions will be flipped in scrchnk function * Returns: 0 on success, -1 on failure with error set *----------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscwcchnk(intf *id, intf *start, _fcd char_data) { intf ret; @@ -1942,7 +1942,7 @@ nscwcchnk(intf *id, intf *start, _fcd char_data) * Returns: 0 on success, -1 on failure with error set * Users: HDF Fortran programmers *-------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscscompress(intf *id, intf *comp_type, intf *comp_prm) { @@ -2019,7 +2019,7 @@ nscscompress(intf *id, intf *comp_type, intf *comp_prm) * Returns: 0 on success, -1 on failure with error set * Users: HDF Fortran programmers *-------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscgcompress(intf *id, intf *comp_type, intf *comp_prm) { @@ -2091,7 +2091,7 @@ nscgcompress(intf *id, intf *comp_type, intf *comp_prm) * Inputs: id: sds id * Returns: TRUE/FALSE (1/0)) *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfisrcrd(intf *id) { return ((intf)SDisrecord(*id)); @@ -2104,7 +2104,7 @@ nsfisrcrd(intf *id) block_size: block size in bytes * Returns: SUCCEED/FAIL (0/-1) *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nsfsblsz(intf *id, intf *block_size) { return ((intf)SDsetblocksize(*id, *block_size)); @@ -2117,7 +2117,7 @@ nsfsblsz(intf *id, intf *block_size) flag: TRUE/FALSE flag * Returns: SUCCEED/FAIL (0/-1) *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscchempty(intf *id, intf *flag) { intn flag_c; @@ -2135,7 +2135,7 @@ nscchempty(intf *id, intf *flag) * namelen: length of file name * Returns: real length on success, -1 on failure *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscgetfname(intf *file_id, _fcd name, intf *namelen) { char *fn; @@ -2159,7 +2159,7 @@ nscgetfname(intf *file_id, _fcd name, intf *namelen) * Outputs: namelen: name length * Returns: 0 on success, -1 on failure *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscgetnamelen(intf *obj_id, intf *namelen) { intn ret; @@ -2181,7 +2181,7 @@ nscgetnamelen(intf *obj_id, intf *namelen) * 2 for dimension scale * Returns: 0 on success, -1 on failure *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscidtype(intf *obj_id, intf *obj_type) { intn ret = -1; @@ -2202,7 +2202,7 @@ nscidtype(intf *obj_id, intf *obj_type) * Inputs: req_max: requested max number of files * Returns: current max number of opened files on success, -1 on failure *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscrmaxopenf(intf *req_max) { intf cur_max; @@ -2218,7 +2218,7 @@ nscrmaxopenf(intf *req_max) * sys_limit: system limit on open files * Returns: 0 on success, -1 on failure *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscgmaxopenf(intf *cur_max, intf *sys_limit) { intf ret = 0; @@ -2238,7 +2238,7 @@ nscgmaxopenf(intf *cur_max, intf *sys_limit) * Outputs: cur_num: number of files currently being opened * Returns: 0 on success, -1 on failure *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscgnumopenf(intf *cur_num) { intf ret = 0; @@ -2263,7 +2263,7 @@ nscgnumopenf(intf *cur_num) * type_list: list of types * Returns: 0 on success, -1 on failure *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscn2indices(intf *sd_id, _fcd name, intf *namelen, intf *var_list, intf *type_list, intf *n_vars) { char *fn; @@ -2300,7 +2300,7 @@ nscn2indices(intf *sd_id, _fcd name, intf *namelen, intf *var_list, intf *type_l * Outputs: n_vars: number of data sets * Returns: 0 on success, -1 on failure *---------------------------------------------------------------------------*/ -FRETVAL(intf) +intf nscgnvars_byname(intf *sd_id, _fcd name, intf *namelen, intf *n_vars) { char *fn; diff --git a/mfhdf/fortran/mfsdf.h b/mfhdf/fortran/mfsdf.h index 5ec4e7a156..4ef7d75fbe 100644 --- a/mfhdf/fortran/mfsdf.h +++ b/mfhdf/fortran/mfsdf.h @@ -91,81 +91,77 @@ extern "C" { #define nscgnumopenf H4_F77_FUNC(scgnumopenf, SCGNUMOPENF) #define nscrmaxopenf H4_F77_FUNC(scrmaxopenf, SCRMAXOPENF) -HDFFCLIBAPI FRETVAL(intf) nscstart(_fcd name, intf *access, intf *namelen); -HDFFCLIBAPI FRETVAL(intf) - nscginfo(intf *id, _fcd name, intf *rank, intf *dimsizes, intf *nt, intf *nattr, intf *len); -HDFFCLIBAPI FRETVAL(intf) nscn2index(intf *id, _fcd name, intf *namelen); -HDFFCLIBAPI FRETVAL(intf) nsccreate(intf *id, _fcd name, intf *nt, intf *rank, intf *dims, intf *namelen); -HDFFCLIBAPI FRETVAL(intf) nscsdimstr(intf *id, _fcd l, _fcd u, _fcd f, intf *ll, intf *ul, intf *fl); -HDFFCLIBAPI FRETVAL(intf) nscsdimname(intf *id, _fcd name, intf *len); -HDFFCLIBAPI FRETVAL(intf) - nscsdatstr(intf *id, _fcd l, _fcd u, _fcd f, _fcd c, intf *ll, intf *ul, intf *fl, intf *cl); -HDFFCLIBAPI FRETVAL(intf) nscgdimstrs(intf *dim, _fcd label, _fcd unit, _fcd format, intf *llabel, - intf *lunit, intf *lformat, intf *mlen); -HDFFCLIBAPI FRETVAL(intf) nscgdatstrs(intf *id, _fcd label, _fcd unit, _fcd format, _fcd coord, intf *llabel, - intf *lunit, intf *lformat, intf *lcoord, intf *len); -HDFFCLIBAPI FRETVAL(intf) nscgainfo(intf *id, intf *number, _fcd name, intf *nt, intf *count, intf *len); -HDFFCLIBAPI FRETVAL(intf) nscgdinfo(intf *id, _fcd name, intf *sz, intf *nt, intf *nattr, intf *len); -HDFFCLIBAPI FRETVAL(intf) nscscatt(intf *id, _fcd name, intf *nt, intf *count, _fcd data, intf *len); -HDFFCLIBAPI FRETVAL(intf) nscsnatt(intf *id, _fcd name, intf *nt, intf *count, void *data, intf *len); -HDFFCLIBAPI FRETVAL(intf) nscsattr(intf *id, _fcd name, intf *nt, intf *count, void *data, intf *len); -HDFFCLIBAPI FRETVAL(intf) nscsextf(intf *id, _fcd name, intf *offset, intf *namelen); -HDFFCLIBAPI FRETVAL(intf) nscgichnk(intf *id, intf *dim_length, intf *flags); -HDFFCLIBAPI FRETVAL(intf) nscrcchnk(intf *id, intf *start, _fcd char_data); -HDFFCLIBAPI FRETVAL(intf) nscrchnk(intf *id, intf *start, void *num_data); -HDFFCLIBAPI FRETVAL(intf) nscscchnk(intf *id, intf *maxcache, intf *flags); -HDFFCLIBAPI FRETVAL(intf) nscschnk(intf *id, intf *dim_length, intf *comp_type, intf *comp_prm); -HDFFCLIBAPI FRETVAL(intf) nscwcchnk(intf *id, intf *start, _fcd char_data); -HDFFCLIBAPI FRETVAL(intf) nscwchnk(intf *id, intf *start, void *num_data); -HDFFCLIBAPI FRETVAL(intf) nscscompress(intf *id, intf *comp_type, intf *comp_prm); -HDFFCLIBAPI FRETVAL(intf) nscgcompress(intf *id, intf *comp_type, intf *comp_prm); -HDFFCLIBAPI FRETVAL(intf) nscfattr(intf *id, _fcd name, intf *namelen); -HDFFCLIBAPI FRETVAL(intf) nscchempty(intf *id, intf *flag); +HDFFCLIBAPI intf nscstart(_fcd name, intf *access, intf *namelen); +HDFFCLIBAPI intf nscginfo(intf *id, _fcd name, intf *rank, intf *dimsizes, intf *nt, intf *nattr, intf *len); +HDFFCLIBAPI intf nscn2index(intf *id, _fcd name, intf *namelen); +HDFFCLIBAPI intf nsccreate(intf *id, _fcd name, intf *nt, intf *rank, intf *dims, intf *namelen); +HDFFCLIBAPI intf nscsdimstr(intf *id, _fcd l, _fcd u, _fcd f, intf *ll, intf *ul, intf *fl); +HDFFCLIBAPI intf nscsdimname(intf *id, _fcd name, intf *len); +HDFFCLIBAPI intf nscsdatstr(intf *id, _fcd l, _fcd u, _fcd f, _fcd c, intf *ll, intf *ul, intf *fl, intf *cl); +HDFFCLIBAPI intf nscgdimstrs(intf *dim, _fcd label, _fcd unit, _fcd format, intf *llabel, intf *lunit, + intf *lformat, intf *mlen); +HDFFCLIBAPI intf nscgdatstrs(intf *id, _fcd label, _fcd unit, _fcd format, _fcd coord, intf *llabel, + intf *lunit, intf *lformat, intf *lcoord, intf *len); +HDFFCLIBAPI intf nscgainfo(intf *id, intf *number, _fcd name, intf *nt, intf *count, intf *len); +HDFFCLIBAPI intf nscgdinfo(intf *id, _fcd name, intf *sz, intf *nt, intf *nattr, intf *len); +HDFFCLIBAPI intf nscscatt(intf *id, _fcd name, intf *nt, intf *count, _fcd data, intf *len); +HDFFCLIBAPI intf nscsnatt(intf *id, _fcd name, intf *nt, intf *count, void *data, intf *len); +HDFFCLIBAPI intf nscsattr(intf *id, _fcd name, intf *nt, intf *count, void *data, intf *len); +HDFFCLIBAPI intf nscsextf(intf *id, _fcd name, intf *offset, intf *namelen); +HDFFCLIBAPI intf nscgichnk(intf *id, intf *dim_length, intf *flags); +HDFFCLIBAPI intf nscrcchnk(intf *id, intf *start, _fcd char_data); +HDFFCLIBAPI intf nscrchnk(intf *id, intf *start, void *num_data); +HDFFCLIBAPI intf nscscchnk(intf *id, intf *maxcache, intf *flags); +HDFFCLIBAPI intf nscschnk(intf *id, intf *dim_length, intf *comp_type, intf *comp_prm); +HDFFCLIBAPI intf nscwcchnk(intf *id, intf *start, _fcd char_data); +HDFFCLIBAPI intf nscwchnk(intf *id, intf *start, void *num_data); +HDFFCLIBAPI intf nscscompress(intf *id, intf *comp_type, intf *comp_prm); +HDFFCLIBAPI intf nscgcompress(intf *id, intf *comp_type, intf *comp_prm); +HDFFCLIBAPI intf nscfattr(intf *id, _fcd name, intf *namelen); +HDFFCLIBAPI intf nscchempty(intf *id, intf *flag); -HDFFCLIBAPI FRETVAL(intf) nscgnvars_byname(intf *sd_id, _fcd name, intf *namelen, intf *n_vars); -HDFFCLIBAPI FRETVAL(intf) - nscn2indices(intf *sd_id, _fcd name, intf *namelen, intf *var_list, intf *type_list, intf *n_vars); -HDFFCLIBAPI FRETVAL(intf) nscgnumopenf(intf *cur_num); -HDFFCLIBAPI FRETVAL(intf) nscgmaxopenf(intf *cur_max, intf *sys_limit); -HDFFCLIBAPI FRETVAL(intf) nscrmaxopenf(intf *req_max); -HDFFCLIBAPI FRETVAL(intf) nscidtype(intf *obj_id, intf *obj_type); -HDFFCLIBAPI FRETVAL(intf) nscgetnamelen(intf *obj_id, intf *namelen); -HDFFCLIBAPI FRETVAL(intf) nscgetfname(intf *file_id, _fcd name, intf *namelen); +HDFFCLIBAPI intf nscgnvars_byname(intf *sd_id, _fcd name, intf *namelen, intf *n_vars); +HDFFCLIBAPI intf nscn2indices(intf *sd_id, _fcd name, intf *namelen, intf *var_list, intf *type_list, + intf *n_vars); +HDFFCLIBAPI intf nscgnumopenf(intf *cur_num); +HDFFCLIBAPI intf nscgmaxopenf(intf *cur_max, intf *sys_limit); +HDFFCLIBAPI intf nscrmaxopenf(intf *req_max); +HDFFCLIBAPI intf nscidtype(intf *obj_id, intf *obj_type); +HDFFCLIBAPI intf nscgetnamelen(intf *obj_id, intf *namelen); +HDFFCLIBAPI intf nscgetfname(intf *file_id, _fcd name, intf *namelen); -HDFFCLIBAPI FRETVAL(intf) nsfend(intf *file_id); -HDFFCLIBAPI FRETVAL(intf) nsfendacc(intf *id); -HDFFCLIBAPI FRETVAL(intf) nsffinfo(intf *file_id, intf *datasets, intf *gattr); -HDFFCLIBAPI FRETVAL(intf) nsfselect(intf *file_id, intf *index); -HDFFCLIBAPI FRETVAL(intf) nsfdimid(intf *id, intf *index); -HDFFCLIBAPI FRETVAL(intf) - nsfgcal(intf *id, float64 *cal, float64 *cale, float64 *ioff, float64 *ioffe, intf *nt); -HDFFCLIBAPI FRETVAL(intf) - nsfscal(intf *id, float64 *cal, float64 *cale, float64 *ioff, float64 *ioffe, intf *nt); -HDFFCLIBAPI FRETVAL(intf) nsfsdscale(intf *id, intf *count, intf *nt, void *values); -HDFFCLIBAPI FRETVAL(intf) nsfgdscale(intf *id, void *values); -HDFFCLIBAPI FRETVAL(intf) nsfscfill(intf *id, _fcd val); -HDFFCLIBAPI FRETVAL(intf) nsfgcfill(intf *id, _fcd val); -HDFFCLIBAPI FRETVAL(intf) nsfsfill(intf *id, void *val); -HDFFCLIBAPI FRETVAL(intf) nsfgfill(intf *id, void *val); -HDFFCLIBAPI FRETVAL(intf) nsfgrange(intf *id, void *max, void *min); -HDFFCLIBAPI FRETVAL(intf) nsfsrange(intf *id, void *max, void *min); -HDFFCLIBAPI FRETVAL(intf) nsfrcatt(intf *id, intf *index, _fcd buf); -HDFFCLIBAPI FRETVAL(intf) nsfrnatt(intf *id, intf *index, void *buf); -HDFFCLIBAPI FRETVAL(intf) nsfrattr(intf *id, intf *index, void *buf); -HDFFCLIBAPI FRETVAL(intf) nsfrdata(intf *id, intf *start, intf *stride, intf *end, void *values); -HDFFCLIBAPI FRETVAL(intf) nsfwdata(intf *id, intf *start, intf *stride, intf *end, void *values); -HDFFCLIBAPI FRETVAL(intf) nsfrcdata(intf *id, intf *start, intf *stride, intf *end, _fcd values); -HDFFCLIBAPI FRETVAL(intf) nsfwcdata(intf *id, intf *start, intf *stride, intf *end, _fcd values); -HDFFCLIBAPI FRETVAL(intf) nsfid2ref(intf *id); -HDFFCLIBAPI FRETVAL(intf) nsfref2index(intf *id, intf *ref); -HDFFCLIBAPI FRETVAL(intf) nsfiscvar(intf *id); -HDFFCLIBAPI FRETVAL(intf) nsfsnbit(intf *id, intf *start_bit, intf *bit_len, intf *sign_ext, intf *fill_one); -HDFFCLIBAPI FRETVAL(intf) nsfsacct(intf *id, intf *type); -HDFFCLIBAPI FRETVAL(intf) nsfsdmvc(intf *id, intf *compmode); -HDFFCLIBAPI FRETVAL(intf) nsfisdmvc(intf *id); -HDFFCLIBAPI FRETVAL(intf) nsfsflmd(intf *id, intf *fillmode); -HDFFCLIBAPI FRETVAL(intf) nsfisrcrd(intf *id); -HDFFCLIBAPI FRETVAL(intf) nsfsblsz(intf *id, intf *block_size); +HDFFCLIBAPI intf nsfend(intf *file_id); +HDFFCLIBAPI intf nsfendacc(intf *id); +HDFFCLIBAPI intf nsffinfo(intf *file_id, intf *datasets, intf *gattr); +HDFFCLIBAPI intf nsfselect(intf *file_id, intf *index); +HDFFCLIBAPI intf nsfdimid(intf *id, intf *index); +HDFFCLIBAPI intf nsfgcal(intf *id, float64 *cal, float64 *cale, float64 *ioff, float64 *ioffe, intf *nt); +HDFFCLIBAPI intf nsfscal(intf *id, float64 *cal, float64 *cale, float64 *ioff, float64 *ioffe, intf *nt); +HDFFCLIBAPI intf nsfsdscale(intf *id, intf *count, intf *nt, void *values); +HDFFCLIBAPI intf nsfgdscale(intf *id, void *values); +HDFFCLIBAPI intf nsfscfill(intf *id, _fcd val); +HDFFCLIBAPI intf nsfgcfill(intf *id, _fcd val); +HDFFCLIBAPI intf nsfsfill(intf *id, void *val); +HDFFCLIBAPI intf nsfgfill(intf *id, void *val); +HDFFCLIBAPI intf nsfgrange(intf *id, void *max, void *min); +HDFFCLIBAPI intf nsfsrange(intf *id, void *max, void *min); +HDFFCLIBAPI intf nsfrcatt(intf *id, intf *index, _fcd buf); +HDFFCLIBAPI intf nsfrnatt(intf *id, intf *index, void *buf); +HDFFCLIBAPI intf nsfrattr(intf *id, intf *index, void *buf); +HDFFCLIBAPI intf nsfrdata(intf *id, intf *start, intf *stride, intf *end, void *values); +HDFFCLIBAPI intf nsfwdata(intf *id, intf *start, intf *stride, intf *end, void *values); +HDFFCLIBAPI intf nsfrcdata(intf *id, intf *start, intf *stride, intf *end, _fcd values); +HDFFCLIBAPI intf nsfwcdata(intf *id, intf *start, intf *stride, intf *end, _fcd values); +HDFFCLIBAPI intf nsfid2ref(intf *id); +HDFFCLIBAPI intf nsfref2index(intf *id, intf *ref); +HDFFCLIBAPI intf nsfiscvar(intf *id); +HDFFCLIBAPI intf nsfsnbit(intf *id, intf *start_bit, intf *bit_len, intf *sign_ext, intf *fill_one); +HDFFCLIBAPI intf nsfsacct(intf *id, intf *type); +HDFFCLIBAPI intf nsfsdmvc(intf *id, intf *compmode); +HDFFCLIBAPI intf nsfisdmvc(intf *id); +HDFFCLIBAPI intf nsfsflmd(intf *id, intf *fillmode); +HDFFCLIBAPI intf nsfisrcrd(intf *id); +HDFFCLIBAPI intf nsfsblsz(intf *id, intf *block_size); #ifdef __cplusplus } From af34bdd5a5599cc417a070ce3f16b681baa50628 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 12 Feb 2024 22:12:15 -0800 Subject: [PATCH 10/65] Moves some things from hdfi.h to hdf.h (#520) Some things in hdfi.h, like the C99-like types, need to be in the public API and should be in hdf.h. --- hdf/src/hdf.h | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++ hdf/src/hdfi.h | 73 -------------------------------------------------- hdf/src/tbbt.h | 2 ++ 3 files changed, 75 insertions(+), 73 deletions(-) diff --git a/hdf/src/hdf.h b/hdf/src/hdf.h index 4c3600b2fc..b73e7315bc 100644 --- a/hdf/src/hdf.h +++ b/hdf/src/hdf.h @@ -17,6 +17,46 @@ #include "hdfi.h" #include "hlimits.h" +/*------------------------------------------------------------------------- + * Pre-C99 platform-independent type scheme + * + * These types were added long before C99 was widely supported (or even + * existed). They were formerly mapped to native C types on a machine-specific + * basis, but they are now mapped to their equivalent C99 types. + *-------------------------------------------------------------------------*/ + +/* Floating-point types */ +typedef float float32; +typedef double float64; + +/* Characters */ +typedef char char8; +typedef unsigned char uchar8; +typedef char *_fcd; +#define _fcdtocp(desc) (desc) + +/* Fixed-width integer types */ +typedef int8_t int8; +typedef uint8_t uint8; +typedef int16_t int16; +typedef uint16_t uint16; +typedef int32_t int32; +typedef uint32_t uint32; + +/* Native integer types */ +typedef int intn; +typedef unsigned int uintn; + +/* These are no longer used in the library, but other software uses them */ +#ifndef VOID +/* winnt.h defines VOID to `void` via a macro */ +typedef void VOID; +#endif +typedef void *VOIDP; + +/* size of INTEGERs in Fortran compiler */ +typedef int intf; + /* Internal DF structure */ typedef struct { uint16 tag; /* tag of element */ @@ -149,4 +189,37 @@ typedef intn (*hdf_termfunc_t)(void); /* termination function typedef */ /* This is also defined in fmpio.h */ #define MP_PAGEALL 0x01 /* page the whole file i.e. no limit on 'maxcache'*/ +/************************************************************************** + * Memory and string functions + **************************************************************************/ + +/* DO NOT USE THESE MACROS */ + +/* These will be removed from a future version of the library and are + * only kept here to avoid breakage in programs that unwisely used + * them. + */ + +#define HDmalloc(s) malloc(s) +#define HDcalloc(a, b) calloc(a, b) +#define HDfree(p) free(p) +#define HDrealloc(p, s) realloc(p, s) + +/* Macro to free space and clear pointer to NULL */ +#define HDfreenclear(p) \ + { \ + free(p); \ + (p) = NULL; \ + } + +#define HDstrcat(s1, s2) (strcat((s1), (s2))) +#define HDstrcmp(s, t) (strcmp((s), (t))) +#define HDstrcpy(s, d) (strcpy((s), (d))) +#define HDstrlen(s) (strlen((const char *)(s))) +#define HDstrncmp(s1, s2, n) (strncmp((s1), (s2), (n))) +#define HDstrncpy(s1, s2, n) (strncpy((s1), (s2), (n))) +#define HDstrchr(s, c) (strchr((s), (c))) +#define HDstrrchr(s, c) (strrchr((s), (c))) +#define HDstrtol(s, e, b) (strtol((s), (e), (b))) + #endif /* H4_HDF_H */ diff --git a/hdf/src/hdfi.h b/hdf/src/hdfi.h index 379f07230a..ee9cc63b97 100644 --- a/hdf/src/hdfi.h +++ b/hdf/src/hdfi.h @@ -109,43 +109,6 @@ #include #endif -/*------------------------------------------------------------------------- - * Pre-C99 platform-independent type scheme - * - * These types were added long before C99 was widely supported (or even - * existed). They were formerly mapped to native C types on a machine-specific - * basis, but they are now mapped to their equivalent C99 types. - *-------------------------------------------------------------------------*/ - -/* Floating-point types */ -typedef float float32; -typedef double float64; - -/* Characters */ -typedef char char8; -typedef unsigned char uchar8; -typedef char *_fcd; -#define _fcdtocp(desc) (desc) - -/* Fixed-width integer types */ -typedef int8_t int8; -typedef uint8_t uint8; -typedef int16_t int16; -typedef uint16_t uint16; -typedef int32_t int32; -typedef uint32_t uint32; - -/* Native integer types */ -typedef int intn; -typedef unsigned int uintn; - -/* These are no longer used in the library, but other software uses them */ -#ifndef VOID -/* winnt.h defines VOID to `void` via a macro */ -typedef void VOID; -#endif -typedef void *VOIDP; - /*------------------------------------------------------------------------- * Is this an LP64 system? *-------------------------------------------------------------------------*/ @@ -157,9 +120,6 @@ typedef void *VOIDP; * Fortran definitions *-------------------------------------------------------------------------*/ -/* size of INTEGERs in Fortran compiler */ -typedef int intf; - /* Integer that is the same size as a pointer */ typedef intptr_t hdf_pint_t; @@ -279,39 +239,6 @@ typedef intptr_t hdf_pint_t; #define MAX(a, b) (((a) > (b)) ? (a) : (b)) #endif -/************************************************************************** - * Memory and string functions - **************************************************************************/ - -/* DO NOT USE THESE MACROS */ - -/* These will be removed from a future version of the library and are - * only kept here to avoid breakage in programs that unwisely used - * them. - */ - -#define HDmalloc(s) malloc(s) -#define HDcalloc(a, b) calloc(a, b) -#define HDfree(p) free(p) -#define HDrealloc(p, s) realloc(p, s) - -/* Macro to free space and clear pointer to NULL */ -#define HDfreenclear(p) \ - { \ - free(p); \ - (p) = NULL; \ - } - -#define HDstrcat(s1, s2) (strcat((s1), (s2))) -#define HDstrcmp(s, t) (strcmp((s), (t))) -#define HDstrcpy(s, d) (strcpy((s), (d))) -#define HDstrlen(s) (strlen((const char *)(s))) -#define HDstrncmp(s1, s2, n) (strncmp((s1), (s2), (n))) -#define HDstrncpy(s1, s2, n) (strncpy((s1), (s2), (n))) -#define HDstrchr(s, c) (strchr((s), (c))) -#define HDstrrchr(s, c) (strrchr((s), (c))) -#define HDstrtol(s, e, b) (strtol((s), (e), (b))) - /************************************************************************** * JPEG #define's - Look in the JPEG docs before changing - (Q) **************************************************************************/ diff --git a/hdf/src/tbbt.h b/hdf/src/tbbt.h index d83d3a8619..c98cb8d540 100644 --- a/hdf/src/tbbt.h +++ b/hdf/src/tbbt.h @@ -19,6 +19,8 @@ #include "H4api_adpt.h" +#include "hdf.h" + typedef struct tbbt_node TBBT_NODE; /* Threaded node structure */ From bb9febaa1eab1e5a8986a8a7c3b85913ed637b96 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 13 Feb 2024 11:47:40 -0600 Subject: [PATCH 11/65] Update and add INSTALL files and versions in docs (#522) --- HDF4Examples/Using_CMake.txt | 8 +- README.md | 2 +- config/cmake/scripts/HDF4config.cmake | 4 +- release_notes/INSTALL | 211 +++++-------------------- release_notes/INSTALL_Auto.txt | 147 +++++++++++++++++ release_notes/INSTALL_CMake.txt | 152 ++++++++++-------- release_notes/INSTALL_WINDOWS.txt | 14 ++ release_notes/USING_CMake_Examples.txt | 4 +- release_notes/USING_HDF4_CMake.txt | 10 +- release_notes/USING_HDF4_VS.txt | 4 +- 10 files changed, 295 insertions(+), 261 deletions(-) create mode 100644 release_notes/INSTALL_Auto.txt diff --git a/HDF4Examples/Using_CMake.txt b/HDF4Examples/Using_CMake.txt index ce861920e8..3455897c4a 100644 --- a/HDF4Examples/Using_CMake.txt +++ b/HDF4Examples/Using_CMake.txt @@ -29,7 +29,7 @@ I. Preconditions ======================================================================== 1. We suggest you obtain the latest CMake for windows from the Kitware - web site. The HDF 4.2.x product requires a minimum CMake version + web site. The HDF 4.3.x product requires a minimum CMake version of 3.12. 2. You have installed the HDF4 library built with CMake, by executing @@ -40,7 +40,7 @@ I. Preconditions 3. Set the environment variable HDF4_DIR to the installed location of the config files for HDF4. On Windows: - HDF4_ROOT=C:/Program Files/HDF_Group/HDF/4.2.x/ + HDF4_ROOT=C:/Program Files/HDF_Group/HDF/4.3.x/ (Note there are no quote characters used on Windows and all platforms use forward slashes) @@ -180,11 +180,11 @@ III. Using HDF4 Libraries with Visual Studio 2008 (no longer supported) and select "x64". 1.2 Find the box "Show directories for", choose "Include files", add the - header path (i.e. c:\Program Files\HDF Group\HDF4\hdf4.2.x\include) + header path (i.e. c:\Program Files\HDF Group\HDF4\hdf4.3.x\include) to the included directories. 1.3 Find the box "Show directories for", choose "Library files", add the - library path (i.e. c:\Program Files\HDF Group\HDF4\hdf4.2.x\lib) + library path (i.e. c:\Program Files\HDF Group\HDF4\hdf4.3.x\lib) to the library directories. 1.4 If using Fortran libraries, you will also need to setup the path diff --git a/README.md b/README.md index ea91c6334c..0cdb0454be 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ HDF 4.3.0 (February 2024) * We will no longer deploy undocumented, internal header files (the public, documented HDF4 API will not be affected) The 4.2 maintenance line will be retired when 4.3.0 releases. There are no -more planned HDF4 4.2.x releases. +more planned HDF4 4.3.x releases. HDF 4.4.0 (February 2025) * We will drop support for FORTRAN 77 and move to modern Fortran (2003 or 2008) diff --git a/config/cmake/scripts/HDF4config.cmake b/config/cmake/scripts/HDF4config.cmake index 038e361c71..eb7db3397b 100755 --- a/config/cmake/scripts/HDF4config.cmake +++ b/config/cmake/scripts/HDF4config.cmake @@ -37,9 +37,9 @@ set (CTEST_SOURCE_VERSEXT "-1, currently under development") ############################################################################## # handle input parameters to script. #BUILD_GENERATOR - which CMake generator to use, required -#INSTALLDIR - HDF-4.2.x root folder +#INSTALLDIR - HDF-4.3.x root folder #CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo -#CTEST_SOURCE_NAME - name of source folder; HDF-4.2.x +#CTEST_SOURCE_NAME - name of source folder; HDF-4.3.x #STATIC_ONLY - Default is YES #FORTRAN_LIBRARIES - Default is NO #NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac diff --git a/release_notes/INSTALL b/release_notes/INSTALL index f31bd68541..afd618f44b 100644 --- a/release_notes/INSTALL +++ b/release_notes/INSTALL @@ -1,192 +1,53 @@ +************************************************************************* +* Installation Instructions for HDF4 * +************************************************************************* - Installation Instructions for HDF4 on Unix and Mac OSX Platforms - =================================================================== +Instructions for the Installation of HDF4 Software +================================================== -CONTENTS - -1. Third-party Software Requirements -2. Optional Szip Compression Library -3. HDF4 Source Code and Precompiled Binaries -4. Unix and Mac OSX Configuration and Build -5. Using HDF/MFHDF Libraries with the netCDF Library (libnetcdf.a) - - - -1. Third-party Software Requirements - ================================= - -C and Fortran compilers. If a Fortran compiler is not available, use -the --disable-fortran configure flag to build the HDF4 C library and -utilities. For the list of the supported compilers see RELEASE.txt in the -release_notes directory. - -JPEG Distribution Release 6b or later (libjpeg.a(so)). The source code can -be downloaded from http://www.ijg.org/. - -ZLIB 1.1.4(libz.a) or later. The software can be downloaded from: https://zlib.net/ - - - -2. Optional Szip Compression Library - ================================= - -HDF4 may be configured to use the Szip compression library. For more -information about the Szip library, see: - - https://portal.hdfgroup.org/display/HDF4/Szip+Compression+in+HDF+Products - -The Szip compression library is free for non-commercial use. For information -regarding commercial use, see: - - https://portal.hdfgroup.org/display/HDF4/Szip+Copyright+and+License+Statement%2C+as+Distributed+in+the+HDF+Source+Code - - - -3. HDF4 Source Code and Precompiled Binaries - ========================================= - -The HDF Group provides source code and pre-compiled binaries from the -HDF4 download page: - - https://portal.hdfgroup.org/display/support/Download+HDF4 - -As of HDF 4.2.6, binaries are packed with the ZLIB, JPEG, and Szip libraries -that were used to build the binaries. - -HDF4 pre-built utilities come with Szip compression. To use these binaries, -you must install the Szip library on your system. - -To build the Szip library, follow the instructions in the Szip source code -distribution, which can be obtained from: - - https://portal.hdfgroup.org/display/HDF4/Szip+Compression+in+HDF+Products - - - -4. Unix and Mac OSX Configuration and Build - ======================================= - -See RELEASE.txt in the release_notes/ directory for the list of platforms -tested for this release. - -Before You Start: +This file provides instructions for installing the HDF4 software. - 1) Make sure that the ZLIB and JPEG libraries are installed on your - system. +For help with installing, questions can be posted to the HDF Forum or sent to the HDF Helpdesk: - 2) Optional: Install the Szip version 2.1 library (you may use - Szip 2.0 binaries). + HDF Forum: https://forum.hdfgroup.org/ + HDF Helpdesk: https://hdfgroup.atlassian.net/servicedesk/customer/portals - 3) Extract the source from the hdf-X.Y.Z.tar file and change - directory to hdf-X.Y.Z. - - 4) Fortran Notes: - 4.a) g77 may require compiler flag, FFLAGS, "-fno-second-underscore" - -To Configure: - - 4) Use the configure command in the top level HDF4 directory hdf-X.Y.Z: - - ./configure --with-zlib=/path_to_ZLIB_install_directory - --with-jpeg=/path_to_JPEG_install_directory - [--with-szlib=/path_to_SZIP_install_directory] - --prefix=/path_to_HDF4_install_directory - - * Please note that when the szlib option is not used, the Szip - library will not be configured in and Szip compression will not - be enabled. - * If your system has the ZLIB and/or JPEG libraries installed under a - system library directory (such as /usr/lib), configure will - automatically find the library. In this case, the corresponding - configure flag may be omitted. - * Note that --prefix defines where the installation path is. - The default is set as /hdf4. - -To Build and Test: - - 5) To build the library: - - gmake >& gmake.out - - 6) To build and run the tests: - - gmake check >& check.out - -To Install: - - 7) To install the HDF4 library and tools: - - gmake install - - 8) To install C and Fortran examples: - - gmake install-examples - - 9) To test the installation: - - gmake installcheck - - 10) By default, the current configuration uses vendor compilers; to use - another compiler, run the following commands before running configure: - - setenv CC "foo -flags" - setenv F77 "fffoo -flags" - - See the configure help page (configure --help) for a list of - environment variables that have an affect on building the library. - - 11) You may build HDF4 in a directory other than hdf-X.Y.Z by using - the "srcdir" option. Simply create a build directory and type: - - /configure ... - - where "..." are your configuration options. - - - -5. Using HDF/MFHDF Libraries with the netCDF Library (libnetcdf.a) - =============================================================== - - To use the HDF/MFHDF libraries (libdf.a, libmfhdf.a) with the - netCDF library (libnetcdf.a), the HDF4 distribution must be configured - with the --disable-netcdf configuration flag. - - When this flag is used, the HDF versions of the C netCDF functions - (as of netCDF version 2.3.2) are renamed from ncxxx to sd_ncxxx, - and HDF Fortran netCDF wrappers are disabled to avoid name clashes with - the netCDF C and Fortran functions from libnetcdf.a. +CONTENTS +-------- + 1. Obtaining HDF4 + 2. Third-party Software Requirements + 3. Optional Szip Compression Library + 4. HDF4 Source Code and Precompiled Binaries + 5. Build and Install HDF4 on Unix and Mac OSX Platforms with autotools + 6. Build and Install HDF4 C and Fortran Libraries and tools with CMake - Please report all problems to help@hdfgroup.org. -6. Windows Configuration and Build - =============================== +***************************************************************************** -See RELEASE.txt in the release_notes/ directory for the list of platforms -tested for this release. +1. Obtaining HDF4 + The latest supported public releases of HDF4 are available on + https://github.com/HDFGroup/hdf4. -We now recommend that users build, test, and install HDF4 using CMake. +2. Third-party Software Requirements + JPEG Distribution Release 6b or later. The source code can + be downloaded from "https://www.ijg.org/filesz". -Instructions for building and testing HDF4 using CMake can be found in the -INSTALL_CMake.txt file found in this folder. + ZLIB 1.1.4 or later. The software can be downloaded from: "https://github.com/madler/zlib.git" -For instructions on building and testing an application with HDF4, see the -USING_HDF4_CMake.txt file found in this folder. +3. Optional Szip Compression Library + HDF4 may be configured to use the Szip compression library. The + open source software can be downloaded from: "https://github.com/MathisRosenhauer/libaec.git" -Users who want to build and run an application with HDF4 in Visual Studio -without using CMake should consult the USING_HDF4_VS.txt file. +4. HDF4 Source Code and Precompiled Binaries + The HDF Group provides source code and pre-compiled binaries from the + HDF4 github releases page: -Additional Third-party Software Requirements: + https://github.com/HDFGroup/hdf4/releases - 1) Flex and Bison programs are required to regenerate the ncgen parsers. - This is not required to build the library and is only necessary if you - change the input files. - - 2) The Win flex-bison project, a port of Flex & Bison tools - to the Windows platform, is recommended. Download from: - http://sourceforge.net/projects/winflexbison +5. Build and Install HDF4 on Unix and Mac OSX Platforms with autotools + see the release_notes/INSTALL_Autotools.txt file. - 3) CMake version 2.8.11.1 or higher is needed to use Win flex-bison. - Using an earlier version of CMake will require renaming the executables - without the "win_" prefix. +6. Build and Install HDF4 C and Fortran Libraries and tools with CMake + see the release_notes/INSTALL_CMake.txt file. diff --git a/release_notes/INSTALL_Auto.txt b/release_notes/INSTALL_Auto.txt new file mode 100644 index 0000000000..38f0d23f7c --- /dev/null +++ b/release_notes/INSTALL_Auto.txt @@ -0,0 +1,147 @@ +************************************************************************* +* Installation Instructions for HDF4 using Autotools * +************************************************************************* + + Table of Contents + +Section I. Preconditions +Section II: Unix and Mac OSX Configuration and Build +Section III: Using HDF/MFHDF Libraries with the netCDF Library +Section IV: Windows Configuration and Build + +************************************************************************ + +For help with installing, questions can be posted to the HDF Forum or sent to the HDF Helpdesk: + + HDF Forum: https://forum.hdfgroup.org/ + HDF Helpdesk: https://hdfgroup.atlassian.net/servicedesk/customer/portals + + +======================================================================== +I. Preconditions +======================================================================== +Obtaining HDF4 source code + 1. Create a directory for your development; for example, "myhdfstuff". + + 2. Obtain HDF4 source from Github + development branch: https://github.com/HDFGroup/hdf4 + last release: https://github.com/HDFGroup/hdf4/releases/latest + hdf-4_3_"X".tar.gz or hdf-4_3_"X".zip + + and put it in "myhdfstuff". + Uncompress the file. There should be a hdf-4.3."X" folder. + + +======================================================================== +II. Unix and Mac OSX Configuration and Build +======================================================================== + +See RELEASE.txt in the release_notes/ directory for the list of platforms +tested for this release. + +Before You Start: + + 1) Make sure that the ZLIB and JPEG libraries are installed on your + system. + + 2) Optional: Install the Szip version 2.1 library (you may use + Szip 2.0 binaries). + + 3) Extract the source from the hdf-X.Y.Z.tar file and change + directory to hdf-X.Y.Z. + + 4) Fortran Notes: + 4.a) g77 may require compiler flag, FFLAGS, "-fno-second-underscore" + +To Configure: + + 4) Use the configure command in the top level HDF4 directory hdf-X.Y.Z: + + ./configure --with-zlib=/path_to_ZLIB_install_directory + --with-jpeg=/path_to_JPEG_install_directory + [--with-szlib=/path_to_SZIP_install_directory] + --prefix=/path_to_HDF4_install_directory + + * Please note that when the szlib option is not used, the Szip + library will not be configured in and Szip compression will not + be enabled. + * If your system has the ZLIB and/or JPEG libraries installed under a + system library directory (such as /usr/lib), configure will + automatically find the library. In this case, the corresponding + configure flag may be omitted. + * Note that --prefix defines where the installation path is. + The default is set as /hdf4. + +To Build and Test: + + 5) To build the library: + + gmake >& gmake.out + + 6) To build and run the tests: + + gmake check >& check.out + +To Install: + + 7) To install the HDF4 library and tools: + + gmake install + + 8) To install C and Fortran examples: + + gmake install-examples + + 9) To test the installation: + + gmake installcheck + + 10) By default, the current configuration uses vendor compilers; to use + another compiler, run the following commands before running configure: + + setenv CC "foo -flags" + setenv F77 "fffoo -flags" + + See the configure help page (configure --help) for a list of + environment variables that have an affect on building the library. + + 11) You may build HDF4 in a directory other than hdf-X.Y.Z by using + the "srcdir" option. Simply create a build directory and type: + + /configure ... + + where "..." are your configuration options. + + +======================================================================== +III. Using HDF/MFHDF Libraries with the netCDF Library +======================================================================== + To use the HDF/MFHDF libraries (libdf.a, libmfhdf.a) with the + netCDF library (libnetcdf.a), the HDF4 distribution must be configured + with the --disable-netcdf configuration flag. + + When this flag is used, the HDF versions of the C netCDF functions + (as of netCDF version 2.3.2) are renamed from ncxxx to sd_ncxxx, + and HDF Fortran netCDF wrappers are disabled to avoid name clashes with + the netCDF C and Fortran functions from libnetcdf.a. + + Please report all problems to help@hdfgroup.org. + + +======================================================================== +IV. Windows Configuration and Build +======================================================================== +See RELEASE.txt in the release_notes/ directory for the list of platforms +tested for this release. + +We now recommend that users build, test, and install HDF4 using CMake. + +Instructions for building and testing HDF4 using CMake can be found in the +INSTALL_CMake.txt file found in this folder. + +For instructions on building and testing an application with HDF4, see the +USING_HDF4_CMake.txt file found in this folder. + +Users who want to build and run an application with HDF4 in Visual Studio +without using CMake should consult the USING_HDF4_VS.txt file. + diff --git a/release_notes/INSTALL_CMake.txt b/release_notes/INSTALL_CMake.txt index f5426a7020..2ab720c7d5 100644 --- a/release_notes/INSTALL_CMake.txt +++ b/release_notes/INSTALL_CMake.txt @@ -1,5 +1,5 @@ ************************************************************************* -* Build and Install HDF4 C and Fortran Libraries and tools with CMake * +* Build and Install HDF4 C and Fortran Libraries and tools with CMake * ************************************************************************* Table of Contents @@ -12,6 +12,7 @@ Section V: Options for building HDF4 Libraries with CMake command line Section VI: CMake option defaults for HDF4 Section VII: User Defined Options for HDF4 Libraries with CMake Section VIII: Using CMakePresets.json for compiling +Section IX: Autotools Configuration and Build ************************************************************************ @@ -22,8 +23,11 @@ I. Preconditions Obtaining HDF4 source code 1. Create a directory for your development; for example, "myhdfstuff". - 2. Obtain compressed (*.tar or *.zip) HDF4 source from - https://portal.hdfgroup.org/display/support/Building+HDF4+with+CMake + 2. Obtain HDF4 source from Github + development branch: https://github.com/HDFGroup/hdf4 + last release: https://github.com/HDFGroup/hdf4/releases/latest + hdf-4_3_"X".tar.gz or hdf-4_3_"X".zip + and put it in "myhdfstuff". Uncompress the file. There should be a hdf-4.2."X" folder. @@ -53,7 +57,7 @@ The following files referenced below are available at the HDF web site: https://portal.hdfgroup.org/display/support/Building+HDF4+with+CMake Single compressed file with all the files needed, including source: - CMake-hdf-4.2.X.zip or CMake-hdf-4.2.X.tar.gz + CMake-hdf-4.3.X.zip or CMake-hdf-4.3.X.tar.gz Individual files included in the above mentioned compressed files ----------------------------------------------- @@ -66,9 +70,6 @@ External compression szip and zlib libraries: SZip.tar.gz ZLib.tar.gz -Examples Source package: - HDF4Examples-3.x-Source.tar.gz - Configuration files: HDF4config.cmake HDF4options.cmake @@ -80,10 +81,10 @@ To build HDF4 with the SZIP, ZLIB and JPEG external libraries you will need to: 1. Change to the development directory "myhdfstuff". - 2. Download the CMake-hdf-4.2.X.zip(.tar.gz) file to "myhdfstuff". + 2. Download the CMake-hdf-4.3.X.zip(.tar.gz) file to "myhdfstuff". Uncompress the file. - 3. Change to the source directory "hdf-4.2.x". + 3. Change to the source directory "hdf-4.3.x". CTestScript.cmake file should not be modified. 4. Edit the platform configuration file, HDF4options.cmake, if you want to change @@ -115,7 +116,7 @@ To build HDF4 with the SZIP, ZLIB and JPEG external libraries you will need to: The command above will configure, build, test, and create an install package in the myhdfstuff folder. It will have the format: - HDF-4.2.NN-. + HDF-4.3.NN-. On Unix, will be "Linux". A similar .sh file will also be created. On Windows, will be "win64" or "win32". If you have an @@ -136,13 +137,13 @@ To build HDF4 with the SZIP, ZLIB and JPEG external libraries you will need to: 6. To install, "X" is the current release version On Windows (with WiX installed), execute: - HDF-4.2."X"-win32.exe or HDF-4.2."X"-win64.exe + HDF-4.3."X"-win32.exe or HDF-4.3."X"-win64.exe By default this program will install the hdf4 library into the "C:\Program Files" directory and will create the following directory structure: HDF_Group --HDF - ----4.2."X" + ----4.3."X" ------bin ------include ------lib @@ -150,17 +151,17 @@ To build HDF4 with the SZIP, ZLIB and JPEG external libraries you will need to: On Linux, change to the install destination directory (create it if doesn't exist) and execute: - /myhdfstuff/HDF-4.2."X"-Linux.sh + /myhdfstuff/HDF-4.3."X"-Linux.sh After accepting the license, the script will prompt: By default the HDF4 will be installed in: - "/HDF-4.2."X"-Linux" - Do you want to include the subdirectory HDF-4.2."X"-Linux? + "/HDF-4.3."X"-Linux" + Do you want to include the subdirectory HDF-4.3."X"-Linux? Saying no will install in: "" [Yn]: Note that the script will create the following directory structure relative to the install point: HDF_Group --HDF - ----4.2."X" + ----4.3."X" ------bin ------include ------lib @@ -171,19 +172,19 @@ To build HDF4 with the SZIP, ZLIB and JPEG external libraries you will need to: there will be a folder with the following structure: HDF_Group --HDF - ----4.2."X" + ----4.3."X" ------bin ------include ------lib ------share By default the installation will create the bin, include, lib and cmake - folders in the /HDF_Group/HDF/4.2."X" + folders in the /HDF_Group/HDF/4.3."X" The depends on the build platform; Windows will set the default to: - C:/Program Files/HDF_Group/HDF/4.2."X" + C:/Program Files/HDF_Group/HDF/4.3."X" Linux will set the default to: - "myhdfstuff/HDF_Group/HDF/4.2."X" + "myhdfstuff/HDF_Group/HDF/4.3."X" The default can be changed by adding ",INSTALLDIR=" to the "ctest -S HDF4config.cmake..." command. For example on linux: ctest -S HDF4config.cmake,INSTALLDIR=/usr/local/myhdf4,BUILD_GENERATOR=Unix -C Release -VV -O hdf4.log @@ -210,10 +211,10 @@ Notes: This short set of instructions is written for users who want to 5. Configure the C library, tools and tests with one of the following commands: On Windows 32 bit - cmake -G "Visual Studio 12 2013" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_TESTING:BOOL=ON -DHDF4_BUILD_TOOLS:BOOL=ON ..\hdf-4.2."X" + cmake -G "Visual Studio 16 2019" -A Win32 -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_TESTING:BOOL=ON -DHDF4_BUILD_TOOLS:BOOL=ON ..\hdf-4.2."X" On Windows 64 bit - cmake -G "Visual Studio 12 2013 Win64" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_TESTING:BOOL=ON -DHDF4_BUILD_TOOLS:BOOL=ON ..\hdf-4.2."X" + cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_TESTING:BOOL=ON -DHDF4_BUILD_TOOLS:BOOL=ON ..\hdf-4.2."X" On Linux and Mac cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_TESTING:BOOL=ON -DHDF4_BUILD_TOOLS:BOOL=ON ../hdf-4.2."X" @@ -231,13 +232,13 @@ Notes: This short set of instructions is written for users who want to 9. To install On Windows (with WiX installed), execute: - HDF-4.2."X"-win32.msi or HDF-4.2."X"-win64.msi + HDF-4.3."X"-win32.msi or HDF-4.3."X"-win64.msi By default this program will install the hdf4 library into the "C:\Program Files" directory and will create the following directory structure: HDF_Group --HDF - ----4.2."X" + ----4.3."X" ------bin ------include ------lib @@ -245,28 +246,28 @@ Notes: This short set of instructions is written for users who want to On Linux, change to the install destination directory (create if doesn't exist) and execute: - /myhdfstuff/build/HDF-4.2."X"-Linux.sh + /myhdfstuff/build/HDF-4.3."X"-Linux.sh After accepting the license, the script will prompt: By default the HDF4 will be installed in: - "/HDF-4.2."X"-Linux" - Do you want to include the subdirectory HDF-4.2."X"-Linux? + "/HDF-4.3."X"-Linux" + Do you want to include the subdirectory HDF-4.3."X"-Linux? Saying no will install in: "" [Yn]: Note that the script will create the following directory structure relative to the install point: HDF_Group --HDF - ----4.2."X" + ----4.3."X" ------bin ------include ------lib ------share - On Mac you will find HDF-4.2."X"-Darwin.dmg in the build folder. Click + On Mac you will find HDF-4.3."X"-Darwin.dmg in the build folder. Click on the dmg file to proceed with installation. After accepting the license, there will be a folder with the following structure: HDF_Group --HDF - ----4.2."X" + ----4.3."X" ------bin ------include ------lib @@ -279,7 +280,8 @@ IV. Further considerations 1. We suggest you obtain the latest CMake for windows from the Kitware web site. The HDF 4.2."X" product requires a minimum CMake version 3.12. - If you are using VS2019, the CMake minimum is 3.15. + If you are using VS2019, the CMake minimum is 3.15. If you are + using VS2022, the minimum version is 3.21. 2. HDF4 requires Zlib and JPEG. Szip is optional: A. Download the binary packages and install them in a central location. @@ -320,22 +322,18 @@ IV. Further considerations D. Use original source packages from a compressed file by adding the following CMake options: - BUILD_JPEG_WITH_FETCHCONTENT:BOOL=ON - JPEG_TGZ_ORIGNAME:STRING="jpeg_src.ext" + JPEG_TGZ_NAME:STRING="jpeg_src.ext" JPEG_TGZ_ORIGPATH:STRING="some_location" - BUILD_SZIP_WITH_FETCHCONTENT:BOOL=ON - LIBAEC_TGZ_ORIGNAME:STRING="szip_src.ext" + LIBAEC_TGZ_NAME:STRING="szip_src.ext" LIBAEC_TGZ_ORIGPATH:STRING="some_location" - BUILD_ZLIB_WITH_FETCHCONTENT:BOOL=ON - ZLIB_TGZ_ORIGNAME:STRING="zlib_src.ext" + ZLIB_TGZ_NAME:STRING="zlib_src.ext" ZLIB_TGZ_ORIGPATH:STRING="some_location" HDF4_ALLOW_EXTERNAL_SUPPORT:STRING="TGZ" where "some_location" is the URL or full path to the compressed - file and ext is the type of compression file. The individual filters are - enabled by setting the BUILD__WITH_FETCHCONTENT CMake variable to ON. + file and ext is the type of compression file. Also set CMAKE_BUILD_TYPE to the configuration type during configuration. See the settings in the config/cmake/cacheinit.cmake file HDF uses for testing. @@ -364,7 +362,7 @@ IV. Further considerations the settings for the developers' environment. Then the only options needed on the command line are those options that are different. Example using HDF default cache file: - cmake -C ../config/cmake/cacheinit.cmake -G "Visual Studio 12 2013" \ + cmake -C ../config/cmake/cacheinit.cmake -G "Visual Studio 16 2019" \ -DHDF4_ENABLE_SZIP_SUPPORT:BOOL=OFF -DHDF4_ENABLE_EXAMPLES:BOOL=OFF \ -DCMAKE_BUILD_TYPE:STRING=Release .. @@ -519,7 +517,7 @@ These five steps are described in detail below. set (ZLIB_PACKAGE_NAME "zlib" CACHE STRING "Name of ZLIB package" FORCE) set (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use HDF4_ZLib from compressed file" FORCE) set (ZLIB_TGZ_ORIGPATH "https://github.com/madler/zlib/releases/download/v1.2.13" CACHE STRING "Use ZLIB from original location" FORCE) - set (ZLIB_TGZ_ORIGNAME "zlib-1.2.13.tar.gz" CACHE STRING "Use ZLIB from original compressed file" FORCE) + set (ZLIB_TGZ_NAME "zlib-1.2.13.tar.gz" CACHE STRING "Use ZLIB from original compressed file" FORCE) set (ZLIB_USE_LOCALCONTENT OFF CACHE BOOL "Use local file for ZLIB FetchContent" FORCE) set (SZIP_PACKAGE_NAME "szip" CACHE STRING "Name of SZIP package" FORCE) set (LIBAEC_PACKAGE_NAME "libaec" CACHE STRING "Name of AEC SZIP package" FORCE) @@ -527,12 +525,12 @@ These five steps are described in detail below. set (SZAEC_TGZ_NAME "LIBAEC.tar.gz" CACHE STRING "Use SZip AEC from compressed file" FORCE) set (USE_LIBAEC ON CACHE BOOL "Use libaec szip replacement" FORCE) set (LIBAEC_TGZ_ORIGPATH "https://gitlab.dkrz.de/k202009/libaec/-/archive/v1.0.6" CACHE STRING "Use LIBAEC from original location" FORCE) - set (LIBAEC_TGZ_ORIGNAME "libaec-v1.0.6.tar.gz" CACHE STRING "Use LIBAEC from original compressed file" FORCE) + set (LIBAEC_TGZ_NAME "libaec-v1.0.6.tar.gz" CACHE STRING "Use LIBAEC from original compressed file" FORCE) set (LIBAEC_USE_LOCALCONTENT OFF CACHE BOOL "Use local file for LIBAEC FetchContent" FORCE) set (JPEG_PACKAGE_NAME "jpeg" CACHE STRING "Name of JPEG package" FORCE) set (JPEG_TGZ_NAME "JPEG9e.tar.gz" CACHE STRING "Use JPEG from compressed file" FORCE) set (JPEG_TGZ_ORIGPATH "https://www.ijg.org/filesz" CACHE STRING "Use JPEG from original location" FORCE) - set (JPEG_TGZ_ORIGNAME "jpegsrc.v9e.tar.gz" CACHE STRING "Use JPEG from original compressed file" FORCE) + set (JPEG_TGZ_NAME "jpegsrc.v9e.tar.gz" CACHE STRING "Use JPEG from original compressed file" FORCE) set (JPEG_USE_LOCALCONTENT OFF CACHE BOOL "Use local file for JPEG FetchContent" FORCE) 2. Configure the cache settings @@ -557,7 +555,7 @@ These five steps are described in detail below. 2.2 Preferred command line example on Windows in c:\MyHDFstuff\hdf4\build directory: - cmake -C ../config/cmake/cacheinit.cmake -G "Visual Studio 12 2013" \ + cmake -C ../config/cmake/cacheinit.cmake -G "Visual Studio 16 2019" "-Ax64" \ -DHDF4_ENABLE_SZIP_SUPPORT:BOOL=OFF -DHDF4_ENABLE_Z_LIB_SUPPORT:BOOL=OFF \ -DCMAKE_BUILD_TYPE:STRING=Release .. @@ -593,9 +591,13 @@ These five steps are described in detail below. The options to control the GIT URL (config/cmake/cacheinit.cmake file) are: JPEG_GIT_URL:STRING="https://${git_url}/jpeg9e" + JPEG_GIT_BRANCH="${git_branch}" ZLIB_GIT_URL:STRING="https://${git_url}/zlib" + ZLIB_GIT_BRANCH="${git_branch}" SZIP_GIT_URL:STRING="https://${git_url}/szip" - ${git_url} should be changed to your location. Also define CMAKE_BUILD_TYPE + SZIP_GIT_BRANCH="${git_branch}" + ${git_url} should be changed to your location and ${git_branch} is + your branch in the repository. Also define CMAKE_BUILD_TYPE to be the configuration type. 3.2.2 Or the external libraries (zlib, szip, and jpeg) can be configured @@ -678,8 +680,8 @@ Option Name, Option Description, and Option Default. The config/cmake/cacheinit.cmake file can override the following values. ---------------- General Build Options --------------------- -BUILD_STATIC_LIBS "Build Static Libraries" ON -BUILD_SHARED_LIBS "Build Shared Libraries" ON +BUILD_SHARED_LIBS "Build Shared Libraries" ON +BUILD_STATIC_LIBS "Build Static Libraries" ON BUILD_TESTING "Build HDF4 Unit Testing" ON ---------------- HDF4 Build Options --------------------- @@ -704,6 +706,8 @@ else () HDF4_INSTALL_DATA_DIR "share" HDF4_INSTALL_DOC_DIR "HDF4_INSTALL_DATA_DIR" +HDF4_USE_GNU_DIRS "TRUE to use GNU Coding Standard install directory variables, + FALSE to use historical settings" FALSE Defaults as defined by the `GNU Coding Standards` HDF4_INSTALL_BIN_DIR "bin" HDF4_INSTALL_LIB_DIR "lib" @@ -715,8 +719,6 @@ HDF4_INSTALL_DOC_DIR "HDF4_INSTALL_DATA_DIR/doc/hdf" HDF4_BUILD_DOC "Build documentation" OFF ---------------- HDF4 Advanced Options --------------------- -HDF4_USE_GNU_DIRS "TRUE to use GNU Coding Standard install directory variables, - FALSE to use historical settings" FALSE ONLY_SHARED_LIBS "Only Build Shared Libraries" OFF HDF4_DISABLE_COMPILER_WARNINGS "Disable compiler warnings" OFF HDF4_ENABLE_COVERAGE "Enable code coverage for Libraries and Programs" OFF @@ -732,30 +734,30 @@ if (APPLE) if (WIN32) HDF_LEGACY_NAMING "Use Legacy Names for Libraries and Programs" OFF HDF4_ENABLE_NETCDF "Build HDF4 versions of NetCDF-3 APIS" ON + ---------------- External Library Options --------------------- HDF4_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building" "NO" HDF4_ENABLE_JPEG_LIB_SUPPORT "Enable libjpeg required" ON HDF4_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF HDF4_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" ON + JPEG_USE_EXTERNAL "Use External Library Building for JPEG" 0 -SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 0 +JPEG_TGZ_ORIGPATH "Use JPEG from original location" "https://www.ijg.org/filesz" +JPEG_TGZ_NAME "Use JPEG from original compressed file" "jpegsrc.v9e.tar.gz" +JPEG_USE_LOCALCONTENT "Use local file for JPEG FetchContent" OFF + ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 0 +ZLIB_TGZ_ORIGPATH "Use ZLIB from original location" "https://github.com/madler/zlib/releases/download/v1.2.13" +ZLIB_TGZ_NAME "Use ZLIB from original compressed file" "zlib-1.2.13.tar.gz" +ZLIB_USE_LOCALCONTENT "Use local file for ZLIB FetchContent" OFF + +SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 0 if (HDF4_ENABLE_SZIP_SUPPORT) HDF4_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF - USE_LIBAEC "Use libaec szip replacement" OFF - USE_LIBAEC_STATIC "Use static AEC library" OFF -if (BUILD_JPEG_WITH_FETCHCONTENT) - JPEG_TGZ_ORIGPATH "Use JPEG from original location" "https://www.ijg.org/filesz" - JPEG_TGZ_ORIGNAME "Use JPEG from original compressed file" "jpegsrc.v9e.tar.gz" - JPEG_USE_LOCALCONTENT "Use local file for JPEG FetchContent" OFF -if (BUILD_SZIP_WITH_FETCHCONTENT) - LIBAEC_TGZ_ORIGPATH "Use LIBAEC from original location" "https://gitlab.dkrz.de/k202009/libaec/-/archive/v1.0.6" - LIBAEC_TGZ_ORIGNAME "Use LIBAEC from original compressed file" "libaec-v1.0.6.tar.gz" - LIBAEC_USE_LOCALCONTENT "Use local file for LIBAEC FetchContent" OFF -if (BUILD_ZLIB_WITH_FETCHCONTENT) - ZLIB_TGZ_ORIGPATH "Use ZLIB from original location" "https://github.com/madler/zlib/releases/download/v1.2.13" - ZLIB_TGZ_ORIGNAME "Use ZLIB from original compressed file" "zlib-1.2.13.tar.gz" - ZLIB_USE_LOCALCONTENT "Use local file for ZLIB FetchContent" OFF +USE_LIBAEC_STATIC "Use static AEC library" OFF +LIBAEC_TGZ_ORIGPATH "Use LIBAEC from original location" "https://gitlab.dkrz.de/k202009/libaec/-/archive/v1.0.6" +LIBAEC_TGZ_NAME "Use LIBAEC from original compressed file" "libaec-v1.0.6.tar.gz" +LIBAEC_USE_LOCALCONTENT "Use local file for LIBAEC FetchContent" OFF NOTE: The HDF4_USE_GNU_DIRS option is usually recommended for linux platforms, but may @@ -803,15 +805,15 @@ Available configurations presets can be displayed by executing: Using individual command presets (where is GNUC or MSVC or Clang): change directory to the hdf4 source folder - cmake --presets=ci-StdShar- - cmake --build --presets=ci-StdShar- - ctest --presets=ci-StdShar- - cpack --presets=ci-StdShar- + cmake --preset ci-StdShar- + cmake --build --preset ci-StdShar- + ctest --preset ci-StdShar- + cpack --preset ci-StdShar- Using the workflow preset to configure, build, test and package the standard configuration is: change directory to the hdf4 source folder - execute "cmake --workflow --presets=ci-StdShar- --fresh" + execute "cmake --workflow --preset ci-StdShar- --fresh" where is GNUC or MSVC or Clang Creating your own configurations @@ -831,7 +833,7 @@ For instance, to change the support files to use a local directory, edit CMakeUs "inherits": "ci-base", "cacheVariables": { "HDF4_ALLOW_EXTERNAL_SUPPORT": {"type": "STRING", "value": "TGZ"}, - "TGZPATH": {"type": "STRING", "value": "${sourceParentDir}/temp"} + "TGZPATH": {"type": "PATH", "value": "${sourceParentDir}/temp"} } }, { @@ -862,6 +864,16 @@ For instance, to change the support files to use a local directory, edit CMakeUs Then you can change or add options for your specific case. +======================================================================== +III. Autotools Configuration and Build +======================================================================== +See RELEASE.txt in the release_notes/ directory for the list of platforms +tested for this release. + +Instructions for building and testing HDF4 using autotools can be found in the +INSTALL_Auto.txt file found in this folder. + + ======================================================================== For further assistance, send email to help@hdfgroup.org ======================================================================== diff --git a/release_notes/INSTALL_WINDOWS.txt b/release_notes/INSTALL_WINDOWS.txt index 0b60c0a008..882a5860d0 100644 --- a/release_notes/INSTALL_WINDOWS.txt +++ b/release_notes/INSTALL_WINDOWS.txt @@ -16,3 +16,17 @@ Users who want to build and run an application with HDF4 in Visual Studio without using CMake should consult the USING_HDF4_VS.txt file.. Building applications with the dynamic/shared hdf4 libraries requires that the "H4_BUILT_AS_DYNAMIC_LIB" compile definition be used. + +Additional Third-party Software Requirements: + + 1) Flex and Bison programs are required to regenerate the ncgen parsers. + This is not required to build the library and is only necessary if you + change the input files. + + 2) The Win flex-bison project, a port of Flex & Bison tools + to the Windows platform, is recommended. Download from: + http://sourceforge.net/projects/winflexbison + + 3) CMake version 2.8.11.1 or higher is needed to use Win flex-bison. + Using an earlier version of CMake will require renaming the executables + without the "win_" prefix. diff --git a/release_notes/USING_CMake_Examples.txt b/release_notes/USING_CMake_Examples.txt index 02ba25be03..88f8d75b05 100644 --- a/release_notes/USING_CMake_Examples.txt +++ b/release_notes/USING_CMake_Examples.txt @@ -21,7 +21,7 @@ I. Preconditions ======================================================================== 1. We suggest you obtain the latest CMake for your platform from the Kitware - web site. The HDF 4.2.x product requires a minimum CMake version + web site. The HDF 4.3.x product requires a minimum CMake version of 3.12. If you are using VS2019, the minimum version is 3.15. If you are using VS2022, the minimum version is 3.21. @@ -71,7 +71,7 @@ Default installation process: When executed, the ctest script will save the results to the log file, test.log, as indicated by the ctest command. If you wish to see more build and test information, - add "-VV" to the ctest command. The output should show + add "-VV" to the ctest command. The output should show; 100% tests passed, 0 tests failed out of 49. diff --git a/release_notes/USING_HDF4_CMake.txt b/release_notes/USING_HDF4_CMake.txt index 175fd12482..0e1fc8fc54 100644 --- a/release_notes/USING_HDF4_CMake.txt +++ b/release_notes/USING_HDF4_CMake.txt @@ -38,7 +38,7 @@ I. Preconditions ======================================================================== 1. We suggest you obtain the latest CMake for your platform from the Kitware - web site. The HDF 4.2.x product requires a minimum CMake version + web site. The HDF 4.3.x product requires a minimum CMake version of 3.12. If you are using VS2019, the minimum version is 3.15. If you are using VS2022, the minimum version is 3.21. @@ -51,17 +51,17 @@ I. Preconditions or environment variable, set(ENV{HDF4_ROOT} "") to the installed location of HDF4. On Windows: - HDF4_ROOT=C:/Program Files/HDF_Group/HDF/4.2.x/ + HDF4_ROOT=C:/Program Files/HDF_Group/HDF/4.3.x/ On unix: - HDF4_ROOT=/HDF_Group/HDF/4.2.x/ + HDF4_ROOT=/HDF_Group/HDF/4.3.x/ If you are using shared libraries, you may need to add to the path environment variable. Set the path environment variable to the installed location of the library files for HDF4. On Windows (*.dll): - PATH=%PATH%;C:/Program Files/HDF_Group/HDF/4.2.x/bin + PATH=%PATH%;C:/Program Files/HDF_Group/HDF/4.3.x/bin On unix (*.so): - LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/HDF_Group/HDF/4.2.x/lib + LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/HDF_Group/HDF/4.3.x/lib (Note there are no quote characters used on Windows and all platforms use forward slashes) diff --git a/release_notes/USING_HDF4_VS.txt b/release_notes/USING_HDF4_VS.txt index 69df365e4c..7900c9f0aa 100644 --- a/release_notes/USING_HDF4_VS.txt +++ b/release_notes/USING_HDF4_VS.txt @@ -52,11 +52,11 @@ Using Visual Studio 2008 with HDF4 Libraries built with Visual Studio 2008 and select "x64". 2.2 Find the box "Show directories for", choose "Include files", add the - header path (i.e. c:\Program Files\HDF_Group\HDF\4.2.x\include) + header path (i.e. c:\Program Files\HDF_Group\HDF\4.3.x\include) to the included directories. 2.3 Find the box "Show directories for", choose "Library files", add the - library path (i.e. c:\Program Files\HDF_Group\HDF\4.2.x\lib) + library path (i.e. c:\Program Files\HDF_Group\HDF\4.3.x\lib) to the library directories. 2.4 If using Fortran libraries, you will also need to setup the path From 0bf4b69dbca17c355baf058d6463a9f2d774b497 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 13 Feb 2024 12:14:03 -0600 Subject: [PATCH 12/65] Add ABI compatibility reports (#515) --- .github/workflows/abi-report.yml | 152 +++++++++++++++++++++++ .github/workflows/clang-format-check.yml | 2 +- .github/workflows/codespell.yml | 2 +- .github/workflows/daily-build.yml | 11 ++ .github/workflows/intel-auto.yml | 2 +- .github/workflows/intel-cmake.yml | 4 +- .github/workflows/main-cmake.yml | 2 +- .github/workflows/release-files.yml | 12 ++ .github/workflows/release.yml | 13 +- .github/workflows/tarball.yml | 2 +- 10 files changed, 193 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/abi-report.yml diff --git a/.github/workflows/abi-report.yml b/.github/workflows/abi-report.yml new file mode 100644 index 0000000000..24a9bb9571 --- /dev/null +++ b/.github/workflows/abi-report.yml @@ -0,0 +1,152 @@ +name: hdf4 Check Application Binary Interface (ABI) + +on: + workflow_call: + inputs: + use_tag: + description: 'Release version tag' + type: string + required: false + default: snapshot + use_environ: + description: 'Environment to locate files' + type: string + required: true + default: snapshots + file_base: + description: "The common base name of the binary" + required: true + type: string + file_ref: + description: "The reference name for the release binary" + required: true + type: string + +permissions: + contents: read + +jobs: + check: + runs-on: ubuntu-latest + continue-on-error: true + + steps: + - name: Install System dependencies + run: | + sudo apt update + sudo apt install -q -y abi-compliance-checker abi-dumper + sudo apt install -q -y japi-compliance-checker + + - name: Convert hdf4 reference name (Linux) + id: convert-hdf4lib-refname + run: | + FILE_DOTS=$(echo "${{ inputs.file_ref }}" | sed -r "s/([0-9]+)\_([0-9]+)\_([0-9]+)\-([0-9]+).*/\1\.\2\.\3\-\4/") + echo "HDF4R_DOTS=$FILE_DOTS" >> $GITHUB_OUTPUT + + - uses: actions/checkout@v4.1.1 + + - name: Get published binary (Linux) + uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 + with: + name: tgz-ubuntu-2204_gcc-binary + path: ${{ github.workspace }} + + - name: List files for the space (Linux) + run: | + ls -l ${{ github.workspace }} + + - name: Uncompress gh binary (Linux) + run: tar -zxvf ${{ github.workspace }}/${{ inputs.file_base }}-ubuntu-2204_gcc.tar.gz + + - name: Uncompress hdf4 binary (Linux) + run: | + cd "${{ github.workspace }}/hdf4" + tar -zxvf ${{ github.workspace }}/hdf4/HDF-*-Linux.tar.gz --strip-components 1 + + - name: List files for the HDF space (Linux) + run: | + ls -l ${{ github.workspace }}/hdf4 + ls -l ${{ github.workspace }}/hdf4/HDF_Group/HDF + + - name: set hdf4lib name + id: set-hdf4lib-name + run: | + HDF4DIR=${{ github.workspace }}/hdf4/HDF_Group/HDF/ + FILE_NAME_HDF4=$(ls ${{ github.workspace }}/hdf4/HDF_Group/HDF) + FILE_VERS=$(echo "$FILE_NAME_HDF4" | sed -r "s/([0-9]+\.[0-9]+\.[0-9]+\-[0-9]+)\..*/\1/") + echo "HDF4_ROOT=$HDF4DIR$FILE_NAME_HDF4" >> $GITHUB_OUTPUT + echo "HDF4_VERS=$FILE_VERS" >> $GITHUB_OUTPUT + + - name: Download reference version + run: | + mkdir "${{ github.workspace }}/hdf4R" + cd "${{ github.workspace }}/hdf4R" + wget -q https://github.com/HDFGroup/hdf4/releases/download/hdf-${{ inputs.file_ref }}/hdf-${{ inputs.file_ref }}-ubuntu-2204.tar.gz + tar zxf hdf-${{ inputs.file_ref }}-ubuntu-2204.tar.gz + + - name: List files for the space (Linux) + run: | + ls -l ${{ github.workspace }}/hdf4R + + - name: Uncompress hdf4 reference binary (Linux) + run: | + cd "${{ github.workspace }}/hdf4R" + tar -zxvf ${{ github.workspace }}/hdf4R/hdf4/HDF-${{ steps.convert-hdf4lib-refname.outputs.HDF4R_DOTS }}-Linux.tar.gz --strip-components 1 + + - name: List files for the HDFR space (Linux) + run: | + ls -l ${{ github.workspace }}/hdf4R + ls -l ${{ github.workspace }}/hdf4R/HDF_Group/HDF + + - name: set hdf4lib reference name + id: set-hdf4lib-refname + run: | + HDF4RDIR=${{ github.workspace }}/hdf4R/HDF_Group/HDF/ + FILE_NAME_HDF4R=$(ls ${{ github.workspace }}/hdf4R/HDF_Group/HDF) + echo "HDF4R_ROOT=$HDF4RDIR$FILE_NAME_HDF4R" >> $GITHUB_OUTPUT + echo "HDF4R_VERS=$FILE_NAME_HDF4R" >> $GITHUB_OUTPUT + + - name: List files for the lib spaces (Linux) + run: | + ls -l ${{ steps.set-hdf4lib-name.outputs.HDF4_ROOT }}/lib + ls -l ${{ steps.set-hdf4lib-refname.outputs.HDF4R_ROOT }}/lib + + - name: Run Java API report + run: | + japi-compliance-checker ${{ steps.set-hdf4lib-refname.outputs.HDF5R_ROOT }}/lib/jarhdf4-${{ steps.convert-hdf4lib-refname.outputs.HDF4R_DOTS }}.jar ${{ steps.set-hdf4lib-name.outputs.HDF4_ROOT }}/lib/jarhdf4-${{ steps.set-hdf4lib-name.outputs.HDF4_VERS }}.jar + + - name: Run hdf ABI report + run: | + abi-dumper ${{ steps.set-hdf4lib-refname.outputs.HDF4R_ROOT }}/lib/libhdf.so -o ABI-0.dump -public-headers ${{ steps.set-hdf4lib-refname.outputs.HDF4R_ROOT }}/include + abi-dumper ${{ steps.set-hdf4lib-name.outputs.HDF4_ROOT }}/lib/libhdf.so -o ABI-1.dump -public-headers ${{ steps.set-hdf4lib-name.outputs.HDF4_ROOT }}/include + abi-compliance-checker -l ${{ inputs.file_base }}-hdf -old ABI-0.dump -new ABI-1.dump + continue-on-error: true + + - name: Run mfhdf ABI report + run: | + abi-dumper ${{ steps.set-hdf4lib-refname.outputs.HDF4R_ROOT }}/lib/libmfhdf.so -o ABI-2.dump -public-headers ${{ steps.set-hdf4lib-refname.outputs.HDF4R_ROOT }}/include + abi-dumper ${{ steps.set-hdf4lib-name.outputs.HDF4_ROOT }}/lib/libmfhdf.so -o ABI-3.dump -public-headers ${{ steps.set-hdf4lib-name.outputs.HDF4_ROOT }}/include + abi-compliance-checker -l ${{ inputs.file_base }}-mfhdf -old ABI-2.dump -new ABI-3.dump + continue-on-error: true + + - name: Copy ABI reports + run: | + cp compat_reports/jarhdf4-/${{ steps.set-hdf4lib-refname.outputs.HDF5R_VERS }}_to_${{ steps.set-hdf4lib-name.outputs.HDF4_VERS }}/compat_report.html ${{ inputs.file_base }}-java_compat_report.html + ls -l compat_reports/${{ inputs.file_base }}-hdf/X_to_Y + cp compat_reports/${{ inputs.file_base }}-hdf/X_to_Y/compat_report.html ${{ inputs.file_base }}-hdf_compat_report.html + ls -l compat_reports/${{ inputs.file_base }}-mfhdf/X_to_Y + cp compat_reports/${{ inputs.file_base }}-mfhdf/X_to_Y/compat_report.html ${{ inputs.file_base }}-mfhdf_compat_report.html + + - name: List files for the report spaces (Linux) + run: | + ls -l compat_reports + ls -l *.html + + - name: Save output as artifact + uses: actions/upload-artifact@v4 + with: + name: abi-reports + path: | + ${{ inputs.file_base }}-hdf_compat_report.html + ${{ inputs.file_base }}-mfhdf_compat_report.html + ${{ inputs.file_base }}-java_compat_report.html diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index b2fb578604..2f0e149150 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'skip-ci')" steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.1.1 - name: Run clang-format style check for C and Java code uses: DoozyX/clang-format-lint-action@v0.13 with: diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml index fec84b3a86..15e1c92a49 100644 --- a/.github/workflows/codespell.yml +++ b/.github/workflows/codespell.yml @@ -10,7 +10,7 @@ jobs: name: Check for spelling errors runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.1.1 - uses: codespell-project/actions-codespell@master with: skip: ./config/sanitizer/sanitizers.cmake,./hdf/util/testfiles/*.raw,./hdf/util/testfiles/head.r8,./mfhdf/ncdump/*,./mfhdf/ncgen/*,./mfhdf/nctest/*,./mfhdf/README,./mfhdf/THANKS,./mfhdf/FAQ diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index b9b2fef58b..a77715b851 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -28,7 +28,18 @@ jobs: #use_environ: snapshots if: ${{ needs.call-workflow-tarball.outputs.has_changes == 'true' }} +# call-workflow-abi: +# needs: [call-workflow-tarball, call-workflow-ctest] +# uses: ./.github/workflows/abi-report.yml +# with: +# file_ref: '4_3_0-1' +# file_base: ${{ needs.call-workflow-tarball.outputs.file_base }} +# use_tag: snapshot +# use_environ: snapshots +# if: ${{ needs.call-workflow-tarball.outputs.has_changes == 'true' }} + call-workflow-release: +# needs: [call-workflow-tarball, call-workflow-ctest, call-workflow-abi] needs: [call-workflow-tarball, call-workflow-ctest] permissions: contents: write # In order to allow tag creation diff --git a/.github/workflows/intel-auto.yml b/.github/workflows/intel-auto.yml index d3ceb7d0c4..5e43f2961f 100644 --- a/.github/workflows/intel-auto.yml +++ b/.github/workflows/intel-auto.yml @@ -16,7 +16,7 @@ jobs: name: "Intel ${{ inputs.build_mode }}" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.1.1 - name: Install Dependencies run: | diff --git a/.github/workflows/intel-cmake.yml b/.github/workflows/intel-cmake.yml index 6e8da44f40..a13f3f47d0 100644 --- a/.github/workflows/intel-cmake.yml +++ b/.github/workflows/intel-cmake.yml @@ -19,7 +19,7 @@ jobs: name: "ubuntu-oneapi ${{ inputs.build_mode }}" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.1.1 # Only CMake need ninja-build, but we just install it unilaterally # libssl, etc. are needed for the ros3 VFD @@ -80,7 +80,7 @@ jobs: name: "windows-oneapi ${{ inputs.build_mode }}" runs-on: windows-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.1.1 - name: Install Dependencies (Windows) run: choco install ninja diff --git a/.github/workflows/main-cmake.yml b/.github/workflows/main-cmake.yml index a591d28416..81b59b9c3d 100644 --- a/.github/workflows/main-cmake.yml +++ b/.github/workflows/main-cmake.yml @@ -145,7 +145,7 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Get Sources - uses: actions/checkout@v4 + uses: actions/checkout@v4.1.1 # # CMAKE CONFIGURE diff --git a/.github/workflows/release-files.yml b/.github/workflows/release-files.yml index dc3228d756..466c029a02 100644 --- a/.github/workflows/release-files.yml +++ b/.github/workflows/release-files.yml @@ -126,6 +126,12 @@ jobs: name: tgz-ubuntu-2204_intel-binary path: ${{ github.workspace }} +# - name: Get published abi reports (Linux) +# uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0 +# with: +# name: abi-reports +# path: ${{ github.workspace }} + - name: Store snapshot name run: | echo "${{ steps.get-file-base.outputs.FILE_BASE }}" > ./last-file.txt @@ -148,6 +154,9 @@ jobs: ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_intel.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}-win-vs2022_intel.zip if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` +# ${{ steps.get-file-base.outputs.FILE_BASE }}-hdf_compat_report.html +# ${{ steps.get-file-base.outputs.FILE_BASE }}-mfhdf_compat_report.html +# ${{ steps.get-file-base.outputs.FILE_BASE }}-java_compat_report.html - name: Release tag id: create_release @@ -167,6 +176,9 @@ jobs: ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_intel.tar.gz ${{ steps.get-file-base.outputs.FILE_BASE }}-win-vs2022_intel.zip if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` +# ${{ steps.get-file-base.outputs.FILE_BASE }}-hdf_compat_report.html +# ${{ steps.get-file-base.outputs.FILE_BASE }}-mfhdf_compat_report.html +# ${{ steps.get-file-base.outputs.FILE_BASE }}-java_compat_report.html - name: List files for the space (Linux) run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c9c30c118..e6ae47dca5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,7 +50,7 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Get Sources - uses: actions/checkout@v4 + uses: actions/checkout@v4.1.1 with: path: hdfsrc @@ -86,8 +86,17 @@ jobs: file_base: ${{ needs.create-files-ctest.outputs.file_base }} preset_name: ci-StdShar +# call-workflow-abi: +# needs: [log-the-inputs, create-files-ctest, call-workflow-ctest] +# uses: ./.github/workflows/abi-report.yml +# with: +# file_ref: '4_2_16-2' +# file_base: ${{ needs.create-files-ctest.outputs.file_base }} +# use_tag: ${{ needs.log-the-inputs.outputs.rel_tag }} +# use_environ: release + call-workflow-release: - #needs: [call-workflow-tarball, call-workflow-ctest] +# needs: [log-the-inputs, create-files-ctest, call-workflow-ctest, call-workflow-abi] needs: [log-the-inputs, create-files-ctest, call-workflow-ctest] permissions: contents: write # In order to allow tag creation diff --git a/.github/workflows/tarball.yml b/.github/workflows/tarball.yml index 7d346d9b6e..1ff7f65c58 100644 --- a/.github/workflows/tarball.yml +++ b/.github/workflows/tarball.yml @@ -83,7 +83,7 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Get Sources - uses: actions/checkout@v4 + uses: actions/checkout@v4.1.1 with: path: hdfsrc From f2dd67c8735da1f659255192bf8020be8374b9b2 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 13 Feb 2024 13:17:30 -0600 Subject: [PATCH 13/65] Standardize on ON/OFF for boolean CMake options (#523) --- HDF4Examples/config/cmake/HDFMacros.cmake | 8 ++++---- config/cmake/HDF4ExampleCache.cmake | 2 +- config/cmake/HDFMacros.cmake | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/HDF4Examples/config/cmake/HDFMacros.cmake b/HDF4Examples/config/cmake/HDFMacros.cmake index 08c93ea65a..7f919690db 100644 --- a/HDF4Examples/config/cmake/HDFMacros.cmake +++ b/HDF4Examples/config/cmake/HDFMacros.cmake @@ -80,7 +80,7 @@ macro (HDFTEST_COPY_FILE src dest target) endmacro () macro (HDF_DIR_PATHS package_prefix) - option (H4EX_USE_GNU_DIRS "TRUE to use GNU Coding Standard install directory variables, FALSE to use historical settings" FALSE) + option (H4EX_USE_GNU_DIRS "ON to use GNU Coding Standard install directory variables, OFF to use historical settings" FALSE) if (H4EX_USE_GNU_DIRS) include(GNUInstallDirs) if (NOT ${package_prefix}_INSTALL_BIN_DIR) @@ -111,7 +111,7 @@ macro (HDF_DIR_PATHS package_prefix) endif () if (APPLE) - option (${package_prefix}_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE) + option (${package_prefix}_BUILD_FRAMEWORKS "ON to build as frameworks libraries, OFF to build according to BUILD_SHARED_LIBS" FALSE) endif () if (NOT ${package_prefix}_INSTALL_BIN_DIR) @@ -160,10 +160,10 @@ macro (HDF_DIR_PATHS package_prefix) message(STATUS "Final: ${${package_prefix}_INSTALL_DOC_DIR}") # Always use full RPATH, i.e. don't skip the full RPATH for the build tree - set (CMAKE_SKIP_BUILD_RPATH FALSE) + set (CMAKE_SKIP_BUILD_RPATH OFF) # when building, don't use the install RPATH already # (but later on when installing) - set (CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) + set (CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF) # add the automatically determined parts of the RPATH # which point to directories outside the build tree to the install RPATH set (CMAKE_BUILD_WITH_INSTALL_RPATH ON) diff --git a/config/cmake/HDF4ExampleCache.cmake b/config/cmake/HDF4ExampleCache.cmake index 151c4af9e9..7aeb1c90a6 100644 --- a/config/cmake/HDF4ExampleCache.cmake +++ b/config/cmake/HDF4ExampleCache.cmake @@ -10,7 +10,7 @@ set (H4EX_BUILD_EXAMPLES ${HDF4_BUILD_EXAMPLES} CACHE BOOL "Build Examples" FORC set (HDF_BUILD_C ON CACHE BOOL "Build examples C support" FORCE) set (HDF_BUILD_FORTRAN ${HDF4_BUILD_FORTRAN} CACHE BOOL "Build examples FORTRAN support" FORCE) set (HDF_BUILD_JAVA ${HDF4_BUILD_JAVA} CACHE BOOL "Build examples JAVA support" FORCE) -set (H4EX_USE_GNU_DIRS ${HDF4_USE_GNU_DIRS} CACHE BOOL "TRUE to use GNU Coding Standard install directory variables, FALSE to use historical settings" FORCE) +set (H4EX_USE_GNU_DIRS ${HDF4_USE_GNU_DIRS} CACHE BOOL "ON to use GNU Coding Standard install directory variables, OFF to use historical settings" FORCE) #preset HDF4 cache vars to this projects libraries instead of searching set (H4EX_HDF4_HEADER "H4config.h" CACHE STRING "Name of HDF4 header" FORCE) diff --git a/config/cmake/HDFMacros.cmake b/config/cmake/HDFMacros.cmake index 98679e5cbf..3cce8489db 100644 --- a/config/cmake/HDFMacros.cmake +++ b/config/cmake/HDFMacros.cmake @@ -356,7 +356,7 @@ macro (HDFTEST_COPY_FILE src dest target) endmacro () macro (HDF_DIR_PATHS package_prefix) - option (HDF4_USE_GNU_DIRS "TRUE to use GNU Coding Standard install directory variables, FALSE to use historical settings" FALSE) + option (HDF4_USE_GNU_DIRS "ON to use GNU Coding Standard install directory variables, OFF to use historical settings" FALSE) if (HDF4_USE_GNU_DIRS) include(GNUInstallDirs) if (NOT ${package_prefix}_INSTALL_BIN_DIR) @@ -387,7 +387,7 @@ macro (HDF_DIR_PATHS package_prefix) endif () if (APPLE) - option (${package_prefix}_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE) + option (${package_prefix}_BUILD_FRAMEWORKS "ON to build as frameworks libraries, OFF to build according to BUILD_SHARED_LIBS" FALSE) endif () if (NOT ${package_prefix}_INSTALL_BIN_DIR) @@ -436,10 +436,10 @@ macro (HDF_DIR_PATHS package_prefix) message(STATUS "Final: ${${package_prefix}_INSTALL_DOC_DIR}") # Always use full RPATH, i.e. don't skip the full RPATH for the build tree - set (CMAKE_SKIP_BUILD_RPATH FALSE) + set (CMAKE_SKIP_BUILD_RPATH OFF) # when building, don't use the install RPATH already # (but later on when installing) - set (CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) + set (CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF) # add the automatically determined parts of the RPATH # which point to directories outside the build tree to the install RPATH set (CMAKE_BUILD_WITH_INSTALL_RPATH ON) From 086c9af25bfa2a3780609d97f4f0b2dcf3d8d73c Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 13 Feb 2024 11:46:38 -0800 Subject: [PATCH 14/65] hdfi.h is no longer included in hdf.h (#521) In the past, hdfi.h (an internal header file) was included in the public hdf.h header. This is no longer the case. Anything that should be public has been moved from hdfi.h to hdf.h, including: * The C99-like types (e.g., float32) * The archaic VOID/VOIDP macros * The intf Fortran integer type * The HD library macros (e.g., HDmalloc) All of these things are considered obsolete and we only maintain them in the public header so that old code does not have to be modified. It is unwise to use them in new code. --- HDF4Examples/C/AN/h4ex_AN_create_annotation.c | 3 + .../C/AN/h4ex_AN_get_annotation_info.c | 3 + HDF4Examples/C/AN/h4ex_AN_read_annotation.c | 3 + HDF4Examples/C/GR/GR_read_chunks.c | 2 + HDF4Examples/C/GR/GR_write_chunks.c | 2 + .../h4ex_GR_create_and_write_chunked_image.c | 3 + .../C/GR/h4ex_GR_create_and_write_image.c | 2 + HDF4Examples/C/GR/h4ex_GR_get_attribute.c | 3 + HDF4Examples/C/GR/h4ex_GR_image_info.c | 2 + HDF4Examples/C/GR/h4ex_GR_modify_image.c | 2 + HDF4Examples/C/GR/h4ex_GR_read_image.c | 2 + HDF4Examples/C/GR/h4ex_GR_read_palette.c | 2 + HDF4Examples/C/GR/h4ex_GR_set_attribute.c | 2 + HDF4Examples/C/GR/h4ex_GR_write_palette.c | 2 + HDF4Examples/C/SD/h4ex_SD_alter_sds_values.c | 2 + HDF4Examples/C/SD/h4ex_SD_compress_sds.c | 2 + HDF4Examples/C/SD/h4ex_SD_create_sds.c | 2 + HDF4Examples/C/SD/h4ex_SD_dimscale_vs_sds.c | 2 + HDF4Examples/C/SD/h4ex_SD_find_sds_by_name.c | 2 + HDF4Examples/C/SD/h4ex_SD_get_attr.c | 3 + HDF4Examples/C/SD/h4ex_SD_get_info.c | 2 + .../C/SD/h4ex_SD_mv_sds_to_external.c | 2 + HDF4Examples/C/SD/h4ex_SD_read_from_sds.c | 2 + HDF4Examples/C/SD/h4ex_SD_read_subsets.c | 2 + HDF4Examples/C/SD/h4ex_SD_set_attr.c | 2 + HDF4Examples/C/SD/h4ex_SD_set_get_dim_info.c | 2 + HDF4Examples/C/SD/h4ex_SD_unlimited_sds.c | 2 + HDF4Examples/C/SD/h4ex_SD_write_slab.c | 2 + HDF4Examples/C/SD/h4ex_SD_write_to_sds.c | 2 + .../C/VD/h4ex_VD_create_onefield_vdatas.c | 2 + HDF4Examples/C/VD/h4ex_VD_create_vdatas.c | 2 + HDF4Examples/C/VD/h4ex_VD_get_vdata_info.c | 2 + HDF4Examples/C/VD/h4ex_VD_locate_vdata.c | 2 + HDF4Examples/C/VD/h4ex_VD_read_from_vdata.c | 3 + HDF4Examples/C/VD/h4ex_VD_read_mixed_vdata.c | 2 + .../C/VD/h4ex_VD_set_get_vdata_attr.c | 2 + HDF4Examples/C/VD/h4ex_VD_write_mixed_vdata.c | 2 + .../C/VD/h4ex_VD_write_mixed_vdata_struct.c | 2 + HDF4Examples/C/VD/h4ex_VD_write_to_vdata.c | 2 + HDF4Examples/C/VG/h4ex_VG_add_sds_to_vgroup.c | 2 + HDF4Examples/C/VG/h4ex_VG_create_vgroup.c | 2 + HDF4Examples/C/VG/h4ex_VG_get_vgroup_info.c | 3 + .../C/VG/h4ex_VG_insert_vdatas_to_vgroup.c | 2 + .../C/VG/h4ex_VG_set_get_vgroup_attr.c | 2 + HDF4Examples/C/VG/h4ex_VG_vgroup_contents.c | 3 + hdf/src/H4api_adpt.h | 2 - hdf/src/atom.c | 11 +-- hdf/src/atom.h | 2 +- hdf/src/bitvect.c | 1 + hdf/src/bitvect.h | 4 +- hdf/src/cdeflate.c | 5 +- hdf/src/cdeflate.h | 2 +- hdf/src/cnbit.c | 8 +- hdf/src/cnbit.h | 2 + hdf/src/cnone.c | 8 +- hdf/src/cnone.h | 4 +- hdf/src/crle.c | 9 +-- hdf/src/crle.h | 2 + hdf/src/cskphuff.c | 8 +- hdf/src/cskphuff.h | 2 + hdf/src/cszip.c | 3 +- hdf/src/cszip.h | 4 +- hdf/src/df24.c | 2 +- hdf/src/df24f.c | 2 +- hdf/src/dfan.c | 3 +- hdf/src/dfan.h | 3 +- hdf/src/dfanf.c | 2 + hdf/src/dfcomp.c | 8 +- hdf/src/dfconv.c | 5 +- hdf/src/dfconvrt.h | 2 + hdf/src/dff.c | 4 +- hdf/src/dfgr.c | 2 +- hdf/src/dfgr.h | 2 + hdf/src/dfgroup.c | 2 +- hdf/src/dfimcomp.c | 2 +- hdf/src/dfjpeg.c | 2 +- hdf/src/dfknat.c | 2 +- hdf/src/dfkswap.c | 2 +- hdf/src/dfp.c | 2 +- hdf/src/dfpf.c | 2 +- hdf/src/dfr8.c | 2 +- hdf/src/dfr8f.c | 3 +- hdf/src/dfrig.h | 2 + hdf/src/dfrle.c | 2 +- hdf/src/dfsd.c | 2 +- hdf/src/dfsdf.c | 2 +- hdf/src/dfstubs.c | 1 + hdf/src/dfufp2i.c | 7 +- hdf/src/dfufp2i.h | 2 +- hdf/src/dfufp2if.c | 2 +- hdf/src/dfunjpeg.c | 2 +- hdf/src/dfutil.c | 9 +-- hdf/src/dfutilf.c | 3 +- hdf/src/dynarray.c | 8 +- hdf/src/dynarray.h | 2 +- hdf/src/glist.c | 6 +- hdf/src/glist.h | 5 +- hdf/src/hbitio.c | 6 +- hdf/src/hbitio.h | 2 + hdf/src/hblocks.c | 2 +- hdf/src/hbuffer.c | 3 +- hdf/src/hchunks.c | 10 +-- hdf/src/hchunks.h | 7 +- hdf/src/hcomp.c | 7 +- hdf/src/hcomp.h | 2 + hdf/src/hcompi.h | 1 + hdf/src/hcompri.c | 3 +- hdf/src/hconv.h | 6 +- hdf/src/hdatainfo.c | 2 +- hdf/src/hdf.h | 21 ++++-- hdf/src/hdfalloc.c | 2 +- hdf/src/hdfi.h | 24 +++--- hdf/src/herr.c | 2 +- hdf/src/herr.h | 2 + hdf/src/herrf.c | 2 +- hdf/src/hfile.c | 5 +- hdf/src/hfile.h | 2 +- hdf/src/hfiledd.c | 8 +- hdf/src/hfilef.c | 2 +- hdf/src/hkit.c | 2 +- hdf/src/hkit.h | 2 +- hdf/src/hlimits.h | 2 + hdf/src/hproto.h | 3 + hdf/src/hqueue.h | 3 - hdf/src/htags.h | 2 + hdf/src/linklist.c | 9 +-- hdf/src/linklist.h | 2 +- hdf/src/mcache.c | 6 +- hdf/src/mcache.h | 6 +- hdf/src/mfan.c | 5 +- hdf/src/mfan.h | 4 +- hdf/src/mfanf.c | 3 +- hdf/src/mfani.h | 2 +- hdf/src/mfgr.c | 9 +-- hdf/src/mfgr.h | 2 + hdf/src/mfgrf.c | 3 +- hdf/src/mfgrff.f | 1 - hdf/src/mfgri.h | 4 +- hdf/src/mstdio.c | 9 +-- hdf/src/mstdio.h | 5 +- hdf/src/tbbt.c | 4 +- hdf/src/tbbt.h | 4 +- hdf/src/vattr.c | 3 + hdf/src/vattrf.c | 3 +- hdf/src/vconv.c | 3 +- hdf/src/vg.c | 2 +- hdf/src/vgf.c | 2 +- hdf/src/vgint.h | 3 +- hdf/src/vgp.c | 2 +- hdf/src/vhi.c | 2 +- hdf/src/vio.c | 2 +- hdf/src/vparse.c | 2 +- hdf/src/vrw.c | 2 +- hdf/src/vsfld.c | 2 +- hdf/test/forsupf.c | 2 + hdf/test/tproto.h | 2 +- hdf/test/tszip.c | 2 +- hdf/test/tutils.h | 2 + hdf/util/fp2hdf.c | 8 +- hdf/util/gif2hdf.c | 7 +- hdf/util/gif2mem.c | 5 +- hdf/util/gifread.c | 2 + hdf/util/hdf24to8.c | 1 + hdf/util/hdf2gif.c | 1 + hdf/util/hdfcomp.c | 3 + hdf/util/hdfgifwr.c | 4 +- hdf/util/hdftopal.c | 3 + hdf/util/hdftor8.c | 3 + hdf/util/hdfunpac.c | 1 + hdf/util/he.h | 4 +- hdf/util/he_main.c | 1 + hdf/util/jpeg2hdf.c | 3 +- hdf/util/paltohdf.c | 3 + hdf/util/r8tohdf.c | 3 + hdf/util/ristosds.c | 3 + hdf/util/vmake.c | 3 + hdf/util/writehdf.c | 2 +- java/src/jni/hdfImp.c | 2 +- java/src/jni/hdfanImp.c | 2 +- java/src/jni/hdfdfpalImp.c | 2 +- java/src/jni/hdfdfuImp.c | 2 +- java/src/jni/hdfexceptionImp.c | 2 +- java/src/jni/hdfgrImp.c | 2 +- java/src/jni/hdfheImp.c | 2 +- java/src/jni/hdfhxImp.c | 2 +- java/src/jni/hdfnativeImp.c | 2 +- java/src/jni/hdfr24Imp.c | 2 +- java/src/jni/hdfr8Imp.c | 2 +- java/src/jni/hdfsdsImp.c | 2 +- java/src/jni/hdfstructsutil.c | 2 +- java/src/jni/hdfvdataImp.c | 2 +- java/src/jni/hdfvfImp.c | 2 +- java/src/jni/hdfvgroupImp.c | 2 +- java/src/jni/hdfvhImp.c | 2 +- java/src/jni/hdfvqImp.c | 2 +- java/src/jni/hdfvsqImp.c | 2 +- mfhdf/hdfimport/gen_sds_floats.c | 2 + mfhdf/hdfimport/hdfimport.c | 12 +-- mfhdf/hdfimport/hdfimporttest.c | 3 + mfhdf/hdiff/hdiff.c | 2 + mfhdf/hdiff/hdiff_dim.c | 3 + mfhdf/hdiff/hdiff_gr.c | 3 + mfhdf/hdiff/hdiff_list.c | 2 + mfhdf/hdiff/hdiff_mattbl.c | 1 + mfhdf/hdiff/hdiff_sds.c | 3 + mfhdf/hdiff/hdiff_table.c | 1 + mfhdf/hdiff/hdifftst.c | 2 + mfhdf/hrepack/hrepack.c | 3 + mfhdf/hrepack/hrepack_an.c | 2 + mfhdf/hrepack/hrepack_check.c | 3 + mfhdf/hrepack/hrepack_dim.c | 4 + mfhdf/hrepack/hrepack_gr.c | 3 + mfhdf/hrepack/hrepack_list.c | 3 + mfhdf/hrepack/hrepack_lsttable.c | 3 +- mfhdf/hrepack/hrepack_opttable.c | 3 +- mfhdf/hrepack/hrepack_parse.c | 5 +- mfhdf/hrepack/hrepack_sds.c | 4 + mfhdf/hrepack/hrepack_utils.c | 3 + mfhdf/hrepack/hrepack_vg.c | 2 + mfhdf/hrepack/hrepack_vs.c | 2 + mfhdf/hrepack/hrepacktst.c | 3 + mfhdf/libsrc/array.c | 1 - mfhdf/libsrc/attr.c | 1 - mfhdf/libsrc/dim.c | 1 - mfhdf/libsrc/error.c | 6 +- mfhdf/libsrc/error.h | 2 +- mfhdf/libsrc/file.c | 7 +- mfhdf/libsrc/globdef.c | 6 +- mfhdf/libsrc/h4_xdr.c | 15 ++-- mfhdf/libsrc/h4_xdr.h | 12 +-- mfhdf/libsrc/hdf2netcdf.h | 4 +- mfhdf/libsrc/hdfnctest.c | 6 +- mfhdf/libsrc/local_nc.h | 6 +- mfhdf/libsrc/mfdatainfo.h | 2 - mfhdf/libsrc/mfhdf.h | 6 +- mfhdf/libsrc/mfprivate.h | 2 + mfhdf/libsrc/putget.c | 3 +- mfhdf/libsrc/string.c | 1 - mfhdf/libsrc/var.c | 1 - mfhdf/ncdump/dumplib.c | 3 +- mfhdf/ncdump/ncdump.c | 4 +- mfhdf/ncdump/vardata.c | 9 ++- mfhdf/ncgen/generate.c | 2 +- mfhdf/ncgen/ncgen.l | 3 +- mfhdf/nctest/add.c | 4 +- mfhdf/nctest/atttests.c | 4 +- mfhdf/nctest/cdftests.c | 5 +- mfhdf/nctest/dimtests.c | 4 +- mfhdf/nctest/driver.c | 3 +- mfhdf/nctest/error.c | 4 +- mfhdf/nctest/misctest.c | 3 +- mfhdf/nctest/rec.c | 4 +- mfhdf/nctest/slabs.c | 4 +- mfhdf/nctest/val.c | 3 +- mfhdf/nctest/vardef.c | 4 +- mfhdf/nctest/varget.c | 4 +- mfhdf/nctest/varget_unlim.c | 5 +- mfhdf/nctest/vargetg.c | 4 +- mfhdf/nctest/varput.c | 4 +- mfhdf/nctest/varputg.c | 4 +- mfhdf/nctest/vartests.c | 4 +- mfhdf/nctest/vputget.c | 4 +- mfhdf/nctest/vputgetg.c | 4 +- mfhdf/test/cdftest.c | 75 ++++++++++--------- mfhdf/test/hdfnctest.c | 3 + mfhdf/test/hdftest.c | 54 ++++++------- mfhdf/test/hdftest.h | 2 + mfhdf/test/tattdatainfo.c | 7 ++ mfhdf/test/tattributes.c | 2 + mfhdf/test/tchunk.c | 2 + mfhdf/test/tcomp.c | 2 + mfhdf/test/tcoordvar.c | 3 + mfhdf/test/tdatainfo.c | 33 ++++---- mfhdf/test/tdatasizes.c | 2 + mfhdf/test/tdim.c | 2 + mfhdf/test/texternal.c | 12 +++ mfhdf/test/tmixed_apis.c | 3 + mfhdf/test/tncunlim.c | 2 + mfhdf/test/tncvargetfill.c | 3 + mfhdf/test/tnetcdf.c | 3 + mfhdf/test/trank0.c | 2 + mfhdf/test/tsdsprops.c | 3 + mfhdf/test/tszip.c | 3 + mfhdf/test/tunlim.c | 2 + mfhdf/test/tutils.c | 3 + mfhdf/util/h4getopt.h | 2 - release_notes/RELEASE.txt | 34 +++++++-- 287 files changed, 662 insertions(+), 484 deletions(-) diff --git a/HDF4Examples/C/AN/h4ex_AN_create_annotation.c b/HDF4Examples/C/AN/h4ex_AN_create_annotation.c index 62402422f8..f128174478 100644 --- a/HDF4Examples/C/AN/h4ex_AN_create_annotation.c +++ b/HDF4Examples/C/AN/h4ex_AN_create_annotation.c @@ -1,3 +1,6 @@ +#include +#include + #include "hdf.h" #define FILE_NAME "h4ex_AN_create_annotation.hdf" diff --git a/HDF4Examples/C/AN/h4ex_AN_get_annotation_info.c b/HDF4Examples/C/AN/h4ex_AN_get_annotation_info.c index cd16077d85..28fd81ddb4 100644 --- a/HDF4Examples/C/AN/h4ex_AN_get_annotation_info.c +++ b/HDF4Examples/C/AN/h4ex_AN_get_annotation_info.c @@ -1,3 +1,6 @@ +#include +#include + #include "hdf.h" #define FILE_NAME "General_HDFobjects.hdf" diff --git a/HDF4Examples/C/AN/h4ex_AN_read_annotation.c b/HDF4Examples/C/AN/h4ex_AN_read_annotation.c index a107d61be4..656b04b109 100644 --- a/HDF4Examples/C/AN/h4ex_AN_read_annotation.c +++ b/HDF4Examples/C/AN/h4ex_AN_read_annotation.c @@ -1,3 +1,6 @@ +#include +#include + #include "hdf.h" #define FILE_NAME "General_HDFobjects.hdf" diff --git a/HDF4Examples/C/GR/GR_read_chunks.c b/HDF4Examples/C/GR/GR_read_chunks.c index c23169839b..324039ea31 100644 --- a/HDF4Examples/C/GR/GR_read_chunks.c +++ b/HDF4Examples/C/GR/GR_read_chunks.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define FILE_NAME "Image_Chunked.hdf" diff --git a/HDF4Examples/C/GR/GR_write_chunks.c b/HDF4Examples/C/GR/GR_write_chunks.c index 756e4245a6..55e21936d0 100644 --- a/HDF4Examples/C/GR/GR_write_chunks.c +++ b/HDF4Examples/C/GR/GR_write_chunks.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define FILE_NAME "Image_Chunked.hdf" diff --git a/HDF4Examples/C/GR/h4ex_GR_create_and_write_chunked_image.c b/HDF4Examples/C/GR/h4ex_GR_create_and_write_chunked_image.c index fe4d13f274..e1f34ddb6b 100644 --- a/HDF4Examples/C/GR/h4ex_GR_create_and_write_chunked_image.c +++ b/HDF4Examples/C/GR/h4ex_GR_create_and_write_chunked_image.c @@ -1,4 +1,7 @@ +#include + #include "hdf.h" + #define FILE_NAME "h4ex_GR_create_and_write_chunked_image.hdf" #define IMAGE_NAME "gzip_comp_data" #define X_LENGTH 6 /* number of rows in the image */ diff --git a/HDF4Examples/C/GR/h4ex_GR_create_and_write_image.c b/HDF4Examples/C/GR/h4ex_GR_create_and_write_image.c index 5b2f154050..dabe2e5412 100644 --- a/HDF4Examples/C/GR/h4ex_GR_create_and_write_image.c +++ b/HDF4Examples/C/GR/h4ex_GR_create_and_write_image.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define FILE_NAME "h4ex_GR_create_and_write_image.hdf" diff --git a/HDF4Examples/C/GR/h4ex_GR_get_attribute.c b/HDF4Examples/C/GR/h4ex_GR_get_attribute.c index 809699b5be..ae9bc0bb1b 100644 --- a/HDF4Examples/C/GR/h4ex_GR_get_attribute.c +++ b/HDF4Examples/C/GR/h4ex_GR_get_attribute.c @@ -1,3 +1,6 @@ +#include +#include + #include "hdf.h" #define FILE_NAME "General_RImages.hdf" diff --git a/HDF4Examples/C/GR/h4ex_GR_image_info.c b/HDF4Examples/C/GR/h4ex_GR_image_info.c index ce75971ef1..9bfa0bf328 100644 --- a/HDF4Examples/C/GR/h4ex_GR_image_info.c +++ b/HDF4Examples/C/GR/h4ex_GR_image_info.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define FILE_NAME "General_RImages3.hdf" diff --git a/HDF4Examples/C/GR/h4ex_GR_modify_image.c b/HDF4Examples/C/GR/h4ex_GR_modify_image.c index 54e01c5be2..f3d5e80a23 100644 --- a/HDF4Examples/C/GR/h4ex_GR_modify_image.c +++ b/HDF4Examples/C/GR/h4ex_GR_modify_image.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define FILE_NAME "General_RImages2.hdf" diff --git a/HDF4Examples/C/GR/h4ex_GR_read_image.c b/HDF4Examples/C/GR/h4ex_GR_read_image.c index 775c941157..7646313897 100644 --- a/HDF4Examples/C/GR/h4ex_GR_read_image.c +++ b/HDF4Examples/C/GR/h4ex_GR_read_image.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define FILE_NAME "General_RImages.hdf" diff --git a/HDF4Examples/C/GR/h4ex_GR_read_palette.c b/HDF4Examples/C/GR/h4ex_GR_read_palette.c index 4c26b633c2..222d186b1a 100644 --- a/HDF4Examples/C/GR/h4ex_GR_read_palette.c +++ b/HDF4Examples/C/GR/h4ex_GR_read_palette.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define FILE_NAME "Image_with_Palette.hdf" diff --git a/HDF4Examples/C/GR/h4ex_GR_set_attribute.c b/HDF4Examples/C/GR/h4ex_GR_set_attribute.c index 9f61fa9cf9..bdc7fd590b 100644 --- a/HDF4Examples/C/GR/h4ex_GR_set_attribute.c +++ b/HDF4Examples/C/GR/h4ex_GR_set_attribute.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define FILE_NAME "General_RImages4.hdf" diff --git a/HDF4Examples/C/GR/h4ex_GR_write_palette.c b/HDF4Examples/C/GR/h4ex_GR_write_palette.c index 6251c19fcd..6dd593de95 100644 --- a/HDF4Examples/C/GR/h4ex_GR_write_palette.c +++ b/HDF4Examples/C/GR/h4ex_GR_write_palette.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define FILE_NAME "h4ex_GR_write_palette.hdf" diff --git a/HDF4Examples/C/SD/h4ex_SD_alter_sds_values.c b/HDF4Examples/C/SD/h4ex_SD_alter_sds_values.c index 893f9f2e0e..9893192cd6 100644 --- a/HDF4Examples/C/SD/h4ex_SD_alter_sds_values.c +++ b/HDF4Examples/C/SD/h4ex_SD_alter_sds_values.c @@ -1,3 +1,5 @@ +#include + #include "mfhdf.h" #define FILE_NAME "SDS.hdf" diff --git a/HDF4Examples/C/SD/h4ex_SD_compress_sds.c b/HDF4Examples/C/SD/h4ex_SD_compress_sds.c index 0c4e7fe2b2..573de782df 100644 --- a/HDF4Examples/C/SD/h4ex_SD_compress_sds.c +++ b/HDF4Examples/C/SD/h4ex_SD_compress_sds.c @@ -1,3 +1,5 @@ +#include + #include "mfhdf.h" #define FILE_NAME "SDScompressed.hdf" diff --git a/HDF4Examples/C/SD/h4ex_SD_create_sds.c b/HDF4Examples/C/SD/h4ex_SD_create_sds.c index 67ad60d639..e719624c10 100644 --- a/HDF4Examples/C/SD/h4ex_SD_create_sds.c +++ b/HDF4Examples/C/SD/h4ex_SD_create_sds.c @@ -1,3 +1,5 @@ +#include + #include "mfhdf.h" #define FILE_NAME "SDS.hdf" diff --git a/HDF4Examples/C/SD/h4ex_SD_dimscale_vs_sds.c b/HDF4Examples/C/SD/h4ex_SD_dimscale_vs_sds.c index 8bc71bb6d5..96984b46ce 100644 --- a/HDF4Examples/C/SD/h4ex_SD_dimscale_vs_sds.c +++ b/HDF4Examples/C/SD/h4ex_SD_dimscale_vs_sds.c @@ -1,3 +1,5 @@ +#include + #include "mfhdf.h" #define FILE_NAME "SDS.hdf" diff --git a/HDF4Examples/C/SD/h4ex_SD_find_sds_by_name.c b/HDF4Examples/C/SD/h4ex_SD_find_sds_by_name.c index 520076be76..800ff84365 100644 --- a/HDF4Examples/C/SD/h4ex_SD_find_sds_by_name.c +++ b/HDF4Examples/C/SD/h4ex_SD_find_sds_by_name.c @@ -1,3 +1,5 @@ +#include + #include "mfhdf.h" #define FILE_NAME "SDS.hdf" diff --git a/HDF4Examples/C/SD/h4ex_SD_get_attr.c b/HDF4Examples/C/SD/h4ex_SD_get_attr.c index 086550b41c..f0584cbeca 100644 --- a/HDF4Examples/C/SD/h4ex_SD_get_attr.c +++ b/HDF4Examples/C/SD/h4ex_SD_get_attr.c @@ -1,3 +1,6 @@ +#include +#include + #include "mfhdf.h" #define FILE_NAME "SDS.hdf" diff --git a/HDF4Examples/C/SD/h4ex_SD_get_info.c b/HDF4Examples/C/SD/h4ex_SD_get_info.c index 7ce512f545..04fd83390a 100644 --- a/HDF4Examples/C/SD/h4ex_SD_get_info.c +++ b/HDF4Examples/C/SD/h4ex_SD_get_info.c @@ -1,3 +1,5 @@ +#include + #include "mfhdf.h" #define FILE_NAME "SDS.hdf" diff --git a/HDF4Examples/C/SD/h4ex_SD_mv_sds_to_external.c b/HDF4Examples/C/SD/h4ex_SD_mv_sds_to_external.c index 3136320778..a0b4ef093d 100644 --- a/HDF4Examples/C/SD/h4ex_SD_mv_sds_to_external.c +++ b/HDF4Examples/C/SD/h4ex_SD_mv_sds_to_external.c @@ -1,3 +1,5 @@ +#include + #include "mfhdf.h" #define FILE_NAME "SDS.hdf" diff --git a/HDF4Examples/C/SD/h4ex_SD_read_from_sds.c b/HDF4Examples/C/SD/h4ex_SD_read_from_sds.c index e96819a52a..af0802c198 100644 --- a/HDF4Examples/C/SD/h4ex_SD_read_from_sds.c +++ b/HDF4Examples/C/SD/h4ex_SD_read_from_sds.c @@ -1,3 +1,5 @@ +#include + #include "mfhdf.h" #define FILE_NAME "SDS.hdf" diff --git a/HDF4Examples/C/SD/h4ex_SD_read_subsets.c b/HDF4Examples/C/SD/h4ex_SD_read_subsets.c index 1ead1cd525..3ed03fe9a1 100644 --- a/HDF4Examples/C/SD/h4ex_SD_read_subsets.c +++ b/HDF4Examples/C/SD/h4ex_SD_read_subsets.c @@ -1,3 +1,5 @@ +#include + #include "mfhdf.h" #define FILE_NAME "SDS.hdf" diff --git a/HDF4Examples/C/SD/h4ex_SD_set_attr.c b/HDF4Examples/C/SD/h4ex_SD_set_attr.c index 607c8bae56..a5416d8033 100644 --- a/HDF4Examples/C/SD/h4ex_SD_set_attr.c +++ b/HDF4Examples/C/SD/h4ex_SD_set_attr.c @@ -1,3 +1,5 @@ +#include + #include "mfhdf.h" #define FILE_NAME "SDS.hdf" diff --git a/HDF4Examples/C/SD/h4ex_SD_set_get_dim_info.c b/HDF4Examples/C/SD/h4ex_SD_set_get_dim_info.c index 27b8db9ba2..0c64b7419a 100644 --- a/HDF4Examples/C/SD/h4ex_SD_set_get_dim_info.c +++ b/HDF4Examples/C/SD/h4ex_SD_set_get_dim_info.c @@ -1,3 +1,5 @@ +#include + #include "mfhdf.h" #define FILE_NAME "SDS.hdf" diff --git a/HDF4Examples/C/SD/h4ex_SD_unlimited_sds.c b/HDF4Examples/C/SD/h4ex_SD_unlimited_sds.c index 119eeacc3c..4721298acf 100644 --- a/HDF4Examples/C/SD/h4ex_SD_unlimited_sds.c +++ b/HDF4Examples/C/SD/h4ex_SD_unlimited_sds.c @@ -1,3 +1,5 @@ +#include + #include "mfhdf.h" #define FILE_NAME "SDSUNLIMITED.hdf" diff --git a/HDF4Examples/C/SD/h4ex_SD_write_slab.c b/HDF4Examples/C/SD/h4ex_SD_write_slab.c index 9355407880..c72877189c 100644 --- a/HDF4Examples/C/SD/h4ex_SD_write_slab.c +++ b/HDF4Examples/C/SD/h4ex_SD_write_slab.c @@ -1,3 +1,5 @@ +#include + #include "mfhdf.h" #define FILE_NAME "SLABS.hdf" diff --git a/HDF4Examples/C/SD/h4ex_SD_write_to_sds.c b/HDF4Examples/C/SD/h4ex_SD_write_to_sds.c index f0317eee07..93e419256f 100644 --- a/HDF4Examples/C/SD/h4ex_SD_write_to_sds.c +++ b/HDF4Examples/C/SD/h4ex_SD_write_to_sds.c @@ -1,3 +1,5 @@ +#include + #include "mfhdf.h" #define FILE_NAME "SDS.hdf" diff --git a/HDF4Examples/C/VD/h4ex_VD_create_onefield_vdatas.c b/HDF4Examples/C/VD/h4ex_VD_create_onefield_vdatas.c index 38cfa0606f..3332fa79f3 100644 --- a/HDF4Examples/C/VD/h4ex_VD_create_onefield_vdatas.c +++ b/HDF4Examples/C/VD/h4ex_VD_create_onefield_vdatas.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define FILE_NAME "h4ex_VD_create_onefield_vdatas.hdf" diff --git a/HDF4Examples/C/VD/h4ex_VD_create_vdatas.c b/HDF4Examples/C/VD/h4ex_VD_create_vdatas.c index 7e44fd914c..9fa17e9270 100644 --- a/HDF4Examples/C/VD/h4ex_VD_create_vdatas.c +++ b/HDF4Examples/C/VD/h4ex_VD_create_vdatas.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define FILE1_NAME "h4ex_VD_create_vdatas.hdf" diff --git a/HDF4Examples/C/VD/h4ex_VD_get_vdata_info.c b/HDF4Examples/C/VD/h4ex_VD_get_vdata_info.c index 9ee6678df2..66a766de92 100644 --- a/HDF4Examples/C/VD/h4ex_VD_get_vdata_info.c +++ b/HDF4Examples/C/VD/h4ex_VD_get_vdata_info.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define FILE_NAME "General_Vdatas.hdf" diff --git a/HDF4Examples/C/VD/h4ex_VD_locate_vdata.c b/HDF4Examples/C/VD/h4ex_VD_locate_vdata.c index 8a548a300b..658208d410 100644 --- a/HDF4Examples/C/VD/h4ex_VD_locate_vdata.c +++ b/HDF4Examples/C/VD/h4ex_VD_locate_vdata.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define FILE_NAME "General_Vdatas.hdf" diff --git a/HDF4Examples/C/VD/h4ex_VD_read_from_vdata.c b/HDF4Examples/C/VD/h4ex_VD_read_from_vdata.c index 256a3b2d77..92361fc33f 100644 --- a/HDF4Examples/C/VD/h4ex_VD_read_from_vdata.c +++ b/HDF4Examples/C/VD/h4ex_VD_read_from_vdata.c @@ -1,3 +1,6 @@ +#include +#include + #include "hdf.h" #define FILE_NAME "General_Vdatas.hdf" diff --git a/HDF4Examples/C/VD/h4ex_VD_read_mixed_vdata.c b/HDF4Examples/C/VD/h4ex_VD_read_mixed_vdata.c index 527147a9f2..7e50e2273e 100644 --- a/HDF4Examples/C/VD/h4ex_VD_read_mixed_vdata.c +++ b/HDF4Examples/C/VD/h4ex_VD_read_mixed_vdata.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define N_RECORDS 20 /* number of records to be read */ diff --git a/HDF4Examples/C/VD/h4ex_VD_set_get_vdata_attr.c b/HDF4Examples/C/VD/h4ex_VD_set_get_vdata_attr.c index 0544b277ca..480175bf3f 100644 --- a/HDF4Examples/C/VD/h4ex_VD_set_get_vdata_attr.c +++ b/HDF4Examples/C/VD/h4ex_VD_set_get_vdata_attr.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define FILE_NAME "General_Vdatas2.hdf" diff --git a/HDF4Examples/C/VD/h4ex_VD_write_mixed_vdata.c b/HDF4Examples/C/VD/h4ex_VD_write_mixed_vdata.c index d780e52413..54ab6f2958 100644 --- a/HDF4Examples/C/VD/h4ex_VD_write_mixed_vdata.c +++ b/HDF4Examples/C/VD/h4ex_VD_write_mixed_vdata.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define FILE_NAME "h4ex_VD_write_mixed_vdata.hdf" diff --git a/HDF4Examples/C/VD/h4ex_VD_write_mixed_vdata_struct.c b/HDF4Examples/C/VD/h4ex_VD_write_mixed_vdata_struct.c index 00195e2b8c..311c4a722e 100644 --- a/HDF4Examples/C/VD/h4ex_VD_write_mixed_vdata_struct.c +++ b/HDF4Examples/C/VD/h4ex_VD_write_mixed_vdata_struct.c @@ -19,6 +19,8 @@ N_RECORDS. This difference is the result of using an array of structs in this example to hold the field values instead of individual arrays as in Example 4. */ +#include + #include "hdf.h" #define FILE_NAME "h4ex_VD_write_mixed_vdata_struct.hdf" diff --git a/HDF4Examples/C/VD/h4ex_VD_write_to_vdata.c b/HDF4Examples/C/VD/h4ex_VD_write_to_vdata.c index 9ef9e5d420..d951cc3688 100644 --- a/HDF4Examples/C/VD/h4ex_VD_write_to_vdata.c +++ b/HDF4Examples/C/VD/h4ex_VD_write_to_vdata.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define FILE_NAME "General_Vdatas3.hdf" diff --git a/HDF4Examples/C/VG/h4ex_VG_add_sds_to_vgroup.c b/HDF4Examples/C/VG/h4ex_VG_add_sds_to_vgroup.c index 2d365b792a..df990f02c4 100644 --- a/HDF4Examples/C/VG/h4ex_VG_add_sds_to_vgroup.c +++ b/HDF4Examples/C/VG/h4ex_VG_add_sds_to_vgroup.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" /* Note: in this example, hdf.h can be omitted...*/ #include "mfhdf.h" /* ...since mfhdf.h already includes hdf.h */ diff --git a/HDF4Examples/C/VG/h4ex_VG_create_vgroup.c b/HDF4Examples/C/VG/h4ex_VG_create_vgroup.c index 072d4d3e34..ef476e89d1 100644 --- a/HDF4Examples/C/VG/h4ex_VG_create_vgroup.c +++ b/HDF4Examples/C/VG/h4ex_VG_create_vgroup.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define FILE_NAME "h4ex_VG_create_vgroup.hdf" diff --git a/HDF4Examples/C/VG/h4ex_VG_get_vgroup_info.c b/HDF4Examples/C/VG/h4ex_VG_get_vgroup_info.c index 690e177955..3d8095d7da 100644 --- a/HDF4Examples/C/VG/h4ex_VG_get_vgroup_info.c +++ b/HDF4Examples/C/VG/h4ex_VG_get_vgroup_info.c @@ -1,3 +1,6 @@ +#include +#include + #include "hdf.h" #define FILE_NAME "General_Vgroups.hdf" diff --git a/HDF4Examples/C/VG/h4ex_VG_insert_vdatas_to_vgroup.c b/HDF4Examples/C/VG/h4ex_VG_insert_vdatas_to_vgroup.c index db1b02b159..11e0dfec66 100644 --- a/HDF4Examples/C/VG/h4ex_VG_insert_vdatas_to_vgroup.c +++ b/HDF4Examples/C/VG/h4ex_VG_insert_vdatas_to_vgroup.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define FILE_NAME "General_Vgroups3.hdf" diff --git a/HDF4Examples/C/VG/h4ex_VG_set_get_vgroup_attr.c b/HDF4Examples/C/VG/h4ex_VG_set_get_vgroup_attr.c index d53aa3b942..427f7d189c 100644 --- a/HDF4Examples/C/VG/h4ex_VG_set_get_vgroup_attr.c +++ b/HDF4Examples/C/VG/h4ex_VG_set_get_vgroup_attr.c @@ -1,3 +1,5 @@ +#include + #include "hdf.h" #define FILE_NAME "General_Vgroups2.hdf" diff --git a/HDF4Examples/C/VG/h4ex_VG_vgroup_contents.c b/HDF4Examples/C/VG/h4ex_VG_vgroup_contents.c index 26e123be62..5553c962dd 100644 --- a/HDF4Examples/C/VG/h4ex_VG_vgroup_contents.c +++ b/HDF4Examples/C/VG/h4ex_VG_vgroup_contents.c @@ -1,3 +1,6 @@ +#include +#include + #include "hdf.h" #define FILE_NAME "General_Vgroups4.hdf" diff --git a/hdf/src/H4api_adpt.h b/hdf/src/H4api_adpt.h index cd5531728a..da9b6a542d 100644 --- a/hdf/src/H4api_adpt.h +++ b/hdf/src/H4api_adpt.h @@ -14,8 +14,6 @@ #ifndef H4_API_ADPT_H #define H4_API_ADPT_H -#include "h4config.h" - /** * Provide the macros to adapt the HDF public functions to * dll entry points. diff --git a/hdf/src/atom.c b/hdf/src/atom.c index 4662a10929..ac8c22b5aa 100644 --- a/hdf/src/atom.c +++ b/hdf/src/atom.c @@ -44,20 +44,11 @@ EXPORTED ROUTINES HAdestroy_group - Destroy an atomic group Atom Group Cleanup: HAshutdown - Terminate various static buffers. - -AUTHOR - Quincey Koziol - -MODIFICATION HISTORY - 1/3/96 - Starting writing specs & coding prototype - 1/7/96 - Finished coding prototype */ -#include "hdf.h" +#include "hdfi.h" #include "atom.h" -#include - /* # of bits to use for Group ID in each atom (change if MAXGROUP>16) */ #define GROUP_BITS 4 #define GROUP_MASK 0x0F diff --git a/hdf/src/atom.h b/hdf/src/atom.h index e59c1d37d8..042db4d636 100644 --- a/hdf/src/atom.h +++ b/hdf/src/atom.h @@ -24,7 +24,7 @@ #ifndef H4_ATOM_H #define H4_ATOM_H -#include "H4api_adpt.h" +#include "hdfi.h" /* Do swap using XOR operator. Ugly but fast... -QAK */ #define HAIswap_cache(i, j) \ diff --git a/hdf/src/bitvect.c b/hdf/src/bitvect.c index a7711120f8..5ec9f592e6 100644 --- a/hdf/src/bitvect.c +++ b/hdf/src/bitvect.c @@ -36,6 +36,7 @@ DESIGN for finding 1 bits as that is not a use case in the HDF4 library. */ +#include "hdfi.h" #include "bitvect.h" /* Base type of the array used to store the bits */ diff --git a/hdf/src/bitvect.h b/hdf/src/bitvect.h index e8a7e8157b..b595c779f9 100644 --- a/hdf/src/bitvect.h +++ b/hdf/src/bitvect.h @@ -19,9 +19,7 @@ #ifndef H4_BITVECT_H #define H4_BITVECT_H -#include "H4api_adpt.h" - -#include "hdf.h" +#include "hdfi.h" /* Boolean values used */ typedef enum { BV_FALSE = 0, BV_TRUE = 1 } bv_bool; diff --git a/hdf/src/cdeflate.c b/hdf/src/cdeflate.c index 2e3fb2ccd2..659ad2fc89 100644 --- a/hdf/src/cdeflate.c +++ b/hdf/src/cdeflate.c @@ -26,13 +26,10 @@ AUTHOR Quincey Koziol - - MODIFICATION HISTORY - 10/24/95 Starting coding */ /* General HDF includes */ -#include "hdf.h" +#include "hdfi.h" /* HDF compression includes */ #include "hcompi.h" /* Internal definitions for compression */ diff --git a/hdf/src/cdeflate.h b/hdf/src/cdeflate.h index 9df8cd538a..a9f8dd7beb 100644 --- a/hdf/src/cdeflate.h +++ b/hdf/src/cdeflate.h @@ -20,7 +20,7 @@ #ifndef H4_CDEFLATE_H #define H4_CDEFLATE_H -#include "H4api_adpt.h" +#include "hdfi.h" /* Get the gzip 'deflate' header */ #define intf zintf diff --git a/hdf/src/cnbit.c b/hdf/src/cnbit.c index a1e54e8b48..b1056f09e2 100644 --- a/hdf/src/cnbit.c +++ b/hdf/src/cnbit.c @@ -23,16 +23,10 @@ EXPORTED ROUTINES None of these routines are designed to be called by other users except for the modeling layer of the compression routines. - - AUTHOR - Quincey Koziol - - MODIFICATION HISTORY - 10/10/93 Starting writing specs & coding prototype */ /* General HDF includes */ -#include "hdf.h" +#include "hdfi.h" /* HDF compression includes */ #include "hcompi.h" /* Internal definitions for compression */ diff --git a/hdf/src/cnbit.h b/hdf/src/cnbit.h index 572a195f87..ca50cbe542 100644 --- a/hdf/src/cnbit.h +++ b/hdf/src/cnbit.h @@ -20,6 +20,8 @@ #ifndef H4_CNBIT_H #define H4_CNBIT_H +#include "hdfi.h" + /* size of the N-bit buffer */ #define NBIT_BUF_SIZE (MAX_NT_SIZE * 64) diff --git a/hdf/src/cnone.c b/hdf/src/cnone.c index 55e5fd73f7..9e94724f0a 100644 --- a/hdf/src/cnone.c +++ b/hdf/src/cnone.c @@ -25,16 +25,10 @@ EXPORTED ROUTINES None of these routines are designed to be called by other users except for the modeling layer of the compression routines. - - AUTHOR - Quincey Koziol - - MODIFICATION HISTORY - 4/25/94 Starting writing specs & coding prototype. */ /* General HDF includes */ -#include "hdf.h" +#include "hdfi.h" /* HDF compression includes */ #include "hcompi.h" /* Internal definitions for compression */ diff --git a/hdf/src/cnone.h b/hdf/src/cnone.h index 74bfe105e7..9b8167b9f3 100644 --- a/hdf/src/cnone.h +++ b/hdf/src/cnone.h @@ -18,13 +18,13 @@ * Invokes: none * Contents: Structures & definitions for "none" encoding. This header * should only be included in hcomp.c and cnone.c. - * Structure definitions: - * Constant definitions: *---------------------------------------------------------------------------*/ #ifndef H4_CNONE_H #define H4_CNONE_H +#include "hdfi.h" + /* "none" [en|de]coding information */ typedef struct { intn space_holder; /* merely a space holder so compilers don't barf */ diff --git a/hdf/src/crle.c b/hdf/src/crle.c index 09ce2e3ad4..e60e4a1e98 100644 --- a/hdf/src/crle.c +++ b/hdf/src/crle.c @@ -23,17 +23,10 @@ EXPORTED ROUTINES None of these routines are designed to be called by other users except for the modeling layer of the compression routines. - - AUTHOR - Quincey Koziol - - MODIFICATION HISTORY - 9/28/93 Starting writing specs & coding prototype. - 10/09/93 Finished testing. First version done. */ /* General HDF includes */ -#include "hdf.h" +#include "hdfi.h" /* HDF compression includes */ #include "hcompi.h" /* Internal definitions for compression */ diff --git a/hdf/src/crle.h b/hdf/src/crle.h index 4169cb116b..9d10832c50 100644 --- a/hdf/src/crle.h +++ b/hdf/src/crle.h @@ -25,6 +25,8 @@ #ifndef H4_CRLE_H #define H4_CRLE_H +#include "hdfi.h" + /* size of the RLE buffer */ #define RLE_BUF_SIZE 128 diff --git a/hdf/src/cskphuff.c b/hdf/src/cskphuff.c index 1e20d289c5..212c263b59 100644 --- a/hdf/src/cskphuff.c +++ b/hdf/src/cskphuff.c @@ -23,12 +23,6 @@ EXPORTED ROUTINES None of these routines are designed to be called by other users except for the modeling layer of the compression routines. - - AUTHOR - Quincey Koziol - - MODIFICATION HISTORY - 4/25/94 Starting writing specs & coding prototype */ /* @@ -37,7 +31,7 @@ */ /* General HDF includes */ -#include "hdf.h" +#include "hdfi.h" /* HDF compression includes */ #include "hcompi.h" /* Internal definitions for compression */ diff --git a/hdf/src/cskphuff.h b/hdf/src/cskphuff.h index 9f140dec8d..4040ad4716 100644 --- a/hdf/src/cskphuff.h +++ b/hdf/src/cskphuff.h @@ -20,6 +20,8 @@ #ifndef H4_CSKPHUFF_H #define H4_CSKPHUFF_H +#include "hdfi.h" + /* The maximum source character code: */ #define SKPHUFF_MAX_CHAR 255 diff --git a/hdf/src/cszip.c b/hdf/src/cszip.c index f06d9c3a8e..db1bdb6914 100644 --- a/hdf/src/cszip.c +++ b/hdf/src/cszip.c @@ -13,8 +13,7 @@ /* General HDF includes */ -#include "hdf.h" -#include +#include "hdfi.h" #ifdef H4_HAVE_LIBSZ #include "szlib.h" diff --git a/hdf/src/cszip.h b/hdf/src/cszip.h index e521fcdcba..eae0eab359 100644 --- a/hdf/src/cszip.h +++ b/hdf/src/cszip.h @@ -18,13 +18,13 @@ * Invokes: none * Contents: Structures & definitions for szip encoding. This header * should only be included in hcomp.c and cszip.c. - * Structure definitions: - * Constant definitions: *---------------------------------------------------------------------------*/ #ifndef H4_CSZIP_H #define H4_CSZIP_H +#include "hdfi.h" + /* Special parameters for szip compression */ /* [These are aliases for the similar definitions in ricehdf.h header file] */ #define H4_SZ_ALLOW_K13_OPTION_MASK 1 diff --git a/hdf/src/df24.c b/hdf/src/df24.c index b4105c84d0..2d064d6206 100644 --- a/hdf/src/df24.c +++ b/hdf/src/df24.c @@ -35,7 +35,7 @@ * dimension, compression, color compensation etc. *---------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" #include "dfgr.h" static intn Newdata = 0; /* does Readrig contain fresh data? */ diff --git a/hdf/src/df24f.c b/hdf/src/df24f.c index 1f83fd9408..019b90cd25 100644 --- a/hdf/src/df24f.c +++ b/hdf/src/df24f.c @@ -37,7 +37,7 @@ * dimension, compression, color compensation etc. *---------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" #include "dfgr.h" #include "hproto_fortran.h" diff --git a/hdf/src/dfan.c b/hdf/src/dfan.c index 7f6c69ab8d..1f6504a9c0 100644 --- a/hdf/src/dfan.c +++ b/hdf/src/dfan.c @@ -51,8 +51,9 @@ * DFANIgetfann: - get file annotation *---------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" #include "dfan.h" + static uint16 Lastref = 0; /* Last ref read/written */ static uint16 Next_label_ref = 0; /* Next file label ref to read/write */ static uint16 Next_desc_ref = 0; /* Next file desc ref to read/write */ diff --git a/hdf/src/dfan.h b/hdf/src/dfan.h index a771c46944..e0e2960bb2 100644 --- a/hdf/src/dfan.h +++ b/hdf/src/dfan.h @@ -18,13 +18,12 @@ * Contents: * Structure definitions: DFANdirentry, DFANdirhead * Constant definitions: DFAN_LABEL, DFAN_DESC - * Remarks: none *----------------------------------------------------------------------------*/ #ifndef H4_DFAN_H #define H4_DFAN_H -#include "hdf.h" +#include "hdfi.h" #define DFAN_LABEL 0 #define DFAN_DESC 1 diff --git a/hdf/src/dfanf.c b/hdf/src/dfanf.c index 316e505c4f..e11374039a 100644 --- a/hdf/src/dfanf.c +++ b/hdf/src/dfanf.c @@ -38,6 +38,8 @@ * * daiafid_ : add file id (intermediate routine) *---------------------------------------------------------------------------*/ + +#include "hdfi.h" #include "dfan.h" #include "df.h" #include "hproto_fortran.h" diff --git a/hdf/src/dfcomp.c b/hdf/src/dfcomp.c index 9463a43c3f..ac7a26810d 100644 --- a/hdf/src/dfcomp.c +++ b/hdf/src/dfcomp.c @@ -23,10 +23,10 @@ * Remarks: DFgetcomp and DFputcomp constitute a general compression interface *---------------------------------------------------------------------------*/ -/* This module (dfcomp.c) used to be in */ -/* charge of the general compression information */ -/* but hcomp.c now supersedes it. */ -#include "hdf.h" +/* This module (dfcomp.c) used to be in charge of the general compression + * information but hcomp.c now supersedes it + */ +#include "hdfi.h" #define R8_MAX_BLOCKS 32 #define R8_MAX_LENGTH 512 diff --git a/hdf/src/dfconv.c b/hdf/src/dfconv.c index 97927deccf..493fc4ca3c 100644 --- a/hdf/src/dfconv.c +++ b/hdf/src/dfconv.c @@ -43,8 +43,6 @@ Private functions: DFKInoset - Indicate that DFKsetNT hasn't been called - Remarks: - *------------------------------------------------------------------*/ /*****************************************************************************/ @@ -63,8 +61,7 @@ /* */ /*****************************************************************************/ -#include -#include "hdf.h" +#include "hdfi.h" #include "hconv.h" /* diff --git a/hdf/src/dfconvrt.h b/hdf/src/dfconvrt.h index 55ee431fae..96d5de1803 100644 --- a/hdf/src/dfconvrt.h +++ b/hdf/src/dfconvrt.h @@ -18,6 +18,8 @@ #ifndef H4_DFCONVRT_H #define H4_DFCONVRT_H +#include "hdfi.h" + #ifndef FUNC_CONV /* This is the default */ /* using the DFconvert macro instead of function */ diff --git a/hdf/src/dff.c b/hdf/src/dff.c index 39f684c56e..4d7ad5e18f 100644 --- a/hdf/src/dff.c +++ b/hdf/src/dff.c @@ -37,9 +37,11 @@ * dfstat: call DFstat to get status info on file * dfiishdf: call DFishdf to get HDF string *---------------------------------------------------------------------------*/ -#include "df.h" +#include "hdfi.h" +#include "df.h" #include "hproto_fortran.h" + /*----------------------------------------------------------------------------- * Name: dfiopen * Purpose: call DFopen to open HDF file diff --git a/hdf/src/dfgr.c b/hdf/src/dfgr.c index dfd6cc7698..53843e2428 100644 --- a/hdf/src/dfgr.c +++ b/hdf/src/dfgr.c @@ -43,7 +43,7 @@ * dimension, compression, color compensation etc. *---------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" #include "dfgr.h" static char *Grlastfile = NULL; diff --git a/hdf/src/dfgr.h b/hdf/src/dfgr.h index 2fe1ab09e3..5c1994b743 100644 --- a/hdf/src/dfgr.h +++ b/hdf/src/dfgr.h @@ -23,6 +23,8 @@ #ifndef H4_DFGR_H #define H4_DFGR_H +#include "hdfi.h" + /* description record: used to describe image data, palette data etc. */ typedef struct { intn ncomponents; /* number of components */ diff --git a/hdf/src/dfgroup.c b/hdf/src/dfgroup.c index 8822803fb4..a3e4232593 100644 --- a/hdf/src/dfgroup.c +++ b/hdf/src/dfgroup.c @@ -26,7 +26,7 @@ * Each tag/ref combination is called a data identifier (DI). *---------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" #include "hfile.h" typedef struct DIlist_struct { diff --git a/hdf/src/dfimcomp.c b/hdf/src/dfimcomp.c index ca8f1f661c..698dfcd7c2 100644 --- a/hdf/src/dfimcomp.c +++ b/hdf/src/dfimcomp.c @@ -22,7 +22,7 @@ /* DFCunimcomp(), sqr() */ /************************************************************************/ -#include "hdf.h" +#include "hdfi.h" #define PALSIZE 256 #define BIT8 0 diff --git a/hdf/src/dfjpeg.c b/hdf/src/dfjpeg.c index 3900588645..596d28d0ba 100644 --- a/hdf/src/dfjpeg.c +++ b/hdf/src/dfjpeg.c @@ -22,7 +22,7 @@ * that has to know about how to use the JPEG routines. *---------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" /* Hack to prevent libjpeg from re-defining `boolean` in a way that clashes * with windows.h. This MUST come before including jpeglib.h. diff --git a/hdf/src/dfknat.c b/hdf/src/dfknat.c index 1983f499c8..bdc1a7a7b9 100644 --- a/hdf/src/dfknat.c +++ b/hdf/src/dfknat.c @@ -47,7 +47,7 @@ /* */ /*****************************************************************************/ -#include "hdf.h" +#include "hdfi.h" #include "hconv.h" /*****************************************************************************/ diff --git a/hdf/src/dfkswap.c b/hdf/src/dfkswap.c index 018300fa72..17fae26779 100644 --- a/hdf/src/dfkswap.c +++ b/hdf/src/dfkswap.c @@ -46,7 +46,7 @@ /* */ /*****************************************************************************/ -#include "hdf.h" +#include "hdfi.h" #include "hconv.h" /*****************************************************************************/ diff --git a/hdf/src/dfp.c b/hdf/src/dfp.c index 6b4005f01a..2a14a3330a 100644 --- a/hdf/src/dfp.c +++ b/hdf/src/dfp.c @@ -27,7 +27,7 @@ * DFPIopen : open/reopen file *---------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" /* remember that '0' is invalid ref number */ static uint16 Readref = 0; diff --git a/hdf/src/dfpf.c b/hdf/src/dfpf.c index 994e178833..82648a59ff 100644 --- a/hdf/src/dfpf.c +++ b/hdf/src/dfpf.c @@ -28,7 +28,7 @@ * Remarks: none *---------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/dfr8.c b/hdf/src/dfr8.c index b3f0624ec0..4888cdea5a 100644 --- a/hdf/src/dfr8.c +++ b/hdf/src/dfr8.c @@ -40,7 +40,7 @@ * The palette is arranged as RGBRGB... *---------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" #include "dfrig.h" /* Private Variables */ diff --git a/hdf/src/dfr8f.c b/hdf/src/dfr8f.c index 1cdd2c83d1..f9f9fca7c3 100644 --- a/hdf/src/dfr8f.c +++ b/hdf/src/dfr8f.c @@ -29,10 +29,9 @@ * dfr8lastref: Call DFR8lastref to get ref of last image read/written * dfr8setpalette: Set palette to write out with subsequent images * dfr8restart: Call DFR8restart to reset sequencing to first image - * Remarks: none *---------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/dfrig.h b/hdf/src/dfrig.h index b11a1bf722..167147ace9 100644 --- a/hdf/src/dfrig.h +++ b/hdf/src/dfrig.h @@ -23,6 +23,8 @@ #ifndef H4_DFRIG_H #define H4_DFRIG_H +#include "hdfi.h" + /* description record: used to describe image data, palette data etc. */ typedef struct { int16 ncomponents; /* Number of components */ diff --git a/hdf/src/dfrle.c b/hdf/src/dfrle.c index 855fa7278e..f439c68684 100644 --- a/hdf/src/dfrle.c +++ b/hdf/src/dfrle.c @@ -21,7 +21,7 @@ * Remarks: DFCIrle() and DFCIunrle() compress and decompress RLE encoded info *---------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" /*----------------------------------------------------------------------------- * Name: DFCIrle diff --git a/hdf/src/dfsd.c b/hdf/src/dfsd.c index 361c51e28c..b32c9d4a4c 100644 --- a/hdf/src/dfsd.c +++ b/hdf/src/dfsd.c @@ -89,7 +89,7 @@ Fortran stub functions: This version assumes that all the values are floating point. *---------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" #include "dfsd.h" /* MMM: make this definition correct and move to hfile.h, or wherever. */ diff --git a/hdf/src/dfsdf.c b/hdf/src/dfsdf.c index 8619a2de02..dfb5882f4a 100644 --- a/hdf/src/dfsdf.c +++ b/hdf/src/dfsdf.c @@ -68,7 +68,7 @@ * Remarks: no C stubs needed for the put string routines, only Fortran stubs *---------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" #include "dfsd.h" #include "hproto_fortran.h" diff --git a/hdf/src/dfstubs.c b/hdf/src/dfstubs.c index f2e949c887..bcb5aad99f 100644 --- a/hdf/src/dfstubs.c +++ b/hdf/src/dfstubs.c @@ -40,6 +40,7 @@ ** Doug Ilg */ +#include "hdfi.h" #include "df.h" #define DFACC_APPEND 8 diff --git a/hdf/src/dfufp2i.c b/hdf/src/dfufp2i.c index d58ca9785d..373cbf77c1 100644 --- a/hdf/src/dfufp2i.c +++ b/hdf/src/dfufp2i.c @@ -22,11 +22,6 @@ * floating point data ---> | fp_to_hdf | and/or * (in an array) | | ----------> SDS * ----------- - * - * Invokes: libdf.a - * - * Includes: stdio.h, ctype.h, "df.h" - * * Public function: * DFUfptoimage: sets up structs with input params, calls process() * @@ -63,7 +58,7 @@ * *--------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" #include "dfufp2i.h" #include "dfsd.h" diff --git a/hdf/src/dfufp2i.h b/hdf/src/dfufp2i.h index 3adbfddd7e..31a3add12d 100644 --- a/hdf/src/dfufp2i.h +++ b/hdf/src/dfufp2i.h @@ -14,7 +14,7 @@ #ifndef H4_DFUFP2IM_H #define H4_DFUFP2IM_H -#include "H4api_adpt.h" +#include "hdfi.h" /* Input structure */ typedef struct { diff --git a/hdf/src/dfufp2if.c b/hdf/src/dfufp2if.c index e02ae3e0a7..5bfaeb5304 100644 --- a/hdf/src/dfufp2if.c +++ b/hdf/src/dfufp2if.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "hdf.h" +#include "hdfi.h" #include "dfufp2i.h" #include "dfsd.h" #include "hproto_fortran.h" diff --git a/hdf/src/dfunjpeg.c b/hdf/src/dfunjpeg.c index ec80dfb95a..ea9f2d21af 100644 --- a/hdf/src/dfunjpeg.c +++ b/hdf/src/dfunjpeg.c @@ -23,7 +23,7 @@ * routines. *---------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" /* Hack to prevent libjpeg from re-defining `boolean` in a way that clashes * with windows.h. This MUST come before including jpeglib.h. diff --git a/hdf/src/dfutil.c b/hdf/src/dfutil.c index 7ba6f7c4f0..cdf1451044 100644 --- a/hdf/src/dfutil.c +++ b/hdf/src/dfutil.c @@ -17,21 +17,14 @@ * Purpose: * General purpose utility routines, and callable versions of hdf utilities * - * Invokes: - * latest libdf.a - * * Public functions: * DFUfindnextref - For this tag, find the ref after given ref * - * Lower level functions: - * - * Private functions: - * * Remarks: * This version assumes that all the values are floating point. *--------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" /*----------------------------------------------------------------------------- * Name: DFfindnextref diff --git a/hdf/src/dfutilf.c b/hdf/src/dfutilf.c index 8797a29116..6c50c5b24c 100644 --- a/hdf/src/dfutilf.c +++ b/hdf/src/dfutilf.c @@ -19,8 +19,9 @@ * dfindnr_: For a given tag, find the next ref after the given ref *---------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" #include "hproto_fortran.h" + /*----------------------------------------------------------------------------- * Name: dfindnr * Purpose: For this tag, find the ref after lref diff --git a/hdf/src/dynarray.c b/hdf/src/dynarray.c index 1fd887fa03..501d042111 100644 --- a/hdf/src/dynarray.c +++ b/hdf/src/dynarray.c @@ -44,15 +44,9 @@ EXPORTED ROUTINES DAcreate_array - Create a dynarray DAdestroy_array - Destroy a dynarray DAsize_array - Get the current dynarray size - -AUTHOR - Quincey Koziol - -MODIFICATION HISTORY - 1/7/96 - Starting writing specs & coding prototype */ -#include "hdf.h" +#include "hdfi.h" #include "dynarray.h" typedef struct dynarray_tag { diff --git a/hdf/src/dynarray.h b/hdf/src/dynarray.h index 3b4a52d2d6..3353c0e9ba 100644 --- a/hdf/src/dynarray.h +++ b/hdf/src/dynarray.h @@ -19,7 +19,7 @@ #ifndef H4_DYNARRAY_H #define H4_DYNARRAY_H -#include "hdf.h" +#include "hdfi.h" /* Define the pointer to the dynarray without giving outside routines access diff --git a/hdf/src/glist.c b/hdf/src/glist.c index 10ef64792f..3a79b6a9e6 100644 --- a/hdf/src/glist.c +++ b/hdf/src/glist.c @@ -15,13 +15,9 @@ Credits: Original code is part of the public domain 'Generic List Library' by Keith Pomakis(kppomaki@jeeves.uwaterloo.ca)-Spring, 1994 - I modified it to adhere to HDF coding standards. - - 1996/06/04 - George V. ************************************************************************/ -#include -#include +#include "hdfi.h" #include "glist.h" /*+ diff --git a/hdf/src/glist.h b/hdf/src/glist.h index 3980d5f532..c6dc8dbb03 100644 --- a/hdf/src/glist.h +++ b/hdf/src/glist.h @@ -15,15 +15,12 @@ Credits: Original code is part of the public domain 'Generic List Library' by Keith Pomakis(kppomaki@jeeves.uwaterloo.ca)-Spring, 1994 - It has been modified to adhere to HDF coding standards. - - 1996/05/29 - George V. ************************************************************************/ #ifndef H4_GLIST_H #define H4_GLIST_H -#include "hdf.h" /* needed for data types */ +#include "hdfi.h" /* Structure for each element in the list */ typedef struct GLE_struct { diff --git a/hdf/src/hbitio.c b/hdf/src/hbitio.c index 5fffff3103..9a51ae1b11 100644 --- a/hdf/src/hbitio.c +++ b/hdf/src/hbitio.c @@ -34,13 +34,9 @@ LOCAL ROUTINES HIget_bitfile_rec - get a free bitfile record HIread2write - switch from reading bits to writing them HIwrite2read - switch from writing bits to reading them -AUTHOR - Quincey Koziol -MODIFICATION HISTORY - 3/15/92 Starting writing */ -#include "hdf.h" +#include "hdfi.h" #include "hfile.h" /* Local Variables */ diff --git a/hdf/src/hbitio.h b/hdf/src/hbitio.h index e7d0ad8b79..55c07807c1 100644 --- a/hdf/src/hbitio.h +++ b/hdf/src/hbitio.h @@ -21,6 +21,8 @@ #ifndef H4_HBITIO_H #define H4_HBITIO_H +#include "hdf.h" + /* Define the number of elements in the buffered array */ #define BITBUF_SIZE 4096 /* Macro to define the number of bits cached in the 'bits' variable */ diff --git a/hdf/src/hblocks.c b/hdf/src/hblocks.c index 19f4e2a143..c4e35fc353 100644 --- a/hdf/src/hblocks.c +++ b/hdf/src/hblocks.c @@ -118,7 +118,7 @@ LOCAL ROUTINES HLInewlink -- write out some data to a linked block */ -#include "hdf.h" +#include "hdfi.h" #include "hfile.h" /* block_t - record of a linked block. contains the tag and ref of the diff --git a/hdf/src/hbuffer.c b/hdf/src/hbuffer.c index 901bbbc93a..eaa5df5c78 100644 --- a/hdf/src/hbuffer.c +++ b/hdf/src/hbuffer.c @@ -45,9 +45,8 @@ EXPORTED ROUTINES ------------------------------------------------------------------------- */ -#include "hdf.h" +#include "hdfi.h" #include "hfile.h" -#include /* extinfo_t -- external elt information structure */ diff --git a/hdf/src/hchunks.c b/hdf/src/hchunks.c index 914a046229..8d7f736b1a 100644 --- a/hdf/src/hchunks.c +++ b/hdf/src/hchunks.c @@ -253,14 +253,14 @@ LOCAL ROUTINES #define STATISTICS */ -#include "hdf.h" +#include "hdfi.h" #include "hfile.h" -#include "mcache.h" /* cache */ +#include "mcache.h" #include "hchunks.h" -#include "tbbt.h" /* TBBT stuff */ -#include "mcache.h" /* caching routines */ -#include "hcomp.h" /* For Compression */ +#include "tbbt.h" +#include "mcache.h" +#include "hcomp.h" /* Define class, class version and name(partial) for chunk table i.e. Vdata */ #define _HDF_CHK_TBL_NAME "_HDF_CHK_TBL_" /* 13 bytes */ diff --git a/hdf/src/hchunks.h b/hdf/src/hchunks.h index 899394efbe..f59b97318c 100644 --- a/hdf/src/hchunks.h +++ b/hdf/src/hchunks.h @@ -15,19 +15,14 @@ * File: hchunks.h * Purpose: Header file for Chunked elements * Dependencies: tbbt.c mcache.c - * Invokes: none * Contents: Structures & definitions for chunked elements * Structure definitions: DIM_DEF, HCHUNK_DEF - * Constant definitions: - * Author: -GeorgeV - 9/3/96 *---------------------------------------------------------------------------*/ #ifndef H4_HCHUNKS_H #define H4_HCHUNKS_H -#include "H4api_adpt.h" - -/* required includes */ +#include "hdfi.h" #include "hfile.h" /* special info stuff */ /* Public structures */ diff --git a/hdf/src/hcomp.c b/hdf/src/hcomp.c index 01ff374074..64b74d4bb1 100644 --- a/hdf/src/hcomp.c +++ b/hdf/src/hcomp.c @@ -60,15 +60,10 @@ BUGS/LIMITATIONS EXPORTED ROUTINES HCcreate - create or modify an existing data element to be compressed -LOCAL ROUTINES - -AUTHOR - Quincey Koziol - */ /* General HDF includes */ -#include "hdf.h" +#include "hdfi.h" #ifdef H4_HAVE_LIBSZ #include "szlib.h" diff --git a/hdf/src/hcomp.h b/hdf/src/hcomp.h index da5d703072..06ba43a969 100644 --- a/hdf/src/hcomp.h +++ b/hdf/src/hcomp.h @@ -24,6 +24,8 @@ #ifndef H4_HCOMP_H #define H4_HCOMP_H +#include "hdf.h" + /* For determining which type of modeling is being done */ typedef enum { COMP_MODEL_STDIO = 0 /* for Standard C I/O model */ diff --git a/hdf/src/hcompi.h b/hdf/src/hcompi.h index 54b0270f44..f1971e19c5 100644 --- a/hdf/src/hcompi.h +++ b/hdf/src/hcompi.h @@ -24,6 +24,7 @@ #ifndef H4_HCOMPI_H #define H4_HCOMPI_H +#include "hdfi.h" #include "hfile.h" /* Modeling information */ diff --git a/hdf/src/hcompri.c b/hdf/src/hcompri.c index 3e26a315d0..936d001f12 100644 --- a/hdf/src/hcompri.c +++ b/hdf/src/hcompri.c @@ -44,9 +44,8 @@ ------------------------------------------------------------------------- */ -#include "hdf.h" +#include "hdfi.h" #include "hfile.h" -#include /* crinfo_t -- compressed raster information structure */ diff --git a/hdf/src/hconv.h b/hdf/src/hconv.h index eb9aa2562a..ea74033ca1 100644 --- a/hdf/src/hconv.h +++ b/hdf/src/hconv.h @@ -14,15 +14,13 @@ /*----------------------------------------------------------------------------- * File: hconv.h * Purpose: header file for data conversion information & structures - * Invokes: - * Contents: - * Structure definitions: - * Constant definitions: lots... *---------------------------------------------------------------------------*/ #ifndef H4_HCONV_H #define H4_HCONV_H +#include "hdfi.h" + /* This looks redundant because previously, VMS platform would undefine DUFF. */ /* Don't know why. -AKC 2014/1/18 */ #define DUFF diff --git a/hdf/src/hdatainfo.c b/hdf/src/hdatainfo.c index 61f9b40c9d..22a54aaee8 100644 --- a/hdf/src/hdatainfo.c +++ b/hdf/src/hdatainfo.c @@ -44,7 +44,7 @@ LOW-LEVEL ROUTINES **********************************************************************/ -#include "hdf.h" +#include "hdfi.h" #include "hlimits.h" #include "vgint.h" #include "mfani.h" diff --git a/hdf/src/hdf.h b/hdf/src/hdf.h index b73e7315bc..2882c7d597 100644 --- a/hdf/src/hdf.h +++ b/hdf/src/hdf.h @@ -14,7 +14,14 @@ #ifndef H4_HDF_H #define H4_HDF_H -#include "hdfi.h" +/* NOTE: This header is not protected by include guards, so don't include + * it outside of hdf.h + */ +#include "h4config.h" + +#include + +/* Library limits */ #include "hlimits.h" /*------------------------------------------------------------------------- @@ -166,16 +173,20 @@ typedef intn (*hdf_termfunc_t)(void); /* termination function typedef */ /* .................................................................. */ +/* API adapter header (defines HDFPUBLIC, etc.) */ +#include "H4api_adpt.h" + /* Publicly accessible functions declarations. This includes all the - functions that are used by application programs. */ + * functions that are used by application programs. + */ #include "hbitio.h" #include "hcomp.h" #include "herr.h" #include "hproto.h" -#include "hdatainfo.h" /* Add the data info header */ -#include "vg.h" /* Add the Vgroup/Vdata header so the users don't have to */ -#include "mfgr.h" /* Add the GR header so the users don't have to */ +#include "hdatainfo.h" /* data info header */ +#include "vg.h" /* Vgroup/Vdata header */ +#include "mfgr.h" /* GR header */ /* these may eventually evolve into real-life functions but not yet */ #define HDFopen(f, a, d) Hopen((f), (a), (d)) diff --git a/hdf/src/hdfalloc.c b/hdf/src/hdfalloc.c index b4f153b189..81dee7778d 100644 --- a/hdf/src/hdfalloc.c +++ b/hdf/src/hdfalloc.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "hdf.h" +#include "hdfi.h" /* LOCAL ROUTINES diff --git a/hdf/src/hdfi.h b/hdf/src/hdfi.h index ee9cc63b97..f5b6df2ffa 100644 --- a/hdf/src/hdfi.h +++ b/hdf/src/hdfi.h @@ -14,7 +14,18 @@ #ifndef H4_HDFI_H #define H4_HDFI_H -#include "H4api_adpt.h" +/* Define the I/O scheme before hdf.h to avoid an ordering mess in the + * vconv.c code + */ + +/* I/O library constants */ +#define UNIXUNBUFIO 1 +#define UNIXBUFIO 2 + +/* The library always uses UNIXBUFIO */ +#define FILELIB UNIXBUFIO + +#include "hdf.h" /*--------------------------------------------------------------------------*/ /* MT/NT constants */ @@ -59,17 +70,9 @@ #define DF_MT DFMT_LE #endif -/* I/O library constants */ -#define UNIXUNBUFIO 1 -#define UNIXBUFIO 2 - -/* The library always uses UNIXBUFIO */ -#define FILELIB UNIXBUFIO - /* Standard C library headers */ #include #include -#include #include #include #include @@ -103,6 +106,9 @@ /* Windows headers */ #ifdef H4_HAVE_WIN32_API +/* Needed for XDR. Must come BEFORE windows.h!!! */ +#include + #include #include #include diff --git a/hdf/src/herr.c b/hdf/src/herr.c index df994eebc3..7149bd6afa 100644 --- a/hdf/src/herr.c +++ b/hdf/src/herr.c @@ -26,7 +26,7 @@ EXPORTED ROUTINES HEvalue -- return a error off of the error stack */ -#include "hdf.h" +#include "hdfi.h" /* ** Include files for variable argument processing for HEreport diff --git a/hdf/src/herr.h b/hdf/src/herr.h index 3304ffb95b..4f6d8bf7b9 100644 --- a/hdf/src/herr.h +++ b/hdf/src/herr.h @@ -19,6 +19,8 @@ #ifndef H4_HERR_H #define H4_HERR_H +#include "hdf.h" + /* HERROR macro, used to facilitate error reporting */ #define HERROR(e) HEpush(e, __func__, __FILE__, __LINE__) diff --git a/hdf/src/herrf.c b/hdf/src/herrf.c index 440c3a7e45..fbb023bdc4 100644 --- a/hdf/src/herrf.c +++ b/hdf/src/herrf.c @@ -20,7 +20,7 @@ * Remarks: none *---------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/hfile.c b/hdf/src/hfile.c index 9e4a37c473..cfbc6b41df 100644 --- a/hdf/src/hfile.c +++ b/hdf/src/hfile.c @@ -110,11 +110,10 @@ HIread_version -- reads a version tag from a file + */ -#include +#include -#include "hdf.h" +#include "hdfi.h" #include "hfile.h" -#include #include "glist.h" /* for double-linked lists, stacks and queues */ /*--------------------- Locally defined Globals -----------------------------*/ diff --git a/hdf/src/hfile.h b/hdf/src/hfile.h index e23e844586..447c31ab44 100644 --- a/hdf/src/hfile.h +++ b/hdf/src/hfile.h @@ -18,7 +18,7 @@ #ifndef H4_HFILE_H #define H4_HFILE_H -#include "H4api_adpt.h" +#include "hdfi.h" #include "tbbt.h" #include "bitvect.h" diff --git a/hdf/src/hfiledd.c b/hdf/src/hfiledd.c index 3128e26ecf..5a222ead01 100644 --- a/hdf/src/hfiledd.c +++ b/hdf/src/hfiledd.c @@ -82,15 +82,9 @@ OLD ROUTINES HIupdate_dd - write an updated dd to the file HIregister_tag_ref - mark a ref as used for a tag HIunregister_tag_ref - mark a ref as un-used for a tag - -AUTHOR - Quincey Koziol - -MODIFICATION HISTORY - 12/20/95 - Starting writing specs & coding prototype */ -#include "hdf.h" +#include "hdfi.h" #include "hfile.h" /* Private routines */ diff --git a/hdf/src/hfilef.c b/hdf/src/hfilef.c index 96f141e9ef..3f287bf9eb 100644 --- a/hdf/src/hfilef.c +++ b/hdf/src/hfilef.c @@ -20,7 +20,7 @@ * hclose_: call Hclose to close HDF file *---------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/hkit.c b/hdf/src/hkit.c index 6956caeb54..bf449c7db7 100644 --- a/hdf/src/hkit.c +++ b/hdf/src/hkit.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include +#include "hdfi.h" #include "hkit.h" /* diff --git a/hdf/src/hkit.h b/hdf/src/hkit.h index 1b655dbbe3..e557d03dbc 100644 --- a/hdf/src/hkit.h +++ b/hdf/src/hkit.h @@ -18,7 +18,7 @@ #ifndef H4_HKIT_H #define H4_HKIT_H -#include "hdf.h" +#include "hdfi.h" #include "hfile.h" /* tag_messages is the list of tag descriptions in the system, kept as diff --git a/hdf/src/hlimits.h b/hdf/src/hlimits.h index 2ce01c319b..8873ee4f21 100644 --- a/hdf/src/hlimits.h +++ b/hdf/src/hlimits.h @@ -20,6 +20,8 @@ #ifndef H4_HLIMITS_H #define H4_HLIMITS_H +#include "hdf.h" + #if defined H4_HAVE_WIN32_API #define HDsetvbuf(F, S, M, Z) (((Z) > 1) ? setvbuf(F, S, M, Z) : setvbuf(F, S, M, 2)) #else diff --git a/hdf/src/hproto.h b/hdf/src/hproto.h index b8890863f2..43cfc951ac 100644 --- a/hdf/src/hproto.h +++ b/hdf/src/hproto.h @@ -14,7 +14,10 @@ #ifndef H4_H_PROTO #define H4_H_PROTO +#include /* for FILE */ + #include "H4api_adpt.h" +#include "hdf.h" /* Useful macros, which someday might become actual functions */ /* Wrappers for Hinquire. feb-2-92 */ diff --git a/hdf/src/hqueue.h b/hdf/src/hqueue.h index 95412f3f68..5f7d24ebd0 100644 --- a/hdf/src/hqueue.h +++ b/hdf/src/hqueue.h @@ -35,9 +35,6 @@ * This is a modffied version of the original Berkeley code for * manipulating a memory pool. This version however is not * compatible with the original Berkeley version. - * - * Author: George V.- 9/3/96 - * *****************************************************************************/ #ifndef H4_HQUEUE_H diff --git a/hdf/src/htags.h b/hdf/src/htags.h index 421f6da68a..984f73500d 100644 --- a/hdf/src/htags.h +++ b/hdf/src/htags.h @@ -18,6 +18,8 @@ #ifndef H4_HTAGS_H #define H4_HTAGS_H +#include "hdf.h" + /* wild-card tags and refs. Should only be used in interface calls and never stored in the file i.e. in DD's. */ #define DFREF_WILDCARD 0 diff --git a/hdf/src/linklist.c b/hdf/src/linklist.c index 22e4b7047a..5180e16460 100644 --- a/hdf/src/linklist.c +++ b/hdf/src/linklist.c @@ -42,16 +42,9 @@ EXPORTED ROUTINES HULnext_node - Get the next object in a linked-list HULremove_node - Removes an object from a linked-list HULshutdown - Close down the HUL interface - -AUTHOR - Quincey Koziol - -MODIFICATION HISTORY - 2/5/96 - Starting writing specs & coding prototype - 2/12/96 - Finished writing specs & coding prototype, start testing */ -#include "hdf.h" +#include "hdfi.h" #include "linklist.h" /* Pointer to the list node free list */ diff --git a/hdf/src/linklist.h b/hdf/src/linklist.h index 55f0767e8f..d7cbfd9c54 100644 --- a/hdf/src/linklist.h +++ b/hdf/src/linklist.h @@ -19,7 +19,7 @@ #ifndef H4_LINKLIST_H #define H4_LINKLIST_H -#include "hdf.h" +#include "hdfi.h" /* Definitions for linked-list creation flags */ #define HUL_UNSORTED_LIST 0x0000 diff --git a/hdf/src/mcache.c b/hdf/src/mcache.c index cb7e742b43..01769d3362 100644 --- a/hdf/src/mcache.c +++ b/hdf/src/mcache.c @@ -35,8 +35,6 @@ * compatible with the original Berkeley version. * * NOTE: references to pages here is the same as chunks - * - * AUTHOR - George V.- 1996/08/22 *****************************************************************************/ /* @@ -51,8 +49,8 @@ #define STATISTICS */ -#include "hdf.h" /* number types ..etc */ -#include "hqueue.h" /* Circular queue functions(Macros) */ +#include "hdfi.h" +#include "hqueue.h" #include "mcache.h" /* Private routines */ diff --git a/hdf/src/mcache.h b/hdf/src/mcache.h index b552e8213c..cd5d0114ce 100644 --- a/hdf/src/mcache.h +++ b/hdf/src/mcache.h @@ -36,8 +36,6 @@ * compatible with the original Berkeley version. * * This version uses HDF number types. - * - * AUTHOR - George V.- 1996/08/22 *****************************************************************************/ /* @@ -51,11 +49,9 @@ #ifndef H4_MCACHE_H #define H4_MCACHE_H -/* Required include */ +#include "hdfi.h" #include "hqueue.h" /* Circular queue functions(Macros) */ -#include "H4api_adpt.h" - /* Set return/succeed values */ #ifdef SUCCEED #define RET_SUCCESS SUCCEED diff --git a/hdf/src/mfan.c b/hdf/src/mfan.c index 7ad3c9d5b5..bb45bb7596 100644 --- a/hdf/src/mfan.c +++ b/hdf/src/mfan.c @@ -13,7 +13,6 @@ /*----------------------------------------------------------------------------- * File: mfan.c - * Author: GeorgeV * Purpose: Multi-file read and write annotations: labels and descriptions * of data items and file * Invokes: @@ -29,8 +28,6 @@ * NOTE2: Note that any mention of file ID's except in ANStart() * should now refer to annotation interface ID. * - * Contents: - * * Private Routines: * ----------------- * NOTES: TYPE here refers to file/data label/description types @@ -81,6 +78,8 @@ * *---------------------------------------------------------------------------*/ +#include "hdfi.h" + #include "mfani.h" #include "mfan.h" #include "atom.h" diff --git a/hdf/src/mfan.h b/hdf/src/mfan.h index 0804eaa740..cb8cdee532 100644 --- a/hdf/src/mfan.h +++ b/hdf/src/mfan.h @@ -19,9 +19,7 @@ #ifndef H4_MFAN_H #define H4_MFAN_H -#include "H4api_adpt.h" - -#include "hdf.h" +#include "hdfi.h" #ifdef __cplusplus extern "C" { diff --git a/hdf/src/mfanf.c b/hdf/src/mfanf.c index eb01f369ea..25ca8f6f0a 100644 --- a/hdf/src/mfanf.c +++ b/hdf/src/mfanf.c @@ -13,7 +13,6 @@ /*----------------------------------------------------------------------------- * File: mfanf.c - * Author: GeorgeV. * Purpose: C-stubs for multi-file Fortran annotation routines * Invokes: C-Routines in "mfan.c" * Contents: SEE annotation source/header files "mfan.c" and "mfan.h" @@ -48,7 +47,7 @@ * aftagatype - annotation TAG to corresponding annotation type *---------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/mfani.h b/hdf/src/mfani.h index bed5ec1325..40b90592cd 100644 --- a/hdf/src/mfani.h +++ b/hdf/src/mfani.h @@ -19,7 +19,7 @@ #ifndef H4_MFANI_H #define H4_MFANI_H -#include "hdf.h" +#include "hdfi.h" /* This structure is used to find which file the annotation belongs to * and use the subsequent file specific annotation 'key' to find the diff --git a/hdf/src/mfgr.c b/hdf/src/mfgr.c index ad597b5d44..5007e646d9 100644 --- a/hdf/src/mfgr.c +++ b/hdf/src/mfgr.c @@ -152,16 +152,9 @@ LOCAL ROUTINES intn GRIil_convert(const void * inbuf,gr_interlace_t inil,void * outbuf, gr_interlace_t outil,int32 dims[2],int32 ncomp,int32 nt); - Copy a pixel buffer from one interlace to another. - -AUTHOR - Quincey Koziol - -MODIFICATION HISTORY - 10/20/95 - Starting writing specs & coding prototype - 3/ 8/96 - Modifications to remove compiled limits on the # of files */ -#include "hdf.h" +#include "hdfi.h" #include "hlimits.h" #include "mfgri.h" diff --git a/hdf/src/mfgr.h b/hdf/src/mfgr.h index aee4dccf98..5c355b442c 100644 --- a/hdf/src/mfgr.h +++ b/hdf/src/mfgr.h @@ -19,6 +19,8 @@ #ifndef H4_MFGR_H #define H4_MFGR_H +#include "hdf.h" + /* Interlace types available */ typedef int16 gr_interlace_t; #define MFGR_INTERLACE_PIXEL 0 /* pixel interlacing scheme */ diff --git a/hdf/src/mfgrf.c b/hdf/src/mfgrf.c index 31f126dd2f..f47996a2a4 100644 --- a/hdf/src/mfgrf.c +++ b/hdf/src/mfgrf.c @@ -52,10 +52,9 @@ * mgfndat: Call GRfindattr to get the index of an attribute for a name * mglut2ref: Call GRluttoref to get reference number for a palette specified * by palette identifier - * Remarks: *---------------------------------------------------------------------------*/ -#include "hdf.h" +#include "hdfi.h" #include "hproto_fortran.h" /* Local pre-processor macros */ diff --git a/hdf/src/mfgrff.f b/hdf/src/mfgrff.f index 090abf6d5d..fd4713b05b 100644 --- a/hdf/src/mfgrff.f +++ b/hdf/src/mfgrff.f @@ -18,7 +18,6 @@ C Invokes: mfgrf.c C Contents: C dsgdims: get dimensions of next SDG -C Remarks: none C------------------------------------------------------------------------------ diff --git a/hdf/src/mfgri.h b/hdf/src/mfgri.h index 42b02f0eed..6e6f5dc80b 100644 --- a/hdf/src/mfgri.h +++ b/hdf/src/mfgri.h @@ -19,10 +19,10 @@ #ifndef H4_MFGRI_H #define H4_MFGRI_H -#include "H4api_adpt.h" +#include "hdfi.h" #include "hfile.h" -#include "tbbt.h" /* Get tbbt routines */ +#include "tbbt.h" /* This is the size of the hash tables used for GR & RI IDs */ #define GRATOM_HASH_SIZE 32 diff --git a/hdf/src/mstdio.c b/hdf/src/mstdio.c index d97b5b9859..4ff60da112 100644 --- a/hdf/src/mstdio.c +++ b/hdf/src/mstdio.c @@ -36,17 +36,10 @@ EXPORTED ROUTINES HCPmstdio_inquire -- Inquire information about the access record and data element. HCPmstdio_endaccess -- Close the compressed data element - -AUTHOR - Quincey Koziol - -MODIFICATION HISTORY - 9/28/93 Starting writing specs & coding prototype - 10/09/93 Finished testing. First version done. */ /* General HDF includes */ -#include "hdf.h" +#include "hdfi.h" #include "hfile.h" /* HDF compression includes */ diff --git a/hdf/src/mstdio.h b/hdf/src/mstdio.h index 46fdce854b..35a90eca25 100644 --- a/hdf/src/mstdio.h +++ b/hdf/src/mstdio.h @@ -15,16 +15,15 @@ * File: mstdio.h * Purpose: Header file for stdio-like modeling information. * Dependencies: should be included after hdf.h - * Invokes: * Contents: Structures & definitions for stdio modeling. This header * should only be included in hcomp.c and mstdio.c. - * Structure definitions: - * Constant definitions: *---------------------------------------------------------------------------*/ #ifndef H4_MSTDIO_H #define H4_MSTDIO_H +#include "hdfi.h" + /* model information about stdio model */ typedef struct { int32 pos; /* position ? */ diff --git a/hdf/src/tbbt.c b/hdf/src/tbbt.c index 55b6480bba..092a98a2ff 100644 --- a/hdf/src/tbbt.c +++ b/hdf/src/tbbt.c @@ -15,9 +15,7 @@ /* Extended from (added threads to) Knuth 6.2.3, Algorithm A (AVL trees) */ /* Basic tree structure by Adel'son-Vel'skii and Landis */ -#include - -#include "hdf.h" +#include "hdfi.h" #define TBBT_INTERNALS #include "tbbt.h" diff --git a/hdf/src/tbbt.h b/hdf/src/tbbt.h index c98cb8d540..481af1e6c1 100644 --- a/hdf/src/tbbt.h +++ b/hdf/src/tbbt.h @@ -17,9 +17,7 @@ #ifndef H4_TBBT_H #define H4_TBBT_H -#include "H4api_adpt.h" - -#include "hdf.h" +#include "hdfi.h" typedef struct tbbt_node TBBT_NODE; diff --git a/hdf/src/vattr.c b/hdf/src/vattr.c index 5de171ec94..0bc38388ed 100644 --- a/hdf/src/vattr.c +++ b/hdf/src/vattr.c @@ -11,6 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include "hdfi.h" +#include "vgint.h" + /************************************************************** * * vattr.c diff --git a/hdf/src/vattrf.c b/hdf/src/vattrf.c index 6241f65861..d85b005da7 100644 --- a/hdf/src/vattrf.c +++ b/hdf/src/vattrf.c @@ -18,11 +18,10 @@ * * C routines (short names) to be called from fortran * - * ******************************************************/ #define VSET_INTERFACE -#include "hdf.h" +#include "hdfi.h" #include "hproto_fortran.h" /* ----------------- vsfcfdx ---------------------- diff --git a/hdf/src/vconv.c b/hdf/src/vconv.c index 4bfb7186a6..220eef09cb 100644 --- a/hdf/src/vconv.c +++ b/hdf/src/vconv.c @@ -28,7 +28,8 @@ */ #define VSET_INTERFACE -#include "hdf.h" +#include "hdfi.h" +#include "hfile.h" /* ** ================================================================== diff --git a/hdf/src/vg.c b/hdf/src/vg.c index a2aad55303..58a63d96b9 100644 --- a/hdf/src/vg.c +++ b/hdf/src/vg.c @@ -62,7 +62,7 @@ PRIVATE data structures in here pertain to vdata in vsdir only. */ #define VSET_INTERFACE -#include "hdf.h" +#include "hdfi.h" /* These are used to determine whether a vdata had been created by the library internally, that is, not created by user's application */ diff --git a/hdf/src/vgf.c b/hdf/src/vgf.c index 451a94dc00..f6f4fc8e13 100644 --- a/hdf/src/vgf.c +++ b/hdf/src/vgf.c @@ -32,7 +32,7 @@ *********************************************************************** */ #define VSET_INTERFACE -#include "hdf.h" +#include "hdfi.h" #include "hproto_fortran.h" /* diff --git a/hdf/src/vgint.h b/hdf/src/vgint.h index f97d3ee584..454e256b5f 100644 --- a/hdf/src/vgint.h +++ b/hdf/src/vgint.h @@ -28,8 +28,7 @@ #ifndef H4_VGINT_H #define H4_VGINT_H -#include "H4api_adpt.h" - +#include "hdfi.h" #include "hfile.h" /* Include file for Threaded, Balanced Binary Tree implementation */ diff --git a/hdf/src/vgp.c b/hdf/src/vgp.c index ad13c99c3e..3730ab2c8b 100644 --- a/hdf/src/vgp.c +++ b/hdf/src/vgp.c @@ -102,7 +102,7 @@ EXPORTED ROUTINES *************************************************************************/ #define VSET_INTERFACE -#include "hdf.h" +#include "hdfi.h" /* These are used to determine whether a vgroup had been created by the library internally, that is, not created by user's application */ diff --git a/hdf/src/vhi.c b/hdf/src/vhi.c index 36e6b342de..08eeae0958 100644 --- a/hdf/src/vhi.c +++ b/hdf/src/vhi.c @@ -23,7 +23,7 @@ */ #define VSET_INTERFACE -#include "hdf.h" +#include "hdfi.h" /* ------------------------ VHstoredata ------------------------------- NAME diff --git a/hdf/src/vio.c b/hdf/src/vio.c index 1794f1290f..f2b3079f8b 100644 --- a/hdf/src/vio.c +++ b/hdf/src/vio.c @@ -59,7 +59,7 @@ EXPORTED ROUTINES *************************************************************************/ #define VSET_INTERFACE -#include "hdf.h" +#include "hdfi.h" /* Private Function Prototypes */ static intn vunpackvs(VDATA *vs, uint8 buf[], int32 len); diff --git a/hdf/src/vparse.c b/hdf/src/vparse.c index 8640545a65..e53f386506 100644 --- a/hdf/src/vparse.c +++ b/hdf/src/vparse.c @@ -23,7 +23,7 @@ ************************************************************************/ #define VSET_INTERFACE -#include "hdf.h" +#include "hdfi.h" #define ISCOMMA(c) ((c == ',') ? 1 : 0) diff --git a/hdf/src/vrw.c b/hdf/src/vrw.c index 44c9c85765..c9676458d0 100644 --- a/hdf/src/vrw.c +++ b/hdf/src/vrw.c @@ -35,7 +35,7 @@ EXPORTED ROUTINES ************************************************************************/ #define VSET_INTERFACE -#include "hdf.h" +#include "hdfi.h" #ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) diff --git a/hdf/src/vsfld.c b/hdf/src/vsfld.c index d502623ae5..2eec0c5b59 100644 --- a/hdf/src/vsfld.c +++ b/hdf/src/vsfld.c @@ -37,7 +37,7 @@ EXPORTED ROUTINES ************************************************************************/ #define VSET_INTERFACE -#include "hdf.h" +#include "hdfi.h" #include /* diff --git a/hdf/test/forsupf.c b/hdf/test/forsupf.c index b9a0571ede..73873a2b89 100644 --- a/hdf/test/forsupf.c +++ b/hdf/test/forsupf.c @@ -11,6 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include + #include "hdf.h" #include "fortest.h" diff --git a/hdf/test/tproto.h b/hdf/test/tproto.h index a1650cd5f0..83140f4c66 100644 --- a/hdf/test/tproto.h +++ b/hdf/test/tproto.h @@ -14,7 +14,7 @@ #ifndef H4_TPROTO_H #define H4_TPROTO_H -#include "hdf.h" +#include "hdfi.h" #include "tutils.h" void test_an(void); diff --git a/hdf/test/tszip.c b/hdf/test/tszip.c index 93528b8a6b..1caeeb5ff7 100644 --- a/hdf/test/tszip.c +++ b/hdf/test/tszip.c @@ -14,7 +14,7 @@ /* * SZIP support eliminated for HDF4.2R1 */ -#include +#include "hdf.h" #include "tutils.h" #ifdef H4_HAVE_LIBSZ diff --git a/hdf/test/tutils.h b/hdf/test/tutils.h index 0ac848f172..e9edba0cbb 100644 --- a/hdf/test/tutils.h +++ b/hdf/test/tutils.h @@ -14,6 +14,8 @@ #ifndef H4_TUTILS_H #define H4_TUTILS_H +#include "hdfi.h" + /* Define these for use in all the tests */ #ifndef TESTMASTER extern diff --git a/hdf/util/fp2hdf.c b/hdf/util/fp2hdf.c index da16309463..e274061be1 100644 --- a/hdf/util/fp2hdf.c +++ b/hdf/util/fp2hdf.c @@ -145,11 +145,13 @@ * */ -#include "hdf.h" -#include +#include #include +#include +#include #include -#include + +#include "hdf.h" #ifdef H4_HAVE_SYS_STAT_H #include diff --git a/hdf/util/gif2hdf.c b/hdf/util/gif2hdf.c index 3a901e01ec..f68c330cb7 100644 --- a/hdf/util/gif2hdf.c +++ b/hdf/util/gif2hdf.c @@ -11,9 +11,12 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include -#include "gif.h" #include +#include + +#include "hdf.h" +#include "gif.h" + int main(int argv, char *argc[]) { diff --git a/hdf/util/gif2mem.c b/hdf/util/gif2mem.c index cae024c422..b1f9b3b11a 100644 --- a/hdf/util/gif2mem.c +++ b/hdf/util/gif2mem.c @@ -31,9 +31,12 @@ ** ** ** Copyright (C) 1991-92 by Graphics Software Labs. All rights reserved. ** \****************************************************************************/ + #include +#include + #include "gif.h" -#include +#include "hdf.h" #define GIF_VERSION "1.00" extern int EndianOrder; diff --git a/hdf/util/gifread.c b/hdf/util/gifread.c index 40d48ee91e..052b86d07c 100644 --- a/hdf/util/gifread.c +++ b/hdf/util/gifread.c @@ -36,6 +36,8 @@ \****************************************************************************/ #include #include +#include + #include "gif.h" /* External global variables */ diff --git a/hdf/util/hdf24to8.c b/hdf/util/hdf24to8.c index 21bb0bdbd1..2f717a59f6 100644 --- a/hdf/util/hdf24to8.c +++ b/hdf/util/hdf24to8.c @@ -41,6 +41,7 @@ typedef unsigned int UINT; #define COMPRESSION 0 /* no compression */ #include +#include #include "hdf.h" diff --git a/hdf/util/hdf2gif.c b/hdf/util/hdf2gif.c index 0370cd82df..6748e65913 100644 --- a/hdf/util/hdf2gif.c +++ b/hdf/util/hdf2gif.c @@ -12,6 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include +#include #include "gif.h" diff --git a/hdf/util/hdfcomp.c b/hdf/util/hdfcomp.c index fb2f21ed9a..eb38aeb458 100644 --- a/hdf/util/hdfcomp.c +++ b/hdf/util/hdfcomp.c @@ -15,6 +15,9 @@ * hdfcomp.c * Re-compress Raster-8 HDF file */ + +#include + #include "hdf.h" uint8 *space; diff --git a/hdf/util/hdfgifwr.c b/hdf/util/hdfgifwr.c index 3d2fc12231..b6d181b3f3 100644 --- a/hdf/util/hdfgifwr.c +++ b/hdf/util/hdfgifwr.c @@ -135,9 +135,7 @@ static unsigned long cur_accum = 0; static int cur_bits = 0; #define MAXCODE(n_bits) ((1 << (n_bits)) - 1) -#define min(a, b) ((a > b) ? b : a) -#define XV_BITS 12 /* BITS was already defined on some systems */ -#define MSDOS 1 +#define XV_BITS 12 /* BITS was already defined on some systems */ #define HSIZE 5003 /* 80% occupancy */ typedef unsigned char char_type; diff --git a/hdf/util/hdftopal.c b/hdf/util/hdftopal.c index 34a8d93c68..a87caa1fb1 100644 --- a/hdf/util/hdftopal.c +++ b/hdf/util/hdftopal.c @@ -25,6 +25,9 @@ * This program is in the public domain * */ + +#include + #include "hdf.h" int main(int argc, char *argv[]); diff --git a/hdf/util/hdftor8.c b/hdf/util/hdftor8.c index 7542d20e37..1d9cfb524f 100644 --- a/hdf/util/hdftor8.c +++ b/hdf/util/hdftor8.c @@ -16,6 +16,9 @@ * Extract images from HDF file to raster files */ +#include +#include + #include "hdf.h" #define PALETTE_SIZE 768 /* size of palette array */ diff --git a/hdf/util/hdfunpac.c b/hdf/util/hdfunpac.c index c4bf9870dc..a78ea0b5a7 100644 --- a/hdf/util/hdfunpac.c +++ b/hdf/util/hdfunpac.c @@ -26,6 +26,7 @@ #include "hdf.h" #include +#include #include #ifdef H4_HAVE_SYS_TYPES_H diff --git a/hdf/util/he.h b/hdf/util/he.h index 2ae01c37ae..0980e42cc6 100644 --- a/hdf/util/he.h +++ b/hdf/util/he.h @@ -13,10 +13,10 @@ /* he.h -- header file for HDFedit */ #include "hdf.h" + #include #include -/* #include */ - +#include #include /* diff --git a/hdf/util/he_main.c b/hdf/util/he_main.c index 4bac1e67e3..3bcba2dc04 100644 --- a/hdf/util/he_main.c +++ b/hdf/util/he_main.c @@ -61,6 +61,7 @@ *****************************************************************************/ /* ------ he.c ------- main() main HDF interfacing routines */ +#include "hdfi.h" #include "he.h" #include diff --git a/hdf/util/jpeg2hdf.c b/hdf/util/jpeg2hdf.c index ef9c732723..83ed201b2c 100644 --- a/hdf/util/jpeg2hdf.c +++ b/hdf/util/jpeg2hdf.c @@ -11,11 +11,12 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "hdf.h" #include #include #include +#include "hdfi.h" + /* Size of the file buffer to copy through */ #define MAX_FILE_BUF 16384 diff --git a/hdf/util/paltohdf.c b/hdf/util/paltohdf.c index c14ae21cda..24445d08e8 100644 --- a/hdf/util/paltohdf.c +++ b/hdf/util/paltohdf.c @@ -25,6 +25,9 @@ * * This program is in the public domain */ + +#include + #include "hdf.h" int main(int argc, char *argv[]); diff --git a/hdf/util/r8tohdf.c b/hdf/util/r8tohdf.c index adc514263a..7574fc8750 100644 --- a/hdf/util/r8tohdf.c +++ b/hdf/util/r8tohdf.c @@ -19,6 +19,9 @@ /* The intrepretation of arguments has changed a little. A -p introduces a palette which will be used for subsequent images, till another -p. -i and -c introduce a series of images/compressed images */ + +#include + #include "hdf.h" int32 xdim, ydim; diff --git a/hdf/util/ristosds.c b/hdf/util/ristosds.c index 27a76ebdfc..9d92593f87 100644 --- a/hdf/util/ristosds.c +++ b/hdf/util/ristosds.c @@ -20,6 +20,9 @@ /* Sept. 23, 1991 */ /* USAGE: ristosds infile{ infile} -o outfile */ + +#include + #include "hdf.h" #define r_imgae 2; diff --git a/hdf/util/vmake.c b/hdf/util/vmake.c index dde02ee9fe..84531858e3 100644 --- a/hdf/util/vmake.c +++ b/hdf/util/vmake.c @@ -30,6 +30,9 @@ * ******************************************************************************/ +#include +#include + #include "hdf.h" /* diff --git a/hdf/util/writehdf.c b/hdf/util/writehdf.c index e5fe6c096d..82a68a3ace 100644 --- a/hdf/util/writehdf.c +++ b/hdf/util/writehdf.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include +#include "hdf.h" #include "gif.h" #include #include diff --git a/java/src/jni/hdfImp.c b/java/src/jni/hdfImp.c index 001a365097..187395eb0d 100644 --- a/java/src/jni/hdfImp.c +++ b/java/src/jni/hdfImp.c @@ -25,7 +25,7 @@ extern "C" { #endif /* __cplusplus */ #include -#include "hdf.h" +#include "hdfi.h" #include "hfile.h" #include "h4jni.h" #include "hdfImp.h" diff --git a/java/src/jni/hdfanImp.c b/java/src/jni/hdfanImp.c index 489121a8e0..f2b8545ec8 100644 --- a/java/src/jni/hdfanImp.c +++ b/java/src/jni/hdfanImp.c @@ -27,7 +27,7 @@ extern "C" { #include #include #include -#include "hdf.h" +#include "hdfi.h" #include "h4jni.h" #include "hdfanImp.h" diff --git a/java/src/jni/hdfdfpalImp.c b/java/src/jni/hdfdfpalImp.c index f120a11f18..a285d7c6b2 100644 --- a/java/src/jni/hdfdfpalImp.c +++ b/java/src/jni/hdfdfpalImp.c @@ -27,7 +27,7 @@ extern "C" { #include #include #include -#include "hdf.h" +#include "hdfi.h" #include "h4jni.h" #include "hdfdfpalImp.h" diff --git a/java/src/jni/hdfdfuImp.c b/java/src/jni/hdfdfuImp.c index 4ff271fb44..69380a9dbb 100644 --- a/java/src/jni/hdfdfuImp.c +++ b/java/src/jni/hdfdfuImp.c @@ -25,7 +25,7 @@ extern "C" { #endif /* __cplusplus */ #include -#include "hdf.h" +#include "hdfi.h" #include "h4jni.h" #include "hdfdfuImp.h" diff --git a/java/src/jni/hdfexceptionImp.c b/java/src/jni/hdfexceptionImp.c index cef913f123..324507d148 100644 --- a/java/src/jni/hdfexceptionImp.c +++ b/java/src/jni/hdfexceptionImp.c @@ -23,7 +23,7 @@ extern "C" { #endif /* __cplusplus */ #include -#include "hdf.h" +#include "hdfi.h" #include "h4jni.h" #include "hdfexceptionImp.h" diff --git a/java/src/jni/hdfgrImp.c b/java/src/jni/hdfgrImp.c index 85e2476d01..b1ac1c0fa6 100644 --- a/java/src/jni/hdfgrImp.c +++ b/java/src/jni/hdfgrImp.c @@ -25,7 +25,7 @@ extern "C" { #endif /* __cplusplus */ #include -#include "hdf.h" +#include "hdfi.h" #include "mfhdf.h" #include "h4jni.h" #include "hdfgrImp.h" diff --git a/java/src/jni/hdfheImp.c b/java/src/jni/hdfheImp.c index 87ab0c1b78..8f89d1577a 100644 --- a/java/src/jni/hdfheImp.c +++ b/java/src/jni/hdfheImp.c @@ -25,7 +25,7 @@ extern "C" { #endif /* __cplusplus */ #include -#include "hdf.h" +#include "hdfi.h" #include "hfile.h" #include "h4jni.h" #include "hdfheImp.h" diff --git a/java/src/jni/hdfhxImp.c b/java/src/jni/hdfhxImp.c index d9be897fe9..6e95d16125 100644 --- a/java/src/jni/hdfhxImp.c +++ b/java/src/jni/hdfhxImp.c @@ -25,7 +25,7 @@ extern "C" { #endif /* __cplusplus */ #include -#include "hdf.h" +#include "hdfi.h" #include "h4jni.h" #include "hdfhxImp.h" diff --git a/java/src/jni/hdfnativeImp.c b/java/src/jni/hdfnativeImp.c index 76c32f3e08..276c446d02 100644 --- a/java/src/jni/hdfnativeImp.c +++ b/java/src/jni/hdfnativeImp.c @@ -35,7 +35,7 @@ extern "C" { #endif /* __cplusplus */ #include -#include "hdf.h" +#include "hdfi.h" #include "h4jni.h" #include "hdfnativeImp.h" diff --git a/java/src/jni/hdfr24Imp.c b/java/src/jni/hdfr24Imp.c index 0cf1ebd949..fd24c3000c 100644 --- a/java/src/jni/hdfr24Imp.c +++ b/java/src/jni/hdfr24Imp.c @@ -25,7 +25,7 @@ extern "C" { #endif /* __cplusplus */ #include -#include "hdf.h" +#include "hdfi.h" #include "h4jni.h" #include "hdfr24Imp.h" diff --git a/java/src/jni/hdfr8Imp.c b/java/src/jni/hdfr8Imp.c index f4ea3e8544..54e372ef11 100644 --- a/java/src/jni/hdfr8Imp.c +++ b/java/src/jni/hdfr8Imp.c @@ -25,7 +25,7 @@ extern "C" { #endif /* __cplusplus */ #include -#include "hdf.h" +#include "hdfi.h" #include "h4jni.h" #include "hdfr8Imp.h" diff --git a/java/src/jni/hdfsdsImp.c b/java/src/jni/hdfsdsImp.c index 593eda0aec..3cdcf1691b 100644 --- a/java/src/jni/hdfsdsImp.c +++ b/java/src/jni/hdfsdsImp.c @@ -25,7 +25,7 @@ extern "C" { #endif /* __cplusplus */ #include -#include "hdf.h" +#include "hdfi.h" #include "mfhdf.h" #include "h4jni.h" #include "hdfsdsImp.h" diff --git a/java/src/jni/hdfstructsutil.c b/java/src/jni/hdfstructsutil.c index 11f9d3b0bf..3178b3fd39 100644 --- a/java/src/jni/hdfstructsutil.c +++ b/java/src/jni/hdfstructsutil.c @@ -24,7 +24,7 @@ extern "C" { #endif /* __cplusplus */ #include -#include "hdf.h" +#include "hdfi.h" #include "h4jni.h" #include "hdfstructsutil.h" diff --git a/java/src/jni/hdfvdataImp.c b/java/src/jni/hdfvdataImp.c index cbd9bee15d..44999b779e 100644 --- a/java/src/jni/hdfvdataImp.c +++ b/java/src/jni/hdfvdataImp.c @@ -25,7 +25,7 @@ extern "C" { #endif /* __cplusplus */ #include -#include "hdf.h" +#include "hdfi.h" #include "h4jni.h" #include "hdfvdataImp.h" diff --git a/java/src/jni/hdfvfImp.c b/java/src/jni/hdfvfImp.c index 497ed6a338..41c0764f99 100644 --- a/java/src/jni/hdfvfImp.c +++ b/java/src/jni/hdfvfImp.c @@ -25,7 +25,7 @@ extern "C" { #endif /* __cplusplus */ #include -#include "hdf.h" +#include "hdfi.h" #include "h4jni.h" #include "hdfvfImp.h" diff --git a/java/src/jni/hdfvgroupImp.c b/java/src/jni/hdfvgroupImp.c index 320f85a7ac..3c40fa8866 100644 --- a/java/src/jni/hdfvgroupImp.c +++ b/java/src/jni/hdfvgroupImp.c @@ -25,7 +25,7 @@ extern "C" { #endif /* __cplusplus */ #include -#include "hdf.h" +#include "hdfi.h" #include "h4jni.h" #include "hdfvgroupImp.h" diff --git a/java/src/jni/hdfvhImp.c b/java/src/jni/hdfvhImp.c index a459888d6f..6e308b1127 100644 --- a/java/src/jni/hdfvhImp.c +++ b/java/src/jni/hdfvhImp.c @@ -25,7 +25,7 @@ extern "C" { #endif /* __cplusplus */ #include -#include "hdf.h" +#include "hdfi.h" #include "h4jni.h" #include "hdfvhImp.h" diff --git a/java/src/jni/hdfvqImp.c b/java/src/jni/hdfvqImp.c index 97e71db27c..3a4bfb2a1a 100644 --- a/java/src/jni/hdfvqImp.c +++ b/java/src/jni/hdfvqImp.c @@ -25,7 +25,7 @@ extern "C" { #endif /* __cplusplus */ #include -#include "hdf.h" +#include "hdfi.h" #include "h4jni.h" #include "hdfvqImp.h" diff --git a/java/src/jni/hdfvsqImp.c b/java/src/jni/hdfvsqImp.c index 23b35cc4a6..80126cc3e2 100644 --- a/java/src/jni/hdfvsqImp.c +++ b/java/src/jni/hdfvsqImp.c @@ -25,7 +25,7 @@ extern "C" { #endif /* __cplusplus */ #include -#include "hdf.h" +#include "hdfi.h" #include "h4jni.h" #include "hdfvsqImp.h" diff --git a/mfhdf/hdfimport/gen_sds_floats.c b/mfhdf/hdfimport/gen_sds_floats.c index 8c0b8be35b..487a7c3f0b 100644 --- a/mfhdf/hdfimport/gen_sds_floats.c +++ b/mfhdf/hdfimport/gen_sds_floats.c @@ -11,6 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include + #include "mfhdf.h" #define FILE2_NAME "SDSfloat2.hdf" diff --git a/mfhdf/hdfimport/hdfimport.c b/mfhdf/hdfimport/hdfimport.c index 7151ec0a3a..5b79c1da6c 100644 --- a/mfhdf/hdfimport/hdfimport.c +++ b/mfhdf/hdfimport/hdfimport.c @@ -170,13 +170,15 @@ * */ -#include "hdf.h" -#include "hfile.h" -#include +#include #include +#include +#include #include -#include -#include + +#include "hdf.h" +#include "hfile.h" +#include "mfhdf.h" #ifdef H4_HAVE_SYS_STAT_H #include diff --git a/mfhdf/hdfimport/hdfimporttest.c b/mfhdf/hdfimport/hdfimporttest.c index 62f84e0cab..2b113296df 100644 --- a/mfhdf/hdfimport/hdfimporttest.c +++ b/mfhdf/hdfimport/hdfimporttest.c @@ -12,6 +12,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include +#include +#include + #include "hdf.h" /* diff --git a/mfhdf/hdiff/hdiff.c b/mfhdf/hdiff/hdiff.c index 5f89f396e0..13828e64a5 100644 --- a/mfhdf/hdiff/hdiff.c +++ b/mfhdf/hdiff/hdiff.c @@ -11,6 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include + #include "hdiff.h" #include "hdiff_list.h" #include "hdiff_mattbl.h" diff --git a/mfhdf/hdiff/hdiff_dim.c b/mfhdf/hdiff/hdiff_dim.c index db9ab0e534..e6ded43383 100644 --- a/mfhdf/hdiff/hdiff_dim.c +++ b/mfhdf/hdiff/hdiff_dim.c @@ -12,6 +12,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include +#include +#include + #include "hdf.h" #include "mfhdf.h" #include "hdiff_dim.h" diff --git a/mfhdf/hdiff/hdiff_gr.c b/mfhdf/hdiff/hdiff_gr.c index 849ea2aaa3..833a0c4c3c 100644 --- a/mfhdf/hdiff/hdiff_gr.c +++ b/mfhdf/hdiff/hdiff_gr.c @@ -11,6 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include +#include + #include "hdiff.h" #include "hdiff_list.h" #include "hdiff_mattbl.h" diff --git a/mfhdf/hdiff/hdiff_list.c b/mfhdf/hdiff/hdiff_list.c index 216be82852..56e1b762db 100644 --- a/mfhdf/hdiff/hdiff_list.c +++ b/mfhdf/hdiff/hdiff_list.c @@ -12,6 +12,8 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include +#include +#include #include "hdf.h" #include "mfhdf.h" diff --git a/mfhdf/hdiff/hdiff_mattbl.c b/mfhdf/hdiff/hdiff_mattbl.c index f1579d4355..1f1cd8b21d 100644 --- a/mfhdf/hdiff/hdiff_mattbl.c +++ b/mfhdf/hdiff/hdiff_mattbl.c @@ -13,6 +13,7 @@ #include #include +#include #include "hdiff_mattbl.h" diff --git a/mfhdf/hdiff/hdiff_sds.c b/mfhdf/hdiff/hdiff_sds.c index a3e188e9cd..18cdbc035d 100644 --- a/mfhdf/hdiff/hdiff_sds.c +++ b/mfhdf/hdiff/hdiff_sds.c @@ -12,6 +12,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include +#include +#include + #include "hdiff.h" #include "hdiff_list.h" #include "hdiff_mattbl.h" diff --git a/mfhdf/hdiff/hdiff_table.c b/mfhdf/hdiff/hdiff_table.c index 7647a73a2f..f3a66ef283 100644 --- a/mfhdf/hdiff/hdiff_table.c +++ b/mfhdf/hdiff/hdiff_table.c @@ -13,6 +13,7 @@ #include #include +#include #include "hdiff_table.h" diff --git a/mfhdf/hdiff/hdifftst.c b/mfhdf/hdiff/hdifftst.c index 0977163983..7e72d5467a 100644 --- a/mfhdf/hdiff/hdifftst.c +++ b/mfhdf/hdiff/hdifftst.c @@ -1,3 +1,5 @@ +#include + #include "mfhdf.h" #define FILE1_NAME "hdifftst1.hdf" diff --git a/mfhdf/hrepack/hrepack.c b/mfhdf/hrepack/hrepack.c index ff1736ae15..d8fd394c1d 100644 --- a/mfhdf/hrepack/hrepack.c +++ b/mfhdf/hrepack/hrepack.c @@ -11,6 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include +#include + #include "hdf.h" #include "mfhdf.h" #include "hrepack.h" diff --git a/mfhdf/hrepack/hrepack_an.c b/mfhdf/hrepack/hrepack_an.c index 2a33fe2cd0..8244b74b27 100644 --- a/mfhdf/hrepack/hrepack_an.c +++ b/mfhdf/hrepack/hrepack_an.c @@ -11,6 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include + #include "hdf.h" #include "mfhdf.h" diff --git a/mfhdf/hrepack/hrepack_check.c b/mfhdf/hrepack/hrepack_check.c index 9dfb2409be..2f478f440a 100644 --- a/mfhdf/hrepack/hrepack_check.c +++ b/mfhdf/hrepack/hrepack_check.c @@ -11,6 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include +#include + #include "hdf.h" #include "mfhdf.h" diff --git a/mfhdf/hrepack/hrepack_dim.c b/mfhdf/hrepack/hrepack_dim.c index 872f78b472..360dd35400 100644 --- a/mfhdf/hrepack/hrepack_dim.c +++ b/mfhdf/hrepack/hrepack_dim.c @@ -11,6 +11,10 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include +#include +#include + #include "hdf.h" #include "mfhdf.h" #include "hrepack.h" diff --git a/mfhdf/hrepack/hrepack_gr.c b/mfhdf/hrepack/hrepack_gr.c index 70fd3f7fd6..321e729f8d 100644 --- a/mfhdf/hrepack/hrepack_gr.c +++ b/mfhdf/hrepack/hrepack_gr.c @@ -12,6 +12,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include +#include +#include + #include "hdf.h" #include "mfhdf.h" #include "hrepack.h" diff --git a/mfhdf/hrepack/hrepack_list.c b/mfhdf/hrepack/hrepack_list.c index 761d795046..b6324f2dfb 100644 --- a/mfhdf/hrepack/hrepack_list.c +++ b/mfhdf/hrepack/hrepack_list.c @@ -11,6 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include +#include + #include "hdf.h" #include "mfhdf.h" #include "hrepack.h" diff --git a/mfhdf/hrepack/hrepack_lsttable.c b/mfhdf/hrepack/hrepack_lsttable.c index 684d7c0daf..a824d9f3bc 100644 --- a/mfhdf/hrepack/hrepack_lsttable.c +++ b/mfhdf/hrepack/hrepack_lsttable.c @@ -11,9 +11,10 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include #include #include -#include +#include #include "hrepack_lsttable.h" diff --git a/mfhdf/hrepack/hrepack_opttable.c b/mfhdf/hrepack/hrepack_opttable.c index 8f196c7992..d0604d5913 100644 --- a/mfhdf/hrepack/hrepack_opttable.c +++ b/mfhdf/hrepack/hrepack_opttable.c @@ -11,8 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include #include +#include +#include #include "hrepack_opttable.h" diff --git a/mfhdf/hrepack/hrepack_parse.c b/mfhdf/hrepack/hrepack_parse.c index 35c1274a84..fe60cbd4b7 100644 --- a/mfhdf/hrepack/hrepack_parse.c +++ b/mfhdf/hrepack/hrepack_parse.c @@ -11,9 +11,10 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include +#include #include -#include /*isdigit*/ +#include +#include #include "hrepack.h" #include "hrepack_parse.h" diff --git a/mfhdf/hrepack/hrepack_sds.c b/mfhdf/hrepack/hrepack_sds.c index b981732572..4da2303419 100644 --- a/mfhdf/hrepack/hrepack_sds.c +++ b/mfhdf/hrepack/hrepack_sds.c @@ -12,6 +12,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include +#include +#include +#include + #include "hdf.h" #include "mfhdf.h" #include "hrepack.h" diff --git a/mfhdf/hrepack/hrepack_utils.c b/mfhdf/hrepack/hrepack_utils.c index c42b9a4c27..69b95436d9 100644 --- a/mfhdf/hrepack/hrepack_utils.c +++ b/mfhdf/hrepack/hrepack_utils.c @@ -11,6 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include +#include + #include "hdf.h" #include "mfhdf.h" #include "hrepack_utils.h" diff --git a/mfhdf/hrepack/hrepack_vg.c b/mfhdf/hrepack/hrepack_vg.c index 6d2076b239..c7ca9d8ca1 100644 --- a/mfhdf/hrepack/hrepack_vg.c +++ b/mfhdf/hrepack/hrepack_vg.c @@ -12,6 +12,8 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include +#include + #include "hdf.h" #include "mfhdf.h" diff --git a/mfhdf/hrepack/hrepack_vs.c b/mfhdf/hrepack/hrepack_vs.c index f177e3336d..4209e5d2e3 100644 --- a/mfhdf/hrepack/hrepack_vs.c +++ b/mfhdf/hrepack/hrepack_vs.c @@ -12,6 +12,8 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include +#include + #include "hdf.h" #include "mfhdf.h" diff --git a/mfhdf/hrepack/hrepacktst.c b/mfhdf/hrepack/hrepacktst.c index 0045f5f599..1f0338adde 100644 --- a/mfhdf/hrepack/hrepacktst.c +++ b/mfhdf/hrepack/hrepacktst.c @@ -11,6 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include +#include + #include "hdf.h" #include "mfhdf.h" #include "hcomp.h" diff --git a/mfhdf/libsrc/array.c b/mfhdf/libsrc/array.c index 64db095ba0..f821696965 100644 --- a/mfhdf/libsrc/array.c +++ b/mfhdf/libsrc/array.c @@ -14,7 +14,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include #include "local_nc.h" /* diff --git a/mfhdf/libsrc/attr.c b/mfhdf/libsrc/attr.c index 810d713b59..762af6a562 100644 --- a/mfhdf/libsrc/attr.c +++ b/mfhdf/libsrc/attr.c @@ -14,7 +14,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include #include "local_nc.h" NC_attr * diff --git a/mfhdf/libsrc/dim.c b/mfhdf/libsrc/dim.c index 82b4ade374..73bc28794b 100644 --- a/mfhdf/libsrc/dim.c +++ b/mfhdf/libsrc/dim.c @@ -14,7 +14,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include #include "local_nc.h" NC_dim * diff --git a/mfhdf/libsrc/error.c b/mfhdf/libsrc/error.c index 7a4d7d8937..3b57466072 100644 --- a/mfhdf/libsrc/error.c +++ b/mfhdf/libsrc/error.c @@ -19,12 +19,10 @@ * mechanisms for netcdf */ -#include "local_nc.h" - #include #include -#include -#include + +#include "local_nc.h" /* * Log SYSTEM errors diff --git a/mfhdf/libsrc/error.h b/mfhdf/libsrc/error.h index 7b4e4b2633..09fbb7cce7 100644 --- a/mfhdf/libsrc/error.h +++ b/mfhdf/libsrc/error.h @@ -17,7 +17,7 @@ #ifndef MFH4_ERROR_H #define MFH4_ERROR_H -#include "H4api_adpt.h" +#include "hdf.h" HDFLIBAPI void nc_serror(const char *fmt, ...); HDFLIBAPI void NCadvise(int err, const char *fmt, ...); diff --git a/mfhdf/libsrc/file.c b/mfhdf/libsrc/file.c index 1f2dd6f297..d7a8d4766e 100644 --- a/mfhdf/libsrc/file.c +++ b/mfhdf/libsrc/file.c @@ -14,16 +14,11 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include #include -#include "h4config.h" + #include "local_nc.h" #include "herr.h" -#ifdef H4_HAVE_UNISTD_H -#include /* getpid(), access(), F_OK */ -#endif - #if defined H4_HAVE_WIN32_API && !defined __MINGW32__ typedef int pid_t; #endif diff --git a/mfhdf/libsrc/globdef.c b/mfhdf/libsrc/globdef.c index dd2feab3c9..49884fbf76 100644 --- a/mfhdf/libsrc/globdef.c +++ b/mfhdf/libsrc/globdef.c @@ -15,16 +15,14 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * - * * This file initializes all global variables. It's a separate file in order * to allow the creation of SunOS sharable-libraries. */ -#include "h4config.h" + +#include "local_nc.h" #ifdef H4_HAVE_NETCDF #include "netcdf.h" -#include "local_nc.h" #else #include "hdf4_netcdf.h" #endif diff --git a/mfhdf/libsrc/h4_xdr.c b/mfhdf/libsrc/h4_xdr.c index 8e53036dba..689a44ba2b 100644 --- a/mfhdf/libsrc/h4_xdr.c +++ b/mfhdf/libsrc/h4_xdr.c @@ -36,18 +36,16 @@ * xdr. */ -#include "h4config.h" - -#include -#include -#include -#include +#include "local_nc.h" /* Which header files include htonl() ? */ #ifdef H4_HAVE_WIN32_API -/* Use winsock on Win32 (including MinGW) */ -#include +/* Use winsock on Win32 (including MinGW) + * + * This is included in hdfi.h to ensure winsock2.h is included before + * windows.h. + */ #else /* And normal network headers everywhere else */ #ifdef H4_HAVE_ARPA_INET_H @@ -58,7 +56,6 @@ #endif #endif -#include "mfhdf.h" #include "h4_xdr.h" /* diff --git a/mfhdf/libsrc/h4_xdr.h b/mfhdf/libsrc/h4_xdr.h index 561e312ff6..1ea2cf27ba 100644 --- a/mfhdf/libsrc/h4_xdr.h +++ b/mfhdf/libsrc/h4_xdr.h @@ -35,17 +35,7 @@ #ifndef H4_XDR_H #define H4_XDR_H -#include "H4api_adpt.h" - -#include -#include -#include - -#ifdef H4_HAVE_SYS_TYPES_H -#include -#endif - -#include "mfhdf.h" +#include "local_nc.h" /* NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE * diff --git a/mfhdf/libsrc/hdf2netcdf.h b/mfhdf/libsrc/hdf2netcdf.h index 987331a4cf..ee6b597118 100644 --- a/mfhdf/libsrc/hdf2netcdf.h +++ b/mfhdf/libsrc/hdf2netcdf.h @@ -14,8 +14,8 @@ #ifndef MFH4_HDF_2_NETCDF_H #define MFH4_HDF_2_NETCDF_H -#include "h4config.h" -#include "H4api_adpt.h" +#include "hdf.h" + /* If we disable the HDF version of the netCDF API (ncxxx interface) (--disable-netcdf configure flag; the old way was to use -DHAVE_NETCDF compilation flag) ) we need to rename all the relevant function names diff --git a/mfhdf/libsrc/hdfnctest.c b/mfhdf/libsrc/hdfnctest.c index d66160a948..727e6cc3ea 100644 --- a/mfhdf/libsrc/hdfnctest.c +++ b/mfhdf/libsrc/hdfnctest.c @@ -10,7 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "mfhdf.h" +#include #include "hdftest.h" @@ -21,8 +21,8 @@ extern int test_ncunlim(); int main(int argc, char *argv[]) { - intn status; /* status flag */ - int num_errs = 0; /* number of errors so far */ + int status; /* status flag */ + int num_errs = 0; /* number of errors so far */ /* Tests reading/writing datasets with unlimited dimension via HDF API (bugzilla 1378) -BMR, Jan 07, 2009 */ diff --git a/mfhdf/libsrc/local_nc.h b/mfhdf/libsrc/local_nc.h index 4c261327c2..4e7d710091 100644 --- a/mfhdf/libsrc/local_nc.h +++ b/mfhdf/libsrc/local_nc.h @@ -17,15 +17,12 @@ #ifndef MFH4_LOCAL_NC_H #define MFH4_LOCAL_NC_H -#include "H4api_adpt.h" +#include "hdfi.h" /* * netcdf library 'private' data structures, objects and interfaces */ -#include /* size_t */ -#include /* FILENAME_MAX */ - #ifndef FILENAME_MAX #define FILENAME_MAX 255 #endif @@ -55,7 +52,6 @@ * Include HDF stuff */ -#include "hdf.h" #include "vg.h" #include "hfile.h" #include "mfhdfi.h" diff --git a/mfhdf/libsrc/mfdatainfo.h b/mfhdf/libsrc/mfdatainfo.h index 4bb77c7e14..0dbb30e24c 100644 --- a/mfhdf/libsrc/mfdatainfo.h +++ b/mfhdf/libsrc/mfdatainfo.h @@ -14,8 +14,6 @@ #ifndef MFH4_MFDATAINFO_H #define MFH4_MFDATAINFO_H -#include "H4api_adpt.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/mfhdf/libsrc/mfhdf.h b/mfhdf/libsrc/mfhdf.h index ff3e3e4bfb..192426e2d9 100644 --- a/mfhdf/libsrc/mfhdf.h +++ b/mfhdf/libsrc/mfhdf.h @@ -14,13 +14,15 @@ #ifndef MFH4_MFHDF_H #define MFH4_MFHDF_H +/* Formerly used to divide up the HDF and netCDF code. The symbol is retained + * since it's technically in the public API. + */ #ifndef HDF #define HDF 1 #endif -#include "H4api_adpt.h" - #include "hdf.h" + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else diff --git a/mfhdf/libsrc/mfprivate.h b/mfhdf/libsrc/mfprivate.h index 86a2c91cd3..c1b0d0325b 100644 --- a/mfhdf/libsrc/mfprivate.h +++ b/mfhdf/libsrc/mfprivate.h @@ -25,6 +25,8 @@ file - mfprivate.h #ifndef MFH4_MFPRIVATE_H #define MFH4_MFPRIVATE_H +#include "local_nc.h" + /* Get the dimension record */ NC_dim *SDIget_dim(NC *handle, int32 id); diff --git a/mfhdf/libsrc/putget.c b/mfhdf/libsrc/putget.c index 2befea8f31..3e7179b7d7 100644 --- a/mfhdf/libsrc/putget.c +++ b/mfhdf/libsrc/putget.c @@ -14,9 +14,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include #include "local_nc.h" -#include "hfile.h" /* Ugh! We need the defs for HI_READ and HI_SEEK */ +#include "hfile.h" /* Local function prototypes */ static bool_t nssdc_xdr_NCvdata(NC *handle, NC_var *vp, unsigned long where, nc_type type, uint32 count, diff --git a/mfhdf/libsrc/string.c b/mfhdf/libsrc/string.c index 558c27e4f4..bf17e2067c 100644 --- a/mfhdf/libsrc/string.c +++ b/mfhdf/libsrc/string.c @@ -14,7 +14,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include #include "local_nc.h" static uint32 diff --git a/mfhdf/libsrc/var.c b/mfhdf/libsrc/var.c index acf78812bf..830a168c45 100644 --- a/mfhdf/libsrc/var.c +++ b/mfhdf/libsrc/var.c @@ -14,7 +14,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include #include "local_nc.h" NC_var * diff --git a/mfhdf/ncdump/dumplib.c b/mfhdf/ncdump/dumplib.c index d0c8adb3e3..b6c1e31835 100644 --- a/mfhdf/ncdump/dumplib.c +++ b/mfhdf/ncdump/dumplib.c @@ -8,7 +8,8 @@ #include #include -#include "h4config.h" +#include "hdf.h" + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else diff --git a/mfhdf/ncdump/ncdump.c b/mfhdf/ncdump/ncdump.c index c1170aa512..d317d3e59a 100644 --- a/mfhdf/ncdump/ncdump.c +++ b/mfhdf/ncdump/ncdump.c @@ -3,11 +3,11 @@ * See netcdf/README file for copying and redistribution conditions. *********************************************************************/ +#include #include #include #include -#include -#include + #include "local_nc.h" #include "ncdump.h" diff --git a/mfhdf/ncdump/vardata.c b/mfhdf/ncdump/vardata.c index 1bd2e4eba6..35ddda6e6d 100644 --- a/mfhdf/ncdump/vardata.c +++ b/mfhdf/ncdump/vardata.c @@ -8,7 +8,8 @@ #include #include -#include "h4config.h" +#include "hdf.h" + #ifdef H4_HAVE_NETCDF #include #else @@ -27,7 +28,7 @@ extern char *sanitize_string(char *str, bool fix_str); static void annotate(struct ncvar *vp, struct fspec *fsp, long cor[], long iel); -#define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0) +#define VD_STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0) /* * Print a row of variable values. Makes sure output lines aren't too long @@ -83,7 +84,7 @@ pr_vals(struct ncvar *vp, long len, char *fmt, bool more, bool lastrow, void *va break; case NC_CHAR: gp.cp = (char *)vals; - if (fmt == 0 || STREQ(fmt, "%s") || STREQ(fmt, "")) { /* as string */ + if (fmt == 0 || VD_STREQ(fmt, "%s") || VD_STREQ(fmt, "")) { /* as string */ Printf("\""); /* adjust len so trailing nulls don't get printed */ sp = gp.cp + len; @@ -322,7 +323,7 @@ pr_cvals(struct ncvar *vp, long len, char *fmt, bool more, bool lastrow, void *v break; case NC_CHAR: gp.cp = (char *)vals; - if (fmt == 0 || STREQ(fmt, "%s") || STREQ(fmt, "")) { /* as string */ + if (fmt == 0 || VD_STREQ(fmt, "%s") || VD_STREQ(fmt, "")) { /* as string */ Printf("\""); /* adjust len so trailing nulls don't get printed */ sp = gp.cp + len; diff --git a/mfhdf/ncgen/generate.c b/mfhdf/ncgen/generate.c index 4e443fea03..ff07282c5b 100644 --- a/mfhdf/ncgen/generate.c +++ b/mfhdf/ncgen/generate.c @@ -87,7 +87,7 @@ gen_c(char *filename) int ntypes = (sizeof ctypes) / (sizeof ctypes[0]); /* wrap in main program */ - cline("#include \"h4config.h\""); + cline("#include \"hdf.h\""); cline("#ifdef H4_HAVE_NETCDF"); cline("#include \"netcdf.h\""); cline("#else"); diff --git a/mfhdf/ncgen/ncgen.l b/mfhdf/ncgen/ncgen.l index 05265bae69..c9bdd472ad 100644 --- a/mfhdf/ncgen/ncgen.l +++ b/mfhdf/ncgen/ncgen.l @@ -10,9 +10,10 @@ char errstr[100]; /* for short error messages */ extern long strtol(); void expand_escapes(); -#include #include #include +#include +#include #include "ncgentab.h" %} diff --git a/mfhdf/nctest/add.c b/mfhdf/nctest/add.c index 46600fef4e..c98ee68ab9 100644 --- a/mfhdf/nctest/add.c +++ b/mfhdf/nctest/add.c @@ -10,7 +10,8 @@ #include #include -#include "h4config.h" +#include "hdf.h" + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else @@ -20,7 +21,6 @@ #include "testcdf.h" #include "add.h" #include "emalloc.h" -#include "hdf.h" struct netcdf test; /* * in-memory netcdf structure, kept in sync diff --git a/mfhdf/nctest/atttests.c b/mfhdf/nctest/atttests.c index fea8d3c2b2..013e71715f 100644 --- a/mfhdf/nctest/atttests.c +++ b/mfhdf/nctest/atttests.c @@ -6,7 +6,8 @@ #include #include -#include "h4config.h" +#include "hdf.h" + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else @@ -19,7 +20,6 @@ #include "emalloc.h" #include "tests.h" #include "val.h" -#include "hdf.h" #define LEN_OF(array) ((sizeof array) / (sizeof array[0])) diff --git a/mfhdf/nctest/cdftests.c b/mfhdf/nctest/cdftests.c index c68c34e60d..c9f70d3d8e 100644 --- a/mfhdf/nctest/cdftests.c +++ b/mfhdf/nctest/cdftests.c @@ -7,18 +7,19 @@ #include #include -#include "h4config.h" +#include "hdf.h" + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else #include "hdf4_netcdf.h" #endif + #include "testcdf.h" /* defines in-memory test netcdf structure */ #include "add.h" /* functions to update in-memory netcdf */ #include "error.h" #include "tests.h" #include "emalloc.h" -#include "hdf.h" #define LEN_OF(array) ((sizeof array) / (sizeof array[0])) diff --git a/mfhdf/nctest/dimtests.c b/mfhdf/nctest/dimtests.c index a8b771c7d6..9bbfbee256 100644 --- a/mfhdf/nctest/dimtests.c +++ b/mfhdf/nctest/dimtests.c @@ -6,7 +6,8 @@ #include #include -#include "h4config.h" +#include "hdf.h" + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else @@ -18,7 +19,6 @@ #include "error.h" #include "tests.h" #include "emalloc.h" -#include "hdf.h" /* * Test ncdimdef diff --git a/mfhdf/nctest/driver.c b/mfhdf/nctest/driver.c index a58eea364c..8878333293 100644 --- a/mfhdf/nctest/driver.c +++ b/mfhdf/nctest/driver.c @@ -3,7 +3,8 @@ * See netcdf/COPYRIGHT file for copying and redistribution conditions. *********************************************************************/ -#include "h4config.h" +#include "hdf.h" + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else diff --git a/mfhdf/nctest/error.c b/mfhdf/nctest/error.c index aac3a5e0c2..e2c7a09a62 100644 --- a/mfhdf/nctest/error.c +++ b/mfhdf/nctest/error.c @@ -3,11 +3,11 @@ * See netcdf/COPYRIGHT file for copying and redistribution conditions. *********************************************************************/ +#include #include -#include +#include "hdf.h" -#include "h4config.h" #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else diff --git a/mfhdf/nctest/misctest.c b/mfhdf/nctest/misctest.c index df16b575b3..bcbfe7e8fc 100644 --- a/mfhdf/nctest/misctest.c +++ b/mfhdf/nctest/misctest.c @@ -6,7 +6,8 @@ #include #include -#include "h4config.h" +#include "hdf.h" + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else diff --git a/mfhdf/nctest/rec.c b/mfhdf/nctest/rec.c index e34a9e6347..b7877294f8 100644 --- a/mfhdf/nctest/rec.c +++ b/mfhdf/nctest/rec.c @@ -5,7 +5,8 @@ #include -#include "h4config.h" +#include "hdf.h" + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else @@ -17,7 +18,6 @@ #include "error.h" #include "tests.h" #include "emalloc.h" -#include "hdf.h" #define VARS 100 diff --git a/mfhdf/nctest/slabs.c b/mfhdf/nctest/slabs.c index c9ab7bfa90..3f7ffca17c 100644 --- a/mfhdf/nctest/slabs.c +++ b/mfhdf/nctest/slabs.c @@ -3,7 +3,8 @@ * See netcdf/COPYRIGHT file for copying and redistribution conditions. *********************************************************************/ -#include "h4config.h" +#include "hdf.h" + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else @@ -15,7 +16,6 @@ #include "error.h" #include "tests.h" #include "emalloc.h" -#include "hdf.h" #define LEN_OF(array) ((sizeof array) / (sizeof array[0])) /* dimension sizes */ diff --git a/mfhdf/nctest/val.c b/mfhdf/nctest/val.c index 9c089d50ff..24e6dc28f9 100644 --- a/mfhdf/nctest/val.c +++ b/mfhdf/nctest/val.c @@ -5,7 +5,8 @@ #include -#include "h4config.h" +#include "hdf.h" + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else diff --git a/mfhdf/nctest/vardef.c b/mfhdf/nctest/vardef.c index a8774f60c1..90ec579c11 100644 --- a/mfhdf/nctest/vardef.c +++ b/mfhdf/nctest/vardef.c @@ -7,7 +7,8 @@ #include #include -#include "h4config.h" +#include "hdf.h" + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else @@ -19,7 +20,6 @@ #include "error.h" #include "tests.h" #include "emalloc.h" -#include "hdf.h" #define LEN_OF(array) ((sizeof array) / (sizeof array[0])) #define EPS64 ((float64)1.0E-14) diff --git a/mfhdf/nctest/varget.c b/mfhdf/nctest/varget.c index b534de5a51..03aeaece90 100644 --- a/mfhdf/nctest/varget.c +++ b/mfhdf/nctest/varget.c @@ -6,7 +6,8 @@ #include #include -#include "h4config.h" +#include "hdf.h" + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else @@ -17,7 +18,6 @@ #include "error.h" #include "tests.h" #include "emalloc.h" -#include "hdf.h" /* * Test ncvarget diff --git a/mfhdf/nctest/varget_unlim.c b/mfhdf/nctest/varget_unlim.c index f11866a003..7a39eed7d7 100644 --- a/mfhdf/nctest/varget_unlim.c +++ b/mfhdf/nctest/varget_unlim.c @@ -5,8 +5,10 @@ #include #include +#include + +#include "hdf.h" -#include "h4config.h" #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else @@ -17,7 +19,6 @@ #include "error.h" #include "tests.h" #include "emalloc.h" -#include "hdf.h" float a_val[2][3] = {{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0}}; int date_val[12] = {840116, 840214, 840316, 840415, 840516, 840615, diff --git a/mfhdf/nctest/vargetg.c b/mfhdf/nctest/vargetg.c index a460294883..8d33d7c306 100644 --- a/mfhdf/nctest/vargetg.c +++ b/mfhdf/nctest/vargetg.c @@ -6,7 +6,8 @@ #include #include -#include "h4config.h" +#include "hdf.h" + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else @@ -17,7 +18,6 @@ #include "error.h" #include "tests.h" #include "emalloc.h" -#include "hdf.h" /* * Test ncvargetg diff --git a/mfhdf/nctest/varput.c b/mfhdf/nctest/varput.c index 9d8303913d..a41aee55ed 100644 --- a/mfhdf/nctest/varput.c +++ b/mfhdf/nctest/varput.c @@ -6,7 +6,8 @@ #include #include -#include "h4config.h" +#include "hdf.h" + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else @@ -18,7 +19,6 @@ #include "error.h" #include "tests.h" #include "emalloc.h" -#include "hdf.h" /* * Test ncvarput diff --git a/mfhdf/nctest/varputg.c b/mfhdf/nctest/varputg.c index e479126ddc..8e7fcbb2d7 100644 --- a/mfhdf/nctest/varputg.c +++ b/mfhdf/nctest/varputg.c @@ -6,7 +6,8 @@ #include #include -#include "h4config.h" +#include "hdf.h" + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else @@ -18,7 +19,6 @@ #include "error.h" #include "tests.h" #include "emalloc.h" -#include "hdf.h" /* * Test ncvarputg diff --git a/mfhdf/nctest/vartests.c b/mfhdf/nctest/vartests.c index 82ae67a039..6a651c2215 100644 --- a/mfhdf/nctest/vartests.c +++ b/mfhdf/nctest/vartests.c @@ -6,7 +6,8 @@ #include #include -#include "h4config.h" +#include "hdf.h" + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else @@ -18,7 +19,6 @@ #include "error.h" #include "tests.h" #include "emalloc.h" -#include "hdf.h" #define LEN_OF(array) ((sizeof array) / (sizeof array[0])) #define min(A, B) ((A) < (B) ? (A) : (B)) diff --git a/mfhdf/nctest/vputget.c b/mfhdf/nctest/vputget.c index ea2d34495b..c211eb3d7c 100644 --- a/mfhdf/nctest/vputget.c +++ b/mfhdf/nctest/vputget.c @@ -6,7 +6,8 @@ #include #include -#include "h4config.h" +#include "hdf.h" + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else @@ -19,7 +20,6 @@ #include "error.h" #include "tests.h" #include "emalloc.h" -#include "hdf.h" #define max(A, B) ((A) > (B) ? (A) : (B)) diff --git a/mfhdf/nctest/vputgetg.c b/mfhdf/nctest/vputgetg.c index 171efb1910..bbecf1684d 100644 --- a/mfhdf/nctest/vputgetg.c +++ b/mfhdf/nctest/vputgetg.c @@ -6,7 +6,8 @@ #include #include -#include "h4config.h" +#include "hdf.h" + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else @@ -19,7 +20,6 @@ #include "error.h" #include "tests.h" #include "emalloc.h" -#include "hdf.h" #define max(A, B) ((A) > (B) ? (A) : (B)) diff --git a/mfhdf/test/cdftest.c b/mfhdf/test/cdftest.c index 71ca45ed1f..80957e0ff2 100644 --- a/mfhdf/test/cdftest.c +++ b/mfhdf/test/cdftest.c @@ -27,42 +27,45 @@ static char mrcsid[] = "Id: cdftest.c,v 1.11 1994/01/10 23:07:27 chouck Exp "; * complete spec test. */ +#include "hdf.h" + #define REDEF + /* #define SYNCDEBUG */ /* #define NOBUF */ + +#include #include -#include "h4config.h" -#include "H4api_adpt.h" +#include +#include + #ifdef H4_HAVE_NETCDF #include "netcdf.h" #else #include "hdf4_netcdf.h" #endif -#include "hdf.h" - -#define cdf_assert(ex) \ - { \ - if (!(ex)) { \ - fprintf(stderr, "Assertion failed: file %s, line %d\n", __FILE__, __LINE__); \ - exit(EXIT_FAILURE); \ - } \ - } - #define CDFMAXSHORT 32767 #define CDFMAXLONG 2147483647 #define CDFMAXBYTE 127 -#include - #define FILENAME "test.cdf" #define NUM_DIMS 3 #define DONT_CARE -1 + /* make these numbers big when you want to give this a real workout */ #define NUM_RECS 8 #define SIZE_1 7 #define SIZE_2 8 +#define cdf_assert(ex) \ + { \ + if (!(ex)) { \ + fprintf(stderr, "Assertion failed: file %s, line %d\n", __FILE__, __LINE__); \ + exit(EXIT_FAILURE); \ + } \ + } + struct { int num_dims; int num_vars; @@ -116,9 +119,9 @@ chkgot(nc_type type, union getret got, double check) const char *fname = FILENAME; -int num_dims = NUM_DIMS; -long sizes[] = {NC_UNLIMITED, SIZE_1, SIZE_2}; -const char *dim_names[] = {"record", "ixx", "iyy"}; +int num_dims_g = NUM_DIMS; +long sizes_g[] = {NC_UNLIMITED, SIZE_1, SIZE_2}; +const char *dim_names_g[] = {"record", "ixx", "iyy"}; static void createtestdims(int cdfid, int num_dims, long *sizes, const char *dim_names[]) @@ -158,7 +161,7 @@ struct tcdfvar { const char *units; int ndims; int dims[NUM_DIMS]; -} testvars[] = { +} testvars_g[] = { #define Byte_id 0 {"Byte", NC_BYTE, @@ -252,19 +255,19 @@ fill_seq(int id) float val; int ii = 0; - sizes[0] = NUM_RECS; + sizes_g[0] = NUM_RECS; /* zero the indices */ cc = vindices; - while (cc <= &vindices[num_dims - 1]) + while (cc <= &vindices[num_dims_g - 1]) *cc++ = 0; /* ripple counter */ cc = vindices; - mm = sizes; - while (*vindices < *sizes) { + mm = sizes_g; + while (*vindices < *sizes_g) { while (*cc < *mm) { - if (mm == &sizes[num_dims - 1]) { + if (mm == &sizes_g[num_dims_g - 1]) { val = ii; #ifdef VDEBUG parray("indices", NUM_DIMS, vindices); @@ -296,17 +299,17 @@ check_fill_seq(int id) int ii = 0; float val; - sizes[0] = NUM_RECS; - cc = vindices; - while (cc <= &vindices[num_dims - 1]) + sizes_g[0] = NUM_RECS; + cc = vindices; + while (cc <= &vindices[num_dims_g - 1]) *cc++ = 0; /* ripple counter */ cc = vindices; - mm = sizes; - while (*vindices < *sizes) { + mm = sizes_g; + while (*vindices < *sizes_g) { while (*cc < *mm) { - if (mm == &sizes[num_dims - 1]) { + if (mm == &sizes_g[num_dims_g - 1]) { if (ncvarget1(id, Float_id, vindices, (ncvoid *)&got) == -1) goto bad_ret; val = ii; @@ -359,7 +362,7 @@ main(void) #endif int ii; long iilong; - struct tcdfvar *tvp = testvars; + struct tcdfvar *tvp = testvars_g; union getret got; ncopts = NC_VERBOSE; /* errors non fatal */ @@ -386,10 +389,10 @@ main(void) cdf_assert(strcmp(fname, new) == 0); cdf_assert(ncattput(id, NC_GLOBAL, "RCSID", NC_CHAR, strlen(mrcsid), (ncvoid *)mrcsid) != -1); - createtestdims(id, NUM_DIMS, sizes, dim_names); - testdims(id, NUM_DIMS, sizes, dim_names); + createtestdims(id, NUM_DIMS, sizes_g, dim_names_g); + testdims(id, NUM_DIMS, sizes_g, dim_names_g); - createtestvars(id, testvars, NUM_TESTVARS); + createtestvars(id, testvars_g, NUM_TESTVARS); { long lfill = -1; @@ -408,7 +411,7 @@ main(void) cdf_assert(ncdimrename(id, 1, "IXX") >= 0); cdf_assert(ncdiminq(id, 1, new, &iilong) >= 0); printf("dimrename: %s\n", new); - cdf_assert(ncdimrename(id, 1, dim_names[1]) >= 0); + cdf_assert(ncdimrename(id, 1, dim_names_g[1]) >= 0); #ifdef ATTRX cdf_assert(ncattrename(id, 1, "UNITS", "units") != -1); @@ -462,8 +465,8 @@ main(void) printf("NC "); cdf_assert( ncinquire(id, &(cdesc->num_dims), &(cdesc->num_vars), &(cdesc->num_attrs), &(cdesc->xtendim)) == id); - if (cdesc->num_dims != num_dims) { - printf(" num_dims : %d != %d\n", (int)cdesc->num_dims, (int)num_dims); + if (cdesc->num_dims != num_dims_g) { + printf(" num_dims : %d != %d\n", cdesc->num_dims, num_dims_g); exit(1); } cdf_assert(cdesc->num_vars == NUM_TESTVARS); diff --git a/mfhdf/test/hdfnctest.c b/mfhdf/test/hdfnctest.c index a774fc48d0..e89cb99f92 100644 --- a/mfhdf/test/hdfnctest.c +++ b/mfhdf/test/hdfnctest.c @@ -10,6 +10,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include +#include + #include "mfhdf.h" #include "hdftest.h" diff --git a/mfhdf/test/hdftest.c b/mfhdf/test/hdftest.c index 42e46be4a9..5e78558d4e 100644 --- a/mfhdf/test/hdftest.c +++ b/mfhdf/test/hdftest.c @@ -11,6 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include +#include + #include "mfhdf.h" #include "hdftest.h" @@ -78,7 +81,6 @@ main(void) int32 sdid; /* another SDS handle */ int32 rank; /* rank of SDS */ intn status; /* status flag */ - intn i; /* loop variables */ intn nattrs; /* Number of attributes again? */ char name[90]; char text[256]; @@ -216,7 +218,7 @@ main(void) CHECK(status, FAIL, "SDreaddata"); /* compare retrieved values for scale */ - for (i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { if (idata[i] != scale[i]) { fprintf(stderr, "SDreaddata() returned %ld not %ld in location %d\n", (long)idata[i], (long)scale[i], i); @@ -349,7 +351,7 @@ main(void) CHECK(status, FAIL, "SDsetfillvalue"); /* initialize array to write out */ - for (i = 0; i < 10; i++) + for (int i = 0; i < 10; i++) data[i] = (float32)i; /* write out (1,1)->(3,3) array out */ @@ -460,7 +462,7 @@ main(void) num_errs++; } - for (i = 0; i < 50; i++) + for (int i = 0; i < 50; i++) sdata[i] = i; /* Write data to dataset 'DataSetBeta' in file 'test2.hdf' */ @@ -499,7 +501,7 @@ main(void) num_errs++; } - for (i = 0; i < 50; i++) + for (int i = 0; i < 50; i++) outdata[i] = 0; /* read data back in from 'DataSetBeta' from file 'test2.hdf' */ @@ -514,14 +516,14 @@ main(void) { /* verify read values; should be 7 9 11 19 21 23 31 33 35 */ int i, j; /* indexing the two dimensions */ - int k, l; /* counters = number of elements read on each dimension */ - int m = 0; /* indexing the outdata array */ - for (i = 1, l = 0; l < 3; i = i + 2, l++) - for (j = (i * 6) + 1, k = 0; k < 3; j = j + 2, k++, m++) { - if (m < 10) /* number of elements read is 9 */ - if (outdata[m] != sdata[j]) { + int k, m; /* counters = number of elements read on each dimension */ + int n = 0; /* indexing the outdata array */ + for (i = 1, m = 0; m < 3; i = i + 2, m++) + for (j = (i * 6) + 1, k = 0; k < 3; j = j + 2, k++, n++) { + if (n < 10) /* number of elements read is 9 */ + if (outdata[n] != sdata[j]) { fprintf(stderr, "line %d, wrong value: should be %d, got %d\n", __LINE__, sdata[j], - outdata[m]); + outdata[n]); num_errs++; } } @@ -606,7 +608,7 @@ main(void) sdid = SDcreate(f1, "FIXED1", DFNT_INT32, 2, dimsize); CHECK(sdid, FAIL, "SDcreate:Fail to create data set 'FIXED1' in 'test1.hdf'"); - for (i = 0; i < 30; i++) + for (int i = 0; i < 30; i++) idata[i] = i + 100; /* Set fill value attribute for data set 'FIXED1' using SDsetattr(). @@ -673,7 +675,7 @@ main(void) sdid = SDcreate(f1, "FIXED", DFNT_INT32, 2, dimsize); CHECK(sdid, FAIL, "SDcreate:Failed to create data set 'FIXED' in file 'test1.hdf'"); - for (i = 0; i < 30; i++) + for (int i = 0; i < 30; i++) idata[i] = i + 100; /* Set fill value for data set 'FIXED' using SDsetfillvalue() */ @@ -761,7 +763,7 @@ main(void) CHECK(status, FAIL, "SDreaddata(FIXED)"); /* verify the data */ - for (i = 12; i < 18; i++) { + for (int i = 12; i < 18; i++) { if ((idata[i] != 100 + (i - 12)) || (idata[i + 12] != 100 + (i - 12))) { fprintf(stderr, "line %d, wrong value: should be %d, got %d %d\n", __LINE__, 100 + i - 12, (int)idata[i], (int)idata[i + 12]); @@ -769,7 +771,7 @@ main(void) } } - for (i = 18; i < 24; i++) { + for (int i = 18; i < 24; i++) { if (idata[i] == fillval) { fprintf(stderr, "line %d, wrong value: should not be %d, got %d\n", __LINE__, (int)fillval, (int)idata[i]); @@ -800,7 +802,7 @@ main(void) CHECK(status, FAIL, "SDreaddata(FIXED)"); /* verify the data */ - for (i = 12; i < 18; i++) { + for (int i = 12; i < 18; i++) { if (idata[i] != (100 + (i - 12))) { fprintf(stderr, "line %d, wrong value: should be %d, got %d \n", __LINE__, 100 + i - 12, (int)idata[i]); @@ -808,7 +810,7 @@ main(void) } } - for (i = 18; i < 24; i++) { + for (int i = 18; i < 24; i++) { if (idata[i] != fillval) { fprintf(stderr, "line %d, wrong value: should be %d, got %d\n", __LINE__, (int)fillval, (int)idata[i]); @@ -843,7 +845,7 @@ main(void) sdid = SDcreate(f1, "UNLIMITED_SDS", DFNT_INT32, 2, dimsize); CHECK(sdid, FAIL, "SDcreate:Failed to create data set 'UNLIMITED_SDS' in file 'test1.hdf'"); - for (i = 0; i < 24; i++) + for (int i = 0; i < 24; i++) idata[i] = i; /* Set fill value for data set 'UNLIMITED_SDS' */ @@ -924,7 +926,7 @@ main(void) CHECK(status, FAIL, "SDwritedata(NO_FILL)"); /* verify the data */ - for (i = 12; i < 18; i++) { + for (int i = 12; i < 18; i++) { if ((idata[i] != (i - 12)) || (idata[i + 12] != (i - 12))) { fprintf(stderr, "line %d, wrong value for %d: should be %d, got %d\n", __LINE__, i - 12, (int)idata[i], (int)idata[i + 12]); @@ -932,7 +934,7 @@ main(void) } } - for (i = 18; i < 24; i++) { + for (int i = 18; i < 24; i++) { if (idata[i] != fillval) { fprintf(stderr, "line %d, wrong value: should be %d, got %d\n", __LINE__, (int)fillval, (int)idata[i]); @@ -976,14 +978,14 @@ main(void) status = SDsetdimval_comp(dimid1, SD_DIMVAL_BW_COMP); CHECK(status, FAIL, "SDsetdimval_comp"); - for (i = 0; i < 6; i++) + for (int i = 0; i < 6; i++) scale[i] = i * 5; /* set the scale for the second dimension */ status = SDsetdimscale(dimid1, 6, DFNT_INT32, scale); CHECK(status, FAIL, "SDsetdimscale"); - for (i = 0; i < 24; i++) + for (int i = 0; i < 24; i++) idata[i] = i; /* write data to data set 'dimval_1_compat' in file 'test1.hdf' */ @@ -1069,7 +1071,7 @@ main(void) CHECK(status, FAIL, "SDwritedata"); /* verify data */ - for (i = 0; i < 24; i++) { + for (int i = 0; i < 24; i++) { if (idata[i] != i) { fprintf(stderr, "line %d, wrong value: should be %d, got %d\n", __LINE__, i, (int)idata[i]); num_errs++; @@ -1194,7 +1196,7 @@ main(void) CHECK(newsds, FAIL, "SDcreate:Failed to create a new data set('NBitDataSet') for n-bit testing"); /* Initialize data to write out */ - for (i = 0; i < 25; i++) + for (int i = 0; i < 25; i++) idata[i] = i * 10; /* Promote the data set 'NBitDataSet' to an NBIT data set */ @@ -1231,7 +1233,7 @@ main(void) CHECK(status, FAIL, "SDreaddata"); /* verify the data */ - for (i = 0; i < 25; i++) { + for (int i = 0; i < 25; i++) { if ((idata[i] & 0x7f) != rdata[i]) { fprintf(stderr, "Bogus val in loc %d in n-bit dset want %ld got %ld\n", i, (long)idata[i], (long)rdata[i]); diff --git a/mfhdf/test/hdftest.h b/mfhdf/test/hdftest.h index 3cb545aa42..b347739cef 100644 --- a/mfhdf/test/hdftest.h +++ b/mfhdf/test/hdftest.h @@ -14,6 +14,8 @@ #ifndef HDFTEST_H #define HDFTEST_H +#include + /* * The name of the test is printed by saying TESTING("something") which will * result in the string `Testing something' being flushed to standard output. diff --git a/mfhdf/test/tattdatainfo.c b/mfhdf/test/tattdatainfo.c index 7de2c719c3..77cbc5f796 100644 --- a/mfhdf/test/tattdatainfo.c +++ b/mfhdf/test/tattdatainfo.c @@ -22,9 +22,16 @@ * ****************************************************************************/ +#include +#include + #include "mfhdf.h" #include "hdftest.h" +#ifdef H4_HAVE_SYS_TYPES_H +#include /* Windows off_t */ +#endif + static intn test_attrs(); static intn test_dfannots(); static intn test_dfsdattrs(); diff --git a/mfhdf/test/tattributes.c b/mfhdf/test/tattributes.c index 8f1ced6a43..540f426969 100644 --- a/mfhdf/test/tattributes.c +++ b/mfhdf/test/tattributes.c @@ -21,6 +21,8 @@ * ****************************************************************************/ +#include + #include "mfhdf.h" #include "hdftest.h" diff --git a/mfhdf/test/tchunk.c b/mfhdf/test/tchunk.c index cbb09669f5..0371145920 100644 --- a/mfhdf/test/tchunk.c +++ b/mfhdf/test/tchunk.c @@ -11,6 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include + #include "mfhdf.h" #include "hdftest.h" diff --git a/mfhdf/test/tcomp.c b/mfhdf/test/tcomp.c index e72e5d4d45..857092d3f1 100644 --- a/mfhdf/test/tcomp.c +++ b/mfhdf/test/tcomp.c @@ -20,6 +20,8 @@ * ****************************************************************************/ +#include + #include "mfhdf.h" #include "hdftest.h" diff --git a/mfhdf/test/tcoordvar.c b/mfhdf/test/tcoordvar.c index f7d2601fbe..9a3b15a74e 100644 --- a/mfhdf/test/tcoordvar.c +++ b/mfhdf/test/tcoordvar.c @@ -32,6 +32,9 @@ * named variables.) ****************************************************************************/ +#include +#include + #include "mfhdf.h" #include "hdftest.h" diff --git a/mfhdf/test/tdatainfo.c b/mfhdf/test/tdatainfo.c index d386bb4d34..fa8937c8d1 100644 --- a/mfhdf/test/tdatainfo.c +++ b/mfhdf/test/tdatainfo.c @@ -23,9 +23,12 @@ * -BMR, Jul 2010 ****************************************************************************/ -#include "mfhdf.h" - #include +#include +#include + +#include "hdfi.h" +#include "mfhdf.h" #ifdef H4_HAVE_FCNTL_H #include @@ -162,7 +165,6 @@ test_nonspecial_SDSs() t_hdf_datainfo_t sds1_info, sds2_info, sds3_info; uintn info_count = 0; intn status; - int ii, jj; intn num_errs = 0; /* number of errors so far */ /* Create the file and initialize the SD interface */ @@ -202,7 +204,7 @@ test_nonspecial_SDSs() sds_id = SDcreate(sd_id, SDS1_NAME, DFNT_INT32, RANK1, dimsizes); CHECK(sds_id, FAIL, "test_nonspecial_SDSs: SDcreate"); - for (ii = 0; ii < LENGTH1_X; ii++) + for (int ii = 0; ii < LENGTH1_X; ii++) data1[ii] = 1000 * ii; starts[0] = 0; @@ -222,8 +224,8 @@ test_nonspecial_SDSs() sds_id = SDcreate(sd_id, SDS2_NAME, DFNT_FLOAT32, RANK2, dimsizes); CHECK(sds_id, FAIL, "test_nonspecial_SDSs: SDcreate"); - for (ii = 0; ii < LENGTH2_X; ii++) - for (jj = 0; jj < LENGTH2_Y; jj++) + for (int ii = 0; ii < LENGTH2_X; ii++) + for (int jj = 0; jj < LENGTH2_Y; jj++) data2[ii][jj] = 500.50 * (ii + jj); starts[0] = 0; @@ -364,7 +366,7 @@ test_nonspecial_SDSs() ssize_t readlen = 0; /* for read */ int32 *readibuf, *readibuf_swapped; float *readfbuf, *readfbuf_swapped; - int ii, jj, kk; + int kk; /* Open the file for reading without SD API */ fd = open(SIMPLE_FILE, O_RDONLY); @@ -394,7 +396,7 @@ test_nonspecial_SDSs() if (ret32 > 0) { /* Compare data read without SD API against the original buffer */ - for (ii = 0; ii < sds1_info.n_values; ii++) { + for (int ii = 0; ii < sds1_info.n_values; ii++) { if (readibuf_swapped[ii] != data1[ii]) fprintf(stderr, "At value# %d: written = %d read = %d\n", ii, data1[ii], readibuf_swapped[ii]); @@ -423,8 +425,8 @@ test_nonspecial_SDSs() /* Compare data read without SD API against the original buffer */ kk = 0; - for (jj = 0; jj < sds2_info.dimsizes[0]; jj++) - for (ii = 0; ii < sds2_info.dimsizes[1]; ii++) { + for (int jj = 0; jj < sds2_info.dimsizes[0]; jj++) + for (int ii = 0; ii < sds2_info.dimsizes[1]; ii++) { /* Flag if the two numbers are not close enough */ if (fabs(readfbuf_swapped[kk] - data2[jj][ii]) > 0.00001) fprintf(stderr, "At value# %d: written = %f read = %f\n", ii, (double)data2[jj][ii], @@ -455,7 +457,7 @@ test_nonspecial_SDSs() if (ret32 > 0) { /* Compare data read without SD API against the original buffer */ - for (ii = 0; ii < sds3_info.n_values; ii++) { + for (int ii = 0; ii < sds3_info.n_values; ii++) { if (readibuf_swapped[ii] != data3[ii]) fprintf(stderr, "At value# %d: written = %d read = %d\n", ii, data3[ii], readibuf_swapped[ii]); @@ -954,7 +956,7 @@ test_chunked_partial() t_hdf_datainfo_t sds_info; int32 data[Y_LENGTH][X_LENGTH]; int fd; /* for open */ - int ii, jj, chk_num; + int chk_num; int num_errs = 0; /* number of errors so far */ intn status; @@ -1013,8 +1015,8 @@ test_chunked_partial() CHECK(sds_id, FAIL, "test_chunked_partial: SDcreate"); /* Initialize data for the dataset */ - for (jj = 0; jj < Y_LENGTH; jj++) { - for (ii = 0; ii < X_LENGTH; ii++) + for (int jj = 0; jj < Y_LENGTH; jj++) { + for (int ii = 0; ii < X_LENGTH; ii++) data[jj][ii] = (ii + jj) + 1; } @@ -1080,7 +1082,6 @@ test_chunked_partial() int32 ret32; /* for DFKconvert */ ssize_t readlen = 0; /* for read */ int32 *readibuf, *readibuf_swapped; - int ii; /* Forward to the position of the data of the SDS */ if (lseek(fd, (off_t)sds_info.offsets[chk_num], SEEK_SET) == -1) { @@ -1106,7 +1107,7 @@ test_chunked_partial() CHECK(ret32, FAIL, "test_chunked_partial: DFKconvert"); /* Compare data read without SD API against the original buffer */ - for (ii = 0; ii < sds_info.n_values; ii++) { + for (int ii = 0; ii < sds_info.n_values; ii++) { if (readibuf_swapped[ii] != chunk_1dim[ii]) fprintf(stderr, "At value# %d: written = %d read = %d\n", ii, chunk_1dim[ii], readibuf_swapped[ii]); diff --git a/mfhdf/test/tdatasizes.c b/mfhdf/test/tdatasizes.c index 4ed227b5c9..4914abeab5 100644 --- a/mfhdf/test/tdatasizes.c +++ b/mfhdf/test/tdatasizes.c @@ -27,6 +27,8 @@ * and SDgetdatasize. ****************************************************************************/ +#include + #include "mfhdf.h" #include "hdftest.h" diff --git a/mfhdf/test/tdim.c b/mfhdf/test/tdim.c index 464292eee0..d7d86d1d70 100644 --- a/mfhdf/test/tdim.c +++ b/mfhdf/test/tdim.c @@ -20,6 +20,8 @@ * *********************************************************************/ +#include + #include "mfhdf.h" #include "hdftest.h" diff --git a/mfhdf/test/texternal.c b/mfhdf/test/texternal.c index f3df772037..6466fc5756 100644 --- a/mfhdf/test/texternal.c +++ b/mfhdf/test/texternal.c @@ -11,8 +11,20 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include +#include + +/* Need to pick up H4_HAVE_SYS_STAT_H from mfhdf.h */ +#include "hdfi.h" #include "mfhdf.h" +#ifdef H4_HAVE_UNISTD_H +#include +#endif +#ifdef H4_HAVE_SYS_STAT_H +#include +#endif + #include "hdftest.h" #define EXTTST "exttst.hdf" /* main file for external file test */ diff --git a/mfhdf/test/tmixed_apis.c b/mfhdf/test/tmixed_apis.c index bc6c9bbd05..7663eb3234 100644 --- a/mfhdf/test/tmixed_apis.c +++ b/mfhdf/test/tmixed_apis.c @@ -25,6 +25,9 @@ * test_vgisinternal - tests Vgisinternal ****************************************************************************/ +#include +#include + #include "mfhdf.h" #include "hdftest.h" diff --git a/mfhdf/test/tncunlim.c b/mfhdf/test/tncunlim.c index 89b870db1a..206f661dbc 100644 --- a/mfhdf/test/tncunlim.c +++ b/mfhdf/test/tncunlim.c @@ -30,6 +30,8 @@ * ****************************************************************************/ +#include + #include "mfhdf.h" #include "hdftest.h" diff --git a/mfhdf/test/tncvargetfill.c b/mfhdf/test/tncvargetfill.c index 58c8551873..af1e03b050 100644 --- a/mfhdf/test/tncvargetfill.c +++ b/mfhdf/test/tncvargetfill.c @@ -29,6 +29,9 @@ * ****************************************************************************/ +#include +#include + #include "mfhdf.h" #include "hdftest.h" diff --git a/mfhdf/test/tnetcdf.c b/mfhdf/test/tnetcdf.c index 6c56ed34e5..d34207a9c4 100644 --- a/mfhdf/test/tnetcdf.c +++ b/mfhdf/test/tnetcdf.c @@ -11,6 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include +#include + #include "mfhdf.h" #include "hdftest.h" diff --git a/mfhdf/test/trank0.c b/mfhdf/test/trank0.c index 1396194942..c005e5c532 100644 --- a/mfhdf/test/trank0.c +++ b/mfhdf/test/trank0.c @@ -18,6 +18,8 @@ * test_rank0 - test routine, called in hdftest.c ****************************************************************************/ +#include + #include "mfhdf.h" #include "hdftest.h" diff --git a/mfhdf/test/tsdsprops.c b/mfhdf/test/tsdsprops.c index 443c3afa43..ca6256f5d4 100644 --- a/mfhdf/test/tsdsprops.c +++ b/mfhdf/test/tsdsprops.c @@ -28,6 +28,9 @@ * (bugzilla 150) ****************************************************************************/ +#include +#include + #include "mfhdf.h" #include "hdftest.h" diff --git a/mfhdf/test/tszip.c b/mfhdf/test/tszip.c index 101416975a..bacf978108 100644 --- a/mfhdf/test/tszip.c +++ b/mfhdf/test/tszip.c @@ -11,8 +11,11 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include + #include "mfhdf.h" #include "hdftest.h" + #ifdef H4_HAVE_LIBSZ #include "szlib.h" #endif diff --git a/mfhdf/test/tunlim.c b/mfhdf/test/tunlim.c index 74a2f236ab..a5975d01c8 100644 --- a/mfhdf/test/tunlim.c +++ b/mfhdf/test/tunlim.c @@ -33,6 +33,8 @@ * ****************************************************************************/ +#include + #include "mfhdf.h" #include "hdftest.h" diff --git a/mfhdf/test/tutils.c b/mfhdf/test/tutils.c index bc65bcf244..f55764a7bb 100644 --- a/mfhdf/test/tutils.c +++ b/mfhdf/test/tutils.c @@ -11,6 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include +#include + #include "mfhdf.h" #include "hdftest.h" diff --git a/mfhdf/util/h4getopt.h b/mfhdf/util/h4getopt.h index 7b4ea3b6b3..4de8a6c89b 100644 --- a/mfhdf/util/h4getopt.h +++ b/mfhdf/util/h4getopt.h @@ -24,8 +24,6 @@ #ifndef H4GETOPT_H_ #define H4GETOPT_H_ -#include "h4config.h" - /* Instead of relying on the system getopt(), HDF4 includes its own, with all * symbols prefixed with 'h4'. Be careful replacing this! Getting the ifdefs * correct for Windows-y POSIX platforms like MinGW and Cygwin is tricky. diff --git a/release_notes/RELEASE.txt b/release_notes/RELEASE.txt index be039771aa..932d86cd1d 100644 --- a/release_notes/RELEASE.txt +++ b/release_notes/RELEASE.txt @@ -24,6 +24,7 @@ CONTENTS - New features and changes -- Configuration + -- C Library - Support for new platforms and compilers - Bugs fixed since HDF 4.2.16 -- Configuration @@ -62,8 +63,6 @@ New features and changes outdated. We have no resources to properly update those and to add the missing ones. Instead, we will try to create better man pages from Doxygen. - (BMR - 2024/02/04) - - Incorporated HDF4 examples repository into HDF4 library. The HDF4Examples folder is equivalent to the repository hdf4-examples. @@ -78,8 +77,6 @@ New features and changes = HDF_BUILD_JAVA = ${HDF4_BUILD_JAVA} - (ADB - 2023/12/13) - - Autotools and CMake target added to produce doxygen generated documentation The default is OFF or disabled. @@ -89,8 +86,6 @@ New features and changes CMake target is 'doxygen' for all available doxygen targets CMake target is 'hdf4lib_doc' for the src subdirectory - (ADB - 2023/12/03) - - Added support for CMake presets file. CMake supports two main files, CMakePresets.json and CMakeUserPresets.json, @@ -127,6 +122,33 @@ New features and changes MacFS in the 90s and early 2000s can be accessed using C standard library I/O. + C Library: + ---------- + hdfi.h is no longer included by hdf.h + + In the past, hdfi.h (an internal header file) was included in the + public hdf.h header. This is no longer the case. Anything that + should be public has been moved from hdfi.h to hdf.h, including: + + * The C99-like types (e.g., float32) + * The archaic VOID/VOIDP macros + * The intf Fortran integer type + * The HD library macros (e.g., HDmalloc) + + All of these things are considered obsolete and we only maintain + them in the public header so that old code does not have to be + modified. It is unwise to use them in new code. + + NOTE: hdfi.h included many POSIX, Windows, and C standard library + headers. + + *** THESE WILL NO LONGER BE BROUGHT IN BY INCLUDING HDF.H!!! *** + + If you have been relying on hdf.h to bring in headers like + stdlib.h, windows.h, or unistd.h, you will need to update your + code when you move to HDF 4.3.0. + + Support for new platforms and compilers ======================================= From 9553ce61047985edf6f9c7c2fa243abc797c0c65 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 13 Feb 2024 13:27:27 -0800 Subject: [PATCH 15/65] Remove unused Duff's device ifdefs (#524) --- hdf/src/dfkswap.c | 28 ---------------------------- hdf/src/hconv.h | 29 ----------------------------- 2 files changed, 57 deletions(-) diff --git a/hdf/src/dfkswap.c b/hdf/src/dfkswap.c index 17fae26779..638b250d3d 100644 --- a/hdf/src/dfkswap.c +++ b/hdf/src/dfkswap.c @@ -138,10 +138,6 @@ DFKsb4b(void *s, void *d, uint32 num_elm, uint32 source_stride, uint32 dest_stri uint8 buf[4]; /* Inplace processing buffer */ uint8 *source = (uint8 *)s; uint8 *dest = (uint8 *)d; -#ifdef TEST3_sb4b - uint32 *lp_dest; - uint32 *lp_src; -#endif HEclear(); @@ -160,29 +156,6 @@ DFKsb4b(void *s, void *d, uint32 num_elm, uint32 source_stride, uint32 dest_stri if (fast_processing) { if (!in_place) { -#ifndef DUFF_sb4b -#ifdef TEST1_sb4b - source += 3; -#endif -#ifdef TEST3_sb4b - lp_dest = (uint32 *)dest; - lp_src = (uint32 *)source; -#endif - for (i = 0; i < num_elm; i++) { -#if defined TEST3_sb4b - *lp_dest++ = ((lp_src[0] & 0x000000ff) << 24) | ((lp_src[0] & 0x0000ff00) << 8) | - ((lp_src[0] & 0x00ff0000) >> 8) | ((lp_src[0] & 0xff000000) >> 24); - lp_src++; -#else - dest[0] = source[3]; - dest[1] = source[2]; - dest[2] = source[1]; - dest[3] = source[0]; - dest += 4; - source += 4; -#endif - } -#else /* DUFF_sb4b */ uint32 n = (num_elm + 7) / 8; switch (num_elm % 8) { @@ -245,7 +218,6 @@ DFKsb4b(void *s, void *d, uint32 num_elm, uint32 source_stride, uint32 dest_stri source += 4; } while (--n > 0); } -#endif /* DUFF_sb4b */ return 0; } else { diff --git a/hdf/src/hconv.h b/hdf/src/hconv.h index ea74033ca1..44de2d782b 100644 --- a/hdf/src/hconv.h +++ b/hdf/src/hconv.h @@ -21,35 +21,6 @@ #include "hdfi.h" -/* This looks redundant because previously, VMS platform would undefine DUFF. */ -/* Don't know why. -AKC 2014/1/18 */ -#define DUFF -#ifdef DUFF -#define DUFF_sb4b - -#define DUFF_ui2i -#define DUFF_ui2s -#define DUFF_uo2i -#define DUFF_ui4i -#define DUFF_ui4s -#define DUFF_uo4i -#define DUFF_ui4f -#define DUFF_uo4f -#define DUFF_ui8f -#define DUFF_uo8f - -#define DUFF_lui2i -#define DUFF_lui2s -#define DUFF_luo2i -#define DUFF_lui4i -#define DUFF_lui4s -#define DUFF_luo4i -#define DUFF_lui4f -#define DUFF_luo4f -#define DUFF_lui8f -#define DUFF_luo8f -#endif - /*****************************************************************************/ /* CONSTANT DEFINITIONS */ /*****************************************************************************/ From 45dcbeca50dd5efcdb516616e2542e101a8868d6 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 13 Feb 2024 14:00:50 -0800 Subject: [PATCH 16/65] Remove DFconvert() macro (#525) This is unused --- hdf/src/dfconvrt.h | 108 --------------------------------------------- hdf/src/dfsd.c | 8 ++-- 2 files changed, 3 insertions(+), 113 deletions(-) delete mode 100644 hdf/src/dfconvrt.h diff --git a/hdf/src/dfconvrt.h b/hdf/src/dfconvrt.h deleted file mode 100644 index 96d5de1803..0000000000 --- a/hdf/src/dfconvrt.h +++ /dev/null @@ -1,108 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF. The full HDF copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* In order to speed the conversion process, eliminate a layer of function - * calls by making DFconvert into a macro. - * Peter Webb, Oct 11, 1989 - */ -#ifndef H4_DFCONVRT_H -#define H4_DFCONVRT_H - -#include "hdfi.h" - -#ifndef FUNC_CONV -/* This is the default */ -/* using the DFconvert macro instead of function */ -#define DFconvert(src, dest, ntype, stype, dtype, size, status) \ - { \ - char *s = (src), *d = (dest); \ - int nt = (ntype), st = (stype), dt = (dtype); \ - int sz = ((int)size); \ - if (nt == DFNT_FLOAT) { \ - if ((st == DFNTF_IEEE && dt == DFNTF_PC) || (st == DFNTF_PC && dt == DFNTF_IEEE)) { \ - int32 i; \ - for (i = 0; i < sz * 4; i += 4) { \ - d[i] = s[i + 3]; \ - d[i + 1] = s[i + 2]; \ - d[i + 2] = s[i + 1]; \ - d[i + 3] = s[i]; \ - } \ - status = 0; \ - } \ - else { \ - if (st == DFNTF_PC) { \ - int i; \ - char t; \ - for (i = 0; i < sz * 4; i += 4) { \ - t = s[i]; \ - s[i] = s[i + 3]; \ - s[i + 3] = t; \ - t = s[i + 1]; \ - s[i + 1] = s[i + 2]; \ - s[i + 2] = t; \ - } \ - st = DFNTF_IEEE; \ - } \ - if (st == DFNTF_IEEE && dt == DFNTF_CRAY) { \ - int i = 1; \ - SCUP32(s, d, &sz, &i); \ - } \ - else if (st == DFNTF_CRAY && (dt == DFNTF_IEEE || dt == DFNTF_PC)) { \ - int i = 1; \ - CSPK32(s, d, &sz, &i); \ - } \ - else if (st == DFNTF_IEEE && dt == DFNTF_VAX) { \ - status = DFCVieeeF2vaxF((union float_uint_uchar *)s, (union float_uint_uchar *)d, sz); \ - } \ - else if (st == DFNTF_VAX && (dt == DFNTF_IEEE || dt == DFNTF_PC)) { \ - status = DFCVvaxF2ieeeF((union float_uint_uchar *)s, (union float_uint_uchar *)d, sz); \ - } \ - else { \ - status = -1; \ - } \ - if (dt == DFNTF_PC) { \ - int i; \ - char t; \ - for (i = 0; i < sz * 4; i += 4) { \ - t = d[i]; \ - d[i] = d[i + 3]; \ - d[i + 3] = t; \ - t = d[i + 1]; \ - d[i + 1] = d[i + 2]; \ - d[i + 2] = t; \ - } \ - } \ - if ((stype) == DFNTF_PC) { \ - int i; \ - char t; \ - for (i = 0; i < sz * 4; i += 4) { \ - t = s[i]; \ - s[i] = s[i + 3]; \ - s[i + 3] = t; \ - t = s[i + 1]; \ - s[i + 1] = s[i + 2]; \ - s[i + 2] = t; \ - } \ - st = DFNTF_IEEE; \ - } \ - } \ - } \ - else { \ - status = -1; \ - } \ - if (status == -1) \ - HERROR(DFE_BADCONV); \ - } -#endif /* !FUNC_CONV */ - -#endif /* H4_DFCONVRT_H */ diff --git a/hdf/src/dfsd.c b/hdf/src/dfsd.c index b32c9d4a4c..09cbffcdfa 100644 --- a/hdf/src/dfsd.c +++ b/hdf/src/dfsd.c @@ -3677,10 +3677,9 @@ DFSDIputdata(const char *filename, intn rank, int32 *dimsizes, void *data, intn intn DFSDIgetslice(const char *filename, int32 winst[], int32 windims[], void *data, int32 dims[], intn isfortran) { - intn rank; /* number of dimensions in data[] */ - int32 leastsig; /* fastest varying subscript in the array */ - int32 error; /* flag if an error occurred, */ - /* used by DFconvert macro */ + intn rank; /* number of dimensions in data[] */ + int32 leastsig; /* fastest varying subscript in the array */ + int32 error; /* flag if an error occurred, */ int32 convert; /* true if machine NT != NT to be read */ int32 transposed; /* true if we must transpose the data before writing */ int32 done; /* true if we are at the end of the slice */ @@ -4673,7 +4672,6 @@ DFSDwriteslab(int32 start[], int32 stride[], int32 count[], void *data) int32 *filedims; /* tmp array containing the dimensions */ /* of the dataset in the file */ int32 r_error; /* flag if an error occurred, */ - /* used by DFconvert macro */ int32 aid; uint8 platnumsubclass; /* class of this NT for this platform */ From e5430f64523b403fef0d1453009da87244785a0b Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 13 Feb 2024 14:13:12 -0800 Subject: [PATCH 17/65] Fix size warnings in hdiff (#526) --- mfhdf/hdiff/hdiff_vs.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/mfhdf/hdiff/hdiff_vs.c b/mfhdf/hdiff/hdiff_vs.c index 543c946ceb..1cc834d8b4 100644 --- a/mfhdf/hdiff/hdiff_vs.c +++ b/mfhdf/hdiff/hdiff_vs.c @@ -44,11 +44,20 @@ diff_vs(int32 file1_id, int32 file2_id, int32 ref1, int32 ref2, diff_opt_t *opt) vdata2_size, interlace2_mode; char vdata1_name[VSNAMELENMAX]; char vdata1_class[VSNAMELENMAX]; - char fieldname1_list[VSFIELDMAX * FIELDNAMELENMAX]; + char *fieldname1_list = NULL; char vdata2_name[VSNAMELENMAX]; char vdata2_class[VSNAMELENMAX]; - char fieldname2_list[VSFIELDMAX * FIELDNAMELENMAX]; - uint32 nfound = 0; + char *fieldname2_list = NULL; + uint32 nfound = 0; + + if (NULL == (fieldname1_list = (char *)calloc(VSFIELDMAX * FIELDNAMELENMAX, sizeof(char)))) { + printf("Error: Could not allocate memory\n"); + goto out; + } + if (NULL == (fieldname2_list = (char *)calloc(VSFIELDMAX * FIELDNAMELENMAX, sizeof(char)))) { + printf("Error: Could not allocate memory\n"); + goto out; + } /*------------------------------------------------------------------------- * object 1 @@ -161,9 +170,14 @@ diff_vs(int32 file1_id, int32 file2_id, int32 ref1, int32 ref2, diff_opt_t *opt) } } + free(fieldname1_list); + free(fieldname2_list); + return nfound; out: + free(fieldname1_list); + free(fieldname2_list); opt->err_stat = 1; return 0; From e8e53fabf75942edadb39127ef0ea909ef88d34c Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 13 Feb 2024 14:42:28 -0800 Subject: [PATCH 18/65] Create codeql.yml --- .github/workflows/codeql.yml | 84 ++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000000..c4c88671ca --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,84 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + schedule: + - cron: '42 6 * * 3' + +jobs: + analyze: + name: Analyze + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners + # Consider using larger runners for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} + permissions: + # required for all workflows + security-events: write + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + language: [ 'c-cpp' ] + # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] + # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" From ad6ea89b031e55662dfa891c42e6da050b918b1f Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 13 Feb 2024 14:43:14 -0800 Subject: [PATCH 19/65] Fix a too-small buffer issue in hdp (#527) --- mfhdf/dumper/hdp_sds.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mfhdf/dumper/hdp_sds.c b/mfhdf/dumper/hdp_sds.c index 428ed4600c..411fdf1a1f 100644 --- a/mfhdf/dumper/hdp_sds.c +++ b/mfhdf/dumper/hdp_sds.c @@ -640,7 +640,7 @@ intn option_mask_string(int32 options_mask, char *opt_mask_strg) { intn ret_value = SUCCEED; - char numval[10]; + char numval[16]; strcpy(opt_mask_strg, ""); /* init string to empty string */ @@ -707,8 +707,6 @@ option_mask_string(int32 options_mask, char *opt_mask_strg) return (ret_value); } /* option_mask_string */ - /* #endif - */ /* * Prints compression method and compression information of a data set. From 6ff01fb635e12c54c5878427788e2b0eef813350 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 13 Feb 2024 15:34:20 -0800 Subject: [PATCH 20/65] Remove codeql for now (#528) --- .github/workflows/codeql.yml | 84 ------------------------------------ 1 file changed, 84 deletions(-) delete mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index c4c88671ca..0000000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,84 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - schedule: - - cron: '42 6 * * 3' - -jobs: - analyze: - name: Analyze - # Runner size impacts CodeQL analysis time. To learn more, please see: - # - https://gh.io/recommended-hardware-resources-for-running-codeql - # - https://gh.io/supported-runners-and-hardware-resources - # - https://gh.io/using-larger-runners - # Consider using larger runners for possible analysis time improvements. - runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} - timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} - permissions: - # required for all workflows - security-events: write - - # only required for workflows in private repositories - actions: read - contents: read - - strategy: - fail-fast: false - matrix: - language: [ 'c-cpp' ] - # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] - # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both - # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v3 - - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 - with: - category: "/language:${{matrix.language}}" From 799783eeb2f0423b4a4c27662d52623a33be8fb7 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 14 Feb 2024 09:17:24 -0800 Subject: [PATCH 21/65] Remove dead code from testcdf.h (#529) --- mfhdf/nctest/testcdf.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mfhdf/nctest/testcdf.h b/mfhdf/nctest/testcdf.h index ce43d9f047..db8e1fa856 100644 --- a/mfhdf/nctest/testcdf.h +++ b/mfhdf/nctest/testcdf.h @@ -18,11 +18,6 @@ #define ___ 0 /* marker for structure place-holder */ #define BAD_TYPE NC_UNSPECIFIED /* must be distinct from valid types */ -#ifdef DELETE_CHUNK -void *emalloc(); -void *erealloc(); -#endif - struct cdfdim { /* dimension */ char *name; long size; From fb7c2e934315aa60d2194d910b44b4a234396633 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 14 Feb 2024 09:17:46 -0800 Subject: [PATCH 22/65] Remove the VSET_INTERFACE macro (#530) This was an awkward way to protect an internal header file. --- hdf/src/vattr.c | 3 --- hdf/src/vattrf.c | 2 +- hdf/src/vconv.c | 2 +- hdf/src/vg.c | 2 +- hdf/src/vg.h | 5 ----- hdf/src/vgf.c | 2 +- hdf/src/vgp.c | 2 +- hdf/src/vhi.c | 2 +- hdf/src/vio.c | 2 +- hdf/src/vparse.c | 2 +- hdf/src/vrw.c | 2 +- hdf/src/vsfld.c | 5 +++-- hdf/util/vshow.c | 3 ++- mfhdf/dumper/hdp.c | 4 ++-- mfhdf/dumper/show.c | 2 +- 15 files changed, 17 insertions(+), 23 deletions(-) diff --git a/hdf/src/vattr.c b/hdf/src/vattr.c index 0bc38388ed..edc6be1c93 100644 --- a/hdf/src/vattr.c +++ b/hdf/src/vattr.c @@ -185,9 +185,6 @@ * First draft on 7/31/96, modified on 8/6/96, 8/15/96 *************************************************************/ -#define VSET_INTERFACE -#include "hdf.h" - /* ----------------- VSfindex --------------------- NAME VSfindex -- find index of a named field in a vdata diff --git a/hdf/src/vattrf.c b/hdf/src/vattrf.c index d85b005da7..0e6cb7ae9c 100644 --- a/hdf/src/vattrf.c +++ b/hdf/src/vattrf.c @@ -20,8 +20,8 @@ * ******************************************************/ -#define VSET_INTERFACE #include "hdfi.h" +#include "vgint.h" #include "hproto_fortran.h" /* ----------------- vsfcfdx ---------------------- diff --git a/hdf/src/vconv.c b/hdf/src/vconv.c index 220eef09cb..e2e63927e1 100644 --- a/hdf/src/vconv.c +++ b/hdf/src/vconv.c @@ -27,9 +27,9 @@ * Part of the HDF Vset interface. */ -#define VSET_INTERFACE #include "hdfi.h" #include "hfile.h" +#include "vgint.h" /* ** ================================================================== diff --git a/hdf/src/vg.c b/hdf/src/vg.c index 58a63d96b9..734af64909 100644 --- a/hdf/src/vg.c +++ b/hdf/src/vg.c @@ -61,8 +61,8 @@ PRIVATE functions manipulate vsdir and are used only within this file. PRIVATE data structures in here pertain to vdata in vsdir only. */ -#define VSET_INTERFACE #include "hdfi.h" +#include "vgint.h" /* These are used to determine whether a vdata had been created by the library internally, that is, not created by user's application */ diff --git a/hdf/src/vg.h b/hdf/src/vg.h index fda823e023..8f22e2a91c 100644 --- a/hdf/src/vg.h +++ b/hdf/src/vg.h @@ -65,9 +65,4 @@ #define VSET_OLD_VERSION 2 /* All version <= 2 use old type mappings */ #define VSET_OLD_TYPES VSET_OLD_VERSION /* For backward compatibility */ -/* Only include the library header if the VSET_INTERFACE macro is defined */ -#ifdef VSET_INTERFACE -#include "vgint.h" /* Library VSet information header */ -#endif /* VSET_INTERFACE */ - #endif /* H4_VG_H */ diff --git a/hdf/src/vgf.c b/hdf/src/vgf.c index f6f4fc8e13..d221b2125b 100644 --- a/hdf/src/vgf.c +++ b/hdf/src/vgf.c @@ -31,8 +31,8 @@ * *********************************************************************** */ -#define VSET_INTERFACE #include "hdfi.h" +#include "vgint.h" #include "hproto_fortran.h" /* diff --git a/hdf/src/vgp.c b/hdf/src/vgp.c index 3730ab2c8b..db60852ae4 100644 --- a/hdf/src/vgp.c +++ b/hdf/src/vgp.c @@ -101,8 +101,8 @@ EXPORTED ROUTINES *************************************************************************/ -#define VSET_INTERFACE #include "hdfi.h" +#include "vgint.h" /* These are used to determine whether a vgroup had been created by the library internally, that is, not created by user's application */ diff --git a/hdf/src/vhi.c b/hdf/src/vhi.c index 08eeae0958..5596f24b59 100644 --- a/hdf/src/vhi.c +++ b/hdf/src/vhi.c @@ -22,8 +22,8 @@ * VHmakegroup -- makes a vgroup from tag/ref pairs */ -#define VSET_INTERFACE #include "hdfi.h" +#include "vgint.h" /* ------------------------ VHstoredata ------------------------------- NAME diff --git a/hdf/src/vio.c b/hdf/src/vio.c index f2b3079f8b..adaa4fbd92 100644 --- a/hdf/src/vio.c +++ b/hdf/src/vio.c @@ -58,8 +58,8 @@ EXPORTED ROUTINES *************************************************************************/ -#define VSET_INTERFACE #include "hdfi.h" +#include "vgint.h" /* Private Function Prototypes */ static intn vunpackvs(VDATA *vs, uint8 buf[], int32 len); diff --git a/hdf/src/vparse.c b/hdf/src/vparse.c index e53f386506..401640ae4a 100644 --- a/hdf/src/vparse.c +++ b/hdf/src/vparse.c @@ -22,8 +22,8 @@ ************************************************************************/ -#define VSET_INTERFACE #include "hdfi.h" +#include "vgint.h" #define ISCOMMA(c) ((c == ',') ? 1 : 0) diff --git a/hdf/src/vrw.c b/hdf/src/vrw.c index c9676458d0..22221a039c 100644 --- a/hdf/src/vrw.c +++ b/hdf/src/vrw.c @@ -34,8 +34,8 @@ EXPORTED ROUTINES ************************************************************************/ -#define VSET_INTERFACE #include "hdfi.h" +#include "vgint.h" #ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) diff --git a/hdf/src/vsfld.c b/hdf/src/vsfld.c index 2eec0c5b59..6a0c756a86 100644 --- a/hdf/src/vsfld.c +++ b/hdf/src/vsfld.c @@ -36,10 +36,11 @@ EXPORTED ROUTINES ************************************************************************/ -#define VSET_INTERFACE -#include "hdfi.h" #include +#include "hdfi.h" +#include "vgint.h" + /* ** ================================================================== ** PRIVATE data areas and routines diff --git a/hdf/util/vshow.c b/hdf/util/vshow.c index d9c9590373..02c9c190b1 100644 --- a/hdf/util/vshow.c +++ b/hdf/util/vshow.c @@ -26,8 +26,9 @@ * * ******************************************************************************/ -#define VSET_INTERFACE + #include "hdf.h" +#include "vgint.h" static int condensed; diff --git a/mfhdf/dumper/hdp.c b/mfhdf/dumper/hdp.c index 22c869a99d..43be0323fc 100644 --- a/mfhdf/dumper/hdp.c +++ b/mfhdf/dumper/hdp.c @@ -11,9 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#define VSET_INTERFACE #include "hdp.h" -#include "local_nc.h" /* to use some definitions */ +#include "local_nc.h" +#include "vgint.h" /********************/ /* Global Variables */ diff --git a/mfhdf/dumper/show.c b/mfhdf/dumper/show.c index e036dfafc9..5e66f57481 100644 --- a/mfhdf/dumper/show.c +++ b/mfhdf/dumper/show.c @@ -13,8 +13,8 @@ /* Modified from vshow.c by Eric Tsui, 12/25/1994. */ -#define VSET_INTERFACE #include "hdp.h" +#include "vgint.h" #define BUFFER 1000000 From a70413fe8e6fc74692d71fafbb67daa47d549c0e Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 14 Feb 2024 09:32:50 -0800 Subject: [PATCH 23/65] Remove TBBT_INTERNALS scheme (#531) The TBBT code used a weird scheme where the main data structures were defined differently in the header and source files in an attempt to hide private details. This has been switched to use a PIMPL scheme with properly hidden data instead. --- hdf/src/hdatainfo.c | 2 +- hdf/src/mfan.c | 16 +-- hdf/src/mfgr.c | 14 +- hdf/src/tbbt.c | 332 +++++++++++++++++++++++++++----------------- hdf/src/tbbt.h | 106 +++++--------- hdf/src/vgp.c | 6 +- hdf/src/vio.c | 2 +- 7 files changed, 256 insertions(+), 222 deletions(-) diff --git a/hdf/src/hdatainfo.c b/hdf/src/hdatainfo.c index 22a54aaee8..00f49bca7a 100644 --- a/hdf/src/hdatainfo.c +++ b/hdf/src/hdatainfo.c @@ -726,7 +726,7 @@ GRgetattdatainfo(int32 id, int32 attrindex, int32 *offset, int32 *length) HGOTO_ERROR(DFE_ARGS, FAIL); /* Search for an attribute with the same index */ - aentry = (void **)tbbtfirst((TBBT_NODE *)*search_tree); + aentry = (void **)tbbtfirst(search_tree->root); found = FALSE; while (!found && (aentry != NULL)) { at_ptr = (at_info_t *)*aentry; diff --git a/hdf/src/mfan.c b/hdf/src/mfan.c index bb45bb7596..a506742812 100644 --- a/hdf/src/mfan.c +++ b/hdf/src/mfan.c @@ -683,7 +683,7 @@ ANInumann(int32 an_id, /* IN: annotation interface id */ } /* Traverse the list looking for a match */ - for (entry = tbbtfirst((TBBT_NODE *)*(file_rec->an_tree[type])); entry != NULL; entry = tbbtnext(entry)) { + for (entry = tbbtfirst(file_rec->an_tree[type]->root); entry != NULL; entry = tbbtnext(entry)) { ann_entry = (ANentry *)entry->data; /* get annotation entry from node */ if ((ann_entry->elmref == elem_ref) && (ann_entry->elmtag == elem_tag)) { nanns++; /* increment ref counter if match */ @@ -744,7 +744,7 @@ ANIannlist(int32 an_id, /* IN: annotation interface id */ } /* Traverse the list looking for a match */ - for (entry = tbbtfirst((TBBT_NODE *)*(file_rec->an_tree[type])); entry != NULL; entry = tbbtnext(entry)) { + for (entry = tbbtfirst(file_rec->an_tree[type]->root); entry != NULL; entry = tbbtnext(entry)) { ann_entry = (ANentry *)entry->data; /* get annotation entry from node */ if ((ann_entry->elmref == elem_ref) && (ann_entry->elmtag == elem_tag)) { /* save ref of ann match in list */ @@ -1329,7 +1329,7 @@ ANend(int32 an_id /* IN: Annotation ID of file to close */) /* free file label annotation rb tree */ if (file_rec->an_tree[AN_FILE_LABEL] != NULL) { /* Traverse tree puling ann_id's to delete from annotation atom group */ - for (aentry = tbbtfirst((TBBT_NODE *)*(file_rec->an_tree[AN_FILE_LABEL])); aentry != NULL; + for (aentry = tbbtfirst(file_rec->an_tree[AN_FILE_LABEL]->root); aentry != NULL; aentry = tbbtnext(aentry)) { /* get annotation entry from node */ ann_entry = (ANentry *)aentry->data; @@ -1346,7 +1346,7 @@ ANend(int32 an_id /* IN: Annotation ID of file to close */) /* free file desc annotation rb tree */ if (file_rec->an_tree[AN_FILE_DESC] != NULL) { /* Traverse tree puling ann_id's to delete from annotation atom group */ - for (aentry = tbbtfirst((TBBT_NODE *)*(file_rec->an_tree[AN_FILE_DESC])); aentry != NULL; + for (aentry = tbbtfirst(file_rec->an_tree[AN_FILE_DESC]->root); aentry != NULL; aentry = tbbtnext(aentry)) { /* get annotation entry from node */ ann_entry = (ANentry *)aentry->data; @@ -1364,7 +1364,7 @@ ANend(int32 an_id /* IN: Annotation ID of file to close */) /* free label annotation rb tree */ if (file_rec->an_tree[AN_DATA_LABEL] != NULL) { /* Traverse tree puling ann_id's to delete from annotation atom group */ - for (aentry = tbbtfirst((TBBT_NODE *)*(file_rec->an_tree[AN_DATA_LABEL])); aentry != NULL; + for (aentry = tbbtfirst(file_rec->an_tree[AN_DATA_LABEL]->root); aentry != NULL; aentry = tbbtnext(aentry)) { /* get annotation entry from node */ ann_entry = (ANentry *)aentry->data; @@ -1381,7 +1381,7 @@ ANend(int32 an_id /* IN: Annotation ID of file to close */) /* free desc annotation rb tree */ if (file_rec->an_tree[AN_DATA_DESC] != NULL) { /* Traverse tree pulling ann_id's to delete from annotation atom group */ - for (aentry = tbbtfirst((TBBT_NODE *)*(file_rec->an_tree[AN_DATA_DESC])); aentry != NULL; + for (aentry = tbbtfirst(file_rec->an_tree[AN_DATA_DESC]->root); aentry != NULL; aentry = tbbtnext(aentry)) { /* get annotation entry from node */ ann_entry = (ANentry *)aentry->data; @@ -1534,7 +1534,7 @@ ANselect(int32 an_id, /* IN: annotation interface ID */ HE_REPORT_GOTO("bad index", FAIL); /* find 'index' entry */ - if ((entry = tbbtindx((TBBT_NODE *)*(file_rec->an_tree[type]), index)) == NULL) + if ((entry = tbbtindx(file_rec->an_tree[type]->root, index)) == NULL) HE_REPORT_GOTO("failed to find 'index' entry", FAIL); ann_entry = (ANentry *)entry->data; @@ -1774,7 +1774,7 @@ ANget_tagref(int32 an_id, /* IN: annotation interface ID */ HE_REPORT_GOTO("bad index", FAIL); /* find 'index' entry */ - if ((entry = tbbtindx((TBBT_NODE *)*(file_rec->an_tree[type]), index)) == NULL) + if ((entry = tbbtindx(file_rec->an_tree[type]->root, index)) == NULL) HE_REPORT_GOTO("failed to find 'index' entry", FAIL); ann_entry = (ANentry *)entry->data; diff --git a/hdf/src/mfgr.c b/hdf/src/mfgr.c index 5007e646d9..303a659038 100644 --- a/hdf/src/mfgr.c +++ b/hdf/src/mfgr.c @@ -1995,7 +1995,7 @@ GRend(int32 grid) void **t2; ri_info_t *img_ptr; /* ptr to the image */ - if (NULL == (t2 = (void **)tbbtfirst((TBBT_NODE *)*(gr_ptr->grtree)))) { + if (NULL == (t2 = (void **)tbbtfirst(gr_ptr->grtree->root))) { HGOTO_ERROR(DFE_NOTINTABLE, FAIL); } /* end if */ else @@ -2029,7 +2029,7 @@ GRend(int32 grid) void **t3; at_info_t *attr_ptr; /* ptr to the attribute */ - if (NULL == (t3 = (void **)tbbtfirst((TBBT_NODE *)*(img_ptr->lattree)))) { + if (NULL == (t3 = (void **)tbbtfirst(img_ptr->lattree->root))) { HGOTO_ERROR(DFE_NOTINTABLE, FAIL); } /* end if */ else @@ -2082,7 +2082,7 @@ GRend(int32 grid) void **t2; at_info_t *attr_ptr; /* ptr to the attribute */ - if (NULL == (t2 = (void **)tbbtfirst((TBBT_NODE *)*(gr_ptr->gattree)))) { + if (NULL == (t2 = (void **)tbbtfirst(gr_ptr->gattree->root))) { HGOTO_ERROR(DFE_NOTINTABLE, FAIL); } /* end if */ else @@ -2358,7 +2358,7 @@ GRnametoindex(int32 grid, const char *name) if (NULL == (gr_ptr = (gr_info_t *)HAatom_object(grid))) HGOTO_ERROR(DFE_GRNOTFOUND, FAIL); - if ((t = (void **)tbbtfirst((TBBT_NODE *)*(gr_ptr->grtree))) == NULL) + if ((t = (void **)tbbtfirst(gr_ptr->grtree->root)) == NULL) HGOTO_ERROR(DFE_RINOTFOUND, FAIL); do { ri_ptr = (ri_info_t *)*t; @@ -3352,7 +3352,7 @@ GRreftoindex(int32 grid, uint16 ref) if (NULL == (gr_ptr = (gr_info_t *)HAatom_object(grid))) HGOTO_ERROR(DFE_GRNOTFOUND, FAIL); - if ((t = (void **)tbbtfirst((TBBT_NODE *)*(gr_ptr->grtree))) == NULL) + if ((t = (void **)tbbtfirst(gr_ptr->grtree->root)) == NULL) HGOTO_ERROR(DFE_RINOTFOUND, FAIL); do { ri_ptr = (ri_info_t *)*t; @@ -4392,7 +4392,7 @@ GRsetattr(int32 id, const char *name, int32 attr_nt, int32 count, const void *da HGOTO_ERROR(DFE_ARGS, FAIL); /* Search for an attribute with the same name */ - if ((t = (void **)tbbtfirst((TBBT_NODE *)*search_tree)) != NULL) { + if ((t = (void **)tbbtfirst(search_tree->root)) != NULL) { do { at_ptr = (at_info_t *)*t; if (at_ptr != NULL && strcmp(at_ptr->name, name) == 0) /* ie. the name matches */ @@ -4755,7 +4755,7 @@ GRfindattr(int32 id, const char *name) else /* shouldn't get here, but what the heck... */ HGOTO_ERROR(DFE_ARGS, FAIL); - if ((t = (void **)tbbtfirst((TBBT_NODE *)*search_tree)) == NULL) + if ((t = (void **)tbbtfirst(search_tree->root)) == NULL) HGOTO_ERROR(DFE_RINOTFOUND, FAIL); do { at_ptr = (at_info_t *)*t; diff --git a/hdf/src/tbbt.c b/hdf/src/tbbt.c index 092a98a2ff..1eceb5ac2d 100644 --- a/hdf/src/tbbt.c +++ b/hdf/src/tbbt.c @@ -16,31 +16,106 @@ /* Basic tree structure by Adel'son-Vel'skii and Landis */ #include "hdfi.h" - -#define TBBT_INTERNALS #include "tbbt.h" +#define PARENT 0 +#define LEFT 1 +#define RIGHT 2 + +/* Quick hack to implement PIMPL pattern for TBBT nodes + * + * Simple copy-n-paste, so not as robust as a function-like macro (but + * simpler to read and looks more like the original code) + */ +#define Flags priv->flags +#define Link priv->link +#define Rcnt priv->rcnt +#define Lcnt priv->lcnt +#define Parent Link[PARENT] +#define Lchild Link[LEFT] +#define Rchild Link[RIGHT] + +/* Quick hack to implement PIMPL pattern for TBBT trees + * + * Simple copy-n-paste, so not as robust as a function-like macro (but + * simpler to read and looks more like the original code) + */ +#define Count priv->count +#define Fast_compare priv->fast_compare +#define Compar priv->compar +#define Cmparg priv->cmparg + +#define TBBT_FLAG unsigned long +#define TBBT_LEAF unsigned long + +/* TBBT flag values */ +#define TBBT_HEAVY(s) s /* If the `s' sub-tree is deeper than the other */ +#define TBBT_DOUBLE 4 /* If "heavy" sub-tree is two levels deeper */ +#define TBBT_INTERN 8 /* If node is internal (has two children) */ +#define TBBT_UNBAL (TBBT_HEAVY(LEFT) | TBBT_HEAVY(RIGHT)) +#define TBBT_FLAGS (TBBT_UNBAL | TBBT_INTERN | TBBT_DOUBLE) +#define TBBT_CHILD(s) (TBBT_INTERN | TBBT_HEAVY(s)) + +#define LeftCnt(node) ((node)->Lcnt) /* Left descendants */ +#define RightCnt(node) ((node)->Rcnt) /* Left descendants */ +#define Cnt(node, s) (LEFT == (s) ? LeftCnt(node) : RightCnt(node)) +#define HasChild(n, s) (Cnt(n, s) > 0) +#define Heavy(n, s) ((s) & (LeftCnt(n) > RightCnt(n) ? LEFT : LeftCnt(n) == RightCnt(n) ? 0 : RIGHT)) +#define Intern(n) (LeftCnt(n) && RightCnt(n)) +#define UnBal(n) (LeftCnt(n) > RightCnt(n) ? LEFT : LeftCnt(n) == RightCnt(n) ? 0 : RIGHT) +#define Double(n) (TBBT_DOUBLE & (n)->Flags) +#define Other(side) (LEFT + RIGHT - (side)) +#define Delta(n, s) ((Heavy(n, s) ? 1 : -1) * (Double(n) ? 2 : UnBal(n) ? 1 : 0)) + +#define SetFlags(n, s, b, i) \ + ((-2 < (b) && (b) < 2 ? 0 : TBBT_DOUBLE) | \ + (0 > (b) ? TBBT_HEAVY(s) \ + : (b) > 0 ? TBBT_HEAVY(Other(s)) \ + : 0) | \ + ((i) ? TBBT_INTERN : 0)) + +/* Return maximum of two scalar values */ +#define Max(a, b) ((a) > (b) ? (a) : (b)) + +/* Private TBBT information */ +typedef struct tbbt_node_private { + TBBT_NODE *link[3]; /* Pointers to parent, left child, and right child */ + TBBT_FLAG flags; /* TBBT flags: (see above) */ + TBBT_LEAF lcnt; /* Count of left children */ + TBBT_LEAF rcnt; /* Count of right children */ +} TBBT_NODE_PRIV; + +typedef struct tbbt_tree_private { + unsigned long count; /* The number of nodes in the tree currently */ + unsigned fast_compare; /* Use a faster in-line compare (with casts) instead of function call */ + int (*compar)(void *k1, void *k2, int cmparg); + int cmparg; +} TBBT_TREE_PRIV; + +/* Pointer to the tbbt node free list */ +static TBBT_NODE *tbbt_free_list = NULL; + #define KEYcmp(k1, k2, a) \ - ((NULL != compar) ? (*compar)(k1, k2, a) : memcmp(k1, k2, 0 < (a) ? (a) : (intn)strlen(k1))) + ((NULL != compar) ? (*compar)(k1, k2, a) : memcmp(k1, k2, 0 < (a) ? (a) : (int)strlen(k1))) -void tbbt1dump(TBBT_NODE *node, intn method); +void tbbt1dump(TBBT_NODE *node, int method); /* Function Prototypes */ extern void tbbt_printNode(TBBT_NODE *node, void (*key_dump)(void *, void *)); -extern void tbbt_dumpNode(TBBT_NODE *node, void (*key_dump)(void *, void *), intn method); -extern void tbbt_dump(TBBT_TREE *ptree, void (*key_dump)(void *, void *), intn method); +extern void tbbt_dumpNode(TBBT_NODE *node, void (*key_dump)(void *, void *), int method); +extern void tbbt_dump(TBBT_TREE *ptree, void (*key_dump)(void *, void *), int method); static TBBT_NODE *tbbt_get_node(void); static void tbbt_release_node(TBBT_NODE *nod); /* Returns pointer to end-most (to LEFT or RIGHT) node of tree: */ static TBBT_NODE * -tbbt_end(TBBT_NODE *root, intn side) +tbbt_end(TBBT_NODE *root, int side) { if (root == NULL) return NULL; while (HasChild(root, side)) { - root = root->link[side]; + root = root->Link[side]; } return root; } @@ -57,33 +132,20 @@ tbbtlast(TBBT_NODE *root) return tbbt_end(root, RIGHT); } -/* Return address of parent's pointer to neighboring node (to LEFT or RIGHT) ** - static TBBT_NODE **tbbt_anbr(TBBT_NODE *ptr, intn side ) - { - TBBT_NODE **aptr; - - if( ! HasChild( ptr, side ) ) - return( & ptr->link[side] ); - aptr= & ptr->link[side]; - while( HasChild( *aptr, Other(side) ) ) - aptr= & (*aptr)->link[Other(side)]; - return( aptr ); - } */ - /* Returns pointer to neighboring node (to LEFT or RIGHT): */ static TBBT_NODE * -tbbt_nbr(TBBT_NODE *ptr, intn side) +tbbt_nbr(TBBT_NODE *ptr, int side) { /* return( *tbbt_anbr(ptr,side) ); */ if (!HasChild(ptr, side)) - return ptr->link[side]; + return ptr->Link[side]; /* return NULL; */ - ptr = ptr->link[side]; + ptr = ptr->Link[side]; if (ptr == NULL) return NULL; while (HasChild(ptr, Other(side))) - ptr = ptr->link[Other(side)]; + ptr = ptr->Link[Other(side)]; return ptr; } @@ -105,21 +167,21 @@ tbbtprev(TBBT_NODE *node) /* tbbtffind is based on this routine - fix bugs in both places! */ /* Returns a pointer to the found node (or NULL) */ TBBT_NODE * -tbbtfind(TBBT_NODE *root, void *key, intn (*compar)(void *, void *, intn), intn arg, TBBT_NODE **pp) +tbbtfind(TBBT_NODE *root, void *key, int (*compar)(void *, void *, int), int arg, TBBT_NODE **pp) { TBBT_NODE *ptr = root; TBBT_NODE *parent = NULL; - intn cmp = 1; + int cmp = 1; if (ptr) { - intn side; + int side; while (0 != (cmp = KEYcmp(key, ptr->key, arg))) { parent = ptr; side = (cmp < 0) ? LEFT : RIGHT; if (!HasChild(ptr, side)) break; - ptr = ptr->link[side]; + ptr = ptr->Link[side]; } } if (NULL != pp) @@ -131,23 +193,23 @@ tbbtfind(TBBT_NODE *root, void *key, intn (*compar)(void *, void *, intn), intn /* This routine is based on tbbtfind (fix bugs in both places!) */ /* Returns a pointer to the found node (or NULL) */ static TBBT_NODE * -tbbtffind(TBBT_NODE *root, void *key, uintn fast_compare, TBBT_NODE **pp) +tbbtffind(TBBT_NODE *root, void *key, unsigned fast_compare, TBBT_NODE **pp) { TBBT_NODE *ptr = root; TBBT_NODE *parent = NULL; - intn cmp = 1; + int cmp = 1; switch (fast_compare) { case TBBT_FAST_UINT16_COMPARE: if (ptr) { - intn side; + int side; while (0 != (cmp = (*(uint16 *)key - *(uint16 *)ptr->key))) { parent = ptr; side = (cmp < 0) ? LEFT : RIGHT; if (!HasChild(ptr, side)) break; - ptr = ptr->link[side]; + ptr = ptr->Link[side]; } } if (NULL != pp) @@ -156,14 +218,14 @@ tbbtffind(TBBT_NODE *root, void *key, uintn fast_compare, TBBT_NODE **pp) case TBBT_FAST_INT32_COMPARE: if (ptr) { - intn side; + int side; while (0 != (cmp = (*(int32 *)key - *(int32 *)ptr->key))) { parent = ptr; side = (cmp < 0) ? LEFT : RIGHT; if (!HasChild(ptr, side)) break; - ptr = ptr->link[side]; + ptr = ptr->Link[side]; } } if (NULL != pp) @@ -182,31 +244,31 @@ tbbtdfind(TBBT_TREE *tree, void *key, TBBT_NODE **pp) { if (tree == NULL) return NULL; - if (tree->fast_compare != 0) - return tbbtffind(tree->root, key, tree->fast_compare, pp); + if (tree->Fast_compare != 0) + return tbbtffind(tree->root, key, tree->Fast_compare, pp); else - return tbbtfind(tree->root, key, tree->compar, tree->cmparg, pp); + return tbbtfind(tree->root, key, tree->Compar, tree->Cmparg, pp); } /* tbbtless -- Find a node in a tree which is less than a key, */ /* based on a key value */ /* Returns a pointer to the found node (or NULL) */ TBBT_NODE * -tbbtless(TBBT_NODE *root, void *key, intn (*compar)(void *, void *, intn), intn arg, TBBT_NODE **pp) +tbbtless(TBBT_NODE *root, void *key, int (*compar)(void *, void *, int), int arg, TBBT_NODE **pp) { TBBT_NODE *ptr = root; TBBT_NODE *parent = NULL; - intn cmp = 1; + int cmp = 1; if (ptr) { - intn side; + int side; while (0 != (cmp = KEYcmp(key, ptr->key, arg))) { parent = ptr; side = (cmp < 0) ? LEFT : RIGHT; if (!HasChild(ptr, side)) break; - ptr = ptr->link[side]; + ptr = ptr->Link[side]; } } if (cmp != 0) @@ -235,16 +297,11 @@ tbbtdless(TBBT_TREE *tree, void *key, TBBT_NODE **pp) { if (tree == NULL) return NULL; - return tbbtless(tree->root, key, tree->compar, tree->cmparg, pp); + return tbbtless(tree->root, key, tree->Compar, tree->Cmparg, pp); } /* tbbtindx -- Look up the Nth node (in key order) */ /* Returns a pointer to the `indx'th node (or NULL) */ -/* Bugs(fixed): - Added NULL check for 'ptr' in while loop to - prevent endless loop condition. - Fixed bug where we subtracted children count from the wrong side of the - tree. */ TBBT_NODE * tbbtindx(TBBT_NODE *root, int32 indx) { @@ -291,12 +348,12 @@ tbbtindx(TBBT_NODE *root, int32 indx) * pointers to children. */ static TBBT_NODE * -swapkid(TBBT_NODE **root, TBBT_NODE *ptr, intn side) +swapkid(TBBT_NODE **root, TBBT_NODE *ptr, int side) { - TBBT_NODE *kid = ptr->link[side]; /* Sibling to be swapped with parent */ - intn deep[3]; /* Relative depths of three sub-trees involved. */ - /* 0:ptr->link[Other(side)], 1:kid->link[Other(side)], 2:kid->link[side] */ - TBBT_FLAG ptrflg; /* New value for ptr->flags (ptr->flags used after set) */ + TBBT_NODE *kid = ptr->Link[side]; /* Sibling to be swapped with parent */ + int deep[3]; /* Relative depths of three sub-trees involved. */ + /* 0:ptr->Link[Other(side)], 1:kid->Link[Other(side)], 2:kid->Link[side] */ + TBBT_FLAG ptrflg; /* New value for ptr->Flags (ptr->Flags used after set) */ TBBT_LEAF plcnt, prcnt, /* current values of the ptr's and kid's leaf count */ klcnt, krcnt; @@ -310,11 +367,11 @@ swapkid(TBBT_NODE **root, TBBT_NODE *ptr, intn side) klcnt = LeftCnt(kid); krcnt = RightCnt(kid); if (HasChild(kid, Other(side))) { - ptr->link[side] = kid->link[Other(side)]; /* Real child */ - ptr->link[side]->Parent = ptr; + ptr->Link[side] = kid->Link[Other(side)]; /* Real child */ + ptr->Link[side]->Parent = ptr; } else { - ptr->link[side] = kid; /* Thread */ + ptr->Link[side] = kid; /* Thread */ } /* Update grand parent's pointer: */ if (NULL == ptr->Parent) { @@ -327,19 +384,19 @@ swapkid(TBBT_NODE **root, TBBT_NODE *ptr, intn side) ptr->Parent->Rchild = kid; } ptr->Parent = kid; - kid->link[Other(side)] = ptr; - kid->flags = (TBBT_FLAG)SetFlags(kid, Other(side), deep[2] - 1 - Max(deep[0], 0), HasChild(kid, side)); + kid->Link[Other(side)] = ptr; + kid->Flags = (TBBT_FLAG)SetFlags(kid, Other(side), deep[2] - 1 - Max(deep[0], 0), HasChild(kid, side)); /* update leaf counts */ if (side == LEFT) { /* kid's left count doesn't change, nor ptr's r-count */ - kid->rcnt = prcnt + krcnt + 1; /* kid's leafs+former parent's leafs+parent */ - ptr->lcnt = krcnt; + kid->Rcnt = prcnt + krcnt + 1; /* kid's leafs+former parent's leafs+parent */ + ptr->Lcnt = krcnt; } /* end if */ else { /* kid's right count doesn't change, nor ptr's l-count */ - kid->lcnt = plcnt + klcnt + 1; /* kid's leafs+former parent's leafs+parent */ - ptr->rcnt = klcnt; + kid->Lcnt = plcnt + klcnt + 1; /* kid's leafs+former parent's leafs+parent */ + ptr->Rcnt = klcnt; } /* end if */ - ptr->flags = ptrflg; + ptr->Flags = ptrflg; return kid; } @@ -348,36 +405,36 @@ swapkid(TBBT_NODE **root, TBBT_NODE *ptr, intn side) * balance through "rotation"s when needed. */ static void -balance(TBBT_NODE **root, TBBT_NODE *ptr, intn side, intn added) +balance(TBBT_NODE **root, TBBT_NODE *ptr, int side, int added) { - intn deeper = added; /* 1 if sub-tree got longer; -1 if got shorter */ - intn odelta; - intn obal; + int deeper = added; /* 1 if sub-tree got longer; -1 if got shorter */ + int odelta; + int obal; while (NULL != ptr) { odelta = Delta(ptr, side); /* delta before the node was added */ obal = UnBal(ptr); if (LEFT == side) /* One more/fewer left child: */ if (0 < added) - ptr->lcnt++; /* LeftCnt(ptr)++ */ + ptr->Lcnt++; /* LeftCnt(ptr)++ */ else - ptr->lcnt--; /* LeftCnt(ptr)-- */ + ptr->Lcnt--; /* LeftCnt(ptr)-- */ else if (0 < added) - ptr->rcnt++; /* RightCnt(ptr)++ */ + ptr->Rcnt++; /* RightCnt(ptr)++ */ else - ptr->rcnt--; /* RightCnt(ptr)-- */ + ptr->Rcnt--; /* RightCnt(ptr)-- */ if (0 != deeper) { /* One leg got longer or shorter: */ if ((deeper < 0 && odelta < 0) || (deeper > 0 && odelta > 0)) { /* Became too unbalanced: */ TBBT_NODE *kid; - ptr->flags |= TBBT_DOUBLE; /* Mark node too unbalanced */ + ptr->Flags |= TBBT_DOUBLE; /* Mark node too unbalanced */ if (deeper < 0) /* Just removed a node: */ side = Other(side); /* Swap with child from other side. */ else /* Just inserted a node: */ if (ptr->Parent && UnBal(ptr->Parent)) { deeper = 0; /* Fix will re-shorten sub-tree. */ } - kid = ptr->link[side]; + kid = ptr->Link[side]; if (Heavy(kid, Other(side))) { /* Double rotate needed: */ kid = swapkid(root, kid, Other(side)); ptr = swapkid(root, ptr, side); @@ -391,15 +448,15 @@ balance(TBBT_NODE **root, TBBT_NODE *ptr, intn side, intn added) } } else if (obal) { /* Just became balanced: */ - ptr->flags &= ~TBBT_UNBAL; + ptr->Flags &= ~TBBT_UNBAL; if (0 < deeper) { /* Shorter of legs lengthened */ - ptr->flags |= TBBT_INTERN; /* Mark as internal node now */ + ptr->Flags |= TBBT_INTERN; /* Mark as internal node now */ deeper = 0; /* so max length unchanged */ } /* end if */ } else if (deeper < 0) { /* Just became unbalanced: */ - if (ptr->link[Other(side)] != NULL && ptr->link[Other(side)]->Parent == ptr) { - ptr->flags |= (TBBT_FLAG)TBBT_HEAVY(Other(side)); /* Other side longer */ + if (ptr->Link[Other(side)] != NULL && ptr->Link[Other(side)]->Parent == ptr) { + ptr->Flags |= (TBBT_FLAG)TBBT_HEAVY(Other(side)); /* Other side longer */ if (ptr->Parent) if (ptr->Parent->Rchild == ptr) { /* we're the right child */ if (Heavy(ptr->Parent, RIGHT) && LeftCnt(ptr->Parent) == 1) @@ -412,7 +469,7 @@ balance(TBBT_NODE **root, TBBT_NODE *ptr, intn side, intn added) } } else { /* Just became unbalanced: */ - ptr->flags |= (TBBT_FLAG)TBBT_HEAVY(side); /* 0Flags |= (TBBT_FLAG)TBBT_HEAVY(side); /* 0Parent) { @@ -473,9 +530,9 @@ balance(TBBT_NODE **root, TBBT_NODE *ptr, intn side, intn added) /* Returns pointer to inserted node (or NULL) */ TBBT_NODE * tbbtins(TBBT_NODE **root, void *item, void *key, - intn (*compar)(void * /* k1 */, void * /* k2 */, intn /* arg */), intn arg) + int (*compar)(void * /* k1 */, void * /* k2 */, int /* arg */), int arg) { - intn cmp; + int cmp; TBBT_NODE *ptr, *parent; if (NULL != tbbtfind(*root, (key ? key : item), compar, arg, &parent) || NULL == (ptr = tbbt_get_node())) @@ -483,9 +540,9 @@ tbbtins(TBBT_NODE **root, void *item, void *key, ptr->data = item; ptr->key = key ? key : item; ptr->Parent = parent; - ptr->flags = 0L; /* No children on either side */ - ptr->lcnt = 0; - ptr->rcnt = 0; + ptr->Flags = 0L; /* No children on either side */ + ptr->Lcnt = 0; + ptr->Rcnt = 0; if (NULL == parent) { /* Adding first node to tree: */ *root = ptr; ptr->Lchild = ptr->Rchild = NULL; @@ -515,9 +572,9 @@ tbbtdins(TBBT_TREE *tree, void *item, void *key) if (tree == NULL) return NULL; - ret_node = tbbtins(&(tree->root), item, key, tree->compar, tree->cmparg); + ret_node = tbbtins(&(tree->root), item, key, tree->Compar, tree->Cmparg); if (ret_node != NULL) - tree->count++; + tree->Count++; return ret_node; } @@ -538,7 +595,7 @@ tbbtrem(TBBT_NODE **root, TBBT_NODE *node, void **kp) TBBT_NODE *leaf; /* Node with one or zero children */ TBBT_NODE *par; /* Parent of `leaf' */ TBBT_NODE *next; /* Next/prev node near `leaf' (`leaf's `side' thread) */ - intn side; /* `leaf' is `side' child of `par' */ + int side; /* `leaf' is `side' child of `par' */ void *data; /* Saved pointer to data item of deleted node */ if (NULL == root || NULL == node) @@ -565,7 +622,7 @@ tbbtrem(TBBT_NODE **root, TBBT_NODE *node, void **kp) par = leaf->Parent; if (par == next) { /* Case 2x: `node' had exactly 2 descendants */ side = Other(side); /* Transform this to Case 2 */ - next = leaf->link[side]; + next = leaf->Link[side]; } node->data = leaf->data; node->key = leaf->key; @@ -573,12 +630,12 @@ tbbtrem(TBBT_NODE **root, TBBT_NODE *node, void **kp) else { /* Node has one or zero children: */ leaf = node; /* Simply remove THIS node */ par = leaf->Parent; - if (NULL == par) { /* Case 3: Remove root (of 1- or 2-node tree) */ - side = (intn)UnBal(node); /* Which side root has a child on */ - if (side) { /* Case 3a: Remove root of 2-node tree: */ - *root = leaf = node->link[side]; - leaf->Parent = leaf->link[Other(side)] = NULL; - leaf->flags = 0; /* No left children, balanced, not internal */ + if (NULL == par) { /* Case 3: Remove root (of 1- or 2-node tree) */ + side = (int)UnBal(node); /* Which side root has a child on */ + if (side) { /* Case 3a: Remove root of 2-node tree: */ + *root = leaf = node->Link[side]; + leaf->Parent = leaf->Link[Other(side)] = NULL; + leaf->Flags = 0; /* No left children, balanced, not internal */ } else { /* Case 3b: Remove last node of tree: */ *root = NULL; @@ -587,7 +644,7 @@ tbbtrem(TBBT_NODE **root, TBBT_NODE *node, void **kp) return data; } side = (par->Rchild == leaf) ? RIGHT : LEFT; - next = leaf->link[side]; + next = leaf->Link[side]; } /* Now the deletion has been reduced to the following cases (and Case 3 has * been handled completely above and Case 2x has been transformed into @@ -611,53 +668,61 @@ tbbtrem(TBBT_NODE **root, TBBT_NODE *node, void **kp) * the root falls into Case 3a while removing the only leaf falls into * Case 2 (with `next' NULL and `par' the root node). */ if (!UnBal(leaf)) { /* Case 2: `leaf' has no children: */ - par->link[side] = leaf->link[side]; - par->flags &= (TBBT_FLAG)(~(TBBT_INTERN | TBBT_HEAVY(side))); + par->Link[side] = leaf->Link[side]; + par->Flags &= (TBBT_FLAG)(~(TBBT_INTERN | TBBT_HEAVY(side))); } else { /* Case 1: `leaf' has one child: */ TBBT_NODE *n; if (HasChild(leaf, side)) { /* two-in-a-row cases */ - n = leaf->link[side]; - par->link[side] = n; + n = leaf->Link[side]; + par->Link[side] = n; n->Parent = par; if (HasChild(n, Other(side))) while (HasChild(n, Other(side))) - n = n->link[Other(side)]; - n->link[Other(side)] = par; + n = n->Link[Other(side)]; + n->Link[Other(side)] = par; } /* end if */ else { /* zig-zag cases */ - n = leaf->link[Other(side)]; - par->link[side] = n; + n = leaf->Link[Other(side)]; + par->Link[side] = n; n->Parent = par; if (HasChild(n, side)) while (HasChild(n, side)) - n = n->link[side]; - n->link[side] = next; + n = n->Link[side]; + n->Link[side] = next; } /* end else */ } tbbt_release_node(leaf); balance(root, par, side, -1); - ((TBBT_TREE *)root)->count--; + ((TBBT_TREE *)root)->Count--; return data; } /* tbbtdmake - Allocate a new tree description record for an empty tree */ /* Returns a pointer to the description record */ TBBT_TREE * -tbbtdmake(intn (*cmp)(void * /* k1 */, void * /* k2 */, intn /* arg */), intn arg, uintn fast_compare) +tbbtdmake(int (*cmp)(void * /* k1 */, void * /* k2 */, int /* arg */), int arg, unsigned fast_compare) { - TBBT_TREE *tree = malloc(sizeof(TBBT_TREE)); - if (NULL == tree) - return NULL; + TBBT_TREE *tree = NULL; + + if (NULL == (tree = (TBBT_TREE *)calloc(1, sizeof(TBBT_TREE)))) + goto error; + if (NULL == (tree->priv = (TBBT_TREE_PRIV *)calloc(1, sizeof(TBBT_TREE_PRIV)))) + goto error; tree->root = NULL; - tree->count = 0; - tree->fast_compare = fast_compare; - tree->compar = cmp; - tree->cmparg = arg; + tree->Count = 0; + tree->Fast_compare = fast_compare; + tree->Compar = cmp; + tree->Cmparg = arg; return tree; +error: + if (tree) + free(tree->priv); + free(tree); + return NULL; } /* tbbtfree() - Free an entire tree not allocated with tbbtdmake(). */ @@ -705,15 +770,15 @@ tbbtprint(TBBT_NODE *node) if (node == NULL) return; printf("node=%p, key=%p, data=%p, flags=%x\n", (void *)node, node->key, node->data, - (unsigned)node->flags); - printf("Lcnt=%d, Rcnt=%d\n", (int)node->lcnt, (int)node->rcnt); + (unsigned)node->Flags); + printf("Lcnt=%d, Rcnt=%d\n", (int)node->Lcnt, (int)node->Rcnt); printf("*key=%d\n", (int)*(int32 *)(node->key)); printf("Lchild=%p, Rchild=%p, Parent=%p\n", (void *)node->Lchild, (void *)node->Rchild, (void *)node->Parent); } /* end tbbtprint() */ void -tbbt1dump(TBBT_NODE *node, intn method) +tbbt1dump(TBBT_NODE *node, int method) { if (node == NULL) return; @@ -747,10 +812,10 @@ tbbt1dump(TBBT_NODE *node, intn method) } /* end tbbt1dump() */ void -tbbtdump(TBBT_TREE *tree, intn method) +tbbtdump(TBBT_TREE *tree, int method) { if (tree != NULL && *(TBBT_NODE **)tree != NULL) { - printf("Number of nodes in the tree: %ld\n", tree->count); + printf("Number of nodes in the tree: %ld\n", tree->Count); tbbt1dump(tree->root, method); } /* end if */ else @@ -765,8 +830,8 @@ tbbt_printNode(TBBT_NODE *node, void (*key_dump)(void *, void *)) printf("ERROR: null node pointer\n"); return; } - printf("node=%p, flags=%x, Lcnt=%ld, Rcnt=%ld\n", (void *)node, (unsigned)node->flags, (long)node->lcnt, - (long)node->rcnt); + printf("node=%p, flags=%x, Lcnt=%ld, Rcnt=%ld\n", (void *)node, (unsigned)node->Flags, (long)node->Lcnt, + (long)node->Rcnt); printf("Lchild=%p, Rchild=%p, Parent=%p\n", (void *)node->Lchild, (void *)node->Rchild, (void *)node->Parent); if (key_dump != NULL) { @@ -776,7 +841,7 @@ tbbt_printNode(TBBT_NODE *node, void (*key_dump)(void *, void *)) } /* end tbbt_printNode() */ void -tbbt_dumpNode(TBBT_NODE *node, void (*key_dump)(void *, void *), intn method) +tbbt_dumpNode(TBBT_NODE *node, void (*key_dump)(void *, void *), int method) { if (node == NULL) return; @@ -810,13 +875,13 @@ tbbt_dumpNode(TBBT_NODE *node, void (*key_dump)(void *, void *), intn method) } /* end tbbt_dumpNode() */ void -tbbt_dump(TBBT_TREE *ptree, void (*key_dump)(void *, void *), intn method) +tbbt_dump(TBBT_TREE *ptree, void (*key_dump)(void *, void *), int method) { TBBT_TREE *tree; tree = (TBBT_TREE *)ptree; printf("TBBT-tree dump %p:\n\n", (void *)ptree); - printf("capacity = %ld\n", (long)tree->count); + printf("capacity = %ld\n", (long)tree->Count); printf("\n"); tbbt_dumpNode(tree->root, key_dump, method); } @@ -829,6 +894,7 @@ tbbtdfree(TBBT_TREE *tree, void (*fd)(void * /* item */), void (*fk)(void * /* k return NULL; tbbtfree(&tree->root, fd, fk); + free(tree->priv); free(tree); return NULL; } @@ -840,7 +906,7 @@ tbbtcount(TBBT_TREE *tree) if (tree == NULL) return -1; else - return (long)tree->count; + return (long)tree->Count; } /****************************************************************************** @@ -864,10 +930,19 @@ tbbt_get_node(void) ret_value = tbbt_free_list; tbbt_free_list = tbbt_free_list->Lchild; } - else - ret_value = malloc(sizeof(TBBT_NODE)); + else { + if (NULL == (ret_value = (TBBT_NODE *)calloc(1, sizeof(TBBT_NODE)))) + goto error; + if (NULL == (ret_value->priv = (TBBT_NODE_PRIV *)calloc(1, sizeof(TBBT_NODE_PRIV)))) + goto error; + } return ret_value; +error: + if (ret_value) + free(ret_value->priv); + free(ret_value); + return NULL; } /* end tbbt_get_node() */ /****************************************************************************** @@ -895,7 +970,7 @@ tbbt_release_node(TBBT_NODE *nod) PURPOSE Terminate various static buffers. USAGE - intn tbbt_shutdown() + int tbbt_shutdown() RETURNS Returns SUCCEED/FAIL DESCRIPTION @@ -906,7 +981,7 @@ tbbt_release_node(TBBT_NODE *nod) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -intn +int tbbt_shutdown(void) { TBBT_NODE *curr; @@ -916,6 +991,7 @@ tbbt_shutdown(void) while (tbbt_free_list != NULL) { curr = tbbt_free_list; tbbt_free_list = tbbt_free_list->Lchild; + free(curr->priv); free(curr); } } diff --git a/hdf/src/tbbt.h b/hdf/src/tbbt.h index 481af1e6c1..b9edc0355a 100644 --- a/hdf/src/tbbt.h +++ b/hdf/src/tbbt.h @@ -19,87 +19,45 @@ #include "hdfi.h" -typedef struct tbbt_node TBBT_NODE; +/* Define the "fast compare" values */ +#define TBBT_FAST_UINT16_COMPARE 1 +#define TBBT_FAST_INT32_COMPARE 2 + +/* Private TBBT information (defined in tbbt.c) */ +struct tbbt_node_private; + +/* Private TBBT node information (defined in tbbt.c) */ +struct tbbt_tree_private; /* Threaded node structure */ -struct tbbt_node { +typedef struct tbbt_node { void *data; /* Pointer to user data to be associated with node */ void *key; /* Field to sort nodes on */ -#ifdef TBBT_INTERNALS -#define PARENT 0 -#define LEFT 1 -#define RIGHT 2 - TBBT_NODE *link[3]; /* Pointers to parent, left child, and right child */ -#define Parent link[PARENT] -#define Lchild link[LEFT] -#define Rchild link[RIGHT] -#define TBBT_FLAG unsigned long -#define TBBT_LEAF unsigned long - TBBT_FLAG flags; /* Combination of the following bit fields: */ -#define TBBT_HEAVY(s) s /* If the `s' sub-tree is deeper than the other */ -#define TBBT_DOUBLE 4 /* If "heavy" sub-tree is two levels deeper */ -#define TBBT_INTERN 8 /* If node is internal (has two children) */ -#define TBBT_UNBAL (TBBT_HEAVY(LEFT) | TBBT_HEAVY(RIGHT)) -#define TBBT_FLAGS (TBBT_UNBAL | TBBT_INTERN | TBBT_DOUBLE) -#define TBBT_CHILD(s) (TBBT_INTERN | TBBT_HEAVY(s)) - TBBT_LEAF lcnt; /* count of left children */ - TBBT_LEAF rcnt; /* count of right children */ -#define LeftCnt(node) ((node)->lcnt) /* Left descendants */ -#define RightCnt(node) ((node)->rcnt) /* Left descendants */ -#define Cnt(node, s) (LEFT == (s) ? LeftCnt(node) : RightCnt(node)) -#define HasChild(n, s) (Cnt(n, s) > 0) -#define Heavy(n, s) ((s) & (LeftCnt(n) > RightCnt(n) ? LEFT : LeftCnt(n) == RightCnt(n) ? 0 : RIGHT)) -#define Intern(n) (LeftCnt(n) && RightCnt(n)) -#define UnBal(n) (LeftCnt(n) > RightCnt(n) ? LEFT : LeftCnt(n) == RightCnt(n) ? 0 : RIGHT) -#define Double(n) (TBBT_DOUBLE & (n)->flags) -#define Other(side) (LEFT + RIGHT - (side)) -#define Delta(n, s) ((Heavy(n, s) ? 1 : -1) * (Double(n) ? 2 : UnBal(n) ? 1 : 0)) -#define SetFlags(n, s, b, i) \ - ((-2 < (b) && (b) < 2 ? 0 : TBBT_DOUBLE) | \ - (0 > (b) ? TBBT_HEAVY(s) \ - : (b) > 0 ? TBBT_HEAVY(Other(s)) \ - : 0) | \ - ((i) ? TBBT_INTERN : 0)) -}; - -/* Pointer to the tbbt node free list */ -static TBBT_NODE *tbbt_free_list = NULL; + struct tbbt_node_private *priv; /* Private information about the TBBT node */ +} TBBT_NODE; -typedef struct tbbt_tree TBBT_TREE; /* Threaded tree structure */ -struct tbbt_tree { - TBBT_NODE *root; - unsigned long count; /* The number of nodes in the tree currently */ - uintn fast_compare; /* use a faster in-line compare (with casts) instead of function call */ - intn (*compar)(void *k1, void *k2, intn cmparg); - intn cmparg; -#endif /* TBBT_INTERNALS */ -}; +typedef struct tbbt_tree { + TBBT_NODE *root; -/* Define the "fast compare" values */ -#define TBBT_FAST_UINT16_COMPARE 1 -#define TBBT_FAST_INT32_COMPARE 2 - -#ifndef TBBT_INTERNALS -typedef TBBT_NODE **TBBT_TREE; -#endif /* TBBT_INTERNALS */ - -/* Return maximum of two scalar values (use arguments w/o side effects): */ -#define Max(a, b) ((a) > (b) ? (a) : (b)) + struct tbbt_tree_private *priv; /* Private information about the TBBT */ +} TBBT_TREE; /* These routines are designed to allow use of a general-purpose balanced tree * implementation. These trees are appropriate for maintaining in memory one * or more lists of items, each list sorted according to key values (key values * must form a "completely ordered set") where no two items in a single list * can have the same key value. The following operations are supported: - * Create an empty list - * Add an item to a list - * Look up an item in a list by key value - * Look up the Nth item in a list - * Delete an item from a list - * Find the first/last/next/previous item in a list - * Destroy a list + * + * - Create an empty list + * - Add an item to a list + * - Look up an item in a list by key value + * - Look up the Nth item in a list + * - Delete an item from a list + * - Find the first/last/next/previous item in a list + * - Destroy a list + * * Each of the above operations requires Order(log(N)) time where N is the * number of items in the list (except for list creation which requires * constant time and list destruction which requires Order(N) time if the user- @@ -139,7 +97,7 @@ typedef TBBT_NODE **TBBT_TREE; extern "C" { #endif -HDFLIBAPI TBBT_TREE *tbbtdmake(intn (*compar)(void *, void *, intn), intn arg, uintn fast_compare); +HDFLIBAPI TBBT_TREE *tbbtdmake(int (*compar)(void *, void *, int), int arg, unsigned fast_compare); /* Allocates and initializes an empty threaded, balanced, binary tree and * returns a pointer to the control structure for it. You can also create * empty trees without this function as long as you never use tbbtd* routines @@ -201,10 +159,10 @@ HDFLIBAPI TBBT_TREE *tbbtdmake(intn (*compar)(void *, void *, intn), intn arg, u */ HDFLIBAPI TBBT_NODE *tbbtdfind(TBBT_TREE *tree, void *key, TBBT_NODE **pp); -HDFLIBAPI TBBT_NODE *tbbtfind(TBBT_NODE *root, void *key, intn (*cmp)(void *, void *, intn), intn arg, +HDFLIBAPI TBBT_NODE *tbbtfind(TBBT_NODE *root, void *key, int (*cmp)(void *, void *, int), int arg, TBBT_NODE **pp); HDFLIBAPI TBBT_NODE *tbbtdless(TBBT_TREE *tree, void *key, TBBT_NODE **pp); -HDFLIBAPI TBBT_NODE *tbbtless(TBBT_NODE *root, void *key, intn (*cmp)(void *, void *, intn), intn arg, +HDFLIBAPI TBBT_NODE *tbbtless(TBBT_NODE *root, void *key, int (*cmp)(void *, void *, int), int arg, TBBT_NODE **pp); /* Locate a node based on the key given. A pointer to the node in the tree * with a key value matching `key' is returned. If no such node exists, NULL @@ -228,8 +186,8 @@ HDFLIBAPI TBBT_NODE *tbbtindx(TBBT_NODE *root, int32 indx); */ HDFLIBAPI TBBT_NODE *tbbtdins(TBBT_TREE *tree, void *item, void *key); -HDFLIBAPI TBBT_NODE *tbbtins(TBBT_NODE **root, void *item, void *key, intn (*cmp)(void *, void *, intn), - intn arg); +HDFLIBAPI TBBT_NODE *tbbtins(TBBT_NODE **root, void *item, void *key, int (*cmp)(void *, void *, int), + int arg); /* Insert a new node to the tree having a key value of `key' and a data pointer * of `item'. If a node already exists in the tree with key value `key' or if * malloc() fails, NULL is returned (no node is inserted), otherwise a pointer @@ -280,7 +238,7 @@ HDFLIBAPI void tbbtfree(TBBT_NODE **root, void (*fd)(void *), void (*fk)(v HDFLIBAPI void tbbtprint(TBBT_NODE *node); /* Prints out the data in a node */ -HDFLIBAPI void tbbtdump(TBBT_TREE *tree, intn method); +HDFLIBAPI void tbbtdump(TBBT_TREE *tree, int method); /* Prints an entire tree. The method variable determines which sort of * traversal is used: * -1 : Pre-Order Traversal @@ -291,7 +249,7 @@ HDFLIBAPI void tbbtdump(TBBT_TREE *tree, intn method); HDFLIBAPI long tbbtcount(TBBT_TREE *tree); /* Terminate the buffers used in the tbbt*() interface */ -HDFPUBLIC intn tbbt_shutdown(void); +HDFPUBLIC int tbbt_shutdown(void); #ifdef __cplusplus } diff --git a/hdf/src/vgp.c b/hdf/src/vgp.c index db60852ae4..66071bef26 100644 --- a/hdf/src/vgp.c +++ b/hdf/src/vgp.c @@ -2291,7 +2291,7 @@ Vgetid(HFILEID f, /* IN: file handle */ if (vf->vgtree == NULL) HGOTO_DONE(FAIL); /* just return FAIL, no error */ - if (NULL == (t = (void **)tbbtfirst((TBBT_NODE *)*(vf->vgtree)))) + if (NULL == (t = (void **)tbbtfirst(vf->vgtree->root))) HGOTO_DONE(FAIL); /* just return FAIL, no error */ /* t is assumed to valid at this point */ @@ -2305,8 +2305,8 @@ Vgetid(HFILEID f, /* IN: file handle */ key = (int32)vgid; t = (void **)tbbtdfind(vf->vgtree, (void *)&key, NULL); - if (t == NULL || t == (void **)tbbtlast((TBBT_NODE *)*( - vf->vgtree))) { /* couldn't find the old vgid or at the end */ + if (t == NULL || t == (void **)tbbtlast(vf->vgtree->root)) { + /* couldn't find the old vgid or at the end */ ret_value = (FAIL); } else if (NULL == (t = (void **)tbbtnext((TBBT_NODE *)t))) /* get the next node in the tree */ diff --git a/hdf/src/vio.c b/hdf/src/vio.c index adaa4fbd92..7e1073cb2a 100644 --- a/hdf/src/vio.c +++ b/hdf/src/vio.c @@ -1174,7 +1174,7 @@ VSgetid(HFILEID f, /* IN: file handle */ if (vf->vstree == NULL) HGOTO_DONE(FAIL); - if ((t = (void **)tbbtfirst((TBBT_NODE *)*(vf->vstree))) == NULL) + if ((t = (void **)tbbtfirst(vf->vstree->root)) == NULL) HGOTO_DONE(FAIL); /* we assume 't' is valid at this point */ From 846594a75b3adf4560c6bc86ad39af1631375f6e Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 14 Feb 2024 11:31:56 -0800 Subject: [PATCH 24/65] Fix all warnings about shadowed variables (#532) --- hdf/util/hdfgifwr.c | 12 +- hdf/util/hdfpack.c | 24 +- hdf/util/vshow.c | 22 +- mfhdf/hdfimport/hdfimport.c | 892 ++++++++++++++++++------------------ mfhdf/nctest/add.c | 5 - mfhdf/nctest/atttests.c | 178 +++---- mfhdf/nctest/cdftests.c | 66 +-- mfhdf/nctest/dimtests.c | 50 +- mfhdf/nctest/driver.c | 10 + mfhdf/nctest/slabs.c | 6 +- mfhdf/nctest/testcdf.h | 6 +- mfhdf/nctest/vardef.c | 20 +- mfhdf/nctest/varget.c | 18 +- mfhdf/nctest/vargetg.c | 14 +- mfhdf/nctest/varput.c | 20 +- mfhdf/nctest/varputg.c | 16 +- mfhdf/nctest/vartests.c | 102 +++-- mfhdf/nctest/vputget.c | 32 +- mfhdf/nctest/vputgetg.c | 52 ++- 19 files changed, 777 insertions(+), 768 deletions(-) diff --git a/hdf/util/hdfgifwr.c b/hdf/util/hdfgifwr.c index b6d181b3f3..becdc1d3a2 100644 --- a/hdf/util/hdfgifwr.c +++ b/hdf/util/hdfgifwr.c @@ -149,7 +149,7 @@ static unsigned short codetab[HSIZE]; #define HashTabOf(i) htab[i] #define CodeTabOf(i) codetab[i] -static int hsize = HSIZE; /* for dynamic table sizing */ +static int hsize_g = HSIZE; /* for dynamic table sizing */ /* * To save much memory, we overlay the table used by compress() with those @@ -221,7 +221,7 @@ compress(int init_bits, FILE *outfile, byte *data, int len) maxmaxcode = 1 << XV_BITS; memset(htab, 0, sizeof(htab)); memset(codetab, 0, sizeof(codetab)); - hsize = HSIZE; + hsize_g = HSIZE; free_ent = 0; clear_flg = 0; in_count = 1; @@ -246,11 +246,11 @@ compress(int init_bits, FILE *outfile, byte *data, int len) len--; hshift = 0; - for (fcode = (long)hsize; fcode < 65536L; fcode *= 2L) + for (fcode = (long)hsize_g; fcode < 65536L; fcode *= 2L) hshift++; hshift = 8 - hshift; /* set hash code range bound */ - hsize_reg = hsize; + hsize_reg = hsize_g; cl_hash((count_int)hsize_reg); /* clear hash table */ output(ClearCode); @@ -384,7 +384,7 @@ cl_block(void) /* table clear for block compress */ { /* Clear out the hash table */ - cl_hash((count_int)hsize); + cl_hash((count_int)hsize_g); free_ent = ClearCode + 2; clear_flg = 1; @@ -401,7 +401,7 @@ cl_hash(count_int hsize) long m1 = -1; i = hsize - 16; - do { /* might use Sys V memset(3) here */ + do { *(htab_p - 16) = m1; *(htab_p - 15) = m1; *(htab_p - 14) = m1; diff --git a/hdf/util/hdfpack.c b/hdf/util/hdfpack.c index 9a50a291ad..82b91e1abb 100644 --- a/hdf/util/hdfpack.c +++ b/hdf/util/hdfpack.c @@ -271,15 +271,15 @@ main(int argc, char *argv[]) case SPECIAL_EXT: if (external) { sp_info_block_t info; - int32 aid1, new_aid; + int32 _aid, new_aid; char *name; /* get file name and offset */ - aid1 = Hstartread(infile, dlist[i].tag, dlist[i].ref); - if (aid1 == FAIL) + _aid = Hstartread(infile, dlist[i].tag, dlist[i].ref); + if (_aid == FAIL) continue; - ret = HDget_special_info(aid1, &info); + ret = HDget_special_info(_aid, &info); if ((ret == FAIL) || (info.key != SPECIAL_EXT)) continue; @@ -294,7 +294,7 @@ main(int argc, char *argv[]) info.offset, dlist[i].length); /* close the elements */ - Hendaccess(aid1); + Hendaccess(_aid); Hendaccess(new_aid); } else { @@ -305,22 +305,22 @@ main(int argc, char *argv[]) case SPECIAL_COMP: /* This code assumes that you'd like to leave the compressed data that way and not expand it */ { - int32 aid, len; + int32 _aid, len; void **buf; /* Read in old compressed data description */ - if ((aid = Hstartaccess(infile, dlist[i].tag, dlist[i].ref, DFACC_READ)) == FAIL) + if ((_aid = Hstartaccess(infile, dlist[i].tag, dlist[i].ref, DFACC_READ)) == FAIL) continue; HQuerylength(aid, &len); buf = malloc(len); - Hread(aid, len, buf); - Hendaccess(aid); + Hread(_aid, len, buf); + Hendaccess(_aid); /* Write compressed data description into new file */ - if ((aid = Hstartaccess(outfile, dlist[i].tag, dlist[i].ref, DFACC_WRITE)) == FAIL) + if ((_aid = Hstartaccess(outfile, dlist[i].tag, dlist[i].ref, DFACC_WRITE)) == FAIL) continue; - Hwrite(aid, len, buf); - Hendaccess(aid); + Hwrite(_aid, len, buf); + Hendaccess(_aid); free(buf); } break; default: diff --git a/hdf/util/vshow.c b/hdf/util/vshow.c index 02c9c190b1..9fa3853e26 100644 --- a/hdf/util/vshow.c +++ b/hdf/util/vshow.c @@ -485,7 +485,7 @@ vsdumpfull(int32 vs) static intn dumpattr(int32 vid, intn full, intn isvs) { - intn i, j, k, cn = 0; + int i, j, k, _cn = 0; VDATA *vs; vsinstance_t *vs_inst; VGROUP *vg; @@ -603,19 +603,19 @@ dumpattr(int32 vid, intn full, intn isvs) off = DFKNTsize(i_type | DFNT_NATIVE); ptr = (alloc_flag) ? buf : attrbuf; putchar('\t'); - cn = 0; + _cn = 0; for (k = 0; k < i_count; k++) { fmtfn((char *)ptr); ptr += off; putchar(' '); - cn++; - if (cn > 55) { + _cn++; + if (_cn > 55) { putchar('\n'); putchar('\t'); - cn = 0; + _cn = 0; } } - if (cn) + if (_cn) putchar('\n'); if (alloc_flag) { free(buf); @@ -712,19 +712,19 @@ dumpattr(int32 vid, intn full, intn isvs) off = DFKNTsize(i_type | DFNT_NATIVE); ptr = (alloc_flag) ? buf : attrbuf; putchar('\t'); - cn = 0; + _cn = 0; for (k = 0; k < i_count; k++) { fmtfn((char *)ptr); ptr += off; putchar(' '); - cn++; - if (cn > 55) { + _cn++; + if (_cn > 55) { putchar('\n'); putchar('\t'); - cn = 0; + _cn = 0; } } - if (cn) + if (_cn) putchar('\n'); if (alloc_flag) { free(buf); diff --git a/mfhdf/hdfimport/hdfimport.c b/mfhdf/hdfimport/hdfimport.c index 5b79c1da6c..5082ff5e2a 100644 --- a/mfhdf/hdfimport/hdfimport.c +++ b/mfhdf/hdfimport/hdfimport.c @@ -446,22 +446,26 @@ void fpdeallocate(struct Input *in, struct Raster *im, struct Options *opt int main(int argc, char *argv[]) { - struct Options opt; - int i, k; - int outfile_named = FALSE; - int token; - int state = 0; - int flag = 0; - char types[5][6] = {"FP32", "FP64", "INT32", "INT16", "INT8"}; + struct Options *opt = NULL; + int i, k; + int outfile_named = FALSE; + int token; + int state = 0; + int flag = 0; + char types[5][6] = {"FP32", "FP64", "INT32", "INT16", "INT8"}; const char *err1 = "Invalid number of arguments: %d.\n"; const char *err2 = "Error in state table.\n"; const char *err3 = "No output file given.\n"; const char *err4 = "Program aborted.\n"; - /* const char *err5 = "Cannot allooacte memory.\n"; */ - /* - * set 'stdout' and 'stderr' to line-buffering mode - */ + const char *err5 = "Cannot allooacte memory.\n"; + + if (NULL == (opt = (struct Options *)calloc(1, sizeof(struct Options)))) { + fprintf(stderr, "%s", err5); + goto err; + } + + /* set 'stdout' and 'stderr' to line-buffering mode */ (void)HDsetvbuf(stderr, (char *)NULL, _IOLBF, 0); (void)HDsetvbuf(stdout, (char *)NULL, _IOLBF, 0); @@ -469,22 +473,22 @@ main(int argc, char *argv[]) * validate the number of command line arguments */ if (argc < 2) { - (void)fprintf(stderr, err1, argc); + fprintf(stderr, err1, argc); usage(argv[0]); goto err; } - opt.to_image = FALSE; /* default: no image */ - opt.to_float = FALSE; /* default: make float if no image */ - /* Set FALSE here. Will be set TRUE */ - /* after confirming image option is not set. */ - opt.ctm = EXPAND; /* default: pixel replication */ - opt.hres = 0; /* default: no expansion values */ - opt.vres = 0; - opt.dres = 0; - opt.pal = FALSE; /* default: no palette */ - opt.mean = FALSE; /* default: no mean given */ - opt.fcount = 0; /* to count number of input files */ + opt->to_image = FALSE; /* default: no image */ + opt->to_float = FALSE; /* default: make float if no image */ + /* Set FALSE here. Will be set TRUE */ + /* after confirming image option is not set. */ + opt->ctm = EXPAND; /* default: pixel replication */ + opt->hres = 0; /* default: no expansion values */ + opt->vres = 0; + opt->dres = 0; + opt->pal = FALSE; /* default: no palette */ + opt->mean = FALSE; /* default: no mean given */ + opt->fcount = 0; /* to count number of input files */ /* * parse the command line @@ -504,52 +508,52 @@ main(int argc, char *argv[]) switch (state) { case 1: /* counting input files */ - (void)strcpy(opt.infiles[opt.fcount].filename, argv[i]); - opt.infiles[opt.fcount].outtype = NO_NE; - opt.fcount++; + (void)strcpy(opt->infiles[opt->fcount].filename, argv[i]); + opt->infiles[opt->fcount].outtype = NO_NE; + opt->fcount++; break; case 2: /* -o found; look for outfile */ break; case 3: /* get outfile name */ - (void)strcpy(opt.outfile, argv[i]); + (void)strcpy(opt->outfile, argv[i]); outfile_named = TRUE; break; case 4: /* -r found */ - opt.to_image = TRUE; + opt->to_image = TRUE; break; case 5: /* -e found */ - opt.ctm = EXPAND; + opt->ctm = EXPAND; break; case 6: /* horizontal resolution */ - opt.hres = atoi(argv[i]); + opt->hres = atoi(argv[i]); break; case 7: /* vertical resolution */ - opt.vres = atoi(argv[i]); + opt->vres = atoi(argv[i]); break; case 8: /* depth resolution */ - opt.dres = atoi(argv[i]); + opt->dres = atoi(argv[i]); break; case 9: /* -i found */ - opt.ctm = INTERP; + opt->ctm = INTERP; break; case 10: /* -p found */ - opt.pal = TRUE; + opt->pal = TRUE; break; case 11: /* get pal filename */ - (void)strcpy(opt.palfile, argv[i]); + (void)strcpy(opt->palfile, argv[i]); break; case 12: /* -f found (after a -r) */ case 13: /* -f found (no -r yet) */ - opt.to_float = TRUE; + opt->to_float = TRUE; break; case 14: /* -h found; help, then exit */ help(argv[0]); exit(0); case 15: /* -m found */ - opt.mean = TRUE; + opt->mean = TRUE; break; case 16: /* mean value */ - opt.meanval = (float32)atof(argv[i]); + opt->meanval = (float32)atof(argv[i]); break; case 17: /* -t found */ i++; @@ -558,18 +562,18 @@ main(int argc, char *argv[]) if (!strcmp(argv[i], types[k])) flag = 1; if (flag) - opt.infiles[opt.fcount - 1].outtype = k - 1; + opt->infiles[opt->fcount - 1].outtype = k - 1; else { usage(argv[0]); goto err; } break; case 18: /* -n found */ - opt.infiles[opt.fcount - 1].outtype = FP_64; + opt->infiles[opt->fcount - 1].outtype = FP_64; break; case ERR: /* command syntax error */ default: - (void)fprintf(stderr, "%s", err2); + fprintf(stderr, "%s", err2); usage(argv[0]); goto err; } @@ -579,25 +583,28 @@ main(int argc, char *argv[]) * make sure an output file was specified */ if (!outfile_named) { - (void)fprintf(stderr, "%s", err3); + fprintf(stderr, "%s", err3); usage(argv[0]); goto err; } - if (!opt.to_image) - opt.to_float = TRUE; + if (!opt->to_image) + opt->to_float = TRUE; /* * process the input files */ - if (process(&opt)) + if (process(opt)) goto err; - return (0); + free(opt); + + return EXIT_SUCCESS; err: - (void)fprintf(stderr, "%s", err4); - return (1); + free(opt); + fprintf(stderr, "%s", err4); + return EXIT_FAILURE; } /* @@ -657,7 +664,7 @@ gdata(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_ma status = SDreaddata(sds_id, start, NULL, hdfdims, in->data); if (status == FAIL) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -667,7 +674,7 @@ gdata(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_ma for (j = 0; j < in->dims[1]; j++) { for (i = 0; i < in->dims[0]; i++, fp32++) { if (gfloat(infile, strm, fp32, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -689,7 +696,7 @@ gdata(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_ma for (j = 0; j < in->dims[1]; j++) { for (i = 0; i < in->dims[0]; i++, in32++) { if (gint32(infile, strm, in32, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -711,7 +718,7 @@ gdata(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_ma for (j = 0; j < in->dims[1]; j++) { for (i = 0; i < in->dims[0]; i++, in16++) { if (gint16(infile, strm, in16, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -734,7 +741,7 @@ gdata(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_ma for (j = 0; j < in->dims[1]; j++) { for (i = 0; i < in->dims[0]; i++, in8++) { if (gint8(infile, strm, in8, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -757,7 +764,7 @@ gdata(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_ma for (j = 0; j < in->dims[1]; j++) { for (i = 0; i < in->dims[0]; i++, fp64++) { if (gfloat64(infile, strm, fp64, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -780,16 +787,16 @@ gdata(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_ma } #ifdef DEBUG - (void)printf("\tdata:"); + printf("\tdata:"); for (k = 0, fp32 = in->data; k < in->dims[2]; k++) { - (void)printf("\n"); + printf("\n"); for (j = 0; j < in->dims[1]; j++) { - (void)printf("\n\t"); + printf("\n\t"); for (i = 0; i < in->dims[0]; i++, fp32++) - (void)printf("%E ", *fp32); + printf("%E ", *fp32); } } - (void)printf("\n\n\n"); + printf("\n\n\n"); #endif /* DEBUG */ return (0); @@ -813,8 +820,8 @@ gdata(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_ma static int gdimen(struct infilesformat infile_info, struct Input *in, FILE *strm) { - int32 hdfdims[3]; /* order: ZYX or YX */ - char infile[NAME_LEN]; + int32 hdfdims[3]; /* order: ZYX or YX */ + char *infile = infile_info.filename; /* shortcut for input filename */ char *sds_name = NULL; int32 rank, nattrs, dtype; /* rank, num of attrs, data type */ @@ -831,8 +838,7 @@ gdimen(struct infilesformat infile_info, struct Input *in, FILE *strm) */ if (in->is_hdf == TRUE) { int32 sds_id, sd_index; - int32 sd_id = infile_info.handle; /* shortcut for handle from SDstart */ - char *infile = infile_info.filename; /* shortcut for input filename */ + int32 sd_id = infile_info.handle; /* shortcut for handle from SDstart */ uint16 name_len = 0; intn status = FAIL; @@ -840,7 +846,7 @@ gdimen(struct infilesformat infile_info, struct Input *in, FILE *strm) sd_index = 0; sds_id = SDselect(sd_id, sd_index); if (sds_id == FAIL) { - (void)fprintf(stderr, "%s", err7); + fprintf(stderr, "%s", err7); goto err; } @@ -848,26 +854,26 @@ gdimen(struct infilesformat infile_info, struct Input *in, FILE *strm) the name's buffer */ status = SDgetnamelen(sds_id, &name_len); if (status == FAIL) { - (void)fprintf(stderr, err5, sd_index); + fprintf(stderr, err5, sd_index); goto err; } sds_name = (char *)malloc(name_len + 1); if (sds_name == NULL) { - (void)fprintf(stderr, "%s", err6); + fprintf(stderr, "%s", err6); goto err; } /* obtain the SDS' information */ status = SDgetinfo(sds_id, sds_name, &rank, hdfdims, &dtype, &nattrs); if (status == FAIL) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } in->rank = (int)rank; /* don't know how to deal with other numbers yet */ if (dtype != DFNT_FLOAT32) { - (void)fprintf(stderr, err4, infile); + fprintf(stderr, err4, infile); goto err; } @@ -886,7 +892,7 @@ gdimen(struct infilesformat infile_info, struct Input *in, FILE *strm) in->dims[2] = hdfdims[0]; } else { - (void)fprintf(stderr, err2, in->rank, infile); + fprintf(stderr, err2, in->rank, infile); goto err; } @@ -897,7 +903,7 @@ gdimen(struct infilesformat infile_info, struct Input *in, FILE *strm) } else { if (gint(infile, strm, &in->dims[2], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (in->dims[2] > 1) @@ -905,11 +911,11 @@ gdimen(struct infilesformat infile_info, struct Input *in, FILE *strm) else in->rank = 2; if (gint(infile, strm, &in->dims[1], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (gint(infile, strm, &in->dims[0], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -918,15 +924,15 @@ gdimen(struct infilesformat infile_info, struct Input *in, FILE *strm) * validate dimension sizes */ if ((in->dims[0] < 2) || (in->dims[1] < 2)) { - (void)fprintf(stderr, err3, infile); + fprintf(stderr, err3, infile); goto err; } #ifdef DEBUG - (void)printf("\nInput Information ...\n\n"); - (void)printf("\trank:\n\n\t%d\n\n", in->rank); - (void)printf("\tdimensions (nplanes,nrows,ncols):\n\n"); - (void)printf("\t%d %d %d\n\n", in->dims[2], in->dims[1], in->dims[0]); + printf("\nInput Information ...\n\n"); + printf("\trank:\n\n\t%d\n\n", in->rank); + printf("\tdimensions (nplanes,nrows,ncols):\n\n"); + printf("\t%d %d %d\n\n", in->dims[2], in->dims[1], in->dims[0]); #endif /* DEBUG */ free(sds_name); @@ -955,19 +961,19 @@ gfloat(char *infile, FILE *strm, float32 *fp32, struct Input *in) if (in->is_text == TRUE) { if (fscanf(strm, "%e", fp32) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } else if (in->is_fp32 == TRUE) { if (fread((char *)fp32, sizeof(float32), 1, strm) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } else { if (fread((char *)&fp64, sizeof(float64), 1, strm) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } *fp32 = (float32)fp64; @@ -996,13 +1002,13 @@ gfloat64(char *infile, FILE *strm, float64 *fp64, struct Input *in) if (in->is_text == TRUE) { if (fscanf(strm, "%le", fp64) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } else { if (fread((char *)fp64, sizeof(float64), 1, strm) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -1030,7 +1036,7 @@ gint(char *infile, FILE *strm, int32 *ival, struct Input *in) */ if (in->is_text == TRUE) { if (fscanf(strm, "%d", ival) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } @@ -1040,7 +1046,7 @@ gint(char *infile, FILE *strm, int32 *ival, struct Input *in) } else { if (fread((char *)ival, sizeof(int), 1, strm) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -1069,7 +1075,7 @@ gint32(char *infile, FILE *strm, int32 *ival, struct Input *in) */ if (in->is_text == TRUE) { if (fscanf(strm, "%d", ival) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } @@ -1079,7 +1085,7 @@ gint32(char *infile, FILE *strm, int32 *ival, struct Input *in) } else { if (fread((char *)ival, sizeof(int32), 1, strm) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -1106,14 +1112,14 @@ gint16(char *infile, FILE *strm, int16 *ival, struct Input *in) if (in->is_text == TRUE) { if (fscanf(strm, "%hd", ival) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } else { if (fread((char *)ival, sizeof(int16), 1, strm) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -1141,14 +1147,14 @@ gint8(char *infile, FILE *strm, int8 *ival, struct Input *in) if (in->is_text == TRUE) { if (fscanf(strm, "%hd", &temp) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } *ival = (int8)temp; } else { if (fread((char *)ival, sizeof(int8), 1, strm) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -1199,11 +1205,11 @@ gmaxmin(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_ char *infile = infile_info.filename; if (in->outtype == FP_32) { if (gfloat(infile, strm, &in->max, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (gfloat(infile, strm, &in->min, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (in->max > in->min) @@ -1211,11 +1217,11 @@ gmaxmin(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_ } if (in->outtype == FP_64) { if (gfloat64(infile, strm, &in->fp64s.max, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (gfloat64(infile, strm, &in->fp64s.min, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (in->fp64s.max > in->fp64s.min) @@ -1223,11 +1229,11 @@ gmaxmin(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_ } if (in->outtype == INT_32) { if (gint32(infile, strm, &in->in32s.max, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (gint32(infile, strm, &in->in32s.min, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (in->in32s.max > in->in32s.min) @@ -1236,11 +1242,11 @@ gmaxmin(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_ if (in->outtype == INT_16) { if (gint16(infile, strm, &in->in16s.max, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (gint16(infile, strm, &in->in16s.min, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (in->in16s.max > in->in16s.min) @@ -1249,11 +1255,11 @@ gmaxmin(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_ if (in->outtype == INT_8) { if (gint8(infile, strm, &in->in8s.max, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (gint8(infile, strm, &in->in8s.min, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (in->in8s.max > in->in8s.min) @@ -1262,8 +1268,8 @@ gmaxmin(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_ } #ifdef DEBUG - (void)printf("\tinput maximum/minimum values:\n\n"); - (void)printf("\t%E %E\n\n", in->max, in->min); + printf("\tinput maximum/minimum values:\n\n"); + printf("\t%E %E\n\n", in->max, in->min); #endif /* DEBUG */ return (0); @@ -1362,14 +1368,14 @@ gscale(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_s if (in->rank == 2) { for (i = 0; i < hdfdims[0]; i++) { if (gfloat(infile, strm, &in->vscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } in->vscale[i] = in->vscale[i - 1]; for (i = 0; i < hdfdims[1]; i++) { if (gfloat(infile, strm, &in->hscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -1379,21 +1385,21 @@ gscale(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_s else { for (i = 0; i < hdfdims[0]; i++) { if (gfloat(infile, strm, &in->dscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } in->dscale[i] = in->dscale[i - 1]; for (i = 0; i < hdfdims[1]; i++) { if (gfloat(infile, strm, &in->vscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } in->vscale[i] = in->vscale[i - 1]; for (i = 0; i < hdfdims[2]; i++) { if (gfloat(infile, strm, &in->hscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -1405,14 +1411,14 @@ gscale(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_s if (in->rank == 2) { for (i = 0; i < hdfdims[0]; i++) { if (gfloat64(infile, strm, &in->fp64s.vscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } in->fp64s.vscale[i] = in->fp64s.vscale[i - 1]; for (i = 0; i < hdfdims[1]; i++) { if (gfloat64(infile, strm, &in->fp64s.hscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -1421,7 +1427,7 @@ gscale(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_s else { for (i = 0; i < hdfdims[0]; i++) { if (gfloat64(infile, strm, &in->fp64s.dscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -1429,7 +1435,7 @@ gscale(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_s for (i = 0; i < hdfdims[1]; i++) { if (gfloat64(infile, strm, &in->fp64s.vscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -1437,7 +1443,7 @@ gscale(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_s for (i = 0; i < hdfdims[2]; i++) { if (gfloat64(infile, strm, &in->fp64s.hscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -1449,14 +1455,14 @@ gscale(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_s if (in->rank == 2) { for (i = 0; i < hdfdims[0]; i++) { if (gint32(infile, strm, &in->in32s.vscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } in->in32s.vscale[i] = in->in32s.vscale[i - 1]; for (i = 0; i < hdfdims[1]; i++) { if (gint32(infile, strm, &in->in32s.hscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -1466,21 +1472,21 @@ gscale(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_s else { for (i = 0; i < hdfdims[0]; i++) { if (gint32(infile, strm, &in->in32s.dscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } in->in32s.dscale[i] = in->in32s.dscale[i - 1]; for (i = 0; i < hdfdims[1]; i++) { if (gint32(infile, strm, &in->in32s.vscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } in->in32s.vscale[i] = in->in32s.vscale[i - 1]; for (i = 0; i < hdfdims[2]; i++) { if (gint32(infile, strm, &in->in32s.hscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -1492,14 +1498,14 @@ gscale(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_s if (in->rank == 2) { for (i = 0; i < hdfdims[0]; i++) { if (gint16(infile, strm, &in->in16s.vscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } in->in16s.vscale[i] = in->in16s.vscale[i - 1]; for (i = 0; i < hdfdims[1]; i++) { if (gint16(infile, strm, &in->in16s.hscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -1509,21 +1515,21 @@ gscale(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_s else { for (i = 0; i < hdfdims[0]; i++) { if (gint16(infile, strm, &in->in16s.dscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } in->in16s.dscale[i] = in->in16s.dscale[i - 1]; for (i = 0; i < hdfdims[1]; i++) { if (gint16(infile, strm, &in->in16s.vscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } in->in16s.vscale[i] = in->in16s.vscale[i - 1]; for (i = 0; i < hdfdims[2]; i++) { if (gint16(infile, strm, &in->in16s.hscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -1535,14 +1541,14 @@ gscale(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_s if (in->rank == 2) { for (i = 0; i < hdfdims[0]; i++) { if (gint8(infile, strm, &in->in8s.vscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } in->in8s.vscale[i] = in->in8s.vscale[i - 1]; for (i = 0; i < hdfdims[1]; i++) { if (gint8(infile, strm, &in->in8s.hscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -1552,21 +1558,21 @@ gscale(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_s else { for (i = 0; i < hdfdims[0]; i++) { if (gint8(infile, strm, &in->in8s.dscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } in->in8s.dscale[i] = in->in8s.dscale[i - 1]; for (i = 0; i < hdfdims[1]; i++) { if (gint8(infile, strm, &in->in8s.vscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } in->in8s.vscale[i] = in->in8s.vscale[i - 1]; for (i = 0; i < hdfdims[2]; i++) { if (gint8(infile, strm, &in->in8s.hscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -1578,25 +1584,25 @@ gscale(struct infilesformat infile_info, struct Input *in, FILE *strm, int *is_s #ifdef DEBUG if (in->rank == 2) { - (void)printf("\tscales of the axes (vert,horiz):\n\n\t"); + printf("\tscales of the axes (vert,horiz):\n\n\t"); for (i = 0; i < hdfdims[0]; i++) - (void)printf("%E ", in->vscale[i]); - (void)printf("\n\t"); + printf("%E ", in->vscale[i]); + printf("\n\t"); for (i = 0; i < hdfdims[1]; i++) - (void)printf("%E ", in->hscale[i]); + printf("%E ", in->hscale[i]); } else { - (void)printf("\tscales of the axes (depth,vert,horiz):\n\n\t"); + printf("\tscales of the axes (depth,vert,horiz):\n\n\t"); for (i = 0; i < hdfdims[0]; i++) - (void)printf("%E ", in->dscale[i]); - (void)printf("\n\t"); + printf("%E ", in->dscale[i]); + printf("\n\t"); for (i = 0; i < hdfdims[1]; i++) - (void)printf("%E ", in->vscale[i]); - (void)printf("\n\t"); + printf("%E ", in->vscale[i]); + printf("\n\t"); for (i = 0; i < hdfdims[2]; i++) - (void)printf("%E ", in->hscale[i]); + printf("%E ", in->hscale[i]); } - (void)printf("\n\n\n"); + printf("\n\n\n"); #endif /* DEBUG */ return (0); @@ -1671,7 +1677,7 @@ gtoken(char *s) token = OPT_num; } if (token == ERR) - (void)fprintf(stderr, err1, s); + fprintf(stderr, err1, s); } else if (isnum(s)) /* positive number */ token = OPT_num; @@ -1710,11 +1716,11 @@ gtype(char *infile, struct Input *in, FILE **strm) in->is_hdf = TRUE; else { if ((*strm = fopen(infile, "r")) == NULL) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (fread(buf, 4, 1, *strm) != 1) { - (void)fprintf(stderr, err2, infile); + fprintf(stderr, err2, infile); goto err; } if (!memcmp("TEXT", buf, 4) || !memcmp("text", buf, 4)) { @@ -1727,7 +1733,7 @@ gtype(char *infile, struct Input *in, FILE **strm) in->is_fp64 = TRUE; if (in->outtype != FP_64) if (in->outtype != NO_NE) { - (void)fprintf(stderr, err4, infile); + fprintf(stderr, err4, infile); goto err; } else @@ -1735,7 +1741,7 @@ gtype(char *infile, struct Input *in, FILE **strm) } else { if (in->outtype != NO_NE) { - (void)fprintf(stderr, err4, infile); + fprintf(stderr, err4, infile); goto err; } if (!memcmp("FP32", buf, 4) || !memcmp("fp32", buf, 4)) { @@ -1750,11 +1756,11 @@ gtype(char *infile, struct Input *in, FILE **strm) else if (!memcmp("IN08", buf, 4) || !memcmp("in08", buf, 4)) in->outtype = INT_8; else { - (void)fprintf(stderr, err3, infile); + fprintf(stderr, err3, infile); goto err; } if (in->outtype == NO_NE) { - (void)fprintf(stderr, err4, infile); + fprintf(stderr, err4, infile); goto err; } } @@ -1777,191 +1783,187 @@ gtype(char *infile, struct Input *in, FILE **strm) void help(char *name) { - (void)printf("Name:\n"); - (void)printf("\t%s (previously fp2hdf)\n\n", name); - (void)printf("Purpose:\n"); - (void)printf("\tTo convert floating point data to HDF Scientific "); - (void)printf("Data Set (SDS)\n"); - (void)printf("\tand/or 8-bit Raster Image Set (RIS8) format, "); - (void)printf("storing the results\n"); - (void)printf("\tin an HDF file. The image data can be scaled "); - (void)printf("about a mean value.\n\n"); - - (void)fprintf(stderr, "Synopsis:"); - (void)fprintf(stderr, "\n\t%s -h[elp]", name); - (void)fprintf(stderr, "\n\t\t Print this summary of usage and exit."); - (void)fprintf(stderr, "\n\t\t "); - (void)fprintf(stderr, "\n\t%s -V", name); - (void)fprintf(stderr, "\n\t\t Print version of the HDF4 library and exit."); - (void)fprintf(stderr, "\n\t\t "); - (void)fprintf( - stderr, "\n\t%s [ [-t[ype] | -n] [ [-t[ype] | -n]...]", - name); - (void)fprintf(stderr, "\n\t\t\t\t\t-o[utfile] [-r[aster] [ras_opts ...]] [-f[loat]]"); - - (void)fprintf(stderr, "\n\n\t :"); - (void)fprintf(stderr, "\n\t\t Name of the input file(s), containing a single "); - (void)fprintf(stderr, "\n\t\t two-dimensional or three-dimensional floating point array "); - (void)fprintf(stderr, "\n\t\t in either ASCII text, native floating point, native integer "); - (void)fprintf(stderr, "\n\t\t or HDF SDS format. If an HDF file is used for input, it "); - (void)fprintf(stderr, "\n\t\t must contain an SDS. The SDS need only contain a dimension "); - (void)fprintf(stderr, "\n\t\t record and the data, but if it also contains maximum and "); - (void)fprintf(stderr, "\n\t\t minimum values and/or scales for each axis, these will "); - (void)fprintf(stderr, "\n\t\t be used. If the input format is ASCII text or native "); - (void)fprintf(stderr, "\n\t\t floating point or native integer, see \"Notes\" below on "); - (void)fprintf(stderr, "\n\t\t how it must be organized."); - - (void)fprintf(stderr, "\n\n\t -t[ype] : "); - (void)fprintf(stderr, "\n\t\t Optionally used for every input ASCII file to specify the "); - (void)fprintf(stderr, "\n\t\t data type of the data-set to be written. If not specified "); - (void)fprintf(stderr, "\n\t\t default data type is 32-bit floating point. "); - (void)fprintf(stderr, "\n\t\t can be any of the following: FP32 (default), FP64, INT32"); - (void)fprintf(stderr, "\n\t\t INT16, INT8. It can be used only with ASCII files."); - - (void)fprintf(stderr, "\n\n\t -n: "); - (void)fprintf(stderr, "\n\t\t This option is to be used only if the binary input file "); - (void)fprintf(stderr, "\n\t\t contains 64-bit floating point data and the default"); - (void)fprintf(stderr, "\n\t\t behaviour (default behaviour is to write it to a 32-bit"); - (void)fprintf(stderr, "\n\t\t floating point data-set) should be overridden to write "); - (void)fprintf(stderr, "\n\t\t it to a 64-bit floating point data-set."); - - (void)fprintf(stderr, "\n\n\t -o[utfile] :"); - (void)fprintf(stderr, "\n\t\t Data from one or more input files are stored as one or"); - (void)fprintf(stderr, "\n\t\t more data sets and/or images in one HDF output file,"); - (void)fprintf(stderr, "\n\t\t \"outfile\"."); - - (void)fprintf(stderr, "\n\n\t -r[aster]:"); - (void)fprintf(stderr, "\n\t\t Store output as a raster image set in the output file."); - - (void)fprintf(stderr, "\n\n\t -f[loat]:"); - (void)fprintf(stderr, "\n\t Store output as a scientific data set in the output file."); - (void)fprintf(stderr, "\n\t This is the default if the \"-r\" option is not specified."); - - (void)fprintf(stderr, "\n\n\t ras_opts ..."); - (void)fprintf(stderr, "\n\n\t -e[xpand] []:"); - (void)fprintf(stderr, "\n\t Expand float data via pixel replication to produce the"); - (void)fprintf(stderr, "\n\t image(s). \"horiz\" and \"vert\" give the horizontal and"); - (void)fprintf(stderr, "\n\t vertical resolution of the image(s) to be produced; and"); - (void)fprintf(stderr, "\n\t optionally, \"depth\" gives the number of images or depth"); - (void)fprintf(stderr, "\n\t planes (for 3D input data)."); - - (void)fprintf(stderr, "\n\n\t -i[nterp] []:"); - (void)fprintf(stderr, "\n\t\t Apply bilinear, or trilinear, interpolation to the float"); - (void)fprintf(stderr, "\n\t\t data to produce the image(s). \"horiz\", \"vert\", and \"depth\""); - (void)fprintf(stderr, "\n\t\t must be greater than or equal to the dimensions of the"); - (void)fprintf(stderr, "\n\t\t original dataset."); - (void)fprintf(stderr, "\n\t\t If max and min are supplied in input file, this option clips"); - (void)fprintf(stderr, "\n\t\t values that are greater than max or less then min, setting"); - (void)fprintf(stderr, "\n\t\t them to the max and min, respectively."); - - (void)fprintf(stderr, "\n\n\t -p[alfile] :"); - (void)fprintf(stderr, "\n\t\t Store the palette with the image. Get the palette from"); - (void)fprintf(stderr, "\n\t\t \"palfile\"; which may be an HDF file containing a palette,"); - (void)fprintf(stderr, "\n\t\t or a file containing a raw palette."); - - (void)fprintf(stderr, "\n\n\t -m[ean] :"); - (void)fprintf(stderr, "\n\t\t If a floating point mean value is given, the image will be"); - (void)fprintf(stderr, "\n\t\t scaled about the mean. The new extremes (newmax and newmin),"); - (void)fprintf(stderr, "\n\t\t as given by:"); - - (void)fprintf(stderr, "\n\n\t\t\t newmax = mean + max(abs(max-mean), abs(mean-min))"); - (void)fprintf(stderr, "\n\t\t\t newmin = mean - max(abs(max-mean), abs(mean-min))"); - - (void)fprintf(stderr, "\n\n\t\t will be equidistant from the mean value. If no mean value"); - (void)fprintf(stderr, "\n\t\t is given, then the mean will be: 0.5 (max + min)"); - - (void)fprintf(stderr, "\n\n\t Notes:"); - (void)fprintf( + printf("Name:\n"); + printf("\t%s (previously fp2hdf)\n\n", name); + printf("Purpose:\n"); + printf("\tTo convert floating point data to HDF Scientific "); + printf("Data Set (SDS)\n"); + printf("\tand/or 8-bit Raster Image Set (RIS8) format, "); + printf("storing the results\n"); + printf("\tin an HDF file. The image data can be scaled "); + printf("about a mean value.\n\n"); + + fprintf(stderr, "Synopsis:"); + fprintf(stderr, "\n\t%s -h[elp]", name); + fprintf(stderr, "\n\t\t Print this summary of usage and exit."); + fprintf(stderr, "\n\t\t "); + fprintf(stderr, "\n\t%s -V", name); + fprintf(stderr, "\n\t\t Print version of the HDF4 library and exit."); + fprintf(stderr, "\n\t\t "); + fprintf(stderr, + "\n\t%s [ [-t[ype] | -n] [ [-t[ype] | -n]...]", + name); + fprintf(stderr, "\n\t\t\t\t\t-o[utfile] [-r[aster] [ras_opts ...]] [-f[loat]]"); + + fprintf(stderr, "\n\n\t :"); + fprintf(stderr, "\n\t\t Name of the input file(s), containing a single "); + fprintf(stderr, "\n\t\t two-dimensional or three-dimensional floating point array "); + fprintf(stderr, "\n\t\t in either ASCII text, native floating point, native integer "); + fprintf(stderr, "\n\t\t or HDF SDS format. If an HDF file is used for input, it "); + fprintf(stderr, "\n\t\t must contain an SDS. The SDS need only contain a dimension "); + fprintf(stderr, "\n\t\t record and the data, but if it also contains maximum and "); + fprintf(stderr, "\n\t\t minimum values and/or scales for each axis, these will "); + fprintf(stderr, "\n\t\t be used. If the input format is ASCII text or native "); + fprintf(stderr, "\n\t\t floating point or native integer, see \"Notes\" below on "); + fprintf(stderr, "\n\t\t how it must be organized."); + + fprintf(stderr, "\n\n\t -t[ype] : "); + fprintf(stderr, "\n\t\t Optionally used for every input ASCII file to specify the "); + fprintf(stderr, "\n\t\t data type of the data-set to be written. If not specified "); + fprintf(stderr, "\n\t\t default data type is 32-bit floating point. "); + fprintf(stderr, "\n\t\t can be any of the following: FP32 (default), FP64, INT32"); + fprintf(stderr, "\n\t\t INT16, INT8. It can be used only with ASCII files."); + + fprintf(stderr, "\n\n\t -n: "); + fprintf(stderr, "\n\t\t This option is to be used only if the binary input file "); + fprintf(stderr, "\n\t\t contains 64-bit floating point data and the default"); + fprintf(stderr, "\n\t\t behaviour (default behaviour is to write it to a 32-bit"); + fprintf(stderr, "\n\t\t floating point data-set) should be overridden to write "); + fprintf(stderr, "\n\t\t it to a 64-bit floating point data-set."); + + fprintf(stderr, "\n\n\t -o[utfile] :"); + fprintf(stderr, "\n\t\t Data from one or more input files are stored as one or"); + fprintf(stderr, "\n\t\t more data sets and/or images in one HDF output file,"); + fprintf(stderr, "\n\t\t \"outfile\"."); + + fprintf(stderr, "\n\n\t -r[aster]:"); + fprintf(stderr, "\n\t\t Store output as a raster image set in the output file."); + + fprintf(stderr, "\n\n\t -f[loat]:"); + fprintf(stderr, "\n\t Store output as a scientific data set in the output file."); + fprintf(stderr, "\n\t This is the default if the \"-r\" option is not specified."); + + fprintf(stderr, "\n\n\t ras_opts ..."); + fprintf(stderr, "\n\n\t -e[xpand] []:"); + fprintf(stderr, "\n\t Expand float data via pixel replication to produce the"); + fprintf(stderr, "\n\t image(s). \"horiz\" and \"vert\" give the horizontal and"); + fprintf(stderr, "\n\t vertical resolution of the image(s) to be produced; and"); + fprintf(stderr, "\n\t optionally, \"depth\" gives the number of images or depth"); + fprintf(stderr, "\n\t planes (for 3D input data)."); + + fprintf(stderr, "\n\n\t -i[nterp] []:"); + fprintf(stderr, "\n\t\t Apply bilinear, or trilinear, interpolation to the float"); + fprintf(stderr, "\n\t\t data to produce the image(s). \"horiz\", \"vert\", and \"depth\""); + fprintf(stderr, "\n\t\t must be greater than or equal to the dimensions of the"); + fprintf(stderr, "\n\t\t original dataset."); + fprintf(stderr, "\n\t\t If max and min are supplied in input file, this option clips"); + fprintf(stderr, "\n\t\t values that are greater than max or less then min, setting"); + fprintf(stderr, "\n\t\t them to the max and min, respectively."); + + fprintf(stderr, "\n\n\t -p[alfile] :"); + fprintf(stderr, "\n\t\t Store the palette with the image. Get the palette from"); + fprintf(stderr, "\n\t\t \"palfile\"; which may be an HDF file containing a palette,"); + fprintf(stderr, "\n\t\t or a file containing a raw palette."); + + fprintf(stderr, "\n\n\t -m[ean] :"); + fprintf(stderr, "\n\t\t If a floating point mean value is given, the image will be"); + fprintf(stderr, "\n\t\t scaled about the mean. The new extremes (newmax and newmin),"); + fprintf(stderr, "\n\t\t as given by:"); + + fprintf(stderr, "\n\n\t\t\t newmax = mean + max(abs(max-mean), abs(mean-min))"); + fprintf(stderr, "\n\t\t\t newmin = mean - max(abs(max-mean), abs(mean-min))"); + + fprintf(stderr, "\n\n\t\t will be equidistant from the mean value. If no mean value"); + fprintf(stderr, "\n\t\t is given, then the mean will be: 0.5 (max + min)"); + + fprintf(stderr, "\n\n\t Notes:"); + fprintf( stderr, "\n\t\t If the input file format is ASCII text or native floating point or native integer(32-bit,"); - (void)fprintf(stderr, "\n\t\t 16-bit, 8-bit), it"); - (void)fprintf(stderr, "\n\t\t must have the following input fields:"); - - (void)fprintf(stderr, "\n\t\t format"); - (void)fprintf(stderr, "\n\t\t nplanes"); - (void)fprintf(stderr, "\n\t\t nrows"); - (void)fprintf(stderr, "\n\t\t cols"); - (void)fprintf(stderr, "\n\t\t max_value"); - (void)fprintf(stderr, "\n\t\t min_value"); - (void)fprintf(stderr, "\n\t\t [plane1 plane2 plane3 ...]"); - (void)fprintf(stderr, "\n\t\t row1 row2 row3 ..."); - (void)fprintf(stderr, "\n\t\t col1 col2 col3 ..."); - (void)fprintf(stderr, "\n\t\t data1 data2 data3 ..."); - - (void)fprintf(stderr, "\n\n\t\t Where:"); - (void)fprintf(stderr, "\n\n\t\t format:"); - (void)fprintf(stderr, - "\n\t\t\t Format designator (\"TEXT\", \"FP32\", \"FP64\", \"IN32\", \"IN16\", \"IN08\")."); - (void)fprintf(stderr, "\n\t\t\t nplanes, nrows, ncols:"); - (void)fprintf(stderr, "\n\t\t\t Dimensions are specified in the order slowest changing dimension first."); - (void)fprintf(stderr, "\n\t\t\t ncols is dimension of the fastest changing dimension. (horizontal axis"); - (void)fprintf(stderr, "\n\t\t\t or X-axis in a 3D scale)"); - (void)fprintf(stderr, "\n\t\t\t nrows corresponds to dimension of the vertical axis or Y-axis in a 3D "); - (void)fprintf(stderr, "\n\t\t\t scale."); - (void)fprintf(stderr, - "\n\t\t\t nplanes corresponds to the slowest changing dimension i.e. dimension of "); - (void)fprintf(stderr, "\n\t\t\t the depth axis or the Z-axis in a 3D scale (\"1\" for 2D input)."); - (void)fprintf(stderr, "\n\t\t max_value:"); - (void)fprintf(stderr, "\n\t\t\t Maximum data value."); - (void)fprintf(stderr, "\n\t\t min_value:"); - (void)fprintf(stderr, "\n\t\t\t Minimum data value."); - (void)fprintf(stderr, "\n\t\t plane1, plane2, plane3, ...:"); - (void)fprintf(stderr, "\n\t\t\t Scales for depth axis."); - (void)fprintf(stderr, "\n\t\t row1, row2, row3, ...:"); - (void)fprintf(stderr, "\n\t\t\t Scales for the vertical axis."); - (void)fprintf(stderr, "\n\t\t col1, col2, col3, ...:"); - (void)fprintf(stderr, "\n\t\t\t Scales for the horizontal axis."); - (void)fprintf(stderr, "\n\t\t data1, data2, data3, ...:"); - (void)fprintf(stderr, "\n\t\t\t The data ordered by rows, left to right and top"); - (void)fprintf(stderr, "\n\t\t\t to bottom; then optionally, ordered by planes,"); - (void)fprintf(stderr, "\n\t\t\t front to back."); - - (void)fprintf(stderr, - "\n\n\t\t For FP32 and FP64 input format, \"format\", \"nplanes\", \"nrows\", \"ncols\","); - (void)fprintf(stderr, "\n\t\t and \"nplanes\" are native integers; where \"format\" is the integer"); - (void)fprintf(stderr, "\n\t\t representation of the appropriate 4-character string (0x46503332 for"); - (void)fprintf(stderr, "\n\t\t \"FP32\" and 0x46503634 for \"FP64\"). The remaining input fields are"); - (void)fprintf(stderr, "\n\t\t composed of native 32-bit floating point values for FP32 input format,"); - (void)fprintf(stderr, "\n\t\t or native 64-bit floating point values for FP64 input format."); - - (void)fprintf( - stderr, - "\n\n\t For IN32, IN16 and IN08 input format, \"format\", \"nplanes\", \"nrows\", \"ncols\","); - (void)fprintf(stderr, "\n\t\t and \"nplanes\" are native integers; where \"format\" is the integer"); - (void)fprintf(stderr, - "\n\t\t representation of the appropriate 4-character string. The remaining input "); - (void)fprintf(stderr, - "\n\t\t fields are composed of native 32-bit integer values for IN32 input format,"); - (void)fprintf(stderr, "\n\t\t or native 16-bit integer values for IN16 input format or native 8-bit "); - (void)fprintf(stderr, "\n\t\t integer values for IN08 input format."); - - (void)printf("\nExamples:\n"); - (void)printf("\tConvert floating point data in \"f1.txt\" to SDS "); - (void)printf("format, and store it\n"); - (void)printf("\tas an SDS in HDF file \"o1\":\n\n"); - (void)printf("\t\t%s f1.txt -o o1\n\n", name); - (void)printf("\tConvert floating point data in \"f2.hdf\" to "); - (void)printf("8-bit raster format, and\n"); - (void)printf("\tstore it as an RIS8 in HDF file \"o2\":\n\n"); - (void)printf("\t\t%s f2.hdf -o o2 -r\n\n", name); - (void)printf("\tConvert floating point data in \"f3.bin\" to "); - (void)printf("8-bit raster format and\n"); - (void)printf("\tSDS format, and store both the RIS8 and the SDS "); - (void)printf("in HDF file \"o3\":\n\n"); - (void)printf("\t\t%s f3.bin -o o3 -r -f\n\n", name); - (void)printf("\tConvert floating point data in \"f4\" to a "); - (void)printf("500x600 raster image, and\n"); - (void)printf("\tstore the RIS8 in HDF file \"o4\". Also store a "); - (void)printf("palette from \"palfile\"\n"); - (void)printf("\twith the image:\n\n"); - (void)printf("\t\t%s f4 -o o4 -r -e 500 600 -p palfile\n\n", name); - (void)printf("\tConvert floating point data in \"f5\" to 200 "); - (void)printf("planes of 500x600 raster\n"); - (void)printf("\timages, and store the RIS8 in HDF file \"o5\". "); - (void)printf("Also scale the image\n"); - (void)printf("\tdata so that it is centered about a mean value "); - (void)printf("of 10.0:\n\n"); - (void)printf("\t\t%s f5 -o o5 -r -i 500 600 200 -m 10.0\n", name); + fprintf(stderr, "\n\t\t 16-bit, 8-bit), it"); + fprintf(stderr, "\n\t\t must have the following input fields:"); + + fprintf(stderr, "\n\t\t format"); + fprintf(stderr, "\n\t\t nplanes"); + fprintf(stderr, "\n\t\t nrows"); + fprintf(stderr, "\n\t\t cols"); + fprintf(stderr, "\n\t\t max_value"); + fprintf(stderr, "\n\t\t min_value"); + fprintf(stderr, "\n\t\t [plane1 plane2 plane3 ...]"); + fprintf(stderr, "\n\t\t row1 row2 row3 ..."); + fprintf(stderr, "\n\t\t col1 col2 col3 ..."); + fprintf(stderr, "\n\t\t data1 data2 data3 ..."); + + fprintf(stderr, "\n\n\t\t Where:"); + fprintf(stderr, "\n\n\t\t format:"); + fprintf(stderr, + "\n\t\t\t Format designator (\"TEXT\", \"FP32\", \"FP64\", \"IN32\", \"IN16\", \"IN08\")."); + fprintf(stderr, "\n\t\t\t nplanes, nrows, ncols:"); + fprintf(stderr, "\n\t\t\t Dimensions are specified in the order slowest changing dimension first."); + fprintf(stderr, "\n\t\t\t ncols is dimension of the fastest changing dimension. (horizontal axis"); + fprintf(stderr, "\n\t\t\t or X-axis in a 3D scale)"); + fprintf(stderr, "\n\t\t\t nrows corresponds to dimension of the vertical axis or Y-axis in a 3D "); + fprintf(stderr, "\n\t\t\t scale."); + fprintf(stderr, "\n\t\t\t nplanes corresponds to the slowest changing dimension i.e. dimension of "); + fprintf(stderr, "\n\t\t\t the depth axis or the Z-axis in a 3D scale (\"1\" for 2D input)."); + fprintf(stderr, "\n\t\t max_value:"); + fprintf(stderr, "\n\t\t\t Maximum data value."); + fprintf(stderr, "\n\t\t min_value:"); + fprintf(stderr, "\n\t\t\t Minimum data value."); + fprintf(stderr, "\n\t\t plane1, plane2, plane3, ...:"); + fprintf(stderr, "\n\t\t\t Scales for depth axis."); + fprintf(stderr, "\n\t\t row1, row2, row3, ...:"); + fprintf(stderr, "\n\t\t\t Scales for the vertical axis."); + fprintf(stderr, "\n\t\t col1, col2, col3, ...:"); + fprintf(stderr, "\n\t\t\t Scales for the horizontal axis."); + fprintf(stderr, "\n\t\t data1, data2, data3, ...:"); + fprintf(stderr, "\n\t\t\t The data ordered by rows, left to right and top"); + fprintf(stderr, "\n\t\t\t to bottom; then optionally, ordered by planes,"); + fprintf(stderr, "\n\t\t\t front to back."); + + fprintf(stderr, + "\n\n\t\t For FP32 and FP64 input format, \"format\", \"nplanes\", \"nrows\", \"ncols\","); + fprintf(stderr, "\n\t\t and \"nplanes\" are native integers; where \"format\" is the integer"); + fprintf(stderr, "\n\t\t representation of the appropriate 4-character string (0x46503332 for"); + fprintf(stderr, "\n\t\t \"FP32\" and 0x46503634 for \"FP64\"). The remaining input fields are"); + fprintf(stderr, "\n\t\t composed of native 32-bit floating point values for FP32 input format,"); + fprintf(stderr, "\n\t\t or native 64-bit floating point values for FP64 input format."); + + fprintf(stderr, + "\n\n\t For IN32, IN16 and IN08 input format, \"format\", \"nplanes\", \"nrows\", \"ncols\","); + fprintf(stderr, "\n\t\t and \"nplanes\" are native integers; where \"format\" is the integer"); + fprintf(stderr, "\n\t\t representation of the appropriate 4-character string. The remaining input "); + fprintf(stderr, "\n\t\t fields are composed of native 32-bit integer values for IN32 input format,"); + fprintf(stderr, "\n\t\t or native 16-bit integer values for IN16 input format or native 8-bit "); + fprintf(stderr, "\n\t\t integer values for IN08 input format."); + + printf("\nExamples:\n"); + printf("\tConvert floating point data in \"f1.txt\" to SDS "); + printf("format, and store it\n"); + printf("\tas an SDS in HDF file \"o1\":\n\n"); + printf("\t\t%s f1.txt -o o1\n\n", name); + printf("\tConvert floating point data in \"f2.hdf\" to "); + printf("8-bit raster format, and\n"); + printf("\tstore it as an RIS8 in HDF file \"o2\":\n\n"); + printf("\t\t%s f2.hdf -o o2 -r\n\n", name); + printf("\tConvert floating point data in \"f3.bin\" to "); + printf("8-bit raster format and\n"); + printf("\tSDS format, and store both the RIS8 and the SDS "); + printf("in HDF file \"o3\":\n\n"); + printf("\t\t%s f3.bin -o o3 -r -f\n\n", name); + printf("\tConvert floating point data in \"f4\" to a "); + printf("500x600 raster image, and\n"); + printf("\tstore the RIS8 in HDF file \"o4\". Also store a "); + printf("palette from \"palfile\"\n"); + printf("\twith the image:\n\n"); + printf("\t\t%s f4 -o o4 -r -e 500 600 -p palfile\n\n", name); + printf("\tConvert floating point data in \"f5\" to 200 "); + printf("planes of 500x600 raster\n"); + printf("\timages, and store the RIS8 in HDF file \"o5\". "); + printf("Also scale the image\n"); + printf("\tdata so that it is centered about a mean value "); + printf("of 10.0:\n\n"); + printf("\t\t%s f5 -o o5 -r -i 500 600 200 -m 10.0\n", name); return; } @@ -1988,7 +1990,7 @@ indexes(float32 *scale, int dim, int *idx, int res) * determine the midpoints between scale values */ if ((midpt = (float32 *)malloc((size_t)dim * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } for (i = 0; i < dim - 1; i++) @@ -2087,16 +2089,16 @@ interp(struct Input *in, struct Raster *im) * allocate dynamic memory for the interpolation ratio buffers */ if ((hratio = (float32 *)malloc((size_t)im->hres * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if ((vratio = (float32 *)malloc((unsigned int)im->vres * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if (in->rank == 3) { if ((dratio = (float32 *)malloc((unsigned int)im->dres * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } } @@ -2106,16 +2108,16 @@ interp(struct Input *in, struct Raster *im) * buffers */ if ((hinc = (int *)malloc((unsigned int)im->hres * sizeof(int))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if ((voff = (int *)malloc((unsigned int)(im->vres + 1) * sizeof(int))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if (in->rank == 3) { if ((doff = (int *)malloc((unsigned int)(im->dres + 1) * sizeof(int))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } } @@ -2314,7 +2316,7 @@ palette(char *palfile) */ if (Hishdf(palfile)) { if (DFPgetpal(palfile, pal)) { - (void)fprintf(stderr, err1, palfile); + fprintf(stderr, err1, palfile); goto err; } @@ -2324,19 +2326,19 @@ palette(char *palfile) } else { if ((strm = fopen(palfile, "r")) == NULL) { - (void)fprintf(stderr, err2, palfile); + fprintf(stderr, err2, palfile); goto err; } if (fread((char *)red, 1, 256, strm) != 256) { - (void)fprintf(stderr, err1, palfile); + fprintf(stderr, err1, palfile); goto err; } else if (fread((char *)green, 1, 256, strm) != 256) { - (void)fprintf(stderr, err1, palfile); + fprintf(stderr, err1, palfile); goto err; } else if (fread((char *)blue, 1, 256, strm) != 256) { - (void)fprintf(stderr, err1, palfile); + fprintf(stderr, err1, palfile); goto err; } (void)fclose(strm); @@ -2356,7 +2358,7 @@ palette(char *palfile) * set up the palette as the default for subsequent images */ if (DFR8setpalette(pal)) { - (void)fprintf(stderr, "%s", err3); + fprintf(stderr, "%s", err3); goto err; } @@ -2396,7 +2398,7 @@ pixrep(struct Input *in, struct Raster *im) * determine the scale indexes of the horizontal pixel locations */ if ((hidx = (int *)malloc((unsigned int)(im->hres + 1) * sizeof(int))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } @@ -2407,7 +2409,7 @@ pixrep(struct Input *in, struct Raster *im) * determine the scale indexes of the vertical pixel locations */ if ((vidx = (int *)malloc((unsigned int)(im->vres + 1) * sizeof(int))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } @@ -2421,7 +2423,7 @@ pixrep(struct Input *in, struct Raster *im) didx = &dummy; if (in->rank == 3) { if ((didx = (int *)malloc((unsigned int)(im->dres + 1) * sizeof(int))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } @@ -2433,7 +2435,7 @@ pixrep(struct Input *in, struct Raster *im) * compute the expanded image */ if ((pix = (unsigned char *)malloc((unsigned int)(in->dims[0] + 1))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } for (k = 0, odidx = didx[0] - 1; k < im->dres; k++) { @@ -2540,31 +2542,31 @@ alloc_data(void **data, int32 len, int outtype) case 0: /* 32-bit float */ case 5: /* NO_NE */ if ((*data = (void *)malloc((size_t)len * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", alloc_err); + fprintf(stderr, "%s", alloc_err); return FAIL; } break; case 1: /* 64-bit float */ if ((*data = (void *)malloc((size_t)len * sizeof(float64))) == NULL) { - (void)fprintf(stderr, "%s", alloc_err); + fprintf(stderr, "%s", alloc_err); return FAIL; } break; case 2: /* 32-bit integer */ if ((*data = (void *)malloc((size_t)len * sizeof(int32))) == NULL) { - (void)fprintf(stderr, "%s", alloc_err); + fprintf(stderr, "%s", alloc_err); return FAIL; } break; case 3: /* 16-bit integer */ if ((*data = (void *)malloc((size_t)len * sizeof(int16))) == NULL) { - (void)fprintf(stderr, "%s", alloc_err); + fprintf(stderr, "%s", alloc_err); return FAIL; } break; case 4: /* 8-bit integer */ if ((*data = (void *)malloc((size_t)len * sizeof(int8))) == NULL) { - (void)fprintf(stderr, "%s", alloc_err); + fprintf(stderr, "%s", alloc_err); return FAIL; } break; @@ -2593,7 +2595,7 @@ write_SDS(int32 sds_id, struct Input *in) start[0] = 0; start[1] = 0; if (SDwritedata(sds_id, start, NULL, edges, (void *)in->data) != 0) { - (void)fprintf(stderr, "%s", write_err); + fprintf(stderr, "%s", write_err); return FAIL; } } @@ -2606,7 +2608,7 @@ write_SDS(int32 sds_id, struct Input *in) start[1] = 0; start[2] = 0; if (SDwritedata(sds_id, start, NULL, edges, (void *)in->data) != 0) { - (void)fprintf(stderr, "%s", write_err); + fprintf(stderr, "%s", write_err); return FAIL; } } @@ -2639,7 +2641,7 @@ set_dimensions(int32 sds_id, struct Input *in, int32 nt, void *dscale, void *vsc dim_id = SDgetdimid(sds_id, dim_index); if (SDsetdimscale(dim_id, edges[0], nt, (void *)vscale) == FAIL) { - (void)fprintf(stderr, "%s, dim index %d\n", dim_err, dim_index); + fprintf(stderr, "%s, dim index %d\n", dim_err, dim_index); return FAIL; } @@ -2647,7 +2649,7 @@ set_dimensions(int32 sds_id, struct Input *in, int32 nt, void *dscale, void *vsc dim_id = SDgetdimid(sds_id, dim_index); if (SDsetdimscale(dim_id, edges[1], nt, hscale) != 0) { - (void)fprintf(stderr, "%s, dim index %d\n", dim_err, dim_index); + fprintf(stderr, "%s, dim index %d\n", dim_err, dim_index); return FAIL; } } @@ -2661,21 +2663,21 @@ set_dimensions(int32 sds_id, struct Input *in, int32 nt, void *dscale, void *vsc dim_id = SDgetdimid(sds_id, dim_index); if (SDsetdimscale(dim_id, edges[0], nt, dscale) != 0) { - (void)fprintf(stderr, "%s, dim index %d\n", dim_err, dim_index); + fprintf(stderr, "%s, dim index %d\n", dim_err, dim_index); return FAIL; } dim_index = 1; dim_id = SDgetdimid(sds_id, dim_index); if (SDsetdimscale(dim_id, edges[1], nt, vscale) != 0) { - (void)fprintf(stderr, "%s, dim index %d\n", dim_err, dim_index); + fprintf(stderr, "%s, dim index %d\n", dim_err, dim_index); return FAIL; } dim_index = 2; dim_id = SDgetdimid(sds_id, dim_index); if (SDsetdimscale(dim_id, edges[2], nt, hscale) != 0) { - (void)fprintf(stderr, "%s, dim index %d\n", dim_err, dim_index); + fprintf(stderr, "%s, dim index %d\n", dim_err, dim_index); return FAIL; } } @@ -2743,14 +2745,14 @@ process(struct Options *opt) * create the HDF output file */ if ((hdf = Hopen(opt->outfile, DFACC_CREATE, 0)) == FAIL) { - (void)fprintf(stderr, err1, opt->outfile); + fprintf(stderr, err1, opt->outfile); goto err; } (void)Hclose(hdf); /* new interface */ if ((sd_id = SDstart(opt->outfile, DFACC_WRITE)) == FAIL) { - (void)fprintf(stderr, err1a, opt->outfile); + fprintf(stderr, err1a, opt->outfile); goto err; } @@ -2774,7 +2776,7 @@ process(struct Options *opt) in.is_hdf = TRUE; opt->infiles[i].handle = SDstart(opt->infiles[i].filename, DFACC_RDONLY); if (opt->infiles[i].handle == FAIL) { - (void)fprintf(stderr, err1a, opt->infiles[i].filename); + fprintf(stderr, err1a, opt->infiles[i].filename); goto err; } } @@ -2834,7 +2836,7 @@ process(struct Options *opt) if (is_scale == TRUE) { /* set range */ if (SDsetrange(sds_id, &in.max, &in.min) != 0) { - (void)fprintf(stderr, "%s", err5a); + fprintf(stderr, "%s", err5a); goto err; } @@ -2860,7 +2862,7 @@ process(struct Options *opt) if (is_scale == TRUE) { /* set range */ if (SDsetrange(sds_id, &in.fp64s.max, &in.fp64s.min) != 0) { - (void)fprintf(stderr, "%s", err5a); + fprintf(stderr, "%s", err5a); goto err; } @@ -2886,7 +2888,7 @@ process(struct Options *opt) if (is_scale == TRUE) { /* set range */ if (SDsetrange(sds_id, &in.in32s.max, &in.in32s.min) != 0) { - (void)fprintf(stderr, "%s", err5a); + fprintf(stderr, "%s", err5a); goto err; } @@ -2911,7 +2913,7 @@ process(struct Options *opt) if (is_scale == TRUE) { /* set range */ if (SDsetrange(sds_id, &in.in16s.max, &in.in16s.min) != 0) { - (void)fprintf(stderr, "%s", err5a); + fprintf(stderr, "%s", err5a); goto err; } @@ -2936,7 +2938,7 @@ process(struct Options *opt) if (is_scale == TRUE) { /* set range */ if (SDsetrange(sds_id, &in.in8s.max, &in.in8s.min) != 0) { - (void)fprintf(stderr, "%s", err5a); + fprintf(stderr, "%s", err5a); goto err; } @@ -2954,14 +2956,14 @@ process(struct Options *opt) } /* close data set */ if (SDendaccess(sds_id) == FAIL) { - (void)fprintf(stderr, "%s", err6a); + fprintf(stderr, "%s", err6a); goto err; } /* close the input file */ if (in.is_hdf == TRUE) { if (SDend(opt->infiles[i].handle) == FAIL) { - (void)fprintf(stderr, "SDend failed"); + fprintf(stderr, "SDend failed"); goto err; } } @@ -2976,19 +2978,19 @@ process(struct Options *opt) */ im.hres = (opt->hres == 0) ? in.dims[0] : opt->hres; if ((im.hres < in.dims[0]) && (opt->ctm == EXPAND)) { - (void)fprintf(stderr, "%s", err3a); - (void)fprintf(stderr, err3b, "Horiz."); - (void)fprintf(stderr, err3c, "horiz."); - (void)fprintf(stderr, err3d, in.dims[0]); + fprintf(stderr, "%s", err3a); + fprintf(stderr, err3b, "Horiz."); + fprintf(stderr, err3c, "horiz."); + fprintf(stderr, err3d, in.dims[0]); im.hres = in.dims[0]; opt->hres = in.dims[0]; } im.vres = (opt->vres == 0) ? in.dims[1] : opt->vres; if ((im.vres < in.dims[1]) && (opt->ctm == EXPAND)) { - (void)fprintf(stderr, "%s", err3a); - (void)fprintf(stderr, err3b, "Vert."); - (void)fprintf(stderr, err3c, "vert."); - (void)fprintf(stderr, err3d, in.dims[1]); + fprintf(stderr, "%s", err3a); + fprintf(stderr, err3b, "Vert."); + fprintf(stderr, err3c, "vert."); + fprintf(stderr, err3d, in.dims[1]); im.vres = in.dims[1]; opt->vres = in.dims[1]; } @@ -2996,17 +2998,17 @@ process(struct Options *opt) if (in.rank == 3) { im.dres = (opt->dres == 0) ? in.dims[2] : opt->dres; if ((im.dres < in.dims[2]) && (opt->ctm == EXPAND)) { - (void)fprintf(stderr, "%s", err3a); - (void)fprintf(stderr, err3b, "Depth"); - (void)fprintf(stderr, err3c, "depth"); - (void)fprintf(stderr, err3d, in.dims[2]); + fprintf(stderr, "%s", err3a); + fprintf(stderr, err3b, "Depth"); + fprintf(stderr, err3c, "depth"); + fprintf(stderr, err3d, in.dims[2]); im.dres = in.dims[2]; opt->dres = in.dims[2]; } } len = im.hres * im.vres * im.dres; if ((im.image = (unsigned char *)malloc((unsigned int)len)) == NULL) { - (void)fprintf(stderr, "%s", err2); + fprintf(stderr, "%s", err2); goto err; } @@ -3031,32 +3033,32 @@ process(struct Options *opt) len = im.hres * im.vres; for (j = 0, ip = im.image; j < im.dres; j++, ip += len) { if (DFR8addimage(opt->outfile, ip, im.hres, im.vres, DFTAG_RLE)) { - (void)fprintf(stderr, "%s", err4); + fprintf(stderr, "%s", err4); goto err; } } #ifdef DEBUG - (void)printf("Output Raster Information ...\n\n"); - (void)printf("\tresolution (horiz,vert,[depth]):\n\n"); + printf("Output Raster Information ...\n\n"); + printf("\tresolution (horiz,vert,[depth]):\n\n"); if (in.rank == 2) - (void)printf("\t%d %d\n\n", im.hres, im.vres); + printf("\t%d %d\n\n", im.hres, im.vres); else - (void)printf("\t%d %d %d\n\n", im.hres, im.vres, im.dres); + printf("\t%d %d %d\n\n", im.hres, im.vres, im.dres); if (opt->mean == TRUE) { - (void)printf("\tadjusted max/min values:\n\n"); - (void)printf("\t%f %f\n\n", in.max, in.min); + printf("\tadjusted max/min values:\n\n"); + printf("\t%f %f\n\n", in.max, in.min); } - (void)printf("\tcolor index values:"); + printf("\tcolor index values:"); for (d = 0, ip = im.image; d < im.dres; d++) { - (void)printf("\n"); + printf("\n"); for (v = 0; v < im.vres; v++) { - (void)printf("\n"); + printf("\n"); for (h = 0; h < im.hres; h++, ip++) - (void)printf("\t%d", *ip); + printf("\t%d", *ip); } } - (void)printf("\n"); + printf("\n"); #endif /* DEBUG */ } /* @@ -3067,7 +3069,7 @@ process(struct Options *opt) /* close the output file */ if (SDend(sd_id) != 0) { - (void)fprintf(stderr, "%s", err6); + fprintf(stderr, "%s", err6); goto err; } @@ -3152,16 +3154,16 @@ init_scales(struct Input *in) case 0: /* 32-bit float */ case 5: /* NO_NE */ if ((in->hscale = (float32 *)malloc((size_t)(in->dims[0] + 1) * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if ((in->vscale = (float32 *)malloc((size_t)(in->dims[1] + 1) * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if (in->rank == 3) { if ((in->dscale = (float32 *)malloc((size_t)(in->dims[2] + 1) * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } } @@ -3170,33 +3172,33 @@ init_scales(struct Input *in) case 1: /* 64-bit float */ if ((in->fp64s.hscale = (float64 *)malloc((size_t)(in->dims[0] + 1) * sizeof(float64))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if ((in->fp64s.vscale = (float64 *)malloc((size_t)(in->dims[1] + 1) * sizeof(float64))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if (in->rank == 3) { if ((in->fp64s.dscale = (float64 *)malloc((size_t)(in->dims[2] + 1) * sizeof(float64))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } } break; case 2: /* 32-bit integer */ if ((in->in32s.hscale = (int32 *)malloc((size_t)(in->dims[0] + 1) * sizeof(int32))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if ((in->in32s.vscale = (int32 *)malloc((size_t)(in->dims[1] + 1) * sizeof(int32))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if (in->rank == 3) { if ((in->in32s.dscale = (int32 *)malloc((size_t)(in->dims[2] + 1) * sizeof(int32))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } } @@ -3204,16 +3206,16 @@ init_scales(struct Input *in) case 3: /* 16-bit integer */ if ((in->in16s.hscale = (int16 *)malloc((size_t)(in->dims[0] + 1) * sizeof(int16))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if ((in->in16s.vscale = (int16 *)malloc((size_t)(in->dims[1] + 1) * sizeof(int16))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if (in->rank == 3) { if ((in->in16s.dscale = (int16 *)malloc((size_t)(in->dims[2] + 1) * sizeof(int16))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } } @@ -3221,16 +3223,16 @@ init_scales(struct Input *in) case 4: /* 8-bit integer */ if ((in->in8s.hscale = (int8 *)malloc((size_t)(in->dims[0] + 1) * sizeof(int8))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if ((in->in8s.vscale = (int8 *)malloc((size_t)(in->dims[1] + 1) * sizeof(int8))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if (in->rank == 3) { if ((in->in8s.dscale = (int8 *)malloc((size_t)(in->dims[2] + 1) * sizeof(int8))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } } @@ -3251,41 +3253,41 @@ init_scales(struct Input *in) void usage(char *name) { - (void)fprintf(stderr, "\nUsage:\t%s -h[elp], OR\n", name); - (void)fprintf(stderr, "\t%s -V, OR\n", name); - (void)fprintf(stderr, "\t%s [ [-t[ype] | -n] ", name); - (void)fprintf(stderr, "[ [-t[ype] | -n ]]...]\n"); - (void)fprintf(stderr, "\t\t\t\t\t-o[utfile] [options..]\n"); - (void)fprintf(stderr, "\n\t-t[ype] "); - - (void)fprintf(stderr, "\n\t\tOptionally used for every input ASCII file to specify the"); - (void)fprintf(stderr, "\n\t\tdata type of the data-set to be written. If not specified"); - (void)fprintf(stderr, "\n\t\tdefault data type is 32-bit floating point. "); - (void)fprintf(stderr, "\n\t\tcan be any of the following: FP32 (default), FP64, INT32"); - (void)fprintf(stderr, "\n\t\tINT16, INT8. It can be used only with ASCII files."); - - (void)fprintf(stderr, "\n\t-n"); - (void)fprintf(stderr, "\n\t\tThis option is to be used only if the binary input file "); - (void)fprintf(stderr, "\n\t\tcontains 64-bit floating point data and the default"); - (void)fprintf(stderr, "\n\t\tbehaviour (default behaviour is to write it to a 32-bit"); - (void)fprintf(stderr, "\n\t\tfloating point data-set) should be overridden to write "); - (void)fprintf(stderr, "\n\t\tit to a 64-bit floating point data-set."); - (void)fprintf(stderr, "\n\n\toptions...\n"); - (void)fprintf(stderr, "\n\t-r[aster]:\n"); - (void)fprintf(stderr, "\t\tproduce an image. Could be "); - (void)fprintf(stderr, "followed by:\n"); - (void)fprintf(stderr, "\t\t-e[xpand] "); - (void)fprintf(stderr, "[]:\n"); - (void)fprintf(stderr, "\t\t\t resolution with pixel "); - (void)fprintf(stderr, "replication\n"); - (void)fprintf(stderr, "\t\t-i[nterp] "); - (void)fprintf(stderr, "[]:\n"); - (void)fprintf(stderr, "\t\t\tresolution with interpolation\n"); - (void)fprintf(stderr, "\t\t-p[alfile] :\n"); - (void)fprintf(stderr, "\t\t\tinclude palette from palfile\n"); - (void)fprintf(stderr, "\t\t-m[ean] :\n"); - (void)fprintf(stderr, "\t\t\tmean value to scale image "); - (void)fprintf(stderr, "around\n"); - (void)fprintf(stderr, "\t-f[loat]:\n"); - (void)fprintf(stderr, "\t\tproduce floating point data\n\n"); + fprintf(stderr, "\nUsage:\t%s -h[elp], OR\n", name); + fprintf(stderr, "\t%s -V, OR\n", name); + fprintf(stderr, "\t%s [ [-t[ype] | -n] ", name); + fprintf(stderr, "[ [-t[ype] | -n ]]...]\n"); + fprintf(stderr, "\t\t\t\t\t-o[utfile] [options..]\n"); + fprintf(stderr, "\n\t-t[ype] "); + + fprintf(stderr, "\n\t\tOptionally used for every input ASCII file to specify the"); + fprintf(stderr, "\n\t\tdata type of the data-set to be written. If not specified"); + fprintf(stderr, "\n\t\tdefault data type is 32-bit floating point. "); + fprintf(stderr, "\n\t\tcan be any of the following: FP32 (default), FP64, INT32"); + fprintf(stderr, "\n\t\tINT16, INT8. It can be used only with ASCII files."); + + fprintf(stderr, "\n\t-n"); + fprintf(stderr, "\n\t\tThis option is to be used only if the binary input file "); + fprintf(stderr, "\n\t\tcontains 64-bit floating point data and the default"); + fprintf(stderr, "\n\t\tbehaviour (default behaviour is to write it to a 32-bit"); + fprintf(stderr, "\n\t\tfloating point data-set) should be overridden to write "); + fprintf(stderr, "\n\t\tit to a 64-bit floating point data-set."); + fprintf(stderr, "\n\n\toptions...\n"); + fprintf(stderr, "\n\t-r[aster]:\n"); + fprintf(stderr, "\t\tproduce an image. Could be "); + fprintf(stderr, "followed by:\n"); + fprintf(stderr, "\t\t-e[xpand] "); + fprintf(stderr, "[]:\n"); + fprintf(stderr, "\t\t\t resolution with pixel "); + fprintf(stderr, "replication\n"); + fprintf(stderr, "\t\t-i[nterp] "); + fprintf(stderr, "[]:\n"); + fprintf(stderr, "\t\t\tresolution with interpolation\n"); + fprintf(stderr, "\t\t-p[alfile] :\n"); + fprintf(stderr, "\t\t\tinclude palette from palfile\n"); + fprintf(stderr, "\t\t-m[ean] :\n"); + fprintf(stderr, "\t\t\tmean value to scale image "); + fprintf(stderr, "around\n"); + fprintf(stderr, "\t-f[loat]:\n"); + fprintf(stderr, "\t\tproduce floating point data\n\n"); } diff --git a/mfhdf/nctest/add.c b/mfhdf/nctest/add.c index c98ee68ab9..42993d033c 100644 --- a/mfhdf/nctest/add.c +++ b/mfhdf/nctest/add.c @@ -22,11 +22,6 @@ #include "add.h" #include "emalloc.h" -struct netcdf test; /* - * in-memory netcdf structure, kept in sync - * with disk netcdf - */ - /* add the dimension idim to the netcdf test */ void add_dim(struct netcdf *test, struct cdfdim *idim) diff --git a/mfhdf/nctest/atttests.c b/mfhdf/nctest/atttests.c index 013e71715f..497fa1a705 100644 --- a/mfhdf/nctest/atttests.c +++ b/mfhdf/nctest/atttests.c @@ -100,7 +100,7 @@ test_ncattput(char *path) ncclose(cdfid); return; } - add_att(&test, NC_GLOBAL, &atts[ia]); /* keep in-memory netcdf updated */ + add_att(test_g, NC_GLOBAL, &atts[ia]); /* keep in-memory netcdf updated */ } /* make sure count of global attributes has been updated */ if (ncinquire(cdfid, &ndims, &nvars, &ngatts, &xdimid) == -1) { @@ -146,14 +146,14 @@ test_ncattput(char *path) ncclose(cdfid); return; } - add_var(&test, &ww); /* keep in-memory netcdf in sync */ + add_var(test_g, &ww); /* keep in-memory netcdf in sync */ for (ia = 0; ia < na; ia++) { if (ncattput(cdfid, ww_id, atts[ia].name, atts[ia].type, atts[ia].len, atts[ia].val) == -1) { error("%s: ncattput of variable attribute failed", pname); ncclose(cdfid); return; } - add_att(&test, ww_id, &atts[ia]); /* keep in-memory netcdf updated */ + add_att(test_g, ww_id, &atts[ia]); /* keep in-memory netcdf updated */ } /* check with ncattinq and ncattget that variable attributes put OK */ for (ia = 0; ia < na; ia++) { @@ -197,7 +197,7 @@ test_ncattput(char *path) tmp.type = atts[ia].type; tmp.len = atts[ia].len; tmp.val = atts[ia].val; - add_att(&test, ww_id, &tmp); /* keep in-memory netcdf updated */ + add_att(test_g, ww_id, &tmp); /* keep in-memory netcdf updated */ } /* check with ncattinq and ncattget that variable attributes put OK */ for (ia = 1; ia < na; ia++) { @@ -271,7 +271,7 @@ test_ncattput(char *path) tmp.type = atts[ia].type; tmp.len = atts[ia].len; tmp.val = atts[ia].val; - add_att(&test, ww_id, &tmp); /* keep in-memory netcdf updated */ + add_att(test_g, ww_id, &tmp); /* keep in-memory netcdf updated */ } /* check with ncattinq and ncattget that variable attributes put OK */ for (ia = 0; ia < na - 1; ia++) { @@ -299,7 +299,7 @@ test_ncattput(char *path) free(tmp.val); } /* try with bad variable handle, should fail */ - if (ncattput(cdfid, test.nvars, atts[0].name, atts[0].type, atts[0].len, atts[0].val) != -1) { + if (ncattput(cdfid, test_g->nvars, atts[0].name, atts[0].type, atts[0].len, atts[0].val) != -1) { error("%s: ncattput should fail with bad variable handle", pname); ncclose(cdfid); return; @@ -349,18 +349,18 @@ test_ncattinq(char *path) return; } /* in data mode, check all attributes against test netcdf */ - for (ia = 0; ia < test.natts; ia++) { - if (ncattinq(cdfid, test.atts[ia].var, test.atts[ia].name, &type, &len) == -1) { + for (ia = 0; ia < test_g->natts; ia++) { + if (ncattinq(cdfid, test_g->atts[ia].var, test_g->atts[ia].name, &type, &len) == -1) { error("%s: ncattinq failed", pname); ncclose(cdfid); return; } - if (type != test.atts[ia].type) { + if (type != test_g->atts[ia].type) { error("%s: ncattinq returned wrong type", pname); ncclose(cdfid); return; } - if (len != test.atts[ia].len) { + if (len != test_g->atts[ia].len) { error("%s: ncattinq returned wrong len", pname); ncclose(cdfid); return; @@ -376,13 +376,13 @@ test_ncattinq(char *path) /* in define mode, add a variable */ vv.dims = (int *)emalloc(sizeof(int) * vv.ndims); for (id = 0; id < vv.ndims; id++) - vv.dims[id] = id; /* assumes vv.ndims <= test.ndims */ + vv.dims[id] = id; /* assumes vv.ndims <= test_g->ndims */ if ((vv_id = ncvardef(cdfid, vv.name, vv.type, vv.ndims, vv.dims)) == -1) { error("%s: ncvardef failed", pname); ncclose(cdfid); return; } - add_var(&test, &vv); /* keep in-memory netcdf in sync */ + add_var(test_g, &vv); /* keep in-memory netcdf in sync */ /* try with nonexisting attribute, should fail */ if (ncattinq(cdfid, vv_id, "nonesuch", &type, &len) != -1) { @@ -391,24 +391,24 @@ test_ncattinq(char *path) return; } /* try with bad variable handle, should fail */ - if (ncattinq(cdfid, test.nvars, test.atts[0].name, &type, &len) != -1) { + if (ncattinq(cdfid, test_g->nvars, test_g->atts[0].name, &type, &len) != -1) { error("%s: ncattinq should fail with bad variable id", pname); ncclose(cdfid); return; } /* in define mode check all attributes against test netcdf */ - for (ia = 0; ia < test.natts; ia++) { - if (ncattinq(cdfid, test.atts[ia].var, test.atts[ia].name, &type, &len) == -1) { + for (ia = 0; ia < test_g->natts; ia++) { + if (ncattinq(cdfid, test_g->atts[ia].var, test_g->atts[ia].name, &type, &len) == -1) { error("%s: ncattinq in define mode failed", pname); ncclose(cdfid); return; } - if (type != test.atts[ia].type) { + if (type != test_g->atts[ia].type) { error("%s: ncattinq in define mode returned wrong type", pname); ncclose(cdfid); return; } - if (len != test.atts[ia].len) { + if (len != test_g->atts[ia].len) { error("%s: ncattinq in define mode returned wrong len", pname); ncclose(cdfid); return; @@ -423,7 +423,7 @@ test_ncattinq(char *path) error("%s: ncclose failed", pname); return; } - if (ncattinq(cdfid, NC_GLOBAL, test.atts[0].name, &type, &len) != -1) { + if (ncattinq(cdfid, NC_GLOBAL, test_g->atts[0].name, &type, &len) != -1) { error("%s: ncattinq should fail with bad cdfid", pname); nerrs++; } @@ -480,7 +480,7 @@ test_ncattget(char *path) ncclose(cdfid); return; } - add_var(&test, &uu); /* keep in-memory netcdf in sync */ + add_var(test_g, &uu); /* keep in-memory netcdf in sync */ /* add an attribute */ if (ncattput(cdfid, uu_id, vmax.name, vmax.type, vmax.len, vmax.val) == -1) { @@ -488,39 +488,39 @@ test_ncattget(char *path) ncclose(cdfid); return; } - add_att(&test, uu_id, &vmax); /* keep in-memory netcdf updated */ + add_att(test_g, uu_id, &vmax); /* keep in-memory netcdf updated */ /* in define mode, check all attributes values against test netcdf */ - for (ia = 0; ia < test.natts; ia++) { - if (ncattinq(cdfid, test.atts[ia].var, test.atts[ia].name, &tmp.type, &tmp.len) == -1) { + for (ia = 0; ia < test_g->natts; ia++) { + if (ncattinq(cdfid, test_g->atts[ia].var, test_g->atts[ia].name, &tmp.type, &tmp.len) == -1) { error("%s: ncattinq in define mode failed", pname); ncclose(cdfid); return; } - if (tmp.type != test.atts[ia].type) { + if (tmp.type != test_g->atts[ia].type) { error("%s: ncattinq in define mode returned wrong type", pname); ncclose(cdfid); return; } - if (tmp.len != test.atts[ia].len) { + if (tmp.len != test_g->atts[ia].len) { error("%s: ncattinq in define mode returned wrong len", pname); ncclose(cdfid); return; } /* allocate space to hold the attribute value to be retrieved */ tmp.val = emalloc(tmp.len * nctypelen(tmp.type)); - if (ncattget(cdfid, test.atts[ia].var, test.atts[ia].name, tmp.val) == -1) { + if (ncattget(cdfid, test_g->atts[ia].var, test_g->atts[ia].name, tmp.val) == -1) { error("%s: ncattget of variable attribute failed in define mode", pname); ncclose(cdfid); return; } - if (val_cmp(tmp.type, tmp.len, tmp.val, test.atts[ia].val) != 0) { + if (val_cmp(tmp.type, tmp.len, tmp.val, test_g->atts[ia].val) != 0) { error("%s: ncattget got bad values in define mode", pname); error(" cdfid=%d, varname=%s, attname=%s, type=%d, len=%d", cdfid, - test.vars[test.atts[ia].var].name, test.atts[ia].name, test.atts[ia].type, - test.atts[ia].len); + test_g->vars[test_g->atts[ia].var].name, test_g->atts[ia].name, test_g->atts[ia].type, + test_g->atts[ia].len); (void)fprintf(stderr, "should have got:"); - val_out(test.atts[ia].type, test.atts[ia].len, test.atts[ia].val); + val_out(test_g->atts[ia].type, test_g->atts[ia].len, test_g->atts[ia].val); (void)fprintf(stderr, " instead got:"); val_out(tmp.type, tmp.len, tmp.val); nerrs++; @@ -534,36 +534,36 @@ test_ncattget(char *path) } /* in data mode, check all attributes values against test netcdf */ - for (ia = 0; ia < test.natts; ia++) { - if (ncattinq(cdfid, test.atts[ia].var, test.atts[ia].name, &tmp.type, &tmp.len) == -1) { + for (ia = 0; ia < test_g->natts; ia++) { + if (ncattinq(cdfid, test_g->atts[ia].var, test_g->atts[ia].name, &tmp.type, &tmp.len) == -1) { error("%s: ncattinq failed", pname); ncclose(cdfid); return; } - if (tmp.type != test.atts[ia].type) { + if (tmp.type != test_g->atts[ia].type) { error("%s: ncattinq returned wrong type", pname); ncclose(cdfid); return; } - if (tmp.len != test.atts[ia].len) { + if (tmp.len != test_g->atts[ia].len) { error("%s: ncattinq returned wrong len", pname); ncclose(cdfid); return; } /* allocate space to hold the attribute value to be retrieved */ tmp.val = emalloc(tmp.len * nctypelen(tmp.type)); - if (ncattget(cdfid, test.atts[ia].var, test.atts[ia].name, tmp.val) == -1) { + if (ncattget(cdfid, test_g->atts[ia].var, test_g->atts[ia].name, tmp.val) == -1) { error("%s: ncattget of variable attribute failed in data mode", pname); ncclose(cdfid); return; } - if (val_cmp(tmp.type, tmp.len, tmp.val, test.atts[ia].val) != 0) { + if (val_cmp(tmp.type, tmp.len, tmp.val, test_g->atts[ia].val) != 0) { error("%s: ncattget got bad values in data mode", pname); error(" cdfid=%d, varname=%s, attname=%s, type=%d, len=%d", cdfid, - test.vars[test.atts[ia].var].name, test.atts[ia].name, test.atts[ia].type, - test.atts[ia].len); + test_g->vars[test_g->atts[ia].var].name, test_g->atts[ia].name, test_g->atts[ia].type, + test_g->atts[ia].len); (void)fprintf(stderr, "should have got:"); - val_out(test.atts[ia].type, test.atts[ia].len, test.atts[ia].val); + val_out(test_g->atts[ia].type, test_g->atts[ia].len, test_g->atts[ia].val); (void)fprintf(stderr, " instead got:"); val_out(tmp.type, tmp.len, tmp.val); nerrs++; @@ -571,7 +571,7 @@ test_ncattget(char *path) free(tmp.val); } /* try with bad variable handle, should fail */ - if (ncattget(cdfid, test.nvars, vmax.name, vmax.val) != -1) { + if (ncattget(cdfid, test_g->nvars, vmax.name, vmax.val) != -1) { error("%s: ncattget should fail with bad variable handle", pname); ncclose(cdfid); return; @@ -651,7 +651,7 @@ test_ncattcopy(char *path1, char *path2) ncclose(cdfid); return; } - add_att(&test, NC_GLOBAL, &att); /* keep in-memory netcdf consistent */ + add_att(test_g, NC_GLOBAL, &att); /* keep in-memory netcdf consistent */ tt.dims = (int *)emalloc(sizeof(int) * tt.ndims); for (id = 0; id < tt.ndims; id++) tt.dims[0] = id; @@ -660,13 +660,13 @@ test_ncattcopy(char *path1, char *path2) ncclose(cdfid); return; } - add_var(&test, &tt); /* keep in-memory netcdf consistent */ + add_var(test_g, &tt); /* keep in-memory netcdf consistent */ if (ncattput(cdfid, tt_id, att.name, att.type, att.len, att.val) == -1) { error("%s: ncattput failed", pname); ncclose(cdfid); return; } - add_att(&test, tt_id, &att); /* keep in-memory netcdf consistent */ + add_att(test_g, tt_id, &att); /* keep in-memory netcdf consistent */ tu.dims = (int *)emalloc(sizeof(int) * tu.ndims); for (id = 0; id < tu.ndims; id++) @@ -676,13 +676,13 @@ test_ncattcopy(char *path1, char *path2) ncclose(cdfid); return; } - add_var(&test, &tu); /* keep in-memory netcdf consistent */ + add_var(test_g, &tu); /* keep in-memory netcdf consistent */ if (ncattput(cdfid, tu_id, att.name, att.type, att.len, att.val) == -1) { error("%s: ncattput failed", pname); ncclose(cdfid); return; } - add_att(&test, tu_id, &att); /* keep in-memory netcdf consistent */ + add_att(test_g, tu_id, &att); /* keep in-memory netcdf consistent */ if (ncendef(cdfid) == -1) { error("%s: ncendef failed", pname); ncclose(cdfid); @@ -696,7 +696,7 @@ test_ncattcopy(char *path1, char *path2) } /* create dimensions and variable in second netcdf */ for (id = 0; id < tu.ndims; id++) { /* copy dimensions from source */ - if ((tu.dims[id] = ncdimdef(cdfid2, test.dims[id].name, test.dims[id].size)) == -1) { + if ((tu.dims[id] = ncdimdef(cdfid2, test_g->dims[id].name, test_g->dims[id].size)) == -1) { error("%s: ncdimdef failed", pname); ncclose(cdfid); ncclose(cdfid2); @@ -793,7 +793,7 @@ test_ncattcopy(char *path1, char *path2) ncclose(cdfid2); return; } - add_att(&test, NC_GLOBAL, &att2); /* keep in-memory netcdf consistent */ + add_att(test_g, NC_GLOBAL, &att2); /* keep in-memory netcdf consistent */ /* copy shorter attribute on existing attribute */ if (ncattcopy(cdfid, NC_GLOBAL, att2.name, cdfid2, tu2_id) == -1) { error("%s: ncattcopy of shorter attribute on old attribute failed", pname); @@ -836,7 +836,7 @@ test_ncattcopy(char *path1, char *path2) ncclose(cdfid2); return; } - add_att(&test, tu_id, &att2); /* keep in-memory netcdf consistent */ + add_att(test_g, tu_id, &att2); /* keep in-memory netcdf consistent */ /* check that copy worked with ncattinq and ncattget */ if (ncattinq(cdfid, tu_id, att2.name, &tmp.type, &tmp.len) == -1) { error("%s: ncattinq of variable attribute failed", pname); @@ -879,7 +879,7 @@ test_ncattcopy(char *path1, char *path2) return; } /* try with bad source or target variable handle, check error */ - if (ncattcopy(cdfid, test.nvars, att.name, cdfid, tu_id) != -1) { + if (ncattcopy(cdfid, test_g->nvars, att.name, cdfid, tu_id) != -1) { error("%s: ncattcopy should fail with bad source variable id", pname); ncclose(cdfid); ncclose(cdfid2); @@ -954,47 +954,47 @@ test_ncattname(char *path) /* for each NC_GLOBAL attribute, get name and compare with expected name */ att.name = (char *)emalloc(H4_MAX_NC_NAME); ib = 0; - for (ia = 0; ia < test.ngatts; ia++) { + for (ia = 0; ia < test_g->ngatts; ia++) { if (ncattname(cdfid, NC_GLOBAL, ia, att.name) == -1) { error("%s: ncattname failed on global attribute", pname); ncclose(cdfid); return; } /* find number of next global attribute */ - while (ib < test.natts && test.atts[ib].var != NC_GLOBAL) + while (ib < test_g->natts && test_g->atts[ib].var != NC_GLOBAL) ib++; - if (ib >= test.natts) { + if (ib >= test_g->natts) { error("%s: test problem, expected global attribute not found", pname); ncclose(cdfid); return; } - if (strcmp(att.name, test.atts[ib].name) != 0) { + if (strcmp(att.name, test_g->atts[ib].name) != 0) { error("%s: NC_GLOBAL attribute name `%s' instead of expected `%s'", pname, att.name, - test.atts[ib].name); + test_g->atts[ib].name); nerrs++; } ib++; } /* for each variable attribute, get name and compare with expected name */ - for (iv = 0; iv < test.nvars; iv++) { + for (iv = 0; iv < test_g->nvars; iv++) { ib = 0; - for (ia = 0; ia < test.vars[iv].natts; ia++) { + for (ia = 0; ia < test_g->vars[iv].natts; ia++) { if (ncattname(cdfid, iv, ia, att.name) == -1) { error("%s: ncattname failed on variable attribute", pname); ncclose(cdfid); return; } /* find number of next attribute */ - while (ib < test.natts && test.atts[ib].var != iv) + while (ib < test_g->natts && test_g->atts[ib].var != iv) ib++; - if (ib >= test.natts) { + if (ib >= test_g->natts) { error("%s: problem in test, expected attribute not found", pname); ncclose(cdfid); return; } - if (strcmp(att.name, test.atts[ib].name) != 0) { - error("%s: variable '%s' name `%s' instead of expected `%s'", pname, test.vars[iv].name, - att.name, test.atts[ib].name); + if (strcmp(att.name, test_g->atts[ib].name) != 0) { + error("%s: variable '%s' name `%s' instead of expected `%s'", pname, test_g->vars[iv].name, + att.name, test_g->atts[ib].name); nerrs++; } ib++; @@ -1007,10 +1007,10 @@ test_ncattname(char *path) ncclose(cdfid); return; } - add_att(&test, NC_GLOBAL, &att); /* keep in-memory netcdf consistent */ + add_att(test_g, NC_GLOBAL, &att); /* keep in-memory netcdf consistent */ /* test that ncattname works immediately after ncattput */ tmp.name = (char *)emalloc(H4_MAX_NC_NAME); - if (ncattname(cdfid, NC_GLOBAL, test.ngatts - 1, tmp.name) == -1) { + if (ncattname(cdfid, NC_GLOBAL, test_g->ngatts - 1, tmp.name) == -1) { error("%s: ncattname failed on variable attribute", pname); ncclose(cdfid); return; @@ -1027,54 +1027,54 @@ test_ncattname(char *path) /* in data mode */ /* for each NC_GLOBAL attribute, get name and compare with expected name */ ib = 0; - for (ia = 0; ia < test.ngatts; ia++) { + for (ia = 0; ia < test_g->ngatts; ia++) { if (ncattname(cdfid, NC_GLOBAL, ia, att.name) == -1) { error("%s: ncattname failed on global attribute", pname); ncclose(cdfid); return; } /* find number of next global attribute */ - while (ib < test.natts && test.atts[ib].var != NC_GLOBAL) + while (ib < test_g->natts && test_g->atts[ib].var != NC_GLOBAL) ib++; - if (ib >= test.natts) { + if (ib >= test_g->natts) { error("%s: test problem, expected global attribute not found", pname); ncclose(cdfid); return; } - if (strcmp(att.name, test.atts[ib].name) != 0) { + if (strcmp(att.name, test_g->atts[ib].name) != 0) { error("%s: NC_GLOBAL attribute name `%s' instead of expected `%s'", pname, att.name, - test.atts[ib].name); + test_g->atts[ib].name); nerrs++; } ib++; } /* for each variable attribute, get name and compare with expected name */ - for (iv = 0; iv < test.nvars; iv++) { + for (iv = 0; iv < test_g->nvars; iv++) { ib = 0; - for (ia = 0; ia < test.vars[iv].natts; ia++) { + for (ia = 0; ia < test_g->vars[iv].natts; ia++) { if (ncattname(cdfid, iv, ia, att.name) == -1) { error("%s: ncattname failed on variable attribute", pname); ncclose(cdfid); return; } /* find number of next attribute */ - while (ib < test.natts && test.atts[ib].var != iv) + while (ib < test_g->natts && test_g->atts[ib].var != iv) ib++; - if (ib >= test.natts) { + if (ib >= test_g->natts) { error("%s: problem in test, expected attribute not found", pname); ncclose(cdfid); return; } - if (strcmp(att.name, test.atts[ib].name) != 0) { - error("%s: variable '%s' name `%s' instead of expected `%s'", pname, test.vars[iv].name, - att.name, test.atts[ib].name); + if (strcmp(att.name, test_g->atts[ib].name) != 0) { + error("%s: variable '%s' name `%s' instead of expected `%s'", pname, test_g->vars[iv].name, + att.name, test_g->atts[ib].name); nerrs++; } ib++; } } /* try with bad variable handle, check error */ - if (ncattname(cdfid, test.nvars, 0, att.name) != -1) { + if (ncattname(cdfid, test_g->nvars, 0, att.name) != -1) { error("%s: ncattname should fail with bad variable handle", pname); ncclose(cdfid); return; @@ -1085,7 +1085,7 @@ test_ncattname(char *path) ncclose(cdfid); return; } - if (ncattname(cdfid, NC_GLOBAL, test.ngatts, att.name) != -1) { + if (ncattname(cdfid, NC_GLOBAL, test_g->ngatts, att.name) != -1) { error("%s: ncattname should fail with too-high number", pname); ncclose(cdfid); return; @@ -1152,14 +1152,14 @@ test_ncattrename(char *path) ncclose(cdfid); return; } - add_att(&test, NC_GLOBAL, &atty); /* keep in-memory netcdf in sync */ - ynum = test.natts - 1; /* number of attribute just put */ + add_att(test_g, NC_GLOBAL, &atty); /* keep in-memory netcdf in sync */ + ynum = test_g->natts - 1; /* number of attribute just put */ if (ncattput(cdfid, NC_GLOBAL, attz.name, attz.type, attz.len, attz.val) == -1) { error("%s: ncattput failed", pname); ncclose(cdfid); return; } - add_att(&test, NC_GLOBAL, &attz); /* keep in-memory netcdf in sync */ + add_att(test_g, NC_GLOBAL, &attz); /* keep in-memory netcdf in sync */ /* rename first attribute to shorter name */ if (ncattrename(cdfid, NC_GLOBAL, atty.name, newname) == -1) { @@ -1167,7 +1167,7 @@ test_ncattrename(char *path) ncclose(cdfid); return; } - (void)strcpy(test.atts[ynum].name, newname); /* keep test consistent */ + (void)strcpy(test_g->atts[ynum].name, newname); /* keep test consistent */ /* check new name with ncattinq */ if (ncattinq(cdfid, NC_GLOBAL, newname, &tmp.type, &tmp.len) == -1) { error("%s: ncattinq of renamed attribute failed", pname); @@ -1208,7 +1208,7 @@ test_ncattrename(char *path) return; } /* try with bad variable handle, check for failure */ - if (ncattrename(cdfid, test.nvars, newname, atty.name) != -1) { + if (ncattrename(cdfid, test_g->nvars, newname, atty.name) != -1) { error("%s: ncattrename should have failed on bad variable id", pname); ncclose(cdfid); return; @@ -1309,7 +1309,7 @@ test_ncattdel(char *path) ncclose(cdfid); return; } - add_att(&test, NC_GLOBAL, &yaa); /* keep in-memory netcdf in sync */ + add_att(test_g, NC_GLOBAL, &yaa); /* keep in-memory netcdf in sync */ yav.dims = (int *)emalloc(sizeof(int) * yav.ndims); for (id = 0; id < yav.ndims; id++) yav.dims[id] = id; @@ -1318,13 +1318,13 @@ test_ncattdel(char *path) ncclose(cdfid); return; } - add_var(&test, &yav); /* keep in-memory netcdf consistent */ + add_var(test_g, &yav); /* keep in-memory netcdf consistent */ if (ncattput(cdfid, yav_id, yaa.name, yaa.type, yaa.len, yaa.val) == -1) { error("%s: ncattput failed", pname); ncclose(cdfid); return; } - add_att(&test, yav_id, &yaa); /* keep in-memory netcdf consistent */ + add_att(test_g, yav_id, &yaa); /* keep in-memory netcdf consistent */ /* get number of global attributes, number of attributes for variable */ if (ncinquire(cdfid, &ndims, &nvars, &ngatts1, &xdimid) == -1) { @@ -1346,7 +1346,7 @@ test_ncattdel(char *path) ncclose(cdfid); return; } - del_att(&test, NC_GLOBAL, &yaa); /* keep in-memory netcdf consistent */ + del_att(test_g, NC_GLOBAL, &yaa); /* keep in-memory netcdf consistent */ if (ncinquire(cdfid, &ndims, &nvars, &ngatts2, &xdimid) == -1) { error("%s: ncinquire failed", pname); ncclose(cdfid); @@ -1369,7 +1369,7 @@ test_ncattdel(char *path) ncclose(cdfid); return; } - del_att(&test, yav_id, &yaa); /* keep in-memory netcdf consistent */ + del_att(test_g, yav_id, &yaa); /* keep in-memory netcdf consistent */ if (ncvarinq(cdfid, yav_id, vtmp.name, &vtmp.type, &vtmp.ndims, vtmp.dims, &vtmp.natts) == -1) { error("%s: ncvarinq failed", pname); ncclose(cdfid); @@ -1391,13 +1391,13 @@ test_ncattdel(char *path) ncclose(cdfid); return; } - add_att(&test, NC_GLOBAL, &yaa); /* keep in-memory netcdf in sync */ + add_att(test_g, NC_GLOBAL, &yaa); /* keep in-memory netcdf in sync */ if (ncattput(cdfid, yav_id, yaa.name, yaa.type, yaa.len, yaa.val) == -1) { error("%s: ncattput failed", pname); ncclose(cdfid); return; } - add_att(&test, yav_id, &yaa); /* keep in-memory netcdf consistent */ + add_att(test_g, yav_id, &yaa); /* keep in-memory netcdf consistent */ /* try on nonexistent attribute, should fail */ if (ncattdel(cdfid, yav_id, "nonesuch") != -1) { error("%s: ncattdel should fail on bogus attribute", pname); @@ -1405,7 +1405,7 @@ test_ncattdel(char *path) return; } /* try on bad variable id, should fail */ - if (ncattdel(cdfid, test.nvars, yaa.name) != -1) { + if (ncattdel(cdfid, test_g->nvars, yaa.name) != -1) { error("%s: ncattdel should fail on bad variable id", pname); ncclose(cdfid); return; diff --git a/mfhdf/nctest/cdftests.c b/mfhdf/nctest/cdftests.c index c9f70d3d8e..c82f1bdfd9 100644 --- a/mfhdf/nctest/cdftests.c +++ b/mfhdf/nctest/cdftests.c @@ -70,7 +70,7 @@ test_nccreate(char *path) } /* Initialize in-memory netcdf to empty */ - add_reset(&test); + add_reset(test_g); if (nerrs > 0) (void)fprintf(stderr, "FAILED! ***\n"); else @@ -124,7 +124,7 @@ test_ncopen(char *path) ncclose(cdfid0); return; } - add_att(&test, NC_GLOBAL, &title); /* keep in-memory netcdf updated */ + add_att(test_g, NC_GLOBAL, &title); /* keep in-memory netcdf updated */ if (ncendef(cdfid0) == -1) { error("%s: ncendef failed after ncattput", pname); ncclose(cdfid0); @@ -217,7 +217,7 @@ test_ncredef(char *path) ncclose(cdfid); return; } - add_dim(&test, &ii); /* keep in-memory netcdf in sync */ + add_dim(test_g, &ii); /* keep in-memory netcdf in sync */ /* dimension added OK, add a variable */ aa.dims = (int *)emalloc(sizeof(int) * aa.ndims); @@ -227,7 +227,7 @@ test_ncredef(char *path) ncclose(cdfid); return; } - add_var(&test, &aa); /* keep in-memory netcdf in sync */ + add_var(test_g, &aa); /* keep in-memory netcdf in sync */ /* variable added OK, add a variable attribute */ aa_units.var = aa_id; @@ -237,7 +237,7 @@ test_ncredef(char *path) ncclose(cdfid); return; } - add_att(&test, aa_id, &aa_units); /* keep in-memory netcdf in sync */ + add_att(test_g, aa_id, &aa_units); /* keep in-memory netcdf in sync */ if (ncredef(cdfid) != -1) { error("%s: cdredef in define mode should have failed", pname); @@ -310,8 +310,8 @@ test_ncendef(char *path) ncclose(cdfid); return; } - add_dim(&test, &jj); /* keep in-memory netcdf in sync */ - add_dim(&test, &kk); /* keep in-memory netcdf in sync */ + add_dim(test_g, &jj); /* keep in-memory netcdf in sync */ + add_dim(test_g, &kk); /* keep in-memory netcdf in sync */ /* dimensions added OK, add a variable */ bb.dims = (int *)emalloc(sizeof(int) * bb.ndims); @@ -322,7 +322,7 @@ test_ncendef(char *path) ncclose(cdfid); return; } - add_var(&test, &bb); /* keep in-memory netcdf in sync */ + add_var(test_g, &bb); /* keep in-memory netcdf in sync */ /* variable added OK, add a variable attribute */ if (ncattput(cdfid, bb_id, bb_range.name, bb_range.type, bb_range.len, (void *)bb_range.val) == -1) { @@ -330,7 +330,7 @@ test_ncendef(char *path) ncclose(cdfid); return; } - add_att(&test, bb_id, &bb_range); /* keep in-memory netcdf in sync */ + add_att(test_g, bb_id, &bb_range); /* keep in-memory netcdf in sync */ if (ncendef(cdfid) == -1) { error("%s: ncendef failed", pname); @@ -461,20 +461,20 @@ test_ncinquire(char *path) return; } /* compare returned with expected values */ - if (ndims != test.ndims) { - error("%s: ndims returned as %d, expected %d", pname, ndims, test.ndims); + if (ndims != test_g->ndims) { + error("%s: ndims returned as %d, expected %d", pname, ndims, test_g->ndims); nerrs++; } - if (nvars != test.nvars) { - error("%s: nvars returned as %d, expected %d", pname, nvars, test.nvars); + if (nvars != test_g->nvars) { + error("%s: nvars returned as %d, expected %d", pname, nvars, test_g->nvars); nerrs++; } - if (ngatts != test.ngatts) { - error("%s: ngatts returned as %d, expected %d", pname, ngatts, test.ngatts); + if (ngatts != test_g->ngatts) { + error("%s: ngatts returned as %d, expected %d", pname, ngatts, test_g->ngatts); nerrs++; } - if (xdimid != test.xdimid) { - error("%s: xdimid returned as %d, expected %d", pname, xdimid, test.xdimid); + if (xdimid != test_g->xdimid) { + error("%s: xdimid returned as %d, expected %d", pname, xdimid, test_g->xdimid); nerrs++; } @@ -490,7 +490,7 @@ test_ncinquire(char *path) ncclose(cdfid); return; } - add_dim(&test, &dims[id]); + add_dim(test_g, &dims[id]); } /* add an unlimited dimension */ @@ -499,7 +499,7 @@ test_ncinquire(char *path) ncclose(cdfid); return; } - add_dim(&test, &rec); + add_dim(test_g, &rec); /* add some record variables */ for (iv = 0; iv < nv; iv++) { @@ -512,7 +512,7 @@ test_ncinquire(char *path) ncclose(cdfid); return; } - add_var(&test, &cc[iv]); + add_var(test_g, &cc[iv]); /* add a variable attribute */ if (ncattput(cdfid, cc_id, cc_units.name, cc_units.type, cc_units.len, (void *)cc_units.val) == -1) { @@ -520,7 +520,7 @@ test_ncinquire(char *path) ncclose(cdfid); return; } - add_att(&test, cc_id, &cc_units); + add_att(test_g, cc_id, &cc_units); } /* try calling from define mode, compare returned values to expected */ if (ncinquire(cdfid, &ndims, &nvars, &ngatts, &xdimid) == -1) { @@ -529,20 +529,20 @@ test_ncinquire(char *path) return; } /* compare returned with expected values */ - if (ndims != test.ndims) { - error("%s: ndims returned as %d, expected %d", pname, ndims, test.ndims); + if (ndims != test_g->ndims) { + error("%s: ndims returned as %d, expected %d", pname, ndims, test_g->ndims); nerrs++; } - if (nvars != test.nvars) { - error("%s: nvars returned as %d, expected %d", pname, nvars, test.nvars); + if (nvars != test_g->nvars) { + error("%s: nvars returned as %d, expected %d", pname, nvars, test_g->nvars); nerrs++; } - if (ngatts != test.ngatts) { - error("%s: ngatts returned as %d, expected %d", pname, ngatts, test.ngatts); + if (ngatts != test_g->ngatts) { + error("%s: ngatts returned as %d, expected %d", pname, ngatts, test_g->ngatts); nerrs++; } - if (xdimid != test.xdimid) { - error("%s: xdimid returned as %d, expected %d", pname, xdimid, test.xdimid); + if (xdimid != test_g->xdimid) { + error("%s: xdimid returned as %d, expected %d", pname, xdimid, test_g->xdimid); nerrs++; } @@ -610,7 +610,7 @@ test_ncsync(char *path) ncclose(cdfid0); return; } - add_dim(&test, &ll); + add_dim(test_g, &ll); dd.dims = (int *)emalloc(sizeof(int) * dd.ndims); dd.dims[0] = ll_dim; @@ -619,7 +619,7 @@ test_ncsync(char *path) ncclose(cdfid0); return; } - add_var(&test, &dd); + add_var(test_g, &dd); if (ncattput(cdfid0, dd_id, dd_fill_val.name, dd_fill_val.type, dd_fill_val.len, (void *)dd_fill_val.val) == -1) { @@ -627,7 +627,7 @@ test_ncsync(char *path) ncclose(cdfid0); return; } - add_att(&test, dd_id, &dd_fill_val); + add_att(test_g, dd_id, &dd_fill_val); if (ncsync(cdfid0) != -1) { error("%s: ncsync in define mode should fail", pname); @@ -657,7 +657,7 @@ test_ncsync(char *path) ncclose(cdfid0); return; } - add_data(&test, dd_id, dd_start, dd_edges); /* keep test in sync */ + add_data(test_g, dd_id, dd_start, dd_edges); /* keep test in sync */ if (ncsync(cdfid0) == -1) { error("%s: ncsync after putting data failed", pname); nerrs++; diff --git a/mfhdf/nctest/dimtests.c b/mfhdf/nctest/dimtests.c index 9bbfbee256..6f40291746 100644 --- a/mfhdf/nctest/dimtests.c +++ b/mfhdf/nctest/dimtests.c @@ -72,10 +72,10 @@ test_ncdimdef(char *path) ncclose(cdfid); return; } - add_dim(&test, &mm); /* keep in-memory netcdf in sync */ + add_dim(test_g, &mm); /* keep in-memory netcdf in sync */ /* check that dim id returned is one more than previous dim id */ - if (dimid != test.ndims - 1) { - error("%s: ncdimdef returned %d for dim id, expected %d", pname, dimid, test.ndims - 1); + if (dimid != test_g->ndims - 1) { + error("%s: ncdimdef returned %d for dim id, expected %d", pname, dimid, test_g->ndims - 1); ncclose(cdfid); return; } @@ -104,7 +104,7 @@ test_ncdimdef(char *path) ncclose(cdfid); return; } - add_dim(&test, &rec); + add_dim(test_g, &rec); } /* try adding another unlimited dimension, which should fail */ if (ncdimdef(cdfid, "rec2", rec.size) != -1) { @@ -167,7 +167,7 @@ test_ncdimid(char *path) ncclose(cdfid); return; } - add_dim(&test, &nn); /* keep in-memory netcdf in sync */ + add_dim(test_g, &nn); /* keep in-memory netcdf in sync */ /* check id returned for name matches id returned from definition */ if (ncdimid(cdfid, nn.name) != nn_dim) { error("%s: ncdimid returned wrong value in define mode", pname); @@ -192,7 +192,7 @@ test_ncdimid(char *path) return; } /* try with unlimited dimension, assumed to be "rec" from earlier calls */ - if (ncdimid(cdfid, "rec") != test.xdimid) { + if (ncdimid(cdfid, "rec") != test_g->xdimid) { error("%s: ncdimid returned bad value for record dimension", pname); ncclose(cdfid); return; @@ -237,21 +237,21 @@ test_ncdiminq(char *path) } /* opened, in data mode */ dim.name = (char *)emalloc(H4_MAX_NC_NAME); - for (dimid = 0; dimid < test.ndims; dimid++) { /* loop on all dim ids */ + for (dimid = 0; dimid < test_g->ndims; dimid++) { /* loop on all dim ids */ if (ncdiminq(cdfid, dimid, dim.name, &dim.size) == -1) { error("%s: ncdiminq in data mode failed on dim id %d", pname, dimid); ncclose(cdfid); return; } /* compare returned with expected values */ - if (strcmp(dim.name, test.dims[dimid].name) != 0) { + if (strcmp(dim.name, test_g->dims[dimid].name) != 0) { error("%s: ncdiminq (data mode), name %s, expected %s for id = %d", pname, dim.name, - test.dims[dimid].name, dimid); + test_g->dims[dimid].name, dimid); nerrs++; } - if (dim.size != test.dims[dimid].size) { + if (dim.size != test_g->dims[dimid].size) { error("%s: ncdiminq (data mode), size %d, expected %d for id = %d", pname, dim.size, - test.dims[dimid].size, dimid); + test_g->dims[dimid].size, dimid); nerrs++; } } @@ -261,27 +261,27 @@ test_ncdiminq(char *path) return; } /* in define mode, compare returned with expected values again */ - for (dimid = 0; dimid < test.ndims; dimid++) { /* loop on all dim ids */ + for (dimid = 0; dimid < test_g->ndims; dimid++) { /* loop on all dim ids */ if (ncdiminq(cdfid, dimid, dim.name, &dim.size) == -1) { error("%s: ncdiminq in define mode failed on dim id %d", pname, dimid); ncclose(cdfid); return; } /* compare returned with expected values */ - if (strcmp(dim.name, test.dims[dimid].name) != 0) { + if (strcmp(dim.name, test_g->dims[dimid].name) != 0) { error("%s: ncdiminq (define), name %s, expected %s for id = %d", pname, dim.name, - test.dims[dimid].name, dimid); + test_g->dims[dimid].name, dimid); nerrs++; } - if (dim.size != test.dims[dimid].size) { + if (dim.size != test_g->dims[dimid].size) { error("%s: ncdiminq (define), size %d, expected %d for id = %d", pname, dim.size, - test.dims[dimid].size, dimid); + test_g->dims[dimid].size, dimid); nerrs++; } } /* try with bad dimension handles, check for failure */ if (ncdiminq(cdfid, -1, dim.name, &dim.size) != -1 || - ncdiminq(cdfid, test.ndims, dim.name, &dim.size) != -1) { + ncdiminq(cdfid, test_g->ndims, dim.name, &dim.size) != -1) { error("%s: ncdiminq should have failed on bad dimension ids", pname, dimid); ncclose(cdfid); return; @@ -296,7 +296,7 @@ test_ncdiminq(char *path) return; } /* should fail, since bad handle */ - if (test.ndims >= 1) { /* if any dimensions have been defined */ + if (test_g->ndims >= 1) { /* if any dimensions have been defined */ if (ncdiminq(cdfid, 0, dim.name, &dim.size) != -1) { error("%s: ncdiminq failed to report bad netcdf handle ", pname); nerrs++; @@ -350,13 +350,13 @@ test_ncdimrename(char *path) ncclose(cdfid); return; } - add_dim(&test, &pp); /* keep in-memory netcdf in sync */ + add_dim(test_g, &pp); /* keep in-memory netcdf in sync */ if (ncdimdef(cdfid, qq.name, qq.size) == -1) { error("%s: ncdimdef failed", pname); ncclose(cdfid); return; } - add_dim(&test, &qq); /* keep in-memory netcdf in sync */ + add_dim(test_g, &qq); /* keep in-memory netcdf in sync */ /* rename first dimension */ if (ncdimrename(cdfid, pp_dim, newname) == -1) { error("%s: ncdimrename failed", pname); @@ -380,8 +380,8 @@ test_ncdimrename(char *path) ncclose(cdfid); return; } - test.dims[pp_dim].name = (char *)erealloc((void *)test.dims[pp_dim].name, strlen(newname) + 1); - (void)strcpy(test.dims[pp_dim].name, newname); /* keep test consistent */ + test_g->dims[pp_dim].name = (char *)erealloc((void *)test_g->dims[pp_dim].name, strlen(newname) + 1); + (void)strcpy(test_g->dims[pp_dim].name, newname); /* keep test consistent */ /* try to rename second dimension same as first, should fail */ if (ncdimrename(cdfid, pp_dim, qq.name) != -1) { error("%s: ncdimrename should have failed with used name", pname); @@ -389,7 +389,7 @@ test_ncdimrename(char *path) return; } /* try with bad dimension handles, check for failure */ - if (ncdimrename(cdfid, -1, dim.name) != -1 || ncdimrename(cdfid, test.ndims, dim.name) != -1) { + if (ncdimrename(cdfid, -1, dim.name) != -1 || ncdimrename(cdfid, test_g->ndims, dim.name) != -1) { error("%s: ncdimrename should have failed on bad dimension ids", pname); ncclose(cdfid); return; @@ -405,8 +405,8 @@ test_ncdimrename(char *path) ncclose(cdfid); return; } - test.dims[pp_dim].name = (char *)erealloc((void *)test.dims[pp_dim].name, strlen(pp.name) + 1); - (void)strcpy(test.dims[pp_dim].name, pp.name); /* keep test consistent */ + test_g->dims[pp_dim].name = (char *)erealloc((void *)test_g->dims[pp_dim].name, strlen(pp.name) + 1); + (void)strcpy(test_g->dims[pp_dim].name, pp.name); /* keep test consistent */ if (ncclose(cdfid) == -1) { error("%s: ncclose failed", pname); return; diff --git a/mfhdf/nctest/driver.c b/mfhdf/nctest/driver.c index 8878333293..9b564b4c8d 100644 --- a/mfhdf/nctest/driver.c +++ b/mfhdf/nctest/driver.c @@ -11,6 +11,8 @@ #include "hdf4_netcdf.h" #endif +#include "emalloc.h" +#include "testcdf.h" #include "tests.h" /* #define MDEBUG 1 */ @@ -28,6 +30,9 @@ #include #include /* to remove warnings, HDFFR-1434 */ +/* In-memory netcdf structure, kept in sync with disk netcdf */ +struct netcdf *test_g = NULL; + int main(void) { @@ -39,6 +44,9 @@ main(void) ncopts |= NC_VERBOSE; /* turn error messages on--AKC */ ncopts &= ~NC_VERBOSE; /* turn off error messages */ + test_g = (struct netcdf *)emalloc(sizeof(struct netcdf)); + memset(test_g, 0, sizeof(struct netcdf)); + test_nccreate(testfile); test_ncopen(testfile); @@ -107,5 +115,7 @@ main(void) test_nctypelen(); + free(test_g); + return EXIT_SUCCESS; } diff --git a/mfhdf/nctest/slabs.c b/mfhdf/nctest/slabs.c index 3f7ffca17c..d40af907f8 100644 --- a/mfhdf/nctest/slabs.c +++ b/mfhdf/nctest/slabs.c @@ -202,7 +202,7 @@ val_stuff(nc_type type, void *v, int ii, long val) /* v[ii] = val */ ncclose(cdfid); return 1; } - add_dim(&test, &dims[idim]); + add_dim(test_g, &dims[idim]); } /* define a multi-dimensional variable of each type */ @@ -217,7 +217,7 @@ val_stuff(nc_type type, void *v, int ii, long val) /* v[ii] = val */ ncclose(cdfid); return 1; } - add_var(&test, &va[iv]); /* keep in-memory netcdf in sync */ + add_var(test_g, &va[iv]); /* keep in-memory netcdf in sync */ } if (ncendef(cdfid) == -1) { @@ -261,7 +261,7 @@ val_stuff(nc_type type, void *v, int ii, long val) /* v[ii] = val */ nerrs++; } - add_data(&test, varid[iv], corner, edge); /* keep test in sync */ + add_data(test_g, varid[iv], corner, edge); /* keep test in sync */ /* * For several combinations of fixed dimensions, get a slab and compare * values to function values. diff --git a/mfhdf/nctest/testcdf.h b/mfhdf/nctest/testcdf.h index db8e1fa856..43ff432924 100644 --- a/mfhdf/nctest/testcdf.h +++ b/mfhdf/nctest/testcdf.h @@ -54,9 +54,7 @@ struct netcdf { struct cdfatt atts[MAX_TEST_ATTS]; /* attributes */ }; -extern struct netcdf test; /* - * in-memory netcdf structure, kept in sync - * with disk netcdf - */ +/* In-memory netcdf structure, kept in sync with disk netcdf */ +extern struct netcdf *test_g; #endif /* NCTEST_TESTCDF_H */ diff --git a/mfhdf/nctest/vardef.c b/mfhdf/nctest/vardef.c index 90ec579c11..6f8c14e3da 100644 --- a/mfhdf/nctest/vardef.c +++ b/mfhdf/nctest/vardef.c @@ -85,7 +85,7 @@ test_ncvardef(char *path) ncclose(cdfid); return; } - add_dim(&test, &di[id]); /* keep in-memory netcdf in sync */ + add_dim(test_g, &di[id]); /* keep in-memory netcdf in sync */ } tmp.dims = (int *)emalloc(sizeof(int) * H4_MAX_VAR_DIMS); @@ -99,21 +99,21 @@ test_ncvardef(char *path) va[iv].dims[id] = di_id[id]; if ((va_id[iv] = ncvardef(cdfid, va[iv].name, va[iv].type, va[iv].ndims, va[iv].dims)) == -1) { error("%s: ncvardef failed", pname); - errvar(&test, &va[iv]); /* prints details about variable */ + errvar(test_g, &va[iv]); /* prints details about variable */ ncclose(cdfid); return; } - add_var(&test, &va[iv]); /* keep in-memory netcdf in sync */ + add_var(test_g, &va[iv]); /* keep in-memory netcdf in sync */ /* check that var id returned is one more than previous var id */ - if (va_id[iv] != test.nvars - 1) { - error("%s: ncvardef returned %d for var id, expected %d", pname, va_id[iv], test.nvars - 1); + if (va_id[iv] != test_g->nvars - 1) { + error("%s: ncvardef returned %d for var id, expected %d", pname, va_id[iv], test_g->nvars - 1); ncclose(cdfid); return; } /* use ncvarinq to get values just set and compare values */ if (ncvarinq(cdfid, va_id[iv], tmp.name, &tmp.type, &tmp.ndims, tmp.dims, &tmp.natts) == -1) { error("%s: ncvarinq failed", pname); - errvar(&test, &va[iv]); /* prints details about variable */ + errvar(test_g, &va[iv]); /* prints details about variable */ ncclose(cdfid); return; } @@ -121,15 +121,15 @@ test_ncvardef(char *path) tmp.natts != va[iv].natts) { error("%s: ncvardef and ncvarinq don't agree for %s", pname, va[iv].name); nerrs++; - errvar(&test, &va[iv]); - errvar(&test, &tmp); + errvar(test_g, &va[iv]); + errvar(test_g, &tmp); } for (id = 0; id < va[iv].ndims; id++) { if (tmp.dims[id] != va[iv].dims[id]) { error("%s: ncvardef and ncvarinq don't agree on shape of %s", pname, va[iv].name); nerrs++; - errvar(&test, &va[iv]); - errvar(&test, &tmp); + errvar(test_g, &va[iv]); + errvar(test_g, &tmp); } } } diff --git a/mfhdf/nctest/varget.c b/mfhdf/nctest/varget.c index 03aeaece90..b9000871e4 100644 --- a/mfhdf/nctest/varget.c +++ b/mfhdf/nctest/varget.c @@ -56,20 +56,20 @@ test_ncvarget(char *path) /* find a variable with at least one dimension */ iv = 0; - while (test.vars[iv].ndims <= 0 && iv < test.nvars) + while (test_g->vars[iv].ndims <= 0 && iv < test_g->nvars) iv++; - if (iv < test.nvars) { /* iv is varid of variable with dimensions */ + if (iv < test_g->nvars) { /* iv is varid of variable with dimensions */ int tmp; /* set coords */ int id; /* dimension id */ - for (id = 0; id < test.vars[iv].ndims; id++) { + for (id = 0; id < test_g->vars[iv].ndims; id++) { hc.cor[id] = 0; hc.edg[id] = 1; } /* get space for vals */ - hc.vals = emalloc(nctypelen(test.vars[iv].type) + 8); + hc.vals = emalloc(nctypelen(test_g->vars[iv].type) + 8); - id = test.vars[iv].ndims - 1; + id = test_g->vars[iv].ndims - 1; tmp = hc.cor[id]; hc.cor[id] = -1; /* try negative coordinate, should fail */ if (ncvarget(cdfid, iv, hc.cor, hc.edg, hc.vals) != -1) { @@ -88,11 +88,11 @@ test_ncvarget(char *path) hc.edg[id] = tmp; { - long mqv = test.vars[iv].ndims - 1; - int dim = test.vars[iv].dims[mqv]; + long mqv = test_g->vars[iv].ndims - 1; + int dim = test_g->vars[iv].dims[mqv]; tmp = hc.cor[mqv]; - hc.cor[mqv] = test.dims[dim].size; /* try big coordinate, should fail */ + hc.cor[mqv] = test_g->dims[dim].size; /* try big coordinate, should fail */ if (ncvarget(cdfid, iv, hc.cor, hc.edg, hc.vals) != -1) { error("%s: ncvarget should fail for too-high coordinate", pname); ncclose(cdfid); @@ -100,7 +100,7 @@ test_ncvarget(char *path) } hc.cor[mqv] = tmp; tmp = hc.edg[mqv]; - hc.edg[mqv] = test.dims[dim].size + 1; /* try big edge, should fail */ + hc.edg[mqv] = test_g->dims[dim].size + 1; /* try big edge, should fail */ if (ncvarget(cdfid, iv, hc.cor, hc.edg, hc.vals) != -1) { error("%s: ncvarget should fail for too-high edge", pname); ncclose(cdfid); diff --git a/mfhdf/nctest/vargetg.c b/mfhdf/nctest/vargetg.c index 8d33d7c306..4ad5177f42 100644 --- a/mfhdf/nctest/vargetg.c +++ b/mfhdf/nctest/vargetg.c @@ -55,25 +55,25 @@ test_ncvargetg(char *path) /* find a variable with at least one dimension */ iv = 0; - while (test.vars[iv].ndims <= 0 && iv < test.nvars) + while (test_g->vars[iv].ndims <= 0 && iv < test_g->nvars) iv++; - if (iv < test.nvars) { /* iv is varid of variable with dimensions */ + if (iv < test_g->nvars) { /* iv is varid of variable with dimensions */ long tmp; int id; /* dimension id */ /* set coords and strides */ - for (id = 0; id < test.vars[iv].ndims; id++) { + for (id = 0; id < test_g->vars[iv].ndims; id++) { hc.cor[id] = 0; hc.edg[id] = 1; strides[id] = 1; } /* get space for vals */ - hc.vals = emalloc(nctypelen(test.vars[iv].type) + 8); + hc.vals = emalloc(nctypelen(test_g->vars[iv].type) + 8); #define TEST_FAILS(varid) (ncvarputg(cdfid, varid, hc.cor, hc.edg, strides, (long *)NULL, hc.vals) != -1) - id = test.vars[iv].ndims - 1; + id = test_g->vars[iv].ndims - 1; tmp = hc.cor[id]; hc.cor[id] = -1; /* try negative coordinate, should fail */ if (TEST_FAILS(iv)) { @@ -91,7 +91,7 @@ test_ncvargetg(char *path) } hc.edg[id] = tmp; tmp = hc.cor[id]; - hc.cor[id] = test.dims[id].size; /* try big coordinate, should fail */ + hc.cor[id] = test_g->dims[id].size; /* try big coordinate, should fail */ if (TEST_FAILS(iv)) { error("%s: ncvargetg should fail for too-high coordinate", pname); ncclose(cdfid); @@ -99,7 +99,7 @@ test_ncvargetg(char *path) } hc.cor[id] = tmp; tmp = hc.edg[id]; - hc.edg[id] = test.dims[id].size + 1; /* try big edge, should fail */ + hc.edg[id] = test_g->dims[id].size + 1; /* try big edge, should fail */ if (TEST_FAILS(iv)) { error("%s: ncvargetg should fail for too-high edge", pname); ncclose(cdfid); diff --git a/mfhdf/nctest/varput.c b/mfhdf/nctest/varput.c index a41aee55ed..f7a091fd56 100644 --- a/mfhdf/nctest/varput.c +++ b/mfhdf/nctest/varput.c @@ -62,19 +62,19 @@ test_ncvarput(char *path) /* find a variable with at least one dimension */ iv = 0; - while (test.vars[iv].ndims <= 0 && iv < test.nvars) + while (test_g->vars[iv].ndims <= 0 && iv < test_g->nvars) iv++; - if (iv < test.nvars) { /* iv is first varid of var with dimensions */ + if (iv < test_g->nvars) { /* iv is first varid of var with dimensions */ /* set coords */ - for (id = 0; id < test.vars[iv].ndims; id++) { + for (id = 0; id < test_g->vars[iv].ndims; id++) { hc.cor[id] = 0; hc.edg[id] = 1; } /* fill in vals with value of appropriate type */ - hc.vals = emalloc(nctypelen(test.vars[iv].type)); - val_fill(test.vars[iv].type, 1, hc.vals); + hc.vals = emalloc(nctypelen(test_g->vars[iv].type)); + val_fill(test_g->vars[iv].type, 1, hc.vals); - id = test.vars[iv].ndims - 1; + id = test_g->vars[iv].ndims - 1; tmp = hc.cor[id]; hc.cor[id] = -1; /* try negative coordinate, should fail */ if (ncvarput(cdfid, iv, hc.cor, hc.edg, hc.vals) != -1) { @@ -92,11 +92,11 @@ test_ncvarput(char *path) } hc.edg[id] = tmp; { - long mqv = test.vars[iv].ndims - 1; - int dim = test.vars[iv].dims[mqv]; + long mqv = test_g->vars[iv].ndims - 1; + int dim = test_g->vars[iv].dims[mqv]; tmp = hc.cor[mqv]; - hc.cor[mqv] = test.dims[dim].size; /* try big coordinate, should fail */ + hc.cor[mqv] = test_g->dims[dim].size; /* try big coordinate, should fail */ if (ncvarput(cdfid, iv, hc.cor, hc.edg, hc.vals) != -1) { error("%s: ncvarput should fail for too-high coordinate", pname); ncclose(cdfid); @@ -105,7 +105,7 @@ test_ncvarput(char *path) hc.cor[mqv] = tmp; tmp = hc.edg[mqv]; - hc.edg[mqv] = test.dims[dim].size + 1; /* try big edge, should fail */ + hc.edg[mqv] = test_g->dims[dim].size + 1; /* try big edge, should fail */ if (ncvarput(cdfid, iv, hc.cor, hc.edg, hc.vals) != -1) { error("%s: ncvarput should fail for too-high edge", pname); ncclose(cdfid); diff --git a/mfhdf/nctest/varputg.c b/mfhdf/nctest/varputg.c index 8e7fcbb2d7..713f2b5cba 100644 --- a/mfhdf/nctest/varputg.c +++ b/mfhdf/nctest/varputg.c @@ -60,24 +60,24 @@ test_ncvarputg(char *path) /* find a variable with at least one dimension */ iv = 0; - while (test.vars[iv].ndims <= 0 && iv < test.nvars) + while (test_g->vars[iv].ndims <= 0 && iv < test_g->nvars) iv++; - if (iv < test.nvars) { /* iv is first varid of var with dimensions */ + if (iv < test_g->nvars) { /* iv is first varid of var with dimensions */ /* set coords and strides */ - for (id = 0; id < test.vars[iv].ndims; id++) { + for (id = 0; id < test_g->vars[iv].ndims; id++) { hc.cor[id] = 0; hc.edg[id] = 1; strides[id] = 1; } /* fill in vals with value of appropriate type */ - hc.vals = emalloc(nctypelen(test.vars[iv].type)); - val_fill(test.vars[iv].type, 1, hc.vals); + hc.vals = emalloc(nctypelen(test_g->vars[iv].type)); + val_fill(test_g->vars[iv].type, 1, hc.vals); #define TEST_FAILS(varid) (ncvarputg(cdfid, varid, hc.cor, hc.edg, strides, (long *)NULL, hc.vals) != -1) - id = test.vars[iv].ndims - 1; + id = test_g->vars[iv].ndims - 1; tmp = hc.cor[id]; hc.cor[id] = -1; /* try negative coordinate, should fail */ if (TEST_FAILS(iv)) { @@ -95,7 +95,7 @@ test_ncvarputg(char *path) } hc.edg[id] = tmp; tmp = hc.cor[id]; - hc.cor[id] = test.dims[id].size; /* try big coordinate, should fail */ + hc.cor[id] = test_g->dims[id].size; /* try big coordinate, should fail */ if (TEST_FAILS(iv)) { error("%s: ncvarputg should fail for too-high coordinate", pname); ncclose(cdfid); @@ -103,7 +103,7 @@ test_ncvarputg(char *path) } hc.cor[id] = tmp; tmp = hc.edg[id]; - hc.edg[id] = test.dims[id].size + 1; /* try big edge, should fail */ + hc.edg[id] = test_g->dims[id].size + 1; /* try big edge, should fail */ if (TEST_FAILS(iv)) { error("%s: ncvarputg should fail for too-high edge", pname); ncclose(cdfid); diff --git a/mfhdf/nctest/vartests.c b/mfhdf/nctest/vartests.c index 6a651c2215..336eaeee09 100644 --- a/mfhdf/nctest/vartests.c +++ b/mfhdf/nctest/vartests.c @@ -63,7 +63,7 @@ test_ncvarid(char *path) ncclose(cdfid); return; } - add_var(&test, &xx); /* keep in-memory netcdf in sync */ + add_var(test_g, &xx); /* keep in-memory netcdf in sync */ /* check id returned for name matches id returned from definition */ if (ncvarid(cdfid, xx.name) != varid) { @@ -130,33 +130,33 @@ test_ncvarinq(char *path) /* opened, in data mode */ var.dims = (int *)emalloc(sizeof(int) * H4_MAX_VAR_DIMS); var.name = (char *)emalloc(H4_MAX_NC_NAME); - for (varid = 0; varid < test.nvars; varid++) { /* loop on all var ids */ + for (varid = 0; varid < test_g->nvars; varid++) { /* loop on all var ids */ if (ncvarinq(cdfid, varid, var.name, &var.type, &var.ndims, var.dims, &var.natts) == -1) { error("%s: ncvarinq in data mode failed on var id %d", pname, varid); ncclose(cdfid); return; } /* compare returned with expected values */ - if (strcmp(var.name, test.vars[varid].name) != 0) { + if (strcmp(var.name, test_g->vars[varid].name) != 0) { error("%s: ncvarinq (data mode), name %s, expected %s for id = %d", pname, var.name, - test.vars[varid].name, varid); + test_g->vars[varid].name, varid); nerrs++; } - if (var.type != test.vars[varid].type) { + if (var.type != test_g->vars[varid].type) { error("%s: ncvarinq (data mode), type %d, expected %d for id = %d", pname, var.type, - test.vars[varid].type, varid); + test_g->vars[varid].type, varid); nerrs++; } - if (var.ndims != test.vars[varid].ndims) { + if (var.ndims != test_g->vars[varid].ndims) { error("%s: ncvarinq (data mode), ndims %d, expected %d for id = %d", pname, var.ndims, - test.vars[varid].ndims, varid); + test_g->vars[varid].ndims, varid); nerrs++; } else { /* if ndims OK, compare dims */ for (idim = 0; idim < var.ndims; idim++) - if (var.dims[idim] != test.vars[varid].dims[idim]) { + if (var.dims[idim] != test_g->vars[varid].dims[idim]) { error("%s: ncvarinq (data mode), dims[%d]=%d, expected %d", pname, idim, var.dims[idim], - test.vars[varid].dims[idim]); + test_g->vars[varid].dims[idim]); nerrs++; } } @@ -167,39 +167,39 @@ test_ncvarinq(char *path) return; } /* in define mode, compare returned with expected values again */ - for (varid = 0; varid < test.nvars; varid++) { /* loop on all var ids */ + for (varid = 0; varid < test_g->nvars; varid++) { /* loop on all var ids */ if (ncvarinq(cdfid, varid, var.name, &var.type, &var.ndims, var.dims, &var.natts) == -1) { error("%s: ncvarinq in data mode failed on var id %d", pname, varid); ncclose(cdfid); return; } - if (strcmp(var.name, test.vars[varid].name) != 0) { + if (strcmp(var.name, test_g->vars[varid].name) != 0) { error("%s: ncvarinq (define mode), name %s, expected %s for id = %d", pname, var.name, - test.vars[varid].name, varid); + test_g->vars[varid].name, varid); nerrs++; } - if (var.type != test.vars[varid].type) { + if (var.type != test_g->vars[varid].type) { error("%s: ncvarinq (define mode), type %d, expected %d for id = %d", pname, var.type, - test.vars[varid].type, varid); + test_g->vars[varid].type, varid); nerrs++; } - if (var.ndims != test.vars[varid].ndims) { + if (var.ndims != test_g->vars[varid].ndims) { error("%s: ncvarinq (define mode), ndims %d, expected %d for id = %d", pname, var.ndims, - test.vars[varid].ndims, varid); + test_g->vars[varid].ndims, varid); nerrs++; } else { /* if ndims OK, compare dims */ for (idim = 0; idim < var.ndims; idim++) - if (var.dims[idim] != test.vars[varid].dims[idim]) { + if (var.dims[idim] != test_g->vars[varid].dims[idim]) { error("%s: ncvarinq (define mode), dims[%d]=%d, expected %d", pname, idim, var.dims[idim], - test.vars[varid].dims[idim]); + test_g->vars[varid].dims[idim]); nerrs++; } } } /* try with bad variable handles, check for failure */ if (ncvarinq(cdfid, -1, var.name, &var.type, &var.ndims, var.dims, &var.natts) != -1 || - ncvarinq(cdfid, test.nvars, var.name, &var.type, &var.ndims, var.dims, &var.natts) != -1) { + ncvarinq(cdfid, test_g->nvars, var.name, &var.type, &var.ndims, var.dims, &var.natts) != -1) { error("%s: ncvarinq should have failed on bad variable ids", pname, varid); ncclose(cdfid); return; @@ -214,7 +214,7 @@ test_ncvarinq(char *path) return; } /* should fail, since bad handle */ - if (test.nvars >= 1) { /* if any variables have been defined */ + if (test_g->nvars >= 1) { /* if any variables have been defined */ if (ncvarinq(cdfid, varid, var.name, &var.type, &var.ndims, var.dims, &var.natts) != -1) { error("%s: ncvarinq failed to report bad netcdf handle ", pname); nerrs++; @@ -264,13 +264,13 @@ test_varputget1(int cdfid) float flval; double dbval; - for (iv = 0; iv < test.nvars; iv++) { /* for each var in netcdf */ - for (id = 0; id < test.vars[iv].ndims; id++) { /* set corners */ - int dsize; /* max dimension size, used for u-r corner */ + for (iv = 0; iv < test_g->nvars; iv++) { /* for each var in netcdf */ + for (id = 0; id < test_g->vars[iv].ndims; id++) { /* set corners */ + int dsize; /* max dimension size, used for u-r corner */ /* "lower-left" corner */ elm[0].coords[id] = 0; /* if unlimited dimension, choose record 3 for max, arbitrarily */ - dsize = test.dims[test.vars[iv].dims[id]].size; + dsize = test_g->dims[test_g->vars[iv].dims[id]].size; if (dsize == NC_UNLIMITED) dsize = 3; /* middle */ @@ -278,8 +278,8 @@ test_varputget1(int cdfid) /* "upper-right" corner */ elm[2].coords[id] = dsize - 1; } - for (ie = 0; ie < ne; ie++) { /* for each of ne points */ - switch (test.vars[iv].type) { /* get values of right type to put */ + for (ie = 0; ie < ne; ie++) { /* for each of ne points */ + switch (test_g->vars[iv].type) { /* get values of right type to put */ case NC_BYTE: case NC_CHAR: elm[ie].val.by = (char)(ie + 1); @@ -310,18 +310,18 @@ test_varputget1(int cdfid) error("%s: bad type, test program error", pname); } if (ncvarput1(cdfid, iv, elm[ie].coords, voidp) == -1) { - error("%s: ncvarput1 failed for point %d, variable %s", pname, ie, test.vars[iv].name); + error("%s: ncvarput1 failed for point %d, variable %s", pname, ie, test_g->vars[iv].name); ncclose(cdfid); return 1; } - add_data(&test, iv, elm[ie].coords, edges); /* keep test in sync */ + add_data(test_g, iv, elm[ie].coords, edges); /* keep test in sync */ if (ncvarget1(cdfid, iv, elm[ie].coords, tmpp) == -1) { - error("%s: ncvarget1 failed for point %d, variable %s", pname, ie, test.vars[iv].name); + error("%s: ncvarget1 failed for point %d, variable %s", pname, ie, test_g->vars[iv].name); ncclose(cdfid); return 1; } - switch (test.vars[iv].type) { /* compare values of right type */ + switch (test_g->vars[iv].type) { /* compare values of right type */ case NC_BYTE: case NC_CHAR: if (elm[ie].val.by != chval) { @@ -392,21 +392,22 @@ test_ncvarput1(char *path) /* find a variable with at least one dimension */ iv = 0; - while (test.vars[iv].ndims <= 0 && iv < test.nvars) + while (test_g->vars[iv].ndims <= 0 && iv < test_g->nvars) iv++; - if (iv < test.nvars) { /* iv is varid of variable with dimensions */ + if (iv < test_g->nvars) { /* iv is varid of variable with dimensions */ /* set coords */ int id; /* dimension id */ - for (id = 0; id < test.vars[iv].ndims; id++) + for (id = 0; id < test_g->vars[iv].ndims; id++) elm.coords[id] = 0; /* try invalid coordinates, should fail */ - elm.coords[test.vars[iv].ndims / 2] = -1; + elm.coords[test_g->vars[iv].ndims / 2] = -1; if (ncvarput1(cdfid, iv, elm.coords, (void *)&elm.val) != -1) { error("%s: ncvarput1 should fail for negative coordinate", pname); ncclose(cdfid); return; } - elm.coords[test.vars[iv].ndims / 2] = test.dims[test.vars[iv].dims[test.vars[iv].ndims / 2]].size; + elm.coords[test_g->vars[iv].ndims / 2] = + test_g->dims[test_g->vars[iv].dims[test_g->vars[iv].ndims / 2]].size; if (ncvarput1(cdfid, iv, elm.coords, (void *)&elm.val) != -1) { error("%s: ncvarput1 should fail for too-high coordinate", pname); ncclose(cdfid); @@ -415,7 +416,7 @@ test_ncvarput1(char *path) } /* try with bad variable handle, should fail */ if (ncvarput1(cdfid, -1, elm.coords, (void *)&elm.val) != -1 || - ncvarput1(cdfid, test.nvars, elm.coords, (void *)&elm.val) != -1) { + ncvarput1(cdfid, test_g->nvars, elm.coords, (void *)&elm.val) != -1) { error("%s: ncvarput1 should fail for bad variable handle", pname); ncclose(cdfid); return; @@ -426,7 +427,7 @@ test_ncvarput1(char *path) return; } /* try in define mode, should fail */ - if (test.nvars > 0) + if (test_g->nvars > 0) if (ncvarput1(cdfid, 0, elm.coords, (void *)&elm.val) != -1) { error("%s: ncvarput1 should fail in define mode", pname); ncclose(cdfid); @@ -482,21 +483,22 @@ test_ncvarget1(char *path) /* find a variable with at least one dimension */ iv = 0; - while (test.vars[iv].ndims <= 0 && iv < test.nvars) + while (test_g->vars[iv].ndims <= 0 && iv < test_g->nvars) iv++; - if (iv < test.nvars) { /* iv is varid of variable with dimensions */ + if (iv < test_g->nvars) { /* iv is varid of variable with dimensions */ /* set coords */ int id; /* dimension id */ - for (id = 0; id < test.vars[iv].ndims; id++) + for (id = 0; id < test_g->vars[iv].ndims; id++) elm.coords[id] = 0; /* try invalid coordinates, should fail */ - elm.coords[test.vars[iv].ndims / 2] = -1; + elm.coords[test_g->vars[iv].ndims / 2] = -1; if (ncvarget1(cdfid, iv, elm.coords, (void *)&elm.val) != -1) { error("%s: ncvarget1 should fail for negative coordinate", pname); ncclose(cdfid); return; } - elm.coords[test.vars[iv].ndims / 2] = test.dims[test.vars[iv].dims[test.vars[iv].ndims / 2]].size; + elm.coords[test_g->vars[iv].ndims / 2] = + test_g->dims[test_g->vars[iv].dims[test_g->vars[iv].ndims / 2]].size; if (ncvarget1(cdfid, iv, elm.coords, (void *)&elm.val) != -1) { error("%s: ncvarget1 should fail for too-high coordinate", pname); ncclose(cdfid); @@ -505,7 +507,7 @@ test_ncvarget1(char *path) } /* try with bad variable handle, should fail */ if (ncvarget1(cdfid, -1, elm.coords, (void *)&elm.val) != -1 || - ncvarget1(cdfid, test.nvars, elm.coords, (void *)&elm.val) != -1) { + ncvarget1(cdfid, test_g->nvars, elm.coords, (void *)&elm.val) != -1) { error("%s: ncvarget1 should fail for bad variable handle", pname); ncclose(cdfid); return; @@ -516,7 +518,7 @@ test_ncvarget1(char *path) return; } /* try in define mode, should fail */ - if (test.nvars > 0) + if (test_g->nvars > 0) if (ncvarget1(cdfid, 0, elm.coords, (void *)&elm.val) != -1) { error("%s: ncvarget1 should fail in define mode", pname); ncclose(cdfid); @@ -588,7 +590,7 @@ test_ncvarrename(char *path) ncclose(cdfid); return; } - add_var(&test, &yy); /* keep in-memory netcdf in sync */ + add_var(test_g, &yy); /* keep in-memory netcdf in sync */ zz.dims = (int *)emalloc(sizeof(int) * zz.ndims); for (id = 0; id < zz.ndims; id++) zz.dims[id] = id; @@ -597,7 +599,7 @@ test_ncvarrename(char *path) ncclose(cdfid); return; } - add_var(&test, &zz); /* keep in-memory netcdf in sync */ + add_var(test_g, &zz); /* keep in-memory netcdf in sync */ /* rename first variable */ if (ncvarrename(cdfid, yy_id, newname) == -1) { @@ -626,7 +628,7 @@ test_ncvarrename(char *path) ncclose(cdfid); return; } - (void)strcpy(test.vars[yy_id].name, newname); /* keep test consistent */ + (void)strcpy(test_g->vars[yy_id].name, newname); /* keep test consistent */ /* try to rename second variable same as first, should fail */ if (ncvarrename(cdfid, yy_id, zz.name) != -1) { error("%s: ncvarrename should have failed with used name", pname); @@ -634,7 +636,7 @@ test_ncvarrename(char *path) return; } /* try with bad variable handles, check for failure */ - if (ncvarrename(cdfid, -1, var.name) != -1 || ncvarrename(cdfid, test.nvars, var.name) != -1) { + if (ncvarrename(cdfid, -1, var.name) != -1 || ncvarrename(cdfid, test_g->nvars, var.name) != -1) { error("%s: ncvarrename should have failed on bad variable ids", pname); ncclose(cdfid); return; @@ -655,7 +657,7 @@ test_ncvarrename(char *path) ncclose(cdfid); return; } - (void)strcpy(test.vars[yy_id].name, shortname); /* keep test consistent */ + (void)strcpy(test_g->vars[yy_id].name, shortname); /* keep test consistent */ if (ncclose(cdfid) == -1) { error("%s: ncclose failed", pname); return; diff --git a/mfhdf/nctest/vputget.c b/mfhdf/nctest/vputget.c index c211eb3d7c..0fadd48228 100644 --- a/mfhdf/nctest/vputget.c +++ b/mfhdf/nctest/vputget.c @@ -52,14 +52,14 @@ test_varputget(int cdfid) } hc[3], tmp; /* test hypercubes */ int nel[3]; /* number of elements in hypercube */ - for (iv = 0; iv < test.nvars; iv++) { /* for each var in netcdf */ + for (iv = 0; iv < test_g->nvars; iv++) { /* for each var in netcdf */ for (ie = 0; ie < ne; ie++) nel[ie] = 1; /* to compute space for hypercube values */ - for (id = 0; id < test.vars[iv].ndims; id++) { /* set cubes */ + for (id = 0; id < test_g->vars[iv].ndims; id++) { /* set cubes */ /* max dimension size, 5 for records */ - int dsize = test.dims[test.vars[iv].dims[id]].size; + int dsize = test_g->dims[test_g->vars[iv].dims[id]].size; if (dsize == NC_UNLIMITED) dsize = 5; @@ -81,38 +81,38 @@ test_varputget(int cdfid) for (ie = 0; ie < ne; ie++) { /* for each of ne points */ /* allocate space for the cube of values */ - hc[ie].vals = emalloc(nel[ie] * nctypelen(test.vars[iv].type) + 8); - tmp.vals = emalloc(nel[ie] * nctypelen(test.vars[iv].type) + 8); + hc[ie].vals = emalloc(nel[ie] * nctypelen(test_g->vars[iv].type) + 8); + tmp.vals = emalloc(nel[ie] * nctypelen(test_g->vars[iv].type) + 8); /* fill allocated space with different values of right type */ - val_fill(test.vars[iv].type, nel[ie], hc[ie].vals); + val_fill(test_g->vars[iv].type, nel[ie], hc[ie].vals); if (ncvarput(cdfid, iv, hc[ie].cor, hc[ie].edg, hc[ie].vals) == -1) { - error("%s: ncvarput failed for point %d, variable %s", pname, ie, test.vars[iv].name); + error("%s: ncvarput failed for point %d, variable %s", pname, ie, test_g->vars[iv].name); nerrs++; - errvar(&test, &test.vars[iv]); + errvar(test_g, &test_g->vars[iv]); (void)fprintf(stderr, " corner = ("); - for (id = 0; id < test.vars[iv].ndims; id++) + for (id = 0; id < test_g->vars[iv].ndims; id++) (void)fprintf(stderr, "%d%s", (int)hc[ie].cor[id], - (id < test.vars[iv].ndims - 1) ? ", " : ""); + (id < test_g->vars[iv].ndims - 1) ? ", " : ""); (void)fprintf(stderr, ")\n"); (void)fprintf(stderr, " edge = ("); - for (id = 0; id < test.vars[iv].ndims; id++) + for (id = 0; id < test_g->vars[iv].ndims; id++) (void)fprintf(stderr, "%d%s", (int)hc[ie].edg[id], - (id < test.vars[iv].ndims - 1) ? ", " : ""); + (id < test_g->vars[iv].ndims - 1) ? ", " : ""); (void)fprintf(stderr, ")\n"); } else { - add_data(&test, iv, hc[ie].cor, hc[ie].edg); /* keep test in sync */ + add_data(test_g, iv, hc[ie].cor, hc[ie].edg); /* keep test in sync */ if (ncvarget(cdfid, iv, hc[ie].cor, hc[ie].edg, tmp.vals) == -1) { - error("%s: ncvarget failed for point %d, variable %s", pname, ie, test.vars[iv].name); + error("%s: ncvarget failed for point %d, variable %s", pname, ie, test_g->vars[iv].name); nerrs++; } else { - if (val_cmp(test.vars[iv].type, nel[ie], hc[ie].vals, tmp.vals) != 0) { + if (val_cmp(test_g->vars[iv].type, nel[ie], hc[ie].vals, tmp.vals) != 0) { error("%s: bad values returned from ncvarget", pname); nerrs++; - errvar(&test, &test.vars[iv]); /* describe var */ + errvar(test_g, &test_g->vars[iv]); /* describe var */ } } } diff --git a/mfhdf/nctest/vputgetg.c b/mfhdf/nctest/vputgetg.c index bbecf1684d..0a54331cf9 100644 --- a/mfhdf/nctest/vputgetg.c +++ b/mfhdf/nctest/vputgetg.c @@ -55,7 +55,7 @@ test_varputgetg(int cdfid) long basis[H4_MAX_VAR_DIMS]; /* internal array, element-access basis vector */ - for (iv = 0; iv < test.nvars; iv++) { /* for each var in netcdf */ + for (iv = 0; iv < test_g->nvars; iv++) { /* for each var in netcdf */ long tmpbasis; for (ie = 0; ie < ne; ie++) @@ -67,12 +67,13 @@ test_varputgetg(int cdfid) * dimension. */ #define EXTNPTS(varid, idim) \ - (test.dims[test.vars[varid].dims[id]].size == NC_UNLIMITED ? 5 \ - : test.dims[test.vars[varid].dims[id]].size) + (test_g->dims[test_g->vars[varid].dims[id]].size == NC_UNLIMITED \ + ? 5 \ + : test_g->dims[test_g->vars[varid].dims[id]].size) #define STRIDE(idim) (idim + 2) #define INTNPTS(extnpts, idim) (1 + (extnpts - 1) / STRIDE(idim)) - for (id = 0; id < test.vars[iv].ndims; id++) { /* set cubes */ + for (id = 0; id < test_g->vars[iv].ndims; id++) { /* set cubes */ strides[id] = STRIDE(id); /* start at "lower-left" corner, do whole variable */ @@ -91,67 +92,68 @@ test_varputgetg(int cdfid) nel[2] *= hc[2].edg[id]; } for (ie = 0; ie < ne; ie++) { /* for each of ne points */ - int nelms = nel[ie] * nctypelen(test.vars[iv].type) + 8; + int nelms = nel[ie] * nctypelen(test_g->vars[iv].type) + 8; /* allocate space for the cube of values */ hc[ie].vals = emalloc(nelms); tmp.vals = emalloc(nelms); /* fill allocated space with different values of right type */ - val_fill(test.vars[iv].type, nel[ie], hc[ie].vals); + val_fill(test_g->vars[iv].type, nel[ie], hc[ie].vals); /* * Set internal-array element-access basis vector to be negative * of natural storage so as to access the elements of the array * backwards. */ - tmpbasis = nctypelen(test.vars[iv].type); - for (id = test.vars[iv].ndims - 1; id >= 0; --id) { + tmpbasis = nctypelen(test_g->vars[iv].type); + for (id = test_g->vars[iv].ndims - 1; id >= 0; --id) { basis[id] = -tmpbasis; tmpbasis *= hc[ie].edg[id]; } if (ncvarputg(cdfid, iv, hc[ie].cor, hc[ie].edg, strides, basis, - (char *)hc[ie].vals + (nel[ie] - 1) * nctypelen(test.vars[iv].type)) == -1) { - error("%s: ncvarputg failed for point %d, variable %s", pname, ie, test.vars[iv].name); + (char *)hc[ie].vals + (nel[ie] - 1) * nctypelen(test_g->vars[iv].type)) == -1) { + error("%s: ncvarputg failed for point %d, variable %s", pname, ie, test_g->vars[iv].name); nerrs++; - errvar(&test, &test.vars[iv]); + errvar(test_g, &test_g->vars[iv]); (void)fprintf(stderr, " corner = ("); - for (id = 0; id < test.vars[iv].ndims; id++) + for (id = 0; id < test_g->vars[iv].ndims; id++) (void)fprintf(stderr, "%d%s", (int)hc[ie].cor[id], - (id < test.vars[iv].ndims - 1) ? ", " : ""); + (id < test_g->vars[iv].ndims - 1) ? ", " : ""); (void)fprintf(stderr, ")\n"); (void)fprintf(stderr, " edge = ("); - for (id = 0; id < test.vars[iv].ndims; id++) + for (id = 0; id < test_g->vars[iv].ndims; id++) (void)fprintf(stderr, "%d%s", (int)hc[ie].edg[id], - (id < test.vars[iv].ndims - 1) ? ", " : ""); + (id < test_g->vars[iv].ndims - 1) ? ", " : ""); (void)fprintf(stderr, ")\n"); (void)fprintf(stderr, " external strides = ("); - for (id = 0; id < test.vars[iv].ndims; id++) + for (id = 0; id < test_g->vars[iv].ndims; id++) (void)fprintf(stderr, "%d%s", (int)strides[id], - (id < test.vars[iv].ndims - 1) ? ", " : ""); + (id < test_g->vars[iv].ndims - 1) ? ", " : ""); (void)fprintf(stderr, ")\n"); (void)fprintf(stderr, " internal basis vector = ("); - for (id = 0; id < test.vars[iv].ndims; id++) - (void)fprintf(stderr, "%d%s", (int)basis[id], (id < test.vars[iv].ndims - 1) ? ", " : ""); + for (id = 0; id < test_g->vars[iv].ndims; id++) + (void)fprintf(stderr, "%d%s", (int)basis[id], + (id < test_g->vars[iv].ndims - 1) ? ", " : ""); (void)fprintf(stderr, ")\n"); } else { long dsize[H4_MAX_VAR_DIMS]; - for (id = 0; id < test.vars[iv].ndims; id++) + for (id = 0; id < test_g->vars[iv].ndims; id++) dsize[id] = EXTNPTS(iv, id); - add_data(&test, iv, hc[ie].cor, dsize); + add_data(test_g, iv, hc[ie].cor, dsize); /* keep test in sync */ if (ncvargetg(cdfid, iv, hc[ie].cor, hc[ie].edg, strides, basis, - (char *)tmp.vals + (nel[ie] - 1) * nctypelen(test.vars[iv].type)) == -1) { - error("%s: ncvargetg failed for point %d, variable %s", pname, ie, test.vars[iv].name); + (char *)tmp.vals + (nel[ie] - 1) * nctypelen(test_g->vars[iv].type)) == -1) { + error("%s: ncvargetg failed for point %d, variable %s", pname, ie, test_g->vars[iv].name); nerrs++; } else { - if (val_cmp(test.vars[iv].type, nel[ie], hc[ie].vals, tmp.vals) != 0) { + if (val_cmp(test_g->vars[iv].type, nel[ie], hc[ie].vals, tmp.vals) != 0) { error("%s: bad values returned from ncvargetg", pname); nerrs++; - errvar(&test, &test.vars[iv]); /* describe var */ + errvar(test_g, &test_g->vars[iv]); /* describe var */ } } } From 0730d192725ab9802de2273711857259a889e4fc Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 14 Feb 2024 11:52:04 -0800 Subject: [PATCH 25/65] Fix jpeg test const issue (#533) --- hdf/test/rig.c | 18 ++++++++---------- hdf/test/tusejpegfuncs.c | 33 +++++++++++++++------------------ 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/hdf/test/rig.c b/hdf/test/rig.c index 649b72b919..cba8035cdd 100644 --- a/hdf/test/rig.c +++ b/hdf/test/rig.c @@ -23,7 +23,7 @@ #define JPEGFILE "tjpeg.hdf" #define NONHDF_JPEGFILE "tnonhdf_jpeg.hdf" -static const uint8 jpeg_8bit_orig[JPEGY][JPEGX] = { +static uint8 jpeg_8bit_orig[JPEGY][JPEGX] = { {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, @@ -92,7 +92,7 @@ static const uint8 jpeg_8bit_orig[JPEGY][JPEGX] = { 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}}; -static const uint8 jpeg_8bit_j80[JPEGY][JPEGX] = { +static uint8 jpeg_8bit_j80[JPEGY][JPEGX] = { {200, 200, 200, 200, 200, 200, 200, 200, 202, 202, 201, 201, 201, 200, 200, 200, 201, 201, 200, 200, 200, 201, 202, 202, 202, 202, 201, 200, 200, 200, 200, 201, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, @@ -161,7 +161,7 @@ static const uint8 jpeg_8bit_j80[JPEGY][JPEGX] = { 201, 201, 202, 202, 202, 202, 201, 201, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}}; -static const uint8 jpeg_8bit_j30[JPEGY][JPEGX] = { +static uint8 jpeg_8bit_j30[JPEGY][JPEGX] = { {199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199}, @@ -230,7 +230,7 @@ static const uint8 jpeg_8bit_j30[JPEGY][JPEGX] = { 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, 199}}; -static const uint8 jpeg_8bit_j75[JPEGY][JPEGX] = { +static uint8 jpeg_8bit_j75[JPEGY][JPEGX] = { {200, 200, 200, 200, 200, 200, 200, 200, 198, 198, 198, 199, 199, 200, 200, 200, 202, 202, 200, 199, 199, 199, 199, 200, 199, 199, 200, 201, 201, 201, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}, @@ -299,9 +299,7 @@ static const uint8 jpeg_8bit_j75[JPEGY][JPEGX] = { 201, 201, 202, 202, 202, 202, 201, 201, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200}}; -/* const uint8 jpeg_24bit_orig[JPEGY][JPEGX][3] = - */ -const uint8 jpeg_24bit_orig[JPEGY * JPEGX * 3] = { +static uint8 jpeg_24bit_orig[JPEGY * JPEGX * 3] = { 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, 255, 103, 0, @@ -463,9 +461,9 @@ static void check_im_pal(int32 oldx, int32 oldy, int32 newx, int32 newy, uint8 * /* These two functions are in tusejpegfuncs.c. They use JPEG functions directly to compress and decompress the same data as in test_r24_jpeg, to verify that the DFR24 API work correctly regardless which JPEG library is used */ -intn comp_using_jpeglib(const char *filename, long *file_offset, int im_height, int im_width, int im_ncomps, - int quality, const uint8 *written_buffer); -intn decomp_using_jpeglib(const char *filename, long file_offset, int im_height, int im_width, int im_ncomps, +int comp_using_jpeglib(const char *filename, long *file_offset, int im_height, int im_width, int im_ncomps, + int quality, uint8 *written_buffer); +int decomp_using_jpeglib(const char *filename, long file_offset, int im_height, int im_width, int im_ncomps, uint8 *read_buffer); void test_r24_jpeg(void); diff --git a/hdf/test/tusejpegfuncs.c b/hdf/test/tusejpegfuncs.c index ad62248fd1..eee4dd9938 100644 --- a/hdf/test/tusejpegfuncs.c +++ b/hdf/test/tusejpegfuncs.c @@ -13,7 +13,7 @@ #define HAVE_BOOLEAN #endif -#include "jpeglib.h" +#include #define ABS(x) ((int)(x) < 0 ? (-x) : x) @@ -26,21 +26,19 @@ to the specified file. Return value: The number of errors occurred in this routine. - Apr 11, 2011 -BMR *************************************************************************/ -intn -comp_using_jpeglib(const char *filename, /* file to write compressed data in */ - long *file_offset, /* end offset of previous data and indicating where - to start writing data in this round */ - int im_height, /* image's height */ - int im_width, /* image's width */ - int im_ncomps, /* image's number of components */ - int quality, /* JPEG quality value */ - const uint8 *written_buffer) /* data to be compressed */ +int +comp_using_jpeglib(const char *filename, /* file to write compressed data in */ + long *file_offset, /* end offset of previous data and indicating where + to start writing data in this round */ + int im_height, /* image's height */ + int im_width, /* image's width */ + int im_ncomps, /* image's number of components */ + int quality, /* JPEG quality value */ + uint8 *written_buffer) /* data to be compressed */ { - FILE *outfile; /* target file */ - JSAMPROW row_pointer[1]; /* pointer to JSAMPLE row[s] */ - int row_stride; /* physical row width in image buffer */ + FILE *outfile; /* target file */ + int row_stride; /* physical row width in image buffer */ /* JPEG object for JPEG compression parameters and pointers to working space (which is allocated as needed by the JPEG library). */ @@ -115,8 +113,8 @@ comp_using_jpeglib(const char *filename, /* file to write compressed data * Here the array is only one element long, but you could pass * more than one scanline at a time if that's more convenient. */ - row_pointer[0] = &written_buffer[cinfo.next_scanline * row_stride]; - (void)jpeg_write_scanlines(&cinfo, row_pointer, 1); + JSAMPROW row_pointer = &written_buffer[cinfo.next_scanline * row_stride]; + (void)jpeg_write_scanlines(&cinfo, &row_pointer, 1); } /* Finish compression */ @@ -144,9 +142,8 @@ comp_using_jpeglib(const char *filename, /* file to write compressed data uncompressed data in the provided buffer. Return value: The number of errors occurred in this routine. - Apr 11, 2011 -BMR ****************************************************************************/ -intn +int decomp_using_jpeglib(const char *filename, /* file to read compressed data from */ long file_offset, /* offset in the file to start reading */ int im_height, /* image's height */ From 45df7a2e0f794de557b7f23f8ea1cbc400985daf Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 14 Feb 2024 12:22:18 -0800 Subject: [PATCH 26/65] Fix maybe-uninitialized warnings in hfile.c (#534) --- hdf/src/hfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hdf/src/hfile.c b/hdf/src/hfile.c index cfbc6b41df..19fb2b354b 100644 --- a/hdf/src/hfile.c +++ b/hdf/src/hfile.c @@ -2516,8 +2516,8 @@ static intn HIcheckfileversion(int32 file_id) { filerec_t *file_rec; - uint32 lmajorv, lminorv, lrelease; - uint32 fmajorv, fminorv, frelease; + uint32 lmajorv = 0, lminorv = 0, lrelease = 0; + uint32 fmajorv = 0, fminorv = 0, frelease = 0; char string[LIBVSTR_LEN + 1]; /* len 80+1 */ intn newver = 0; intn ret_value = SUCCEED; From cc34f1c8babab0be1f4027b1838aadf99bbaba96 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 14 Feb 2024 15:28:33 -0800 Subject: [PATCH 27/65] Fix size warnings in hdf/test/bitio.c (#536) --- hdf/test/bitio.c | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/hdf/test/bitio.c b/hdf/test/bitio.c index d4a64961f6..13bb5c9117 100644 --- a/hdf/test/bitio.c +++ b/hdf/test/bitio.c @@ -12,23 +12,8 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - FILE bitio.c Test HDF bit-level I/O routines - - REMARKS - - DESIGN - - BUGS/LIMITATIONS - - EXPORTED ROUTINES - - AUTHOR - Quincey Koziol - - MODIFICATION HISTORY - 10/19/93 - Started coding. */ #include "tproto.h" @@ -37,11 +22,6 @@ #define TESTFILE_NAME "tbitio.hdf" #define DATAFILE_NAME "test_files/bitio.dat" -/* Last ditch attempt to define this value... */ -#ifndef UINT_MAX -#define UINT_MAX (unsigned)(-1) -#endif - #ifndef RAND_MAX #define RAND_MAX (UINT_MAX) #endif @@ -64,9 +44,12 @@ #define BITIO_TAG_3 3500 #define BITIO_REF_3 3500 -static uint8 outbuf[BUFSIZE], inbuf[DATASIZE]; +static uint8 *outbuf = NULL; +static uint8 *inbuf = NULL; -static uint32 outbuf2[BUFSIZE], inbuf2[BUFSIZE], totbits[BUFSIZE]; +static uint32 *outbuf2 = NULL; +static uint32 *inbuf2 = NULL; +static uint32 *totbits = NULL; static uint32 maskbuf[] = {0x00000000, 0x00000001, 0x00000003, 0x00000007, 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff, @@ -402,7 +385,25 @@ test_bitio_seek(void) void test_bitio(void) { + outbuf = (uint8 *)calloc(BUFSIZE, sizeof(uint8)); + inbuf = (uint8 *)calloc(DATASIZE, sizeof(uint8)); + outbuf2 = (uint32 *)calloc(BUFSIZE, sizeof(uint32)); + inbuf2 = (uint32 *)calloc(BUFSIZE, sizeof(uint32)); + totbits = (uint32 *)calloc(BUFSIZE, sizeof(uint32)); + + CHECK_ALLOC(outbuf, "outbuf", "test_bitio"); + CHECK_ALLOC(inbuf, "inbuf", "test_bitio"); + CHECK_ALLOC(outbuf2, "outbuf2", "test_bitio"); + CHECK_ALLOC(inbuf2, "inbuf2", "test_bitio"); + CHECK_ALLOC(totbits, "totbits", "test_bitio"); + test_bitio_read(); test_bitio_write(); test_bitio_seek(); + + free(outbuf); + free(inbuf); + free(outbuf2); + free(inbuf2); + free(totbits); } From 4e4f9e48e4a27a2bab5b67af2c37a07883a05619 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 14 Feb 2024 17:30:40 -0600 Subject: [PATCH 28/65] Add MSYS2 actions to CI using CMake (#535) --- .github/workflows/main.yml | 5 +++ .github/workflows/msys2-cmake.yml | 70 +++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 .github/workflows/msys2-cmake.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index efd7edf0ef..4f8902b83e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,3 +34,8 @@ jobs: uses: ./.github/workflows/cmake.yml if: "!contains(github.event.head_commit.message, 'skip-ci')" + workflow-msys2: + name: "CMake msys2 Workflows" + uses: ./.github/workflows/msys2-cmake.yml + with: + build_mode: "Release" diff --git a/.github/workflows/msys2-cmake.yml b/.github/workflows/msys2-cmake.yml new file mode 100644 index 0000000000..c4b4157738 --- /dev/null +++ b/.github/workflows/msys2-cmake.yml @@ -0,0 +1,70 @@ +name: hdf4 dev CMake MSys2 CI + +# Controls when the action will run. Triggers the workflow on a call +on: + workflow_call: + inputs: + build_mode: + description: "release vs. debug build" + required: true + type: string + +permissions: + contents: read + +jobs: + Msys2_build_and_test: + runs-on: windows-latest + strategy: + matrix: + include: + - { icon: '⬛', sys: mingw32 } + - { icon: '🟦', sys: mingw64 } + - { icon: '🟨', sys: ucrt64 } + - { icon: '🟧', sys: clang64 } + name: ${{ matrix.icon }} MSYS2-${{ matrix.sys }}-${{ inputs.build_mode }} + defaults: + run: + shell: msys2 {0} + steps: + - name: Get Sources + uses: actions/checkout@v4.1.1 + + - name: '${{ matrix.icon }} Setup MSYS2' + uses: msys2/setup-msys2@v2 + with: + msystem: ${{matrix.sys}} + update: true + install: >- + git + make + pacboy: >- + toolchain:p + cmake:p + ninja:p + + - name: CMake Configure + run: | + mkdir "${{ runner.workspace }}/build" + cd "${{ runner.workspace }}/build" + cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} \ + -DCMAKE_TOOLCHAIN_FILE="" \ + -DJPEG_USE_LOCALCONTENT=OFF \ + -DLIBAEC_USE_LOCALCONTENT=OFF \ + -DZLIB_USE_LOCALCONTENT=OFF \ + -DHDF4_BUILD_FORTRAN=OFF \ + -DHDF4_BUILD_JAVA=OFF \ + $GITHUB_WORKSPACE + # BUILD + - name: CMake Build + run: | + cmake --build . --parallel 3 --config ${{ inputs.build_mode }} + working-directory: ${{ runner.workspace }}/build + + # RUN TESTS + - name: CMake Run Tests + run: | + ctest . --parallel 2 -C ${{ inputs.build_mode }} -V -E "HDP-dumpv|h4ex_GR_create|h4ex_GR_write|h4ex_VG_add" + working-directory: ${{ runner.workspace }}/build From 958a77132c961572f48553a83f1551e89478458f Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 14 Feb 2024 16:21:16 -0800 Subject: [PATCH 29/65] Adds CHECK macros to test_file_limits (tfile1.c) (#256) * Adds CHECK macros to test_file_limits (tfile1.c) This test has many issues! This change adds CHECK_VOID macros to inspect the return values from the HDF4 API calls and complain to the test framework when the calls have failed. * Bump the limit of stdio files on Windows --- hdf/test/file1.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/hdf/test/file1.c b/hdf/test/file1.c index b06896f353..c1e49042e6 100644 --- a/hdf/test/file1.c +++ b/hdf/test/file1.c @@ -33,19 +33,28 @@ test_file_limits(void) int i; int32 ret; +#ifdef H4_HAVE_WIN32_API + /* Windows can only have 512 stdio files open by default, so we need + * to bump this to handle BIG files open at once. + */ + ret = _setmaxstdio(1024); + CHECK_VOID(ret, FAIL, "_setmaxstdio"); +#endif + MESSAGE(5, puts("Opening many files of same name");); for (i = 0; i < BIG; i++) { files[i] = Hopen("thf.hdf", DFACC_RDWR, 0); + CHECK_VOID(files[i], FAIL, "Hopen"); if (files[i] < 0) { - /* i++; */ break; - } /* end if */ + } } MESSAGE(5, printf("Opening stopped at %d/%d files\n", i, BIG);); MESSAGE(5, puts("Closing all files");); for (i--; i >= 0; i--) { ret = Hclose(files[i]); + CHECK_VOID(ret, FAIL, "Hclose"); if (ret < 0) printf("Error closing file %d\n", i); } @@ -56,16 +65,17 @@ test_file_limits(void) char fname[100]; sprintf(fname, "%s%1d.hdf", TESTFILE_NAME, i); files[i] = Hopen(fname, DFACC_ALL, 0); + CHECK_VOID(files[i], FAIL, "Hopen"); if (files[i] < 0) { - /* i++; */ break; - } /* end if */ + } } MESSAGE(5, printf("Opening stopped at %d/%d files\n", i, BIG);); MESSAGE(5, puts("Closing all files except first open");); for (i--; i > 0; i--) { ret = Hclose(files[i]); + CHECK_VOID(ret, FAIL, "Hclose"); if (ret < 0) printf("Error closing file %d\n", i); } @@ -74,6 +84,7 @@ test_file_limits(void) MESSAGE(5, puts("Opening write access elements");); for (i = 0; i < BIG; i++) { accs[i] = Hstartwrite(files[0], (uint16)100, (uint16)(i + 1), 100L); + CHECK_VOID(accs[i], FAIL, "Hstartwrite"); if (accs[i] < 0) break; } @@ -82,12 +93,14 @@ test_file_limits(void) MESSAGE(5, puts("Closing access elements");); for (i--; i >= 0; i--) { ret = Hendaccess(accs[i]); + CHECK_VOID(ret, FAIL, "Hendaccess"); if (ret < 0) printf("Error ending access %d\n", i); } MESSAGE(5, puts("Ended access");); ret = Hclose(files[0]); + CHECK_VOID(ret, FAIL, "Hclose"); } /* end test_file_limits() */ #define TAG1 ((uint16)1000) From d243953bbe65d1ecb1985de4ebeaee0046037497 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 14 Feb 2024 20:07:31 -0800 Subject: [PATCH 30/65] Fix several stack/frame size warnings (#537) Converts static 1D arrays to dynamic --- hdf/test/blocks.c | 12 ++++++++- hdf/test/chunks.c | 19 +++++++------ hdf/test/extelt.c | 12 ++++++++- hdf/test/file.c | 12 ++++++++- mfhdf/test/hdftest.c | 64 ++++++++++++++++++++++++-------------------- 5 files changed, 79 insertions(+), 40 deletions(-) diff --git a/hdf/test/blocks.c b/hdf/test/blocks.c index ee78153961..8f09ca2d3f 100644 --- a/hdf/test/blocks.c +++ b/hdf/test/blocks.c @@ -18,7 +18,8 @@ #define HLCONVERT_TAG 1500 -static uint8 outbuf[BUFSIZE], inbuf[BUFSIZE]; +static uint8 *outbuf = NULL; +static uint8 *inbuf = NULL; void test_hblocks(void) @@ -32,6 +33,12 @@ test_hblocks(void) int32 ret; intn errors = 0; + outbuf = (uint8 *)calloc(BUFSIZE, sizeof(uint8)); + inbuf = (uint8 *)calloc(BUFSIZE, sizeof(uint8)); + + CHECK_ALLOC(outbuf, "outbuf", "test_hblocks"); + CHECK_ALLOC(inbuf, "outbuf", "test_hblocks"); + for (i = 0; i < BUFSIZE; i++) outbuf[i] = (uint8)(i % 256); @@ -267,5 +274,8 @@ test_hblocks(void) errors++; } + free(outbuf); + free(inbuf); + num_errs += errors; /* increment global error count */ } diff --git a/hdf/test/chunks.c b/hdf/test/chunks.c index 9c19f8a966..e87b623b48 100644 --- a/hdf/test/chunks.c +++ b/hdf/test/chunks.c @@ -107,10 +107,6 @@ * HMCsetMaxCache() * HMCwriteChunk() * HMCreadChunk() - * - * - * Author -GeorgeV - * */ #include "tproto.h" @@ -120,8 +116,8 @@ #define BUFSIZE 12288 /* Some static data buffers */ -static uint8 outbuf[BUFSIZE], /* output data buffer */ - inbuf[BUFSIZE]; /* input data buffer */ +static uint8 *outbuf = NULL; +static uint8 *inbuf = NULL; /* used to verify data in Test 2. */ static uint8 outbuf_2[16] = {0, 0, 2, 3, 0, 0, 6, 7, 8, 9, 0, 0, 12, 13, 0, 0}; @@ -163,8 +159,6 @@ static uint8 u8_data[2][3][4] = {{{0, 1, 2, 3}, {10, 11, 12, 13}, {20, 21, 22, 2 /* * main entry point to tests the Special Chunking layer... - * - * -GeorgeV */ void test_chunks(void) @@ -194,6 +188,12 @@ test_chunks(void) model_info minfo; intn errors = 0; + outbuf = (uint8 *)calloc(BUFSIZE, sizeof(uint8)); + inbuf = (uint8 *)calloc(BUFSIZE, sizeof(uint8)); + + CHECK_ALLOC(outbuf, "outbuf", "test_chunks"); + CHECK_ALLOC(inbuf, "outbuf", "test_chunks"); + /* initialize out buffer */ for (i = 0; i < BUFSIZE; i++) outbuf[i] = (char)(i % 256); @@ -2197,5 +2197,8 @@ test_chunks(void) /* Don't forget to free dimensions allocate for chunk definition */ free(chunk[0].pdims); + free(outbuf); + free(inbuf); + num_errs += errors; /* increment global error count */ } /* test_chunks() */ diff --git a/hdf/test/extelt.c b/hdf/test/extelt.c index 92da8a5ea8..6a016c377b 100644 --- a/hdf/test/extelt.c +++ b/hdf/test/extelt.c @@ -24,7 +24,8 @@ #define BUF_SIZE 4096 -static uint8 outbuf[BUF_SIZE], inbuf[BUF_SIZE]; +static uint8 *outbuf = NULL; +static uint8 *inbuf = NULL; void test_hextelt(void) @@ -39,6 +40,12 @@ test_hextelt(void) intn errflag = 0; intn errors = 0; + outbuf = (uint8 *)calloc(BUF_SIZE, sizeof(uint8)); + inbuf = (uint8 *)calloc(BUF_SIZE, sizeof(uint8)); + + CHECK_ALLOC(outbuf, "outbuf", "test_hextelt"); + CHECK_ALLOC(inbuf, "outbuf", "test_hextelt"); + /* Initialize buffer */ for (i = 0; i < BUF_SIZE; i++) outbuf[i] = (char)(i % 256); @@ -390,5 +397,8 @@ test_hextelt(void) ret = HXsetdir(NULL); CHECK_VOID(ret, FAIL, "HXsetdir"); + free(outbuf); + free(inbuf); + num_errs += errors; /* increment global error count */ } diff --git a/hdf/test/file.c b/hdf/test/file.c index fe01f27c51..d771fd33e9 100644 --- a/hdf/test/file.c +++ b/hdf/test/file.c @@ -47,7 +47,8 @@ #define TESTFILE_NAME "t.hdf" #define BUF_SIZE 4096 -static uint8 outbuf[BUF_SIZE], inbuf[BUF_SIZE]; +static uint8 *outbuf = NULL; +static uint8 *inbuf = NULL; void test_hfile(void) @@ -62,6 +63,12 @@ test_hfile(void) intn errors = 0; intn ret_bool; + outbuf = (uint8 *)calloc(BUF_SIZE, sizeof(uint8)); + inbuf = (uint8 *)calloc(BUF_SIZE, sizeof(uint8)); + + CHECK_ALLOC(outbuf, "outbuf", "test_hfile"); + CHECK_ALLOC(inbuf, "outbuf", "test_hfile"); + for (i = 0; i < BUF_SIZE; i++) outbuf[i] = (char)(i % 256); @@ -211,4 +218,7 @@ test_hfile(void) ret_bool = (intn)Hishdf("qqqqqqqq.qqq"); /* I sure hope it isn't there */ CHECK_VOID(ret, TRUE, "Hishdf"); + + free(outbuf); + free(inbuf); } diff --git a/mfhdf/test/hdftest.c b/mfhdf/test/hdftest.c index 5e78558d4e..2ddea6fdd4 100644 --- a/mfhdf/test/hdftest.c +++ b/mfhdf/test/hdftest.c @@ -68,38 +68,42 @@ extern int test_att_ann_datainfo(); int main(void) { - int32 f1, f2, fnbit; /* File handles */ - int32 nt; /* Number type */ - int32 dimsize[10]; /* dimension sizes */ - int32 newsds, newsds2, newsds3; /* SDS handles */ - int32 sdsid; /* SDS handle */ - int32 dimid, dimid1, dimid2; /* Dimension handles */ - int32 num_sds; /* number of SDS in file */ - int32 num_gattr; /* Number of global attributes */ - int32 index; /* Index of dataset in file */ - int32 ival; - int32 sdid; /* another SDS handle */ - int32 rank; /* rank of SDS */ - intn status; /* status flag */ - intn nattrs; /* Number of attributes again? */ - char name[90]; - char text[256]; - int32 start[10], end[10], stride[10]; /* start, end, stride arrays */ - int32 scale[10]; - char l[80], u[80], fmt[80], c[80]; - int32 count; - int32 fillval = 0, readval = 0; - int32 idata[100]; - int32 rdata[100]; - int16 sdata[100], outdata[100]; - int32 ndg_saved_ref; /* used to save a ref of an SDS in one of the test */ - uint8 iuval; - float32 data[1000], max, min, imax, imin; - float64 cal, cale, ioff, ioffe; - int num_errs = 0; /* number of errors so far */ + int32 f1, f2, fnbit; /* File handles */ + int32 nt; /* Number type */ + int32 dimsize[10]; /* dimension sizes */ + int32 newsds, newsds2, newsds3; /* SDS handles */ + int32 sdsid; /* SDS handle */ + int32 dimid, dimid1, dimid2; /* Dimension handles */ + int32 num_sds; /* number of SDS in file */ + int32 num_gattr; /* Number of global attributes */ + int32 index; /* Index of dataset in file */ + int32 ival; + int32 sdid; /* another SDS handle */ + int32 rank; /* rank of SDS */ + intn status; /* status flag */ + intn nattrs; /* Number of attributes again? */ + char name[90]; + char text[256]; + int32 start[10], end[10], stride[10]; /* start, end, stride arrays */ + int32 scale[10]; + char l[80], u[80], fmt[80], c[80]; + int32 count; + int32 fillval = 0, readval = 0; + int32 idata[100]; + int32 rdata[100]; + int16 sdata[100], outdata[100]; + int32 ndg_saved_ref; /* used to save a ref of an SDS in one of the test */ + uint8 iuval; + float32 *data = NULL; + float32 max, min, imax, imin; + float64 cal, cale, ioff, ioffe; + int num_errs = 0; /* number of errors so far */ ncopts = NC_VERBOSE; + data = (float32 *)calloc(1000, sizeof(float32)); + CHECK_ALLOC(data, "data", "main"); + /* Testing SDstart */ /* Try start non-existing file with RDONLY and RDWR. Both should fail. */ f1 = SDstart(UFOFILE, DFACC_RDONLY); @@ -1336,6 +1340,8 @@ main(void) /* status = test_sd(); */ /* num_errs = num_errs + status; */ + free(data); + if (num_errs == 0) { printf("*** HDF-SD test passes ***\n"); return EXIT_SUCCESS; From c5add8e07e577d1c3cb142d00b21e041f95c5a24 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Thu, 15 Feb 2024 15:39:46 -0600 Subject: [PATCH 31/65] Delete old snapshot binaries after new snapshots are created (#538) --- .github/workflows/daily-build.yml | 32 ++++++++++++++ .github/workflows/hdfeos2.yml | 2 +- .github/workflows/main-auto.yml | 2 +- .github/workflows/main-cmake-mingw.yml | 2 +- .github/workflows/main-cmake.yml | 1 - .github/workflows/ppc64.yml | 4 +- .github/workflows/remove-files.yml | 58 ++++++++++++++++++++++++++ 7 files changed, 95 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/remove-files.yml diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index a77715b851..e6880f72ef 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -12,6 +12,26 @@ permissions: # A workflow run is made up of one or more jobs that can run sequentially or # in parallel. jobs: + get-old-names: + runs-on: ubuntu-latest + outputs: + hdf4-name: ${{ steps.gethdf4base.outputs.HDF4_NAME_BASE }} + + steps: + - uses: actions/checkout@v4.1.1 + + - name: Get hdf4 release base name + uses: dsaltares/fetch-gh-release-asset@master + with: + version: 'tags/snapshot' + file: 'last-file.txt' + + - name: Read base-name file + id: gethdf4base + run: echo "HDF4_NAME_BASE=$(cat last-file.txt)" >> $GITHUB_OUTPUT + + - run: echo "hdf4 base name is ${{ steps.gethdf4base.outputs.HDF4_NAME_BASE }}." + call-workflow-tarball: uses: ./.github/workflows/tarball.yml with: @@ -52,3 +72,15 @@ jobs: use_environ: snapshots if: ${{ needs.call-workflow-tarball.outputs.has_changes == 'true' }} + call-workflow-remove: +# needs: [get-old-names, call-workflow-tarball, call-workflow-ctest, call-workflow-abi, call-workflow-release] + needs: [get-old-names, call-workflow-tarball, call-workflow-ctest, call-workflow-release] + permissions: + contents: write # In order to allow file deletion + uses: ./.github/workflows/remove-files.yml + with: + file_base: ${{ needs.get-old-names.outputs.hdf4-name }} + use_tag: snapshot + use_environ: snapshots + if: ${{ needs.call-workflow-tarball.outputs.has_changes == 'true' }} + diff --git a/.github/workflows/hdfeos2.yml b/.github/workflows/hdfeos2.yml index d9951a3a31..62ef9aadfa 100644 --- a/.github/workflows/hdfeos2.yml +++ b/.github/workflows/hdfeos2.yml @@ -7,7 +7,7 @@ jobs: name: Build hdfeos runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.1.1 - name: Install Autotools Dependencies (Linux) run: | diff --git a/.github/workflows/main-auto.yml b/.github/workflows/main-auto.yml index 94e65aaaa7..1ca6ec81dc 100644 --- a/.github/workflows/main-auto.yml +++ b/.github/workflows/main-auto.yml @@ -50,7 +50,7 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Get Sources - uses: actions/checkout@v4 + uses: actions/checkout@v4.1.1 # AUTOTOOLS CONFIGURE - name: Autotools Configure diff --git a/.github/workflows/main-cmake-mingw.yml b/.github/workflows/main-cmake-mingw.yml index 1c55852cd5..f7fcc1fce8 100644 --- a/.github/workflows/main-cmake-mingw.yml +++ b/.github/workflows/main-cmake-mingw.yml @@ -52,7 +52,7 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Get Sources - uses: actions/checkout@v4 + uses: actions/checkout@v4.1.1 # # CMAKE CONFIGURE diff --git a/.github/workflows/main-cmake.yml b/.github/workflows/main-cmake.yml index 81b59b9c3d..b6b5a65309 100644 --- a/.github/workflows/main-cmake.yml +++ b/.github/workflows/main-cmake.yml @@ -225,4 +225,3 @@ jobs: path: ${{ runner.workspace }}/build/HDF-*-Darwin.tar.gz if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` if: ${{ (matrix.os == 'macos-13') && (inputs.netcdf == 'true') && (inputs.shared == 'true') }} - diff --git a/.github/workflows/ppc64.yml b/.github/workflows/ppc64.yml index 505683fbc8..669bdba26b 100644 --- a/.github/workflows/ppc64.yml +++ b/.github/workflows/ppc64.yml @@ -18,7 +18,7 @@ jobs: name: Ubuntu PowerPC Autotools steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.1.1 - uses: uraimo/run-on-arch-action@v2 name: Run commands @@ -58,7 +58,7 @@ jobs: name: Ubuntu PowerPC CMake steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.1.1 - uses: uraimo/run-on-arch-action@v2 name: Run commands diff --git a/.github/workflows/remove-files.yml b/.github/workflows/remove-files.yml new file mode 100644 index 0000000000..cdfa063b7a --- /dev/null +++ b/.github/workflows/remove-files.yml @@ -0,0 +1,58 @@ +name: hdf4 dev remove-files + +# Controls when the action will run. Triggers the workflow on a schedule +on: + workflow_call: + inputs: + use_tag: + description: 'Release version tag' + type: string + required: false + default: snapshot + use_environ: + description: 'Environment to locate files' + type: string + required: true + default: snapshots + file_base: + description: "The common base name of the source tarballs" + required: true + type: string + +# Minimal permissions to be inherited by any job that doesn't declare its own permissions +permissions: + contents: read + +# Previous workflows must pass to get here so tag the commit that created the files +jobs: + PreRelease-delfiles: + runs-on: ubuntu-latest + environment: ${{ inputs.use_environ }} + permissions: + contents: write + steps: + - name: Get file base name + id: get-file-base + run: | + FILE_NAME_BASE=$(echo "${{ inputs.file_base }}") + echo "FILE_BASE=$FILE_NAME_BASE" >> $GITHUB_OUTPUT + + - name: PreRelease delete from tag + id: delete_prerelease + if: ${{ (inputs.use_environ == 'snapshots') }} + uses: mknejp/delete-release-assets@v1 + with: + token: ${{ github.token }} + tag: "${{ inputs.use_tag }}" + assets: | + ${{ steps.get-file-base.outputs.FILE_BASE }}.doxygen.zip + ${{ steps.get-file-base.outputs.FILE_BASE }}.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}.zip + ${{ steps.get-file-base.outputs.FILE_BASE }}-osx12.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_gcc.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}-win-vs2022_cl.zip + ${{ steps.get-file-base.outputs.FILE_BASE }}-ubuntu-2204_intel.tar.gz + ${{ steps.get-file-base.outputs.FILE_BASE }}-win-vs2022_intel.zip +# ${{ steps.get-file-base.outputs.FILE_BASE }}-hdf_compat_report.html +# ${{ steps.get-file-base.outputs.FILE_BASE }}-mfhdf_compat_report.html +# ${{ steps.get-file-base.outputs.FILE_BASE }}-java_compat_report.html From 9894425adb4a6f54405156afaaeca98b7b473ac7 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 16 Feb 2024 06:00:42 -0600 Subject: [PATCH 32/65] Correct String FIND for runTest and grepTest (#539) --- CMakeLists.txt | 4 +++ CMakePresets.json | 38 ++++++++++++++++++++++++ HDF4Examples/config/cmake/grepTest.cmake | 17 +++++++---- HDF4Examples/config/cmake/runTest.cmake | 19 ++++++++---- config/cmake-presets/hidden-presets.json | 24 +++++++++++++++ config/cmake/grepTest.cmake | 17 +++++++---- config/cmake/runTest.cmake | 19 ++++++++---- hdf/src/CMakeLists.txt | 12 ++++++++ 8 files changed, 128 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 189f542dfb..7216298bbd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -149,6 +149,7 @@ mark_as_advanced (HDF4_NO_PACKAGES) # Set the core names of all the libraries #----------------------------------------------------------------------------- set (HDF4_SRC_LIB_CORENAME "hdf") +set (HDF4_SRC_LIB_SYM_CORENAME "df") set (HDF4_SRC_FCSTUB_LIB_CORENAME "hdf_fcstub") set (HDF4_SRC_FORTRAN_LIB_CORENAME "hdf_fortran") set (HDF4_MF_LIB_CORENAME "mfhdf") @@ -166,6 +167,7 @@ set (HDF4_JAVA_TEST_LIB_CORENAME "jartest4") # Set the true names of all the libraries if customized by external project #----------------------------------------------------------------------------- set (HDF4_SRC_LIB_NAME "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_SRC_LIB_CORENAME}") +set (HDF4_SRC_LIB_SYM_NAME "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_SRC_LIB_SYM_CORENAME}") set (HDF4_SRC_FCSTUB_LIB_NAME "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_SRC_FCSTUB_LIB_CORENAME}") set (HDF4_SRC_FORTRAN_LIB_NAME "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_SRC_FORTRAN_LIB_CORENAME}") set (HDF4_MF_LIB_NAME "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_MF_LIB_CORENAME}") @@ -183,6 +185,7 @@ set (HDF4_JAVA_TEST_LIB_NAME "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_JAVA_TEST_LIB # Set the target names of all the libraries #----------------------------------------------------------------------------- set (HDF4_SRC_LIB_TARGET "${HDF4_SRC_LIB_CORENAME}-static") +set (HDF4_SRC_LIB_SYM_TARGET "${HDF4_SRC_LIB_SYM_CORENAME}-static") set (HDF4_SRC_FCSTUB_LIB_TARGET "${HDF4_SRC_FCSTUB_LIB_CORENAME}-static") set (HDF4_SRC_FORTRAN_LIB_TARGET "${HDF4_SRC_FORTRAN_LIB_CORENAME}-static") set (HDF4_MF_LIB_TARGET "${HDF4_MF_LIB_CORENAME}-static") @@ -195,6 +198,7 @@ set (HDF4_TOOLS_LIB_TARGET "${HDF4_TOOLS_LIB_CORENAME}-static") set (HDF4_JAVA_JNI_LIB_TARGET "${HDF4_JAVA_JNI_LIB_CORENAME}") set (HDF4_JAVA_HDF_LIB_TARGET "${HDF4_JAVA_HDF_LIB_CORENAME}") set (HDF4_JAVA_TEST_LIB_TARGET "${HDF4_JAVA_TEST_LIB_CORENAME}") +set (HDF4_SRC_LIBSH_SYM_TARGET "${HDF4_SRC_LIB_SYM_CORENAME}-shared") set (HDF4_SRC_LIBSH_TARGET "${HDF4_SRC_LIB_CORENAME}-shared") set (HDF4_SRC_FCSTUB_LIBSH_TARGET "${HDF4_SRC_FCSTUB_LIB_CORENAME}-shared") set (HDF4_SRC_FORTRAN_LIBSH_TARGET "${HDF4_SRC_FORTRAN_LIB_CORENAME}-shared") diff --git a/CMakePresets.json b/CMakePresets.json index e3d2b31e1a..05ce25aefa 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -84,6 +84,26 @@ { "name": "ci-StdShar-GNUC", "description": "GNUC Standard Config for x64 (Release)", + "inherits": [ + "ci-x64-Release-GNUC", + "ci-Fortran", + "ci-Java", + "ci-StdShar" + ] + }, + { + "name": "ci-StdShar-Clang-Fortran", + "description": "Clang Standard Config for x64 (Release)", + "inherits": [ + "ci-x64-Release-Clang", + "ci-Fortran", + "ci-Java", + "ci-StdShar" + ] + }, + { + "name": "ci-StdShar-GNUC-Fortran", + "description": "GNUC Standard Config for x64 (Release)", "inherits": [ "ci-x64-Release-GNUC", "ci-Java", @@ -241,6 +261,15 @@ {"type": "package", "name": "ci-StdShar-Clang"} ] }, + { + "name": "ci-StdShar-Clang-Fortran", + "steps": [ + {"type": "configure", "name": "ci-StdShar-Clang-Fortran"}, + {"type": "build", "name": "ci-StdShar-Clang"}, + {"type": "test", "name": "ci-StdShar-Clang"}, + {"type": "package", "name": "ci-StdShar-Clang"} + ] + }, { "name": "ci-StdShar-OSX-Clang", "steps": [ @@ -259,6 +288,15 @@ {"type": "package", "name": "ci-StdShar-GNUC"} ] }, + { + "name": "ci-StdShar-GNUC-Fortran", + "steps": [ + {"type": "configure", "name": "ci-StdShar-GNUC-Fortran"}, + {"type": "build", "name": "ci-StdShar-GNUC"}, + {"type": "test", "name": "ci-StdShar-GNUC"}, + {"type": "package", "name": "ci-StdShar-GNUC"} + ] + }, { "name": "ci-StdShar-Intel", "steps": [ diff --git a/HDF4Examples/config/cmake/grepTest.cmake b/HDF4Examples/config/cmake/grepTest.cmake index f5d66ee9e1..75ad68b295 100644 --- a/HDF4Examples/config/cmake/grepTest.cmake +++ b/HDF4Examples/config/cmake/grepTest.cmake @@ -61,11 +61,18 @@ message (STATUS "COMMAND Result: ${TEST_RESULT}") message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output -file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT) -if (TEST_FIND_RESULT GREATER -1) - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () + string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () endif () # if the TEST_ERRREF exists grep the error output with the error reference diff --git a/HDF4Examples/config/cmake/runTest.cmake b/HDF4Examples/config/cmake/runTest.cmake index 2deb4ab434..4e48fec8fa 100644 --- a/HDF4Examples/config/cmake/runTest.cmake +++ b/HDF4Examples/config/cmake/runTest.cmake @@ -122,11 +122,18 @@ endif () message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output -file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT) -if (TEST_FIND_RESULT GREATER -1) - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () + string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () endif () # remove special error output @@ -137,7 +144,7 @@ else () # the error stack remains in the .err file file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) endif () -string (FIND TEST_STREAM "no version information available" TEST_FIND_RESULT) +string (FIND "${TEST_STREAM}" "no version information available" TEST_FIND_RESULT) if (TEST_FIND_RESULT GREATER -1) string (REGEX REPLACE "^.*no version information available[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") # write back the changes to the original files diff --git a/config/cmake-presets/hidden-presets.json b/config/cmake-presets/hidden-presets.json index 0e2246812d..eae754e986 100644 --- a/config/cmake-presets/hidden-presets.json +++ b/config/cmake-presets/hidden-presets.json @@ -96,6 +96,30 @@ "strategy": "external" } }, + { + "name": "ci-Fortran", + "hidden": true, + "cacheVariables": { + "HDF4_BUILD_FORTRAN": "ON" + }, + "toolset": { + "value": "host=x64", + "strategy": "external" + } + }, + { + "name": "ci-Fortran-Clang", + "hidden": true, + "inherits": "ci-Fortran", + "cacheVariables": { + "CMAKE_Fortran_COMPILER": {"type": "FILEPATH", "value": "gfortran"} + }, + "condition": { + "type": "matches", + "string": "${presetName}", + "regex": ".*-Clang" + } + }, { "name": "ci-Java", "hidden": true, diff --git a/config/cmake/grepTest.cmake b/config/cmake/grepTest.cmake index f5d66ee9e1..75ad68b295 100644 --- a/config/cmake/grepTest.cmake +++ b/config/cmake/grepTest.cmake @@ -61,11 +61,18 @@ message (STATUS "COMMAND Result: ${TEST_RESULT}") message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output -file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT) -if (TEST_FIND_RESULT GREATER -1) - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () + string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () endif () # if the TEST_ERRREF exists grep the error output with the error reference diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake index 9d2f9fd303..15f24cba8b 100644 --- a/config/cmake/runTest.cmake +++ b/config/cmake/runTest.cmake @@ -122,11 +122,18 @@ endif () message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output -file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (FIND TEST_STREAM "_pmi_alps" TEST_FIND_RESULT) -if (TEST_FIND_RESULT GREATER -1) - string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () + string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT) + if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) + endif () endif () # remove special error output @@ -137,7 +144,7 @@ else () # the error stack remains in the .err file file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) endif () -string (FIND TEST_STREAM "no version information available" TEST_FIND_RESULT) +string (FIND "${TEST_STREAM}" "no version information available" TEST_FIND_RESULT) if (TEST_FIND_RESULT GREATER -1) string (REGEX REPLACE "^.*no version information available[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") # write back the changes to the original files diff --git a/hdf/src/CMakeLists.txt b/hdf/src/CMakeLists.txt index 9449ed2f17..e164b5ef8c 100644 --- a/hdf/src/CMakeLists.txt +++ b/hdf/src/CMakeLists.txt @@ -136,6 +136,12 @@ if (NOT ONLY_SHARED_LIBS) INTERFACE_INCLUDE_DIRECTORIES "$/include>" ) set (install_targets ${HDF4_SRC_LIB_TARGET}) +# +# add_custom_command(TARGET ${HDF4_SRC_LIB_TARGET} +# COMMAND ${CMAKE_COMMAND} -E create_symlink $ $ +# DEPENDS $ +# ) +# set (install_targets ${install_targets} ${HDF4_SRC_LIB_SYM_TARGET}) endif () if (BUILD_SHARED_LIBS) @@ -161,6 +167,12 @@ if (BUILD_SHARED_LIBS) INTERFACE_COMPILE_DEFINITIONS H4_BUILT_AS_DYNAMIC_LIB=1 ) set (install_targets ${install_targets} ${HDF4_SRC_LIBSH_TARGET}) +# +# add_custom_command(TARGET ${HDF4_SRC_LIBSH_TARGET} +# COMMAND ${CMAKE_COMMAND} -E create_symlink $ $ +# DEPENDS $ +# ) +# set (install_targets ${install_targets} ${HDF4_SRC_LIBSH_SYM_TARGET}) endif () #----------------------------------------------------------------------------- From 9f83fca088622f38edd3d94f8048c0798ca151b6 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 16 Feb 2024 12:44:34 -0800 Subject: [PATCH 33/65] Move XDR licence info to COPYING (#540) --- COPYING | 37 +++++++++++++++++++ mfhdf/libsrc/xdr_NOTICE.h | 28 --------------- mfhdf/libsrc/xdr_README | 75 --------------------------------------- 3 files changed, 37 insertions(+), 103 deletions(-) delete mode 100644 mfhdf/libsrc/xdr_NOTICE.h delete mode 100644 mfhdf/libsrc/xdr_README diff --git a/COPYING b/COPYING index 50fad56a21..f68a28e10e 100644 --- a/COPYING +++ b/COPYING @@ -55,3 +55,40 @@ and Digital Equipment Corporation (DEC). --------------------------------------------------------------------------- +--------------------------------------------------------------------------- +--------------------------------------------------------------------------- + +3rd-party software included in HDF4: XDR + +HDF4 builds the Sun RPC version of XDR as an internal 3rd-party I/O +library under this license: + + Sun RPC is a product of Sun Microsystems, Inc. and is provided for + unrestricted use provided that this legend is included on all tape + media and as a part of the software program in whole or part. Users + may copy or modify Sun RPC without charge, but are not authorized + to license or distribute it to anyone else except as part of a product or + program developed by the user. + + SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE + WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. + + Sun RPC is provided with no support and without any obligation on the + part of Sun Microsystems, Inc. to assist in its use, correction, + modification or enhancement. + + SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE + INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC + OR ANY PART THEREOF. + + In no event will Sun Microsystems, Inc. be liable for any lost revenue + or profits or other special, indirect and consequential damages, even if + Sun has been advised of the possibility of such damages. + + Sun Microsystems, Inc. + 2550 Garcia Avenue + Mountain View, California 94043 + +--------------------------------------------------------------------------- + diff --git a/mfhdf/libsrc/xdr_NOTICE.h b/mfhdf/libsrc/xdr_NOTICE.h deleted file mode 100644 index 6f796c8a8c..0000000000 --- a/mfhdf/libsrc/xdr_NOTICE.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Sun RPC is a product of Sun Microsystems, Inc. and is provided for - * unrestricted use provided that this legend is included on all tape - * media and as a part of the software program in whole or part. Users - * may copy or modify Sun RPC without charge, but are not authorized - * to license or distribute it to anyone else except as part of a product or - * program developed by the user. - * - * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE - * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * - * Sun RPC is provided with no support and without any obligation on the - * part of Sun Microsystems, Inc. to assist in its use, correction, - * modification or enhancement. - * - * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE - * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC - * OR ANY PART THEREOF. - * - * In no event will Sun Microsystems, Inc. be liable for any lost revenue - * or profits or other special, indirect and consequential damages, even if - * Sun has been advised of the possibility of such damages. - * - * Sun Microsystems, Inc. - * 2550 Garcia Avenue - * Mountain View, California 94043 - */ diff --git a/mfhdf/libsrc/xdr_README b/mfhdf/libsrc/xdr_README deleted file mode 100644 index 758452eb78..0000000000 --- a/mfhdf/libsrc/xdr_README +++ /dev/null @@ -1,75 +0,0 @@ - -Mon Apr 17 18:40:07 MDT 1989 - -This directory contains materials copyrighted by Sun Microsystems, Inc. -Please read "NOTICE.h" - -This is the minimum subset of RPCSRC 3.9 needed to build the netcdf library. -It is included here for those systems which lack xdr support. -If your system already has these xdr routines, by all means use them. -Unix systems which support the Network File System (NFS) usually have these -routines in the 'c' library, /usr/lib/libc.a, -so you don't need to link in any additional libraries. -Another candididate is librpclib.a in /usr/lib or /usr/local/lib. - -The complete RPCSRC distribution may be obtained from Sun or -from the sun-spots archive at rice.edu. - -If you must build this portion of the system, make xdrtest. -Running it should produce output like the contents of -testout.sav on standard output. -N.B **** For the double precision numbers, the last three -decimal digits will vary between vaxes and ieee machines. ***** -Running xdrtest will also produce the file "test.xdr". -Once standard out looks good, then do a binary comparison of the -files "test.xdr" and "test_xdr.sav". -(On unix you enter, 'cmp test.xdr test_xdr.sav'). -If the files are byte for byte identical, you are okay. - - -On VAX/VMS, you WILL probably have to build this directory. -The following files are only used on vms: - descrip.mms - The immoral equivalent of a Makefile - htonl.mar - 'Host To Network Long', in VAX Macro - ntohl.mar - 'Network To Host Long', in VAX Macro -Because the stdio implementation in vax C runtime library is so poor, -this code runs 3 times slower on vms than under Ultrix on the same -Microvax. If someone were very civic minded they would rewrite the -file xdrstdio.c as xdr_qio.c. (This is not as bad as it sounds, -the similar thing has already been done for MacOS Toolbox calls.) -The file netcdf/src/file.c would also need to be changed ... -Otherwise, hammer on DEC to get there C language support together. - - -Notes: - -Fri Sep 23 10:11:14 MDT 1988 - -The return value of xdr_getpos and the corresponding argument to xdr_setpos -changed from 'u_int' to 'u_long' (fpos_t??) in anticipation of problems -on micros where sizeof(int) < sizeof(long). OK with Steve Nahm at sun. - - -Thu Mar 9 22:23:00 MDT 1989 - -Added support for architectures where sizeof(enum) == sizeof(char) -in xdr.c:xdr_enum. Note that, as written this is a runtime !?! check... - - -Mon Apr 17 15:08:05 MDT 1989 - -The Iris computers seem to put the xdr routines in /usr/lib/libsun.a. -EG, you don't need to build the ones here. -You may have to muck around to get the include files right on an iris. -Also may need libbsd.a. - - -Wed Apr 26 19:48:46 MDT 1989 - -Fix to xdr_float.c:xdr_float:"#ifdef vax" to handle values less than -2^^-127 properly. - - -May 1989 - -Added MIPSEL #ifdef for ieee, byte swapped machines like DECstations. From fedd6090a0d49bd916ba683f5d3903c1b4049cb6 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 16 Feb 2024 15:00:41 -0800 Subject: [PATCH 34/65] Ensure that java requires shared in Autotools (#541) The Autotools checked for Java before checking static/shared, which allowed Java to be configured with static-only builds. This reorders the Java and static/shared checks to ensure that Java cannot be configured without shared libraries. --- configure.ac | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/configure.ac b/configure.ac index 3919fc2c02..657922bdbb 100644 --- a/configure.ac +++ b/configure.ac @@ -328,6 +328,20 @@ esac AM_CONDITIONAL([HDF_BUILD_FORTRAN], [test "X$BUILD_FORTRAN" = "Xyes"]) AC_SUBST([BUILD_FORTRAN]) +## ------------------------------------------------------------------------- +## Build static libraries by default. Furthermore, fortran shared libraries +## are unsupported. Disallow a user from enabling both shared libraries and +## fortran. +if test "X${enable_shared}" != "Xyes"; then + enable_shared="no" +fi + +if test "X${enable_shared}" = "Xyes"; then + if test "X${BUILD_FORTRAN}" = "Xyes"; then + AC_MSG_ERROR([Cannot build shared fortran libraries. Please configure with --disable-fortran flag.]) + fi +fi + ## ---------------------------------------------------------------------- ## Check if they would like the Java native interface (JNI) compiled ## @@ -386,23 +400,8 @@ else AC_MSG_RESULT([no]) fi -## ------------------------------------------------------------------------- -## Build static libraries by default. Furthermore, fortran shared libraries -## are unsupported. Disallow a user from enabling both shared libraries and -## fortran. -if test "X${enable_shared}" != "Xyes"; then - enable_shared="no" -fi - -if test "X${enable_shared}" = "Xyes"; then - if test "X${BUILD_FORTRAN}" = "Xyes"; then - AC_MSG_ERROR([Cannot build shared fortran libraries. Please configure with --disable-fortran flag.]) - fi -fi - AC_PROG_LN_S - ## ---------------------------------------------------------------------- ## Check which archiving tool to use. This needs to be done before ## the LT_INIT macro. From ae4d6d231491ae1c94340cfd8b3e72e1a503a23c Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 16 Feb 2024 22:46:28 -0800 Subject: [PATCH 35/65] Lower BIG value in hdf/test/file1.c (#543) The number of open files via stdio calls is often capped by the OS/libc so we need to lower this to a level that doesn't cause problems. --- hdf/test/file1.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hdf/test/file1.c b/hdf/test/file1.c index c1e49042e6..ddbfd40de2 100644 --- a/hdf/test/file1.c +++ b/hdf/test/file1.c @@ -17,7 +17,14 @@ #include "tproto.h" #include "hfile.h" -#define BIG 600 + +/* This value can cause platform-specific problems as the number of files + * that can be open at one time via fopen() is often capped by the OS. + * + * The current value doesn't seem to cause problems on any platform. + */ +#define BIG 127 + #define TESTFILE_NAME "thf" #define TESTREF_NAME "tref.hdf" #define MAX_REF_TESTED MAX_REF @@ -35,7 +42,10 @@ test_file_limits(void) #ifdef H4_HAVE_WIN32_API /* Windows can only have 512 stdio files open by default, so we need - * to bump this to handle BIG files open at once. + * to bump this to handle large values for BIG files open at once. + * + * Technically no longer necessary since BIG was adjusted to < 512, but + * worth keeping around in case we need to set this in the future. */ ret = _setmaxstdio(1024); CHECK_VOID(ret, FAIL, "_setmaxstdio"); From 842705a8f4058395b4afd3c17699bdf01ed70178 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Sat, 17 Feb 2024 13:08:39 -0800 Subject: [PATCH 36/65] Fix encoder detection w/ --with-szlib & no paths (#548) The Autotools --with-szlib option did not correctly detect the presence of the encoder due to a mis-named variable. When enabled, a missing variable would cause the dumper tests to fail due to picking the non-szip file for output diffs. This is fixed now, and --with-szlib works as expected. Also cleans up some szip-related warnings. --- configure.ac | 4 +++- mfhdf/test/tszip.c | 20 ++++++++++---------- release_notes/RELEASE.txt | 10 ++++++++++ 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index 657922bdbb..7d73fb557b 100644 --- a/configure.ac +++ b/configure.ac @@ -756,12 +756,14 @@ case "X-$withval" in X-yes) HAVE_SZIP="yes" AC_CHECK_HEADERS([szlib.h], [HAVE_SZLIB_H="yes"], [unset HAVE_SZIP]) - if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then + if test "x$HAVE_SZIP" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, [unset HAVE_SZIP]) fi if test -z "$HAVE_SZIP"; then AC_MSG_ERROR([couldn't find szlib library]) + else + USE_COMP_SZIP="yes" fi ;; X-|X-no|X-none) diff --git a/mfhdf/test/tszip.c b/mfhdf/test/tszip.c index bacf978108..193613811e 100644 --- a/mfhdf/test/tszip.c +++ b/mfhdf/test/tszip.c @@ -834,8 +834,8 @@ test_szip_chunk() for (j = 0; j < CLENGTH; j++) { for (i = 0; i < CWIDTH; i++) { if (chunk_out[j][i] != chunk4[j][i]) { - fprintf(stderr, "Bogus val in loc [%d][%d] in chunk #4, want %ld got %ld\n", j, i, - chunk4[j][i], chunk_out[j][i]); + fprintf(stderr, "Bogus val in loc [%d][%d] in chunk #4, want %d got %d\n", j, i, chunk4[j][i], + chunk_out[j][i]); num_errs++; } } @@ -852,8 +852,8 @@ test_szip_chunk() for (j = 0; j < CLENGTH; j++) { for (i = 0; i < CWIDTH; i++) if (chunk_out[j][i] != chunk5[j][i]) { - fprintf(stderr, "Bogus val in loc [%d][%d] in chunk #5, want %ld got %ld\n", j, i, - chunk5[j][i], chunk_out[j][i]); + fprintf(stderr, "Bogus val in loc [%d][%d] in chunk #5, want %d got %d\n", j, i, chunk5[j][i], + chunk_out[j][i]); num_errs++; } } @@ -885,9 +885,6 @@ test_szip_chunk() #define CHK_DIM1 2 /* second dimension of the chunk */ #define CHK_DIM2 2 /* third dimension of the chunk */ -int16 all_data[SDS_DIM0][SDS_DIM1][SDS_DIM2]; -int16 out_data[SDS_DIM0][SDS_DIM1][SDS_DIM2]; - static intn test_szip_chunk_3d() { @@ -903,8 +900,11 @@ test_szip_chunk_3d() int16 fill_value = 0; /* Fill value */ comp_coder_t comp_type; /* to retrieve compression type into */ comp_info cinfo; /* compression information structure */ - int num_errs = 0; /* number of errors so far */ - int i, j, k; + int16 all_data[SDS_DIM0][SDS_DIM1][SDS_DIM2]; + int16 out_data[SDS_DIM0][SDS_DIM1][SDS_DIM2]; + + int num_errs = 0; /* number of errors so far */ + int i, j, k; for (i = 0; i < SDS_DIM0; i++) { for (j = 0; j < SDS_DIM1; j++) { @@ -1024,7 +1024,7 @@ test_szip_chunk_3d() for (j = 0; j < SDS_DIM1; j++) { for (k = 0; k < SDS_DIM2; k++) { if (out_data[i][j][k] != all_data[i][j][k]) { - fprintf(stderr, "Bogus val in loc [%d][%d][%d] want %ld got %ld\n", i, j, k, + fprintf(stderr, "Bogus val in loc [%d][%d][%d] want %d got %d\n", i, j, k, out_data[i][j][k], all_data[i][j][k]); num_errs++; } diff --git a/release_notes/RELEASE.txt b/release_notes/RELEASE.txt index 932d86cd1d..888b817827 100644 --- a/release_notes/RELEASE.txt +++ b/release_notes/RELEASE.txt @@ -156,6 +156,16 @@ Support for new platforms and compilers Bugs fixed since HDF 4.2.16 =========================== + - Fix --with-szlib with no paths not detecting the encoder + + The --with-szlib option in the Autotools has been broken when used + without include/library paths for the past decade (git blame says 11 + years ago). A misnamed variable and a missing setting would skip + the encoder check, so the library could only be added in decode-only + mode. + + This has been fixed and szip encoding will now be detected normally. + - Fixed an external file bug introduced in 4.2.16 Fixing HDFFR-1607 introduced a bug where the flag that indicates whether From dc4119149963d4a5f78d5e4539e36da281c42b87 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Sat, 17 Feb 2024 13:09:15 -0800 Subject: [PATCH 37/65] Fix clang warnings (#542) * String casts in hdf/src/dfsd.c * Unused variables * Possible unset variables in hdf/test/mgr.c * Ambiguous braces --- hdf/src/dfsd.c | 10 ++-------- hdf/src/dfunjpeg.c | 8 +++----- hdf/test/mgr.c | 4 ++++ hdf/util/gif2hdf.c | 3 +-- mfhdf/hdfimport/hdfimport.c | 6 ++++-- mfhdf/libsrc/putget.c | 19 ++++++++++--------- mfhdf/test/tncvargetfill.c | 5 ----- 7 files changed, 24 insertions(+), 31 deletions(-) diff --git a/hdf/src/dfsd.c b/hdf/src/dfsd.c index 09cbffcdfa..49a9880227 100644 --- a/hdf/src/dfsd.c +++ b/hdf/src/dfsd.c @@ -2824,7 +2824,7 @@ DFSDIputndg(int32 file_id, uint16 ref, DFSsdg *sdg) /* if dataluf non-NULL, set up to write */ if (sdg->dataluf[luf] && sdg->dataluf[luf][0]) { strcpy((char *)bufp, sdg->dataluf[luf]); - bufp += strlen(bufp) + 1; + bufp += strlen((char *)bufp) + 1; } else { /* dataluf NULL */ *bufp++ = '\0'; @@ -2834,7 +2834,7 @@ DFSDIputndg(int32 file_id, uint16 ref, DFSsdg *sdg) for (i = 0; i < sdg->rank; i++) { if (sdg->dimluf[luf] && sdg->dimluf[luf][i] && sdg->dimluf[luf][i][0]) { /* dimluf not NULL */ strcpy((char *)bufp, sdg->dimluf[luf][i]); - bufp += strlen(bufp) + 1; + bufp += strlen((char *)bufp) + 1; } else { /* dimluf NULL */ *bufp++ = '\0'; @@ -4660,7 +4660,6 @@ DFSDwriteslab(int32 start[], int32 stride[], int32 count[], void *data) int32 fileNTsize; /* size of this NT in the file */ int32 localNTsize; /* size of this NT as it occurs in this machine */ int32 numelements; /* number of floats to read at once */ - int32 sdgsize; /* number of bytes to be written in the SDG */ int32 rowsize; /* number of bytes to be written at once */ /* in the hyperslab */ int32 fileoffset; /* offset into the current dataset in the file */ @@ -4717,11 +4716,6 @@ DFSDwriteslab(int32 start[], int32 stride[], int32 count[], void *data) fileNTsize = DFKNTsize(numtype); fileNT = Writesdg.filenumsubclass; - /* Calculate total bytes in SDS that can be written */ - sdgsize = fileNTsize; - for (i = 0; i < Writesdg.rank; i++) - sdgsize *= Writesdg.dimsizes[i]; - /* Set Access Id */ aid = Writesdg.aid; diff --git a/hdf/src/dfunjpeg.c b/hdf/src/dfunjpeg.c index ea9f2d21af..799a4e19b2 100644 --- a/hdf/src/dfunjpeg.c +++ b/hdf/src/dfunjpeg.c @@ -310,7 +310,7 @@ DFCIunjpeg(int32 file_id, uint16 tag, uint16 ref, void *image, int32 xdim, int32 */ struct jpeg_decompress_struct *cinfo_ptr; struct jpeg_error_mgr *jerr_ptr; - JDIMENSION lines_read, lines_left; + JDIMENSION lines_read; JSAMPARRAY buffer; if ((cinfo_ptr = calloc(1, sizeof(struct jpeg_decompress_struct))) == NULL) @@ -335,14 +335,12 @@ DFCIunjpeg(int32 file_id, uint16 tag, uint16 ref, void *image, int32 xdim, int32 jpeg_start_decompress(cinfo_ptr); /* read the whole image in */ - lines_left = (JDIMENSION)ydim; while (cinfo_ptr->output_scanline < cinfo_ptr->output_height) { buffer = (JSAMPARRAY)ℑ lines_read = jpeg_read_scanlines(cinfo_ptr, buffer, 1); - lines_left -= lines_read; - image = (char *)image + + image = (char *)image + ((size_t)cinfo_ptr->output_width * (size_t)cinfo_ptr->output_components * lines_read); - } /* end while */ + } /* Finish reading stuff in */ jpeg_finish_decompress(cinfo_ptr); diff --git a/hdf/test/mgr.c b/hdf/test/mgr.c index c65cbc3f2e..1953c3cbea 100644 --- a/hdf/test/mgr.c +++ b/hdf/test/mgr.c @@ -4513,6 +4513,9 @@ test_mgr_chunkwr_pixel(int flag) /********************** End of variable declaration **********************/ i = flag; + + memset(&chunk_def, 0, sizeof(HDF_CHUNK_DEF)); + /* * Create and open the file. */ @@ -4576,6 +4579,7 @@ test_mgr_chunkwr_pixel(int flag) break; } default: { + comp_flag = HDF_NONE; printf("Error\n"); break; } diff --git a/hdf/util/gif2hdf.c b/hdf/util/gif2hdf.c index f68c330cb7..0fbbf6ac3c 100644 --- a/hdf/util/gif2hdf.c +++ b/hdf/util/gif2hdf.c @@ -21,8 +21,7 @@ int main(int argv, char *argc[]) { - GIFTOMEM GifMemoryStruct; - GIFIMAGEDESC gifImageDesc; + GIFTOMEM GifMemoryStruct; FILE *fpGif; int32 i; diff --git a/mfhdf/hdfimport/hdfimport.c b/mfhdf/hdfimport/hdfimport.c index 5082ff5e2a..5af88669ba 100644 --- a/mfhdf/hdfimport/hdfimport.c +++ b/mfhdf/hdfimport/hdfimport.c @@ -1731,13 +1731,15 @@ gtype(char *infile, struct Input *in, FILE **strm) else { if (!memcmp("FP64", buf, 4) || !memcmp("fp64", buf, 4)) { in->is_fp64 = TRUE; - if (in->outtype != FP_64) + if (in->outtype != FP_64) { if (in->outtype != NO_NE) { fprintf(stderr, err4, infile); goto err; } - else + else { in->outtype = FP_32; + } + } } else { if (in->outtype != NO_NE) { diff --git a/mfhdf/libsrc/putget.c b/mfhdf/libsrc/putget.c index 3e7179b7d7..d2db533d65 100644 --- a/mfhdf/libsrc/putget.c +++ b/mfhdf/libsrc/putget.c @@ -1806,31 +1806,32 @@ ncvarput(int cdfid, int varid, const long *start, const long *edges, ncvoid *val int NC_fill_buffer(NC *handle, int varid, const long *edges, void *values) { - NC_var *vp; - NC_attr **attr; + NC_var *vp = NULL; + NC_attr **attr = NULL; unsigned long buf_size; - int ii; /* Find the variable structure */ if (handle->vars == NULL) - return (-1); + return -1; vp = NC_hlookupvar(handle, varid); if (vp == NULL) - return (-1); + return -1; /* Compute the size of the buffer using the edges */ buf_size = 1; - for (ii = 0; ii < vp->assoc->count; ii++) + for (int ii = 0; ii < vp->assoc->count; ii++) buf_size = buf_size * edges[ii]; /* Find user-defined fill-value and fill the buffer with it */ attr = NC_findattr(&vp->attrs, _FillValue); if (attr != NULL) - if (HDmemfill(values, (*attr)->data->values, vp->szof, buf_size) == NULL) - return (-1); + if (HDmemfill(values, (*attr)->data->values, vp->szof, buf_size) == NULL) { + return -1; + } /* If no user-defined fill-value, fill the buffer with default fill-value */ - else + else { NC_arrayfill(values, buf_size * vp->szof, vp->type); + } return 0; } diff --git a/mfhdf/test/tncvargetfill.c b/mfhdf/test/tncvargetfill.c index af1e03b050..975c4c3b29 100644 --- a/mfhdf/test/tncvargetfill.c +++ b/mfhdf/test/tncvargetfill.c @@ -166,8 +166,6 @@ test_1dim_multivars() /* result data to compare against read data */ int16 sdresult1[] = {300, 301, 302, 303, -1, -1, 306, 307}; int16 sdresult2[] = {102, 104}; - int16 ncresult1[] = {300, 301, 302, 303, -1, -1, 306, 307}; /* same as sd result */ - int16 ncresult2[] = {102, 104, -2, -2, -2, -2, -2, -2}; /* Create a new file */ fid = SDstart(FILENAME1, DFACC_CREATE); @@ -678,9 +676,6 @@ test_readings(long max_numrecs) /* data resulted from reading at start=[4,0,0] for edges=[6,1,1] */ int16 result3D_start400_edge611[6] = {-3, -3, -3, 800, -3, -3}; - /* data resulted from reading at start=[4] for edges=[6] */ - int16 result1D_start4_edge6[] = {302, 303, -1, -1, -1, -1}; - /* Open the file for reading and writing with nc API */ ncid = ncopen(FILENAME2, NC_RDWR); CHECK(ncid, -1, "ncopen"); From adab3c4aff19db4f31668e2eec3d933a36801183 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Sat, 17 Feb 2024 13:09:30 -0800 Subject: [PATCH 38/65] Fix memory leaks in HDF Editor (#547) --- hdf/util/he_cntrl.c | 17 ++++++++++------- hdf/util/he_main.c | 10 +++++++--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/hdf/util/he_cntrl.c b/hdf/util/he_cntrl.c index 5e10f32ae1..438531f3ec 100644 --- a/hdf/util/he_cntrl.c +++ b/hdf/util/he_cntrl.c @@ -936,8 +936,9 @@ getLine(char *p) char * nextWord(char **p) { - char *word; - char *s, *q; + char *word = NULL; + char *s = NULL; + char *q = NULL; unsigned len; q = *p; @@ -1267,15 +1268,16 @@ parsePred(int argc, char *argv[]) int predNum = -1; int state = 0; int key = 0; - int i; - char *s; - char *tok; pred = (HE_PRED *)calloc(HE_PRED_SZ, sizeof(HE_PRED)); - for (i = 1; i < argc; i++) { - s = argv[i]; + for (int i = 1; i < argc; i++) { + + char *s = argv[i]; + while (*s) { + char *tok = NULL; + if (state != 2) tok = nextToken(&s); else @@ -1330,6 +1332,7 @@ parsePred(int argc, char *argv[]) pred[predNum].arg.str = copyStr(tok); } state = 0; + free(tok); break; default: diff --git a/hdf/util/he_main.c b/hdf/util/he_main.c index 3bcba2dc04..eb11b66bba 100644 --- a/hdf/util/he_main.c +++ b/hdf/util/he_main.c @@ -280,10 +280,14 @@ backupName(const char *file) int backupFile(char *file) { - char *back; /* backup file name */ + char *back = NULL; /* backup file name */ + int f = -1; back = backupName(file); - return copyFile(file, back); + f = copyFile(file, back); + free(back); + + return f; } int @@ -405,7 +409,7 @@ initFile(char *file) int closeFile(int keep) { - char *back; + char *back = NULL; if (!fileOpen()) { fprintf(stderr, "No open file to close.\n"); From 11d6aabd02969594627691ce087c7d5589c5467b Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Sat, 17 Feb 2024 13:09:55 -0800 Subject: [PATCH 39/65] Remove extraneous void casts (#545) Also fixes a couple of missing headers in Fortran code --- hdf/src/mcache.c | 49 ++- hdf/src/vgf.c | 2 +- hdf/test/forsupf.c | 1 + hdf/util/fp2hdf.c | 528 ++++++++++++++++---------------- hdf/util/fptest.c | 40 +-- hdf/util/he_disp.c | 4 +- mfhdf/fortran/mfsdf.c | 3 + mfhdf/hdfimport/hdfimporttest.c | 94 +++--- mfhdf/hdiff/hdiff.h | 2 - mfhdf/hdiff/hdiff_main.c | 4 +- mfhdf/hdiff/hdiff_misc.c | 36 +-- mfhdf/libsrc/string.c | 2 +- mfhdf/ncdump/dumplib.c | 4 +- mfhdf/ncdump/ncdump.c | 68 ++-- mfhdf/ncdump/ncdump.h | 1 - mfhdf/ncdump/vardata.c | 134 ++++---- mfhdf/ncgen/close.c | 2 - mfhdf/ncgen/generate.c | 4 +- mfhdf/ncgen/genlib.c | 4 +- mfhdf/ncgen/load.c | 2 - mfhdf/nctest/add.c | 14 +- mfhdf/nctest/atttests.c | 50 +-- mfhdf/nctest/cdftests.c | 48 +-- mfhdf/nctest/dimtests.c | 24 +- mfhdf/nctest/error.c | 4 +- mfhdf/nctest/misctest.c | 6 +- mfhdf/nctest/rec.c | 18 +- mfhdf/nctest/val.c | 12 +- mfhdf/nctest/vardef.c | 6 +- mfhdf/nctest/varget.c | 6 +- mfhdf/nctest/varget_unlim.c | 6 +- mfhdf/nctest/vargetg.c | 6 +- mfhdf/nctest/varput.c | 6 +- mfhdf/nctest/varputg.c | 6 +- mfhdf/nctest/vartests.c | 30 +- mfhdf/nctest/vputget.c | 16 +- mfhdf/nctest/vputgetg.c | 30 +- mfhdf/test/cdftest.c | 2 +- mfhdf/util/h4getopt.c | 4 +- 39 files changed, 636 insertions(+), 642 deletions(-) diff --git a/hdf/src/mcache.c b/hdf/src/mcache.c index 01769d3362..fd8fc543cc 100644 --- a/hdf/src/mcache.c +++ b/hdf/src/mcache.c @@ -818,31 +818,30 @@ mcache_stat(MCACHE *mp /* IN: MCACHE cookie */) /* check inputs */ if (mp != NULL) { - (void)fprintf(stderr, "%u pages in the object\n", mp->npages); - (void)fprintf(stderr, "page size %u, caching %u pages of %u page max cache\n", mp->pagesize, - mp->curcache, mp->maxcache); - (void)fprintf(stderr, "%u page puts, %u page gets, %u page new\n", mp->pageput, mp->pageget, - mp->pagenew); - (void)fprintf(stderr, "%u page allocs, %u page flushes\n", mp->pagealloc, mp->pageflush); + fprintf(stderr, "%u pages in the object\n", mp->npages); + fprintf(stderr, "page size %u, caching %u pages of %u page max cache\n", mp->pagesize, mp->curcache, + mp->maxcache); + fprintf(stderr, "%u page puts, %u page gets, %u page new\n", mp->pageput, mp->pageget, mp->pagenew); + fprintf(stderr, "%u page allocs, %u page flushes\n", mp->pagealloc, mp->pageflush); if (mp->cachehit + mp->cachemiss) - (void)fprintf(stderr, "%.0f%% cache hit rate (%u hits, %u misses)\n", - ((double)mp->cachehit / (mp->cachehit + mp->cachemiss)) * 100, mp->cachehit, - mp->cachemiss); - (void)fprintf(stderr, "%u page reads, %u page writes\n", mp->pageread, mp->pagewrite); - (void)fprintf(stderr, "%u listhits, %u listallocs\n", mp->listhit, mp->listalloc); - (void)fprintf(stderr, "sizeof(MCACHE)=%zu, sizeof(BKT)=%zu, sizeof(L_ELEM)=%zu\n", sizeof(MCACHE), - sizeof(BKT), sizeof(L_ELEM)); - (void)fprintf(stderr, "memory pool used %u bytes\n", - (int32)(sizeof(MCACHE) + (sizeof(BKT) + mp->pagesize) * mp->curcache + - (sizeof(L_ELEM) * mp->npages))); + fprintf(stderr, "%.0f%% cache hit rate (%u hits, %u misses)\n", + ((double)mp->cachehit / (mp->cachehit + mp->cachemiss)) * 100, mp->cachehit, + mp->cachemiss); + fprintf(stderr, "%u page reads, %u page writes\n", mp->pageread, mp->pagewrite); + fprintf(stderr, "%u listhits, %u listallocs\n", mp->listhit, mp->listalloc); + fprintf(stderr, "sizeof(MCACHE)=%zu, sizeof(BKT)=%zu, sizeof(L_ELEM)=%zu\n", sizeof(MCACHE), + sizeof(BKT), sizeof(L_ELEM)); + fprintf(stderr, "memory pool used %u bytes\n", + (int32)(sizeof(MCACHE) + (sizeof(BKT) + mp->pagesize) * mp->curcache + + (sizeof(L_ELEM) * mp->npages))); sep = ""; cnt = 0; for (bp = mp->lqh.cqh_first; bp != (void *)&mp->lqh; bp = bp->q.cqe_next) { - (void)fprintf(stderr, "%s%u", sep, bp->pgno); + fprintf(stderr, "%s%u", sep, bp->pgno); if (bp->flags & MCACHE_DIRTY) - (void)fprintf(stderr, "d"); + fprintf(stderr, "d"); if (bp->flags & MCACHE_PINNED) - (void)fprintf(stderr, "P"); + fprintf(stderr, "P"); if (++cnt == 10) { sep = "\n"; cnt = 0; @@ -850,8 +849,8 @@ mcache_stat(MCACHE *mp /* IN: MCACHE cookie */) else sep = ", "; } - (void)fprintf(stderr, "\n"); - (void)fprintf(stderr, "Element hits\n"); + fprintf(stderr, "\n"); + fprintf(stderr, "Element hits\n"); sep = ""; cnt = 0; hitcnt = 0; @@ -859,7 +858,7 @@ mcache_stat(MCACHE *mp /* IN: MCACHE cookie */) lhead = &mp->lhqh[entry]; for (lp = lhead->cqh_first; lp != (void *)lhead; lp = lp->hl.cqe_next) { cnt++; - (void)fprintf(stderr, "%s%u(%u)", sep, lp->pgno, lp->elemhit); + fprintf(stderr, "%s%u(%u)", sep, lp->pgno, lp->elemhit); hitcnt += lp->elemhit; if (cnt >= 8) { sep = "\n"; @@ -869,12 +868,12 @@ mcache_stat(MCACHE *mp /* IN: MCACHE cookie */) sep = ", "; } if (cnt >= 8) { - (void)fprintf(stderr, "\n"); + fprintf(stderr, "\n"); cnt = 0; } } - (void)fprintf(stderr, "\n"); - (void)fprintf(stderr, "Total num of elemhits=%d\n", hitcnt); + fprintf(stderr, "\n"); + fprintf(stderr, "Total num of elemhits=%d\n", hitcnt); } /* end if mp */ } #endif /* STATISTICS */ diff --git a/hdf/src/vgf.c b/hdf/src/vgf.c index d221b2125b..02d5aa717c 100644 --- a/hdf/src/vgf.c +++ b/hdf/src/vgf.c @@ -680,7 +680,7 @@ nvssextfc(intf *id, _fcd name, intf *offset, intf *namelen) if (!fn) return FAIL; ret = (intf)VSsetexternalfile(*id, fn, *offset); - free((void *)fn); + free(fn); return ret; } diff --git a/hdf/test/forsupf.c b/hdf/test/forsupf.c index 73873a2b89..699e766d4d 100644 --- a/hdf/test/forsupf.c +++ b/hdf/test/forsupf.c @@ -12,6 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include +#include #include "hdf.h" #include "fortest.h" diff --git a/hdf/util/fp2hdf.c b/hdf/util/fp2hdf.c index e274061be1..880f1d3c94 100644 --- a/hdf/util/fp2hdf.c +++ b/hdf/util/fp2hdf.c @@ -353,7 +353,7 @@ main(int argc, char *argv[]) * validate the number of command line arguments */ if (argc < 2) { - (void)fprintf(stderr, err1, argc); + fprintf(stderr, err1, argc); usage(argv[0]); goto err; } @@ -428,7 +428,7 @@ main(int argc, char *argv[]) break; case ERR: /* command syntax error */ default: - (void)fprintf(stderr, "%s", err2); + fprintf(stderr, "%s", err2); usage(argv[0]); goto err; } @@ -438,7 +438,7 @@ main(int argc, char *argv[]) * make sure an output file was specified */ if (!outfile_named) { - (void)fprintf(stderr, "%s", err3); + fprintf(stderr, "%s", err3); usage(argv[0]); goto err; } @@ -456,7 +456,7 @@ main(int argc, char *argv[]) return (0); err: - (void)fprintf(stderr, "%s", err4); + fprintf(stderr, "%s", err4); return (1); } @@ -496,7 +496,7 @@ gdata(char *infile, struct Input *in, FILE *strm, int *is_maxmin) } if (DFSDgetdata(infile, in->rank, hdfdims, in->data)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -505,7 +505,7 @@ gdata(char *infile, struct Input *in, FILE *strm, int *is_maxmin) for (j = 0; j < in->dims[1]; j++) { for (i = 0; i < in->dims[0]; i++, fp32++) { if (gfloat(infile, strm, fp32, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -557,13 +557,13 @@ gdimen(char *infile, struct Input *inp, FILE *strm) */ if (inp->is_hdf == TRUE) { if (DFSDgetdims(infile, &inp->rank, hdfdims, 3) == FAIL) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } /* don't know how to deal with other numbers yet */ if (DFSDgetNT(&nt) == FAIL || nt != DFNT_FLOAT32) { - (void)fprintf(stderr, err4, infile); + fprintf(stderr, err4, infile); goto err; } @@ -582,7 +582,7 @@ gdimen(char *infile, struct Input *inp, FILE *strm) inp->dims[2] = hdfdims[0]; } else { - (void)fprintf(stderr, err2, inp->rank, infile); + fprintf(stderr, err2, inp->rank, infile); goto err; } @@ -593,7 +593,7 @@ gdimen(char *infile, struct Input *inp, FILE *strm) } else { if (gint(infile, strm, &inp->dims[2], inp)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (inp->dims[2] > 1) @@ -601,11 +601,11 @@ gdimen(char *infile, struct Input *inp, FILE *strm) else inp->rank = 2; if (gint(infile, strm, &inp->dims[1], inp)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (gint(infile, strm, &inp->dims[0], inp)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -614,7 +614,7 @@ gdimen(char *infile, struct Input *inp, FILE *strm) * validate dimension sizes */ if ((inp->dims[0] < 2) || (inp->dims[1] < 2)) { - (void)fprintf(stderr, err3, infile); + fprintf(stderr, err3, infile); goto err; } @@ -643,20 +643,20 @@ gfloat(char *infile, FILE *strm, float32 *fp32, struct Input *in) if (in->is_text == TRUE) { if (fscanf(strm, "%e", fp32) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } else if (in->is_fp32 == TRUE) { if (fread((char *)fp32, sizeof(float32), 1, strm) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } else { if (fread((char *)&fp64, sizeof(float64), 1, strm) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } *fp32 = (float32)fp64; @@ -686,7 +686,7 @@ gint(char *infile, FILE *strm, int *ival, struct Input *in) */ if (in->is_text == TRUE) { if (fscanf(strm, "%d", ival) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } @@ -696,7 +696,7 @@ gint(char *infile, FILE *strm, int *ival, struct Input *in) } else { if (fread((char *)ival, sizeof(int), 1, strm) != 1) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -729,11 +729,11 @@ gmaxmin(char *infile, struct Input *in, FILE *strm, int *is_maxmin) } else { if (gfloat(infile, strm, &in->max, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (gfloat(infile, strm, &in->min, in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (in->max > in->min) @@ -815,14 +815,14 @@ gscale(char *infile, struct Input *in, FILE *strm, int *is_scale) if (in->rank == 2) { for (i = 0; i < hdfdims[0]; i++) { if (gfloat(infile, strm, &in->vscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } in->vscale[i] = in->vscale[i - 1]; for (i = 0; i < hdfdims[1]; i++) { if (gfloat(infile, strm, &in->hscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -831,21 +831,21 @@ gscale(char *infile, struct Input *in, FILE *strm, int *is_scale) else { for (i = 0; i < hdfdims[0]; i++) { if (gfloat(infile, strm, &in->dscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } in->dscale[i] = in->dscale[i - 1]; for (i = 0; i < hdfdims[1]; i++) { if (gfloat(infile, strm, &in->vscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } in->vscale[i] = in->vscale[i - 1]; for (i = 0; i < hdfdims[2]; i++) { if (gfloat(infile, strm, &in->hscale[i], in)) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } } @@ -919,7 +919,7 @@ gtoken(char *s) token = OPT_num; } if (token == ERR) - (void)fprintf(stderr, err1, s); + fprintf(stderr, err1, s); } else if (isnum(s)) /* positive number */ token = OPT_num; @@ -952,11 +952,11 @@ gtype(char *infile, struct Input *in, FILE **strm) in->is_hdf = TRUE; else { if ((*strm = fopen(infile, "r")) == NULL) { - (void)fprintf(stderr, err1, infile); + fprintf(stderr, err1, infile); goto err; } if (fread(buf, 4, 1, *strm) != 1) { - (void)fprintf(stderr, err2, infile); + fprintf(stderr, err2, infile); goto err; } if (!memcmp("TEXT", buf, 4) || !memcmp("text", buf, 4)) { @@ -968,7 +968,7 @@ gtype(char *infile, struct Input *in, FILE **strm) else { rewind(*strm); if (fread(buf, sizeof(int), 1, *strm) != 1) { - (void)fprintf(stderr, err2, infile); + fprintf(stderr, err2, infile); goto err; } if (!memcmp("FP32", buf, 4) || !memcmp("fp32", buf, 4)) @@ -976,7 +976,7 @@ gtype(char *infile, struct Input *in, FILE **strm) else if (!memcmp("FP64", buf, 4) || !memcmp("fp64", buf, 4)) in->is_fp64 = TRUE; else { - (void)fprintf(stderr, err3, infile); + fprintf(stderr, err3, infile); goto err; } } @@ -998,174 +998,174 @@ gtype(char *infile, struct Input *in, FILE **strm) void help(char *name) { - (void)printf("Name:\n"); - (void)printf("\t %s\n\n", name); - (void)printf("Purpose:\n"); - (void)printf("\t To convert floating point data to HDF Scientific "); - (void)printf("Data Set (SDS)\n"); - (void)printf("\t and/or 8-bit Raster Image Set (RIS8) format, "); - (void)printf("storing the results\n"); - (void)printf("\t in an HDF file. The image data can be scaled "); - (void)printf("about a mean value.\n\n"); - (void)printf("Version:\n"); - (void)printf("\t v1.1 (Apr 30, 1990)\n\n"); - (void)printf("Synopsis:\n"); - (void)printf("\t %s -h[elp], OR\n", name); - (void)printf("\t %s [...] -o[utfile] ", name); - (void)printf("\n"); - (void)printf("\t\t [-r[aster] [ras_opts ...]] [-f[loat]]\n\n"); - (void)printf("\t -h[elp]:\n"); - (void)printf("\t\t Print a helpful summary of usage, and exit.\n\n"); - (void)printf("\t infile(s):\n"); - (void)printf("\t\t Input file(s), containing a single "); - (void)printf("two-dimensional or\n"); - (void)printf("\t\t three-dimensional floating point array in "); - (void)printf("either ASCII\n"); - (void)printf("\t\t text, native floating point, or HDF SDS format. "); - (void)printf("If an\n"); - (void)printf("\t\t HDF file is used for input, it must contain an "); - (void)printf("SDS.\n"); - (void)printf("\t\t The SDS need only contain a dimension record and "); - (void)printf("the\n"); - (void)printf("\t\t data, but if it also contains maximum and "); - (void)printf("minimum values\n"); - (void)printf("\t\t and/or scales for each axis, these will be "); - (void)printf("used. If the\n"); - (void)printf("\t\t input format is ASCII text or native floating "); - (void)printf("point, see\n"); - (void)printf("\t\t \"Notes\" below on how it must be organized.\n\n"); - (void)printf("\t -o[utfile] :\n"); - (void)printf("\t\t Data from one or more input files are stored as "); - (void)printf("one or\n"); - (void)printf("\t\t more data sets and/or images in one HDF output "); - (void)printf("file,\n\t\t\"outfile\".\n\n"); - (void)printf("\t -r[aster]:\n"); - (void)printf("\t\t Store output as a raster image set in the "); - (void)printf("output file\n\n"); - (void)printf("\t -f[loat]:\n"); - (void)printf("\t\t Store output as a scientific data set in the "); - (void)printf("the output file.\n"); - (void)printf("\t\t This is the default if the \"-r\" option is not "); - (void)printf("specified.\n\n"); - (void)printf("\t ras_opts ...\n\n"); - (void)printf("\t -e[xpand] []:\n"); - (void)printf("\t\t Expand float data via pixel replication to "); - (void)printf("produce the\n"); - (void)printf("\t\t image(s). \"horiz\" and \"vert\" give the "); - (void)printf("horizontal and\n"); - (void)printf("\t\t vertical resolution of the image(s) to be "); - (void)printf("produced; and\n"); - (void)printf("\t\t optionally, \"depth\" gives the number of "); - (void)printf("images or depth\n"); - (void)printf("\t\t planes (for 3D input data).\n\n"); - (void)printf("\t-i[nterp] []:\n"); - (void)printf("\t\t Apply bilinear, or trilinear, interpolation to "); - (void)printf("the float\n"); - (void)printf("\t\t data to produce the image(s). \"horiz\", "); - (void)printf("\"vert\", and \"depth\"\n"); - (void)printf("\t\t must be greater than or equal to the dimensions "); - (void)printf("of the\n"); - (void)printf("\t\t original dataset.\n\n"); - (void)printf("\t -p[alfile] :\n"); - (void)printf("\t\t Store the palette with the image. Get the "); - (void)printf("palette from\n"); - (void)printf("\t\t \"palfile\"; which may be an HDF file containing "); - (void)printf("a palette,\n"); - (void)printf("\t\t or a file containing a raw palette.\n\n"); - (void)printf("\t -m[ean] :\n"); - (void)printf("\t\t If a floating point mean value is given, the "); - (void)printf("image will be\n"); - (void)printf("\t\t scaled about the mean. The new extremes "); - (void)printf("(newmax and newmin),\n"); - (void)printf("\t\t as given by:\n\n"); - (void)printf("\t\t newmax = mean + max(abs(max-mean), "); - (void)printf("abs(mean-min))\n"); - (void)printf("\t\t newmin = mean - max(abs(max-mean), "); - (void)printf("abs(mean-min))\n\n"); - (void)printf("\t\t will be equidistant from the mean value. If "); - (void)printf("no mean value\n"); - (void)printf("\t\t is given, then the mean will be: 0.5 * (max "); - (void)printf("+ min)\n\n"); - (void)printf("Notes:\n"); - (void)printf("\t If the input file format is ASCII text or native "); - (void)printf("floating point, it\n"); - (void)printf("\t must have the following input fields:\n\n"); - (void)printf("\t\t format\n"); - (void)printf("\t\t nplanes\n"); - (void)printf("\t\t nrows\n"); - (void)printf("\t\t ncols\n"); - (void)printf("\t\t max_value\n"); - (void)printf("\t\t min_value\n"); - (void)printf("\t\t [plane1 plane2 plane3 ...]\n"); - (void)printf("\t\t row1 row2 row3 ...\n"); - (void)printf("\t\t col1 col2 col3 ...\n"); - (void)printf("\t\t data1 data2 data3 ...\n"); - (void)printf("\t\t ...\n\n"); - (void)printf("\t Where:\n"); - (void)printf("\t\t format:\n"); - (void)printf("\t\t\t Format designator (\"TEXT\", \"FP32\" or "); - (void)printf("\"FP64\").\n"); - (void)printf("\t\t nplanes:\n"); - (void)printf("\t\t\t Dimension of the depth axis (\"1\" for 2D "); - (void)printf("input).\n"); - (void)printf("\t\t nrows:\n"); - (void)printf("\t\t\t Dimension of the vertical axis.\n"); - (void)printf("\t\t ncols:\n"); - (void)printf("\t\t\t Dimension of the horizontal axis.\n"); - (void)printf("\t\t max_value:\n"); - (void)printf("\t\t\t Maximum data value.\n"); - (void)printf("\t\t min_value:\n"); - (void)printf("\t\t\t Minimum data value.\n"); - (void)printf("\t\t plane1, plane2, plane3, ...:\n"); - (void)printf("\t\t\t Scales for depth axis.\n"); - (void)printf("\t\t row1, row2, row3, ...:\n"); - (void)printf("\t\t\t Scales for the vertical axis.\n"); - (void)printf("\t\t col1, col2, col3, ...:\n"); - (void)printf("\t\t\t Scales for the horizontal axis.\n"); - (void)printf("\t\t data1, data2, data3, ...:\n"); - (void)printf("\t\t\t The data ordered by rows, left to right and "); - (void)printf("top\n"); - (void)printf("\t\t\t to bottom; then optionally, ordered by planes,\n"); - (void)printf("\t\t\t front to back.\n\n"); - (void)printf("\t For FP32 and FP64 input format, \"format\", "); - (void)printf("\"nplanes\", \"nrows\", \"ncols\",\n"); - (void)printf("\t and \"nplanes\" are native integers; where "); - (void)printf("\"format\" is the integer\n"); - (void)printf("\t representation of the appropriate 4-character "); - (void)printf("string (0x46503332 for\n"); - (void)printf("\t \"FP32\" and 0x46503634 for \"FP64\"). The "); - (void)printf("remaining input fields are\n"); - (void)printf("\t composed of native 32-bit floating point values for "); - (void)printf("FP32 input format,\n"); - (void)printf("\t or native 64-bit floating point values for FP64 "); - (void)printf("input format.\n\n"); - (void)printf("Examples:\n"); - (void)printf("\t Convert floating point data in \"f1.txt\" to SDS "); - (void)printf("format, and store it\n"); - (void)printf("\t as an SDS in HDF file \"o1\":\n\n"); - (void)printf("\t\t %s f1.txt -o o1\n\n", name); - (void)printf("\t Convert floating point data in \"f2.hdf\" to "); - (void)printf("8-bit raster format, and\n"); - (void)printf("\t store it as an RIS8 in HDF file \"o2\":\n\n"); - (void)printf("\t\t %s f2.hdf -o o2 -r\n\n", name); - (void)printf("\t Convert floating point data in \"f3.bin\" to "); - (void)printf("8-bit raster format and\n"); - (void)printf("\t SDS format, and store both the RIS8 and the SDS "); - (void)printf("in HDF file \"o3\":\n\n"); - (void)printf("\t\t %s f3.bin -o o3 -r -f\n\n", name); - (void)printf("\t Convert floating point data in \"f4\" to a "); - (void)printf("500x600 raster image, and\n"); - (void)printf("\t store the RIS8 in HDF file \"o4\". Also store a "); - (void)printf("palette from \"palfile\"\n"); - (void)printf("\t with the image:\n\n"); - (void)printf("\t\t %s f4 -o o4 -r -e 500 600 -p palfile\n\n", name); - (void)printf("\t Convert floating point data in \"f5\" to 200 "); - (void)printf("planes of 500x600 raster\n"); - (void)printf("\t images, and store the RIS8 in HDF file \"o5\". "); - (void)printf("Also scale the image\n"); - (void)printf("\t data so that it is centered about a mean value "); - (void)printf("of 10.0:\n\n"); - (void)printf("\t\t %s f5 -o o5 -r -i 500 600 200 -m 10.0\n", name); + printf("Name:\n"); + printf("\t %s\n\n", name); + printf("Purpose:\n"); + printf("\t To convert floating point data to HDF Scientific "); + printf("Data Set (SDS)\n"); + printf("\t and/or 8-bit Raster Image Set (RIS8) format, "); + printf("storing the results\n"); + printf("\t in an HDF file. The image data can be scaled "); + printf("about a mean value.\n\n"); + printf("Version:\n"); + printf("\t v1.1 (Apr 30, 1990)\n\n"); + printf("Synopsis:\n"); + printf("\t %s -h[elp], OR\n", name); + printf("\t %s [...] -o[utfile] ", name); + printf("\n"); + printf("\t\t [-r[aster] [ras_opts ...]] [-f[loat]]\n\n"); + printf("\t -h[elp]:\n"); + printf("\t\t Print a helpful summary of usage, and exit.\n\n"); + printf("\t infile(s):\n"); + printf("\t\t Input file(s), containing a single "); + printf("two-dimensional or\n"); + printf("\t\t three-dimensional floating point array in "); + printf("either ASCII\n"); + printf("\t\t text, native floating point, or HDF SDS format. "); + printf("If an\n"); + printf("\t\t HDF file is used for input, it must contain an "); + printf("SDS.\n"); + printf("\t\t The SDS need only contain a dimension record and "); + printf("the\n"); + printf("\t\t data, but if it also contains maximum and "); + printf("minimum values\n"); + printf("\t\t and/or scales for each axis, these will be "); + printf("used. If the\n"); + printf("\t\t input format is ASCII text or native floating "); + printf("point, see\n"); + printf("\t\t \"Notes\" below on how it must be organized.\n\n"); + printf("\t -o[utfile] :\n"); + printf("\t\t Data from one or more input files are stored as "); + printf("one or\n"); + printf("\t\t more data sets and/or images in one HDF output "); + printf("file,\n\t\t\"outfile\".\n\n"); + printf("\t -r[aster]:\n"); + printf("\t\t Store output as a raster image set in the "); + printf("output file\n\n"); + printf("\t -f[loat]:\n"); + printf("\t\t Store output as a scientific data set in the "); + printf("the output file.\n"); + printf("\t\t This is the default if the \"-r\" option is not "); + printf("specified.\n\n"); + printf("\t ras_opts ...\n\n"); + printf("\t -e[xpand] []:\n"); + printf("\t\t Expand float data via pixel replication to "); + printf("produce the\n"); + printf("\t\t image(s). \"horiz\" and \"vert\" give the "); + printf("horizontal and\n"); + printf("\t\t vertical resolution of the image(s) to be "); + printf("produced; and\n"); + printf("\t\t optionally, \"depth\" gives the number of "); + printf("images or depth\n"); + printf("\t\t planes (for 3D input data).\n\n"); + printf("\t-i[nterp] []:\n"); + printf("\t\t Apply bilinear, or trilinear, interpolation to "); + printf("the float\n"); + printf("\t\t data to produce the image(s). \"horiz\", "); + printf("\"vert\", and \"depth\"\n"); + printf("\t\t must be greater than or equal to the dimensions "); + printf("of the\n"); + printf("\t\t original dataset.\n\n"); + printf("\t -p[alfile] :\n"); + printf("\t\t Store the palette with the image. Get the "); + printf("palette from\n"); + printf("\t\t \"palfile\"; which may be an HDF file containing "); + printf("a palette,\n"); + printf("\t\t or a file containing a raw palette.\n\n"); + printf("\t -m[ean] :\n"); + printf("\t\t If a floating point mean value is given, the "); + printf("image will be\n"); + printf("\t\t scaled about the mean. The new extremes "); + printf("(newmax and newmin),\n"); + printf("\t\t as given by:\n\n"); + printf("\t\t newmax = mean + max(abs(max-mean), "); + printf("abs(mean-min))\n"); + printf("\t\t newmin = mean - max(abs(max-mean), "); + printf("abs(mean-min))\n\n"); + printf("\t\t will be equidistant from the mean value. If "); + printf("no mean value\n"); + printf("\t\t is given, then the mean will be: 0.5 * (max "); + printf("+ min)\n\n"); + printf("Notes:\n"); + printf("\t If the input file format is ASCII text or native "); + printf("floating point, it\n"); + printf("\t must have the following input fields:\n\n"); + printf("\t\t format\n"); + printf("\t\t nplanes\n"); + printf("\t\t nrows\n"); + printf("\t\t ncols\n"); + printf("\t\t max_value\n"); + printf("\t\t min_value\n"); + printf("\t\t [plane1 plane2 plane3 ...]\n"); + printf("\t\t row1 row2 row3 ...\n"); + printf("\t\t col1 col2 col3 ...\n"); + printf("\t\t data1 data2 data3 ...\n"); + printf("\t\t ...\n\n"); + printf("\t Where:\n"); + printf("\t\t format:\n"); + printf("\t\t\t Format designator (\"TEXT\", \"FP32\" or "); + printf("\"FP64\").\n"); + printf("\t\t nplanes:\n"); + printf("\t\t\t Dimension of the depth axis (\"1\" for 2D "); + printf("input).\n"); + printf("\t\t nrows:\n"); + printf("\t\t\t Dimension of the vertical axis.\n"); + printf("\t\t ncols:\n"); + printf("\t\t\t Dimension of the horizontal axis.\n"); + printf("\t\t max_value:\n"); + printf("\t\t\t Maximum data value.\n"); + printf("\t\t min_value:\n"); + printf("\t\t\t Minimum data value.\n"); + printf("\t\t plane1, plane2, plane3, ...:\n"); + printf("\t\t\t Scales for depth axis.\n"); + printf("\t\t row1, row2, row3, ...:\n"); + printf("\t\t\t Scales for the vertical axis.\n"); + printf("\t\t col1, col2, col3, ...:\n"); + printf("\t\t\t Scales for the horizontal axis.\n"); + printf("\t\t data1, data2, data3, ...:\n"); + printf("\t\t\t The data ordered by rows, left to right and "); + printf("top\n"); + printf("\t\t\t to bottom; then optionally, ordered by planes,\n"); + printf("\t\t\t front to back.\n\n"); + printf("\t For FP32 and FP64 input format, \"format\", "); + printf("\"nplanes\", \"nrows\", \"ncols\",\n"); + printf("\t and \"nplanes\" are native integers; where "); + printf("\"format\" is the integer\n"); + printf("\t representation of the appropriate 4-character "); + printf("string (0x46503332 for\n"); + printf("\t \"FP32\" and 0x46503634 for \"FP64\"). The "); + printf("remaining input fields are\n"); + printf("\t composed of native 32-bit floating point values for "); + printf("FP32 input format,\n"); + printf("\t or native 64-bit floating point values for FP64 "); + printf("input format.\n\n"); + printf("Examples:\n"); + printf("\t Convert floating point data in \"f1.txt\" to SDS "); + printf("format, and store it\n"); + printf("\t as an SDS in HDF file \"o1\":\n\n"); + printf("\t\t %s f1.txt -o o1\n\n", name); + printf("\t Convert floating point data in \"f2.hdf\" to "); + printf("8-bit raster format, and\n"); + printf("\t store it as an RIS8 in HDF file \"o2\":\n\n"); + printf("\t\t %s f2.hdf -o o2 -r\n\n", name); + printf("\t Convert floating point data in \"f3.bin\" to "); + printf("8-bit raster format and\n"); + printf("\t SDS format, and store both the RIS8 and the SDS "); + printf("in HDF file \"o3\":\n\n"); + printf("\t\t %s f3.bin -o o3 -r -f\n\n", name); + printf("\t Convert floating point data in \"f4\" to a "); + printf("500x600 raster image, and\n"); + printf("\t store the RIS8 in HDF file \"o4\". Also store a "); + printf("palette from \"palfile\"\n"); + printf("\t with the image:\n\n"); + printf("\t\t %s f4 -o o4 -r -e 500 600 -p palfile\n\n", name); + printf("\t Convert floating point data in \"f5\" to 200 "); + printf("planes of 500x600 raster\n"); + printf("\t images, and store the RIS8 in HDF file \"o5\". "); + printf("Also scale the image\n"); + printf("\t data so that it is centered about a mean value "); + printf("of 10.0:\n\n"); + printf("\t\t %s f5 -o o5 -r -i 500 600 200 -m 10.0\n", name); return; } @@ -1193,7 +1193,7 @@ indexes(float32 *scale, int dim, int *idx, int res) * determine the midpoints between scale values */ if ((midpt = (float32 *)malloc((size_t)dim * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } for (i = 0; i < dim - 1; i++) @@ -1292,16 +1292,16 @@ interp(struct Input *in, struct Raster *im) * allocate dynamic memory for the interpolation ratio buffers */ if ((hratio = (float32 *)malloc((size_t)im->hres * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if ((vratio = (float32 *)malloc((unsigned int)im->vres * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if (in->rank == 3) { if ((dratio = (float32 *)malloc((unsigned int)im->dres * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } } @@ -1311,16 +1311,16 @@ interp(struct Input *in, struct Raster *im) * buffers */ if ((hinc = (int *)malloc((unsigned int)im->hres * sizeof(int))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if ((voff = (int *)malloc((unsigned int)(im->vres + 1) * sizeof(int))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } if (in->rank == 3) { if ((doff = (int *)malloc((unsigned int)(im->dres + 1) * sizeof(int))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } } @@ -1519,7 +1519,7 @@ palette(char *palfile) */ if (Hishdf(palfile)) { if (DFPgetpal(palfile, pal)) { - (void)fprintf(stderr, err1, palfile); + fprintf(stderr, err1, palfile); goto err; } @@ -1529,19 +1529,19 @@ palette(char *palfile) } else { if ((strm = fopen(palfile, "r")) == NULL) { - (void)fprintf(stderr, err2, palfile); + fprintf(stderr, err2, palfile); goto err; } if (fread((char *)red, 1, 256, strm) != 256) { - (void)fprintf(stderr, err1, palfile); + fprintf(stderr, err1, palfile); goto err; } else if (fread((char *)green, 1, 256, strm) != 256) { - (void)fprintf(stderr, err1, palfile); + fprintf(stderr, err1, palfile); goto err; } else if (fread((char *)blue, 1, 256, strm) != 256) { - (void)fprintf(stderr, err1, palfile); + fprintf(stderr, err1, palfile); goto err; } (void)fclose(strm); @@ -1561,7 +1561,7 @@ palette(char *palfile) * set up the palette as the default for subsequent images */ if (DFR8setpalette(pal)) { - (void)fprintf(stderr, "%s", err3); + fprintf(stderr, "%s", err3); goto err; } @@ -1602,7 +1602,7 @@ pixrep(struct Input *in, struct Raster *im) * determine the scale indexes of the horizontal pixel locations */ if ((hidx = (int *)malloc((unsigned int)(im->hres + 1) * sizeof(int))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } @@ -1613,7 +1613,7 @@ pixrep(struct Input *in, struct Raster *im) * determine the scale indexes of the vertical pixel locations */ if ((vidx = (int *)malloc((unsigned int)(im->vres + 1) * sizeof(int))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } @@ -1627,7 +1627,7 @@ pixrep(struct Input *in, struct Raster *im) didx = &dummy; if (in->rank == 3) { if ((didx = (int *)malloc((unsigned int)(im->dres + 1) * sizeof(int))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } @@ -1639,7 +1639,7 @@ pixrep(struct Input *in, struct Raster *im) * compute the expanded image */ if ((pix = (unsigned char *)malloc((unsigned int)(in->dims[0] + 1))) == NULL) { - (void)fprintf(stderr, "%s", err1); + fprintf(stderr, "%s", err1); goto err; } for (k = 0, odidx = didx[0] - 1; k < im->dres; k++) { @@ -1736,7 +1736,7 @@ process(struct Options *opt) * create the HDF output file */ if ((hdf = Hopen(opt->outfile, DFACC_CREATE, 0)) == FAIL) { - (void)fprintf(stderr, err1, opt->outfile); + fprintf(stderr, err1, opt->outfile); goto err; } (void)Hclose(hdf); @@ -1770,16 +1770,16 @@ process(struct Options *opt) * get the scale for each axis */ if ((in.hscale = (float32 *)malloc((size_t)(in.dims[0] + 1) * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err2); + fprintf(stderr, "%s", err2); goto err; } if ((in.vscale = (float32 *)malloc((size_t)(in.dims[1] + 1) * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err2); + fprintf(stderr, "%s", err2); goto err; } if (in.rank == 3) { if ((in.dscale = (float32 *)malloc((size_t)(in.dims[2] + 1) * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err2); + fprintf(stderr, "%s", err2); goto err; } } @@ -1791,7 +1791,7 @@ process(struct Options *opt) */ len = in.dims[0] * in.dims[1] * in.dims[2]; if ((in.data = (void *)malloc((size_t)len * sizeof(float32))) == NULL) { - (void)fprintf(stderr, "%s", err2); + fprintf(stderr, "%s", err2); goto err; } if (gdata(opt->infiles[i], &in, strm, &is_maxmin)) @@ -1816,45 +1816,45 @@ process(struct Options *opt) } if (DFSDsetNT(DFNT_FLOAT32)) { - (void)fprintf(stderr, "%s", err5); + fprintf(stderr, "%s", err5); goto err; } if (is_scale == TRUE) { if (DFSDsetdims(in.rank, hdfdims)) { - (void)fprintf(stderr, "%s", err5); + fprintf(stderr, "%s", err5); goto err; } if (DFSDsetrange(&in.max, &in.min)) { - (void)fprintf(stderr, "%s", err5); + fprintf(stderr, "%s", err5); goto err; } if (in.rank == 2) { if (DFSDsetdimscale(1, hdfdims[0], in.vscale)) { - (void)fprintf(stderr, "%s", err5); + fprintf(stderr, "%s", err5); goto err; } if (DFSDsetdimscale(2, hdfdims[1], in.hscale)) { - (void)fprintf(stderr, "%s", err5); + fprintf(stderr, "%s", err5); goto err; } } else { if (DFSDsetdimscale(1, hdfdims[0], in.dscale)) { - (void)fprintf(stderr, "%s", err5); + fprintf(stderr, "%s", err5); goto err; } if (DFSDsetdimscale(2, hdfdims[1], in.vscale)) { - (void)fprintf(stderr, "%s", err5); + fprintf(stderr, "%s", err5); goto err; } if (DFSDsetdimscale(3, hdfdims[2], in.hscale)) { - (void)fprintf(stderr, "%s", err5); + fprintf(stderr, "%s", err5); goto err; } } } if (DFSDadddata(opt->outfile, in.rank, hdfdims, in.data)) { - (void)fprintf(stderr, "%s", err5); + fprintf(stderr, "%s", err5); goto err; } } @@ -1868,19 +1868,19 @@ process(struct Options *opt) */ im.hres = (opt->hres == 0) ? in.dims[0] : opt->hres; if ((im.hres < in.dims[0]) && (opt->ctm == EXPAND)) { - (void)fprintf(stderr, "%s", err3a); - (void)fprintf(stderr, err3b, "Horiz."); - (void)fprintf(stderr, err3c, "horiz."); - (void)fprintf(stderr, err3d, in.dims[0]); + fprintf(stderr, "%s", err3a); + fprintf(stderr, err3b, "Horiz."); + fprintf(stderr, err3c, "horiz."); + fprintf(stderr, err3d, in.dims[0]); im.hres = in.dims[0]; opt->hres = in.dims[0]; } im.vres = (opt->vres == 0) ? in.dims[1] : opt->vres; if ((im.vres < in.dims[1]) && (opt->ctm == EXPAND)) { - (void)fprintf(stderr, "%s", err3a); - (void)fprintf(stderr, err3b, "Vert."); - (void)fprintf(stderr, err3c, "vert."); - (void)fprintf(stderr, err3d, in.dims[1]); + fprintf(stderr, "%s", err3a); + fprintf(stderr, err3b, "Vert."); + fprintf(stderr, err3c, "vert."); + fprintf(stderr, err3d, in.dims[1]); im.vres = in.dims[1]; opt->vres = in.dims[1]; } @@ -1888,17 +1888,17 @@ process(struct Options *opt) if (in.rank == 3) { im.dres = (opt->dres == 0) ? in.dims[2] : opt->dres; if ((im.dres < in.dims[2]) && (opt->ctm == EXPAND)) { - (void)fprintf(stderr, "%s", err3a); - (void)fprintf(stderr, err3b, "Depth"); - (void)fprintf(stderr, err3c, "depth"); - (void)fprintf(stderr, err3d, in.dims[2]); + fprintf(stderr, "%s", err3a); + fprintf(stderr, err3b, "Depth"); + fprintf(stderr, err3c, "depth"); + fprintf(stderr, err3d, in.dims[2]); im.dres = in.dims[2]; opt->dres = in.dims[2]; } } len = im.hres * im.vres * im.dres; if ((im.image = (unsigned char *)malloc((unsigned int)len)) == NULL) { - (void)fprintf(stderr, "%s", err2); + fprintf(stderr, "%s", err2); goto err; } @@ -1923,7 +1923,7 @@ process(struct Options *opt) len = im.hres * im.vres; for (j = 0, ip = im.image; j < im.dres; j++, ip += len) { if (DFR8addimage(opt->outfile, ip, im.hres, im.vres, DFTAG_RLE)) { - (void)fprintf(stderr, "%s", err4); + fprintf(stderr, "%s", err4); goto err; } } @@ -1957,27 +1957,27 @@ process(struct Options *opt) void usage(char *name) { - (void)fprintf(stderr, "\nUsage:\t%s -h[elp], OR\n", name); - (void)fprintf(stderr, "\t%s [...] ", name); - (void)fprintf(stderr, "-o[utfile] [options...]\n\n"); - (void)fprintf(stderr, "\toptions...\n"); - (void)fprintf(stderr, "\t -r[aster]:\n"); - (void)fprintf(stderr, "\t produce an image. Could be "); - (void)fprintf(stderr, "followed by:\n"); - (void)fprintf(stderr, "\t -e[xpand] "); - (void)fprintf(stderr, "[]:\n"); - (void)fprintf(stderr, "\t resolution with pixel "); - (void)fprintf(stderr, "replication\n"); - (void)fprintf(stderr, "\t -i[nterp] "); - (void)fprintf(stderr, "[]:\n"); - (void)fprintf(stderr, "\t resolution with interpolation\n"); - (void)fprintf(stderr, "\t -p[alfile] :\n"); - (void)fprintf(stderr, "\t include palette from palfile\n"); - (void)fprintf(stderr, "\t -m[ean] :\n"); - (void)fprintf(stderr, "\t mean value to scale image "); - (void)fprintf(stderr, "around\n"); - (void)fprintf(stderr, "\t -f[loat]:\n"); - (void)fprintf(stderr, "\t produce floating point data\n\n"); + fprintf(stderr, "\nUsage:\t%s -h[elp], OR\n", name); + fprintf(stderr, "\t%s [...] ", name); + fprintf(stderr, "-o[utfile] [options...]\n\n"); + fprintf(stderr, "\toptions...\n"); + fprintf(stderr, "\t -r[aster]:\n"); + fprintf(stderr, "\t produce an image. Could be "); + fprintf(stderr, "followed by:\n"); + fprintf(stderr, "\t -e[xpand] "); + fprintf(stderr, "[]:\n"); + fprintf(stderr, "\t resolution with pixel "); + fprintf(stderr, "replication\n"); + fprintf(stderr, "\t -i[nterp] "); + fprintf(stderr, "[]:\n"); + fprintf(stderr, "\t resolution with interpolation\n"); + fprintf(stderr, "\t -p[alfile] :\n"); + fprintf(stderr, "\t include palette from palfile\n"); + fprintf(stderr, "\t -m[ean] :\n"); + fprintf(stderr, "\t mean value to scale image "); + fprintf(stderr, "around\n"); + fprintf(stderr, "\t -f[loat]:\n"); + fprintf(stderr, "\t produce floating point data\n\n"); return; } diff --git a/hdf/util/fptest.c b/hdf/util/fptest.c index 56b81cec8a..e925b77a1f 100644 --- a/hdf/util/fptest.c +++ b/hdf/util/fptest.c @@ -137,40 +137,40 @@ main(void) _fmode = _O_TEXT; #endif sp = fopen("ctxtr2", "w"); - (void)fprintf(sp, "%s\n", text); - (void)fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); - (void)fprintf(sp, "%14.6E%14.6E\n", ezero, ezero); + fprintf(sp, "%s\n", text); + fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); + fprintf(sp, "%14.6E%14.6E\n", ezero, ezero); for (i = 0; i < nrow; i++) - (void)fprintf(sp, "%14.6E", row4[i]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", row4[i]); + fprintf(sp, "\n"); for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%14.6E", col4[j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", col4[j]); + fprintf(sp, "\n"); for (i = 0; i < nrow; i++) { for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%14.6E", b32r2[i][j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", b32r2[i][j]); + fprintf(sp, "\n"); } (void)fclose(sp); sp = fopen("ctxtr3", "w"); - (void)fprintf(sp, "%s\n", text); - (void)fprintf(sp, "%10d%10d%10d\n", npln, nrow, ncol); - (void)fprintf(sp, "%14.6E%14.6E\n", ezero, ezero); + fprintf(sp, "%s\n", text); + fprintf(sp, "%10d%10d%10d\n", npln, nrow, ncol); + fprintf(sp, "%14.6E%14.6E\n", ezero, ezero); for (k = 0; k < npln; k++) - (void)fprintf(sp, "%14.6E", pln4[k]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", pln4[k]); + fprintf(sp, "\n"); for (i = 0; i < nrow; i++) - (void)fprintf(sp, "%14.6E", row4[i]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", row4[i]); + fprintf(sp, "\n"); for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%14.6E", col4[j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", col4[j]); + fprintf(sp, "\n"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) { for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%14.6E", b32r3[k][i][j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", b32r3[k][i][j]); + fprintf(sp, "\n"); } (void)fclose(sp); diff --git a/hdf/util/he_disp.c b/hdf/util/he_disp.c index 7b7e545186..8928751184 100644 --- a/hdf/util/he_disp.c +++ b/hdf/util/he_disp.c @@ -210,7 +210,7 @@ rImage(int usepal) * If a palette should be used, send it with the M command. */ if (usepal) { - (void)printf("\033^M;0;256;768;rseq^"); /* start map */ + printf("\033^M;0;256;768;rseq^"); /* start map */ thischar = (int8 *)rgb; for (j = 0; j < 768; j++) { @@ -236,7 +236,7 @@ rImage(int usepal) newxsize = rleIt((char *)thisline, (char *)space, (int)xdim); thisline += xdim; /* increment to next line */ - (void)printf("\033^R;0;%d;%d;%d;rseq^", i * factor, factor, newxsize); + printf("\033^R;0;%d;%d;%d;rseq^", i * factor, factor, newxsize); thischar = space; for (j = 0; j < newxsize; j++) { diff --git a/mfhdf/fortran/mfsdf.c b/mfhdf/fortran/mfsdf.c index d2c5abab6e..6359be5d12 100644 --- a/mfhdf/fortran/mfsdf.c +++ b/mfhdf/fortran/mfsdf.c @@ -18,6 +18,9 @@ The basic routines called by fortran will be of the form sfxxxx */ + +#include + #include "mfsdf.h" intf nsfscfill(intf *id, _fcd val); diff --git a/mfhdf/hdfimport/hdfimporttest.c b/mfhdf/hdfimport/hdfimporttest.c index 2b113296df..51ff742492 100644 --- a/mfhdf/hdfimport/hdfimporttest.c +++ b/mfhdf/hdfimport/hdfimporttest.c @@ -171,91 +171,91 @@ main(void) */ sp = fopen("ctxtr2", "w"); - (void)fprintf(sp, "%s\n", text); - (void)fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); - (void)fprintf(sp, "%14.6E%14.6E\n", (double)ezero, (double)ezero); + fprintf(sp, "%s\n", text); + fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); + fprintf(sp, "%14.6E%14.6E\n", (double)ezero, (double)ezero); for (i = 0; i < nrow; i++) - (void)fprintf(sp, "%14.6E", (double)row4[i]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", (double)row4[i]); + fprintf(sp, "\n"); for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%14.6E", (double)col4[j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", (double)col4[j]); + fprintf(sp, "\n"); for (i = 0; i < nrow; i++) { for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%14.6E", (double)b32r2[i][j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", (double)b32r2[i][j]); + fprintf(sp, "\n"); } (void)fclose(sp); sp = fopen("ctxti2", "w"); - (void)fprintf(sp, "%s\n", text); - (void)fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); - (void)fprintf(sp, "%10d%10d\n", ezeroi, ezeroi); + fprintf(sp, "%s\n", text); + fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); + fprintf(sp, "%10d%10d\n", ezeroi, ezeroi); for (i = 0; i < nrow; i++) - (void)fprintf(sp, "%10d", row4i[i]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%10d", row4i[i]); + fprintf(sp, "\n"); for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%10d", col4i[j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%10d", col4i[j]); + fprintf(sp, "\n"); for (i = 0; i < nrow; i++) { for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%10d", b32i2[i][j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%10d", b32i2[i][j]); + fprintf(sp, "\n"); } (void)fclose(sp); sp = fopen("ctxti162", "w"); - (void)fprintf(sp, "%s\n", text); - (void)fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); - (void)fprintf(sp, "%10u%10u\n", ezeroi16, ezeroi16); + fprintf(sp, "%s\n", text); + fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); + fprintf(sp, "%10u%10u\n", ezeroi16, ezeroi16); for (i = 0; i < nrow; i++) - (void)fprintf(sp, "%10u", row4i16[i]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%10u", row4i16[i]); + fprintf(sp, "\n"); for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%10u", col4i16[j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%10u", col4i16[j]); + fprintf(sp, "\n"); for (i = 0; i < nrow; i++) { for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%10u", b16i2[i][j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%10u", b16i2[i][j]); + fprintf(sp, "\n"); } (void)fclose(sp); sp = fopen("ctxti82", "w"); - (void)fprintf(sp, "%s\n", text); - (void)fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); - (void)fprintf(sp, "%10c%10c\n", ezeroi8, ezeroi8); + fprintf(sp, "%s\n", text); + fprintf(sp, "%10d%10d%10d\n", ione, nrow, ncol); + fprintf(sp, "%10c%10c\n", ezeroi8, ezeroi8); for (i = 0; i < nrow; i++) - (void)fprintf(sp, "%10c", row4i8[i]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%10c", row4i8[i]); + fprintf(sp, "\n"); for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%10c", col4i8[j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%10c", col4i8[j]); + fprintf(sp, "\n"); for (i = 0; i < nrow; i++) { for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%10c", b8i2[i][j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%10c", b8i2[i][j]); + fprintf(sp, "\n"); } (void)fclose(sp); sp = fopen("ctxtr3", "w"); - (void)fprintf(sp, "%s\n", text); - (void)fprintf(sp, "%10d%10d%10d\n", npln, nrow, ncol); - (void)fprintf(sp, "%14.6E%14.6E\n", (double)ezero, (double)ezero); + fprintf(sp, "%s\n", text); + fprintf(sp, "%10d%10d%10d\n", npln, nrow, ncol); + fprintf(sp, "%14.6E%14.6E\n", (double)ezero, (double)ezero); for (k = 0; k < npln; k++) - (void)fprintf(sp, "%14.6E", (double)pln4[k]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", (double)pln4[k]); + fprintf(sp, "\n"); for (i = 0; i < nrow; i++) - (void)fprintf(sp, "%14.6E", (double)row4[i]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", (double)row4[i]); + fprintf(sp, "\n"); for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%14.6E", (double)col4[j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", (double)col4[j]); + fprintf(sp, "\n"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) { for (j = 0; j < ncol; j++) - (void)fprintf(sp, "%14.6E", (double)b32r3[k][i][j]); - (void)fprintf(sp, "\n"); + fprintf(sp, "%14.6E", (double)b32r3[k][i][j]); + fprintf(sp, "\n"); } (void)fclose(sp); diff --git a/mfhdf/hdiff/hdiff.h b/mfhdf/hdiff/hdiff.h index d2db7ce1ea..07a9949d74 100644 --- a/mfhdf/hdiff/hdiff.h +++ b/mfhdf/hdiff/hdiff.h @@ -11,8 +11,6 @@ #include "mfhdf.h" #include "hdiff_table.h" -#define Printf (void)printf - /* Maximum value for max_err_cnt */ #define MAX_DIFF 0x7FFFFFFF diff --git a/mfhdf/hdiff/hdiff_main.c b/mfhdf/hdiff/hdiff_main.c index 34b23e79cb..0bdbdd4863 100644 --- a/mfhdf/hdiff/hdiff_main.c +++ b/mfhdf/hdiff/hdiff_main.c @@ -45,8 +45,8 @@ static void usage() { - (void)fprintf(stdout, "hdiff [-V] [-b] [-g] [-s] [-d] [-D] [-S] [-v var1[,...]] [-u var1[,...]] [-e " - "count] [-t limit] [-p relative] file1 file2\n"); + fprintf(stdout, "hdiff [-V] [-b] [-g] [-s] [-d] [-D] [-S] [-v var1[,...]] [-u var1[,...]] [-e " + "count] [-t limit] [-p relative] file1 file2\n"); fprintf(stdout, " [-V] Display version of the HDF4 library and exit\n"); fprintf(stdout, " [-b] Verbose mode\n"); fprintf(stdout, " [-g] Compare global attributes only\n"); diff --git a/mfhdf/hdiff/hdiff_misc.c b/mfhdf/hdiff/hdiff_misc.c index 0d17379b44..c419872e4f 100644 --- a/mfhdf/hdiff/hdiff_misc.c +++ b/mfhdf/hdiff/hdiff_misc.c @@ -131,13 +131,13 @@ pr_att_vals(nc_type type, int len, void *vals) gp.cp = (char *)vals; for (iel = 0; iel < len; iel++) if (isprint(uc = *gp.cp++ & 0377)) - Printf("'%c'%s", uc, iel < len - 1 ? ", " : ""); + printf("'%c'%s", uc, iel < len - 1 ? ", " : ""); else - Printf("'\\%o'%s", uc, iel < len - 1 ? ", " : ""); + printf("'\\%o'%s", uc, iel < len - 1 ? ", " : ""); break; case DFNT_CHAR: gp.cp = (char *)vals; - Printf("\""); + printf("\""); /* adjust len so trailing nulls don't get printed */ sp = gp.cp + len - 1; while (*sp-- == '\0' && len > 0) @@ -145,47 +145,47 @@ pr_att_vals(nc_type type, int len, void *vals) for (iel = 0; iel < len; iel++) switch (uc = *gp.cp++ & 0377) { case '\b': - Printf("\\b"); + printf("\\b"); break; case '\f': - Printf("\\f"); + printf("\\f"); break; case '\n': /* generate linebreaks after new-lines */ - Printf("\\n\",\n \""); + printf("\\n\",\n \""); break; case '\r': - Printf("\\r"); + printf("\\r"); break; case '\t': - Printf("\\t"); + printf("\\t"); break; case '\v': - Printf("\\v"); + printf("\\v"); break; case '\\': - Printf("\\\\"); + printf("\\\\"); break; case '\'': - Printf("\\'"); + printf("\\'"); break; case '\"': - Printf("\\\""); + printf("\\\""); break; default: - Printf("%c", uc); + printf("%c", uc); break; } - Printf("\""); + printf("\""); break; case DFNT_INT16: gp.sp = (int16 *)vals; for (iel = 0; iel < len; iel++) - Printf("%ds%s", *gp.sp++, iel < len - 1 ? ", " : ""); + printf("%ds%s", *gp.sp++, iel < len - 1 ? ", " : ""); break; case DFNT_INT32: gp.lp = (int32 *)vals; for (iel = 0; iel < len; iel++) - Printf("%d%s", *gp.lp++, iel < len - 1 ? ", " : ""); + printf("%d%s", *gp.lp++, iel < len - 1 ? ", " : ""); break; case DFNT_FLOAT: gp.fp = (float32 *)vals; @@ -197,7 +197,7 @@ pr_att_vals(nc_type type, int len, void *vals) gps[ll + 1] = '\0'; gps[ll] = 'f'; tztrim(gps); /* trim trailing 0's after '.' */ - Printf("%s%s", gps, iel < len - 1 ? ", " : ""); + printf("%s%s", gps, iel < len - 1 ? ", " : ""); } break; case DFNT_DOUBLE: @@ -205,7 +205,7 @@ pr_att_vals(nc_type type, int len, void *vals) for (iel = 0; iel < len; iel++) { (void)sprintf(gps, d_fmt, *gp.dp++); tztrim(gps); /* trim trailing 0's after '.' */ - Printf("%s%s", gps, iel < len - 1 ? ", " : ""); + printf("%s%s", gps, iel < len - 1 ? ", " : ""); } break; default: diff --git a/mfhdf/libsrc/string.c b/mfhdf/libsrc/string.c index bf17e2067c..934bb8a5bb 100644 --- a/mfhdf/libsrc/string.c +++ b/mfhdf/libsrc/string.c @@ -108,7 +108,7 @@ NC_re_string(NC_string *old, unsigned count, const char *str) return NULL; (void)memcpy(old->values, str, count); - (void)memset(old->values + count, 0, (int)old->count - (int)count + 1); + memset(old->values + count, 0, (int)old->count - (int)count + 1); /* make sure len is always == to the string length */ old->len = count; diff --git a/mfhdf/ncdump/dumplib.c b/mfhdf/ncdump/dumplib.c index b6c1e31835..e7bdb149bf 100644 --- a/mfhdf/ncdump/dumplib.c +++ b/mfhdf/ncdump/dumplib.c @@ -26,13 +26,13 @@ error(const char *fmt, ...) { va_list args; - (void)fprintf(stderr, "*** %s: ", progname); + fprintf(stderr, "*** %s: ", progname); va_start(args, fmt); (void)vfprintf(stderr, fmt, args); va_end(args); - (void)fprintf(stderr, "\n"); + fprintf(stderr, "\n"); (void)fflush(stderr); /* to ensure log files are current */ } diff --git a/mfhdf/ncdump/ncdump.c b/mfhdf/ncdump/ncdump.c index d317d3e59a..d77dcf149c 100644 --- a/mfhdf/ncdump/ncdump.c +++ b/mfhdf/ncdump/ncdump.c @@ -149,13 +149,13 @@ pr_att_vals(nc_type type, int len, void *vals) gp.cp = (char *)vals; for (iel = 0; iel < len; iel++) if (isprint(uc = *gp.cp++ & 0377)) - Printf("'%c'%s", uc, iel < len - 1 ? ", " : ""); + printf("'%c'%s", uc, iel < len - 1 ? ", " : ""); else - Printf("'\\%o'%s", uc, iel < len - 1 ? ", " : ""); + printf("'\\%o'%s", uc, iel < len - 1 ? ", " : ""); break; case NC_CHAR: gp.cp = (char *)vals; - Printf("\""); + printf("\""); /* adjust len so trailing nulls don't get printed */ sp = gp.cp + len - 1; while (*sp-- == '\0' && len > 0) @@ -163,47 +163,47 @@ pr_att_vals(nc_type type, int len, void *vals) for (iel = 0; iel < len; iel++) switch (uc = *gp.cp++ & 0377) { case '\b': - Printf("\\b"); + printf("\\b"); break; case '\f': - Printf("\\f"); + printf("\\f"); break; case '\n': /* generate linebreaks after new-lines */ - Printf("\\n\",\n \""); + printf("\\n\",\n \""); break; case '\r': - Printf("\\r"); + printf("\\r"); break; case '\t': - Printf("\\t"); + printf("\\t"); break; case '\v': - Printf("\\v"); + printf("\\v"); break; case '\\': - Printf("\\\\"); + printf("\\\\"); break; case '\'': - Printf("\\'"); + printf("\\'"); break; case '\"': - Printf("\\\""); + printf("\\\""); break; default: - Printf("%c", uc); + printf("%c", uc); break; } - Printf("\""); + printf("\""); break; case NC_SHORT: gp.sp = (short *)vals; for (iel = 0; iel < len; iel++) - Printf("%ds%s", *gp.sp++, iel < len - 1 ? ", " : ""); + printf("%ds%s", *gp.sp++, iel < len - 1 ? ", " : ""); break; case NC_LONG: gp.lp = (nclong *)vals; for (iel = 0; iel < len; iel++) - Printf("%d%s", (int)*gp.lp++, iel < len - 1 ? ", " : ""); + printf("%d%s", (int)*gp.lp++, iel < len - 1 ? ", " : ""); break; case NC_FLOAT: gp.fp = (float *)vals; @@ -215,7 +215,7 @@ pr_att_vals(nc_type type, int len, void *vals) gps[ll + 1] = '\0'; gps[ll] = 'f'; tztrim(gps); /* trim trailing 0's after '.' */ - Printf("%s%s", gps, iel < len - 1 ? ", " : ""); + printf("%s%s", gps, iel < len - 1 ? ", " : ""); } break; case NC_DOUBLE: @@ -223,7 +223,7 @@ pr_att_vals(nc_type type, int len, void *vals) for (iel = 0; iel < len; iel++) { (void)sprintf(gps, d_fmt, *gp.dp++); tztrim(gps); /* trim trailing 0's after '.' */ - Printf("%s%s", gps, iel < len - 1 ? ", " : ""); + printf("%s%s", gps, iel < len - 1 ? ", " : ""); } break; default: @@ -306,7 +306,7 @@ do_ncdump(char *path, struct fspec *specp) if (specp->name == NULL) specp->name = name_path(path); - Printf("netcdf %s {\n", specp->name); + printf("netcdf %s {\n", specp->name); /* * get number of dimensions, number of variables, number of global @@ -316,7 +316,7 @@ do_ncdump(char *path, struct fspec *specp) /* get dimension info */ if (ndims > 0) { - Printf("dimensions:\n"); + printf("dimensions:\n"); for (dimid = 0; dimid < ndims; dimid++) { char *fixed_str = NULL; @@ -331,15 +331,15 @@ do_ncdump(char *path, struct fspec *specp) } if (dimid == xdimid) - Printf("\t%s = %s ; // (%d currently)\n", fixed_str, "UNLIMITED", (int)dims[dimid].size); + printf("\t%s = %s ; // (%d currently)\n", fixed_str, "UNLIMITED", (int)dims[dimid].size); else - Printf("\t%s = %ld ;\n", fixed_str, dims[dimid].size); + printf("\t%s = %ld ;\n", fixed_str, dims[dimid].size); free(fixed_str); } } - Printf("\nvariables:\n"); + printf("\nvariables:\n"); /* get variable info, with variable attributes */ for (varid = 0; varid < nvars; varid++) { @@ -353,10 +353,10 @@ do_ncdump(char *path, struct fspec *specp) return; } - Printf("\t%s %s", type_name(var.type), fixed_var); + printf("\t%s %s", type_name(var.type), fixed_var); if (var.ndims > 0) - Printf("("); + printf("("); for (id = 0; id < var.ndims; id++) { char *fixed_dim = sanitize_string(dims[var.dims[id]].name, specp->fix_str); @@ -367,11 +367,11 @@ do_ncdump(char *path, struct fspec *specp) return; } - Printf("%s%s", fixed_dim, id < var.ndims - 1 ? ", " : ")"); + printf("%s%s", fixed_dim, id < var.ndims - 1 ? ", " : ")"); free(fixed_dim); } - Printf(" ;\n"); + printf(" ;\n"); /* get variable attributes */ for (ia = 0; ia < var.natts; ia++) { @@ -386,7 +386,7 @@ do_ncdump(char *path, struct fspec *specp) return; } - Printf("\t\t%s:%s = ", fixed_var, fixed_att); + printf("\t\t%s:%s = ", fixed_var, fixed_att); (void)ncattinq(ncid, varid, att.name, &att.type, &att.len); att.val = (void *)malloc((unsigned)att.len * nctypelen(att.type)); @@ -400,7 +400,7 @@ do_ncdump(char *path, struct fspec *specp) (void)ncattget(ncid, varid, att.name, att.val); pr_att_vals(att.type, att.len, att.val); - Printf(" ;\n"); + printf(" ;\n"); free(att.val); free(fixed_att); } @@ -410,7 +410,7 @@ do_ncdump(char *path, struct fspec *specp) /* get global attributes */ if (ngatts > 0) - Printf("\n// global attributes:\n"); + printf("\n// global attributes:\n"); for (ia = 0; ia < ngatts; ia++) { char *fixed_att; @@ -423,7 +423,7 @@ do_ncdump(char *path, struct fspec *specp) return; } - Printf("\t\t:%s = ", fixed_att); + printf("\t\t:%s = ", fixed_att); (void)ncattinq(ncid, NC_GLOBAL, att.name, &att.type, &att.len); att.val = malloc((unsigned)(att.len * nctypelen(att.type))); @@ -437,14 +437,14 @@ do_ncdump(char *path, struct fspec *specp) (void)ncattget(ncid, NC_GLOBAL, att.name, att.val); pr_att_vals(att.type, att.len, att.val); - Printf(" ;\n"); + printf(" ;\n"); free(att.val); free(fixed_att); } if (!specp->header_only) { if (nvars > 0) - Printf("\ndata:\n"); + printf("\ndata:\n"); /* output variable data */ for (varid = 0; varid < nvars; varid++) { @@ -525,7 +525,7 @@ do_ncdump(char *path, struct fspec *specp) } } - Printf("}\n"); + printf("}\n"); (void)ncclose(ncid); } diff --git a/mfhdf/ncdump/ncdump.h b/mfhdf/ncdump/ncdump.h index 7a21cba63a..87a27e1084 100644 --- a/mfhdf/ncdump/ncdump.h +++ b/mfhdf/ncdump/ncdump.h @@ -6,7 +6,6 @@ #ifndef NCDUMP_H #define NCDUMP_H -#define Printf (void)printf #define ERR_READFAIL \ -2 /* Used to return by vardata() to indicate that \ ncvarget() fails to read the data */ diff --git a/mfhdf/ncdump/vardata.c b/mfhdf/ncdump/vardata.c index 35ddda6e6d..c620a00408 100644 --- a/mfhdf/ncdump/vardata.c +++ b/mfhdf/ncdump/vardata.c @@ -85,7 +85,7 @@ pr_vals(struct ncvar *vp, long len, char *fmt, bool more, bool lastrow, void *va case NC_CHAR: gp.cp = (char *)vals; if (fmt == 0 || VD_STREQ(fmt, "%s") || VD_STREQ(fmt, "")) { /* as string */ - Printf("\""); + printf("\""); /* adjust len so trailing nulls don't get printed */ sp = gp.cp + len; while (len > 0 && *--sp == '\0') @@ -93,40 +93,40 @@ pr_vals(struct ncvar *vp, long len, char *fmt, bool more, bool lastrow, void *va for (iel = 0; iel < len; iel++) switch (uc = *gp.cp++ & 0377) { case '\b': - Printf("\\b"); + printf("\\b"); break; case '\f': - Printf("\\f"); + printf("\\f"); break; case '\n': /* generate linebreaks after new-lines */ - Printf("\\n\",\n \""); + printf("\\n\",\n \""); break; case '\r': - Printf("\\r"); + printf("\\r"); break; case '\t': - Printf("\\t"); + printf("\\t"); break; case '\v': - Printf("\\v"); + printf("\\v"); break; case '\\': - Printf("\\\\"); + printf("\\\\"); break; case '\'': - Printf("\\\'"); + printf("\\\'"); break; case '\"': - Printf("\\\""); + printf("\\\""); break; default: if (isprint(uc)) - Printf("%c", uc); + printf("%c", uc); else - Printf("\\%.3o", uc); + printf("\\%.3o", uc); break; } - Printf("\""); + printf("\""); } else { /* use format from C_format attribute */ for (iel = 0; iel < len - 1; iel++) { @@ -221,14 +221,14 @@ static void lastdelim(bool more, bool lastrow) { if (more) { - Printf(", "); + printf(", "); } else { if (lastrow) { - Printf(";"); + printf(";"); } else { - Printf(","); + printf(","); } } } @@ -247,23 +247,23 @@ annotate(struct ncvar *vp, struct fspec *fsp, long cor[], long iel) int id; /* print indices according to data_lang */ - (void)printf(" // %s(", vp->name); + printf(" // %s(", vp->name); switch (fsp->data_lang) { case LANG_C: /* C variable indices */ for (id = 0; id < vrank - 1; id++) - Printf("%d,", (int)cor[id]); - Printf("%d", (int)(cor[id] + iel)); + printf("%d,", (int)cor[id]); + printf("%d", (int)(cor[id] + iel)); break; case LANG_F: /* Fortran variable indices */ - Printf("%d", (int)(cor[vrank - 1] + iel + 1)); + printf("%d", (int)(cor[vrank - 1] + iel + 1)); for (id = vrank - 2; id >= 0; id--) { - Printf(",%d", (int)(1 + cor[id])); + printf(",%d", (int)(1 + cor[id])); } break; } - Printf(")\n "); + printf(")\n "); } /* @@ -313,18 +313,18 @@ pr_cvals(struct ncvar *vp, long len, char *fmt, bool more, bool lastrow, void *v case NC_BYTE: gp.cp = (char *)vals; for (iel = 0; iel < len - 1; iel++) { - Printf(fmt, *gp.cp++); - Printf(", "); + printf(fmt, *gp.cp++); + printf(", "); annotate(vp, fsp, cor, iel); } - Printf(fmt, *gp.cp++); + printf(fmt, *gp.cp++); lastdelim(more, lastrow); annotate(vp, fsp, cor, iel); break; case NC_CHAR: gp.cp = (char *)vals; if (fmt == 0 || VD_STREQ(fmt, "%s") || VD_STREQ(fmt, "")) { /* as string */ - Printf("\""); + printf("\""); /* adjust len so trailing nulls don't get printed */ sp = gp.cp + len; while (len > 0 && *--sp == '\0') @@ -332,49 +332,49 @@ pr_cvals(struct ncvar *vp, long len, char *fmt, bool more, bool lastrow, void *v for (iel = 0; iel < len; iel++) switch (uc = *gp.cp++ & 0377) { case '\b': - Printf("\\b"); + printf("\\b"); break; case '\f': - Printf("\\f"); + printf("\\f"); break; case '\n': /* generate linebreaks after new-lines */ - Printf("\\n\",\n \""); + printf("\\n\",\n \""); break; case '\r': - Printf("\\r"); + printf("\\r"); break; case '\t': - Printf("\\t"); + printf("\\t"); break; case '\v': - Printf("\\v"); + printf("\\v"); break; case '\\': - Printf("\\\\"); + printf("\\\\"); break; case '\'': - Printf("\\\'"); + printf("\\\'"); break; case '\"': - Printf("\\\""); + printf("\\\""); break; default: if (isprint(uc)) - Printf("%c", uc); + printf("%c", uc); else - Printf("\\%.3o", uc); + printf("\\%.3o", uc); break; } - Printf("\""); + printf("\""); annotate(vp, fsp, cor, 0); } else { /* use format from C_format attribute */ for (iel = 0; iel < len - 1; iel++) { - Printf(fmt, *gp.cp++); - Printf(", "); + printf(fmt, *gp.cp++); + printf(", "); annotate(vp, fsp, cor, iel); } - Printf(fmt, *gp.cp++); + printf(fmt, *gp.cp++); lastdelim(more, lastrow); annotate(vp, fsp, cor, iel); } @@ -382,22 +382,22 @@ pr_cvals(struct ncvar *vp, long len, char *fmt, bool more, bool lastrow, void *v case NC_SHORT: gp.sp = (short *)vals; for (iel = 0; iel < len - 1; iel++) { - Printf(fmt, *gp.sp++); - Printf(", "); + printf(fmt, *gp.sp++); + printf(", "); annotate(vp, fsp, cor, iel); } - Printf(fmt, *gp.sp++); + printf(fmt, *gp.sp++); lastdelim(more, lastrow); annotate(vp, fsp, cor, iel); break; case NC_LONG: gp.lp = (nclong *)vals; for (iel = 0; iel < len - 1; iel++) { - Printf(fmt, *gp.lp++); - Printf(", "); + printf(fmt, *gp.lp++); + printf(", "); annotate(vp, fsp, cor, iel); } - Printf(fmt, *gp.lp++); + printf(fmt, *gp.lp++); lastdelim(more, lastrow); annotate(vp, fsp, cor, iel); break; @@ -405,17 +405,17 @@ pr_cvals(struct ncvar *vp, long len, char *fmt, bool more, bool lastrow, void *v gp.fp = (float *)vals; for (iel = 0; iel < len - 1; iel++) { if (*gp.fp >= fill_float) - Printf("FloatInf"); + printf("FloatInf"); else - Printf(fmt, (double)*gp.fp); - Printf(","); + printf(fmt, (double)*gp.fp); + printf(","); annotate(vp, fsp, cor, iel); gp.fp++; } if (*gp.fp >= fill_float) - Printf("FloatInf"); + printf("FloatInf"); else - Printf(fmt, (double)*gp.fp); + printf(fmt, (double)*gp.fp); lastdelim(more, lastrow); annotate(vp, fsp, cor, iel); gp.fp++; @@ -424,18 +424,18 @@ pr_cvals(struct ncvar *vp, long len, char *fmt, bool more, bool lastrow, void *v gp.dp = (double *)vals; for (iel = 0; iel < len - 1; iel++) { if (*gp.dp >= fill_double) - Printf("DoubleInf"); + printf("DoubleInf"); else { - Printf(fmt, *gp.dp); + printf(fmt, *gp.dp); } - Printf(","); + printf(","); annotate(vp, fsp, cor, iel); gp.dp++; } if (*gp.dp >= fill_double) - Printf("DoubleInf"); + printf("DoubleInf"); else - Printf(fmt, *gp.dp); + printf(fmt, *gp.dp); lastdelim(more, lastrow); annotate(vp, fsp, cor, iel); gp.dp++; @@ -509,11 +509,11 @@ vardata(struct ncvar *vp, long vdims[], int ncid, int varid, struct fspec *fsp) fixed_var = sanitize_string(vp->name, fsp->fix_str); if (vrank <= 1) { - Printf("\n %s = ", fixed_var); + printf("\n %s = ", fixed_var); set_indent(strlen(fixed_var) + 4); } else { - Printf("\n %s =\n ", fixed_var); + printf("\n %s =\n ", fixed_var); set_indent(2); } @@ -544,29 +544,29 @@ vardata(struct ncvar *vp, long vdims[], int ncid, int varid, struct fspec *fsp) corsav = cor[vrank - 1]; if (fsp->brief_data_cmnts != false && vrank > 1 && left > 0) { /* print brief comment with indices range */ - Printf("// %s(", fixed_var); + printf("// %s(", fixed_var); switch (fsp->data_lang) { case LANG_C: /* print brief comment with C variable indices */ for (id = 0; id < vrank - 1; id++) - Printf("%d,", (int)cor[id]); + printf("%d,", (int)cor[id]); if (vdims[vrank - 1] == 1) - Printf("0"); + printf("0"); else - Printf(" 0-%d", (int)vdims[vrank - 1] - 1); + printf(" 0-%d", (int)vdims[vrank - 1] - 1); break; case LANG_F: /* print brief comment with Fortran variable indices */ if (vdims[vrank - 1] == 1) - Printf("1"); + printf("1"); else - Printf("1-%d ", (int)vdims[vrank - 1]); + printf("1-%d ", (int)vdims[vrank - 1]); for (id = vrank - 2; id >= 0; id--) { - Printf(",%d", (int)(1 + cor[id])); + printf(",%d", (int)(1 + cor[id])); } break; } - Printf(")\n "); + printf(")\n "); set_indent(4); } } diff --git a/mfhdf/ncgen/close.c b/mfhdf/ncgen/close.c index 4896e97781..34613dc09a 100644 --- a/mfhdf/ncgen/close.c +++ b/mfhdf/ncgen/close.c @@ -19,8 +19,6 @@ cl_netcdf() derror("error closing netcdf"); } -#define fpr (void)fprintf - static void cl_c() { diff --git a/mfhdf/ncgen/generate.c b/mfhdf/ncgen/generate.c index ff07282c5b..f93da7e8a9 100644 --- a/mfhdf/ncgen/generate.c +++ b/mfhdf/ncgen/generate.c @@ -314,8 +314,8 @@ fline(const char *stmnt) while (len > 0) { if (line >= FORT_MAX_LINES) derror("FORTRAN statement too long: %s", stmnt); - (void)fprintf(fout, " %c", cont[line++]); - (void)fprintf(fout, "%.66s\n", stmnt); + fprintf(fout, " %c", cont[line++]); + fprintf(fout, "%.66s\n", stmnt); len -= 66; if (len > 0) stmnt += 66; diff --git a/mfhdf/ncgen/genlib.c b/mfhdf/ncgen/genlib.c index 1b64975acd..ae46121867 100644 --- a/mfhdf/ncgen/genlib.c +++ b/mfhdf/ncgen/genlib.c @@ -22,9 +22,9 @@ derror(const char *fmt, ...) va_list args; if (lineno == 1) - (void)fprintf(stderr, "%s: %s: ", progname, cdlname); + fprintf(stderr, "%s: %s: ", progname, cdlname); else - (void)fprintf(stderr, "%s: %s line %d: ", progname, cdlname, lineno); + fprintf(stderr, "%s: %s line %d: ", progname, cdlname, lineno); va_start(args, fmt); diff --git a/mfhdf/ncgen/load.c b/mfhdf/ncgen/load.c index d6ed9243be..db60d275c5 100644 --- a/mfhdf/ncgen/load.c +++ b/mfhdf/ncgen/load.c @@ -88,8 +88,6 @@ load_netcdf(void *rec_start) /* write out record from in-memory structure */ derror("error putting value for variable %s", vars[varnum].name); } -#define fpr (void)fprintf - /* * Remove trailing zeros (after decimal point) but not trailing decimal * point from ss, a string representation of a floating-point number that diff --git a/mfhdf/nctest/add.c b/mfhdf/nctest/add.c index 42993d033c..587c69cf66 100644 --- a/mfhdf/nctest/add.c +++ b/mfhdf/nctest/add.c @@ -29,7 +29,7 @@ add_dim(struct netcdf *test, struct cdfdim *idim) static char pname[] = "add_dim"; if (test->ndims >= H4_MAX_NC_DIMS) { - (void)fprintf(stderr, "%s: too many dimensions (%d)", pname, test->ndims); + fprintf(stderr, "%s: too many dimensions (%d)", pname, test->ndims); return; } test->dims[test->ndims].size = idim->size; @@ -48,7 +48,7 @@ add_var(struct netcdf *test, struct cdfvar *ivar) int i; if (test->nvars >= H4_MAX_NC_VARS) { - (void)fprintf(stderr, "%s: too many variables (%d)", pname, test->nvars); + fprintf(stderr, "%s: too many variables (%d)", pname, test->nvars); return; } @@ -71,7 +71,7 @@ add_att(struct netcdf *test, int varid, struct cdfatt *iatt) int ia; /* attribute number */ if (test->natts >= MAX_TEST_ATTS) { - (void)fprintf(stderr, "%s: too many attributes (%d)", pname, test->natts); + fprintf(stderr, "%s: too many attributes (%d)", pname, test->natts); return; } @@ -135,7 +135,7 @@ del_att(struct netcdf *test, int varid, struct cdfatt *iatt) } } /* not found */ - (void)fprintf(stderr, "%s: no such attribute as (%s, %s)", pname, test->vars[varid].name, iatt->name); + fprintf(stderr, "%s: no such attribute as (%s, %s)", pname, test->vars[varid].name, iatt->name); } /* keep max record written updated */ @@ -178,8 +178,8 @@ errvar(struct netcdf *cdfp, struct cdfvar *varp) break; } - (void)fprintf(stderr, " name=%s type=%s dims=(", varp->name, types); + fprintf(stderr, " name=%s type=%s dims=(", varp->name, types); for (id = 0; id < varp->ndims; id++) - (void)fprintf(stderr, "%d%s", (int)cdfp->dims[varp->dims[id]].size, id < varp->ndims - 1 ? ", " : ""); - (void)fprintf(stderr, ")\n"); + fprintf(stderr, "%d%s", (int)cdfp->dims[varp->dims[id]].size, id < varp->ndims - 1 ? ", " : ""); + fprintf(stderr, ")\n"); } diff --git a/mfhdf/nctest/atttests.c b/mfhdf/nctest/atttests.c index 497fa1a705..e862d7fcf7 100644 --- a/mfhdf/nctest/atttests.c +++ b/mfhdf/nctest/atttests.c @@ -74,7 +74,7 @@ test_ncattput(char *path) {"ww", NC_LONG, 1, ___, 0}; static struct cdfatt tmp; /* attribute */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -316,9 +316,9 @@ test_ncattput(char *path) } free(tmp.name); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -342,7 +342,7 @@ test_ncattinq(char *path) static struct cdfvar vv = /* new variable */ {"vv", NC_SHORT, 2, ___, 0}; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -428,9 +428,9 @@ test_ncattinq(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -459,7 +459,7 @@ test_ncattget(char *path) static char pname[] = "test_ncattget"; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -519,9 +519,9 @@ test_ncattget(char *path) error(" cdfid=%d, varname=%s, attname=%s, type=%d, len=%d", cdfid, test_g->vars[test_g->atts[ia].var].name, test_g->atts[ia].name, test_g->atts[ia].type, test_g->atts[ia].len); - (void)fprintf(stderr, "should have got:"); + fprintf(stderr, "should have got:"); val_out(test_g->atts[ia].type, test_g->atts[ia].len, test_g->atts[ia].val); - (void)fprintf(stderr, " instead got:"); + fprintf(stderr, " instead got:"); val_out(tmp.type, tmp.len, tmp.val); nerrs++; } @@ -562,9 +562,9 @@ test_ncattget(char *path) error(" cdfid=%d, varname=%s, attname=%s, type=%d, len=%d", cdfid, test_g->vars[test_g->atts[ia].var].name, test_g->atts[ia].name, test_g->atts[ia].type, test_g->atts[ia].len); - (void)fprintf(stderr, "should have got:"); + fprintf(stderr, "should have got:"); val_out(test_g->atts[ia].type, test_g->atts[ia].len, test_g->atts[ia].val); - (void)fprintf(stderr, " instead got:"); + fprintf(stderr, " instead got:"); val_out(tmp.type, tmp.len, tmp.val); nerrs++; } @@ -593,9 +593,9 @@ test_ncattget(char *path) return; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -633,7 +633,7 @@ test_ncattcopy(char *path1, char *path2) {___, "att", NC_FLOAT, LEN_OF(float_vals), (void *)float_vals}; static struct cdfatt tmp; /* attribute */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path1, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -911,9 +911,9 @@ test_ncattcopy(char *path1, char *path2) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -939,7 +939,7 @@ test_ncattname(char *path) static struct cdfatt att = /* attribute */ {___, ___, NC_SHORT, LEN_OF(short_vals), (void *)short_vals}; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -1103,9 +1103,9 @@ test_ncattname(char *path) free(tmp.name); free(att.name); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -1134,7 +1134,7 @@ test_ncattrename(char *path) {___, "arggh", NC_SHORT, LEN_OF(short_vals), (void *)short_vals}; int ynum; /* attribute number */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -1256,9 +1256,9 @@ test_ncattrename(char *path) return; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -1291,7 +1291,7 @@ test_ncattdel(char *path) int natts; /* number of variable attributes */ int xdimid; /* id of unlimited dimension */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -1434,7 +1434,7 @@ test_ncattdel(char *path) free(vtmp.name); free(yav.dims); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/cdftests.c b/mfhdf/nctest/cdftests.c index c82f1bdfd9..edc8d9822c 100644 --- a/mfhdf/nctest/cdftests.c +++ b/mfhdf/nctest/cdftests.c @@ -39,7 +39,7 @@ test_nccreate(char *path) static char pname[] = "test_nccreate"; int cdfid; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = nccreate(path, NC_CLOBBER)) == -1) { error("%s: nccreate failed to NC_CLOBBER", pname); @@ -72,9 +72,9 @@ test_nccreate(char *path) /* Initialize in-memory netcdf to empty */ add_reset(test_g); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -98,7 +98,7 @@ test_ncopen(char *path) static struct cdfatt title = /* attribute */ {NC_GLOBAL, "title", NC_CHAR, LEN_OF(title_val), (void *)title_val}; - (void)fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); if ((cdfid0 = ncopen(xpath, NC_NOWRITE)) != -1) { error("%s: ncopen should fail opening nonexistent file", pname); @@ -168,9 +168,9 @@ test_ncopen(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -199,7 +199,7 @@ test_ncredef(char *path) static struct cdfatt aa_units = /* attribute */ {___, "units", NC_CHAR, LEN_OF(units_val), (void *)units_val}; - (void)fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -259,9 +259,9 @@ test_ncredef(char *path) } free(aa.dims); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -291,7 +291,7 @@ test_ncendef(char *path) static struct cdfatt bb_range = /* attribute */ {___, "valid_range", NC_FLOAT, LEN_OF(bb_rangev), (void *)bb_rangev}; - (void)fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -353,9 +353,9 @@ test_ncendef(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -373,7 +373,7 @@ test_ncclose(char *path) static char pname[] = "test_ncclose"; int cdfid; /* netcdf id */ - (void)fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -405,9 +405,9 @@ test_ncclose(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -448,7 +448,7 @@ test_ncinquire(char *path) static struct cdfatt cc_units = /* attribute */ {___, "units", NC_CHAR, LEN_OF(units_val), (void *)units_val}; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -562,9 +562,9 @@ test_ncinquire(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -591,7 +591,7 @@ test_ncsync(char *path) static struct cdfatt dd_fill_val = /* attribute */ {___, "fill_value", NC_SHORT, LEN_OF(dd_fill_valv), (void *)dd_fill_valv}; - (void)fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); if ((cdfid0 = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen in NC_WRITE mode failed", pname); @@ -694,9 +694,9 @@ test_ncsync(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -718,7 +718,7 @@ test_ncabort(char *path) {___, "temp", NC_SHORT, LEN_OF(attv), (void *)attv}; int cdfid; /* netcdf id */ - (void)fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -777,7 +777,7 @@ test_ncabort(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/dimtests.c b/mfhdf/nctest/dimtests.c index 6f40291746..ebb7d46530 100644 --- a/mfhdf/nctest/dimtests.c +++ b/mfhdf/nctest/dimtests.c @@ -48,7 +48,7 @@ test_ncdimdef(char *path) int xdimid; /* id of unlimited dimension, or -1 if none */ int dimid; /* dimension id */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -126,9 +126,9 @@ test_ncdimdef(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -149,7 +149,7 @@ test_ncdimid(char *path) static struct cdfdim nn = /* dimension */ {"nn", 1}; /* 1 should be a valid dimension size */ - (void)fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -207,9 +207,9 @@ test_ncdimid(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -229,7 +229,7 @@ test_ncdiminq(char *path) int dimid; /* dimension id */ struct cdfdim dim; /* dimension */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -304,9 +304,9 @@ test_ncdiminq(char *path) } free(dim.name); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -332,7 +332,7 @@ test_ncdimrename(char *path) static struct cdfdim qq = /* dimension */ {"qq", 10}; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -418,7 +418,7 @@ test_ncdimrename(char *path) } free(dim.name); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/error.c b/mfhdf/nctest/error.c index e2c7a09a62..c2b26d29a9 100644 --- a/mfhdf/nctest/error.c +++ b/mfhdf/nctest/error.c @@ -26,13 +26,13 @@ error(const char *fmt, ...) { va_list args; - (void)fprintf(stderr, "*** "); + fprintf(stderr, "*** "); va_start(args, fmt); (void)vfprintf(stderr, fmt, args); va_end(args); - (void)fprintf(stderr, "\n"); + fprintf(stderr, "\n"); error_count++; } diff --git a/mfhdf/nctest/misctest.c b/mfhdf/nctest/misctest.c index bcbfe7e8fc..338a398d17 100644 --- a/mfhdf/nctest/misctest.c +++ b/mfhdf/nctest/misctest.c @@ -30,7 +30,7 @@ test_nctypelen() int nerrs = 0; static char pname[] = "test_nctypelen"; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if (nctypelen(NC_BYTE) != sizeof(char)) { error("%s: nctypelen failed for NC_BYTE", pname); @@ -57,7 +57,7 @@ test_nctypelen() nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/rec.c b/mfhdf/nctest/rec.c index b7877294f8..787d7a4c31 100644 --- a/mfhdf/nctest/rec.c +++ b/mfhdf/nctest/rec.c @@ -129,7 +129,7 @@ test_ncrecinq(char *path) long trvarsizes[VARS]; /* true rec size of each record variable */ int iv; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((ncid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -203,9 +203,9 @@ test_ncrecinq(char *path) } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -320,7 +320,7 @@ test_ncrecput(char *path) nc_type vartype[VARS]; void *zeros[VARS]; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((ncid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -445,9 +445,9 @@ test_ncrecput(char *path) } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -475,7 +475,7 @@ test_ncrecget(char *path) nc_type vartype[VARS]; void *zeros[VARS]; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((ncid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -577,7 +577,7 @@ test_ncrecget(char *path) } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/val.c b/mfhdf/nctest/val.c index 24e6dc28f9..91c7b8cda4 100644 --- a/mfhdf/nctest/val.c +++ b/mfhdf/nctest/val.c @@ -211,33 +211,33 @@ val_out(nc_type type, long len, void *vals) double *dp; } gp; - (void)fprintf(stderr, " "); + fprintf(stderr, " "); switch (type) { case NC_BYTE: case NC_CHAR: gp.cp = (char *)vals; for (iel = 0; iel < len; iel++) - (void)fprintf(stderr, "%d%s", *gp.cp++, iel < len - 1 ? ", " : ""); + fprintf(stderr, "%d%s", *gp.cp++, iel < len - 1 ? ", " : ""); break; case NC_SHORT: gp.sp = (short *)vals; for (iel = 0; iel < len; iel++) - (void)fprintf(stderr, "%d%s", *gp.sp++, iel < len - 1 ? ", " : ""); + fprintf(stderr, "%d%s", *gp.sp++, iel < len - 1 ? ", " : ""); break; case NC_LONG: gp.lp = (nclong *)vals; for (iel = 0; iel < len; iel++) - (void)fprintf(stderr, "%d%s", (int)*gp.lp++, iel < len - 1 ? ", " : ""); + fprintf(stderr, "%d%s", (int)*gp.lp++, iel < len - 1 ? ", " : ""); break; case NC_FLOAT: gp.fp = (float *)vals; for (iel = 0; iel < len; iel++) - (void)fprintf(stderr, "%g%s", (double)*gp.fp++, iel < len - 1 ? ", " : ""); + fprintf(stderr, "%g%s", (double)*gp.fp++, iel < len - 1 ? ", " : ""); break; case NC_DOUBLE: gp.dp = (double *)vals; for (iel = 0; iel < len; iel++) - (void)fprintf(stderr, "%g%s", *gp.dp++, iel < len - 1 ? ", " : ""); + fprintf(stderr, "%g%s", *gp.dp++, iel < len - 1 ? ", " : ""); break; default: error("%s: bad type, test program error", pname); diff --git a/mfhdf/nctest/vardef.c b/mfhdf/nctest/vardef.c index 6f8c14e3da..045e3a4384 100644 --- a/mfhdf/nctest/vardef.c +++ b/mfhdf/nctest/vardef.c @@ -59,7 +59,7 @@ test_ncvardef(char *path) int nd = LEN_OF(di); /* number of dimensions */ int di_id[LEN_OF(di)]; /* dimension ids */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -272,7 +272,7 @@ test_ncvardef(char *path) for (iv = 0; iv < nv; iv++) free(va[iv].dims); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/varget.c b/mfhdf/nctest/varget.c index b9000871e4..656afab2a5 100644 --- a/mfhdf/nctest/varget.c +++ b/mfhdf/nctest/varget.c @@ -42,7 +42,7 @@ test_ncvarget(char *path) void *vals; /* pointer to block of values */ } hc; /* test hypercube */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -143,7 +143,7 @@ test_ncvarget(char *path) } free(hc.vals); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/varget_unlim.c b/mfhdf/nctest/varget_unlim.c index 7a39eed7d7..21eefba3c7 100644 --- a/mfhdf/nctest/varget_unlim.c +++ b/mfhdf/nctest/varget_unlim.c @@ -50,7 +50,7 @@ test_ncvarget_unlim(char *basefile) long start[3], count[3]; int i, j, n; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if (srcdir) { strcpy(testfile, srcdir); @@ -156,7 +156,7 @@ test_ncvarget_unlim(char *basefile) status = ncclose(ncid); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/vargetg.c b/mfhdf/nctest/vargetg.c index 4ad5177f42..f004b0a9c4 100644 --- a/mfhdf/nctest/vargetg.c +++ b/mfhdf/nctest/vargetg.c @@ -44,7 +44,7 @@ test_ncvargetg(char *path) } hc; /* test hypercube */ long strides[H4_MAX_VAR_DIMS]; /* external, I/O strides */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -149,7 +149,7 @@ test_ncvargetg(char *path) } free(hc.vals); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/varput.c b/mfhdf/nctest/varput.c index f7a091fd56..e2e5fd05dc 100644 --- a/mfhdf/nctest/varput.c +++ b/mfhdf/nctest/varput.c @@ -45,7 +45,7 @@ test_ncvarput(char *path) int tmp; int id; /* dimension id */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); /* handle case where struct netcdf test is uninitialised */ hc.cor[0] = 0; @@ -150,7 +150,7 @@ test_ncvarput(char *path) } free(hc.vals); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/varputg.c b/mfhdf/nctest/varputg.c index 713f2b5cba..4a870bfd57 100644 --- a/mfhdf/nctest/varputg.c +++ b/mfhdf/nctest/varputg.c @@ -47,7 +47,7 @@ test_ncvarputg(char *path) int id; /* dimension id */ long strides[H4_MAX_VAR_DIMS]; /* external, I/O strides */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -153,7 +153,7 @@ test_ncvarputg(char *path) } free(hc.vals); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/vartests.c b/mfhdf/nctest/vartests.c index 336eaeee09..2d34a752e5 100644 --- a/mfhdf/nctest/vartests.c +++ b/mfhdf/nctest/vartests.c @@ -42,7 +42,7 @@ test_ncvarid(char *path) static struct cdfvar xx = /* variable */ {"xx", NC_FLOAT, 1, ___, 0}; - (void)fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -98,9 +98,9 @@ test_ncvarid(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -121,7 +121,7 @@ test_ncvarinq(char *path) struct cdfvar var; /* variable */ int idim; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -223,9 +223,9 @@ test_ncvarinq(char *path) free(var.dims); free(var.name); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } struct cdfelm { /* coordinates and generic value */ @@ -381,7 +381,7 @@ test_ncvarput1(char *path) int iv; /* variable id */ struct cdfelm elm; /* coordinates and value of test point */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -448,9 +448,9 @@ test_ncvarput1(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -472,7 +472,7 @@ test_ncvarget1(char *path) int iv; /* variable id */ struct cdfelm elm; /* coordinates and value of test point */ - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -539,9 +539,9 @@ test_ncvarget1(char *path) nerrs++; } if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } /* @@ -569,7 +569,7 @@ test_ncvarrename(char *path) static struct cdfvar zz = /* variable */ {"zz", NC_BYTE, 2, ___, 0}; - (void)fprintf(stderr, "*** Testing %s ...\t", &pname[5]); + fprintf(stderr, "*** Testing %s ...\t", &pname[5]); if ((cdfid = ncopen(path, NC_WRITE)) == -1) { error("%s: ncopen failed", pname); @@ -670,7 +670,7 @@ test_ncvarrename(char *path) free(var.name); free(var.dims); if (nerrs > 0) - (void)fprintf(stderr, "FAILED! ***\n"); + fprintf(stderr, "FAILED! ***\n"); else - (void)fprintf(stderr, "ok ***\n"); + fprintf(stderr, "ok ***\n"); } diff --git a/mfhdf/nctest/vputget.c b/mfhdf/nctest/vputget.c index 0fadd48228..43b985f8bc 100644 --- a/mfhdf/nctest/vputget.c +++ b/mfhdf/nctest/vputget.c @@ -91,16 +91,16 @@ test_varputget(int cdfid) error("%s: ncvarput failed for point %d, variable %s", pname, ie, test_g->vars[iv].name); nerrs++; errvar(test_g, &test_g->vars[iv]); - (void)fprintf(stderr, " corner = ("); + fprintf(stderr, " corner = ("); for (id = 0; id < test_g->vars[iv].ndims; id++) - (void)fprintf(stderr, "%d%s", (int)hc[ie].cor[id], - (id < test_g->vars[iv].ndims - 1) ? ", " : ""); - (void)fprintf(stderr, ")\n"); - (void)fprintf(stderr, " edge = ("); + fprintf(stderr, "%d%s", (int)hc[ie].cor[id], + (id < test_g->vars[iv].ndims - 1) ? ", " : ""); + fprintf(stderr, ")\n"); + fprintf(stderr, " edge = ("); for (id = 0; id < test_g->vars[iv].ndims; id++) - (void)fprintf(stderr, "%d%s", (int)hc[ie].edg[id], - (id < test_g->vars[iv].ndims - 1) ? ", " : ""); - (void)fprintf(stderr, ")\n"); + fprintf(stderr, "%d%s", (int)hc[ie].edg[id], + (id < test_g->vars[iv].ndims - 1) ? ", " : ""); + fprintf(stderr, ")\n"); } else { add_data(test_g, iv, hc[ie].cor, hc[ie].edg); /* keep test in sync */ diff --git a/mfhdf/nctest/vputgetg.c b/mfhdf/nctest/vputgetg.c index 0a54331cf9..9fdb270e9d 100644 --- a/mfhdf/nctest/vputgetg.c +++ b/mfhdf/nctest/vputgetg.c @@ -116,26 +116,24 @@ test_varputgetg(int cdfid) error("%s: ncvarputg failed for point %d, variable %s", pname, ie, test_g->vars[iv].name); nerrs++; errvar(test_g, &test_g->vars[iv]); - (void)fprintf(stderr, " corner = ("); + fprintf(stderr, " corner = ("); for (id = 0; id < test_g->vars[iv].ndims; id++) - (void)fprintf(stderr, "%d%s", (int)hc[ie].cor[id], - (id < test_g->vars[iv].ndims - 1) ? ", " : ""); - (void)fprintf(stderr, ")\n"); - (void)fprintf(stderr, " edge = ("); + fprintf(stderr, "%d%s", (int)hc[ie].cor[id], + (id < test_g->vars[iv].ndims - 1) ? ", " : ""); + fprintf(stderr, ")\n"); + fprintf(stderr, " edge = ("); for (id = 0; id < test_g->vars[iv].ndims; id++) - (void)fprintf(stderr, "%d%s", (int)hc[ie].edg[id], - (id < test_g->vars[iv].ndims - 1) ? ", " : ""); - (void)fprintf(stderr, ")\n"); - (void)fprintf(stderr, " external strides = ("); + fprintf(stderr, "%d%s", (int)hc[ie].edg[id], + (id < test_g->vars[iv].ndims - 1) ? ", " : ""); + fprintf(stderr, ")\n"); + fprintf(stderr, " external strides = ("); for (id = 0; id < test_g->vars[iv].ndims; id++) - (void)fprintf(stderr, "%d%s", (int)strides[id], - (id < test_g->vars[iv].ndims - 1) ? ", " : ""); - (void)fprintf(stderr, ")\n"); - (void)fprintf(stderr, " internal basis vector = ("); + fprintf(stderr, "%d%s", (int)strides[id], (id < test_g->vars[iv].ndims - 1) ? ", " : ""); + fprintf(stderr, ")\n"); + fprintf(stderr, " internal basis vector = ("); for (id = 0; id < test_g->vars[iv].ndims; id++) - (void)fprintf(stderr, "%d%s", (int)basis[id], - (id < test_g->vars[iv].ndims - 1) ? ", " : ""); - (void)fprintf(stderr, ")\n"); + fprintf(stderr, "%d%s", (int)basis[id], (id < test_g->vars[iv].ndims - 1) ? ", " : ""); + fprintf(stderr, ")\n"); } else { long dsize[H4_MAX_VAR_DIMS]; diff --git a/mfhdf/test/cdftest.c b/mfhdf/test/cdftest.c index 80957e0ff2..e63ef150ce 100644 --- a/mfhdf/test/cdftest.c +++ b/mfhdf/test/cdftest.c @@ -600,7 +600,7 @@ main(void) cdf_assert(ncvarget1(id, Byte_id, indices[6], (ncvoid *)&got) != -1); printf("got val = %c (0x%02x) \n", got.by[0], got.by[0]); - /* (void)memset(new,0,256) ; */ + /* memset(new,0,256) ; */ { char *cp = new; for (; cp < &new[sizeof(new) - 1]; *cp++ = 0) diff --git a/mfhdf/util/h4getopt.c b/mfhdf/util/h4getopt.c index 2312856841..805e682994 100644 --- a/mfhdf/util/h4getopt.c +++ b/mfhdf/util/h4getopt.c @@ -84,7 +84,7 @@ h4getopt(int argc, char *const argv[], const char *optstring) if (*place == 0) ++h4optind; if (h4opterr && *optstring != ':') - (void)fprintf(stderr, "unknown option -- %c\n", h4optopt); + fprintf(stderr, "unknown option -- %c\n", h4optopt); return BADCH; } @@ -108,7 +108,7 @@ h4getopt(int argc, char *const argv[], const char *optstring) if (*optstring == ':') return BADARG; if (h4opterr) - (void)fprintf(stderr, "option requires an argument -- %c\n", h4optopt); + fprintf(stderr, "option requires an argument -- %c\n", h4optopt); return BADCH; } place = EMSG; From a5bcf532c0f9e378453cc1bc8f64aa6850978b23 Mon Sep 17 00:00:00 2001 From: bmribler <39579120+bmribler@users.noreply.github.com> Date: Sun, 18 Feb 2024 04:20:17 -0500 Subject: [PATCH 40/65] Check for invalid file ID in Vinitialize (#550) --- hdf/src/hfile.c | 2 +- hdf/src/vgp.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hdf/src/hfile.c b/hdf/src/hfile.c index 19fb2b354b..21ef511d35 100644 --- a/hdf/src/hfile.c +++ b/hdf/src/hfile.c @@ -205,7 +205,7 @@ static intn HIstart(void); /*-------------------------------------------------------------------------- NAME - Hopen -- Opens a HDF file. + Hopen -- Opens or creates an HDF file. USAGE int32 Hopen(path, access, ndds) char *path; IN: Name of file to be opened. diff --git a/hdf/src/vgp.c b/hdf/src/vgp.c index 66071bef26..5136f45efe 100644 --- a/hdf/src/vgp.c +++ b/hdf/src/vgp.c @@ -645,6 +645,10 @@ Vinitialize(HFILEID f /* IN: file handle */) /* clear error stack */ HEclear(); + /* Check file ID */ + if (f < 0) + HGOTO_ERROR(DFE_ARGS, FAIL); + /* Perform global, one-time initialization */ if (library_terminate == FALSE) { if (VIstart() == FAIL) From 3ccac38a06f705f10fe67e18f2a45adec22d3827 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Sun, 18 Feb 2024 04:35:46 -0800 Subject: [PATCH 41/65] Use AC_MSG macros in configure.ac (#546) --- configure.ac | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 7d73fb557b..30e3dbe899 100644 --- a/configure.ac +++ b/configure.ac @@ -364,7 +364,7 @@ AC_ARG_ENABLE([java], if test "X$HDF_JAVA" = "Xyes"; then if test "X${enable_shared}" != "Xno"; then - echo "yes" + AC_MSG_RESULT([yes]) if test "X$CLASSPATH" = "X"; then H4_CLASSPATH=".:$srcdir/java/lib" else @@ -568,14 +568,14 @@ AC_ARG_ENABLE([static_exec], [STATIC_EXEC=$enableval]) if test "X$STATIC_EXEC" = "Xyes"; then - echo "yes" + AC_MSG_RESULT([yes]) ## Issue a warning if -static flag is not supported. if test "X$lt_cv_prog_compiler_static_works" = "Xno"; then - echo " warning: -static flag not supported on this system; executable won't statically link shared system libraries." + AC_MSG_WARN([-static flag not supported on this system; executable won't statically link shared system libraries]) fi LT_STATIC_EXEC="-all-static" else - echo "no" + AC_MSG_RESULT([no]) LT_STATIC_EXEC="" fi From 99fe727aa6eb33fbbbb1dbd76ce035e83bb304c7 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Sun, 18 Feb 2024 04:36:03 -0800 Subject: [PATCH 42/65] Load missing gcc general warnings in Autotools (#553) The config/gnu-flags file didn't load the general warnings for gcc, so critical warnings like -Wall and -Wextra were missing. --- config/gnu-flags | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/config/gnu-flags b/config/gnu-flags index 08728bf303..7d688e00e9 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -125,6 +125,16 @@ if test "X-gcc" = "X-$cc_vendor"; then PROFILE_CFLAGS="-pg" PROFILE_CPPFLAGS= + #################### + # General warnings # + #################### + + # Add various general warning flags in gnu-warnings for gcc versions 4.8 and later. + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 8 -o $cc_vers_major -gt 4; then + CFLAGS="$CFLAGS $(load_gnu_arguments general)" + CFLAGS="$CFLAGS $(load_gnu_arguments no-developer-general)" + fi + ############################# # Version-specific warnings # ############################# From c5b44e4f6beaef4e95c5c47f522dcf789d34024e Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Sun, 18 Feb 2024 04:36:14 -0800 Subject: [PATCH 43/65] Remove unused done target from an szip function (#554) --- hdf/src/mfgr.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/hdf/src/mfgr.c b/hdf/src/mfgr.c index 303a659038..e8173c62cc 100644 --- a/hdf/src/mfgr.c +++ b/hdf/src/mfgr.c @@ -3936,11 +3936,6 @@ GRsetaccesstype(int32 riid, uintn accesstype) DESCRIPTION Sets the computed szip parameters before calling HCcreate. - - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - EXAMPLES - REVISION LOG --------------------------------------------------------------------------*/ intn GRsetup_szip_parms(ri_info_t *ri_ptr, comp_info *c_info, int32 *cdims) @@ -3949,7 +3944,6 @@ GRsetup_szip_parms(ri_info_t *ri_ptr, comp_info *c_info, int32 *cdims) int32 ndims; int32 ncomp; int32 xdims[H4_MAX_VAR_DIMS]; - intn ret_value = SUCCEED; ndims = 2; xdims[0] = ri_ptr->img_dim.xdim; @@ -3958,10 +3952,7 @@ GRsetup_szip_parms(ri_info_t *ri_ptr, comp_info *c_info, int32 *cdims) nt = ri_ptr->img_dim.nt; ncomp = ri_ptr->img_dim.ncomps; - ret_value = HCPsetup_szip_parms(c_info, nt, ncomp, ndims, xdims, cdims); - -done: - return ret_value; + return HCPsetup_szip_parms(c_info, nt, ncomp, ndims, xdims, cdims); } #endif From 50a312755936257984239ce90379d116abce51c9 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Sun, 18 Feb 2024 11:53:45 -0800 Subject: [PATCH 44/65] Sync Autotools m4 Java files w/ HDF5 (#544) --- m4/ax_check_class.m4 | 71 ++------------------------------------- m4/ax_check_classpath.m4 | 6 ++-- m4/ax_check_java_home.m4 | 6 ++-- m4/ax_check_junit.m4 | 4 +-- m4/ax_check_rqrd_class.m4 | 6 ++-- m4/ax_java_check_class.m4 | 8 ++--- m4/ax_java_options.m4 | 4 +-- m4/ax_jni_include_dir.m4 | 67 ++++++++++++++++++++++++------------ m4/ax_prog_jar.m4 | 4 +-- m4/ax_prog_java.m4 | 6 ++-- m4/ax_prog_java_cc.m4 | 6 ++-- m4/ax_prog_java_works.m4 | 51 +++------------------------- m4/ax_prog_javac.m4 | 6 ++-- m4/ax_prog_javac_works.m4 | 6 ++-- m4/ax_prog_javadoc.m4 | 4 +-- m4/ax_prog_javah.m4 | 16 ++++----- m4/ax_try_compile_java.m4 | 8 ++--- m4/ax_try_run_java.m4 | 4 +-- 18 files changed, 100 insertions(+), 183 deletions(-) diff --git a/m4/ax_check_class.m4 b/m4/ax_check_class.m4 index 2cc50db4d5..e673c2d35d 100644 --- a/m4/ax_check_class.m4 +++ b/m4/ax_check_class.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_class.html +# https://www.gnu.org/software/autoconf-archive/ax_check_class.html # =========================================================================== # # SYNOPSIS @@ -36,7 +36,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -51,7 +51,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 7 +#serial 12 AU_ALIAS([AC_CHECK_CLASS], [AX_CHECK_CLASS]) AC_DEFUN([AX_CHECK_CLASS],[ @@ -61,73 +61,8 @@ dnl Normally I'd use a AC_CACHE_CHECK here but since the variable name is dnl dynamic I need an extra level of extraction AC_MSG_CHECKING([for $1 class]) AC_CACHE_VAL(ax_cv_class_$ac_var_name, [ -if test x$ac_cv_prog_uudecode_base64 = xyes; then -dnl /** -dnl * Test.java: used to test dynamically if a class exists. -dnl */ -dnl public class Test -dnl { -dnl -dnl public static void -dnl main( String[] argv ) -dnl { -dnl Class lib; -dnl if (argv.length < 1) -dnl { -dnl System.err.println ("Missing argument"); -dnl System.exit (77); -dnl } -dnl try -dnl { -dnl lib = Class.forName (argv[0]); -dnl } -dnl catch (ClassNotFoundException e) -dnl { -dnl System.exit (1); -dnl } -dnl lib = null; -dnl System.exit (0); -dnl } -dnl -dnl } -cat << \EOF > Test.uue -begin-base64 644 Test.class -yv66vgADAC0AKQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE -bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 -bWJlclRhYmxlDAAKAAsBAANlcnIBABVMamF2YS9pby9QcmludFN0cmVhbTsJ -AA0ACQcADgEAEGphdmEvbGFuZy9TeXN0ZW0IABABABBNaXNzaW5nIGFyZ3Vt -ZW50DAASABMBAAdwcmludGxuAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWCgAV -ABEHABYBABNqYXZhL2lvL1ByaW50U3RyZWFtDAAYABkBAARleGl0AQAEKEkp -VgoADQAXDAAcAB0BAAdmb3JOYW1lAQAlKExqYXZhL2xhbmcvU3RyaW5nOylM -amF2YS9sYW5nL0NsYXNzOwoAHwAbBwAgAQAPamF2YS9sYW5nL0NsYXNzBwAi -AQAgamF2YS9sYW5nL0NsYXNzTm90Rm91bmRFeGNlcHRpb24BAAY8aW5pdD4B -AAMoKVYMACMAJAoAAwAlAQAKU291cmNlRmlsZQEACVRlc3QuamF2YQAhAAEA -AwAAAAAAAgAJAAUABgABAAcAAABtAAMAAwAAACkqvgSiABCyAAwSD7YAFBBN -uAAaKgMyuAAeTKcACE0EuAAaAUwDuAAasQABABMAGgAdACEAAQAIAAAAKgAK -AAAACgAAAAsABgANAA4ADgATABAAEwASAB4AFgAiABgAJAAZACgAGgABACMA -JAABAAcAAAAhAAEAAQAAAAUqtwAmsQAAAAEACAAAAAoAAgAAAAQABAAEAAEA -JwAAAAIAKA== -==== -EOF - if $UUDECODE Test.uue; then - : - else - echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AS_MESSAGE_LOG_FD - echo "configure: failed file was:" >&AS_MESSAGE_LOG_FD - cat Test.uue >&AS_MESSAGE_LOG_FD - ac_cv_prog_uudecode_base64=no - fi - rm -f Test.uue - if AC_TRY_COMMAND($JAVA $JAVAFLAGS Test $1) >/dev/null 2>&1; then - eval "ac_cv_class_$ac_var_name=yes" - else - eval "ac_cv_class_$ac_var_name=no" - fi - rm -f Test.class -else AX_TRY_COMPILE_JAVA([$1], , [eval "ac_cv_class_$ac_var_name=yes"], [eval "ac_cv_class_$ac_var_name=no"]) -fi eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`" HAVE_LAST_CLASS=$ac_var_val diff --git a/m4/ax_check_classpath.m4 b/m4/ax_check_classpath.m4 index 3c9081a087..e08a253d8b 100644 --- a/m4/ax_check_classpath.m4 +++ b/m4/ax_check_classpath.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_classpath.html +# https://www.gnu.org/software/autoconf-archive/ax_check_classpath.html # =========================================================================== # # SYNOPSIS @@ -33,7 +33,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -48,7 +48,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 5 +#serial 6 AU_ALIAS([AC_CHECK_CLASSPATH], [AX_CHECK_CLASSPATH]) AC_DEFUN([AX_CHECK_CLASSPATH],[ diff --git a/m4/ax_check_java_home.m4 b/m4/ax_check_java_home.m4 index cfe8f58928..1d60387b1b 100644 --- a/m4/ax_check_java_home.m4 +++ b/m4/ax_check_java_home.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_java_home.html +# https://www.gnu.org/software/autoconf-archive/ax_check_java_home.html # =========================================================================== # # SYNOPSIS @@ -28,7 +28,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -43,7 +43,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 6 +#serial 7 AU_ALIAS([AC_CHECK_JAVA_HOME], [AX_CHECK_JAVA_HOME]) diff --git a/m4/ax_check_junit.m4 b/m4/ax_check_junit.m4 index 39b52d1f73..44dd70df3b 100644 --- a/m4/ax_check_junit.m4 +++ b/m4/ax_check_junit.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_junit.html +# https://www.gnu.org/software/autoconf-archive/ax_check_junit.html # =========================================================================== # # SYNOPSIS @@ -45,7 +45,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 5 +#serial 6 AU_ALIAS([AC_CHECK_JUNIT], [AX_CHECK_JUNIT]) AC_DEFUN([AX_CHECK_JUNIT],[ diff --git a/m4/ax_check_rqrd_class.m4 b/m4/ax_check_rqrd_class.m4 index 8f14241b1b..baa041aca5 100644 --- a/m4/ax_check_rqrd_class.m4 +++ b/m4/ax_check_rqrd_class.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_rqrd_class.html +# https://www.gnu.org/software/autoconf-archive/ax_check_rqrd_class.html # =========================================================================== # # SYNOPSIS @@ -35,7 +35,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -50,7 +50,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 5 +#serial 6 AU_ALIAS([AC_CHECK_RQRD_CLASS], [AX_CHECK_RQRD_CLASS]) AC_DEFUN([AX_CHECK_RQRD_CLASS],[ diff --git a/m4/ax_java_check_class.m4 b/m4/ax_java_check_class.m4 index 917638ae4b..c9d60f7861 100644 --- a/m4/ax_java_check_class.m4 +++ b/m4/ax_java_check_class.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_java_check_class.html +# https://www.gnu.org/software/autoconf-archive/ax_java_check_class.html # =========================================================================== # # SYNOPSIS @@ -15,7 +15,7 @@ # # The macro tries to compile a minimal program importing . Some # newer compilers moan about the failure to use this but fail or produce a -# class file anyway. All moaing is sunk to /dev/null since I only wanted +# class file anyway. All moaning is sunk to /dev/null since I only wanted # to know if the class could be imported. This is a recommended followup # to AX_CHECK_JAVA_PLUGIN with classpath appropriately adjusted. # @@ -34,7 +34,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -49,7 +49,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 9 +#serial 12 AU_ALIAS([DPS_JAVA_CHECK_CLASS], [AX_JAVA_CHECK_CLASS]) AC_DEFUN([AX_JAVA_CHECK_CLASS],[ diff --git a/m4/ax_java_options.m4 b/m4/ax_java_options.m4 index 36c10d922b..722d788027 100644 --- a/m4/ax_java_options.m4 +++ b/m4/ax_java_options.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_java_options.html +# https://www.gnu.org/software/autoconf-archive/ax_java_options.html # =========================================================================== # # SYNOPSIS @@ -27,7 +27,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 6 +#serial 7 AU_ALIAS([AC_JAVA_OPTIONS], [AX_JAVA_OPTIONS]) AC_DEFUN([AX_JAVA_OPTIONS],[ diff --git a/m4/ax_jni_include_dir.m4 b/m4/ax_jni_include_dir.m4 index becb33a34a..cd720987b7 100644 --- a/m4/ax_jni_include_dir.m4 +++ b/m4/ax_jni_include_dir.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html +# https://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html # =========================================================================== # # SYNOPSIS @@ -32,6 +32,10 @@ # # - at the configure level, setenv JAVAC # +# This macro depends on AC_CANONICAL_HOST which requires that config.guess +# and config.sub be distributed along with the source code. See autoconf +# manual for details. +# # Note: This macro can work with the autoconf M4 macros for Java programs. # This particular macro is not part of the original set of macros. # @@ -44,11 +48,13 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 11 +#serial 15 AU_ALIAS([AC_JNI_INCLUDE_DIR], [AX_JNI_INCLUDE_DIR]) AC_DEFUN([AX_JNI_INCLUDE_DIR],[ +AC_REQUIRE([AC_CANONICAL_HOST]) + JNI_INCLUDE_DIRS="" if test "x$JAVA_HOME" != x; then @@ -66,14 +72,23 @@ else fi case "$host_os" in - darwin*) # Apple JDK is at /System location and has headers symlinked elsewhere - case "$_JTOPDIR" in - /System/Library/Frameworks/JavaVM.framework/*) - _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` - _JINC="$_JTOPDIR/Headers";; - *) _JINC="$_JTOPDIR/include";; - esac;; - *) _JINC="$_JTOPDIR/include";; + darwin*) # Apple Java headers are inside the Xcode bundle. + major_macos_version=$(sw_vers -productVersion | sed -n -e 's/^\(@<:@0-9@:>@*\).@<:@0-9@:>@*.@<:@0-9@:>@*/\1/p') + if @<:@ "$major_macos_version" -gt "10" @:>@; then + _JTOPDIR="$(/usr/libexec/java_home)" + _JINC="$_JTOPDIR/include" + else + macos_version=$(sw_vers -productVersion | sed -n -e 's/^@<:@0-9@:>@*.\(@<:@0-9@:>@*\).@<:@0-9@:>@*/\1/p') + if @<:@ "$macos_version" -gt "7" @:>@; then + _JTOPDIR="$(xcrun --show-sdk-path)/System/Library/Frameworks/JavaVM.framework" + _JINC="$_JTOPDIR/Headers" + else + _JTOPDIR="/System/Library/Frameworks/JavaVM.framework" + _JINC="$_JTOPDIR/Headers" + fi + fi + ;; + *) _JINC="$_JTOPDIR/include";; esac _AS_ECHO_LOG([_JTOPDIR=$_JTOPDIR]) _AS_ECHO_LOG([_JINC=$_JINC]) @@ -81,13 +96,21 @@ _AS_ECHO_LOG([_JINC=$_JINC]) # On Mac OS X 10.6.4, jni.h is a symlink: # /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/jni.h # -> ../../CurrentJDK/Headers/jni.h. -AC_CHECK_FILE([$_JINC/jni.h], - [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"], - [_JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` - AC_CHECK_FILE([$_JTOPDIR/include/jni.h], - [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include"], - AC_MSG_ERROR([cannot find JDK header files])) - ]) +AC_CACHE_CHECK(jni headers, ac_cv_jni_header_path, +[ + if test -f "$_JINC/jni.h"; then + ac_cv_jni_header_path="$_JINC" + JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $ac_cv_jni_header_path" + else + _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` + if test -f "$_JTOPDIR/include/jni.h"; then + ac_cv_jni_header_path="$_JTOPDIR/include" + JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $ac_cv_jni_header_path" + else + ac_cv_jni_header_path=none + fi + fi +]) # get the likely subdirectories for system specific java includes case "$host_os" in @@ -102,13 +125,15 @@ cygwin*) _JNI_INC_SUBDIRS="win32";; *) _JNI_INC_SUBDIRS="genunix";; esac -# add any subdirectories that are present -for JINCSUBDIR in $_JNI_INC_SUBDIRS -do +if test "x$ac_cv_jni_header_path" != "xnone"; then + # add any subdirectories that are present + for JINCSUBDIR in $_JNI_INC_SUBDIRS + do if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR" fi -done + done +fi ]) # _ACJNI_FOLLOW_SYMLINKS diff --git a/m4/ax_prog_jar.m4 b/m4/ax_prog_jar.m4 index 3c60fcaf2d..d474912a05 100644 --- a/m4/ax_prog_jar.m4 +++ b/m4/ax_prog_jar.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_jar.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_jar.html # =========================================================================== # # SYNOPSIS @@ -37,7 +37,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 7 +#serial 8 AU_ALIAS([AC_PROG_JAR], [AX_PROG_JAR]) AC_DEFUN([AX_PROG_JAR],[ diff --git a/m4/ax_prog_java.m4 b/m4/ax_prog_java.m4 index 03961db5b7..c2e6964e2c 100644 --- a/m4/ax_prog_java.m4 +++ b/m4/ax_prog_java.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_java.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_java.html # =========================================================================== # # SYNOPSIS @@ -85,7 +85,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -100,7 +100,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 9 +#serial 10 AU_ALIAS([AC_PROG_JAVA], [AX_PROG_JAVA]) AC_DEFUN([AX_PROG_JAVA],[ diff --git a/m4/ax_prog_java_cc.m4 b/m4/ax_prog_java_cc.m4 index 3df064ff66..ce9612d3f8 100644 --- a/m4/ax_prog_java_cc.m4 +++ b/m4/ax_prog_java_cc.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_java_cc.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_java_cc.html # =========================================================================== # # SYNOPSIS @@ -56,7 +56,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -71,7 +71,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 4 +#serial 5 # AX_PROG_JAVA_CC([COMPILER ...]) # -------------------------- diff --git a/m4/ax_prog_java_works.m4 b/m4/ax_prog_java_works.m4 index 54e132afae..bc7052619e 100644 --- a/m4/ax_prog_java_works.m4 +++ b/m4/ax_prog_java_works.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html # =========================================================================== # # SYNOPSIS @@ -32,7 +32,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -47,57 +47,16 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 9 +#serial 11 AU_ALIAS([AC_PROG_JAVA_WORKS], [AX_PROG_JAVA_WORKS]) AC_DEFUN([AX_PROG_JAVA_WORKS], [ -AC_PATH_PROG(UUDECODE, uudecode, [no]) -if test x$UUDECODE != xno; then -AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [ -dnl /** -dnl * Test.java: used to test if java compiler works. -dnl */ -dnl public class Test -dnl { -dnl -dnl public static void -dnl main( String[] argv ) -dnl { -dnl System.exit (0); -dnl } -dnl -dnl } -cat << \EOF > Test.uue -begin-base64 644 Test.class -yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE -bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 -bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s -YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG -aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB -AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB -AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ= -==== -EOF -if $UUDECODE Test.uue; then - ac_cv_prog_uudecode_base64=yes -else - echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AS_MESSAGE_LOG_FD - echo "configure: failed file was:" >&AS_MESSAGE_LOG_FD - cat Test.uue >&AS_MESSAGE_LOG_FD - ac_cv_prog_uudecode_base64=no -fi -rm -f Test.uue]) -fi -if test x$ac_cv_prog_uudecode_base64 != xyes; then - rm -f Test.class - AC_MSG_WARN([I have to compile Test.class from scratch]) if test x$ac_cv_prog_javac_works = xno; then AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly]) fi if test x$ac_cv_prog_javac_works = x; then AX_PROG_JAVAC fi -fi AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [ JAVA_TEST=Test.java CLASS_TEST=Test.class @@ -111,7 +70,6 @@ public static void main (String args[]) { } } EOF changequote([, ])dnl -if test x$ac_cv_prog_uudecode_base64 != xyes; then if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then : else @@ -119,7 +77,6 @@ if test x$ac_cv_prog_uudecode_base64 != xyes; then cat $JAVA_TEST >&AS_MESSAGE_LOG_FD AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)) fi -fi if AC_TRY_COMMAND($JAVA -classpath . $JAVAFLAGS $TEST) >/dev/null 2>&1; then ac_cv_prog_java_works=yes else @@ -127,7 +84,7 @@ else cat $JAVA_TEST >&AS_MESSAGE_LOG_FD AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?)) fi -rm -fr $JAVA_TEST $CLASS_TEST Test.uue +rm -f $JAVA_TEST $CLASS_TEST ]) AC_PROVIDE([$0])dnl ] diff --git a/m4/ax_prog_javac.m4 b/m4/ax_prog_javac.m4 index d061243cdb..8abb733fce 100644 --- a/m4/ax_prog_javac.m4 +++ b/m4/ax_prog_javac.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_javac.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_javac.html # =========================================================================== # # SYNOPSIS @@ -49,7 +49,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -64,7 +64,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 7 +#serial 8 AU_ALIAS([AC_PROG_JAVAC], [AX_PROG_JAVAC]) AC_DEFUN([AX_PROG_JAVAC],[ diff --git a/m4/ax_prog_javac_works.m4 b/m4/ax_prog_javac_works.m4 index 7dfa1e37d8..9b48149d80 100644 --- a/m4/ax_prog_javac_works.m4 +++ b/m4/ax_prog_javac_works.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_javac_works.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_javac_works.html # =========================================================================== # # SYNOPSIS @@ -32,7 +32,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -47,7 +47,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 6 +#serial 7 AU_ALIAS([AC_PROG_JAVAC_WORKS], [AX_PROG_JAVAC_WORKS]) AC_DEFUN([AX_PROG_JAVAC_WORKS],[ diff --git a/m4/ax_prog_javadoc.m4 b/m4/ax_prog_javadoc.m4 index bcb6045a82..b9fcea414d 100644 --- a/m4/ax_prog_javadoc.m4 +++ b/m4/ax_prog_javadoc.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_javadoc.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_javadoc.html # =========================================================================== # # SYNOPSIS @@ -38,7 +38,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 8 +#serial 9 AU_ALIAS([AC_PROG_JAVADOC], [AX_PROG_JAVADOC]) AC_DEFUN([AX_PROG_JAVADOC],[ diff --git a/m4/ax_prog_javah.m4 b/m4/ax_prog_javah.m4 index cefc616d4c..935ec8964b 100644 --- a/m4/ax_prog_javah.m4 +++ b/m4/ax_prog_javah.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_javah.html +# https://www.gnu.org/software/autoconf-archive/ax_prog_javah.html # =========================================================================== # # SYNOPSIS @@ -21,7 +21,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 8 +#serial 11 AU_ALIAS([AC_PROG_JAVAH], [AX_PROG_JAVAH]) AC_DEFUN([AX_PROG_JAVAH],[ @@ -30,19 +30,19 @@ AC_REQUIRE([AC_PROG_CPP])dnl AC_PATH_PROG(JAVAH,javah) AS_IF([test -n "$ac_cv_path_JAVAH"], [ - AC_TRY_CPP([#include ],,[ + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include ]])],[],[ ac_save_CPPFLAGS="$CPPFLAGS" - _ACJAVAH_FOLLOW_SYMLINKS("$ac_cv_path_JAVAH") + _ACJAVAH_FOLLOW_SYMLINKS("$ac_cv_path_JAVAH") ax_prog_javah_bin_dir=`AS_DIRNAME([$_ACJAVAH_FOLLOWED])` ac_dir="`AS_DIRNAME([$ax_prog_javah_bin_dir])`/include" AS_CASE([$build_os], - [cygwin*], + [cygwin*|mingw*], [ac_machdep=win32], [ac_machdep=`AS_ECHO($build_os) | sed 's,[[-0-9]].*,,'`]) CPPFLAGS="$ac_save_CPPFLAGS -I$ac_dir -I$ac_dir/$ac_machdep" - AC_TRY_CPP([#include ], - ac_save_CPPFLAGS="$CPPFLAGS", - AC_MSG_WARN([unable to include ])) + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include ]])], + [ac_save_CPPFLAGS="$CPPFLAGS"], + [AC_MSG_WARN([unable to include ])]) CPPFLAGS="$ac_save_CPPFLAGS"]) ]) ]) diff --git a/m4/ax_try_compile_java.m4 b/m4/ax_try_compile_java.m4 index a8ed6b2a36..245c36c40d 100644 --- a/m4/ax_try_compile_java.m4 +++ b/m4/ax_try_compile_java.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_try_compile_java.html +# https://www.gnu.org/software/autoconf-archive/ax_try_compile_java.html # =========================================================================== # # SYNOPSIS @@ -29,7 +29,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 8 +#serial 10 AU_ALIAS([AC_TRY_COMPILE_JAVA], [AX_TRY_COMPILE_JAVA]) AC_DEFUN([AX_TRY_COMPILE_JAVA],[ @@ -48,8 +48,8 @@ dnl Don't remove the temporary files here, so they can be examined. else echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD cat Test.java >&AS_MESSAGE_LOG_FD -ifelse([$4], , , [ rm -fr Test.java Test.class +ifelse([$4], , , [ rm -f Test.java Test.class $4 ])dnl fi -rm -fr Test.java Test.class]) +rm -f Test.java Test.class]) diff --git a/m4/ax_try_run_java.m4 b/m4/ax_try_run_java.m4 index c680f03f2c..2ebb86d6dc 100644 --- a/m4/ax_try_run_java.m4 +++ b/m4/ax_try_run_java.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_try_run_java.html +# https://www.gnu.org/software/autoconf-archive/ax_try_run_java.html # =========================================================================== # # SYNOPSIS @@ -29,7 +29,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 2 +#serial 3 AU_ALIAS([AC_TRY_RUN_JAVA], [AX_TRY_RUN_JAVA]) AC_DEFUN([AX_TRY_RUN_JAVA],[ From 814bef3fc59e8dac60505f9280bf3ab530360b05 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Sun, 18 Feb 2024 11:53:58 -0800 Subject: [PATCH 45/65] Fix srcdir issues (#551) * Fix srcdir issues in hdf/test * Fix srcdir issues in mfhdf/test --- configure.ac | 2 + hdf/test/CMakeLists.txt | 8 ++- hdf/test/bitio.c | 24 +++------ hdf/test/litend.c | 10 +--- hdf/test/mgr.c | 100 ++++++++++------------------------- hdf/test/srcdir_str.h.in | 19 +++++++ hdf/test/tutils.c | 104 ++++++++++++++++++++++--------------- hdf/test/tutils.h | 10 ++-- hdf/test/tvnameclass.c | 72 ++++++++++++------------- mfhdf/test/CMakeLists.txt | 8 ++- mfhdf/test/hdftest.h | 6 +++ mfhdf/test/srcdir_str.h.in | 19 +++++++ mfhdf/test/tfile.c | 53 +++++++++---------- mfhdf/test/tnetcdf.c | 59 ++++----------------- mfhdf/test/tszip.c | 20 +++---- mfhdf/test/tutils.c | 63 +++++++++++++++++++++- 16 files changed, 299 insertions(+), 278 deletions(-) create mode 100644 hdf/test/srcdir_str.h.in create mode 100644 mfhdf/test/srcdir_str.h.in diff --git a/configure.ac b/configure.ac index 30e3dbe899..ba69238b00 100644 --- a/configure.ac +++ b/configure.ac @@ -1208,6 +1208,7 @@ AC_CONFIG_FILES([Makefile hdf/fortran/Makefile hdf/src/Makefile hdf/test/Makefile + hdf/test/srcdir_str.h hdf/util/Makefile hdf/util/h4cc hdf/util/h4fc @@ -1236,6 +1237,7 @@ AC_CONFIG_FILES([Makefile mfhdf/ncgen/testncgen.sh mfhdf/nctest/Makefile mfhdf/test/Makefile + mfhdf/test/srcdir_str.h mfhdf/test/testmfhdf.sh java/Makefile java/src/Makefile diff --git a/hdf/test/CMakeLists.txt b/hdf/test/CMakeLists.txt index 24cf43f973..ec14ea0be8 100644 --- a/hdf/test/CMakeLists.txt +++ b/hdf/test/CMakeLists.txt @@ -1,6 +1,12 @@ cmake_minimum_required (VERSION 3.12) project (HDF4_HDF_TEST C) +#----------------------------------------------------------------------------- +# Generate the srcdir_str.h file +#----------------------------------------------------------------------------- +set (srcdir ${HDF4_HDF_TEST_SOURCE_DIR}) +configure_file (${HDF4_HDF_TEST_SOURCE_DIR}/srcdir_str.h.in srcdir_str.h @ONLY) + LINK_DIRECTORIES ( ${HDF4_HDF_BINARY_DIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} @@ -48,7 +54,7 @@ set (testhdf_SRCS #-- Adding test for testhdf add_executable (testhdf ${testhdf_SRCS}) -target_include_directories(testhdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_BINARY_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_HDFSOURCE_DIR}") +target_include_directories(testhdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_BINARY_DIR};${CMAKE_CURRENT_BINARY_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_HDFSOURCE_DIR}") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (testhdf STATIC) target_link_libraries (testhdf PRIVATE ${HDF4_SRC_LIB_TARGET} ${LINK_COMP_LIBS}) diff --git a/hdf/test/bitio.c b/hdf/test/bitio.c index 13bb5c9117..83beb32879 100644 --- a/hdf/test/bitio.c +++ b/hdf/test/bitio.c @@ -119,27 +119,19 @@ test_bitio_write(void) static void test_bitio_read(void) { - int32 fid; - int32 bitid1; - int32 ret; - intn inbits; - uint32 tempbuf; - intn i; - uint8 *test_ptr; - char datafile[512] = ""; - char *srcdir = getenv("srcdir"); + int32 fid; + int32 bitid1; + int32 ret; + intn inbits; + uint32 tempbuf; + intn i; + uint8 *test_ptr; + const char *datafile = get_srcdir_filename(DATAFILE_NAME); SEED((uintn)time(NULL)); MESSAGE(6, printf("Testing bitio read routines\n");); - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(DATAFILE_NAME) + 1) < sizeof(datafile))) { - strcpy(datafile, srcdir); - strcat(datafile, "/"); - } - strcat(datafile, DATAFILE_NAME); - fid = Hopen(datafile, DFACC_READ, 0); CHECK_VOID(fid, FAIL, "Hopen"); diff --git a/hdf/test/litend.c b/hdf/test/litend.c index e85e47189a..91735ce4f1 100644 --- a/hdf/test/litend.c +++ b/hdf/test/litend.c @@ -77,20 +77,12 @@ test_little_read(void) float64 *data_f64; int ret; - char filename[512] = ""; - char *srcdir = getenv("srcdir"); + const char *filename = get_srcdir_filename(FILENAME); MESSAGE(5, printf("Testing Little-Endian Read Routines\n");); MESSAGE(10, printf("Testing Little-Endian INT8 Reading Routines\n");); - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(FILENAME) + 1) < sizeof(filename))) { - strcpy(filename, srcdir); - strcat(filename, "/"); - } - strcat(filename, FILENAME); - ret = DFSDgetdims(filename, &rank, dimsizes, 2); RESULT("DFSDgetdims"); if (dimsizes[0] != CDIM_Y || dimsizes[1] != CDIM_X) { diff --git a/hdf/test/mgr.c b/hdf/test/mgr.c index 1953c3cbea..253a2a8734 100644 --- a/hdf/test/mgr.c +++ b/hdf/test/mgr.c @@ -1128,26 +1128,18 @@ extern void test_mgr_dup_images(); static void test_mgr_init(void) { - int32 fid; /* HDF file ID */ - int32 grid; /* GRID for the interface */ - int32 n_datasets; /* number of datasets */ - int32 n_attrs; /* number of attributes */ - int32 ret; /* generic return value */ - char datafile[512] = ""; - char *srcdir = getenv("srcdir"); + int32 fid; /* HDF file ID */ + int32 grid; /* GRID for the interface */ + int32 n_datasets; /* number of datasets */ + int32 n_attrs; /* number of attributes */ + int32 ret; /* generic return value */ + const char *datafile = get_srcdir_filename(DATAFILE); /* Output message about test being performed */ MESSAGE(6, printf("Testing Multi-file Raster Initialization routines\n");); MESSAGE(8, printf("Try creating a new file and checking it out\n");); - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(DATAFILE) + 1) < sizeof(datafile))) { - strcpy(datafile, srcdir); - strcat(datafile, "/"); - } - strcat(datafile, DATAFILE); - /* Create a new file */ fid = Hopen(TESTFILE, DFACC_CREATE, 0); CHECK_VOID(fid, FAIL, "Hopen"); @@ -2631,24 +2623,16 @@ test_mgr_image_b2a2cc(int flag) static void test_mgr_image_b2b1(int flag) { - int32 fid; /* HDF file ID */ - int32 grid; /* GRID for the interface */ - int32 ret; /* generic return value */ - char datafile[512] = ""; - char *srcdir = getenv("srcdir"); + int32 fid; /* HDF file ID */ + int32 grid; /* GRID for the interface */ + int32 ret; /* generic return value */ + const char *datafile = get_srcdir_filename(DATAFILE); (void)flag; /* B2b1 - Read/Write images - with real Data - Existing Image - Whole Image */ MESSAGE(8, printf("Check out I/O from Existing Image - Whole Image\n");); - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(DATAFILE) + 1) < sizeof(datafile))) { - strcpy(datafile, srcdir); - strcat(datafile, "/"); - } - strcat(datafile, DATAFILE); - /* Open up the existing datafile and get the image information from it */ fid = Hopen(datafile, DFACC_READ, 0); CHECK_VOID(fid, FAIL, "Hopen"); @@ -3724,21 +3708,13 @@ static const uint8 jpeg_24bit_j80[JPEGY][JPEGX][3] = { static void test_mgr_old_a(int flag) { - int32 fid; /* HDF file ID */ - int32 grid; /* GRID for the interface */ - int32 ret; /* generic return value */ - char oldrlefile[512] = ""; - char *srcdir = getenv("srcdir"); + int32 fid; /* HDF file ID */ + int32 grid; /* GRID for the interface */ + int32 ret; /* generic return value */ + const char *oldrlefile = get_srcdir_filename(OLDRLEFILE); (void)flag; - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(OLDRLEFILE) + 1) < sizeof(oldrlefile))) { - strcpy(oldrlefile, srcdir); - strcat(oldrlefile, "/"); - } - strcat(oldrlefile, OLDRLEFILE); - /* A - Read RLE compressed data from old raster image file */ MESSAGE(8, printf("Read RLE compressed image\n");); @@ -3797,21 +3773,13 @@ test_mgr_old_a(int flag) static void test_mgr_old_c(int flag) { - int32 fid; /* HDF file ID */ - int32 grid; /* GRID for the interface */ - int32 ret; /* generic return value */ - char oldgreyjpegfile[512] = ""; - char *srcdir = getenv("srcdir"); + int32 fid; /* HDF file ID */ + int32 grid; /* GRID for the interface */ + int32 ret; /* generic return value */ + const char *oldgreyjpegfile = get_srcdir_filename(OLDGREYJPEGFILE); (void)flag; - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(OLDGREYJPEGFILE) + 1) < sizeof(oldgreyjpegfile))) { - strcpy(oldgreyjpegfile, srcdir); - strcat(oldgreyjpegfile, "/"); - } - strcat(oldgreyjpegfile, OLDGREYJPEGFILE); - /* C - Read 8-bit JPEG compressed data from old raster image file */ MESSAGE(8, printf("Read 8-bit JPEG compressed image\n");); @@ -3863,21 +3831,13 @@ test_mgr_old_c(int flag) static void test_mgr_old_e(int flag) { - int32 fid; /* HDF file ID */ - int32 grid; /* GRID for the interface */ - int32 ret; /* generic return value */ - char oldjpegfile[512] = ""; - char *srcdir = getenv("srcdir"); + int32 fid; /* HDF file ID */ + int32 grid; /* GRID for the interface */ + int32 ret; /* generic return value */ + const char *oldjpegfile = get_srcdir_filename(OLDJPEGFILE); (void)flag; - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(OLDJPEGFILE) + 1) < sizeof(oldjpegfile))) { - strcpy(oldjpegfile, srcdir); - strcat(oldjpegfile, "/"); - } - strcat(oldjpegfile, OLDJPEGFILE); - /* E - Read 24-bit JPEG compressed data from old raster image file */ MESSAGE(8, printf("Read 24-bit JPEG compressed image\n");); @@ -3958,21 +3918,13 @@ test_mgr_old(int flag) static void test_mgr_r24_a(int flag) { - int32 fid; /* HDF file ID */ - int32 grid; /* GRID for the interface */ - int32 ret; /* generic return value */ - char gr_r24file[512] = ""; - char *srcdir = getenv("srcdir"); + int32 fid; /* HDF file ID */ + int32 grid; /* GRID for the interface */ + int32 ret; /* generic return value */ + const char *gr_r24file = get_srcdir_filename(GR_R24FILE); (void)flag; - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(GR_R24FILE) + 1) < sizeof(gr_r24file))) { - strcpy(gr_r24file, srcdir); - strcat(gr_r24file, "/"); - } - strcat(gr_r24file, GR_R24FILE); - /* A - Write/Read DF24 image */ MESSAGE(8, printf("Operate on DF24 images\n");); diff --git a/hdf/test/srcdir_str.h.in b/hdf/test/srcdir_str.h.in new file mode 100644 index 0000000000..067a2280ad --- /dev/null +++ b/hdf/test/srcdir_str.h.in @@ -0,0 +1,19 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF. The full HDF copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* If you are reading this file and it has a '.h' suffix, it was automatically + * generated from the '.in' version. Make changes there. + */ + +/* Set the 'srcdir' path from configure time */ +static const char *config_srcdir = "@srcdir@"; + diff --git a/hdf/test/tutils.c b/hdf/test/tutils.c index b0f3d07295..c7c77d2118 100644 --- a/hdf/test/tutils.c +++ b/hdf/test/tutils.c @@ -13,6 +13,68 @@ #include "hdf.h" #include "tutils.h" +#include "srcdir_str.h" + +/* Buffer to construct path in and return pointer to */ +static char srcdir_path[1024]; + +/* Buffer to construct file in and return pointer to */ +static char srcdir_testpath[1024]; + +/*------------------------------------------------------------------------- + * Function: get_srcdir_filename + * + * Purpose: Append the test file name to the srcdir path and return the whole string + * + * Return: The string or NULL (errors or not enough space) + * + *------------------------------------------------------------------------- + */ +const char * +get_srcdir_filename(const char *filename) +{ + const char *srcdir = get_srcdir(); + + /* Check for error */ + if (NULL == srcdir) + return NULL; + + /* Build path to test file */ + if ((strlen(srcdir) + strlen(filename) + 1) < sizeof(srcdir_testpath)) { + snprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s/%s", srcdir, filename); + return srcdir_testpath; + } + + /* If not enough space, just return NULL */ + return NULL; +} /* end get_srcdir_filename() */ + +/*------------------------------------------------------------------------- + * Function: get_srcdir + * + * Purpose: Just return the srcdir path + * + * Return: The string + * + *------------------------------------------------------------------------- + */ +const char * +get_srcdir(void) +{ + const char *srcdir = getenv("srcdir"); + + /* Check for using the srcdir from configure time */ + if (NULL == srcdir) + srcdir = config_srcdir; + + /* Build path to all test files */ + if ((strlen(srcdir) + 2) < sizeof(srcdir_path)) { + snprintf(srcdir_path, sizeof(srcdir_path), "%s/", srcdir); + return (srcdir_path); + } + else + return NULL; +} /* end get_srcdir() */ intn fuzzy_memcmp(const void *s1, const void *s2, int32 len, intn fuzz_factor) @@ -46,45 +108,3 @@ print_mismatched(const void *s1, const void *s2, int32 size2cmp) t2++; } } - -/* Generate the correct name for the test file, by prepending the source path - if it exists, otherwise, assume it is the local directory */ -/* NOTE: should move all utilities into mfutil.c or something like that */ -intn -make_datafilename(char *basename, char *testfile, unsigned int size) -{ - char *srcdir = getenv("srcdir"); - char *tempfile = NULL; - - tempfile = (char *)calloc(sizeof(char *), (size + 1)); - - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(basename) + 1) < size)) { - strcpy(tempfile, srcdir); - strcat(tempfile, "/"); - } - - /* Windows doesn't set srcdir, and generates files in a different relative - path, so we need to special case here. It is best to look for the - testfile in the same path, and the Windows test script will make sure - to put it there first. - SJW 2007/09/19 (from tnetcdf.c) */ -#if defined _WIN32 - /* This is to get to the file when the library was built without srcdir - option and the test is ran by ./hdftest in the test src directory - instead of by make check. - BMR 2007/08/09 */ - if (srcdir == NULL) - strcpy(tempfile, "./"); -#endif /* _WIN32 */ - - /* Name of data file */ - strcat(tempfile, basename); - - /* Verify that file name is not NULL */ - if (tempfile == NULL || tempfile[0] == '\0') - return FAIL; - - /* File name is generated, return it */ - strcpy(testfile, tempfile); - free(tempfile); - return SUCCEED; -} diff --git a/hdf/test/tutils.h b/hdf/test/tutils.h index e9edba0cbb..74d628f562 100644 --- a/hdf/test/tutils.h +++ b/hdf/test/tutils.h @@ -212,13 +212,15 @@ extern #define ABS(x) ((int)(x) < 0 ? (-x) : x) +/* Just return the srcdir path */ +const char *get_srcdir(void); + +/* Append the test file name to the srcdir path and return the whole string */ +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); -/* Generate the correct name for the test file, by prepending the source path - if it exists, otherwise, assume it is the local directory */ -intn make_datafilename(char *basename, char *testfile, unsigned int size); - /* System command to use for Cleanup */ #if defined _WIN32 #define CLEAN_CMD "del *.hdf" diff --git a/hdf/test/tvnameclass.c b/hdf/test/tvnameclass.c index 64ec6ad226..9ea545f595 100644 --- a/hdf/test/tvnameclass.c +++ b/hdf/test/tvnameclass.c @@ -300,50 +300,42 @@ test_undefined(void) static void test_vgisinternal() { - int32 fid, vgroup_id; - intn is_internal = FALSE; - int32 vref = -1; - intn ii, status; - char testfile[H4_MAX_NC_NAME] = ""; - char internal_array2[2] = {TRUE, TRUE}; + int32 fid, vgroup_id; + intn is_internal = FALSE; + int32 vref = -1; + intn ii, status; + const char *testfile = get_srcdir_filename(GR_FILE); + char internal_array2[2] = {TRUE, TRUE}; /* Use a GR file to test Vgisinternal on internal vgroups */ - /* The file GR_FILE is an existing file in the test_files directory, - make_datafilename builds the file name with correct path */ - if (make_datafilename(GR_FILE, testfile, H4_MAX_NC_NAME) != FAIL) { - /* Open the old GR file and initialize the V interface */ - fid = Hopen(testfile, DFACC_READ, 0); - CHECK_VOID(fid, FAIL, "Hopen: grtdfui83.hdf"); - status = Vstart(fid); - CHECK_VOID(status, FAIL, "Vstart"); - - ii = 0; - while ((vref = Vgetid(fid, vref)) != FAIL) { /* until no more vgroups */ - vgroup_id = Vattach(fid, vref, "r"); /* attach to vgroup */ - - /* Test that the current vgroup is or is not internal as specified - in the array internal_array2 */ - is_internal = Vgisinternal(vgroup_id); - CHECK_VOID(is_internal, FAIL, "Vgisinternal"); - VERIFY_VOID(is_internal, internal_array2[ii], "Vgisinternal"); - - status = Vdetach(vgroup_id); - CHECK_VOID(status, FAIL, "Vdetach"); - - ii++; /* increment vgroup index */ - } - - /* Terminate access to the V interface and close the file */ - status = Vend(fid); - CHECK_VOID(status, FAIL, "Vend"); - status = Hclose(fid); - CHECK_VOID(status, FAIL, "Hclose"); - } - else { - fprintf(stderr, "ERROR>>> Unable to make filename for %s\n", GR_FILE); - H4_FAILED() + /* Open the old GR file and initialize the V interface */ + fid = Hopen(testfile, DFACC_READ, 0); + CHECK_VOID(fid, FAIL, "Hopen: grtdfui83.hdf"); + status = Vstart(fid); + CHECK_VOID(status, FAIL, "Vstart"); + + ii = 0; + while ((vref = Vgetid(fid, vref)) != FAIL) { /* until no more vgroups */ + vgroup_id = Vattach(fid, vref, "r"); /* attach to vgroup */ + + /* Test that the current vgroup is or is not internal as specified + in the array internal_array2 */ + is_internal = Vgisinternal(vgroup_id); + CHECK_VOID(is_internal, FAIL, "Vgisinternal"); + VERIFY_VOID(is_internal, internal_array2[ii], "Vgisinternal"); + + status = Vdetach(vgroup_id); + CHECK_VOID(status, FAIL, "Vdetach"); + + ii++; /* increment vgroup index */ } + + /* Terminate access to the V interface and close the file */ + status = Vend(fid); + CHECK_VOID(status, FAIL, "Vend"); + status = Hclose(fid); + CHECK_VOID(status, FAIL, "Hclose"); } /* test_vgisinternal */ void diff --git a/mfhdf/test/CMakeLists.txt b/mfhdf/test/CMakeLists.txt index 417a1d04a6..b9dc5e7722 100644 --- a/mfhdf/test/CMakeLists.txt +++ b/mfhdf/test/CMakeLists.txt @@ -1,6 +1,12 @@ cmake_minimum_required (VERSION 3.12) project (HDF4_MFHDF_TEST C) +#----------------------------------------------------------------------------- +# Generate the srcdir_str.h file +#----------------------------------------------------------------------------- +set (srcdir ${HDF4_MFHDF_TEST_SOURCE_DIR}) +configure_file (${HDF4_MFHDF_TEST_SOURCE_DIR}/srcdir_str.h.in srcdir_str.h @ONLY) + set (hdftest_SRCS ${HDF4_MFHDF_TEST_SOURCE_DIR}/hdftest.c ${HDF4_MFHDF_TEST_SOURCE_DIR}/tchunk.c @@ -25,7 +31,7 @@ set (hdftest_SRCS #-- Adding test for hdftest add_executable (hdftest ${hdftest_SRCS}) -target_include_directories(hdftest PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR}") +target_include_directories(hdftest PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR};${CMAKE_CURRENT_BINARY_DIR}") if (NOT BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (hdftest STATIC) target_link_libraries (hdftest PRIVATE ${HDF4_MF_LIB_TARGET}) diff --git a/mfhdf/test/hdftest.h b/mfhdf/test/hdftest.h index b347739cef..51861ade1e 100644 --- a/mfhdf/test/hdftest.h +++ b/mfhdf/test/hdftest.h @@ -101,6 +101,12 @@ /*************************** Utility Functions ***************************/ +/* Just return the srcdir path */ +const char *get_srcdir(void); + +/* Append the test file name to the srcdir path and return the whole string */ +const char *get_srcdir_filename(const char *filename); + /* Generates the correct name of the source path */ intn make_sourcepath(char *src_path, unsigned int size); diff --git a/mfhdf/test/srcdir_str.h.in b/mfhdf/test/srcdir_str.h.in new file mode 100644 index 0000000000..067a2280ad --- /dev/null +++ b/mfhdf/test/srcdir_str.h.in @@ -0,0 +1,19 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF. The full HDF copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* If you are reading this file and it has a '.h' suffix, it was automatically + * generated from the '.in' version. Make changes there. + */ + +/* Set the 'srcdir' path from configure time */ +static const char *config_srcdir = "@srcdir@"; + diff --git a/mfhdf/test/tfile.c b/mfhdf/test/tfile.c index 973683e98c..8ef915fed4 100644 --- a/mfhdf/test/tfile.c +++ b/mfhdf/test/tfile.c @@ -375,16 +375,13 @@ test_longfilename() static int test_fileformat() { - int32 fid; /* file id */ - intn ishdf = 0; /* true if file has HDF format */ - intn isnetcdf = 0; /* true if file has classic netCDF format */ - intn isnetcdf64 = 0; /* true if file has 64-bit netCDF format */ - intn num_errs = 0; /* number of errors so far */ - char testfile[512] = ""; - const char *hdf_basename = "hdffile.hdf"; /* hdf file to test */ - const char *netcdf1_basename = "Roy.nc"; /* classic netCDF file to test */ - const char *netcdf2_basename = "Roy-64.nc"; /* netCDF 64-bit file to test */ - intn status = 0; /* status returned by called functions */ + int32 fid; /* file id */ + intn ishdf = 0; /* true if file has HDF format */ + intn isnetcdf = 0; /* true if file has classic netCDF format */ + intn isnetcdf64 = 0; /* true if file has 64-bit netCDF format */ + intn num_errs = 0; /* number of errors so far */ + const char *hdf_basename = "hdffile.hdf"; /* hdf file to test */ + intn status = 0; /* status returned by called functions */ /* Create an empty HDF file to test Hishdf. */ fid = SDstart(hdf_basename, DFACC_CREATE); @@ -400,27 +397,31 @@ test_fileformat() isnetcdf64 = HDisnetcdf64(hdf_basename); VERIFY(isnetcdf64, FALSE, "test_fileformat: HDisnetcdf64"); - /* Make the name of the classic netCDF file */ - make_datafilename(netcdf1_basename, testfile, sizeof(testfile)); + /* Test a classic netCDF file */ + { + const char *netcdf_filename = get_srcdir_filename("Roy.nc"); - /* Verify that this is not an HDF file */ - ishdf = Hishdf(testfile); - VERIFY(ishdf, FALSE, "test_fileformat: Hishdf"); + /* Verify that this is not an HDF file */ + ishdf = Hishdf(netcdf_filename); + VERIFY(ishdf, FALSE, "test_fileformat: Hishdf"); - /* Verify that this is a classic netCDF file */ - isnetcdf = HDisnetcdf(testfile); - VERIFY(isnetcdf, TRUE, "test_fileformat: HDisnetcdf"); + /* Verify that this is a classic netCDF file */ + isnetcdf = HDisnetcdf(netcdf_filename); + VERIFY(isnetcdf, TRUE, "test_fileformat: HDisnetcdf"); + } - /* Make the name of the netCDF 64-bit file */ - make_datafilename(netcdf2_basename, testfile, sizeof(testfile)); + /* Test a 64-bit netCDF file */ + { + const char *netcdf_filename = get_srcdir_filename("Roy-64.nc"); - /* Verify that this is a netCDF 64-bit file */ - isnetcdf64 = HDisnetcdf64(testfile); - VERIFY(isnetcdf64, TRUE, "test_fileformat: HDisnetcdf64"); + /* Verify that this is a netCDF 64-bit file */ + isnetcdf64 = HDisnetcdf64(netcdf_filename); + VERIFY(isnetcdf64, TRUE, "test_fileformat: HDisnetcdf64"); - /* Verify that this is not a classic netCDF file */ - isnetcdf = HDisnetcdf(testfile); - VERIFY(isnetcdf, FALSE, "test_fileformat: HDisnetcdf"); + /* Verify that this is not a classic netCDF file */ + isnetcdf = HDisnetcdf(netcdf_filename); + VERIFY(isnetcdf, FALSE, "test_fileformat: HDisnetcdf"); + } return num_errs; } diff --git a/mfhdf/test/tnetcdf.c b/mfhdf/test/tnetcdf.c index d34207a9c4..cf097efb15 100644 --- a/mfhdf/test/tnetcdf.c +++ b/mfhdf/test/tnetcdf.c @@ -50,33 +50,13 @@ static intn test_read_dim() { - int32 fid, sds_id, status, dim1_id; - int32 dim_sizes[H4_MAX_VAR_DIMS]; /* read dimensions */ - int32 array_rank, num_type, attributes; - char dim_name[H4_MAX_NC_NAME], name[H4_MAX_NC_NAME]; - int32 size, dim_data_type, dim_num_attrs; - char testfile[512] = ""; - intn num_errs = 0; /* number of errors so far */ - - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(NC_FILE) + 1) < sizeof(testfile))) { - strcpy(testfile, srcdir); - strcat(testfile, "/"); - } - - /* Windows doesn't set srcdir, and generates files in a different relative - path, so we need to special case here. It is best to look for the - testfile in the same path, and the Windows test script will make sure - to put it there first. - SJW 2007/09/19 */ -#if !defined _WIN32 - /* This is to get to the file when the library was built without - srcdir option and the test is ran by ./hdftest in the src directory - hdf4/mfhdf/libsrc instead of by make check. - BMR 2007/08/09 */ - if (srcdir == NULL) - strcpy(testfile, "./"); -#endif /* _WIN32 */ - - strcat(testfile, NC_FILE); + int32 fid, sds_id, status, dim1_id; + int32 dim_sizes[H4_MAX_VAR_DIMS]; /* read dimensions */ + int32 array_rank, num_type, attributes; + char dim_name[H4_MAX_NC_NAME], name[H4_MAX_NC_NAME]; + int32 size, dim_data_type, dim_num_attrs; + intn num_errs = 0; /* number of errors so far */ + const char *testfile = get_srcdir_filename(NC_FILE); /* Create the file defined by BASIC_FILE and initiate the SD interface. */ fid = SDstart(testfile, DFACC_READ); @@ -142,33 +122,12 @@ test_netcdf_reading() char name[H4_MAX_NC_NAME]; int32 status; intn i, j; - intn num_errs = 0; /* number of errors so far */ - const char *basename = "test1.nc"; - char testfile[512] = ""; + intn num_errs = 0; /* number of errors so far */ + const char *testfile = get_srcdir_filename("test1.nc"); /* Output message about test being performed */ TESTING("reading of netCDF file using the SDxxx interface (tnetcdf.c)"); - /* Generate the correct name for the test file, by prepending the source path */ - if (srcdir && ((strlen(srcdir) + strlen(basename) + 1) < sizeof(testfile))) { - strcpy(testfile, srcdir); - strcat(testfile, "/"); - } - - /* Windows doesn't set srcdir, and generates files in a different relative - path, so we need to special case here. It is best to look for the - testfile in the same path, and the Windows test script will make sure - to put it there first. - SJW 2007/09/19 */ -#if !defined _WIN32 - /* This is to get to the file 'test1.nc' when the library was built without - srcdir option and the test is ran by ./hdftest in the src directory - hdf4/mfhdf/libsrc instead of by make check. - BMR 2007/08/09 */ - if (srcdir == NULL) - strcpy(testfile, "./"); -#endif /* _WIN32 */ - - strcat(testfile, basename); - /* Open the file 'test1.nc' and initialize the SD interface. */ sd_id = SDstart(testfile, DFACC_RDONLY); CHECK(sd_id, FAIL, "netCDF Read Test 1. SDstart failed on file test1.nc"); diff --git a/mfhdf/test/tszip.c b/mfhdf/test/tszip.c index 193613811e..04c9b3bc92 100644 --- a/mfhdf/test/tszip.c +++ b/mfhdf/test/tszip.c @@ -1215,18 +1215,14 @@ test_getszipinfo() int32 attributes = -1; char name[H4_MAX_NC_NAME]; comp_coder_t comp_type; - int32 comp_size = -1; - int32 uncomp_size = -1; - int32 orig_size = -1; - int num_errs = 0; /* number of errors so far */ - char testfile[512] = ""; - const char *basename = "sds_szipped.dat"; + int32 comp_size = -1; + int32 uncomp_size = -1; + int32 orig_size = -1; + int num_errs = 0; /* number of errors so far */ + const char *testfile = get_srcdir_filename("sds_szipped.dat"); /********************* End of variable declaration ***********************/ - /* Make the name for the test file */ - make_datafilename(basename, testfile, sizeof(testfile)); - /* Open the file and select dataset SDS1_NAME */ sd_id = SDstart(testfile, DFACC_RDONLY); CHECK(sd_id, FAIL, "SDstart"); @@ -1314,8 +1310,7 @@ test_getszipdata() int i, j; int num_errs = 0; /* number of errors so far */ int32 out_data[SZ_LENGTH][SZ_WIDTH]; - char testfile[512] = ""; - const char *basename = "sds_szipped.dat"; + const char *testfile = get_srcdir_filename("sds_szipped.dat"); /* data to compare against read data from sds_szipped.dat */ int32 in_data[SZ_LENGTH][SZ_WIDTH] = { @@ -1328,9 +1323,6 @@ test_getszipdata() /********************* End of variable declaration ***********************/ - /* Make the name for the test file */ - make_datafilename(basename, testfile, sizeof(testfile)); - /* Open the file */ sd_id = SDstart(testfile, DFACC_READ); CHECK(sd_id, FAIL, "SDstart"); diff --git a/mfhdf/test/tutils.c b/mfhdf/test/tutils.c index f55764a7bb..fed5e6188a 100644 --- a/mfhdf/test/tutils.c +++ b/mfhdf/test/tutils.c @@ -15,8 +15,69 @@ #include #include "mfhdf.h" - #include "hdftest.h" +#include "srcdir_str.h" + +/* Buffer to construct path in and return pointer to */ +static char srcdir_path[1024]; + +/* Buffer to construct file in and return pointer to */ +static char srcdir_testpath[1024]; + +/*------------------------------------------------------------------------- + * Function: get_srcdir_filename + * + * Purpose: Append the test file name to the srcdir path and return the whole string + * + * Return: The string or NULL (errors or not enough space) + * + *------------------------------------------------------------------------- + */ +const char * +get_srcdir_filename(const char *filename) +{ + const char *srcdir = get_srcdir(); + + /* Check for error */ + if (NULL == srcdir) + return NULL; + + /* Build path to test file */ + if ((strlen(srcdir) + strlen(filename) + 1) < sizeof(srcdir_testpath)) { + snprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s/%s", srcdir, filename); + return srcdir_testpath; + } + + /* If not enough space, just return NULL */ + return NULL; +} /* end get_srcdir_filename() */ + +/*------------------------------------------------------------------------- + * Function: get_srcdir + * + * Purpose: Just return the srcdir path + * + * Return: The string + * + *------------------------------------------------------------------------- + */ +const char * +get_srcdir(void) +{ + const char *srcdir = getenv("srcdir"); + + /* Check for using the srcdir from configure time */ + if (NULL == srcdir) + srcdir = config_srcdir; + + /* Build path to all test files */ + if ((strlen(srcdir) + 2) < sizeof(srcdir_path)) { + snprintf(srcdir_path, sizeof(srcdir_path), "%s/", srcdir); + return (srcdir_path); + } + else + return NULL; +} /* end get_srcdir() */ /******************************************************************** Name: make_sourcepath() - Generates the source path From 20dab1148ac95179c62162b0821d2c520962784e Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Sun, 18 Feb 2024 13:50:50 -0800 Subject: [PATCH 46/65] Update download url to fix broken link (#556) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0cdb0454be..8936d5857e 100644 --- a/README.md +++ b/README.md @@ -78,8 +78,8 @@ Periodically development code snapshots are provided at the following URL: https://github.com/HDFGroup/hdf4/releases/tag/snapshot Source packages for current and previous releases are located at: - - https://portal.hdfgroup.org/display/support/Download+HDF4 + + https://portal.hdfgroup.org/downloads/ Development code is available at our Github location: From 627580a4e555ad971ac1550c7df5ac9a72742f34 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Sun, 18 Feb 2024 13:51:18 -0800 Subject: [PATCH 47/65] Update Autotools clang flags (#555) * Uses clang-warnings/general, etc. * Update -O to 3 for production and 1/g for debug * Add -ftrapv and -fno-common to debug (like HDF5) --- config/clang-flags | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/config/clang-flags b/config/clang-flags index 5698608c0e..3dac6d79e7 100644 --- a/config/clang-flags +++ b/config/clang-flags @@ -4,6 +4,20 @@ # after configure starts and defines, among other things, flags for # the various compilation modes. +# +# Prepend `$srcdir/config/clang-warnings/` to the filename suffix(es) given as +# subroutine argument(s), remove comments starting with # and ending +# at EOL, replace spans of whitespace (including newlines) with spaces, +# and re-emit the file(s) thus filtered on the standard output stream. +# +load_clang_arguments() +{ + set -- $(for arg; do + sed 's,#.*$,,' $srcdir/config/clang-warnings/${arg} + done) + IFS=' ' echo "$*" +} + # Get the compiler version in a way that works for clang # unless a compiler version is already known # @@ -43,15 +57,31 @@ if test "X-clang" = "X-$cc_vendor" -o "X-Apple LLVM" = "X-$cc_vendor"; then echo "compiler '$CC' is $cc_vendor-$cc_version" CFLAGS="$CFLAGS -Wno-error=implicit-function-declaration" - CFLAGS="$CFLAGS -std=c99 -Wall -pedantic" + CFLAGS="$CFLAGS -std=c99" - DEBUG_CFLAGS="-g" + DEBUG_CFLAGS="-g -ftrapv -fno-common" + # -Og is only understood by clang 4+ and Xcode 9+ + # Otherwise use -O1 (which is what -Og usually equates to) + if test "X-clang" = "X-$cc_vendor" -a $cc_vers_major -ge 4 -o "X-Apple LLVM" = "X-$cc_vendor" -a $cc_vers_major -ge 9; then + DEBUG_CFLAGS="$DEBUG_CFLAGS -Og" + else + DEBUG_CFLAGS="$DEBUG_CFLAGS -O1" + fi DEBUG_CPPFLAGS= - PROD_CFLAGS="-O2" + + PROD_CFLAGS="-O3" PROD_CPPFLAGS= + PROFILE_CFLAGS="-pg" PROFILE_CPPFLAGS= + ########### + # General # + ########### + + CFLAGS="$CFLAGS $(load_clang_arguments general)" + CFLAGS="$CFLAGS $(load_clang_arguments no-developer-general)" + ################# # Flags are set # ################# From ae731139b2dd3db8ae57bb7149dcad512bb5c3ae Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 19 Feb 2024 05:39:48 -0800 Subject: [PATCH 48/65] Fix a potential uninitialized value in test/litend.c (#558) --- hdf/test/litend.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hdf/test/litend.c b/hdf/test/litend.c index 91735ce4f1..34ad11bc08 100644 --- a/hdf/test/litend.c +++ b/hdf/test/litend.c @@ -65,7 +65,7 @@ static void test_little_read(void) { intn rank; - int32 dimsizes[2]; + int32 dimsizes[2] = {-1, -1}; int32 numbertype; int8 *data_i8; uint8 *data_u8; @@ -84,6 +84,7 @@ test_little_read(void) MESSAGE(10, printf("Testing Little-Endian INT8 Reading Routines\n");); ret = DFSDgetdims(filename, &rank, dimsizes, 2); + RESULT("DFSDgetdims"); if (dimsizes[0] != CDIM_Y || dimsizes[1] != CDIM_X) { fprintf(stderr, "Dimensions for INT8 data were incorrect\n"); From d7d5a8c7e9b85d4826b9c5ca57aaf3aecb630df5 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 19 Feb 2024 05:45:08 -0800 Subject: [PATCH 49/65] Remove unused make_datafilename() function (#559) --- mfhdf/test/hdftest.h | 3 --- mfhdf/test/texternal.c | 4 ++-- mfhdf/test/tutils.c | 37 +------------------------------------ 3 files changed, 3 insertions(+), 41 deletions(-) diff --git a/mfhdf/test/hdftest.h b/mfhdf/test/hdftest.h index 51861ade1e..fd71d11944 100644 --- a/mfhdf/test/hdftest.h +++ b/mfhdf/test/hdftest.h @@ -110,9 +110,6 @@ const char *get_srcdir_filename(const char *filename); /* Generates the correct name of the source path */ intn make_sourcepath(char *src_path, unsigned int size); -/* Generates the correct name for the test file */ -intn make_datafilename(const char *basename, char *testfile, unsigned int size); - /* Calls SDcreate, SDwritedata, and SDendaccess */ int32 make_SDS(int32 sd_id, char *sds_name, int32 type, int32 rank, int32 *dim_sizes, int32 unlim_dim, void *written_data); diff --git a/mfhdf/test/texternal.c b/mfhdf/test/texternal.c index 6466fc5756..56934c502c 100644 --- a/mfhdf/test/texternal.c +++ b/mfhdf/test/texternal.c @@ -728,7 +728,7 @@ test_change_extdir(void) intn num_errs = 0; /* number of errors in compression test so far */ status = make_sourcepath(dir_name, MAX_PATH_LEN); - CHECK(status, FAIL, "make_datafilename"); + CHECK(status, FAIL, "make_sourcepath"); /* When srcdir is not available, make up a directory to create the external file to cause subsequent reads to look outside of the current directory */ @@ -889,7 +889,7 @@ test_HDFFR_1609(void) intn num_errs = 0; /* number of errors in compression test so far */ status = make_sourcepath(dir_name, MAX_PATH_LEN); - CHECK(status, FAIL, "make_datafilename"); + CHECK(status, FAIL, "make_sourcepath"); /* When srcdir is not available, make up a directory to create the external file to cause subsequent reads to look outside of the current directory */ diff --git a/mfhdf/test/tutils.c b/mfhdf/test/tutils.c index fed5e6188a..439541d892 100644 --- a/mfhdf/test/tutils.c +++ b/mfhdf/test/tutils.c @@ -95,7 +95,7 @@ make_sourcepath(char *src_path, unsigned int size) char *tempdir = NULL; tempdir = (char *)malloc(size * sizeof(char)); - CHECK_ALLOC(tempdir, "tempdir", "make_datafilename"); + CHECK_ALLOC(tempdir, "tempdir", "make_sourcepath"); memset(tempdir, 0, size); /* Generate the source path */ @@ -118,41 +118,6 @@ make_sourcepath(char *src_path, unsigned int size) return SUCCEED; } -/******************************************************************** - Name: make_datafilename() - Generates the correct name for the test file. - Description: - Generate the correct name for the test file by prepending the source - path if it exists, otherwise, assume it is the local directory. - Return value: - Returns SUCCEED if the file name is generated successfully, or - FAIL, otherwise. -*********************************************************************/ -intn -make_datafilename(const char *basename, char *testfile, unsigned int size) -{ - char *srcdir = getenv("srcdir"); - char *tempfile = NULL; - - /* Leave room for the file name and null char */ - unsigned int max_dir_len = size - strlen(basename) - 1; - - tempfile = (char *)malloc(size * sizeof(char)); - CHECK_ALLOC(tempfile, "tempfile", "make_datafilename"); - - if (make_sourcepath(tempfile, max_dir_len) == FAIL) { - free(tempfile); - return FAIL; - } - - /* Name of data file */ - strcat(tempfile, basename); - - /* File name is generated, return it */ - strcpy(testfile, tempfile); - free(tempfile); - return SUCCEED; -} - /******************************************************************** Name: make_SDS() - Creates and writes a 3-D unlimited SDS. Description: From c081fb27c375a42bbc185c383df95e7c9a8ef060 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Mon, 19 Feb 2024 09:21:40 -0600 Subject: [PATCH 50/65] Correct preset for fortran (#561) --- CMakePresets.json | 61 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 10 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 05ce25aefa..f8ac095b37 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -86,14 +86,13 @@ "description": "GNUC Standard Config for x64 (Release)", "inherits": [ "ci-x64-Release-GNUC", - "ci-Fortran", "ci-Java", "ci-StdShar" ] }, - { + { "name": "ci-StdShar-Clang-Fortran", - "description": "Clang Standard Config for x64 (Release)", + "description": "Clang Standard Fortran Config for x64 (Release)", "inherits": [ "ci-x64-Release-Clang", "ci-Fortran", @@ -103,9 +102,10 @@ }, { "name": "ci-StdShar-GNUC-Fortran", - "description": "GNUC Standard Config for x64 (Release)", + "description": "GNUC Standard Fortran Config for x64 (Release)", "inherits": [ "ci-x64-Release-GNUC", + "ci-Fortran", "ci-Java", "ci-StdShar" ] @@ -129,6 +129,14 @@ "ci-x64-Release-MSVC" ] }, + { + "name": "ci-StdShar-Clang-Fortran", + "description": "Clang Standard Fortran Build for x64 (Release)", + "configurePreset": "ci-StdShar-Clang-Fortran", + "inherits": [ + "ci-x64-Release-Clang" + ] + }, { "name": "ci-StdShar-Clang", "description": "Clang Standard Build for x64 (Release)", @@ -137,6 +145,15 @@ "ci-x64-Release-Clang" ] }, + { + "name": "ci-StdShar-GNUC-Fortran", + "description": "GNUC Standard Fortran Build for x64 (Release)", + "configurePreset": "ci-StdShar-GNUC-Fortran", + "verbose": true, + "inherits": [ + "ci-x64-Release-GNUC" + ] + }, { "name": "ci-StdShar-GNUC", "description": "GNUC Standard Build for x64 (Release)", @@ -171,6 +188,13 @@ "ci-x64-Release-Clang" ] }, + { + "name": "ci-StdShar-Clang-Fortran", + "configurePreset": "ci-StdShar-Clang-Fortran", + "inherits": [ + "ci-x64-Release-Clang" + ] + }, { "name": "ci-StdShar-OSX-Clang", "configurePreset": "ci-StdShar-Clang", @@ -195,6 +219,13 @@ "ci-x64-Release-GNUC" ] }, + { + "name": "ci-StdShar-GNUC-Fortran", + "configurePreset": "ci-StdShar-GNUC-Fortran", + "inherits": [ + "ci-x64-Release-GNUC" + ] + }, { "name": "ci-StdShar-win-Intel", "configurePreset": "ci-StdShar-Intel", @@ -231,11 +262,21 @@ "configurePreset": "ci-StdShar-Clang", "inherits": "ci-x64-Release-Clang" }, + { + "name": "ci-StdShar-Clang-Fortran", + "configurePreset": "ci-StdShar-Clang-Fortran", + "inherits": "ci-x64-Release-Clang" + }, { "name": "ci-StdShar-GNUC", "configurePreset": "ci-StdShar-GNUC", "inherits": "ci-x64-Release-GNUC" }, + { + "name": "ci-StdShar-GNUC-Fortran", + "configurePreset": "ci-StdShar-GNUC-Fortran", + "inherits": "ci-x64-Release-GNUC" + }, { "name": "ci-StdShar-Intel", "configurePreset": "ci-StdShar-Intel", @@ -265,9 +306,9 @@ "name": "ci-StdShar-Clang-Fortran", "steps": [ {"type": "configure", "name": "ci-StdShar-Clang-Fortran"}, - {"type": "build", "name": "ci-StdShar-Clang"}, - {"type": "test", "name": "ci-StdShar-Clang"}, - {"type": "package", "name": "ci-StdShar-Clang"} + {"type": "build", "name": "ci-StdShar-Clang-Fortran"}, + {"type": "test", "name": "ci-StdShar-Clang-Fortran"}, + {"type": "package", "name": "ci-StdShar-Clang-Fortran"} ] }, { @@ -292,9 +333,9 @@ "name": "ci-StdShar-GNUC-Fortran", "steps": [ {"type": "configure", "name": "ci-StdShar-GNUC-Fortran"}, - {"type": "build", "name": "ci-StdShar-GNUC"}, - {"type": "test", "name": "ci-StdShar-GNUC"}, - {"type": "package", "name": "ci-StdShar-GNUC"} + {"type": "build", "name": "ci-StdShar-GNUC-Fortran"}, + {"type": "test", "name": "ci-StdShar-GNUC-Fortran"}, + {"type": "package", "name": "ci-StdShar-GNUC-Fortran"} ] }, { From 08f590d98288ab78882041de2c575c39485d264d Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 19 Feb 2024 12:52:11 -0800 Subject: [PATCH 51/65] Fix stack overflows on Windows w/ oneAPI and MinGW + MSYS2 (#563) --- .github/workflows/intel-cmake.yml | 2 +- .github/workflows/msys2-cmake.yml | 2 +- mfhdf/dumper/show.c | 14 ++++++++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/intel-cmake.yml b/.github/workflows/intel-cmake.yml index a13f3f47d0..6912fcef1f 100644 --- a/.github/workflows/intel-cmake.yml +++ b/.github/workflows/intel-cmake.yml @@ -122,5 +122,5 @@ jobs: CC: ${{ steps.setup-fortran.outputs.cc }} CXX: ${{ steps.setup-fortran.outputs.cxx }} run: | - ctest . --parallel 2 -C ${{ inputs.build_mode }} -V -E "HDP-dumpv|h4ex_GR_create|h4ex_GR_write|h4ex_VG_add" + ctest . --parallel 2 -C ${{ inputs.build_mode }} -V working-directory: ${{ runner.workspace }}/build diff --git a/.github/workflows/msys2-cmake.yml b/.github/workflows/msys2-cmake.yml index c4b4157738..82e6ae3f71 100644 --- a/.github/workflows/msys2-cmake.yml +++ b/.github/workflows/msys2-cmake.yml @@ -66,5 +66,5 @@ jobs: # RUN TESTS - name: CMake Run Tests run: | - ctest . --parallel 2 -C ${{ inputs.build_mode }} -V -E "HDP-dumpv|h4ex_GR_create|h4ex_GR_write|h4ex_VG_add" + ctest . --parallel 2 -C ${{ inputs.build_mode }} -V working-directory: ${{ runner.workspace }}/build diff --git a/mfhdf/dumper/show.c b/mfhdf/dumper/show.c index 5e66f57481..e42b562eab 100644 --- a/mfhdf/dumper/show.c +++ b/mfhdf/dumper/show.c @@ -446,10 +446,15 @@ dumpattr(int32 vid, int32 findex, intn isvs, file_format_t ff, FILE *fp) uint8 *buf = NULL; uint8 *ptr = NULL; intn (*vfmtfn)(void *, file_format_t ff, FILE *); - intn status; - intn ret_value = SUCCEED; - char name[FIELDNAMELENMAX + 1]; - uint8 attrbuf[BUFFER]; + intn status; + intn ret_value = SUCCEED; + char name[FIELDNAMELENMAX + 1]; + uint8 *attrbuf = NULL; + + if (NULL == (attrbuf = (uint8 *)calloc(1, BUFFER))) { + ret_value = FAIL; + goto done; + } /* vdata or vgroup? */ if (isvs) @@ -603,6 +608,7 @@ dumpattr(int32 vid, int32 findex, intn isvs, file_format_t ff, FILE *fp) } /* for i */ done: + free(attrbuf); if (ret_value == FAIL) { /* Failure cleanup */ free(buf); } From df76cb1c103dfc417de9a5993fd1e5709fa09cb7 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Mon, 19 Feb 2024 17:00:58 -0600 Subject: [PATCH 52/65] remove win-Intel workaround presets (#564) --- .github/workflows/cmake-ctest.yml | 2 +- CMakePresets.json | 26 -------------------------- HDF4Examples/CMakePresets.json | 25 ------------------------- 3 files changed, 1 insertion(+), 52 deletions(-) diff --git a/.github/workflows/cmake-ctest.yml b/.github/workflows/cmake-ctest.yml index f4f110e7f6..001396014f 100644 --- a/.github/workflows/cmake-ctest.yml +++ b/.github/workflows/cmake-ctest.yml @@ -302,7 +302,7 @@ jobs: CXX: ${{ steps.setup-fortran.outputs.cxx }} run: | cd "${{ runner.workspace }}/hdf4/hdfsrc" - cmake --workflow --preset=${{ inputs.preset_name }}-win-Intel --fresh + cmake --workflow --preset=${{ inputs.preset_name }}-Intel --fresh shell: pwsh - name: Publish binary (Windows_intel) diff --git a/CMakePresets.json b/CMakePresets.json index f8ac095b37..95281185c6 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -226,23 +226,6 @@ "ci-x64-Release-GNUC" ] }, - { - "name": "ci-StdShar-win-Intel", - "configurePreset": "ci-StdShar-Intel", - "inherits": [ - "ci-x64-Release-Intel" - ], - "filter": { - "exclude": { - "name": "HDP-dumpv|h4ex_GR_create|h4ex_GR_write|h4ex_VG_add" - } - }, - "condition": { - "type": "equals", - "lhs": "${hostSystemName}", - "rhs": "Windows" - } - }, { "name": "ci-StdShar-Intel", "configurePreset": "ci-StdShar-Intel", @@ -346,15 +329,6 @@ {"type": "test", "name": "ci-StdShar-Intel"}, {"type": "package", "name": "ci-StdShar-Intel"} ] - }, - { - "name": "ci-StdShar-win-Intel", - "steps": [ - {"type": "configure", "name": "ci-StdShar-Intel"}, - {"type": "build", "name": "ci-StdShar-Intel"}, - {"type": "test", "name": "ci-StdShar-win-Intel"}, - {"type": "package", "name": "ci-StdShar-Intel"} - ] } ] } diff --git a/HDF4Examples/CMakePresets.json b/HDF4Examples/CMakePresets.json index af284eb781..fa34261c1a 100644 --- a/HDF4Examples/CMakePresets.json +++ b/HDF4Examples/CMakePresets.json @@ -153,23 +153,6 @@ "ci-x64-Release-GNUC" ] }, - { - "name": "ci-StdShar-win-Intel", - "configurePreset": "ci-StdShar-Intel", - "inherits": [ - "ci-x64-Release-Intel" - ], - "filter": { - "exclude": { - "name": "HDP-dumpv|h4ex_GR_create|h4ex_GR_write|h4ex_VG_add" - } - }, - "condition": { - "type": "equals", - "lhs": "${hostSystemName}", - "rhs": "Windows" - } - }, { "name": "ci-StdShar-Intel", "configurePreset": "ci-StdShar-Intel", @@ -218,14 +201,6 @@ {"type": "build", "name": "ci-StdShar-Intel"}, {"type": "test", "name": "ci-StdShar-Intel"} ] - }, - { - "name": "ci-StdShar-win-Intel", - "steps": [ - {"type": "configure", "name": "ci-StdShar-Intel"}, - {"type": "build", "name": "ci-StdShar-Intel"}, - {"type": "test", "name": "ci-StdShar-win-Intel"} - ] } ] } From 76af62aecc8ce9fc639a9a7aafc0f4e83b1bf9d9 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 19 Feb 2024 18:55:52 -0800 Subject: [PATCH 53/65] Add a netCDF action to GitHub CI (#566) --- .github/workflows/netcdf.yml | 67 ++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/netcdf.yml diff --git a/.github/workflows/netcdf.yml b/.github/workflows/netcdf.yml new file mode 100644 index 0000000000..adb6a0d1cb --- /dev/null +++ b/.github/workflows/netcdf.yml @@ -0,0 +1,67 @@ +name: netCDF dev + +on: + workflow_dispatch: + push: + pull_request: + branches: [ master ] + paths-ignore: + - '.github/CODEOWNERS' + - 'release_notes/**' + - 'COPYING' + - '**.md' + +permissions: + contents: read + +# Using concurrency to cancel any in-progress job or run +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Install System dependencies + run: | + sudo apt update + sudo apt install -y libaec-dev zlib1g-dev automake autoconf libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev doxygen openssl libtool libtool-bin + - name: Checkout HDF4 + uses: actions/checkout@v4.1.1 + - name: Install HDF4 + run: | + ./autogen.sh + ./configure --prefix=/usr/local --disable-netcdf --disable-netcdf-tools --enable-shared --with-szlib + make -j + sudo make install -j + + - name: Checkout HDF5 + uses: actions/checkout@v4.1.1 + with: + repository: HDFGroup/hdf5 + path: hdf5 + - name: Install HDF5 + run: | + cd hdf5 + ./autogen.sh + ./configure --prefix=/usr/local --disable-tests --disable-static --enable-shared --enable-hl --with-szlib + make -j + sudo make install -j + + - name: Checkout netCDF + uses: actions/checkout@v4.1.1 + with: + repository: unidata/netcdf-c + path: netcdf-c + - name: Test netCDF + run: | + cd netcdf-c + autoreconf -if + CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ./configure --enable-hdf5 --enable-hdf4 --enable-hdf4-file-tests --enable-dap --disable-dap-remote-tests --enable-external-server-tests + cat config.log + cat libnetcdf.settings + CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} make -j + CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} make check TESTS="" -j + LD_LIBRARY_PATH="/home/runner/work/hdf4/hdf4/netcdf-c/liblib/.libs:/usr/local/lib:${LD_LIBRARY_PATH}" + CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} make check -j From 77e673e99cb465fb676473bbf2a5b78cd4669876 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Mon, 19 Feb 2024 21:00:50 -0600 Subject: [PATCH 54/65] Add nvhpc workflow (#562) --- .github/workflows/autotools.yml | 6 +++ .github/workflows/cmake.yml | 6 +++ .github/workflows/intel-cmake.yml | 1 - .github/workflows/nvhpc-auto.yml | 82 +++++++++++++++++++++++++++++++ .github/workflows/nvhpc-cmake.yml | 71 ++++++++++++++++++++++++++ 5 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/nvhpc-auto.yml create mode 100644 .github/workflows/nvhpc-cmake.yml diff --git a/.github/workflows/autotools.yml b/.github/workflows/autotools.yml index 0105e7bb43..8b8c473060 100644 --- a/.github/workflows/autotools.yml +++ b/.github/workflows/autotools.yml @@ -48,3 +48,9 @@ jobs: uses: ./.github/workflows/intel-auto.yml with: build_mode: "production" + + call-release-auto-nvhpc: + name: "Autotools nvhpc Workflows" + uses: ./.github/workflows/nvhpc-auto.yml + with: + build_mode: "production" diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 4a0c234e1e..04331642b6 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -71,3 +71,9 @@ jobs: uses: ./.github/workflows/intel-cmake.yml with: build_mode: "Release" + + call-release-cmake-nvhpc: + name: "CMake nvhpc Workflows" + uses: ./.github/workflows/nvhpc-cmake.yml + with: + build_mode: "Release" diff --git a/.github/workflows/intel-cmake.yml b/.github/workflows/intel-cmake.yml index 6912fcef1f..8c3068c1b6 100644 --- a/.github/workflows/intel-cmake.yml +++ b/.github/workflows/intel-cmake.yml @@ -1,6 +1,5 @@ name: hdf4 dev CMake icx CI -# Controls when the action will run. Triggers the workflow on a call on: workflow_call: inputs: diff --git a/.github/workflows/nvhpc-auto.yml b/.github/workflows/nvhpc-auto.yml new file mode 100644 index 0000000000..803eab9042 --- /dev/null +++ b/.github/workflows/nvhpc-auto.yml @@ -0,0 +1,82 @@ +name: hdf4 dev autotools nvhpc + +on: + workflow_call: + inputs: + build_mode: + description: "release vs. debug build" + required: true + type: string + +permissions: + contents: read + +jobs: + nvhpc_build_and_test: + name: "nvhpc ${{ inputs.build_mode }}" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install autoconf automake libtool libtool-bin libaec-dev + + - name: Install NVHPC + shell: bash + run: | + curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg + echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list + sudo apt-get update -y + sudo apt-get install -y nvhpc-23-9 + echo "NVHPCSDK=/opt/nvidia/hpc_sdk" >> $GITHUB_ENV + echo "OMPI_CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvc" >> $GITHUB_ENV + echo "OMPI_FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvfortran" >> $GITHUB_ENV + echo "CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvc" >> $GITHUB_ENV + echo "FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvfortran" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/lib" >> $GITHUB_ENV + echo "DESTDIR=/tmp" >> $GITHUB_ENV + + - name: Autotools Configure + shell: bash + run: | + export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin:$PATH + sh ./autogen.sh + mkdir "${{ runner.workspace }}/build" + cd "${{ runner.workspace }}/build" + $GITHUB_WORKSPACE/configure \ + FCFLAGS="-fPIC -fortranlibs" \ + --enable-build-mode=${{ inputs.build_mode }} \ + --disable-fortran \ + --enable-shared \ + #cat config.log + + # BUILD + - name: Autotools Build + shell: bash + run: | + export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin:$PATH + make -j3 + working-directory: ${{ runner.workspace }}/build + + # RUN TESTS + # NORMAL + - name: Autotools Run Tests + run: | + export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin:$PATH + make check -j + working-directory: ${{ runner.workspace }}/build + + # INSTALL (note that this runs even when we don't run the tests) + - name: Autotools Install + run: | + export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin:$PATH + make install + working-directory: ${{ runner.workspace }}/build + +# - name: Autotools Verify Install +# run: | +# export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin:$PATH +# make check-install +# working-directory: ${{ runner.workspace }}/build diff --git a/.github/workflows/nvhpc-cmake.yml b/.github/workflows/nvhpc-cmake.yml new file mode 100644 index 0000000000..b125db5c50 --- /dev/null +++ b/.github/workflows/nvhpc-cmake.yml @@ -0,0 +1,71 @@ +name: hdf4 dev CMake nvhpc + +on: + workflow_call: + inputs: + build_mode: + description: "release vs. debug build" + required: true + type: string + +permissions: + contents: read + +jobs: + nvhpc_build_and_test: + name: "nvhpc ${{ inputs.build_mode }}" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + + - name: Install Linux dependencies + shell: bash + run: | + sudo apt update + sudo apt-get install ninja-build doxygen graphviz + sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev + sudo apt install -y libaec-dev zlib1g-dev wget curl bzip2 flex bison cmake libzip-dev openssl build-essential + + - name: Install NVHPC + shell: bash + run: | + curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg + echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list + sudo apt-get update -y + sudo apt-get install -y nvhpc-23-9 + echo "NVHPCSDK=/opt/nvidia/hpc_sdk" >> $GITHUB_ENV + echo "OMPI_CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvc" >> $GITHUB_ENV + echo "OMPI_FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvfortran" >> $GITHUB_ENV + echo "CC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvc" >> $GITHUB_ENV + echo "FC=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin/nvfortran" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/cuda/12.2/lib64:/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/lib" >> $GITHUB_ENV + echo "DESTDIR=/tmp" >> $GITHUB_ENV + + - name: CMake Configure with nvc + shell: bash + run: | + export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/23.9/compilers/bin:$PATH + mkdir "${{ runner.workspace }}/build" + cd "${{ runner.workspace }}/build" + cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake -G Ninja \ + -DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} \ + -DJPEG_USE_LOCALCONTENT=OFF \ + -DLIBAEC_USE_LOCALCONTENT=OFF \ + -DZLIB_USE_LOCALCONTENT=OFF \ + -DHDF4_BUILD_FORTRAN:BOOL=ON \ + -DHDF4_BUILD_JAVA:BOOL=OFF \ + $GITHUB_WORKSPACE + + # BUILD + - name: CMake Build + shell: bash + run: | + cmake --build . --parallel 3 --config ${{ inputs.build_mode }} + working-directory: ${{ runner.workspace }}/build + + # RUN TESTS + - name: CMake Run Tests + shell: bash + run: | + ctest . --parallel 2 -C ${{ inputs.build_mode }} -V + working-directory: ${{ runner.workspace }}/build From 276e2c205b767d31f9d0b757f53a36aee1e1f9b2 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 19 Feb 2024 19:55:00 -0800 Subject: [PATCH 55/65] Fix for compiling the buffer test (#567) * Use hdfi.h to pick up time headers * Also fix warnings --- hdf/test/buffer.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/hdf/test/buffer.c b/hdf/test/buffer.c index 0ce3b5f61d..53ab15c609 100644 --- a/hdf/test/buffer.c +++ b/hdf/test/buffer.c @@ -25,29 +25,11 @@ - Buffer the compressed element and get times for the buffered element. - Make a new linked block element and get benchmark times - Buffer the linked block element and get times for the buffered element. - - BUGS/LIMITATIONS - - EXPORTED ROUTINES - - AUTHOR - Quincey Koziol - - MODIFICATION HISTORY - 12/11/98 - Wrote tests - 12/20/06 - Compute the wallclock time and use the environment - variable or macro HDF4_TESTPREFIX to add prefix to the - testing files names. Also, it allows to specify the number - of elements in buffer at the command line. - */ #define TESTMASTER -#include "hdf.h" -#ifdef H4_HAVE_SYS_TIME_H -#include -#endif +#include "hdfi.h" #include "tutils.h" #include "hfile.h" @@ -97,10 +79,8 @@ static long write_test(int32 aid, intn num_timings); static void init_buffer(void) { - intn j; - SEED(time(NULL)); - for (j = 0; j < elemsize; j++) { + for (int j = 0; j < elemsize; j++) { out_buf[j] = (uint8)RAND(); } } /* init_buffers() */ @@ -272,7 +252,7 @@ read_test(int32 aid) } /* Clear input buffer */ - memset(in_buf, 0, elemsize); + memset(in_buf, 0, (size_t)elemsize); /* Increment the total I/O time */ acc_time += (end_time.tv_sec - start_time.tv_sec) * FACTOR + (end_time.tv_usec - start_time.tv_usec); @@ -395,7 +375,7 @@ write_test(int32 aid, intn num_timings) } /* Clear input buffer */ - memset(in_buf, 0, elemsize); + memset(in_buf, 0, (size_t)elemsize); /* Increment the total I/O time */ acc_time += (end_time.tv_sec - start_time.tv_sec) * FACTOR + (end_time.tv_usec - start_time.tv_usec); From 1d01f7f16e558a769814fbfd3f7f8384667393fc Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 19 Feb 2024 22:38:07 -0800 Subject: [PATCH 56/65] No longer deploy private header files (#568) Both the Autotools and CMake no longer install the following header files: atom.h bitvect.h cdeflate.h cnbit.h cnone.h crle.h cskphuff.h cszip.h df.h dfan.h dfgr.h dfrig.h dfsd.h dfufp2i.h dynarray.h hchunks.h hcompi.h hconv.h hdfi.h hfile.h hkit.h linklist.h local_nc.h mfan.h mfani.h mfgri.h mstdio.h tbbt.h --- hdf/src/CMakeLists.txt | 36 ++++++++++++++++++------------------ hdf/src/Makefile.am | 10 +++------- mfhdf/libsrc/CMakeLists.txt | 8 ++++---- mfhdf/libsrc/Makefile.am | 7 ++++--- release_notes/RELEASE.txt | 36 +++++++++++++++++++++++++++++++++++- 5 files changed, 64 insertions(+), 33 deletions(-) diff --git a/hdf/src/CMakeLists.txt b/hdf/src/CMakeLists.txt index e164b5ef8c..ab2b8818c5 100644 --- a/hdf/src/CMakeLists.txt +++ b/hdf/src/CMakeLists.txt @@ -66,6 +66,22 @@ set (HDF4_HDF_SRC_CSRCS ) set (HDF4_HDF_SRC_CHDRS + ${HDF4_HDF_SRC_SOURCE_DIR}/H4api_adpt.h + #${HDF4_BINARY_DIR}/h4config.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hbitio.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hcomp.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hdatainfo.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hdf.h + ${HDF4_HDF_SRC_SOURCE_DIR}/herr.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hlimits.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hntdefs.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hproto.h + ${HDF4_HDF_SRC_SOURCE_DIR}/htags.h + ${HDF4_HDF_SRC_SOURCE_DIR}/mfgr.h + ${HDF4_HDF_SRC_SOURCE_DIR}/vg.h +) + +set (HDF4_PRIVATE_HDF_SRC_CHDRS ${HDF4_HDF_SRC_SOURCE_DIR}/atom.h ${HDF4_HDF_SRC_SOURCE_DIR}/bitvect.h ${HDF4_HDF_SRC_SOURCE_DIR}/cdeflate.h @@ -81,37 +97,21 @@ set (HDF4_HDF_SRC_CHDRS ${HDF4_HDF_SRC_SOURCE_DIR}/dfsd.h ${HDF4_HDF_SRC_SOURCE_DIR}/dfufp2i.h ${HDF4_HDF_SRC_SOURCE_DIR}/dynarray.h - ${HDF4_HDF_SRC_SOURCE_DIR}/H4api_adpt.h - #${HDF4_BINARY_DIR}/h4config.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hbitio.h + ${HDF4_HDF_SRC_SOURCE_DIR}/glist.h ${HDF4_HDF_SRC_SOURCE_DIR}/hchunks.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hcomp.h ${HDF4_HDF_SRC_SOURCE_DIR}/hcompi.h ${HDF4_HDF_SRC_SOURCE_DIR}/hconv.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hdatainfo.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hdf.h ${HDF4_HDF_SRC_SOURCE_DIR}/hdfi.h - ${HDF4_HDF_SRC_SOURCE_DIR}/herr.h ${HDF4_HDF_SRC_SOURCE_DIR}/hfile.h ${HDF4_HDF_SRC_SOURCE_DIR}/hkit.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hlimits.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hntdefs.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hproto.h ${HDF4_HDF_SRC_SOURCE_DIR}/hqueue.h - ${HDF4_HDF_SRC_SOURCE_DIR}/htags.h ${HDF4_HDF_SRC_SOURCE_DIR}/linklist.h + ${HDF4_HDF_SRC_SOURCE_DIR}/mcache.h ${HDF4_HDF_SRC_SOURCE_DIR}/mfan.h ${HDF4_HDF_SRC_SOURCE_DIR}/mfani.h - ${HDF4_HDF_SRC_SOURCE_DIR}/mfgr.h ${HDF4_HDF_SRC_SOURCE_DIR}/mfgri.h ${HDF4_HDF_SRC_SOURCE_DIR}/mstdio.h ${HDF4_HDF_SRC_SOURCE_DIR}/tbbt.h - ${HDF4_HDF_SRC_SOURCE_DIR}/vg.h -) - -set (HDF4_PRIVATE_HDF_SRC_CHDRS - ${HDF4_HDF_SRC_SOURCE_DIR}/glist.h - ${HDF4_HDF_SRC_SOURCE_DIR}/mcache.h ${HDF4_HDF_SRC_SOURCE_DIR}/vgint.h ) diff --git a/hdf/src/Makefile.am b/hdf/src/Makefile.am index 0bf30c7d35..c9cc6b7edf 100644 --- a/hdf/src/Makefile.am +++ b/hdf/src/Makefile.am @@ -20,13 +20,9 @@ CSOURCES = atom.c bitvect.c cdeflate.c cnbit.c cnone.c crle.c cskphuff.c \ mcache.c mfan.c mfgr.c mstdio.c tbbt.c vattr.c vconv.c vg.c \ vgp.c vhi.c vio.c vparse.c vrw.c vsfld.c -CHEADERS = atom.h bitvect.h cdeflate.h cnbit.h cnone.h cskphuff.h crle.h \ - cszip.h df.h dfan.h dfgr.h dfrig.h dfsd.h dfufp2i.h \ - dynarray.h H4api_adpt.h h4config.h hbitio.h hchunks.h hcomp.h \ - hcompi.h hconv.h hdf.h hdfi.h herr.h hfile.h hkit.h hlimits.h \ - hproto.h hntdefs.h htags.h linklist.h mfan.h mfani.h mfgr.h \ - mfgri.h mstdio.h tbbt.h vg.h hdatainfo.h -## hdatainfo.h needs to be added conditionally only, should fix this asap +CHEADERS = H4api_adpt.h h4config.h hbitio.h hcomp.h hdatainfo.h hdf.h \ + herr.h hlimits.h hntdefs.h hproto.h htags.h mfgr.h vg.h + FHEADERS = dffunc.f90 hdf.f90 dffunc.inc hdf.inc if HDF_BUILD_FORTRAN diff --git a/mfhdf/libsrc/CMakeLists.txt b/mfhdf/libsrc/CMakeLists.txt index b3bf90d17d..2a472aaa6d 100644 --- a/mfhdf/libsrc/CMakeLists.txt +++ b/mfhdf/libsrc/CMakeLists.txt @@ -35,18 +35,18 @@ set (HDF4_MFHDF_LIBSRC_CSRCS ) set (HDF4_MFHDF_LIBSRC_INSTALL_CHDRS - ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/local_nc.h + ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/hdf2netcdf.h + ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfdatainfo.h ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfhdf.h ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfhdfi.h - ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfdatainfo.h - ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/hdf2netcdf.h ) set (HDF4_MFHDF_LIBSRC_CHDRS ${HDF4_MFHDF_LIBSRC_INSTALL_CHDRS} ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/error.h - ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfprivate.h ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/h4_xdr.h + ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/local_nc.h + ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfprivate.h ) if (HDF4_ENABLE_NETCDF) diff --git a/mfhdf/libsrc/Makefile.am b/mfhdf/libsrc/Makefile.am index 64862de8a5..dae0e31b7f 100644 --- a/mfhdf/libsrc/Makefile.am +++ b/mfhdf/libsrc/Makefile.am @@ -36,10 +36,11 @@ endif libmfhdf_la_LIBADD = $(top_builddir)/hdf/src/libdf.la if HDF_BUILD_NETCDF -include_HEADERS = hdf2netcdf.h local_nc.h mfhdf.h netcdf.h mfhdfi.h mfdatainfo.h +include_HEADERS = hdf2netcdf.h mfhdf.h netcdf.h mfdatainfo.h \ + mfhdfi.h else -include_HEADERS = hdf2netcdf.h local_nc.h mfhdf.h hdf4_netcdf.h mfhdfi.h mfdatainfo.h -# mfdatainfo.h should be added conditionally only; should local_nc.h even be here? -BMR +include_HEADERS = hdf2netcdf.h mfhdf.h hdf4_netcdf.h mfdatainfo.h \ + mfhdfi.h endif # The following is a workaround. Since Fortran is included in this diff --git a/release_notes/RELEASE.txt b/release_notes/RELEASE.txt index 888b817827..7dc0cbe201 100644 --- a/release_notes/RELEASE.txt +++ b/release_notes/RELEASE.txt @@ -124,7 +124,41 @@ New features and changes C Library: ---------- - hdfi.h is no longer included by hdf.h + - Private headers are no longer deployed + + The following private headers are not a part of the public API and + will no longer be deployed when installing the library: + + atom.h + bitvect.h + cdeflate.h + cnbit.h + cnone.h + crle.h + cskphuff.h + cszip.h + df.h + dfan.h + dfgr.h + dfrig.h + dfsd.h + dfufp2i.h + dynarray.h + hchunks.h + hcompi.h + hconv.h + hdfi.h + hfile.h + hkit.h + linklist.h + local_nc.h + mfan.h + mfani.h + mfgri.h + mstdio.h + tbbt.h + + - hdfi.h is no longer included by hdf.h In the past, hdfi.h (an internal header file) was included in the public hdf.h header. This is no longer the case. Anything that From ae080c488facf507da4e3dd8e2e4425f98405859 Mon Sep 17 00:00:00 2001 From: Lori Cooper Date: Tue, 20 Feb 2024 12:11:14 -0600 Subject: [PATCH 57/65] Update README.md (#569) Updated new URL for HDF4 general info --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8936d5857e..c1e52027a4 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ DOCUMENTATION ------------- Full Documentation and Programming Resources for this release can be found at - https://portal.hdfgroup.org/display/HDF4 + https://portal.hdfgroup.org/hdf4/ See the RELEASE.txt file in the release\_notes/ directory for information specific to the features and updates included in this release of the library. From 91ac2899b0e2465ac08c62a3f164f7a94eac3775 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Tue, 20 Feb 2024 13:57:12 -0600 Subject: [PATCH 58/65] Add options to allow tools type selection and naming (#565) --- CMakeLists.txt | 19 +- .../config/cmake/HDFExampleMacros.cmake | 25 +- config/cmake/HDF4ExampleCache.cmake | 2 +- config/cmake/hdf4-config.cmake.in | 35 +- hdf/fortran/CMakeLists.txt | 4 +- hdf/src/CMakeLists.txt | 4 +- hdf/util/CMakeLists.txt | 342 +++++++----------- hdf/util/CMakeTests.cmake | 16 +- mfhdf/dumper/CMakeLists.txt | 24 +- mfhdf/dumper/CMakeTests.cmake | 2 +- mfhdf/fortran/CMakeLists.txt | 4 +- mfhdf/hdfimport/CMakeLists.txt | 26 +- mfhdf/hdfimport/CMakeTests.cmake | 6 +- mfhdf/hdiff/CMakeLists.txt | 23 +- mfhdf/hdiff/CMakeTests.cmake | 2 +- mfhdf/hrepack/CMakeLists.txt | 43 +-- mfhdf/hrepack/CMakeTests.cmake | 2 +- mfhdf/libsrc/CMakeLists.txt | 4 +- mfhdf/ncdump/CMakeLists.txt | 23 +- mfhdf/ncdump/CMakeTests.cmake | 2 +- mfhdf/ncgen/CMakeLists.txt | 23 +- mfhdf/ncgen/CMakeTests.cmake | 2 +- release_notes/INSTALL_CMake.txt | 1 + release_notes/RELEASE.txt | 7 + 24 files changed, 260 insertions(+), 381 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7216298bbd..06a2683142 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -335,7 +335,9 @@ set (H4_ENABLE_STATIC_LIB NO) option (BUILD_SHARED_LIBS "Build Shared Libraries" ON) set (H4_ENABLE_SHARED_LIB NO) -# only shared libraries is true if user forces static OFF +option (HDF4_BUILD_STATIC_TOOLS "Build Static Tools NOT Shared Tools" OFF) + +# only shared libraries/tools is true if user forces static OFF if (NOT BUILD_STATIC_LIBS) set (ONLY_SHARED_LIBS ON CACHE BOOL "Only Build Shared Libraries" FORCE) endif () @@ -345,6 +347,15 @@ if (ONLY_SHARED_LIBS) set (H4_ENABLE_STATIC_LIB NO) set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries" FORCE) set (BUILD_STATIC_LIBS OFF CACHE BOOL "Build Static Libraries" FORCE) + if (HDF4_BUILD_STATIC_TOOLS) + message (WARNING "Cannot build static tools without static libraries. Building shared tools.") + endif () + set (HDF4_BUILD_STATIC_TOOLS OFF CACHE BOOL "Build Static Tools NOT Shared Tools" FORCE) +endif () + +if (NOT BUILD_SHARED_LIBS AND NOT HDF4_BUILD_STATIC_TOOLS) + message (WARNING "Cannot build shared tools without shared libraries. Building static tools.") + set (HDF4_BUILD_STATIC_TOOLS ON CACHE BOOL "Build Static Tools NOT Shared Tools" FORCE) endif () if (BUILD_STATIC_LIBS) @@ -356,12 +367,6 @@ endif () set (CMAKE_POSITION_INDEPENDENT_CODE ON) -if (NOT BUILD_SHARED_LIBS) - set (tgt_file_ext "") -else () - set (tgt_file_ext "-shared") -endif () - add_definitions (-DHAVE_CONFIG_H) #----------------------------------------------------------------------------- diff --git a/HDF4Examples/config/cmake/HDFExampleMacros.cmake b/HDF4Examples/config/cmake/HDFExampleMacros.cmake index b9cf3ff137..012abcbbd1 100644 --- a/HDF4Examples/config/cmake/HDFExampleMacros.cmake +++ b/HDF4Examples/config/cmake/HDFExampleMacros.cmake @@ -120,18 +120,6 @@ macro (HDF4_SUPPORT) message (STATUS "HDF4 Fortran libs: static:${HDF4_static_Fortran_FOUND} and shared:${HDF4_shared_Fortran_FOUND}") message (STATUS "HDF4 Java libs: ${HDF4_Java_FOUND}") if (HDF4_FOUND) - if (USE_SHARED_LIBS) - if (NOT TARGET ${HDF4_NAMESPACE}hdp-shared) - add_executable (${HDF4_NAMESPACE}hdp-shared IMPORTED) - endif () - set (H4EX_HDF4_DUMP_EXECUTABLE $) - else () - if (NOT TARGET ${HDF4_NAMESPACE}hdp) - add_executable (${HDF4_NAMESPACE}hdp IMPORTED) - endif() - set (H4EX_HDF4_DUMP_EXECUTABLE $) - endif() - if (NOT HDF4_static_C_FOUND AND NOT HDF4_shared_C_FOUND) #find library from non-dual-binary package set (FIND_HDF_COMPONENTS C) @@ -165,11 +153,20 @@ macro (HDF4_SUPPORT) if (USE_SHARED_LIBS AND HDF4_shared_C_FOUND) set (H4EX_HDF4_LINK_LIBS ${H4EX_HDF4_LINK_LIBS} ${HDF4_C_SHARED_LIBRARY}) set (HDF4_LIBRARY_PATH ${PACKAGE_PREFIX_DIR}/lib) - set_property (TARGET ${HDF4_NAMESPACE}hdp-shared PROPERTY IMPORTED_LOCATION "${HDF4_TOOLS_DIR}/hdp-shared") else () set (H4EX_HDF4_LINK_LIBS ${H4EX_HDF4_LINK_LIBS} ${HDF4_C_STATIC_LIBRARY}) - set_property (TARGET ${HDF4_NAMESPACE}hdp PROPERTY IMPORTED_LOCATION "${HDF4_TOOLS_DIR}/hdp") endif () + if (HDF4_VERSION VERSION_LESS "4.3" AND NOT HDF4_shared_C_FOUND) + if (NOT TARGET ${HDF4_NAMESPACE}hdp-shared) + add_executable (${HDF4_NAMESPACE}hdp-shared IMPORTED) + endif () + set (H4EX_HDF4_DUMP_EXECUTABLE $) + else () + if (NOT TARGET ${HDF4_NAMESPACE}hdp) + add_executable (${HDF4_NAMESPACE}hdp IMPORTED) + endif() + set (H4EX_HDF4_DUMP_EXECUTABLE $) + endif() if (NOT HDF4_static_Fortran_FOUND AND NOT HDF4_shared_Fortran_FOUND) set (HDF_BUILD_FORTRAN OFF CACHE BOOL "Build FORTRAN support" FORCE) message (STATUS "HDF4 Fortran libs not found - disable build of Fortran examples") diff --git a/config/cmake/HDF4ExampleCache.cmake b/config/cmake/HDF4ExampleCache.cmake index 7aeb1c90a6..e255a90d32 100644 --- a/config/cmake/HDF4ExampleCache.cmake +++ b/config/cmake/HDF4ExampleCache.cmake @@ -48,4 +48,4 @@ endif () message (STATUS "HDF4 Example link libs: ${H4EX_HDF4_LINK_LIBS} Includes: ${H4EX_HDF4_INCLUDE_DIRS}") set (HDF4_TOOLS_DIR ${CMAKE_TEST_OUTPUT_DIRECTORY} CACHE STRING "HDF4 Directory for all Executables" FORCE) -set (H4EX_HDF4_DUMP_EXECUTABLE $ CACHE STRING "HDF4 hdp target" FORCE) +set (H4EX_HDF4_DUMP_EXECUTABLE $ CACHE STRING "HDF4 hdp target" FORCE) diff --git a/config/cmake/hdf4-config.cmake.in b/config/cmake/hdf4-config.cmake.in index bd6fa1ae0d..f720fadf49 100644 --- a/config/cmake/hdf4-config.cmake.in +++ b/config/cmake/hdf4-config.cmake.in @@ -16,20 +16,29 @@ set (${HDF4_PACKAGE_NAME}_VALID_COMPONENTS #----------------------------------------------------------------------------- # User Options #----------------------------------------------------------------------------- -set (${HDF4_PACKAGE_NAME}_BUILD_FORTRAN @HDF4_BUILD_FORTRAN@) -set (${HDF4_PACKAGE_NAME}_BUILD_JAVA @HDF4_BUILD_JAVA@) -set (${HDF4_PACKAGE_NAME}_BUILD_TOOLS @HDF4_BUILD_TOOLS@) -set (${HDF4_PACKAGE_NAME}_BUILD_UTILS @HDF4_BUILD_UTILS@) +# Languages: +#----------------------------------------------------------------------------- +set (${HDF4_PACKAGE_NAME}_BUILD_FORTRAN @HDF4_BUILD_FORTRAN@) +set (${HDF4_PACKAGE_NAME}_BUILD_JAVA @HDF4_BUILD_JAVA@) +#----------------------------------------------------------------------------- +# Features: +#----------------------------------------------------------------------------- +set (${HDF4_PACKAGE_NAME}_BUILD_SHARED_LIBS @H4_ENABLE_SHARED_LIB@) +set (${HDF4_PACKAGE_NAME}_BUILD_STATIC_LIBS @H4_ENABLE_STATIC_LIB@) +#----------------------------------------------------------------------------- +set (${HDF4_PACKAGE_NAME}_BUILD_TOOLS @HDF4_BUILD_TOOLS@) +set (${HDF4_PACKAGE_NAME}_BUILD_UTILS @HDF4_BUILD_UTILS@) +set (${HDF4_PACKAGE_NAME}_BUILD_STATIC_TOOLS @HDF4_BUILD_STATIC_TOOLS@) +#----------------------------------------------------------------------------- set (${HDF4_PACKAGE_NAME}_ENABLE_JPEG_LIB_SUPPORT @HDF4_ENABLE_JPEG_LIB_SUPPORT@) -set (${HDF4_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT @HDF4_ENABLE_Z_LIB_SUPPORT@) -set (${HDF4_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT @HDF4_ENABLE_SZIP_SUPPORT@) -set (${HDF4_PACKAGE_NAME}_ENABLE_SZIP_ENCODING @HDF4_ENABLE_SZIP_ENCODING@) -set (${HDF4_PACKAGE_NAME}_BUILD_SHARED_LIBS @H4_ENABLE_SHARED_LIB@) -set (${HDF4_PACKAGE_NAME}_BUILD_STATIC_LIBS @H4_ENABLE_STATIC_LIB@) -set (${HDF4_PACKAGE_NAME}_PACKAGE_EXTLIBS @HDF4_PACKAGE_EXTLIBS@) -set (${HDF4_PACKAGE_NAME}_EXPORT_LIBRARIES @HDF4_LIBRARIES_TO_EXPORT@) -set (${HDF4_PACKAGE_NAME}_ARCHITECTURE "@CMAKE_GENERATOR_ARCHITECTURE@") -set (${HDF4_PACKAGE_NAME}_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") +set (${HDF4_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT @HDF4_ENABLE_Z_LIB_SUPPORT@) +set (${HDF4_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT @HDF4_ENABLE_SZIP_SUPPORT@) +set (${HDF4_PACKAGE_NAME}_ENABLE_SZIP_ENCODING @HDF4_ENABLE_SZIP_ENCODING@) +#----------------------------------------------------------------------------- +set (${HDF4_PACKAGE_NAME}_PACKAGE_EXTLIBS @HDF4_PACKAGE_EXTLIBS@) +set (${HDF4_PACKAGE_NAME}_EXPORT_LIBRARIES @HDF4_LIBRARIES_TO_EXPORT@) +set (${HDF4_PACKAGE_NAME}_ARCHITECTURE "@CMAKE_GENERATOR_ARCHITECTURE@") +set (${HDF4_PACKAGE_NAME}_TOOLSET "@CMAKE_GENERATOR_TOOLSET@") #----------------------------------------------------------------------------- # Dependencies diff --git a/hdf/fortran/CMakeLists.txt b/hdf/fortran/CMakeLists.txt index 45503de51a..0ac55a7dd4 100644 --- a/hdf/fortran/CMakeLists.txt +++ b/hdf/fortran/CMakeLists.txt @@ -29,7 +29,7 @@ set (FORTRAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) #----------------------------------------------------------------------------- # Add Main fortran library #----------------------------------------------------------------------------- -if (NOT ONLY_SHARED_LIBS) +if (BUILD_STATIC_LIBS) add_library (${HDF4_SRC_FCSTUB_LIB_TARGET} STATIC ${HDF4_HDF_SRC_CSTUB_FSRCS} ${HDF4_HDF_SRC_CHDRS} ${HDF4_HDFSOURCE_DIR}/hproto_fortran.h ${HDF4_BINARY_DIR}/h4config.h) target_include_directories (${HDF4_SRC_FCSTUB_LIB_TARGET} PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_BINARY_DIR}" @@ -95,7 +95,7 @@ set (HDF4_F_FORTRAN_SRCS set_source_files_properties (${HDF4_F_FORTRAN_SRCS} PROPERTIES LANGUAGE Fortran) #----------------------------------------------------------------------------- -if (NOT ONLY_SHARED_LIBS) +if (BUILD_STATIC_LIBS) add_library (${HDF4_SRC_FORTRAN_LIB_TARGET} STATIC ${HDF4_F_FORTRAN_SRCS}) target_include_directories (${HDF4_SRC_FORTRAN_LIB_TARGET} PRIVATE "${HDF4_HDF_BINARY_DIR}" diff --git a/hdf/src/CMakeLists.txt b/hdf/src/CMakeLists.txt index ab2b8818c5..e10b337a45 100644 --- a/hdf/src/CMakeLists.txt +++ b/hdf/src/CMakeLists.txt @@ -115,7 +115,7 @@ set (HDF4_PRIVATE_HDF_SRC_CHDRS ${HDF4_HDF_SRC_SOURCE_DIR}/vgint.h ) -if (NOT ONLY_SHARED_LIBS) +if (BUILD_STATIC_LIBS) add_library (${HDF4_SRC_LIB_TARGET} STATIC ${HDF4_HDF_SRC_CSRCS} ${HDF4_HDF_SRC_CHDRS} ${HDF4_PRIVATE_HDF_SRC_CHDRS} ${HDF4_BINARY_DIR}/h4config.h) target_include_directories(${HDF4_SRC_LIB_TARGET} PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES}" @@ -194,7 +194,7 @@ if (HDF4_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF4_SRC_LIBSH_TARGET} ${HDF4_INSTALL_BIN_DIR} libraries) endif () - if (NOT ONLY_SHARED_LIBS) + if (BUILD_STATIC_LIBS) INSTALL_TARGET_PDB (${HDF4_SRC_LIB_TARGET} ${HDF4_INSTALL_LIB_DIR} libraries) endif () diff --git a/hdf/util/CMakeLists.txt b/hdf/util/CMakeLists.txt index 7f84edc7cf..9d335a7d87 100644 --- a/hdf/util/CMakeLists.txt +++ b/hdf/util/CMakeLists.txt @@ -3,21 +3,16 @@ project (HDF4_HDF_UTIL C) if (HDF4_BUILD_TOOLS) #-- Adding tool hdfls - if (NOT ONLY_SHARED_LIBS) - add_executable (hdfls ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfls.c) - target_include_directories(hdfls PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdfls ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfls.c) + target_include_directories(hdfls PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdfls STATIC) target_link_libraries (hdfls PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_EXECUTABLES hdfls) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdfls-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfls.c) - target_include_directories(hdfls-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdfls-shared SHARED) - target_link_libraries (hdfls-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} hdfls-shared) + else () + TARGET_C_PROPERTIES (hdfls SHARED) + target_link_libraries (hdfls PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_EXECUTABLES hdfls) #-- Adding utility hdfed set (hdfed_SRCS @@ -27,21 +22,16 @@ if (HDF4_BUILD_TOOLS) ${HDF4_HDF_UTIL_SOURCE_DIR}/he_main.c ) - if (NOT ONLY_SHARED_LIBS) - add_executable (hdfed ${hdfed_SRCS}) - target_include_directories(hdfed PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdfed ${hdfed_SRCS}) + target_include_directories(hdfed PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdfed STATIC) target_link_libraries (hdfed PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} hdfed) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdfed-shared ${hdfed_SRCS}) - target_include_directories(hdfed-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdfed-shared SHARED) - target_link_libraries (hdfed-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} hdfed-shared) + else () + TARGET_C_PROPERTIES (hdfed SHARED) + target_link_libraries (hdfed PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} hdfed) endif () if (HDF4_BUILD_UTILS) @@ -51,21 +41,16 @@ if (HDF4_BUILD_UTILS) ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfgifwr.c ) - if (NOT ONLY_SHARED_LIBS) - add_executable (hdf2gif ${hdf2gif_SRCS}) - target_include_directories(hdf2gif PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdf2gif ${hdf2gif_SRCS}) + target_include_directories(hdf2gif PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdf2gif STATIC) target_link_libraries (hdf2gif PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES hdf2gif) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdf2gif-shared ${hdf2gif_SRCS}) - target_include_directories(hdf2gif-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdf2gif-shared SHARED) - target_link_libraries (hdf2gif-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf2gif-shared) + else () + TARGET_C_PROPERTIES (hdf2gif SHARED) + target_link_libraries (hdf2gif PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES hdf2gif) #-- Adding utility gif2hdf set (gif2hdf_SRCS @@ -76,259 +61,184 @@ if (HDF4_BUILD_UTILS) ${HDF4_HDF_UTIL_SOURCE_DIR}/writehdf.c ) - if (NOT ONLY_SHARED_LIBS) - add_executable (gif2hdf ${gif2hdf_SRCS}) - target_include_directories(gif2hdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (gif2hdf ${gif2hdf_SRCS}) + target_include_directories(gif2hdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (gif2hdf STATIC) target_link_libraries (gif2hdf PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} gif2hdf) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (gif2hdf-shared ${gif2hdf_SRCS}) - target_include_directories(gif2hdf-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (gif2hdf-shared SHARED) - target_link_libraries (gif2hdf-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} gif2hdf-shared) + else () + TARGET_C_PROPERTIES (gif2hdf SHARED) + target_link_libraries (gif2hdf PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} gif2hdf) #-- Adding utility hdf24to8 - if (NOT ONLY_SHARED_LIBS) - add_executable (hdf24to8 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf24to8.c) - target_include_directories(hdf24to8 PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdf24to8 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf24to8.c) + target_include_directories(hdf24to8 PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdf24to8 STATIC) target_link_libraries (hdf24to8 PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf24to8) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdf24to8-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf24to8.c) - target_include_directories(hdf24to8-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdf24to8-shared SHARED) - target_link_libraries (hdf24to8-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf24to8-shared) + else () + TARGET_C_PROPERTIES (hdf24to8 SHARED) + target_link_libraries (hdf24to8 PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf24to8) #-- Adding utility hdftor8 - if (NOT ONLY_SHARED_LIBS) - add_executable (hdftor8 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdftor8.c) - target_include_directories(hdftor8 PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdftor8 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdftor8.c) + target_include_directories(hdftor8 PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdftor8 STATIC) target_link_libraries (hdftor8 PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdftor8) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdftor8-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/hdftor8.c) - target_include_directories(hdftor8-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdftor8-shared SHARED) - target_link_libraries (hdftor8-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdftor8-shared) + else () + TARGET_C_PROPERTIES (hdftor8 SHARED) + target_link_libraries (hdftor8 PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdftor8) #-- Adding utility ristosds - if (NOT ONLY_SHARED_LIBS) - add_executable (ristosds ${HDF4_HDF_UTIL_SOURCE_DIR}/ristosds.c) - target_include_directories(ristosds PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (ristosds ${HDF4_HDF_UTIL_SOURCE_DIR}/ristosds.c) + target_include_directories(ristosds PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (ristosds STATIC) target_link_libraries (ristosds PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} ristosds) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (ristosds-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/ristosds.c) - target_include_directories(ristosds-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (ristosds-shared SHARED) - target_link_libraries (ristosds-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} ristosds-shared) + else () + TARGET_C_PROPERTIES (ristosds SHARED) + target_link_libraries (ristosds PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} ristosds) #-- Adding utility hdfpack - if (NOT ONLY_SHARED_LIBS) - add_executable (hdfpack ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfpack.c) - target_include_directories(hdfpack PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdfpack ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfpack.c) + target_include_directories(hdfpack PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdfpack STATIC) target_link_libraries (hdfpack PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdfpack) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdfpack-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfpack.c) - target_include_directories(hdfpack-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdfpack-shared SHARED) - target_link_libraries (hdfpack-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdfpack-shared) + else () + TARGET_C_PROPERTIES (hdfpack SHARED) + target_link_libraries (hdfpack PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdfpack) #-- Adding utility paltohdf - if (NOT ONLY_SHARED_LIBS) - add_executable (paltohdf ${HDF4_HDF_UTIL_SOURCE_DIR}/paltohdf.c) - target_include_directories(paltohdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (paltohdf ${HDF4_HDF_UTIL_SOURCE_DIR}/paltohdf.c) + target_include_directories(paltohdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (paltohdf STATIC) target_link_libraries (paltohdf PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} paltohdf) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (paltohdf-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/paltohdf.c) - target_include_directories(paltohdf-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (paltohdf-shared SHARED) - target_link_libraries (paltohdf-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} paltohdf-shared) + else () + TARGET_C_PROPERTIES (paltohdf SHARED) + target_link_libraries (paltohdf PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} paltohdf) #-- Adding utility hdftopal - if (NOT ONLY_SHARED_LIBS) - add_executable (hdftopal ${HDF4_HDF_UTIL_SOURCE_DIR}/hdftopal.c) - target_include_directories(hdftopal PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdftopal ${HDF4_HDF_UTIL_SOURCE_DIR}/hdftopal.c) + target_include_directories(hdftopal PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdftopal STATIC) target_link_libraries (hdftopal PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdftopal) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdftopal-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/hdftopal.c) - target_include_directories(hdftopal-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdftopal-shared SHARED) - target_link_libraries (hdftopal-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdftopal-shared) + else () + TARGET_C_PROPERTIES (hdftopal SHARED) + target_link_libraries (hdftopal PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdftopal) #-- Adding utility r8tohdf - if (NOT ONLY_SHARED_LIBS) - add_executable (r8tohdf ${HDF4_HDF_UTIL_SOURCE_DIR}/r8tohdf.c) - target_include_directories(r8tohdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (r8tohdf ${HDF4_HDF_UTIL_SOURCE_DIR}/r8tohdf.c) + target_include_directories(r8tohdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (r8tohdf STATIC) target_link_libraries (r8tohdf PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} r8tohdf) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (r8tohdf-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/r8tohdf.c) - target_include_directories(r8tohdf-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (r8tohdf-shared SHARED) - target_link_libraries (r8tohdf-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} r8tohdf-shared) + else () + TARGET_C_PROPERTIES (r8tohdf SHARED) + target_link_libraries (r8tohdf PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} r8tohdf) #-- Adding utility hdfcomp - if (NOT ONLY_SHARED_LIBS) - add_executable (hdfcomp ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfcomp.c) - target_include_directories(hdfcomp PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdfcomp ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfcomp.c) + target_include_directories(hdfcomp PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdfcomp STATIC) target_link_libraries (hdfcomp PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdfcomp) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdfcomp-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfcomp.c) - target_include_directories(hdfcomp-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdfcomp-shared SHARED) - target_link_libraries (hdfcomp-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdfcomp-shared) + else () + TARGET_C_PROPERTIES (hdfcomp SHARED) + target_link_libraries (hdfcomp PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdfcomp) #-- Adding utility jpeg2hdf - if (NOT ONLY_SHARED_LIBS) - add_executable (jpeg2hdf ${HDF4_HDF_UTIL_SOURCE_DIR}/jpeg2hdf.c) - target_include_directories(jpeg2hdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (jpeg2hdf ${HDF4_HDF_UTIL_SOURCE_DIR}/jpeg2hdf.c) + target_include_directories(jpeg2hdf PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (jpeg2hdf STATIC) target_link_libraries (jpeg2hdf PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} jpeg2hdf) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (jpeg2hdf-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/jpeg2hdf.c) - target_include_directories(jpeg2hdf-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (jpeg2hdf-shared SHARED) - target_link_libraries (jpeg2hdf-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} jpeg2hdf-shared) + else () + TARGET_C_PROPERTIES (jpeg2hdf SHARED) + target_link_libraries (jpeg2hdf PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} jpeg2hdf) #-- Adding utility hdf2jpeg - if (NOT ONLY_SHARED_LIBS) - add_executable (hdf2jpeg ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf2jpeg.c) - target_include_directories(hdf2jpeg PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdf2jpeg ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf2jpeg.c) + target_include_directories(hdf2jpeg PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdf2jpeg STATIC) target_link_libraries (hdf2jpeg PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf2jpeg) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdf2jpeg-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf2jpeg.c) - target_include_directories(hdf2jpeg-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdf2jpeg-shared SHARED) - target_link_libraries (hdf2jpeg-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf2jpeg-shared) + else () + TARGET_C_PROPERTIES (hdf2jpeg SHARED) + target_link_libraries (hdf2jpeg PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf2jpeg) #-- Adding utility hdf8to24 - if (NOT ONLY_SHARED_LIBS) - add_executable (hdf8to24 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf8to24.c) - target_include_directories(hdf8to24 PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdf8to24 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf8to24.c) + target_include_directories(hdf8to24 PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdf8to24 STATIC) target_link_libraries (hdf8to24 PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf8to24) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdf8to24-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf8to24.c) - target_include_directories(hdf8to24-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdf8to24-shared SHARED) - target_link_libraries (hdf8to24-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf8to24-shared) + else () + TARGET_C_PROPERTIES (hdf8to24 SHARED) + target_link_libraries (hdf8to24 PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdf8to24) #-- Adding utility hdfunpac - if (NOT ONLY_SHARED_LIBS) - add_executable (hdfunpac ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfunpac.c) - target_include_directories(hdfunpac PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (hdfunpac ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfunpac.c) + target_include_directories(hdfunpac PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdfunpac STATIC) target_link_libraries (hdfunpac PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdfunpac) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (hdfunpac-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfunpac.c) - target_include_directories(hdfunpac-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdfunpac-shared SHARED) - target_link_libraries (hdfunpac-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdfunpac-shared) + else () + TARGET_C_PROPERTIES (hdfunpac SHARED) + target_link_libraries (hdfunpac PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} hdfunpac) #-- Adding utility vmake - if (NOT ONLY_SHARED_LIBS) - add_executable (vmake ${HDF4_HDF_UTIL_SOURCE_DIR}/vmake.c) - target_include_directories(vmake PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (vmake ${HDF4_HDF_UTIL_SOURCE_DIR}/vmake.c) + target_include_directories(vmake PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (vmake STATIC) target_link_libraries (vmake PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} vmake) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (vmake-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/vmake.c) - target_include_directories(vmake-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (vmake-shared SHARED) - target_link_libraries (vmake-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} vmake-shared) + else () + TARGET_C_PROPERTIES (vmake SHARED) + target_link_libraries (vmake PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} vmake) #-- Adding utility vshow - if (NOT ONLY_SHARED_LIBS) - add_executable (vshow ${HDF4_HDF_UTIL_SOURCE_DIR}/vshow.c) - target_include_directories(vshow PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + add_executable (vshow ${HDF4_HDF_UTIL_SOURCE_DIR}/vshow.c) + target_include_directories(vshow PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") + if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (vshow STATIC) target_link_libraries (vshow PRIVATE ${HDF4_MF_LIB_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} vshow) - endif () - - if (BUILD_SHARED_LIBS) - add_executable (vshow-shared ${HDF4_HDF_UTIL_SOURCE_DIR}/vshow.c) - target_include_directories(vshow-shared PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (vshow-shared SHARED) - target_link_libraries (vshow-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} vshow-shared) + else () + TARGET_C_PROPERTIES (vshow SHARED) + target_link_libraries (vshow PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () + set (H4_DEP_UTILITIES ${H4_DEP_UTILITIES} vshow) endif () if (BUILD_TESTING AND HDF4_BUILD_UTILS) diff --git a/hdf/util/CMakeTests.cmake b/hdf/util/CMakeTests.cmake index 7d5c76aeb9..e206dc4ad8 100644 --- a/hdf/util/CMakeTests.cmake +++ b/hdf/util/CMakeTests.cmake @@ -123,12 +123,6 @@ add_custom_target(hdf_util_files ALL COMMENT "Copying files needed by hdf_util t ############################################################################## ############################################################################## -if (NOT BUILD_SHARED_LIBS) - set (tgt_ext "") -else () - set (tgt_ext "-shared") -endif () - if (HDF4_BUILD_TOOLS) macro (ADD_LS_TEST_NOL testfile resultfile resultcode) if (HDF4_ENABLE_USING_MEMCHECKER) @@ -138,7 +132,7 @@ if (HDF4_BUILD_TOOLS) NAME HDFLS_NOL-${testfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${testfile}.tmp" @@ -164,7 +158,7 @@ if (HDF4_BUILD_TOOLS) NAME HDFLS-${testfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-l;${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${testfile}.tmp" @@ -190,7 +184,7 @@ if (HDF4_BUILD_TOOLS) NAME HEDIT-${testfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" + -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-batch" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_INPUT=${testfile}" @@ -210,7 +204,7 @@ if (HDF4_BUILD_TOOLS) endif () macro (ADD_H4_TEST testname testfile) - add_test (NAME ${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) + add_test (NAME ${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (NOT "${last_test}" STREQUAL "") set_tests_properties (${testname} PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME}) else () @@ -230,7 +224,7 @@ macro (ADD_CMP_TEST testname reffile testfile) endmacro () macro (ADD_H4Q_TEST testname testfile) - add_test (NAME ${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} > /dev/null 2>&1) + add_test (NAME ${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} > /dev/null 2>&1) if (NOT "${last_test}" STREQUAL "") set_tests_properties (${testname} PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME}) else () diff --git a/mfhdf/dumper/CMakeLists.txt b/mfhdf/dumper/CMakeLists.txt index e9dafb21c2..f7dd463fff 100644 --- a/mfhdf/dumper/CMakeLists.txt +++ b/mfhdf/dumper/CMakeLists.txt @@ -14,25 +14,19 @@ set (hdp_SRCS ${HDF4_MFHDF_DUMPER_SOURCE_DIR}/show.c ) -if (NOT ONLY_SHARED_LIBS) - add_executable (hdp ${hdp_SRCS}) - target_include_directories(hdp PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR}") +add_executable (hdp ${hdp_SRCS}) +target_include_directories(hdp PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR}") +if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdp STATIC) target_link_libraries (hdp PRIVATE ${HDF4_MF_LIB_TARGET}) - set_target_properties (hdp PROPERTIES COMPILE_DEFINITIONS "HDF") - set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hdp") - set (H4_DEP_EXECUTABLES hdp) +else () + TARGET_C_PROPERTIES (hdp SHARED) + target_link_libraries (hdp PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () +set_target_properties (hdp PROPERTIES COMPILE_DEFINITIONS "HDF") +set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hdp") -if (BUILD_SHARED_LIBS) - add_executable (hdp-shared ${hdp_SRCS}) - target_include_directories(hdp-shared PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdp-shared SHARED) - target_link_libraries (hdp-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set_target_properties (hdp-shared PROPERTIES COMPILE_DEFINITIONS "HDF") - set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hdp-shared") - set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} hdp-shared) -endif () +set (H4_DEP_EXECUTABLES hdp) if (BUILD_TESTING) include (CMakeTests.cmake) diff --git a/mfhdf/dumper/CMakeTests.cmake b/mfhdf/dumper/CMakeTests.cmake index 2e3d9548f2..ec37287e78 100644 --- a/mfhdf/dumper/CMakeTests.cmake +++ b/mfhdf/dumper/CMakeTests.cmake @@ -143,7 +143,7 @@ add_custom_target(dumper_files ALL COMMENT "Copying files needed by dumper tests if (NOT BUILD_SHARED_LIBS) set (tgt_ext "") else () - set (tgt_ext "-shared") + set (tgt_ext "") endif () macro (ADD_H4_TEST resultfile resultcode) diff --git a/mfhdf/fortran/CMakeLists.txt b/mfhdf/fortran/CMakeLists.txt index 2c7be8d571..0eac84b7a4 100644 --- a/mfhdf/fortran/CMakeLists.txt +++ b/mfhdf/fortran/CMakeLists.txt @@ -32,7 +32,7 @@ set (FORTRAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) #----------------------------------------------------------------------------- # Add Main fortran library #----------------------------------------------------------------------------- -if (NOT ONLY_SHARED_LIBS) +if (BUILD_STATIC_LIBS) add_library (${HDF4_MF_FCSTUB_LIB_TARGET} STATIC ${HDF4_MFHDF_LIBSRC_CSTUB_FSRCS} ${HDF4_MFHDF_LIBSRC_CSTUB_FHDRS} ${HDF4_HDF_SRC_CHDRS} ${HDF4_HDFSOURCE_DIR}/hproto_fortran.h) target_include_directories(${HDF4_MF_FCSTUB_LIB_TARGET} PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_BINARY_DIR}" @@ -88,7 +88,7 @@ set (HDF4_MF_FORTRAN_SRCS ) set_source_files_properties (${HDF4_MF_FORTRAN_SRCS} PROPERTIES LANGUAGE Fortran) #----------------------------------------------------------------------------- -if (NOT ONLY_SHARED_LIBS) +if (BUILD_STATIC_LIBS) add_library (${HDF4_MF_FORTRAN_LIB_TARGET} STATIC ${HDF4_MF_FORTRAN_SRCS}) target_include_directories (${HDF4_MF_FORTRAN_LIB_TARGET} PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_MFHDF_FORTRAN_BINARY_DIR};${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_HDF_TESTSOURCE_DIR}" diff --git a/mfhdf/hdfimport/CMakeLists.txt b/mfhdf/hdfimport/CMakeLists.txt index 601a6718f6..6ce4d120bd 100644 --- a/mfhdf/hdfimport/CMakeLists.txt +++ b/mfhdf/hdfimport/CMakeLists.txt @@ -9,27 +9,19 @@ set (hdfimport_SRCS ${HDF4_MFHDF_HDFIMPORT_SOURCE_DIR}/hdfimport.c ) -if (NOT ONLY_SHARED_LIBS) - add_executable (hdfimport ${hdfimport_SRCS}) - target_include_directories(hdfimport PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_BINARY_DIR}") +add_executable (hdfimport ${hdfimport_SRCS}) +target_include_directories(hdfimport PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_BINARY_DIR}") +if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdfimport STATIC) target_link_libraries (hdfimport PRIVATE ${HDF4_MF_LIB_TARGET}) - set_target_properties (hdfimport PROPERTIES COMPILE_DEFINITIONS "HDF") - set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hdfimport") - - set (H4_DEP_EXECUTABLES hdfimport) +else () + TARGET_C_PROPERTIES (hdfimport SHARED) + target_link_libraries (hdfimport PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () +set_target_properties (hdfimport PROPERTIES COMPILE_DEFINITIONS "HDF") +set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hdfimport") -if (BUILD_SHARED_LIBS) - add_executable (hdfimport-shared ${hdfimport_SRCS}) - target_include_directories(hdfimport-shared PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hdfimport-shared SHARED) - target_link_libraries (hdfimport-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set_target_properties (hdfimport-shared PROPERTIES COMPILE_DEFINITIONS "HDF") - set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hdfimport-shared") - - set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} hdfimport-shared) -endif () +set (H4_DEP_EXECUTABLES hdfimport) if (BUILD_TESTING) include (CMakeTests.cmake) diff --git a/mfhdf/hdfimport/CMakeTests.cmake b/mfhdf/hdfimport/CMakeTests.cmake index 1d36cf0695..de1a357328 100644 --- a/mfhdf/hdfimport/CMakeTests.cmake +++ b/mfhdf/hdfimport/CMakeTests.cmake @@ -57,7 +57,7 @@ set (hdfimporttest_SRCS add_executable (hdfimporttest ${hdfimporttest_SRCS}) target_include_directories(hdfimporttest PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_BINARY_DIR}") -if (NOT ONLY_SHARED_LIBS) +if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdfimporttest STATIC) target_link_libraries (hdfimporttest PRIVATE ${HDF4_MF_LIB_TARGET}) else () @@ -72,7 +72,7 @@ set (gen_sds_floats_SRCS add_executable (gen_sds_floats ${gen_sds_floats_SRCS}) target_include_directories(gen_sds_floats PRIVATE "${HDF4_HDF_BINARY_DIR};${HDF4_BINARY_DIR}") -if (NOT ONLY_SHARED_LIBS) +if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (gen_sds_floats STATIC) target_link_libraries (gen_sds_floats PRIVATE ${HDF4_MF_LIB_TARGET}) else () @@ -89,7 +89,7 @@ endif () if (NOT BUILD_SHARED_LIBS) set (tgt_ext "") else () - set (tgt_ext "-shared") + set (tgt_ext "") endif () macro (ADD_H4_TEST resultfile resultcode testtfile testtype) diff --git a/mfhdf/hdiff/CMakeLists.txt b/mfhdf/hdiff/CMakeLists.txt index 297351606f..bc0f53d797 100644 --- a/mfhdf/hdiff/CMakeLists.txt +++ b/mfhdf/hdiff/CMakeLists.txt @@ -21,25 +21,18 @@ set (hdiff_SRCS ${HDF4_MFHDF_UTIL_DIR}/h4getopt.c ) -if (NOT ONLY_SHARED_LIBS) - add_executable(hdiff ${hdiff_SRCS}) - target_include_directories(hdiff PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_BINARY_DIR};${HDF4_MFHDF_UTIL_DIR}") +add_executable(hdiff ${hdiff_SRCS}) +target_include_directories(hdiff PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_BINARY_DIR};${HDF4_MFHDF_UTIL_DIR}") +if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hdiff STATIC) target_link_libraries(hdiff PRIVATE ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS}) - set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hdiff") - - set (H4_DEP_EXECUTABLES hdiff) +else () + TARGET_C_PROPERTIES (hdiff SHARED) + target_link_libraries(hdiff PRIVATE ${HDF4_MF_LIBSH_TARGET} ${HDF4_SRC_LIBSH_TARGET} ${LINK_LIBS}) endif () +set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hdiff") -if (BUILD_SHARED_LIBS) - add_executable(hdiff-shared ${hdiff_SRCS}) - target_include_directories(hdiff-shared PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_BINARY_DIR};${HDF4_MFHDF_UTIL_DIR}") - TARGET_C_PROPERTIES (hdiff-shared SHARED) - target_link_libraries(hdiff-shared PRIVATE ${HDF4_MF_LIBSH_TARGET} ${HDF4_SRC_LIBSH_TARGET} ${LINK_LIBS}) - set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hdiff-shared") - - set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} hdiff-shared) -endif () +set (H4_DEP_EXECUTABLES hdiff) if (BUILD_TESTING) include (CMakeTests.cmake) diff --git a/mfhdf/hdiff/CMakeTests.cmake b/mfhdf/hdiff/CMakeTests.cmake index 5f7ccd2481..0494537229 100644 --- a/mfhdf/hdiff/CMakeTests.cmake +++ b/mfhdf/hdiff/CMakeTests.cmake @@ -46,7 +46,7 @@ endif () if (NOT BUILD_SHARED_LIBS) set (tgt_ext "") else () - set (tgt_ext "-shared") + set (tgt_ext "") endif () macro (ADD_H4_TEST resultfile resultcode) diff --git a/mfhdf/hrepack/CMakeLists.txt b/mfhdf/hrepack/CMakeLists.txt index dc7610b7d8..9cb6e0d1be 100644 --- a/mfhdf/hrepack/CMakeLists.txt +++ b/mfhdf/hrepack/CMakeLists.txt @@ -19,39 +19,30 @@ set (hrepack_SRCS ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_dim.c ) -if (NOT ONLY_SHARED_LIBS) - add_executable (hrepack ${hrepack_SRCS}) - target_include_directories(hrepack PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR}") +add_executable (hrepack ${hrepack_SRCS}) +target_include_directories(hrepack PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR}") +if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hrepack STATIC) target_link_libraries (hrepack PRIVATE ${HDF4_MF_LIB_TARGET} ${LINK_COMP_LIBS}) - set_target_properties (hrepack PROPERTIES COMPILE_DEFINITIONS "HDF") - set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hrepack") +else () + TARGET_C_PROPERTIES (hrepack SHARED) + target_link_libraries (hrepack PRIVATE ${HDF4_MF_LIBSH_TARGET} ${LINK_COMP_LIBS}) +endif () +set_target_properties (hrepack PROPERTIES COMPILE_DEFINITIONS "HDF") +set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hrepack") - add_executable (hrepack_check ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_check.c) - target_include_directories(hrepack_check PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR}") +add_executable (hrepack_check ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_check.c) +target_include_directories(hrepack_check PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR}") +if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (hrepack_check STATIC) target_link_libraries (hrepack_check PRIVATE ${HDF4_MF_LIB_TARGET}) - set_target_properties (hrepack_check PROPERTIES COMPILE_DEFINITIONS "HDF") - - set (H4_DEP_EXECUTABLES hrepack) +else () + TARGET_C_PROPERTIES (hrepack_check SHARED) + target_link_libraries (hrepack_check PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () +set_target_properties (hrepack_check PROPERTIES COMPILE_DEFINITIONS "HDF") -if (BUILD_SHARED_LIBS) - add_executable (hrepack-shared ${hrepack_SRCS}) - target_include_directories(hrepack-shared PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hrepack-shared SHARED) - target_link_libraries (hrepack-shared PRIVATE ${HDF4_MF_LIBSH_TARGET} ${LINK_COMP_LIBS}) - set_target_properties (hrepack-shared PROPERTIES COMPILE_DEFINITIONS "HDF") - set_global_variable (HDF4_UTILS_TO_EXPORT "${HDF4_UTILS_TO_EXPORT};hrepack-shared") - - add_executable (hrepack_check-shared ${HDF4_MFHDF_HREPACK_SOURCE_DIR}/hrepack_check.c) - target_include_directories(hrepack_check-shared PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (hrepack_check-shared SHARED) - target_link_libraries (hrepack_check-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set_target_properties (hrepack_check-shared PROPERTIES COMPILE_DEFINITIONS "HDF") - - set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} hrepack-shared) -endif () +set (H4_DEP_EXECUTABLES hrepack) if (BUILD_TESTING) include (CMakeTests.cmake) diff --git a/mfhdf/hrepack/CMakeTests.cmake b/mfhdf/hrepack/CMakeTests.cmake index 48e1afd6f3..eec82e3ae0 100644 --- a/mfhdf/hrepack/CMakeTests.cmake +++ b/mfhdf/hrepack/CMakeTests.cmake @@ -34,7 +34,7 @@ endif () if (NOT BUILD_SHARED_LIBS) set (tgt_ext "") else () - set (tgt_ext "-shared") + set (tgt_ext "") endif () macro (ADD_H4_TEST testname testtype testfile) diff --git a/mfhdf/libsrc/CMakeLists.txt b/mfhdf/libsrc/CMakeLists.txt index 2a472aaa6d..6d17d7fc0f 100644 --- a/mfhdf/libsrc/CMakeLists.txt +++ b/mfhdf/libsrc/CMakeLists.txt @@ -57,7 +57,7 @@ else () set (HDF4_MFHDF_LIBSRC_XCHDRS ${HDF4_BINARY_DIR}/hdf4_netcdf.h) endif () -if (NOT ONLY_SHARED_LIBS) +if (BUILD_STATIC_LIBS) add_library (${HDF4_MF_LIB_TARGET} STATIC ${HDF4_MFHDF_LIBSRC_CSRCS} ${HDF4_MFHDF_LIBSRC_CHDRS}) target_include_directories (${HDF4_MF_LIB_TARGET} PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_BINARY_DIR};${HDF4_COMP_INCLUDE_DIRECTORIES}" @@ -126,7 +126,7 @@ install ( if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF4_MF_LIBSH_TARGET} ${HDF4_INSTALL_BIN_DIR} libraries) endif () -if (NOT ONLY_SHARED_LIBS) +if (BUILD_STATIC_LIBS) INSTALL_TARGET_PDB (${HDF4_MF_LIB_TARGET} ${HDF4_INSTALL_LIB_DIR} libraries) endif () diff --git a/mfhdf/ncdump/CMakeLists.txt b/mfhdf/ncdump/CMakeLists.txt index e2aaf1a5dd..bfae6bf2e8 100644 --- a/mfhdf/ncdump/CMakeLists.txt +++ b/mfhdf/ncdump/CMakeLists.txt @@ -8,25 +8,18 @@ set (ncdump_SRCS ${HDF4_MFHDF_UTIL_DIR}/h4getopt.c ) -if (NOT ONLY_SHARED_LIBS) - add_executable (ncdump ${ncdump_SRCS}) - target_include_directories (ncdump PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_MFHDF_UTIL_DIR};${HDF4_BINARY_DIR}") +add_executable (ncdump ${ncdump_SRCS}) +target_include_directories (ncdump PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_MFHDF_UTIL_DIR};${HDF4_BINARY_DIR}") +if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (ncdump STATIC) target_link_libraries (ncdump PRIVATE ${HDF4_MF_LIB_TARGET}) - set_target_properties (ncdump PROPERTIES COMPILE_DEFINITIONS "HDF") - - set (H4_DEP_EXECUTABLES ncdump) +else () + TARGET_C_PROPERTIES (ncdump SHARED) + target_link_libraries (ncdump PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () +set_target_properties (ncdump PROPERTIES COMPILE_DEFINITIONS "HDF") -if (BUILD_SHARED_LIBS) - add_executable (ncdump-shared ${ncdump_SRCS}) - target_include_directories (ncdump-shared PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_MFHDF_UTIL_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (ncdump-shared SHARED) - target_link_libraries (ncdump-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set_target_properties (ncdump-shared PROPERTIES COMPILE_DEFINITIONS "HDF") - - set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} ncdump-shared) -endif () +set (H4_DEP_EXECUTABLES ncdump) if (BUILD_TESTING) include (CMakeTests.cmake) diff --git a/mfhdf/ncdump/CMakeTests.cmake b/mfhdf/ncdump/CMakeTests.cmake index 533fcbdad3..3f9ef58093 100644 --- a/mfhdf/ncdump/CMakeTests.cmake +++ b/mfhdf/ncdump/CMakeTests.cmake @@ -8,7 +8,7 @@ if (NOT BUILD_SHARED_LIBS) set (tgt_ext "") else () - set (tgt_ext "-shared") + set (tgt_ext "") endif () # Remove any output file left over from previous test run diff --git a/mfhdf/ncgen/CMakeLists.txt b/mfhdf/ncgen/CMakeLists.txt index 4e7e1cf5f1..490c5b5a07 100644 --- a/mfhdf/ncgen/CMakeLists.txt +++ b/mfhdf/ncgen/CMakeLists.txt @@ -20,25 +20,18 @@ set (ncgen_SRCS ${HDF4_MFHDF_UTIL_DIR}/h4getopt.c ) -if (NOT ONLY_SHARED_LIBS) - add_executable (ncgen ${ncgen_SRCS}) - target_include_directories(ncgen PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_MFHDF_UTIL_DIR};${HDF4_BINARY_DIR}") +add_executable (ncgen ${ncgen_SRCS}) +target_include_directories(ncgen PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_MFHDF_UTIL_DIR};${HDF4_BINARY_DIR}") +if (HDF4_BUILD_STATIC_TOOLS) TARGET_C_PROPERTIES (ncgen STATIC) target_link_libraries (ncgen PRIVATE ${HDF4_MF_LIB_TARGET}) - set_target_properties (ncgen PROPERTIES COMPILE_DEFINITIONS "HDF") - - set (H4_DEP_EXECUTABLES ncgen) +else () + TARGET_C_PROPERTIES (ncgen SHARED) + target_link_libraries (ncgen PRIVATE ${HDF4_MF_LIBSH_TARGET}) endif () +set_target_properties (ncgen PROPERTIES COMPILE_DEFINITIONS "HDF") -if (BUILD_SHARED_LIBS) - add_executable (ncgen-shared ${ncgen_SRCS}) - target_include_directories(ncgen-shared PRIVATE "${HDF4_HDFSOURCE_DIR};${HDF4_MFHDFSOURCE_DIR};${HDF4_MFHDF_UTIL_DIR};${HDF4_BINARY_DIR}") - TARGET_C_PROPERTIES (ncgen-shared SHARED) - target_link_libraries (ncgen-shared PRIVATE ${HDF4_MF_LIBSH_TARGET}) - set_target_properties (ncgen-shared PROPERTIES COMPILE_DEFINITIONS "HDF") - - set (H4_DEP_EXECUTABLES ${H4_DEP_EXECUTABLES} ncgen-shared) -endif () +set (H4_DEP_EXECUTABLES ncgen) if (BUILD_TESTING) include (CMakeTests.cmake) diff --git a/mfhdf/ncgen/CMakeTests.cmake b/mfhdf/ncgen/CMakeTests.cmake index c2a71e32a2..6991fb9cf7 100644 --- a/mfhdf/ncgen/CMakeTests.cmake +++ b/mfhdf/ncgen/CMakeTests.cmake @@ -8,7 +8,7 @@ if (NOT BUILD_SHARED_LIBS) set (tgt_ext "") else () - set (tgt_ext "-shared") + set (tgt_ext "") endif () # Remove any output file left over from previous test run diff --git a/release_notes/INSTALL_CMake.txt b/release_notes/INSTALL_CMake.txt index 2ab720c7d5..29319d176d 100644 --- a/release_notes/INSTALL_CMake.txt +++ b/release_notes/INSTALL_CMake.txt @@ -692,6 +692,7 @@ HDF4_BUILD_UTILS "Build HDF4 Utilities" OFF HDF4_ENABLE_NETCDF "Build HDF4 versions of NetCDF-3 APIS" ON HDF4_BUILD_JAVA "Build Java HDF Library" OFF HDF4_BUILD_NETCDF_TOOLS "Build HDF4 versions of ncdump and ncgen" ON +HDF4_BUILD_STATIC_TOOLS "Build Static Tools Not Shared Tools" OFF ---------------- HDF4 Folder Build Options --------------------- Defaults relative to $ diff --git a/release_notes/RELEASE.txt b/release_notes/RELEASE.txt index 7dc0cbe201..7a282fa02a 100644 --- a/release_notes/RELEASE.txt +++ b/release_notes/RELEASE.txt @@ -39,6 +39,13 @@ New features and changes ======================== Configuration: ------------- + - New option for building and naming tools in CMake + + The following option has been added: + HDF4_BUILD_STATIC_TOOLS "Build Static Tools Not Shared Tools" OFF + + The default will build shared tools unless BUILD_SHARED_LIBS = OFF. + - XDR changes We now only support building HDF4 with the XDR implementation packaged From ed45b86b9e87cecfbdf11a4c7b98a133a510b84c Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 20 Feb 2024 12:29:21 -0800 Subject: [PATCH 59/65] Fix misc gcc warnings (#570) * Remove dead code in hdf/src/mfan.c * Add const to many constant string initializations * Fix some integer type mismatch with casts * Fix logic and parentheses in szip test * Clarify ambiguous brackets * Turn off format-nonliteral warnings --- config/gnu-warnings/no-developer-general | 1 + hdf/src/mfan.c | 67 ----------------------- hdf/test/mgr.c | 13 +++-- hdf/test/tattdatainfo.c | 24 ++++---- hdf/test/tmgrcomp.c | 70 +++++++++++------------- hdf/test/tszip.c | 14 ++--- hdf/util/he_file.c | 8 +-- mfhdf/dumper/hdp_list.c | 34 ++++++------ mfhdf/hdiff/hdiff_misc.c | 4 +- mfhdf/hrepack/hrepack_gr.c | 8 +-- mfhdf/libsrc/mfsd.c | 24 ++++---- mfhdf/libsrc/putget.c | 4 +- mfhdf/ncdump/vardata.c | 8 +++ mfhdf/test/tncunlim.c | 24 ++++---- 14 files changed, 123 insertions(+), 180 deletions(-) diff --git a/config/gnu-warnings/no-developer-general b/config/gnu-warnings/no-developer-general index fafa1214f3..45f84dba72 100644 --- a/config/gnu-warnings/no-developer-general +++ b/config/gnu-warnings/no-developer-general @@ -6,3 +6,4 @@ # regarding the library settings string (H4libhdf4_settings). We'll turn # it off here but leave it on in the developer flags. -Wno-overlength-strings +-Wno-format-nonliteral diff --git a/hdf/src/mfan.c b/hdf/src/mfan.c index a506742812..5901599470 100644 --- a/hdf/src/mfan.c +++ b/hdf/src/mfan.c @@ -569,73 +569,6 @@ ANIcreate_ann_tree(int32 an_id,/* IN: annotation interface id */ return ret_value; } /* ANIcreate_ann_tree */ -#if NOT_USED_YET -/*-------------------------------------------------------------------------- - NAME - ANIfind -- find annotation id for given annotation type and ref number - - DESCRIPTION - Find annotation id for the given annotation type and ref number - - RETURNS - Annotation id if successful and FAIL (-1) otherwise - - AUTHOR - GeorgeV. - - -------------------------------------------------------------------------*/ -static int32 -ANIfind(int32 an_id, /* IN: annotation interface id */ - ann_type type, /* IN: AN_DATA_LABEL for data labels, - AN_DATA_DESC for data descriptions, - AN_FILE_LABEL for file labels, - AN_FILE_DESC for file descriptions.*/ - uint16 ann_ref /* IN: ref of annotation */) -{ - filerec_t *file_rec = NULL; /* file record pointer */ - TBBT_NODE *entry = NULL; - ANentry *ann_entry = NULL; - int32 ann_key; - int32 ret_value = SUCCEED; - - /* Clear error stack */ - HEclear(); - - /* convert an_id i.e. file_id to file rec and check for validity */ - file_rec = HAatom_object(an_id); - if (BADFREC(file_rec)) - HGOTO_ERROR(DFE_ARGS, FAIL); - - /* Check for empty annotation tree of 'type'? */ - if (file_rec->an_num[type] == -1) { - if ((file_rec->an_tree[type] = (TBBT_TREE *)tbbtdmake(ANIanncmp, sizeof(int32), 0)) == NULL) { - HE_REPORT_GOTO("failed to create annotation tree", FAIL); - } - - file_rec->an_num[type] = 0; /* initialize after allocation */ - } - - /* Create key from type/ref pair - * ---------------------------- - * | type(16bits) | ref(16bits) | - * -----------------------------*/ - ann_key = AN_CREATE_KEY(type, ann_ref); - - /* See if annotation of 'type' with ref exits */ - if ((entry = tbbtdfind(file_rec->an_tree[type], &ann_key, NULL)) == NULL) - HE_REPORT_GOTO("failed to find annotation of 'type'", FAIL); - - /* get annotation entry from node */ - ann_entry = (ANentry *)entry->data; - - /* return annotation id */ - ret_value = ann_entry->ann_id; - -done: - return ret_value; -} /* ANIfind */ -#endif /* NOT_USED_YET */ - /*-------------------------------------------------------------------------- NAME ANInumann -- find number of annotation of 'type' that diff --git a/hdf/test/mgr.c b/hdf/test/mgr.c index 253a2a8734..5916f5b9d8 100644 --- a/hdf/test/mgr.c +++ b/hdf/test/mgr.c @@ -4431,12 +4431,13 @@ test_mgr_chunkwr_pixel(int flag) data_type, /* data type of the image data */ comp_flag, /* compression flag */ index, i; - int32 start[2], stride[2], edge[2]; - intn is_mappedable; /* TRUE if the image is mapped-able (hmap project)*/ - intn name_generated; /* TRUE if the image has name generated by lib */ - int16 data_out[3 * Y_LENGTH * X_LENGTH]; - char *image_name[] = {"Image_NO", "Image_RL", "Image_Sk", "Image_DF"}; - char *file_name[] = {"ChunkedGR_NO.hdf", "ChunkedGR_RL.hdf", "ChunkedGR_SK.hdf", "ChunkedGR_DF.hdf"}; + int32 start[2], stride[2], edge[2]; + intn is_mappedable; /* TRUE if the image is mapped-able (hmap project)*/ + intn name_generated; /* TRUE if the image has name generated by lib */ + int16 data_out[3 * Y_LENGTH * X_LENGTH]; + const char *image_name[] = {"Image_NO", "Image_RL", "Image_Sk", "Image_DF"}; + const char *file_name[] = {"ChunkedGR_NO.hdf", "ChunkedGR_RL.hdf", "ChunkedGR_SK.hdf", + "ChunkedGR_DF.hdf"}; HDF_CHUNK_DEF chunk_def; int16 chunk_buf[18]; diff --git a/hdf/test/tattdatainfo.c b/hdf/test/tattdatainfo.c index fd20eefe87..1686c32554 100644 --- a/hdf/test/tattdatainfo.c +++ b/hdf/test/tattdatainfo.c @@ -406,18 +406,18 @@ test_vgmixedattrs() /* Test Vattrinfo2 and Vgetattr2 on each attribute */ for (ii = 0; ii < n_attrs; ii++) { - char aname[20]; - int32 atype, acount, asize, n_fields; - uint16 refnum; - int jj; - char cvalues[20]; - int32 ivalues[10]; - char *check_attr_names[5] = {"Attribute 6", "Attribute 7", "Attribute 1", "Attribute 2", - "Attribute 5"}; - char *check_attr_values[5] = {"VG0 oldattr0", "VG0 oldattr1", - "", /* int values, added by test_vvsattrs with attr1 */ - "Vgroup0", /* added by test_vvsattrs with attr2 */ - "VG0 newattr"}; + char aname[20]; + int32 atype, acount, asize, n_fields; + uint16 refnum; + int jj; + char cvalues[20]; + int32 ivalues[10]; + const char *check_attr_names[5] = {"Attribute 6", "Attribute 7", "Attribute 1", "Attribute 2", + "Attribute 5"}; + const char *check_attr_values[5] = {"VG0 oldattr0", "VG0 oldattr1", + "", /* int values, added by test_vvsattrs with attr1 */ + "Vgroup0", /* added by test_vvsattrs with attr2 */ + "VG0 newattr"}; /* Get attribute information and verify its name and number of fields, which should be 1 */ diff --git a/hdf/test/tmgrcomp.c b/hdf/test/tmgrcomp.c index 1ed731d243..f8a88fe60a 100644 --- a/hdf/test/tmgrcomp.c +++ b/hdf/test/tmgrcomp.c @@ -60,11 +60,10 @@ test_mgr_compress_a() int32 start[2]; /* start of image data to grab */ int32 stride[2]; /* stride of image data to grab */ int32 count[2]; /* Size of image data to operate on */ - intn i, j; /* indices */ /* Initialize data we are going to write out */ - for (i = 0; i < 10; i++) - for (j = 0; j < 10; j++) + for (int i = 0; i < 10; i++) + for (int j = 0; j < 10; j++) image0[i][j] = (uint8)(i + j); /* Get the first image in this file */ @@ -103,7 +102,7 @@ test_mgr_compress_a() if (memcmp(image, image0, 10 * 10) != 0) { MESSAGE(3, printf("Error reading data for gzip compressed image\n");); num_errs++; - } /* end if */ + } /* Close the empty image */ ret = GRendaccess(riid); @@ -159,7 +158,7 @@ test_mgr_compress_a() if (memcmp(image, image0, 10 * 10) != 0) { MESSAGE(3, printf("Error reading 2nd data for gzip compressed image\n");); num_errs++; - } /* end if */ + } /* Close the empty image */ ret = GRendaccess(riid); @@ -210,11 +209,10 @@ test_mgr_compress_b() int32 interlace_mode, n_comps, n_attrs, datatype; /* Image information */ char name[30]; /* Buffer for retrieving image name */ uint8 attr; /* Attribute data */ - intn i, j; /* indices */ /* Initialize data we are going to write out */ - for (i = 0; i < 10; i++) - for (j = 0; j < 10; j++) + for (int i = 0; i < 10; i++) + for (int j = 0; j < 10; j++) image0[i][j] = (uint8)(i + j); /* Get the first image in this file */ @@ -286,7 +284,7 @@ test_mgr_compress_b() if (memcmp(image, image0, 10 * 10) != 0) { MESSAGE(3, printf("Error reading data for gzip compressed image\n");); num_errs++; - } /* end if */ + } /* Close the image */ ret = GRendaccess(riid); @@ -309,16 +307,15 @@ test_mgr_compress_b() static int test_mgr_compress_c() { - intn status; /* status for functions returning an intn */ - int32 file_id, /* HDF file identifier */ - gr_id, /* GR interface identifier */ - ri_id, /* raster image identifier */ - start[2], /* start position to write for each dimension */ - edges[2], /* number of elements to be written along each dimension */ - dim_sizes[2], /* dimension sizes of the image array */ - interlace_mode, /* interlace mode of the image */ - data_type, /* data type of the image data */ - i, j; + int status; /* status for functions returning an int */ + int32 file_id; /* HDF file identifier */ + int32 gr_id; /* GR interface identifier */ + int32 ri_id; /* raster image identifier */ + int32 start[2]; /* start position to write for each dimension */ + int32 edges[2]; /* number of elements to be written along each dimension */ + int32 dim_sizes[2]; /* dimension sizes of the image array */ + int32 interlace_mode; /* interlace mode of the image */ + int32 data_type; /* data type of the image data */ uint8 image_buf[128][128][3]; uint8 read_buf[128][128][3]; comp_info c_info; @@ -351,11 +348,11 @@ test_mgr_compress_c() CHECK(status, FAIL, "GRsetcompress"); /* Fill the image data buffer with values */ - for (i = 0; i < 128; i++) - for (j = 0; j < 128; j++) { - image_buf[i][j][0] = (i + j) + 1; - image_buf[i][j][1] = (i + j) + 1; - image_buf[i][j][2] = (i + j) + 1; + for (uint8 i = 0; i < 128; i++) + for (uint8 j = 0; j < 128; j++) { + image_buf[i][j][0] = (uint8)(i + j + 1); + image_buf[i][j][1] = (uint8)(i + j + 1); + image_buf[i][j][2] = (uint8)(i + j + 1); } /* Write data in the buffer into the image array */ @@ -399,7 +396,7 @@ test_mgr_compress_c() if (fuzzy_memcmp(image_buf, read_buf, 128 * 128 * 3, JPEG_FUZZ) != 0) { MESSAGE(3, printf("tmgrcomp: Error reading data for 24-bit JPEG compressed image\n");); num_errs++; - } /* end if */ + } /* Terminate access to raster image and to GR */ /* interface and, close the HDF file. */ @@ -443,21 +440,20 @@ test_mgr_compress_c() #define DEFLATE_LEVEL 7 /* arbitrary */ #define SKPHUFF_SKIPSIZE 28 /* arbitrary */ -static intn -make_comp_image(int32 grid, char *img_name, comp_coder_t comp_type, /* Compression method */ - comp_info *cinfo, char *message) /* Compression parameters */ +static int +make_comp_image(int32 grid, const char *img_name, comp_coder_t comp_type, /* Compression method */ + comp_info *cinfo, char *message) /* Compression parameters */ { int32 riid; /* RI ID of the working image */ int32 dims[2] = {10, 10}; /* dimensions for the empty image */ uint8 image_data[10][10]; /* space for the image data */ int32 start[2]; /* start of image data to grab */ int32 stride[2]; /* stride of image data to grab */ - intn i, j; /* indices */ - intn ret_value; /* generic return value */ + int ret_value; /* generic return value */ /* Initialize data we are going to write out */ - for (i = 0; i < 10; i++) - for (j = 0; j < 10; j++) + for (int i = 0; i < 10; i++) + for (int j = 0; j < 10; j++) image_data[i][j] = (uint8)(i + j + 10); /* Create the image */ @@ -502,7 +498,7 @@ test_get_compress() comp_coder_t comp_type; /* Compression method */ comp_info cinfo; /* Compression parameters - union */ char err_func[80]; /* name of the functions where failure occurs */ - intn status; /* generic return value */ + int status; /* generic return value */ /* D - Retrieve compression information of compressed images */ MESSAGE(8, printf("Verify the compression information of compressed images\n");); @@ -689,7 +685,7 @@ test_mgr_chunk_compress() /************************* Variable declaration **************************/ - intn status; /* status for functions returning an intn */ + int status; /* status for functions returning an int */ int32 file_id, /* HDF file identifier */ gr_id, /* GR interface identifier */ ri_id[N_IMAGES], /* raster image identifier */ @@ -704,7 +700,7 @@ test_mgr_chunk_compress() comp_coder_t comp_type; int16 data_out[3 * Y_LENGTH * X_LENGTH]; - char *image_name[] = {"Image_NO", "Image_RL", "Image_Sk", "Image_DF"}; + const char *image_name[] = {"Image_NO", "Image_RL", "Image_Sk", "Image_DF"}; HDF_CHUNK_DEF chunk_def[N_IMAGES]; int16 chunk_buf[18]; @@ -879,7 +875,7 @@ test_mgr_chunk_compress() MESSAGE(3, printf("Error in reading chunk at line %d\n", __LINE__);); MESSAGE(3, printf("Image #%d\n", (int)img_num);); num_errs++; - } /* end if */ + } /* Read the whole image. */ start[0] = start[1] = 0; @@ -892,7 +888,7 @@ test_mgr_chunk_compress() MESSAGE(3, printf("%d: Error reading data for the whole image\n", __LINE__);); MESSAGE(3, printf("%d: Compression method\n", (int)img_num);); num_errs++; - } /* end if */ + } status = GRendaccess(ri_id[img_num]); CHECK(status, FAIL, "GRendaccess"); diff --git a/hdf/test/tszip.c b/hdf/test/tszip.c index 1caeeb5ff7..bc2a03f1ed 100644 --- a/hdf/test/tszip.c +++ b/hdf/test/tszip.c @@ -134,7 +134,7 @@ test_szip_RI8bit() /********************** End of variable declaration **********************/ HCget_config_info(COMP_CODE_SZIP, &comp_config); - CHECK_VOID((comp_config & COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED), 0, + CHECK_VOID(((comp_config & COMP_DECODER_ENABLED) && (comp_config & COMP_ENCODER_ENABLED)), 0, "SZIP Compression not available"); /* Create and open the file for sziped data */ @@ -347,7 +347,7 @@ test_szip_RI16bit() /********************** End of variable declaration **********************/ HCget_config_info(COMP_CODE_SZIP, &comp_config); - CHECK_VOID((comp_config & COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED), 0, + CHECK_VOID(((comp_config & COMP_DECODER_ENABLED) && (comp_config & COMP_ENCODER_ENABLED)), 0, "SZIP Compression not available"); /* Create and open the file for sziped data */ @@ -560,7 +560,7 @@ test_szip_RI32bit() /********************** End of variable declaration **********************/ HCget_config_info(COMP_CODE_SZIP, &comp_config); - CHECK_VOID((comp_config & COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED), 0, + CHECK_VOID(((comp_config & COMP_DECODER_ENABLED) && (comp_config & COMP_ENCODER_ENABLED)), 0, "SZIP Compression not available"); /* Create and open the file for sziped data */ @@ -773,7 +773,7 @@ test_szip_RIfl32bit() /********************** End of variable declaration **********************/ HCget_config_info(COMP_CODE_SZIP, &comp_config); - CHECK_VOID((comp_config & COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED), 0, + CHECK_VOID(((comp_config & COMP_DECODER_ENABLED) && (comp_config & COMP_ENCODER_ENABLED)), 0, "SZIP Compression not available"); /* Create and open the file for sziped data */ @@ -987,7 +987,7 @@ test_szip_RIfl64bit() /********************** End of variable declaration **********************/ HCget_config_info(COMP_CODE_SZIP, &comp_config); - CHECK_VOID((comp_config & COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED), 0, + CHECK_VOID(((comp_config & COMP_DECODER_ENABLED) && (comp_config & COMP_ENCODER_ENABLED)), 0, "SZIP Compression not available"); /* Create and open the file for sziped data */ @@ -1144,7 +1144,7 @@ test_szip_chunk() uint32 comp_config; comp_coder_t comp_type; int8 data_out[N_COMPS * LENGTH_CH * WIDTH_CH]; - char *image_name = "Image_chunked_sziped"; + const char *image_name = "Image_chunked_sziped"; HDF_CHUNK_DEF chunk_def; int8 chunk_buf[18]; @@ -1169,7 +1169,7 @@ test_szip_chunk() /********************** End of variable declaration **********************/ HCget_config_info(COMP_CODE_SZIP, &comp_config); - CHECK_VOID((comp_config & COMP_DECODER_ENABLED | COMP_ENCODER_ENABLED), 0, + CHECK_VOID(((comp_config & COMP_DECODER_ENABLED) && (comp_config & COMP_ENCODER_ENABLED)), 0, "SZIP Compression not available"); /* Create and open the file for chunked and sziped data. */ diff --git a/hdf/util/he_file.c b/hdf/util/he_file.c index 2e734c5e3f..5bf8b55dc7 100644 --- a/hdf/util/he_file.c +++ b/hdf/util/he_file.c @@ -486,10 +486,10 @@ put(char *template, int verbose) int HEputR8(HE_CMD *cmd) { - int i; - int verbose = NO; - char *image = "img#.@.%"; - char *pal = "pal#"; + int i; + int verbose = NO; + const char *image = "img#.@.%"; + const char *pal = "pal#"; for (i = 1; i < cmd->argc; i++) if (cmd->argv[i][0] == '-') diff --git a/mfhdf/dumper/hdp_list.c b/mfhdf/dumper/hdp_list.c index b0a5e2f15c..6735b71e3b 100644 --- a/mfhdf/dumper/hdp_list.c +++ b/mfhdf/dumper/hdp_list.c @@ -202,16 +202,16 @@ print_list_header(list_info_t *list_opts) intn print_annots_by_object(const char *fname, int32 an_id, ann_type annot_type, uint16 tag, uint16 ref) { - intn i; - char *buf = NULL; - int32 ann_num; - int32 ann_length; - int32 ann_id = FAIL; - int32 *ann_list = NULL; - char *annot_type_text = "invalid"; /* "label" or "description" */ - char *func_name = "print_annots_by_object"; /* used to print error msg */ - char error_item[256]; /* holds tag, ref, and fname for error msg */ - intn ret_value = SUCCEED; + intn i; + char *buf = NULL; + int32 ann_num; + int32 ann_length; + int32 ann_id = FAIL; + int32 *ann_list = NULL; + const char *annot_type_text = "invalid"; /* "label" or "description" */ + const char *func_name = "print_annots_by_object"; /* used to print error msg */ + char error_item[256]; /* holds tag, ref, and fname for error msg */ + intn ret_value = SUCCEED; /* stores the current values tag, ref, and file name in error_item, just to simplify the error printing statement */ @@ -327,13 +327,13 @@ print_all_file_labels, and print_all_file_descs for the common code. */ intn print_annots_in_file(int32 an_id, const char *fname, int32 n_annotations, ann_type annot_type) { - intn i; - int32 len; - char *annotation = NULL; - char *func_name = "print_annots_in_file"; - int32 ann_id = FAIL; - char *annot_type_text = "invalid"; /* "label" or "description" */ - intn ret_value = SUCCEED; + intn i; + int32 len; + char *annotation = NULL; + const char *func_name = "print_annots_in_file"; + int32 ann_id = FAIL; + const char *annot_type_text = "invalid"; /* "label" or "description" */ + intn ret_value = SUCCEED; /* validate annotation type before processing */ if (annot_type == AN_DATA_LABEL) diff --git a/mfhdf/hdiff/hdiff_misc.c b/mfhdf/hdiff/hdiff_misc.c index c419872e4f..dd48d1ddf9 100644 --- a/mfhdf/hdiff/hdiff_misc.c +++ b/mfhdf/hdiff/hdiff_misc.c @@ -123,8 +123,8 @@ pr_att_vals(nc_type type, int len, void *vals) char *sp; unsigned char uc; char gps[30]; /* for ascii of a float or double precision */ - char *f_fmt = "%#.8g"; - char *d_fmt = "%#.16g"; + const char *f_fmt = "%#.8g"; + const char *d_fmt = "%#.16g"; switch (type) { case DFNT_INT8: diff --git a/mfhdf/hrepack/hrepack_gr.c b/mfhdf/hrepack/hrepack_gr.c index 321e729f8d..11579f2b48 100644 --- a/mfhdf/hrepack/hrepack_gr.c +++ b/mfhdf/hrepack/hrepack_gr.c @@ -82,10 +82,10 @@ copy_gr(int32 infile_id, int32 outfile_id, int32 gr_in, int32 gr_out, int32 tag, eltsz, /* element size */ nelms, /* number of elements */ data_size; - void *buf = NULL; - uint8 pal_data[256 * 3]; - int can_compress = 1; /* flag to tell if a compression is supported */ - char *pal_path = "palette"; + void *buf = NULL; + uint8 pal_data[256 * 3]; + int can_compress = 1; /* flag to tell if a compression is supported */ + const char *pal_path = "palette"; ri_index = GRreftoindex(gr_in, (uint16)ref); ri_id = GRselect(gr_in, ri_index); diff --git a/mfhdf/libsrc/mfsd.c b/mfhdf/libsrc/mfsd.c index efa7cc5be1..033abd0b5e 100644 --- a/mfhdf/libsrc/mfsd.c +++ b/mfhdf/libsrc/mfsd.c @@ -2959,9 +2959,8 @@ SDgetdimstrs(int32 id, /* IN: dataset ID */ NC_dim *dim = NULL; NC_attr **attr = NULL; char *name = NULL; - int32 ii; int32 namelen; - intn ret_value = SUCCEED; + int ret_value = SUCCEED; /* clear error stack */ HEclear(); @@ -2990,10 +2989,10 @@ SDgetdimstrs(int32 id, /* IN: dataset ID */ name = dim->name->values; namelen = strlen(name); dp = (NC_var **)handle->vars->values; - for (ii = 0; ii < handle->vars->count; ii++, dp++) { + for (int i = 0; i < handle->vars->count; i++, dp++) { /* eliminate vars with rank > 1, coord vars only have rank 1 */ - if ((*dp)->assoc->count == 1) - if (namelen == (*dp)->name->len && strncmp(name, (*dp)->name->values, strlen(name)) == 0) + if ((*dp)->assoc->count == 1) { + if (namelen == (*dp)->name->len && strncmp(name, (*dp)->name->values, strlen(name)) == 0) { /* because a dim was given, make sure that this is a coord var */ /* if it is an SDS, the function will fail */ if ((*dp)->var_type == IS_SDSVAR) { @@ -3008,6 +3007,8 @@ SDgetdimstrs(int32 id, /* IN: dataset ID */ { var = (*dp); } + } + } } } @@ -3555,14 +3556,13 @@ SDsetnbitdataset(int32 id, /* IN: dataset ID */ intn SDsetup_szip_parms(int32 id, NC *handle, comp_info *c_info, int32 *cdims) { - NC_dim *dim; /* to check if the dimension is unlimited */ - int32 dimindex; /* to obtain the NC_dim record */ + NC_dim *dim = NULL; /* to check if the dimension is unlimited */ + int32 dimindex; /* to obtain the NC_dim record */ NC_var *var = NULL; int32 ndims; - int i; int32 xdims[H4_MAX_VAR_DIMS]; int32 nt; - intn ret_value = SUCCEED; + int ret_value = SUCCEED; /* clear error stack */ HEclear(); @@ -3577,9 +3577,11 @@ SDsetup_szip_parms(int32 id, NC *handle, comp_info *c_info, int32 *cdims) } ndims = var->assoc->count; - for (i = 0; i < ndims; i++) { + for (int i = 0; i < ndims; i++) { dimindex = var->assoc->values[i]; dim = SDIget_dim(handle, dimindex); + if (dim == NULL) + HGOTO_ERROR(DFE_ARGS, FAIL); xdims[i] = dim->size; } @@ -3588,7 +3590,7 @@ SDsetup_szip_parms(int32 id, NC *handle, comp_info *c_info, int32 *cdims) ret_value = HCPsetup_szip_parms(c_info, nt, 1, ndims, xdims, cdims); done: - return (ret_value); + return ret_value; } #endif /****************************************************************************** diff --git a/mfhdf/libsrc/putget.c b/mfhdf/libsrc/putget.c index d2db533d65..992bddbccd 100644 --- a/mfhdf/libsrc/putget.c +++ b/mfhdf/libsrc/putget.c @@ -1824,7 +1824,7 @@ NC_fill_buffer(NC *handle, int varid, const long *edges, void *values) /* Find user-defined fill-value and fill the buffer with it */ attr = NC_findattr(&vp->attrs, _FillValue); - if (attr != NULL) + if (attr != NULL) { if (HDmemfill(values, (*attr)->data->values, vp->szof, buf_size) == NULL) { return -1; } @@ -1832,6 +1832,8 @@ NC_fill_buffer(NC *handle, int varid, const long *edges, void *values) else { NC_arrayfill(values, buf_size * vp->szof, vp->type); } + } + return 0; } diff --git a/mfhdf/ncdump/vardata.c b/mfhdf/ncdump/vardata.c index c620a00408..6bb157be4d 100644 --- a/mfhdf/ncdump/vardata.c +++ b/mfhdf/ncdump/vardata.c @@ -262,6 +262,10 @@ annotate(struct ncvar *vp, struct fspec *fsp, long cor[], long iel) printf(",%d", (int)(1 + cor[id])); } break; + case LANG_NONE: + default: + /* Might want to make this an error */ + break; } printf(")\n "); } @@ -565,6 +569,10 @@ vardata(struct ncvar *vp, long vdims[], int ncid, int varid, struct fspec *fsp) printf(",%d", (int)(1 + cor[id])); } break; + case LANG_NONE: + default: + /* Might want to make this an error */ + break; } printf(")\n "); set_indent(4); diff --git a/mfhdf/test/tncunlim.c b/mfhdf/test/tncunlim.c index 206f661dbc..627cf225d7 100644 --- a/mfhdf/test/tncunlim.c +++ b/mfhdf/test/tncunlim.c @@ -141,7 +141,7 @@ test_1dim_singlevar() long start[] = {0}; long edges[1]; edges[0] = dimsize; - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -174,7 +174,7 @@ test_1dim_singlevar() long start[] = {0}; long edges[1]; edges[0] = dimsize; - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -404,7 +404,7 @@ test_1dim_multivars() long start[] = {0}; long edges[1]; edges[0] = dimsize; - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); /* Read and verify data of Variable 1 */ status = ncvarget(ncid, varid1, start, edges, outdata); @@ -421,7 +421,7 @@ test_1dim_multivars() /* Read and verify data of Variable 2 */ edges[0] = 2; /* only reading what written to this variable so far */ - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid2, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -437,7 +437,7 @@ test_1dim_multivars() /* Try to read again but up to the max number of records, 4 in this case because the other variable in the file has 4 elements written */ edges[0] = dimsize; - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid2, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -482,7 +482,7 @@ test_1dim_multivars() /* Read and verify data of Variable 1 */ /* read data should be: 300 301 302 303 400 401 */ - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid1, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -497,7 +497,7 @@ test_1dim_multivars() /* Read and verify data of Variable 2 */ /* read data should be: 102 104 -2 -2 -2 -2 */ edges[0] = 2; - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid2, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -534,7 +534,7 @@ test_1dim_multivars() /* Read and verify data of Variable 1 */ /* read data should be: 300 301 302 303 400 401 -1 */ - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid1, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -548,7 +548,7 @@ test_1dim_multivars() /* Read and verify data of Variable 1 */ /* read data should be: 102 104 -2 -2 200 201 202 */ - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid2, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -588,7 +588,7 @@ test_1dim_multivars() /* Read and verify data of Variable 1; read data should be: */ /* 300 301 302 303 400 401 -1 -1 -1 -1 -1 -1 500 501 502 */ - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid1, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -602,7 +602,7 @@ test_1dim_multivars() /* Read and verify data of Variable 2; read data should be: */ /* 102 104 -2 -2 200 201 202 -2 -2 -2 -2 -2 -2 -2 -2 */ - memset(outdata, 0, DIM0); + memset(outdata, 0, DIM0 * sizeof(short)); status = ncvarget(ncid, varid2, start, edges, outdata); CHECK(status, -1, "ncvarget"); @@ -615,7 +615,7 @@ test_1dim_multivars() } } /* end read data */ -#if NOTRUN +#if 0 /* The following test is to verify that attempting to read pass the maximum number of records in the file will fail. However, because ncvarget leads to the internal function NCcoordck which uses NCadvise to display the From 07cbe194006dc27e04c0fe570dafeeef6ce1d822 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 20 Feb 2024 13:20:43 -0800 Subject: [PATCH 60/65] Error early on CMake when Java is built w/o shared (#571) --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 06a2683142..e396e361b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -571,9 +571,13 @@ add_subdirectory (mfhdf) # Option to build HDF4 Java Library #----------------------------------------------------------------------------- if (EXISTS "${HDF4_SOURCE_DIR}/java" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/java") - option (HDF4_BUILD_JAVA "Build Java HDF Library" OFF) + option (HDF4_BUILD_JAVA "Build Java HDF Library" OFF) if (HDF4_BUILD_JAVA) - add_subdirectory (java) + if (NOT BUILD_SHARED_LIBS) + message (FATAL_ERROR "\nJava requires shared libraries!\n") + else () + add_subdirectory (java) + endif () endif () endif () From e8d455c2bf41dfee9eb3dc38a11dc2508be25c8b Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 20 Feb 2024 23:03:47 -0800 Subject: [PATCH 61/65] Moves internal error macros to herr_priv.h (#572) These are undocumented, internal, and not for outside use. If these are public, we won't be able to refactor the library's error handling. --- hdf/src/CMakeLists.txt | 1 + hdf/src/hdfi.h | 6 +- hdf/src/herr.h | 120 ++++----------------------------------- hdf/src/herr_priv.h | 125 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 141 insertions(+), 111 deletions(-) create mode 100644 hdf/src/herr_priv.h diff --git a/hdf/src/CMakeLists.txt b/hdf/src/CMakeLists.txt index e10b337a45..6899eb3b9e 100644 --- a/hdf/src/CMakeLists.txt +++ b/hdf/src/CMakeLists.txt @@ -102,6 +102,7 @@ set (HDF4_PRIVATE_HDF_SRC_CHDRS ${HDF4_HDF_SRC_SOURCE_DIR}/hcompi.h ${HDF4_HDF_SRC_SOURCE_DIR}/hconv.h ${HDF4_HDF_SRC_SOURCE_DIR}/hdfi.h + ${HDF4_HDF_SRC_SOURCE_DIR}/herr_priv.h ${HDF4_HDF_SRC_SOURCE_DIR}/hfile.h ${HDF4_HDF_SRC_SOURCE_DIR}/hkit.h ${HDF4_HDF_SRC_SOURCE_DIR}/hqueue.h diff --git a/hdf/src/hdfi.h b/hdf/src/hdfi.h index f5b6df2ffa..d4afe68ad3 100644 --- a/hdf/src/hdfi.h +++ b/hdf/src/hdfi.h @@ -25,8 +25,6 @@ /* The library always uses UNIXBUFIO */ #define FILELIB UNIXBUFIO -#include "hdf.h" - /*--------------------------------------------------------------------------*/ /* MT/NT constants */ /* Four MT nibbles represent double, float, int, uchar (from most */ @@ -70,6 +68,10 @@ #define DF_MT DFMT_LE #endif +/* Common library headers */ +#include "hdf.h" +#include "herr_priv.h" + /* Standard C library headers */ #include #include diff --git a/hdf/src/herr.h b/hdf/src/herr.h index 4f6d8bf7b9..a61304a39c 100644 --- a/hdf/src/herr.h +++ b/hdf/src/herr.h @@ -11,123 +11,25 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/*+ herr.h - *** header file for using error routines - *** to be included by all ".c" files - + */ +/* herr.h + * + * Error routines + */ #ifndef H4_HERR_H #define H4_HERR_H #include "hdf.h" -/* HERROR macro, used to facilitate error reporting */ -#define HERROR(e) HEpush(e, __func__, __FILE__, __LINE__) - -/* HRETURN_ERROR macro, used to facilitate error reporting. Makes - same assumptions as HERROR. IN ADDITION, this macro causes - a return from the calling routine */ - -#define HRETURN_ERROR(err, ret_val) \ - do { \ - HERROR(err); \ - return (ret_val); \ - } while (0) - -/* HCLOSE_RETURN_ERROR macro, used to facilitate error reporting. Makes - same assumptions as HRETURN_ERROR. IN ADDITION, this macro causes - the file specified by the id "fid" to be closed */ - -#define HCLOSE_RETURN_ERROR(hfid, err, ret_val) \ - do { \ - HERROR(err); \ - Hclose(hfid); \ - return (ret_val); \ - } while (0) - -/* HGOTO_ERROR macro, used to facilitate error reporting. Makes - same assumptions as HERROR. IN ADDITION, this macro causes - a jump to the label 'done' which should be in every function - Also there is an assumption of a variable 'ret_value' */ - -#define HGOTO_ERROR(err, ret_val) \ - do { \ - HERROR(err); \ - ret_value = ret_val; \ - goto done; \ - } while (0) - -/* HGOTO_FAIL macro, used to facilitate error reporting. This one - is added in 2019 to tidy the code. It is similar to HGOTO_ERROR, - except it does not call HERROR. This is to preserve the exact - behavior as the original code. */ - -#define HGOTO_FAIL(ret_val) \ - do { \ - ret_value = ret_val; \ - goto done; \ - } while (0) - -/* HCLOSE_RETURN_ERROR macro, used to facilitate error reporting. Makes - same assumptions as HRETURN_ERROR. IN ADDITION, this macro causes - the file specified by the id "fid" to be closed - Also , this macro causes a jump to the label 'done' which should - be in every function. There is an assumption of a variable 'ret_value' */ - -#define HCLOSE_GOTO_ERROR(hfid, err, ret_val) \ - do { \ - HERROR(err); \ - Hclose(hfid); \ - ret_value = ret_val; \ - goto done; \ - } while (0) - -/* HGOTO_DONE macro, used to facilitate the new error reporting model. - This macro is just a wrapper to set the return value and jump to the 'done' - label. Also assumption of a variable 'ret_value' */ - -#define HGOTO_DONE(ret_val) \ - do { \ - ret_value = ret_val; \ - goto done; \ - } while (0) - -/* For further error reporting */ -#define HE_REPORT(msg) HEreport(msg) -#define HE_REPORT_RETURN(msg, ret_val) \ - do { \ - HEreport(msg); \ - return (ret_val); \ - } while (0) -#define HE_CLOSE_REPORT_RETURN(hfid, msg, ret_val) \ - do { \ - HEreport(msg); \ - Hclose(hfid); \ - return (ret_val); \ - } while (0) - -#define HE_REPORT_GOTO(msg, ret_val) \ - do { \ - HEreport(msg); \ - ret_value = ret_val; \ - goto done; \ - } while (0) -#define HE_CLOSE_REPORT_GOTO(hfid, msg, ret_val) \ - do { \ - HEreport(msg); \ - Hclose(hfid); \ - ret_value = ret_val; \ - goto done; \ - } while (0) - /* - ====================================================================== - Error codes - - NOTE: Remember to update the error_messages[] structure in herr.c - whenever errors are added/deleted from this list. - ====================================================================== + * ====================================================================== + * Error codes + * + * NOTE: Remember to update the error_messages[] structure in herr.c + * whenever errors are added/deleted from this list. + * ====================================================================== */ + /* Declare an enumerated type which holds all the valid HDF error codes */ typedef enum { DFE_NONE = 0, /* special zero, no error */ diff --git a/hdf/src/herr_priv.h b/hdf/src/herr_priv.h new file mode 100644 index 0000000000..5993982a26 --- /dev/null +++ b/hdf/src/herr_priv.h @@ -0,0 +1,125 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF. The full HDF copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* herr_priv.h + * + * Error routines (private) + */ + +#ifndef H4_HERR_PRIV_H +#define H4_HERR_PRIV_H + +#include "hproto.h" + +/* HERROR macro, used to facilitate error reporting */ +#define HERROR(e) HEpush(e, __func__, __FILE__, __LINE__) + +/* HRETURN_ERROR macro, used to facilitate error reporting. Makes + * same assumptions as HERROR. IN ADDITION, this macro causes + * a return from the calling routine + */ + +#define HRETURN_ERROR(err, ret_val) \ + do { \ + HERROR(err); \ + return (ret_val); \ + } while (0) + +/* HGOTO_ERROR macro, used to facilitate error reporting. Makes + * same assumptions as HERROR. IN ADDITION, this macro causes + * a jump to the label 'done' which should be in every function + * Also there is an assumption of a variable 'ret_value' + */ + +#define HGOTO_ERROR(err, ret_val) \ + do { \ + HERROR(err); \ + ret_value = ret_val; \ + goto done; \ + } while (0) + +/* HGOTO_FAIL macro, used to facilitate error reporting. This one + * is added in 2019 to tidy the code. It is similar to HGOTO_ERROR, + * except it does not call HERROR. This is to preserve the exact + * behavior as the original code. + */ + +#define HGOTO_FAIL(ret_val) \ + do { \ + ret_value = ret_val; \ + goto done; \ + } while (0) + +/* HCLOSE_GOTO_ERROR macro, used to facilitate error reporting. Makes + * same assumptions as HRETURN_ERROR. IN ADDITION, this macro causes + * the file specified by the id "fid" to be closed + * Also , this macro causes a jump to the label 'done' which should + * be in every function. There is an assumption of a variable 'ret_value' + */ + +/* TODO: Refactor this out of library and simply close hfid in the `done` target */ + +#define HCLOSE_GOTO_ERROR(hfid, err, ret_val) \ + do { \ + HERROR(err); \ + Hclose(hfid); \ + ret_value = ret_val; \ + goto done; \ + } while (0) + +/* HGOTO_DONE macro, used to facilitate the new error reporting model. + * This macro is just a wrapper to set the return value and jump to the 'done' + * label. Also assumption of a variable 'ret_value' + */ + +#define HGOTO_DONE(ret_val) \ + do { \ + ret_value = ret_val; \ + goto done; \ + } while (0) + +/*******************************/ +/* For further error reporting */ +/*******************************/ + +#define HE_REPORT(msg) HEreport(msg) + +#define HE_REPORT_RETURN(msg, ret_val) \ + do { \ + HEreport(msg); \ + return (ret_val); \ + } while (0) + +#define HE_CLOSE_REPORT_RETURN(hfid, msg, ret_val) \ + do { \ + HEreport(msg); \ + Hclose(hfid); \ + return (ret_val); \ + } while (0) + +#define HE_REPORT_GOTO(msg, ret_val) \ + do { \ + HEreport(msg); \ + ret_value = ret_val; \ + goto done; \ + } while (0) + +#define HE_CLOSE_REPORT_GOTO(hfid, msg, ret_val) \ + do { \ + HEreport(msg); \ + Hclose(hfid); \ + ret_value = ret_val; \ + goto done; \ + } while (0) + +#endif /* H4_HERR_PRIV_H */ From 661476bc48a36587930c5ca3c0df13981afe0999 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 21 Feb 2024 05:41:20 -0800 Subject: [PATCH 62/65] Remove ncgen strtol hack (#574) strtol() is C89 --- mfhdf/ncgen/ncgen.l | 1 - mfhdf/ncgen/ncgenyy.c | 1 - 2 files changed, 2 deletions(-) diff --git a/mfhdf/ncgen/ncgen.l b/mfhdf/ncgen/ncgen.l index c9bdd472ad..2a56dbd443 100644 --- a/mfhdf/ncgen/ncgen.l +++ b/mfhdf/ncgen/ncgen.l @@ -7,7 +7,6 @@ /* lex specification for tokens for ncgen */ char errstr[100]; /* for short error messages */ -extern long strtol(); void expand_escapes(); #include diff --git a/mfhdf/ncgen/ncgenyy.c b/mfhdf/ncgen/ncgenyy.c index 7c5537e99a..8e12bd4a5e 100644 --- a/mfhdf/ncgen/ncgenyy.c +++ b/mfhdf/ncgen/ncgenyy.c @@ -642,7 +642,6 @@ char *yytext; /* lex specification for tokens for ncgen */ char errstr[100]; /* for short error messages */ -extern long strtol(); void expand_escapes(); #include From ec211cddbeb8c5bebe7404254a42cc6d686daa6f Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 21 Feb 2024 05:41:45 -0800 Subject: [PATCH 63/65] Rename private headers _priv.h (#573) * Rename private library headers to _priv.h This will make it easy to distinguish what is private and what is public. Also: * Removed unused hdf/src/src.inc and mfhdf/fortran/common.inc files * Removed mfhdfi.h after moving the enum it contained to mfhdf.h --- CMakeLists.txt | 4 +- bin/h4_release_check.sh | 11 +- bin/h4vers | 16 +-- hdf/src/CMakeLists.txt | 63 +++++----- hdf/src/Makefile.am | 2 +- hdf/src/atom.c | 6 +- hdf/src/{atom.h => atom_priv.h} | 15 +-- hdf/src/bitvect.c | 4 +- hdf/src/{bitvect.h => bitvect_priv.h} | 10 +- hdf/src/cdeflate.c | 16 +-- hdf/src/{cdeflate.h => cdeflate_priv.h} | 12 +- hdf/src/cnbit.c | 13 +- hdf/src/{cnbit.h => cnbit_priv.h} | 12 +- hdf/src/cnone.c | 12 +- hdf/src/{cnone.h => cnone_priv.h} | 12 +- hdf/src/crle.c | 13 +- hdf/src/{crle.h => crle_priv.h} | 14 +-- hdf/src/cskphuff.c | 13 +- hdf/src/{cskphuff.h => cskphuff_priv.h} | 12 +- hdf/src/cszip.c | 4 +- hdf/src/{cszip.h => cszip_priv.h} | 12 +- hdf/src/df24.c | 4 +- hdf/src/df24f.c | 4 +- hdf/src/{df.h => df_priv.h} | 15 +-- hdf/src/dfan.c | 4 +- hdf/src/{dfan.h => dfan_priv.h} | 12 +- hdf/src/dfanf.c | 6 +- hdf/src/dfcomp.c | 2 +- hdf/src/dfconv.c | 4 +- hdf/src/dff.c | 4 +- hdf/src/dfgr.c | 6 +- hdf/src/{dfgr.h => dfgr_priv.h} | 13 +- hdf/src/dfgroup.c | 4 +- hdf/src/dfimcomp.c | 2 +- hdf/src/dfjpeg.c | 2 +- hdf/src/dfknat.c | 6 +- hdf/src/dfkswap.c | 6 +- hdf/src/dfp.c | 2 +- hdf/src/dfpf.c | 2 +- hdf/src/dfr8.c | 6 +- hdf/src/dfr8f.c | 2 +- hdf/src/{dfrig.h => dfrig_priv.h} | 13 +- hdf/src/dfrle.c | 2 +- hdf/src/dfsd.c | 8 +- hdf/src/{dfsd.h => dfsd_priv.h} | 10 +- hdf/src/dfsdf.c | 4 +- hdf/src/dfstubs.c | 4 +- hdf/src/dfufp2i.c | 6 +- hdf/src/{dfufp2i.h => dfufp2i_priv.h} | 10 +- hdf/src/dfufp2if.c | 6 +- hdf/src/dfunjpeg.c | 2 +- hdf/src/dfutil.c | 2 +- hdf/src/dfutilf.c | 2 +- hdf/src/dynarray.c | 4 +- hdf/src/{dynarray.h => dynarray_priv.h} | 10 +- hdf/src/glist.c | 4 +- hdf/src/{glist.h => glist_priv.h} | 8 +- hdf/src/hbitio.c | 4 +- hdf/src/hblocks.c | 4 +- hdf/src/hbuffer.c | 4 +- hdf/src/hchunks.c | 14 +-- hdf/src/{hchunks.h => hchunks_priv.h} | 12 +- hdf/src/hcomp.c | 4 +- hdf/src/{hcompi.h => hcomp_priv.h} | 26 ++-- hdf/src/hcompri.c | 4 +- hdf/src/{hconv.h => hconv_priv.h} | 10 +- hdf/src/hdatainfo.c | 11 +- hdf/src/{hdfi.h => hdf_priv.h} | 6 +- hdf/src/hdfalloc.c | 2 +- hdf/src/herr.c | 2 +- hdf/src/herrf.c | 2 +- hdf/src/hextelt.c | 4 +- hdf/src/hfile.c | 12 +- hdf/src/{hfile.h => hfile_priv.h} | 34 +++--- hdf/src/hfiledd.c | 4 +- hdf/src/hfilef.c | 2 +- hdf/src/hkit.c | 4 +- hdf/src/{hkit.h => hkit_priv.h} | 17 +-- hdf/src/hlimits.h | 6 +- hdf/src/hproto_fortran.h | 4 +- hdf/src/{hqueue.h => hqueue_priv.h} | 8 +- hdf/src/linklist.c | 6 +- hdf/src/{linklist.h => linklist_priv.h} | 10 +- hdf/src/mcache.c | 6 +- hdf/src/{mcache.h => mcache_priv.h} | 12 +- hdf/src/mfan.c | 8 +- hdf/src/mfan.h | 2 +- hdf/src/{mfani.h => mfan_priv.h} | 10 +- hdf/src/mfanf.c | 2 +- hdf/src/mfgr.c | 5 +- hdf/src/{mfgri.h => mfgr_priv.h} | 14 +-- hdf/src/mfgrf.c | 2 +- hdf/src/mstdio.c | 10 +- hdf/src/{mstdio.h => mstdio_priv.h} | 10 +- hdf/src/src.inc | 136 --------------------- hdf/src/tbbt.c | 4 +- hdf/src/{tbbt.h => tbbt_priv.h} | 10 +- hdf/src/vattr.c | 4 +- hdf/src/vattrf.c | 4 +- hdf/src/vconv.c | 6 +- hdf/src/vg.c | 4 +- hdf/src/vg.h | 2 +- hdf/src/{vgint.h => vg_priv.h} | 16 +-- hdf/src/vgf.c | 4 +- hdf/src/vgp.c | 4 +- hdf/src/vhi.c | 4 +- hdf/src/vio.c | 4 +- hdf/src/vparse.c | 4 +- hdf/src/vrw.c | 4 +- hdf/src/vsfld.c | 4 +- hdf/test/buffer.c | 4 +- hdf/test/chunks.c | 4 +- hdf/test/comp.c | 17 +-- hdf/test/file1.c | 2 +- hdf/test/mgr.c | 2 +- hdf/test/tbv.c | 2 +- hdf/test/tproto.h | 2 +- hdf/test/tree.c | 17 +-- hdf/test/tutils.h | 2 +- hdf/test/tvnameclass.c | 2 +- hdf/test/tvset.c | 2 +- hdf/util/hdf2jpeg.c | 2 +- hdf/util/hdfls.c | 2 +- hdf/util/hdfpack.c | 7 +- hdf/util/he_main.c | 2 +- hdf/util/jpeg2hdf.c | 2 +- hdf/util/vshow.c | 3 +- java/src/jni/h4jni.h | 3 +- java/src/jni/hdfImp.c | 13 +- java/src/jni/hdfanImp.c | 14 ++- java/src/jni/hdfdfpalImp.c | 14 ++- java/src/jni/hdfdfuImp.c | 11 +- java/src/jni/hdfexceptionImp.c | 11 +- java/src/jni/hdfgrImp.c | 11 +- java/src/jni/hdfheImp.c | 12 +- java/src/jni/hdfhxImp.c | 11 +- java/src/jni/hdfnativeImp.c | 11 +- java/src/jni/hdfr24Imp.c | 11 +- java/src/jni/hdfr8Imp.c | 11 +- java/src/jni/hdfsdsImp.c | 11 +- java/src/jni/hdfstructsutil.c | 11 +- java/src/jni/hdfvdataImp.c | 11 +- java/src/jni/hdfvfImp.c | 11 +- java/src/jni/hdfvgroupImp.c | 11 +- java/src/jni/hdfvhImp.c | 11 +- java/src/jni/hdfvqImp.c | 11 +- java/src/jni/hdfvsqImp.c | 11 +- mfhdf/dumper/hdp.c | 5 +- mfhdf/dumper/hdp.h | 2 +- mfhdf/dumper/hdp_sds.c | 4 +- mfhdf/dumper/show.c | 3 +- mfhdf/fortran/CMakeLists.txt | 1 - mfhdf/fortran/common.inc | 147 ----------------------- mfhdf/fortran/jackets.c.in | 11 +- mfhdf/hdfimport/hdfimport.c | 2 +- mfhdf/hdiff/hdiff_array.c | 3 +- mfhdf/hdiff/hdiff_main.c | 2 +- mfhdf/hdiff/hdiff_vs.c | 2 +- mfhdf/hrepack/hrepack_main.c | 2 +- mfhdf/libsrc/CMakeLists.txt | 11 +- mfhdf/libsrc/Makefile.am | 6 +- mfhdf/libsrc/array.c | 2 +- mfhdf/libsrc/attr.c | 2 +- mfhdf/libsrc/cdf.c | 6 +- mfhdf/libsrc/dim.c | 2 +- mfhdf/libsrc/error.c | 2 +- mfhdf/libsrc/{error.h => error_priv.h} | 0 mfhdf/libsrc/file.c | 4 +- mfhdf/libsrc/globdef.c | 2 +- mfhdf/libsrc/h4_xdr.c | 6 +- mfhdf/libsrc/{h4_xdr.h => h4_xdr_priv.h} | 8 +- mfhdf/libsrc/hdfsds.c | 2 +- mfhdf/libsrc/iarray.c | 2 +- mfhdf/libsrc/{mfprivate.h => mf_priv.h} | 11 +- mfhdf/libsrc/mfdatainfo.c | 4 +- mfhdf/libsrc/mfhdf.h | 13 +- mfhdf/libsrc/mfhdfi.h | 25 ---- mfhdf/libsrc/mfsd.c | 6 +- mfhdf/libsrc/{local_nc.h => nc_priv.h} | 8 +- mfhdf/libsrc/nssdc.c | 4 +- mfhdf/libsrc/putget.c | 4 +- mfhdf/libsrc/putgetg.c | 2 +- mfhdf/libsrc/sharray.c | 2 +- mfhdf/libsrc/string.c | 2 +- mfhdf/libsrc/var.c | 2 +- mfhdf/ncdump/ncdump.c | 2 +- mfhdf/ncgen/ncgen.h | 2 +- mfhdf/test/tdatainfo.c | 2 +- mfhdf/test/texternal.c | 2 +- mfhdf/test/tfile.c | 2 +- mfhdf/test/tsd.c | 2 +- release_notes/RELEASE.txt | 1 - 192 files changed, 635 insertions(+), 983 deletions(-) rename hdf/src/{atom.h => atom_priv.h} (97%) rename hdf/src/{bitvect.h => bitvect_priv.h} (93%) rename hdf/src/{cdeflate.h => cdeflate_priv.h} (93%) rename hdf/src/{cnbit.h => cnbit_priv.h} (95%) rename hdf/src/{cnone.h => cnone_priv.h} (92%) rename hdf/src/{crle.h => crle_priv.h} (95%) rename hdf/src/{cskphuff.h => cskphuff_priv.h} (93%) rename hdf/src/{cszip.h => cszip_priv.h} (94%) rename hdf/src/{df.h => df_priv.h} (95%) rename hdf/src/{dfan.h => dfan_priv.h} (94%) rename hdf/src/{dfgr.h => dfgr_priv.h} (93%) rename hdf/src/{dfrig.h => dfrig_priv.h} (94%) rename hdf/src/{dfsd.h => dfsd_priv.h} (97%) rename hdf/src/{dfufp2i.h => dfufp2i_priv.h} (95%) rename hdf/src/{dynarray.h => dynarray_priv.h} (97%) rename hdf/src/{glist.h => glist_priv.h} (99%) rename hdf/src/{hchunks.h => hchunks_priv.h} (96%) rename hdf/src/{hcompi.h => hcomp_priv.h} (88%) rename hdf/src/{hconv.h => hconv_priv.h} (96%) rename hdf/src/{hdfi.h => hdf_priv.h} (99%) rename hdf/src/{hfile.h => hfile_priv.h} (98%) rename hdf/src/{hkit.h => hkit_priv.h} (97%) rename hdf/src/{hqueue.h => hqueue_priv.h} (98%) rename hdf/src/{linklist.h => linklist_priv.h} (98%) rename hdf/src/{mcache.h => mcache_priv.h} (97%) rename hdf/src/{mfani.h => mfan_priv.h} (95%) rename hdf/src/{mfgri.h => mfgr_priv.h} (97%) rename hdf/src/{mstdio.h => mstdio_priv.h} (94%) delete mode 100644 hdf/src/src.inc rename hdf/src/{tbbt.h => tbbt_priv.h} (97%) rename hdf/src/{vgint.h => vg_priv.h} (98%) delete mode 100644 mfhdf/fortran/common.inc rename mfhdf/libsrc/{error.h => error_priv.h} (100%) rename mfhdf/libsrc/{h4_xdr.h => h4_xdr_priv.h} (97%) rename mfhdf/libsrc/{mfprivate.h => mf_priv.h} (93%) delete mode 100644 mfhdf/libsrc/mfhdfi.h rename mfhdf/libsrc/{local_nc.h => nc_priv.h} (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index e396e361b0..b4415cb25e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -232,9 +232,9 @@ set (HDF4_SRC_INCLUDE_DIRS ${HDF4_HDFSOURCE_DIR} ${HDF4_MFHDFSOURCE_DIR}) set (CMAKE_MODULE_PATH ${HDF_RESOURCES_DIR} ${CMAKE_MODULE_PATH}) #----------------------------------------------------------------------------- -# parse the full version number from hfile.h and include in H4_VERS_INFO +# parse the full version number from hfile_priv.h and include in H4_VERS_INFO #----------------------------------------------------------------------------- -file (READ ${HDF4_HDFSOURCE_DIR}/hfile.h _hfile_h_contents) +file (READ ${HDF4_HDFSOURCE_DIR}/hfile_priv.h _hfile_h_contents) string (REGEX REPLACE ".*#define[ \t]+LIBVER_MAJOR[ \t]+([0-9]*).*$" "\\1" H4_VERS_MAJOR ${_hfile_h_contents}) string (REGEX REPLACE ".*#define[ \t]+LIBVER_MINOR[ \t]+([0-9]*).*$" diff --git a/bin/h4_release_check.sh b/bin/h4_release_check.sh index df4e15f711..671350e4d2 100755 --- a/bin/h4_release_check.sh +++ b/bin/h4_release_check.sh @@ -83,12 +83,11 @@ fi # TESTING IF FILES EXISTS ######################### -include_file=(atom.h bitvect.h cdeflate.h cnbit.h cnone.h crle.h cskphuff.h cszip.h dfan.h -dffunc.f90 dffunc.inc dfgr.h df.h dfrig.h dfsd.h dfufp2i.h dynarray.h H4api_adpt.h -h4config.h hbitio.h hchunks.h hcomp.h hcompi.h hconv.h hdatainfo.h hdf2netcdf.h hdf.f90 -hdf.h hdfi.h hdf.inc herr.h hfile.h hkit.h hlimits.h hntdefs.h hproto_fortran.h hproto.h -htags.h linklist.h local_nc.h mfan.h mfani.h mfdatainfo.h mffunc.f90 mffunc.inc mfgr.h -mfgri.h mfhdf.h mfhdfi.h mstdio.h netcdf.f90 netcdf.h netcdf.inc tbbt.h vg.h) +include_file=( +dffunc.f90 dffunc.inc H4api_adpt.h h4config.h hbitio.h hcomp.h hdatainfo.h +hdf2netcdf.h hdf.f90 hdf.h hdf.inc herr.h hlimits.h hntdefs.h hproto_fortran.h hproto.h +htags.h mfan.h mfdatainfo.h mffunc.f90 mffunc.inc mfgr.h mfhdf.h netcdf.f90 netcdf.h +netcdf.inc vg.h) lib_file=(libdf.a libdf.la libhdf4.settings libjpeg.a libmfhdf.a libmfhdf.la libsz.a libz.a) diff --git a/bin/h4vers b/bin/h4vers index 15e9bba9d8..9f6b5d7a74 100755 --- a/bin/h4vers +++ b/bin/h4vers @@ -27,7 +27,7 @@ use strict; ### Purpose # Increments the hdf4 version number by changing the value of -# constants in the hdf/src/hfile.h file. The new version number is +# constants in the hdf/src/hfile_priv.h file. The new version number is # printed on the standard output. An alternate source file name can be # specified as an argument. In any case, the original file is saved # by appending a tilde `~' to the name. @@ -61,11 +61,11 @@ use strict; # and the annotation string is cleared. # # If a file is specified then that file is used instead of -# ./hfile.h or ./hdf/src/hfile.h. +# ./hfile_priv.h or ./hdf/src/hfile_priv.h. # # If the version number is changed (either `-s' or `-i' was used on # the command line) then the first line of the README.md and -# release_notes/RELEASE.txt two levels above the hfile.h file are also +# release_notes/RELEASE.txt two levels above the hfile_priv.h file are also # modified so it looks something like: This is hdf4-1.2.3-pre1 currently # under development. The AC_INIT macro in configure.in will also change # in this case to be something like: AC_INIT([HDF4], [hdf4-1.2.3-pre1], @@ -128,15 +128,15 @@ Usage: $prog [OPTS] [FILE] as \"version 1.1 release 0 (pre1)\" will be printed. FILE The name of the file that contains version information. This is - seldom necessary since files hfile.h, hdf/src/hfile.h, - src/hfile.h, and ../hdf/src/hfile.h are automatically checked. + seldom necessary since files hfile_priv.h, hdf/src/hfile_priv.h, + src/hfile_priv.h, and ../hdf/src/hfile_priv.h are automatically checked. EOF exit 1; } # Parse arguments my ($verbose, $set, $inc, $file, $rc); -my (@files) = ("hdf/src/hfile.h", "../hdf/src/hfile.h", "src/hfile.h", "hfile.h"); +my (@files) = ("hdf/src/hfile_priv.h", "../hdf/src/hfile_priv.h", "src/hfile_priv.h", "hfile_priv.h"); while ($_ = shift) { $_ eq "-s" && do { die "-s switch needs a version number\n" unless @ARGV; @@ -168,12 +168,12 @@ die "mutually exclusive options given\n" if $set && $inc; #print "file is $file.\n"; #print "File array is ", @files; -# Determine file to use as hfile.h, README.md, +# Determine file to use as hfile_priv.h, README.md, # release_notes/RELEASE.txt, configure.in, # and config/cmake/scripts/HDF4config.cmake. # The paths to README.md, release_notes/RELEASE.txt, configure.ac, # and config/cmake/scripts/HDF4config.cmake -# files are always from the directory two levels above hfile.h. +# files are always from the directory two levels above hfile_priv.h. unless ($file) { for (@files) { ($file=$_,last) if -f $_; diff --git a/hdf/src/CMakeLists.txt b/hdf/src/CMakeLists.txt index 6899eb3b9e..3f5aab6993 100644 --- a/hdf/src/CMakeLists.txt +++ b/hdf/src/CMakeLists.txt @@ -77,43 +77,44 @@ set (HDF4_HDF_SRC_CHDRS ${HDF4_HDF_SRC_SOURCE_DIR}/hntdefs.h ${HDF4_HDF_SRC_SOURCE_DIR}/hproto.h ${HDF4_HDF_SRC_SOURCE_DIR}/htags.h + ${HDF4_HDF_SRC_SOURCE_DIR}/mfan.h ${HDF4_HDF_SRC_SOURCE_DIR}/mfgr.h ${HDF4_HDF_SRC_SOURCE_DIR}/vg.h ) +# Internal headers end in _priv.h set (HDF4_PRIVATE_HDF_SRC_CHDRS - ${HDF4_HDF_SRC_SOURCE_DIR}/atom.h - ${HDF4_HDF_SRC_SOURCE_DIR}/bitvect.h - ${HDF4_HDF_SRC_SOURCE_DIR}/cdeflate.h - ${HDF4_HDF_SRC_SOURCE_DIR}/cnbit.h - ${HDF4_HDF_SRC_SOURCE_DIR}/cnone.h - ${HDF4_HDF_SRC_SOURCE_DIR}/crle.h - ${HDF4_HDF_SRC_SOURCE_DIR}/cskphuff.h - ${HDF4_HDF_SRC_SOURCE_DIR}/cszip.h - ${HDF4_HDF_SRC_SOURCE_DIR}/df.h - ${HDF4_HDF_SRC_SOURCE_DIR}/dfan.h - ${HDF4_HDF_SRC_SOURCE_DIR}/dfgr.h - ${HDF4_HDF_SRC_SOURCE_DIR}/dfrig.h - ${HDF4_HDF_SRC_SOURCE_DIR}/dfsd.h - ${HDF4_HDF_SRC_SOURCE_DIR}/dfufp2i.h - ${HDF4_HDF_SRC_SOURCE_DIR}/dynarray.h - ${HDF4_HDF_SRC_SOURCE_DIR}/glist.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hchunks.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hcompi.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hconv.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hdfi.h + ${HDF4_HDF_SRC_SOURCE_DIR}/atom_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/bitvect_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/cdeflate_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/cnbit_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/cnone_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/crle_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/cskphuff_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/cszip_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/df_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/dfan_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/dfgr_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/dfrig_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/dfsd_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/dfufp2i_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/dynarray_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/glist_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hchunks_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hcomp_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hconv_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hdf_priv.h ${HDF4_HDF_SRC_SOURCE_DIR}/herr_priv.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hfile.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hkit.h - ${HDF4_HDF_SRC_SOURCE_DIR}/hqueue.h - ${HDF4_HDF_SRC_SOURCE_DIR}/linklist.h - ${HDF4_HDF_SRC_SOURCE_DIR}/mcache.h - ${HDF4_HDF_SRC_SOURCE_DIR}/mfan.h - ${HDF4_HDF_SRC_SOURCE_DIR}/mfani.h - ${HDF4_HDF_SRC_SOURCE_DIR}/mfgri.h - ${HDF4_HDF_SRC_SOURCE_DIR}/mstdio.h - ${HDF4_HDF_SRC_SOURCE_DIR}/tbbt.h - ${HDF4_HDF_SRC_SOURCE_DIR}/vgint.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hfile_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hkit_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/hqueue_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/linklist_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/mcache_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/mfan_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/mfgr_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/mstdio_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/tbbt_priv.h + ${HDF4_HDF_SRC_SOURCE_DIR}/vg_priv.h ) if (BUILD_STATIC_LIBS) diff --git a/hdf/src/Makefile.am b/hdf/src/Makefile.am index c9cc6b7edf..063cf36714 100644 --- a/hdf/src/Makefile.am +++ b/hdf/src/Makefile.am @@ -21,7 +21,7 @@ CSOURCES = atom.c bitvect.c cdeflate.c cnbit.c cnone.c crle.c cskphuff.c \ vgp.c vhi.c vio.c vparse.c vrw.c vsfld.c CHEADERS = H4api_adpt.h h4config.h hbitio.h hcomp.h hdatainfo.h hdf.h \ - herr.h hlimits.h hntdefs.h hproto.h htags.h mfgr.h vg.h + herr.h hlimits.h hntdefs.h hproto.h htags.h mfan.h mfgr.h vg.h FHEADERS = dffunc.f90 hdf.f90 dffunc.inc hdf.inc diff --git a/hdf/src/atom.c b/hdf/src/atom.c index ac8c22b5aa..bb1fd502b5 100644 --- a/hdf/src/atom.c +++ b/hdf/src/atom.c @@ -23,7 +23,7 @@ DESIGN The groups are stored in an array of pointers to store each group in an element. Each "atomic group" node contains a link to a hash table to manage the atoms in each group. The allowed "atomic groups" are stored - in an enum (called group_t) in atom.h. + in an enum (called group_t) in atom_priv.h. BUGS/LIMITATIONS Can't iterate over the atoms in a group. @@ -46,8 +46,8 @@ EXPORTED ROUTINES HAshutdown - Terminate various static buffers. */ -#include "hdfi.h" -#include "atom.h" +#include "hdf_priv.h" +#include "atom_priv.h" /* # of bits to use for Group ID in each atom (change if MAXGROUP>16) */ #define GROUP_BITS 4 diff --git a/hdf/src/atom.h b/hdf/src/atom_priv.h similarity index 97% rename from hdf/src/atom.h rename to hdf/src/atom_priv.h index 042db4d636..aab31e8647 100644 --- a/hdf/src/atom.h +++ b/hdf/src/atom_priv.h @@ -12,19 +12,14 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: atom.h + * File: atom_priv.h * Purpose: header file for atom API - * Dependencies: - * Invokes: - * Contents: - * Structure definitions: - * Constant definitions: *---------------------------------------------------------------------------*/ -#ifndef H4_ATOM_H -#define H4_ATOM_H +#ifndef H4_ATOM_PRIV_H +#define H4_ATOM_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* Do swap using XOR operator. Ugly but fast... -QAK */ #define HAIswap_cache(i, j) \ @@ -208,4 +203,4 @@ HDFLIBAPI intn HAshutdown(void); } #endif -#endif /* H4_ATOM_H */ +#endif /* H4_ATOM_PRIV_H */ diff --git a/hdf/src/bitvect.c b/hdf/src/bitvect.c index 5ec9f592e6..afe81ecb19 100644 --- a/hdf/src/bitvect.c +++ b/hdf/src/bitvect.c @@ -36,8 +36,8 @@ DESIGN for finding 1 bits as that is not a use case in the HDF4 library. */ -#include "hdfi.h" -#include "bitvect.h" +#include "hdf_priv.h" +#include "bitvect_priv.h" /* Base type of the array used to store the bits */ typedef uint8 bv_base; diff --git a/hdf/src/bitvect.h b/hdf/src/bitvect_priv.h similarity index 93% rename from hdf/src/bitvect.h rename to hdf/src/bitvect_priv.h index b595c779f9..5a59092576 100644 --- a/hdf/src/bitvect.h +++ b/hdf/src/bitvect_priv.h @@ -12,14 +12,14 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: bitvect.h + * File: bitvect_priv.h * Purpose: header file for bit-vector API *---------------------------------------------------------------------------*/ -#ifndef H4_BITVECT_H -#define H4_BITVECT_H +#ifndef H4_BITVECT_PRIV_H +#define H4_BITVECT_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* Boolean values used */ typedef enum { BV_FALSE = 0, BV_TRUE = 1 } bv_bool; @@ -55,4 +55,4 @@ HDFLIBAPI int32 bv_find_next_zero(bv_ptr b); } #endif -#endif /* H4_BITVECT_H */ +#endif /* H4_BITVECT_PRIV_H */ diff --git a/hdf/src/cdeflate.c b/hdf/src/cdeflate.c index 659ad2fc89..9b91bcfda4 100644 --- a/hdf/src/cdeflate.c +++ b/hdf/src/cdeflate.c @@ -12,27 +12,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - FILE - cdeflate.c - HDF gzip 'deflate' encoding I/O routines + cdeflate.c - HDF gzip 'deflate' encoding I/O routines - REMARKS - - DESIGN - - EXPORTED ROUTINES None of these routines are designed to be called by other users except for the modeling layer of the compression routines. - - AUTHOR - Quincey Koziol */ /* General HDF includes */ -#include "hdfi.h" +#include "hdf_priv.h" /* HDF compression includes */ -#include "hcompi.h" /* Internal definitions for compression */ +#include "hcomp_priv.h" /* Internal definitions for compression */ /* Define the [default] size of the buffer to interact with the file */ #define DEFLATE_BUF_SIZE 4096 diff --git a/hdf/src/cdeflate.h b/hdf/src/cdeflate_priv.h similarity index 93% rename from hdf/src/cdeflate.h rename to hdf/src/cdeflate_priv.h index a9f8dd7beb..4cd339432a 100644 --- a/hdf/src/cdeflate.h +++ b/hdf/src/cdeflate_priv.h @@ -12,15 +12,15 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: cdeflate.h + * File: cdeflate_priv.h * Purpose: Header file for gzip 'deflate' encoding information. - * Dependencies: should only be included from hcompi.h + * Dependencies: should only be included from hcomp_priv.h *---------------------------------------------------------------------------*/ -#ifndef H4_CDEFLATE_H -#define H4_CDEFLATE_H +#ifndef H4_CDEFLATE_PRIV_H +#define H4_CDEFLATE_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* Get the gzip 'deflate' header */ #define intf zintf @@ -67,4 +67,4 @@ HDFLIBAPI intn HCPcdeflate_endaccess(accrec_t *access_rec); } #endif -#endif /* H4_CDEFLATE_H */ +#endif /* H4_CDEFLATE_PRIV_H */ diff --git a/hdf/src/cnbit.c b/hdf/src/cnbit.c index b1056f09e2..ce0b73e4a2 100644 --- a/hdf/src/cnbit.c +++ b/hdf/src/cnbit.c @@ -12,24 +12,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - FILE - cnbit.c - HDF N-bit encoding I/O routines + cnbit.c - HDF N-bit encoding I/O routines - REMARKS - - DESIGN - - EXPORTED ROUTINES None of these routines are designed to be called by other users except for the modeling layer of the compression routines. */ /* General HDF includes */ -#include "hdfi.h" +#include "hdf_priv.h" /* HDF compression includes */ -#include "hcompi.h" /* Internal definitions for compression */ +#include "hcomp_priv.h" /* Internal definitions for compression */ /* functions to perform N-bit encoding */ funclist_t cnbit_funcs = {HCPcnbit_stread, diff --git a/hdf/src/cnbit.h b/hdf/src/cnbit_priv.h similarity index 95% rename from hdf/src/cnbit.h rename to hdf/src/cnbit_priv.h index ca50cbe542..e66603f8ee 100644 --- a/hdf/src/cnbit.h +++ b/hdf/src/cnbit_priv.h @@ -12,15 +12,15 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: cnbit.h + * File: cnbit_priv.h * Purpose: Header file for N-bit encoding information. - * Dependencies: should only be included from hcompi.h + * Dependencies: should only be included from hcomp_priv.h *---------------------------------------------------------------------------*/ -#ifndef H4_CNBIT_H -#define H4_CNBIT_H +#ifndef H4_CNBIT_PRIV_H +#define H4_CNBIT_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* size of the N-bit buffer */ #define NBIT_BUF_SIZE (MAX_NT_SIZE * 64) @@ -80,4 +80,4 @@ HDFLIBAPI intn HCPcnbit_endaccess(accrec_t *access_rec); } #endif -#endif /* H4_CNBIT_H */ +#endif /* H4_CNBIT_PRIV_H */ diff --git a/hdf/src/cnone.c b/hdf/src/cnone.c index 9e94724f0a..0d30d9bc73 100644 --- a/hdf/src/cnone.c +++ b/hdf/src/cnone.c @@ -12,26 +12,20 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - FILE - cnone.c - HDF none encoding I/O routines + cnone.c - HDF none encoding I/O routines - REMARKS These routines are only included for completeness and are not actually expected to be used. - DESIGN - - EXPORTED ROUTINES None of these routines are designed to be called by other users except for the modeling layer of the compression routines. */ /* General HDF includes */ -#include "hdfi.h" +#include "hdf_priv.h" /* HDF compression includes */ -#include "hcompi.h" /* Internal definitions for compression */ +#include "hcomp_priv.h" /* Internal definitions for compression */ /* functions to perform run-length encoding */ funclist_t cnone_funcs = {HCPcnone_stread, diff --git a/hdf/src/cnone.h b/hdf/src/cnone_priv.h similarity index 92% rename from hdf/src/cnone.h rename to hdf/src/cnone_priv.h index 9b8167b9f3..489d89656d 100644 --- a/hdf/src/cnone.h +++ b/hdf/src/cnone_priv.h @@ -12,18 +12,18 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: cnone.h + * File: cnone_priv.h * Purpose: Header file for "none" encoding information. - * Dependencies: should only be included from hcompi.h + * Dependencies: should only be included from hcomp_priv.h * Invokes: none * Contents: Structures & definitions for "none" encoding. This header * should only be included in hcomp.c and cnone.c. *---------------------------------------------------------------------------*/ -#ifndef H4_CNONE_H -#define H4_CNONE_H +#ifndef H4_CNONE_PRIV_H +#define H4_CNONE_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* "none" [en|de]coding information */ typedef struct { @@ -60,4 +60,4 @@ HDFLIBAPI intn HCPcnone_endaccess(accrec_t *access_rec); } #endif -#endif /* H4_CNONE_H */ +#endif /* H4_CNONE_PRIV_H */ diff --git a/hdf/src/crle.c b/hdf/src/crle.c index e60e4a1e98..a18641084e 100644 --- a/hdf/src/crle.c +++ b/hdf/src/crle.c @@ -12,24 +12,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - FILE - crle.c - HDF run-length encoding I/O routines + crle.c - HDF run-length encoding I/O routines - REMARKS - - DESIGN - - EXPORTED ROUTINES None of these routines are designed to be called by other users except for the modeling layer of the compression routines. */ /* General HDF includes */ -#include "hdfi.h" +#include "hdf_priv.h" /* HDF compression includes */ -#include "hcompi.h" /* Internal definitions for compression */ +#include "hcomp_priv.h" /* Internal definitions for compression */ /* internal defines */ #define TMP_BUF_SIZE 8192 /* size of throw-away buffer */ diff --git a/hdf/src/crle.h b/hdf/src/crle_priv.h similarity index 95% rename from hdf/src/crle.h rename to hdf/src/crle_priv.h index 9d10832c50..a90fa6a708 100644 --- a/hdf/src/crle.h +++ b/hdf/src/crle_priv.h @@ -12,20 +12,18 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: crle.h + * File: crle_priv.h * Purpose: Header file for run-length encoding information. - * Dependencies: should only be included from hcompi.h + * Dependencies: should only be included from hcomp_priv.h * Invokes: none * Contents: Structures & definitions for run-length encoding. This header * should only be included in hcomp.c and crle.c. - * Structure definitions: - * Constant definitions: *---------------------------------------------------------------------------*/ -#ifndef H4_CRLE_H -#define H4_CRLE_H +#ifndef H4_CRLE_PRIV_H +#define H4_CRLE_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* size of the RLE buffer */ #define RLE_BUF_SIZE 128 @@ -103,4 +101,4 @@ HDFLIBAPI intn HCPcrle_endaccess(accrec_t *access_rec); } #endif -#endif /* H4_CRLE_H */ +#endif /* H4_CRLE_PRIV_H */ diff --git a/hdf/src/cskphuff.c b/hdf/src/cskphuff.c index 212c263b59..9d52595366 100644 --- a/hdf/src/cskphuff.c +++ b/hdf/src/cskphuff.c @@ -12,15 +12,8 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - FILE - cskphuff.c - HDF "skipping" huffman encoding I/O routines + cskphuff.c - HDF "skipping" huffman encoding I/O routines - REMARKS - - DESIGN - - EXPORTED ROUTINES None of these routines are designed to be called by other users except for the modeling layer of the compression routines. */ @@ -31,10 +24,10 @@ */ /* General HDF includes */ -#include "hdfi.h" +#include "hdf_priv.h" /* HDF compression includes */ -#include "hcompi.h" /* Internal definitions for compression */ +#include "hcomp_priv.h" /* Internal definitions for compression */ /* Internal Defines */ #define TMP_BUF_SIZE 8192 /* size of throw-away buffer */ diff --git a/hdf/src/cskphuff.h b/hdf/src/cskphuff_priv.h similarity index 93% rename from hdf/src/cskphuff.h rename to hdf/src/cskphuff_priv.h index 4040ad4716..b644b4acf0 100644 --- a/hdf/src/cskphuff.h +++ b/hdf/src/cskphuff_priv.h @@ -12,15 +12,15 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: cskphuff.h + * File: cskphuff_priv.h * Purpose: Header file for skipping huffman encoding information. - * Dependencies: should only be included from hcompi.h + * Dependencies: should only be included from hcomp_priv.h *---------------------------------------------------------------------------*/ -#ifndef H4_CSKPHUFF_H -#define H4_CSKPHUFF_H +#ifndef H4_CSKPHUFF_PRIV_H +#define H4_CSKPHUFF_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* The maximum source character code: */ #define SKPHUFF_MAX_CHAR 255 @@ -74,4 +74,4 @@ HDFLIBAPI intn HCPcskphuff_endaccess(accrec_t *access_rec); } #endif -#endif /* H4_CSKPHUFF_H */ +#endif /* H4_CSKPHUFF_PRIV_H */ diff --git a/hdf/src/cszip.c b/hdf/src/cszip.c index db1bdb6914..c3bb5296fc 100644 --- a/hdf/src/cszip.c +++ b/hdf/src/cszip.c @@ -13,14 +13,14 @@ /* General HDF includes */ -#include "hdfi.h" +#include "hdf_priv.h" #ifdef H4_HAVE_LIBSZ #include "szlib.h" #endif /* HDF compression includes */ -#include "hcompi.h" /* Internal definitions for compression */ +#include "hcomp_priv.h" /* Internal definitions for compression */ /* internal defines */ #define TMP_BUF_SIZE 8192 /* size of throw-away buffer */ diff --git a/hdf/src/cszip.h b/hdf/src/cszip_priv.h similarity index 94% rename from hdf/src/cszip.h rename to hdf/src/cszip_priv.h index eae0eab359..09bc891dcd 100644 --- a/hdf/src/cszip.h +++ b/hdf/src/cszip_priv.h @@ -12,18 +12,18 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: cszip.h + * File: cszip_priv.h * Purpose: Header file for szip encoding information. - * Dependencies: should only be included from hcompi.h + * Dependencies: should only be included from hcomp_priv.h * Invokes: none * Contents: Structures & definitions for szip encoding. This header * should only be included in hcomp.c and cszip.c. *---------------------------------------------------------------------------*/ -#ifndef H4_CSZIP_H -#define H4_CSZIP_H +#ifndef H4_CSZIP_PRIV_H +#define H4_CSZIP_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* Special parameters for szip compression */ /* [These are aliases for the similar definitions in ricehdf.h header file] */ @@ -88,4 +88,4 @@ HDFLIBAPI intn HCPcszip_endaccess(accrec_t *access_rec); } #endif -#endif /* H4_CSZIP_H */ +#endif /* H4_CSZIP_PRIV_H */ diff --git a/hdf/src/df24.c b/hdf/src/df24.c index 2d064d6206..e68f6d9026 100644 --- a/hdf/src/df24.c +++ b/hdf/src/df24.c @@ -35,8 +35,8 @@ * dimension, compression, color compensation etc. *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "dfgr.h" +#include "hdf_priv.h" +#include "dfgr_priv.h" static intn Newdata = 0; /* does Readrig contain fresh data? */ static intn dimsset = 0; /* have dimensions been set? */ diff --git a/hdf/src/df24f.c b/hdf/src/df24f.c index 019b90cd25..22a14ac2aa 100644 --- a/hdf/src/df24f.c +++ b/hdf/src/df24f.c @@ -37,8 +37,8 @@ * dimension, compression, color compensation etc. *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "dfgr.h" +#include "hdf_priv.h" +#include "dfgr_priv.h" #include "hproto_fortran.h" #define LUT 0 diff --git a/hdf/src/df.h b/hdf/src/df_priv.h similarity index 95% rename from hdf/src/df.h rename to hdf/src/df_priv.h index 433ccc3383..14bb699d6b 100644 --- a/hdf/src/df.h +++ b/hdf/src/df_priv.h @@ -12,22 +12,15 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: df.h + * File: df_priv.h * Purpose: header file for HDF routines * Invokes: * Contents: * Structure definitions: DFddh, DFdd, DFdesc, DFdle, DF, DFdi, DFdata - * Procedure type definitions - * Global variables - * Tag definitions - * Error return codes - * Logical constants - * Remarks: This file is included with user programs - * Since it includes stdio.h etc., do not include these after df.h *---------------------------------------------------------------------------*/ -#ifndef H4_DF_H -#define H4_DF_H +#ifndef H4_DF_PRIV_H +#define H4_DF_PRIV_H #include "H4api_adpt.h" @@ -169,4 +162,4 @@ HDFLIBAPI int DFconvert(uint8 *source, uint8 *dest, int ntype, int sourcetype, i } #endif -#endif /* H4_DF_H */ +#endif /* H4_DF_PRIV_H */ diff --git a/hdf/src/dfan.c b/hdf/src/dfan.c index 1f6504a9c0..fbaaad4553 100644 --- a/hdf/src/dfan.c +++ b/hdf/src/dfan.c @@ -51,8 +51,8 @@ * DFANIgetfann: - get file annotation *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "dfan.h" +#include "hdf_priv.h" +#include "dfan_priv.h" static uint16 Lastref = 0; /* Last ref read/written */ static uint16 Next_label_ref = 0; /* Next file label ref to read/write */ diff --git a/hdf/src/dfan.h b/hdf/src/dfan_priv.h similarity index 94% rename from hdf/src/dfan.h rename to hdf/src/dfan_priv.h index e0e2960bb2..94567827ef 100644 --- a/hdf/src/dfan.h +++ b/hdf/src/dfan_priv.h @@ -12,18 +12,18 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*------------------------------------------------------------------------------ - * File: dfan.h + * File: dfan_priv.h * Purpose: header file for the Annotations set - * Invokes: df.h + * Invokes: df_priv.h * Contents: * Structure definitions: DFANdirentry, DFANdirhead * Constant definitions: DFAN_LABEL, DFAN_DESC *----------------------------------------------------------------------------*/ -#ifndef H4_DFAN_H -#define H4_DFAN_H +#ifndef H4_DFAN_PRIV_H +#define H4_DFAN_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" #define DFAN_LABEL 0 #define DFAN_DESC 1 @@ -55,4 +55,4 @@ typedef struct DFANdirhead { DFANdirentry *entries; /* actually an arbitrary size array */ } DFANdirhead; -#endif /* H4_DFAN_H */ +#endif /* H4_DFAN_PRIV_H */ diff --git a/hdf/src/dfanf.c b/hdf/src/dfanf.c index e11374039a..fd2020f983 100644 --- a/hdf/src/dfanf.c +++ b/hdf/src/dfanf.c @@ -39,9 +39,9 @@ * daiafid_ : add file id (intermediate routine) *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "dfan.h" -#include "df.h" +#include "hdf_priv.h" +#include "dfan_priv.h" +#include "df_priv.h" #include "hproto_fortran.h" /* conventions used in forming names of routines: diff --git a/hdf/src/dfcomp.c b/hdf/src/dfcomp.c index ac7a26810d..0d6625fbcb 100644 --- a/hdf/src/dfcomp.c +++ b/hdf/src/dfcomp.c @@ -26,7 +26,7 @@ /* This module (dfcomp.c) used to be in charge of the general compression * information but hcomp.c now supersedes it */ -#include "hdfi.h" +#include "hdf_priv.h" #define R8_MAX_BLOCKS 32 #define R8_MAX_LENGTH 512 diff --git a/hdf/src/dfconv.c b/hdf/src/dfconv.c index 493fc4ca3c..3ed3325e59 100644 --- a/hdf/src/dfconv.c +++ b/hdf/src/dfconv.c @@ -61,8 +61,8 @@ /* */ /*****************************************************************************/ -#include "hdfi.h" -#include "hconv.h" +#include "hdf_priv.h" +#include "hconv_priv.h" /* ** Static function prototypes diff --git a/hdf/src/dff.c b/hdf/src/dff.c index 4d7ad5e18f..883e41051a 100644 --- a/hdf/src/dff.c +++ b/hdf/src/dff.c @@ -38,8 +38,8 @@ * dfiishdf: call DFishdf to get HDF string *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "df.h" +#include "hdf_priv.h" +#include "df_priv.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/dfgr.c b/hdf/src/dfgr.c index 53843e2428..02f4f9c68a 100644 --- a/hdf/src/dfgr.c +++ b/hdf/src/dfgr.c @@ -14,7 +14,7 @@ /*----------------------------------------------------------------------------- * File: dfgr.c * Purpose: read and write general raster images - * Invokes: df.c, dfkit.c, dfcomp.c, dfgroup.c, dfgr.h + * Invokes: df.c, dfkit.c, dfcomp.c, dfgroup.c, dfgr_priv.h * Contents: * DFGRgetlutdims : get dimensions of lookup table * DFGRreqlutil : use this interlace when returning lookup table @@ -43,8 +43,8 @@ * dimension, compression, color compensation etc. *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "dfgr.h" +#include "hdf_priv.h" +#include "dfgr_priv.h" static char *Grlastfile = NULL; static uint8 *Grlutdata = NULL; /* points to lut, if in memory */ diff --git a/hdf/src/dfgr.h b/hdf/src/dfgr_priv.h similarity index 93% rename from hdf/src/dfgr.h rename to hdf/src/dfgr_priv.h index 5c1994b743..7c9207f8ba 100644 --- a/hdf/src/dfgr.h +++ b/hdf/src/dfgr_priv.h @@ -12,18 +12,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: dfgr.h + * File: dfgr_priv.h * Purpose: header file for the Raster Image set - * Invokes: df.h + * Invokes: df_priv.h * Contents: * Structure definitions: DFGRdr, DFGRrig - * Remarks: This is included with user programs which use general raster *---------------------------------------------------------------------------*/ -#ifndef H4_DFGR_H -#define H4_DFGR_H +#ifndef H4_DFGR_PRIV_H +#define H4_DFGR_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* description record: used to describe image data, palette data etc. */ typedef struct { @@ -65,4 +64,4 @@ HDFLIBAPI int32 DFGRIopen(const char *filename, int acc_mode); } #endif -#endif /* H4_DFGR_H */ +#endif /* H4_DFGR_PRIV_H */ diff --git a/hdf/src/dfgroup.c b/hdf/src/dfgroup.c index a3e4232593..2480e8b033 100644 --- a/hdf/src/dfgroup.c +++ b/hdf/src/dfgroup.c @@ -26,8 +26,8 @@ * Each tag/ref combination is called a data identifier (DI). *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" typedef struct DIlist_struct { uint8 *DIlist; diff --git a/hdf/src/dfimcomp.c b/hdf/src/dfimcomp.c index 698dfcd7c2..9a41dd17dc 100644 --- a/hdf/src/dfimcomp.c +++ b/hdf/src/dfimcomp.c @@ -22,7 +22,7 @@ /* DFCunimcomp(), sqr() */ /************************************************************************/ -#include "hdfi.h" +#include "hdf_priv.h" #define PALSIZE 256 #define BIT8 0 diff --git a/hdf/src/dfjpeg.c b/hdf/src/dfjpeg.c index 596d28d0ba..e3b19c4338 100644 --- a/hdf/src/dfjpeg.c +++ b/hdf/src/dfjpeg.c @@ -22,7 +22,7 @@ * that has to know about how to use the JPEG routines. *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" /* Hack to prevent libjpeg from re-defining `boolean` in a way that clashes * with windows.h. This MUST come before including jpeglib.h. diff --git a/hdf/src/dfknat.c b/hdf/src/dfknat.c index bdc1a7a7b9..268f668887 100644 --- a/hdf/src/dfknat.c +++ b/hdf/src/dfknat.c @@ -17,8 +17,6 @@ Purpose: Routines to support "native mode" conversion to and from HDF format - Invokes: - PRIVATE conversion functions: DFKnb1b - Native mode for 8 bit integers DFKnb2b - Native mode for 16 bit integers @@ -47,8 +45,8 @@ /* */ /*****************************************************************************/ -#include "hdfi.h" -#include "hconv.h" +#include "hdf_priv.h" +#include "hconv_priv.h" /*****************************************************************************/ /* NATIVE MODE NUMBER "CONVERSION" ROUTINES */ diff --git a/hdf/src/dfkswap.c b/hdf/src/dfkswap.c index 638b250d3d..b8a372b6eb 100644 --- a/hdf/src/dfkswap.c +++ b/hdf/src/dfkswap.c @@ -17,8 +17,6 @@ Purpose: Routines to support little-endian conversion to and from HDF format - Invokes: - PRIVATE conversion functions: DFKsb2b - Byte swapping for 16 bit integers DFKsb4b - Byte swapping for 32 bit integers @@ -46,8 +44,8 @@ /* */ /*****************************************************************************/ -#include "hdfi.h" -#include "hconv.h" +#include "hdf_priv.h" +#include "hconv_priv.h" /*****************************************************************************/ /* NUMBER CONVERSION ROUTINES FOR BYTE SWAPPING */ diff --git a/hdf/src/dfp.c b/hdf/src/dfp.c index 2a14a3330a..897c99532b 100644 --- a/hdf/src/dfp.c +++ b/hdf/src/dfp.c @@ -27,7 +27,7 @@ * DFPIopen : open/reopen file *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" /* remember that '0' is invalid ref number */ static uint16 Readref = 0; diff --git a/hdf/src/dfpf.c b/hdf/src/dfpf.c index 82648a59ff..c7e03d47e7 100644 --- a/hdf/src/dfpf.c +++ b/hdf/src/dfpf.c @@ -28,7 +28,7 @@ * Remarks: none *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/dfr8.c b/hdf/src/dfr8.c index 4888cdea5a..59b6efe836 100644 --- a/hdf/src/dfr8.c +++ b/hdf/src/dfr8.c @@ -14,7 +14,7 @@ /*----------------------------------------------------------------------------- * File: dfr8.c * Purpose: read and write 8-bit Raster Image Groups - * Invokes: df.c, dfcomp.c, dfgroup.c, dfrig.h + * Invokes: df.c, dfcomp.c, dfgroup.c, dfrig_priv.h * Contents: * DFR8setpalette : specify palette to be used with subsequent 8-bit images * DFR8setcompress : Set the compression for next image written @@ -40,8 +40,8 @@ * The palette is arranged as RGBRGB... *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "dfrig.h" +#include "hdf_priv.h" +#include "dfrig_priv.h" /* Private Variables */ static uint8 *paletteBuf = NULL; diff --git a/hdf/src/dfr8f.c b/hdf/src/dfr8f.c index f9f9fca7c3..b92877f914 100644 --- a/hdf/src/dfr8f.c +++ b/hdf/src/dfr8f.c @@ -31,7 +31,7 @@ * dfr8restart: Call DFR8restart to reset sequencing to first image *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/dfrig.h b/hdf/src/dfrig_priv.h similarity index 94% rename from hdf/src/dfrig.h rename to hdf/src/dfrig_priv.h index 167147ace9..d932450dac 100644 --- a/hdf/src/dfrig.h +++ b/hdf/src/dfrig_priv.h @@ -12,18 +12,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: dfrig.h + * File: dfrig_priv.h * Purpose: header file for the Raster Image set - * Invokes: df.h + * Invokes: df_priv.h * Contents: * Structure definitions: DFRdr, DFRrig - * Remarks: This is included with user programs which use RIG *---------------------------------------------------------------------------*/ -#ifndef H4_DFRIG_H -#define H4_DFRIG_H +#ifndef H4_DFRIG_PRIV_H +#define H4_DFRIG_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* description record: used to describe image data, palette data etc. */ typedef struct { @@ -64,4 +63,4 @@ typedef struct R8dim { uint16 yd; } R8dim; -#endif /* H4_DFRIG_H */ +#endif /* H4_DFRIG_PRIV_H */ diff --git a/hdf/src/dfrle.c b/hdf/src/dfrle.c index f439c68684..f9f30ca05f 100644 --- a/hdf/src/dfrle.c +++ b/hdf/src/dfrle.c @@ -21,7 +21,7 @@ * Remarks: DFCIrle() and DFCIunrle() compress and decompress RLE encoded info *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" /*----------------------------------------------------------------------------- * Name: DFCIrle diff --git a/hdf/src/dfsd.c b/hdf/src/dfsd.c index 49a9880227..0ec38935f7 100644 --- a/hdf/src/dfsd.c +++ b/hdf/src/dfsd.c @@ -18,7 +18,7 @@ Routines for input and output of numeric data group Invokes: - df.c dfgroup.c dfkit.c df.h dfsd.h + df.c dfgroup.c dfkit.c df_priv.h dfsd_priv.h Public functions: DFSDgetdims - get rank and dim sizes @@ -89,10 +89,10 @@ Fortran stub functions: This version assumes that all the values are floating point. *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "dfsd.h" +#include "hdf_priv.h" +#include "dfsd_priv.h" -/* MMM: make this definition correct and move to hfile.h, or wherever. */ +/* MMM: make this definition correct and move to hfile_priv.h, or wherever. */ #define DF_NOFILE 0 #define LABEL 0 diff --git a/hdf/src/dfsd.h b/hdf/src/dfsd_priv.h similarity index 97% rename from hdf/src/dfsd.h rename to hdf/src/dfsd_priv.h index e54f59271d..f86dc793b9 100644 --- a/hdf/src/dfsd.h +++ b/hdf/src/dfsd_priv.h @@ -12,9 +12,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: dfsd.h + * File: dfsd_priv.h * Purpose: header file for the Scientific Data set - * Invokes: dfrig.h + * Invokes: dfrig_priv.h * Contents: * Structure definitions: DFSsdg * Constant definitions: DFS_MAXLEN @@ -23,8 +23,8 @@ * multiple dimensions *---------------------------------------------------------------------------*/ -#ifndef H4_DFSD_H -#define H4_DFSD_H +#ifndef H4_DFSD_PRIV_H +#define H4_DFSD_PRIV_H #include "H4api_adpt.h" @@ -109,4 +109,4 @@ HDFLIBAPI int DFSDIsetdatastrs(const char *label, const char *unit, const char * } #endif -#endif /* H4_DFSD_H */ +#endif /* H4_DFSD_PRIV_H */ diff --git a/hdf/src/dfsdf.c b/hdf/src/dfsdf.c index dfb5882f4a..8c2d4a5376 100644 --- a/hdf/src/dfsdf.c +++ b/hdf/src/dfsdf.c @@ -68,8 +68,8 @@ * Remarks: no C stubs needed for the put string routines, only Fortran stubs *---------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "dfsd.h" +#include "hdf_priv.h" +#include "dfsd_priv.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/dfstubs.c b/hdf/src/dfstubs.c index bcb5aad99f..eb16faa585 100644 --- a/hdf/src/dfstubs.c +++ b/hdf/src/dfstubs.c @@ -40,8 +40,8 @@ ** Doug Ilg */ -#include "hdfi.h" -#include "df.h" +#include "hdf_priv.h" +#include "df_priv.h" #define DFACC_APPEND 8 #define DFEL_ABSENT 0 diff --git a/hdf/src/dfufp2i.c b/hdf/src/dfufp2i.c index 373cbf77c1..70ebc804ba 100644 --- a/hdf/src/dfufp2i.c +++ b/hdf/src/dfufp2i.c @@ -58,9 +58,9 @@ * *--------------------------------------------------------------------------*/ -#include "hdfi.h" -#include "dfufp2i.h" -#include "dfsd.h" +#include "hdf_priv.h" +#include "dfufp2i_priv.h" +#include "dfsd_priv.h" /********************************************************************** * diff --git a/hdf/src/dfufp2i.h b/hdf/src/dfufp2i_priv.h similarity index 95% rename from hdf/src/dfufp2i.h rename to hdf/src/dfufp2i_priv.h index 31a3add12d..eb74fbf522 100644 --- a/hdf/src/dfufp2i.h +++ b/hdf/src/dfufp2i_priv.h @@ -11,10 +11,10 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H4_DFUFP2IM_H -#define H4_DFUFP2IM_H +#ifndef H4_DFUFP2I_PRIV_H +#define H4_DFUFP2I_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* Input structure */ typedef struct { @@ -48,7 +48,7 @@ typedef struct { extern "C" { #endif -/* prototypes for dfufp2im.c */ +/* prototypes for dfufp2i.c */ HDFLIBAPI int process(Input *in, Output *out); HDFLIBAPI int generate_scale(int32 dim, float32 *scale); @@ -64,4 +64,4 @@ HDFLIBAPI int DFUfptoimage(int32 hdim, int32 vdim, float32 max, float32 min, flo } #endif -#endif /* H4_DFUFP2IM_H */ +#endif /* H4_DFUFP2I_PRIV_H */ diff --git a/hdf/src/dfufp2if.c b/hdf/src/dfufp2if.c index 5bfaeb5304..827b773ade 100644 --- a/hdf/src/dfufp2if.c +++ b/hdf/src/dfufp2if.c @@ -11,9 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "hdfi.h" -#include "dfufp2i.h" -#include "dfsd.h" +#include "hdf_priv.h" +#include "dfufp2i_priv.h" +#include "dfsd_priv.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/dfunjpeg.c b/hdf/src/dfunjpeg.c index 799a4e19b2..e9eb2f3be8 100644 --- a/hdf/src/dfunjpeg.c +++ b/hdf/src/dfunjpeg.c @@ -23,7 +23,7 @@ * routines. *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" /* Hack to prevent libjpeg from re-defining `boolean` in a way that clashes * with windows.h. This MUST come before including jpeglib.h. diff --git a/hdf/src/dfutil.c b/hdf/src/dfutil.c index cdf1451044..7ed4aa64aa 100644 --- a/hdf/src/dfutil.c +++ b/hdf/src/dfutil.c @@ -24,7 +24,7 @@ * This version assumes that all the values are floating point. *--------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" /*----------------------------------------------------------------------------- * Name: DFfindnextref diff --git a/hdf/src/dfutilf.c b/hdf/src/dfutilf.c index 6c50c5b24c..1879abd785 100644 --- a/hdf/src/dfutilf.c +++ b/hdf/src/dfutilf.c @@ -19,7 +19,7 @@ * dfindnr_: For a given tag, find the next ref after the given ref *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/dynarray.c b/hdf/src/dynarray.c index 501d042111..03dc1c4f32 100644 --- a/hdf/src/dynarray.c +++ b/hdf/src/dynarray.c @@ -46,8 +46,8 @@ EXPORTED ROUTINES DAsize_array - Get the current dynarray size */ -#include "hdfi.h" -#include "dynarray.h" +#include "hdf_priv.h" +#include "dynarray_priv.h" typedef struct dynarray_tag { intn num_elems; /* Number of elements in the array currently */ diff --git a/hdf/src/dynarray.h b/hdf/src/dynarray_priv.h similarity index 97% rename from hdf/src/dynarray.h rename to hdf/src/dynarray_priv.h index 3353c0e9ba..633693eb15 100644 --- a/hdf/src/dynarray.h +++ b/hdf/src/dynarray_priv.h @@ -12,14 +12,14 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: dynarray.h + * File: dynarray_priv.h * Purpose: header file for dynamic array API *---------------------------------------------------------------------------*/ -#ifndef H4_DYNARRAY_H -#define H4_DYNARRAY_H +#ifndef H4_DYNARRAY_PRIV_H +#define H4_DYNARRAY_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* Define the pointer to the dynarray without giving outside routines access @@ -134,4 +134,4 @@ void *DAdel_elem(dynarr_p arr_ptr, /* IN: Array to access */ } #endif -#endif /* H4_DYNARRAY_H */ +#endif /* H4_DYNARRAY_PRIV_H */ diff --git a/hdf/src/glist.c b/hdf/src/glist.c index 3a79b6a9e6..f0626bcdd6 100644 --- a/hdf/src/glist.c +++ b/hdf/src/glist.c @@ -17,8 +17,8 @@ by Keith Pomakis(kppomaki@jeeves.uwaterloo.ca)-Spring, 1994 ************************************************************************/ -#include "hdfi.h" -#include "glist.h" +#include "hdf_priv.h" +#include "glist_priv.h" /*+ **************************************************************************** diff --git a/hdf/src/glist.h b/hdf/src/glist_priv.h similarity index 99% rename from hdf/src/glist.h rename to hdf/src/glist_priv.h index c6dc8dbb03..f3ccfaed25 100644 --- a/hdf/src/glist.h +++ b/hdf/src/glist_priv.h @@ -17,10 +17,10 @@ by Keith Pomakis(kppomaki@jeeves.uwaterloo.ca)-Spring, 1994 ************************************************************************/ -#ifndef H4_GLIST_H -#define H4_GLIST_H +#ifndef H4_GLIST_PRIV_H +#define H4_GLIST_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* Structure for each element in the list */ typedef struct GLE_struct { @@ -659,4 +659,4 @@ void HDGLremove_all_such_that(Generic_list list, /*IN: list *******************************************************************************/ #define HDGQcopy_queue HDGLcopy_list -#endif /* H4_GLIST_H */ +#endif /* H4_GLIST_PRIV_H */ diff --git a/hdf/src/hbitio.c b/hdf/src/hbitio.c index 9a51ae1b11..1357129e01 100644 --- a/hdf/src/hbitio.c +++ b/hdf/src/hbitio.c @@ -36,8 +36,8 @@ LOCAL ROUTINES HIwrite2read - switch from writing bits to reading them */ -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* Local Variables */ diff --git a/hdf/src/hblocks.c b/hdf/src/hblocks.c index c4e35fc353..8b532ff7a6 100644 --- a/hdf/src/hblocks.c +++ b/hdf/src/hblocks.c @@ -118,8 +118,8 @@ LOCAL ROUTINES HLInewlink -- write out some data to a linked block */ -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* block_t - record of a linked block. contains the tag and ref of the data elt that forms the linked block */ diff --git a/hdf/src/hbuffer.c b/hdf/src/hbuffer.c index eaa5df5c78..ee9a23e378 100644 --- a/hdf/src/hbuffer.c +++ b/hdf/src/hbuffer.c @@ -45,8 +45,8 @@ EXPORTED ROUTINES ------------------------------------------------------------------------- */ -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* extinfo_t -- external elt information structure */ diff --git a/hdf/src/hchunks.c b/hdf/src/hchunks.c index 8d7f736b1a..eb6f7239b9 100644 --- a/hdf/src/hchunks.c +++ b/hdf/src/hchunks.c @@ -253,13 +253,13 @@ LOCAL ROUTINES #define STATISTICS */ -#include "hdfi.h" -#include "hfile.h" -#include "mcache.h" -#include "hchunks.h" +#include "hdf_priv.h" +#include "hfile_priv.h" +#include "mcache_priv.h" +#include "hchunks_priv.h" -#include "tbbt.h" -#include "mcache.h" +#include "tbbt_priv.h" +#include "mcache_priv.h" #include "hcomp.h" /* Define class, class version and name(partial) for chunk table i.e. Vdata */ @@ -348,7 +348,7 @@ typedef struct chunkinfo_t { /* private functions */ static int32 HMCIstaccess(accrec_t *access_rec, /* IN: access record to fill in */ int16 acc_mode /* IN: access mode */); -/* tbbt.h helper routines */ +/* tbbt_priv.h helper routines */ static intn chkcompare(void *k1, /* IN: first key */ void *k2, /* IN: second key */ intn cmparg /* IN: not sure? */); diff --git a/hdf/src/hchunks.h b/hdf/src/hchunks_priv.h similarity index 96% rename from hdf/src/hchunks.h rename to hdf/src/hchunks_priv.h index f59b97318c..314b5b5919 100644 --- a/hdf/src/hchunks.h +++ b/hdf/src/hchunks_priv.h @@ -12,18 +12,18 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: hchunks.h + * File: hchunks_priv.h * Purpose: Header file for Chunked elements * Dependencies: tbbt.c mcache.c * Contents: Structures & definitions for chunked elements * Structure definitions: DIM_DEF, HCHUNK_DEF *---------------------------------------------------------------------------*/ -#ifndef H4_HCHUNKS_H -#define H4_HCHUNKS_H +#ifndef H4_HCHUNKS_PRIV_H +#define H4_HCHUNKS_PRIV_H -#include "hdfi.h" -#include "hfile.h" /* special info stuff */ +#include "hdf_priv.h" +#include "hfile_priv.h" /* special info stuff */ /* Public structures */ @@ -112,4 +112,4 @@ HDFLIBAPI int32 HMCPgetnumrecs /* has to be here because used in hfile.c */ } #endif -#endif /* H4_HCHUNKS_H */ +#endif /* H4_HCHUNKS_PRIV_H */ diff --git a/hdf/src/hcomp.c b/hdf/src/hcomp.c index 64b74d4bb1..4593caa349 100644 --- a/hdf/src/hcomp.c +++ b/hdf/src/hcomp.c @@ -63,14 +63,14 @@ EXPORTED ROUTINES */ /* General HDF includes */ -#include "hdfi.h" +#include "hdf_priv.h" #ifdef H4_HAVE_LIBSZ #include "szlib.h" #endif /* HDF compression includes */ -#include "hcompi.h" /* Internal definitions for compression */ +#include "hcomp_priv.h" /* Internal definitions for compression */ /* Local defines */ #define COMP_HEADER_VERSION 0 diff --git a/hdf/src/hcompi.h b/hdf/src/hcomp_priv.h similarity index 88% rename from hdf/src/hcompi.h rename to hdf/src/hcomp_priv.h index f1971e19c5..d480e5af4e 100644 --- a/hdf/src/hcompi.h +++ b/hdf/src/hcomp_priv.h @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: hcompi.h + * File: hcomp_priv.h * Purpose: Internal library header file for compression information * Dependencies: should be included after hdf.h * Invokes: @@ -21,18 +21,18 @@ * Constant definitions: *---------------------------------------------------------------------------*/ -#ifndef H4_HCOMPI_H -#define H4_HCOMPI_H +#ifndef H4_HCOMP_PRIV_H +#define H4_HCOMP_PRIV_H -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* Modeling information */ /* structure for storing modeling information */ /* only allow modeling and master compression routines access */ -#include "mstdio.h" /* stdio modeling header */ +#include "mstdio_priv.h" /* stdio modeling header */ typedef struct comp_model_info_tag { comp_model_t model_type; /* model this stream is using */ @@ -47,12 +47,12 @@ typedef struct comp_model_info_tag { /* structure for storing modeling information */ /* only allow encoding and master compression routines access */ -#include "cnone.h" /* no encoding header */ -#include "crle.h" /* run-length encoding header */ -#include "cnbit.h" /* N-bit encoding header */ -#include "cskphuff.h" /* Skipping huffman encoding header */ -#include "cdeflate.h" /* gzip 'deflate' encoding header */ -#include "cszip.h" /* szip encoding header */ +#include "cnone_priv.h" /* no encoding header */ +#include "crle_priv.h" /* run-length encoding header */ +#include "cnbit_priv.h" /* N-bit encoding header */ +#include "cskphuff_priv.h" /* Skipping huffman encoding header */ +#include "cdeflate_priv.h" /* gzip 'deflate' encoding header */ +#include "cszip_priv.h" /* szip encoding header */ typedef struct comp_coder_info_tag { comp_coder_t coder_type; /* coding scheme this stream is using */ @@ -96,4 +96,4 @@ typedef struct compinfo_tag { comp_state_cache_t sinfo; /* state information for caching */ } compinfo_t; -#endif /* H4_HCOMPI_H */ +#endif /* H4_HCOMP_PRIV_H */ diff --git a/hdf/src/hcompri.c b/hdf/src/hcompri.c index 936d001f12..72783f8564 100644 --- a/hdf/src/hcompri.c +++ b/hdf/src/hcompri.c @@ -44,8 +44,8 @@ ------------------------------------------------------------------------- */ -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* crinfo_t -- compressed raster information structure */ diff --git a/hdf/src/hconv.h b/hdf/src/hconv_priv.h similarity index 96% rename from hdf/src/hconv.h rename to hdf/src/hconv_priv.h index 44de2d782b..0153f508fa 100644 --- a/hdf/src/hconv.h +++ b/hdf/src/hconv_priv.h @@ -12,14 +12,14 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: hconv.h + * File: hconv_priv.h * Purpose: header file for data conversion information & structures *---------------------------------------------------------------------------*/ -#ifndef H4_HCONV_H -#define H4_HCONV_H +#ifndef H4_HCONV_PRIV_H +#define H4_HCONV_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /*****************************************************************************/ /* CONSTANT DEFINITIONS */ @@ -122,4 +122,4 @@ union float_uint_uchar { unsigned char c[4]; }; -#endif /* H4_HCONV_H */ +#endif /* H4_HCONV_PRIV_H */ diff --git a/hdf/src/hdatainfo.c b/hdf/src/hdatainfo.c index 00f49bca7a..b9c44619fd 100644 --- a/hdf/src/hdatainfo.c +++ b/hdf/src/hdatainfo.c @@ -44,12 +44,13 @@ LOW-LEVEL ROUTINES **********************************************************************/ -#include "hdfi.h" -#include "hlimits.h" -#include "vgint.h" -#include "mfani.h" +#include "hdf_priv.h" + #include "mfan.h" -#include "mfgri.h" + +#include "vg_priv.h" +#include "mfan_priv.h" +#include "mfgr_priv.h" #ifdef H4_HAVE_LIBSZ /* we have the szip library */ #include "szlib.h" diff --git a/hdf/src/hdfi.h b/hdf/src/hdf_priv.h similarity index 99% rename from hdf/src/hdfi.h rename to hdf/src/hdf_priv.h index d4afe68ad3..ebbb9e47c6 100644 --- a/hdf/src/hdfi.h +++ b/hdf/src/hdf_priv.h @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifndef H4_HDFI_H -#define H4_HDFI_H +#ifndef H4_HDF_PRIV_H +#define H4_HDF_PRIV_H /* Define the I/O scheme before hdf.h to avoid an ordering mess in the * vconv.c code @@ -261,4 +261,4 @@ typedef intptr_t hdf_pint_t; */ #define JMEMSYS MEM_ANSI -#endif /* H4_HDFI_H */ +#endif /* H4_HDF_PRIV_H */ diff --git a/hdf/src/hdfalloc.c b/hdf/src/hdfalloc.c index 81dee7778d..8c2dd11b03 100644 --- a/hdf/src/hdfalloc.c +++ b/hdf/src/hdfalloc.c @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "hdfi.h" +#include "hdf_priv.h" /* LOCAL ROUTINES diff --git a/hdf/src/herr.c b/hdf/src/herr.c index 7149bd6afa..a6c41b6801 100644 --- a/hdf/src/herr.c +++ b/hdf/src/herr.c @@ -26,7 +26,7 @@ EXPORTED ROUTINES HEvalue -- return a error off of the error stack */ -#include "hdfi.h" +#include "hdf_priv.h" /* ** Include files for variable argument processing for HEreport diff --git a/hdf/src/herrf.c b/hdf/src/herrf.c index fbb023bdc4..769fca26cf 100644 --- a/hdf/src/herrf.c +++ b/hdf/src/herrf.c @@ -20,7 +20,7 @@ * Remarks: none *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/hextelt.c b/hdf/src/hextelt.c index 35a07874eb..4382c1aea3 100644 --- a/hdf/src/hextelt.c +++ b/hdf/src/hextelt.c @@ -74,8 +74,8 @@ EXPORTED ROUTINES ------------------------------------------------------------------------- */ -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* Directory separator definitions relating to a path. * Note this does not provide a universal way to recognize diff --git a/hdf/src/hfile.c b/hdf/src/hfile.c index 21ef511d35..8008526704 100644 --- a/hdf/src/hfile.c +++ b/hdf/src/hfile.c @@ -18,7 +18,7 @@ H-Level Limits ============== - o MAX_ACC access records open at a single time (#define in hfile.h) + o MAX_ACC access records open at a single time (#define in hfile_priv.h) o int16 total tags (fixed) o int32 max length and offset of an element in an HDF file (fixed) @@ -112,9 +112,9 @@ #include -#include "hdfi.h" -#include "hfile.h" -#include "glist.h" /* for double-linked lists, stacks and queues */ +#include "hdf_priv.h" +#include "hfile_priv.h" +#include "glist_priv.h" /* for double-linked lists, stacks and queues */ /*--------------------- Locally defined Globals -----------------------------*/ @@ -155,7 +155,7 @@ extern funclist_t comp_funcs; /* Functions for accessing chunked data elements. For definition of the chunked data element, see hchunk.c. */ -#include "hchunks.h" +#include "hchunks_priv.h" /* Functions for accessing buffered data elements. For definition of the buffered data element, see hbuffer.c. */ @@ -2438,7 +2438,7 @@ HDbase_tag(uint16 tag) RETURNS returns SUCCEED (0). DESCRIPTION - Copies values from #defines in hfile.h to provided buffers. This + Copies values from #defines in hfile_priv.h to provided buffers. This information is statistically compiled into the HDF library, so it is not necessary to have any files open to get this information. diff --git a/hdf/src/hfile.h b/hdf/src/hfile_priv.h similarity index 98% rename from hdf/src/hfile.h rename to hdf/src/hfile_priv.h index 447c31ab44..370e60098c 100644 --- a/hdf/src/hfile.h +++ b/hdf/src/hfile_priv.h @@ -11,20 +11,20 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/*+ hfile.h - *** Header for hfile.c, routines for low level data element I/O - + */ +/* hfile_priv.h + * Header for hfile.c, routines for low level data element I/O + */ -#ifndef H4_HFILE_H -#define H4_HFILE_H +#ifndef H4_HFILE_PRIV_H +#define H4_HFILE_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" -#include "tbbt.h" -#include "bitvect.h" -#include "atom.h" -#include "linklist.h" -#include "dynarray.h" +#include "tbbt_priv.h" +#include "bitvect_priv.h" +#include "atom_priv.h" +#include "linklist_priv.h" +#include "dynarray_priv.h" /* Magic cookie for HDF data files */ #define MAGICLEN 4 /* length */ @@ -57,10 +57,10 @@ #define LIBVER_MAJOR 4 #define LIBVER_MINOR 3 #define LIBVER_RELEASE 0 -#define LIBVER_SUBRELEASE "1" /* For pre-releases like snap0 */ - /* Empty string for real releases. */ +#define LIBVER_SUBRELEASE "1" /* For pre-releases like snap0 */ + /* Empty string for real releases */ #define LIBVER_STRING "HDF Version 4.3 Release 0-1, February 5, 2024" -#define LIBVSTR_LEN 80 /* length of version string */ +#define LIBVSTR_LEN 80 /* Length of version string */ #define LIBVER_LEN 92 /* 4+4+4+80 = 92 */ /* end of version tags */ @@ -532,9 +532,9 @@ HDFLIBAPI int32 HCPinfo(accrec_t *access_rec, sp_info_block_t *info_block); HDFLIBAPI int32 get_comp_len(accrec_t *access_rec); /* - ** from hchunks.c - should be the same as found in 'hchunks.h' + ** from hchunks.c - should be the same as found in 'hchunks_priv.h' */ -#include "hchunks.h" +#include "hchunks_priv.h" /* ** from hbuffer.c @@ -789,4 +789,4 @@ intn HTPdump_dds(int32 file_id, /* IN: file ID of HDF file to dump info for */ } #endif -#endif /* H4_HFILE_H */ +#endif /* H4_HFILE_PRIV_H */ diff --git a/hdf/src/hfiledd.c b/hdf/src/hfiledd.c index 5a222ead01..f89a2063ac 100644 --- a/hdf/src/hfiledd.c +++ b/hdf/src/hfiledd.c @@ -84,8 +84,8 @@ OLD ROUTINES HIunregister_tag_ref - mark a ref as un-used for a tag */ -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* Private routines */ static intn HTIfind_dd(filerec_t *file_rec, uint16 look_tag, uint16 look_ref, dd_t **pdd, intn direction); diff --git a/hdf/src/hfilef.c b/hdf/src/hfilef.c index 3f287bf9eb..a0cbad8ce3 100644 --- a/hdf/src/hfilef.c +++ b/hdf/src/hfilef.c @@ -20,7 +20,7 @@ * hclose_: call Hclose to close HDF file *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/hkit.c b/hdf/src/hkit.c index bf449c7db7..c7fb3da2ac 100644 --- a/hdf/src/hkit.c +++ b/hdf/src/hkit.c @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "hdfi.h" -#include "hkit.h" +#include "hdf_priv.h" +#include "hkit_priv.h" /* LOCAL ROUTINES diff --git a/hdf/src/hkit.h b/hdf/src/hkit_priv.h similarity index 97% rename from hdf/src/hkit.h rename to hdf/src/hkit_priv.h index e557d03dbc..8d834b408f 100644 --- a/hdf/src/hkit.h +++ b/hdf/src/hkit_priv.h @@ -11,15 +11,16 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/*+ hkit.h - *** private header file for hkit routines - + */ +/* hkit_priv.h + * + * private header file for hkit routines + */ -#ifndef H4_HKIT_H -#define H4_HKIT_H +#ifndef H4_HKIT_PRIV_H +#define H4_HKIT_PRIV_H -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* tag_messages is the list of tag descriptions in the system, kept as tag-description pairs. To look up a description, a linear search is @@ -158,4 +159,4 @@ static const nt_descript_t nt_descriptions[] = { }; -#endif /* H4_HKIT_H */ +#endif /* H4_HKIT_PRIV_H */ diff --git a/hdf/src/hlimits.h b/hdf/src/hlimits.h index 8873ee4f21..fb7ec30b29 100644 --- a/hdf/src/hlimits.h +++ b/hdf/src/hlimits.h @@ -30,7 +30,7 @@ /************************************************************************** * Generally useful macro definitions - * (These are copied from hdfi.h and should remain included in both files + * (These are copied from hdf_priv.h and should remain included in both files * because hlimits.h is included from netcdf.h which is used in some * netCDF utilities which don't need or want the rest of the HDF header * files. -QAK - 2/17/99 ) @@ -224,7 +224,7 @@ changing the class name variable declaration much easier - BMR 4/1/02*/ * _HDF_ATTRIBUTE "Attr0.0" 8/1/96 */ /* classes of the Vdatas/Vgroups created by the SD interface, - from local_nc.h */ + from nc_priv.h */ #define _HDF_ATTRIBUTE "Attr0.0" /* class of a Vdata containing SD interface attribute */ #define _HDF_VARIABLE "Var0.0" @@ -250,7 +250,7 @@ changing the class name variable declaration much easier - BMR 4/1/02*/ #define ATTR_FIELD_NAME "VALUES" /* The following vdata class name is reserved by the Chunking interface. - originally defined in 'hchunks.h'. The full class name + originally defined in 'hchunks_priv.h'. The full class name currently is "_HDF_CHK_TBL_0". -GV 9/25/97 Made the vdata class name available to other interfaces since it is needed diff --git a/hdf/src/hproto_fortran.h b/hdf/src/hproto_fortran.h index 669ca600e3..4c94aa35c4 100644 --- a/hdf/src/hproto_fortran.h +++ b/hdf/src/hproto_fortran.h @@ -15,7 +15,7 @@ #define H4_H_PROTO_FORTRAN #include "H4api_adpt.h" -#include "df.h" +#include "df_priv.h" #ifdef __cplusplus extern "C" { @@ -536,7 +536,7 @@ HDFFCLIBAPI intf nhinumbr(int32 file_id, uint16 tag); HDFFCLIBAPI intf nhconfinfc(intf *coder_type, intf *info); /* - ** from dfufp2im.c + ** from dfufp2i.c */ #define nduif2i H4_F77_FUNC(duif2i, DUIF2I) diff --git a/hdf/src/hqueue.h b/hdf/src/hqueue_priv.h similarity index 98% rename from hdf/src/hqueue.h rename to hdf/src/hqueue_priv.h index 5f7d24ebd0..f1470250f0 100644 --- a/hdf/src/hqueue.h +++ b/hdf/src/hqueue_priv.h @@ -30,15 +30,15 @@ */ /***************************************************************************** - * File: hqueue.h + * File: hqueue_priv.h * * This is a modffied version of the original Berkeley code for * manipulating a memory pool. This version however is not * compatible with the original Berkeley version. *****************************************************************************/ -#ifndef H4_HQUEUE_H -#define H4_HQUEUE_H +#ifndef H4_HQUEUE_PRIV_H +#define H4_HQUEUE_PRIV_H /* * This file defines three types of data structures: lists, tail queues, @@ -152,4 +152,4 @@ else \ (elm)->field.cqe_prev->field.cqe_next = (elm)->field.cqe_next; \ } -#endif /* H4_HQUEUE_H */ +#endif /* H4_HQUEUE_PRIV_H */ diff --git a/hdf/src/linklist.c b/hdf/src/linklist.c index 5180e16460..60334d45c1 100644 --- a/hdf/src/linklist.c +++ b/hdf/src/linklist.c @@ -28,8 +28,6 @@ DESIGN a pointer to a managed object. The list may be sorted or unsorted, based on the comparison function. -BUGS/LIMITATIONS - LOCAL ROUTINES HULIget_list_node - Gets a list node HULIrelease_list_node - Releases a list node @@ -44,8 +42,8 @@ EXPORTED ROUTINES HULshutdown - Close down the HUL interface */ -#include "hdfi.h" -#include "linklist.h" +#include "hdf_priv.h" +#include "linklist_priv.h" /* Pointer to the list node free list */ static node_info_t *node_free_list = NULL; diff --git a/hdf/src/linklist.h b/hdf/src/linklist_priv.h similarity index 98% rename from hdf/src/linklist.h rename to hdf/src/linklist_priv.h index d7cbfd9c54..895d3a8f6a 100644 --- a/hdf/src/linklist.h +++ b/hdf/src/linklist_priv.h @@ -12,14 +12,14 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: linklist.h + * File: linklist_priv.h * Purpose: header file for linked list API *---------------------------------------------------------------------------*/ -#ifndef H4_LINKLIST_H -#define H4_LINKLIST_H +#ifndef H4_LINKLIST_PRIV_H +#define H4_LINKLIST_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* Definitions for linked-list creation flags */ #define HUL_UNSORTED_LIST 0x0000 @@ -184,4 +184,4 @@ intn HULshutdown(void); } #endif -#endif /* H4_LINKLIST_H */ +#endif /* H4_LINKLIST_PRIV_H */ diff --git a/hdf/src/mcache.c b/hdf/src/mcache.c index fd8fc543cc..338e63a811 100644 --- a/hdf/src/mcache.c +++ b/hdf/src/mcache.c @@ -49,9 +49,9 @@ #define STATISTICS */ -#include "hdfi.h" -#include "hqueue.h" -#include "mcache.h" +#include "hdf_priv.h" +#include "hqueue_priv.h" +#include "mcache_priv.h" /* Private routines */ static BKT *mcache_bkt(MCACHE *mp); diff --git a/hdf/src/mcache.h b/hdf/src/mcache_priv.h similarity index 97% rename from hdf/src/mcache.h rename to hdf/src/mcache_priv.h index cd5d0114ce..582770bffc 100644 --- a/hdf/src/mcache.h +++ b/hdf/src/mcache_priv.h @@ -29,7 +29,7 @@ */ /***************************************************************************** - * File: mcache.h + * File: mcache_priv.h * * This is a modified version of the original Berkeley code for * manipulating a memory pool. This version however is not @@ -46,11 +46,11 @@ * -georgev */ -#ifndef H4_MCACHE_H -#define H4_MCACHE_H +#ifndef H4_MCACHE_PRIV_H +#define H4_MCACHE_PRIV_H -#include "hdfi.h" -#include "hqueue.h" /* Circular queue functions(Macros) */ +#include "hdf_priv.h" +#include "hqueue_priv.h" /* Circular queue functions(Macros) */ /* Set return/succeed values */ #ifdef SUCCEED @@ -188,4 +188,4 @@ HDFLIBAPI void mcache_stat(MCACHE *mp /* IN: MCACHE cookie */); } #endif -#endif /* H4_MCACHE_H */ +#endif /* H4_MCACHE_PRIV_H */ diff --git a/hdf/src/mfan.c b/hdf/src/mfan.c index 5901599470..1a1129c9eb 100644 --- a/hdf/src/mfan.c +++ b/hdf/src/mfan.c @@ -78,12 +78,12 @@ * *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" -#include "mfani.h" +#include "mfan_priv.h" #include "mfan.h" -#include "atom.h" -#include "hfile.h" /* needed for filerec_t */ +#include "atom_priv.h" +#include "hfile_priv.h" /* needed for filerec_t */ /* Whether we've installed the library termination function yet for this interface */ diff --git a/hdf/src/mfan.h b/hdf/src/mfan.h index cb8cdee532..9d9b3925d0 100644 --- a/hdf/src/mfan.h +++ b/hdf/src/mfan.h @@ -19,7 +19,7 @@ #ifndef H4_MFAN_H #define H4_MFAN_H -#include "hdfi.h" +#include "hdf.h" #ifdef __cplusplus extern "C" { diff --git a/hdf/src/mfani.h b/hdf/src/mfan_priv.h similarity index 95% rename from hdf/src/mfani.h rename to hdf/src/mfan_priv.h index 40b90592cd..0c6b9c8dbe 100644 --- a/hdf/src/mfani.h +++ b/hdf/src/mfan_priv.h @@ -12,14 +12,14 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*------------------------------------------------------------------------------ - * File: mfani.h + * File: mfan_priv.h * Purpose: private header file for the Multi-file Annotation Interface *----------------------------------------------------------------------------*/ -#ifndef H4_MFANI_H -#define H4_MFANI_H +#ifndef H4_MFAN_PRIV_H +#define H4_MFAN_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* This structure is used to find which file the annotation belongs to * and use the subsequent file specific annotation 'key' to find the @@ -62,4 +62,4 @@ typedef struct ANentry { /* Obtain Annotation type from key */ #define AN_KEY2TYPE(k) ((int32)((int32)k >> 16)) -#endif /* H4_MFANI_H */ +#endif /* H4_MFAN_PRIV_H */ diff --git a/hdf/src/mfanf.c b/hdf/src/mfanf.c index 25ca8f6f0a..d3c2e25796 100644 --- a/hdf/src/mfanf.c +++ b/hdf/src/mfanf.c @@ -47,7 +47,7 @@ * aftagatype - annotation TAG to corresponding annotation type *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" #include "hproto_fortran.h" /*----------------------------------------------------------------------------- diff --git a/hdf/src/mfgr.c b/hdf/src/mfgr.c index e8173c62cc..64c0670d4d 100644 --- a/hdf/src/mfgr.c +++ b/hdf/src/mfgr.c @@ -154,9 +154,8 @@ intn GRIil_convert(const void * inbuf,gr_interlace_t inil,void * outbuf, - Copy a pixel buffer from one interlace to another. */ -#include "hdfi.h" -#include "hlimits.h" -#include "mfgri.h" +#include "hdf_priv.h" +#include "mfgr_priv.h" #ifdef H4_HAVE_LIBSZ /* we have the library */ #include "szlib.h" diff --git a/hdf/src/mfgri.h b/hdf/src/mfgr_priv.h similarity index 97% rename from hdf/src/mfgri.h rename to hdf/src/mfgr_priv.h index 6e6f5dc80b..7e3f5e1f37 100644 --- a/hdf/src/mfgri.h +++ b/hdf/src/mfgr_priv.h @@ -12,17 +12,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: mfgri.h + * File: mfgr_priv.h * Purpose: private header file for multi-file general raster information *---------------------------------------------------------------------------*/ -#ifndef H4_MFGRI_H -#define H4_MFGRI_H +#ifndef H4_MFGR_PRIV_H +#define H4_MFGR_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" -#include "hfile.h" -#include "tbbt.h" +#include "hfile_priv.h" +#include "tbbt_priv.h" /* This is the size of the hash tables used for GR & RI IDs */ #define GRATOM_HASH_SIZE 32 @@ -135,4 +135,4 @@ HDFLIBAPI void GRIridestroynode(void *n); } #endif -#endif /* H4_MFGRI_H */ +#endif /* H4_MFGR_PRIV_H */ diff --git a/hdf/src/mfgrf.c b/hdf/src/mfgrf.c index f47996a2a4..aee08b74c6 100644 --- a/hdf/src/mfgrf.c +++ b/hdf/src/mfgrf.c @@ -54,7 +54,7 @@ * by palette identifier *---------------------------------------------------------------------------*/ -#include "hdfi.h" +#include "hdf_priv.h" #include "hproto_fortran.h" /* Local pre-processor macros */ diff --git a/hdf/src/mstdio.c b/hdf/src/mstdio.c index 4ff60da112..f9577f65d4 100644 --- a/hdf/src/mstdio.c +++ b/hdf/src/mstdio.c @@ -12,9 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* -FILE - mstdio.c - HDF stdio-like modeling I/O routines + mstdio.c - HDF stdio-like modeling I/O routines REMARKS Basically a NOP interface, it just calls the encoding layer. @@ -39,11 +37,11 @@ EXPORTED ROUTINES */ /* General HDF includes */ -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* HDF compression includes */ -#include "hcompi.h" /* Internal definitions for compression */ +#include "hcomp_priv.h" /* Internal definitions for compression */ funclist_t mstdio_funcs = {HCPmstdio_stread, HCPmstdio_stwrite, diff --git a/hdf/src/mstdio.h b/hdf/src/mstdio_priv.h similarity index 94% rename from hdf/src/mstdio.h rename to hdf/src/mstdio_priv.h index 35a90eca25..784bc72a74 100644 --- a/hdf/src/mstdio.h +++ b/hdf/src/mstdio_priv.h @@ -12,17 +12,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*----------------------------------------------------------------------------- - * File: mstdio.h + * File: mstdio_priv.h * Purpose: Header file for stdio-like modeling information. * Dependencies: should be included after hdf.h * Contents: Structures & definitions for stdio modeling. This header * should only be included in hcomp.c and mstdio.c. *---------------------------------------------------------------------------*/ -#ifndef H4_MSTDIO_H -#define H4_MSTDIO_H +#ifndef H4_MSTDIO_PRIV_H +#define H4_MSTDIO_PRIV_H -#include "hdfi.h" +#include "hdf_priv.h" /* model information about stdio model */ typedef struct { @@ -59,4 +59,4 @@ HDFLIBAPI intn HCPmstdio_endaccess(accrec_t *access_rec); } #endif -#endif /* H4_MSTDIO_H */ +#endif /* H4_MSTDIO_PRIV_H */ diff --git a/hdf/src/src.inc b/hdf/src/src.inc deleted file mode 100644 index 50f0b8930f..0000000000 --- a/hdf/src/src.inc +++ /dev/null @@ -1,136 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF. The full HDF copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -# -# ################################################################## -# -# Part of MAKEFILE for creating the HDF library, libdf.a, -# -# This file contains the definitions of all the source code and headers -# used in the actual makefile. They are located here for ease of maintenance. -# -# ################################################################## -# -# - -# Header files not included for copying to 'include' directory during installation -# These are private to the library and users do need them -HDRS_NO= glist.h mcache.h hqueue.h - -HDRS=$(H_HDRS) $(DF_HDRS) $(DFAN_HDRS) $(DFRI_HDRS) $(DFSD_HDRS) $(V_HDRS) \ - $(MFAN_HDRS) $(MFGR_HDRS) - -H_HDRS=hfile.h hdf.h hdfi.h herr.h hproto.h hcomp.h hconv.h hbitio.h \ - tbbt.h crle.h cnbit.h mstdio.h cnone.h cskphuff.h cdeflate.h \ - hlimits.h hntdefs.h htags.h hkit.h hcompi.h bitvect.h atom.h \ - dynarray.h linklist.h hchunks.h cszip.h - -DF_HDRS=df.h dfufp2i.h -DFAN_HDRS=dfan.h -DFRI_HDRS=dfrig.h dfgr.h -DFSD_HDRS=dfsd.h -V_HDRS=vg.h -MFAN_HDRS=mfan.h -MFGR_HDRS=mfgr.h - -CSRCS = $(HCSRCS) $(VCSRCS) $(DFCSRCS) $(MFCSRCS) -HCSRCS=hfile.c herr.c hblocks.c hbuffer.c hcompri.c hextelt.c hkit.c hdfalloc.c \ - hcomp.c hbitio.c tbbt.c hdfalloc.c hcomp.c crle.c cnbit.c mstdio.c cnone.c \ - cskphuff.c cdeflate.c bitvect.c atom.c hfiledd.c dynarray.c linklist.c \ - glist.c hchunks.c mcache.c cszip.c - -VCSRCS=vg.c vrw.c vio.c vparse.c vconv.c vsfld.c vgp.c vhi.c vattr.c - -DFCSRCS=$(DFG_CSRCS) $(DFAN_CSRCS) $(DFSD_CSRCS) $(DFRI_CSRCS) -DFG_CSRCS=dfgroup.c dfconv.c dfufp2i.c dfutil.c dfstubs.c dfknat.c dfkswap.c \ - dfkcray.c dfkvms.c dfkconv.c dfkfuji.c -DFAN_CSRCS=dfan.c -DFSD_CSRCS=dfsd.c -DFRI_CSRCS=dfr8.c dfcomp.c dfrle.c dfimcomp.c dfjpeg.c dfunjpeg.c dfp.c \ - dfgr.c df24.c - -MFCSRCS= $(MFAN_CSRCS) $(MFGR_CSRCS) -MFAN_CSRCS=mfan.c -MFGR_CSRCS=mfgr.c - -COBJS = $(HCOBJS) $(VCOBJS) $(DFCOBJS) $(MFCOBJS) -HCOBJS=hfile.o herr.o hblocks.o hbuffer.o hcompri.o hextelt.o hkit.o hdfalloc.o \ - hcomp.o hbitio.o tbbt.o crle.o cnbit.o mstdio.o cnone.o cskphuff.o \ - cdeflate.o bitvect.o atom.o hfiledd.o dynarray.o linklist.o glist.o \ - hchunks.o mcache.o cszip.o - -VCOBJS=vg.o vrw.o vio.o vparse.o vconv.o vsfld.o vgp.o vhi.o vattr.o - -DFCOBJS=$(DFG_COBJS) $(DFAN_COBJS) $(DFSD_COBJS) $(DFRI_COBJS) -DFG_COBJS=dfgroup.o dfconv.o dfufp2i.o dfutil.o dfstubs.o dfknat.o dfkswap.o \ - dfkcray.o dfkvms.o dfkconv.o dfkfuji.o -DFAN_COBJS=dfan.o -DFSD_COBJS=dfsd.o -DFRI_COBJS=dfr8.o dfcomp.o dfrle.o dfimcomp.o dfjpeg.o dfunjpeg.o dfp.o \ - dfgr.o df24.o - -MFCOBJS= $(MFAN_COBJS) $(MFGR_COBJS) -MFAN_COBJS=mfan.o -MFGR_COBJS=mfgr.o - -FSRCS = $(FCSRCS) $(FFSRCS) -FCSRCS=$(H_FCSRCS) $(V_FCSRCS) $(DF_FCSRCS) $(DFAN_FCSRCS) $(DFSD_FCSRCS) \ - $(DFRI_FCSRCS) $(MFAN_FCSRCS) $(MFGR_FCSRCS) -H_FCSRCS=hfilef.c herrf.c -V_FCSRCS=vgf.c vattrf.c -DF_FCSRCS=dff.c dfutilf.c -DFAN_FCSRCS=dfanf.c -DFSD_FCSRCS=dfsdf.c -DFRI_FCSRCS=dfr8f.c dfpf.c df24f.c -MFAN_FCSRCS=mfanf.c -MFGR_FCSRCS=mfgrf.c - -FFSRCS=$(H_FFSRCS) $(V_FFSRCS) $(DF_FFSRCS) $(DFAN_FFSRCS) $(DFSD_FFSRCS) \ - $(DFRI_FFSRCS) $(MFAN_FFSRCS) $(MFGR_FFSRCS) -H_FFSRCS=hfileff.f -V_FFSRCS=vgff.f vattrff.f -DF_FFSRCS=dfff.f dfufp2if.f -DFAN_FFSRCS=dfanff.f -DFSD_FFSRCS=dfsdff.f -DFRI_FFSRCS=df24ff.f dfpff.f dfr8ff.f -MFAN_FFSRCS= -MFGR_FFSRCS=mfgrff.f - -FOBJS = $(FCOBJS) $(FFOBJS) - -FCOBJS=$(H_FCOBJS) $(V_FCOBJS) $(DF_FCOBJS) $(DFAN_FCOBJS) $(DFSD_FCOBJS) \ - $(DFRI_FCOBJS) $(MFAN_FCOBJS) $(MFGR_FCOBJS) -H_FCOBJS=hfilef.o herrf.o -V_FCOBJS=vgf.o vattrf.o -DF_FCOBJS=dff.o dfutilf.o -DFAN_FCOBJS=dfanf.o -DFSD_FCOBJS=dfsdf.o -DFRI_FCOBJS=dfr8f.o dfpf.o df24f.o -MFAN_FCOBJS=mfanf.o -MFGR_FCOBJS=mfgrf.o - -FFOBJS=$(H_FFOBJS) $(V_FFOBJS) $(DF_FFOBJS) $(DFAN_FFOBJS) $(DFSD_FFOBJS) \ - $(DFRI_FFOBJS) $(MFAN_FFOBJS) $(MFGR_FFOBJS) -H_FFOBJS=hfileff.o -V_FFOBJS=vgff.o vattrff.o -DF_FFOBJS=dfff.o dfufp2if.o -DFAN_FFOBJS=dfanff.o -DFSD_FFOBJS=dfsdff.o -DFRI_FFOBJS=df24ff.o dfpff.o dfr8ff.o -MFAN_FFOBJS= -MFGR_FFOBJS=mfgrff.o - -F90INCS=dffunc.f90 hdf.f90 -FINCS=dffunc.inc hdf.inc $(F90INCS) - - diff --git a/hdf/src/tbbt.c b/hdf/src/tbbt.c index 1eceb5ac2d..d62b5c43e5 100644 --- a/hdf/src/tbbt.c +++ b/hdf/src/tbbt.c @@ -15,8 +15,8 @@ /* Extended from (added threads to) Knuth 6.2.3, Algorithm A (AVL trees) */ /* Basic tree structure by Adel'son-Vel'skii and Landis */ -#include "hdfi.h" -#include "tbbt.h" +#include "hdf_priv.h" +#include "tbbt_priv.h" #define PARENT 0 #define LEFT 1 diff --git a/hdf/src/tbbt.h b/hdf/src/tbbt_priv.h similarity index 97% rename from hdf/src/tbbt.h rename to hdf/src/tbbt_priv.h index b9edc0355a..4b62493088 100644 --- a/hdf/src/tbbt.h +++ b/hdf/src/tbbt_priv.h @@ -11,13 +11,13 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* "tbbt.h" -- Data types/routines for threaded, balanced, binary trees. */ +/* "tbbt_priv.h" -- Data types/routines for threaded, balanced, binary trees. */ /* Extended from Knuth 6.2.3, Algorithm A */ #ifndef H4_TBBT_H #define H4_TBBT_H -#include "hdfi.h" +#include "hdf_priv.h" /* Define the "fast compare" values */ #define TBBT_FAST_UINT16_COMPARE 1 @@ -75,8 +75,10 @@ typedef struct tbbt_tree { * each node will be set equal to the pointer to the data item. * * Since the "data item" pointer is the first field of each tree node, these - * routines may be used without this "tbbt.h" file. For example, assume "ITM" - * is the structure definition for the data items you want to store in lists: + * routines may be used without this "tbbt_priv.h" file. For example, assume + * "ITM" is the structure definition for the data items you want to store in + * lists: + * * ITM ***tbbtdmake( int (*cmp)(void *,void *,int), int arg ); * ITM **root= NULL; (* How to create an empty tree w/o tbbtdmake() *) * ITM **tbbtdfind( ITM ***tree, void *key, ITM ***pp ); diff --git a/hdf/src/vattr.c b/hdf/src/vattr.c index edc6be1c93..11f2fb9cca 100644 --- a/hdf/src/vattr.c +++ b/hdf/src/vattr.c @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" /************************************************************** * diff --git a/hdf/src/vattrf.c b/hdf/src/vattrf.c index 0e6cb7ae9c..ce09d79011 100644 --- a/hdf/src/vattrf.c +++ b/hdf/src/vattrf.c @@ -20,8 +20,8 @@ * ******************************************************/ -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" #include "hproto_fortran.h" /* ----------------- vsfcfdx ---------------------- diff --git a/hdf/src/vconv.c b/hdf/src/vconv.c index e2e63927e1..28a739d33a 100644 --- a/hdf/src/vconv.c +++ b/hdf/src/vconv.c @@ -27,9 +27,9 @@ * Part of the HDF Vset interface. */ -#include "hdfi.h" -#include "hfile.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "hfile_priv.h" +#include "vg_priv.h" /* ** ================================================================== diff --git a/hdf/src/vg.c b/hdf/src/vg.c index 734af64909..b36b6a504d 100644 --- a/hdf/src/vg.c +++ b/hdf/src/vg.c @@ -61,8 +61,8 @@ PRIVATE functions manipulate vsdir and are used only within this file. PRIVATE data structures in here pertain to vdata in vsdir only. */ -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" /* These are used to determine whether a vdata had been created by the library internally, that is, not created by user's application */ diff --git a/hdf/src/vg.h b/hdf/src/vg.h index 8f22e2a91c..2252d97104 100644 --- a/hdf/src/vg.h +++ b/hdf/src/vg.h @@ -20,7 +20,7 @@ * defines symbols and structures used in all v*.c files * * NOTES: - * This include file depends on the basic HDF *.h files hdfi.h and hdf.h. + * This include file depends on the basic HDF *.h file hdf.h. * An 'S' in the comment means that that data field is saved in the HDF file. * ******************************************************************************/ diff --git a/hdf/src/vgint.h b/hdf/src/vg_priv.h similarity index 98% rename from hdf/src/vgint.h rename to hdf/src/vg_priv.h index 454e256b5f..08140add94 100644 --- a/hdf/src/vgint.h +++ b/hdf/src/vg_priv.h @@ -13,26 +13,26 @@ /***************************************************************************** * - * vgint.h + * vg_priv.h * * Part of HDF VSet interface * * defines library private symbols and structures used in v*.c files * * NOTES: - * This include file depends on the basic HDF *.h files hdfi.h and hdf.h. + * This include file depends on the basic HDF *.h files hdf_priv.h and hdf.h. * An 'S' in the comment means that that data field is saved in the HDF file. * ******************************************************************************/ -#ifndef H4_VGINT_H -#define H4_VGINT_H +#ifndef H4_VG_PRIV_H +#define H4_VG_PRIV_H -#include "hdfi.h" -#include "hfile.h" +#include "hdf_priv.h" +#include "hfile_priv.h" /* Include file for Threaded, Balanced Binary Tree implementation */ -#include "tbbt.h" +#include "tbbt_priv.h" /* * typedefs for VGROUP, VDATA and VSUBGROUP @@ -272,4 +272,4 @@ HDFLIBAPI void trimendblanks(char *ss); } #endif -#endif /* H4_VGINT_H */ +#endif /* H4_VG_PRIV_H */ diff --git a/hdf/src/vgf.c b/hdf/src/vgf.c index 02d5aa717c..4559ca8aa5 100644 --- a/hdf/src/vgf.c +++ b/hdf/src/vgf.c @@ -31,8 +31,8 @@ * *********************************************************************** */ -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" #include "hproto_fortran.h" /* diff --git a/hdf/src/vgp.c b/hdf/src/vgp.c index 5136f45efe..7fd59fee13 100644 --- a/hdf/src/vgp.c +++ b/hdf/src/vgp.c @@ -101,8 +101,8 @@ EXPORTED ROUTINES *************************************************************************/ -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" /* These are used to determine whether a vgroup had been created by the library internally, that is, not created by user's application */ diff --git a/hdf/src/vhi.c b/hdf/src/vhi.c index 5596f24b59..538cf02417 100644 --- a/hdf/src/vhi.c +++ b/hdf/src/vhi.c @@ -22,8 +22,8 @@ * VHmakegroup -- makes a vgroup from tag/ref pairs */ -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" /* ------------------------ VHstoredata ------------------------------- NAME diff --git a/hdf/src/vio.c b/hdf/src/vio.c index 7e1073cb2a..5e34f342e8 100644 --- a/hdf/src/vio.c +++ b/hdf/src/vio.c @@ -58,8 +58,8 @@ EXPORTED ROUTINES *************************************************************************/ -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" /* Private Function Prototypes */ static intn vunpackvs(VDATA *vs, uint8 buf[], int32 len); diff --git a/hdf/src/vparse.c b/hdf/src/vparse.c index 401640ae4a..dd47693116 100644 --- a/hdf/src/vparse.c +++ b/hdf/src/vparse.c @@ -22,8 +22,8 @@ ************************************************************************/ -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" #define ISCOMMA(c) ((c == ',') ? 1 : 0) diff --git a/hdf/src/vrw.c b/hdf/src/vrw.c index 22221a039c..662a870c2c 100644 --- a/hdf/src/vrw.c +++ b/hdf/src/vrw.c @@ -34,8 +34,8 @@ EXPORTED ROUTINES ************************************************************************/ -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" #ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) diff --git a/hdf/src/vsfld.c b/hdf/src/vsfld.c index 6a0c756a86..ddb0704f4d 100644 --- a/hdf/src/vsfld.c +++ b/hdf/src/vsfld.c @@ -38,8 +38,8 @@ EXPORTED ROUTINES #include -#include "hdfi.h" -#include "vgint.h" +#include "hdf_priv.h" +#include "vg_priv.h" /* ** ================================================================== diff --git a/hdf/test/buffer.c b/hdf/test/buffer.c index 53ab15c609..6e2a60d2fa 100644 --- a/hdf/test/buffer.c +++ b/hdf/test/buffer.c @@ -29,9 +29,9 @@ #define TESTMASTER -#include "hdfi.h" +#include "hdf_priv.h" #include "tutils.h" -#include "hfile.h" +#include "hfile_priv.h" #define TESTFILE_NAME "tbuffer.hdf" #define EXTFILE_NAME "tbuffer.dat" diff --git a/hdf/test/chunks.c b/hdf/test/chunks.c index e87b623b48..ba481b5b92 100644 --- a/hdf/test/chunks.c +++ b/hdf/test/chunks.c @@ -110,7 +110,7 @@ */ #include "tproto.h" -#include "hchunks.h" +#include "hchunks_priv.h" #define TESTFILE_NAME "tchunks.hdf" #define BUFSIZE 12288 @@ -174,7 +174,7 @@ test_chunks(void) int32 nseek = 0; #endif int32 ret; - HCHUNK_DEF chunk[1]; /* Chunk definition, see 'hchunks.h' */ + HCHUNK_DEF chunk[1]; /* Chunk definition, see 'hchunks_priv.h' */ int32 dims[5]; int32 fill_val_len = 1; uint8 fill_val_u8 = 0; /* test 6 */ diff --git a/hdf/test/comp.c b/hdf/test/comp.c index 1024c7c458..9bbd197621 100644 --- a/hdf/test/comp.c +++ b/hdf/test/comp.c @@ -12,27 +12,16 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - FILE - comp.c - Test HDF compressed data I/O routines + comp.c - Test HDF compressed data I/O routines - DESIGN These are written to test all combinations of modeling and encoding layers with different number types. - - BUGS/LIMITATIONS - - EXPORTED ROUTINES - - AUTHOR - Quincey Koziol - - MODIFICATION HISTORY - 10/19/93 - Through this header in. */ #include + #include "tproto.h" -#include "hfile.h" +#include "hfile_priv.h" #define TESTFILE_NAME "tcomp.hdf" diff --git a/hdf/test/file1.c b/hdf/test/file1.c index ddbfd40de2..c6a3058c34 100644 --- a/hdf/test/file1.c +++ b/hdf/test/file1.c @@ -16,7 +16,7 @@ */ #include "tproto.h" -#include "hfile.h" +#include "hfile_priv.h" /* This value can cause platform-specific problems as the number of files * that can be open at one time via fopen() is often capped by the OS. diff --git a/hdf/test/mgr.c b/hdf/test/mgr.c index 5916f5b9d8..67df784aad 100644 --- a/hdf/test/mgr.c +++ b/hdf/test/mgr.c @@ -25,7 +25,7 @@ #include "tproto.h" #include "mfgr.h" -#include "mfgri.h" +#include "mfgr_priv.h" /* Local pre-processor macros */ #define XDIM 0 diff --git a/hdf/test/tbv.c b/hdf/test/tbv.c index 3d20c7e8f7..6073eb8d66 100644 --- a/hdf/test/tbv.c +++ b/hdf/test/tbv.c @@ -18,7 +18,7 @@ */ #include "tproto.h" -#include "bitvect.h" +#include "bitvect_priv.h" static void test_1(void); static void test_2(void); diff --git a/hdf/test/tproto.h b/hdf/test/tproto.h index 83140f4c66..8b597eb506 100644 --- a/hdf/test/tproto.h +++ b/hdf/test/tproto.h @@ -14,7 +14,7 @@ #ifndef H4_TPROTO_H #define H4_TPROTO_H -#include "hdfi.h" +#include "hdf_priv.h" #include "tutils.h" void test_an(void); diff --git a/hdf/test/tree.c b/hdf/test/tree.c index da7f3a53eb..e5f6a953aa 100644 --- a/hdf/test/tree.c +++ b/hdf/test/tree.c @@ -15,25 +15,12 @@ FILE tree.c Test HDF Threaded-Balanced-Binary Tree (tbbt) routines. - - REMARKS - - DESIGN - - BUGS/LIMITATIONS - - EXPORTED ROUTINES - - AUTHOR - Quincey Koziol - - MODIFICATION HISTORY - 10/21/93 - Started coding. */ #include + #include "tproto.h" -#include "tbbt.h" +#include "tbbt_priv.h" #define MAX_TEST_SIZE 31 /* maximum number of elements to insert */ #define NUM_TEST_RUNS 100 /* number of times to insert & remove each size */ diff --git a/hdf/test/tutils.h b/hdf/test/tutils.h index 74d628f562..1a0070edfe 100644 --- a/hdf/test/tutils.h +++ b/hdf/test/tutils.h @@ -14,7 +14,7 @@ #ifndef H4_TUTILS_H #define H4_TUTILS_H -#include "hdfi.h" +#include "hdf_priv.h" /* Define these for use in all the tests */ #ifndef TESTMASTER diff --git a/hdf/test/tvnameclass.c b/hdf/test/tvnameclass.c index 9ea545f595..52de664e97 100644 --- a/hdf/test/tvnameclass.c +++ b/hdf/test/tvnameclass.c @@ -15,7 +15,7 @@ * Tests for vgroup's and vdata's name and class name. */ #include "hdf.h" -#include "hfile.h" +#include "hfile_priv.h" #include "tproto.h" #include "tutils.h" diff --git a/hdf/test/tvset.c b/hdf/test/tvset.c index b6e01a5aa1..f4d22a559c 100644 --- a/hdf/test/tvset.c +++ b/hdf/test/tvset.c @@ -22,7 +22,7 @@ * */ #include "hdf.h" -#include "hfile.h" +#include "hfile_priv.h" #include "tproto.h" #define VDATA_COUNT 256 /* make this many Vdatas to check for memory leaks */ diff --git a/hdf/util/hdf2jpeg.c b/hdf/util/hdf2jpeg.c index bde768fe7d..29dce1ba1f 100644 --- a/hdf/util/hdf2jpeg.c +++ b/hdf/util/hdf2jpeg.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "hdf.h" -#include "hfile.h" +#include "hfile_priv.h" /* Size of the file buffer to copy through */ #define MAX_FILE_BUF 16384 diff --git a/hdf/util/hdfls.c b/hdf/util/hdfls.c index a08715abf2..e7486984d2 100644 --- a/hdf/util/hdfls.c +++ b/hdf/util/hdfls.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "hdf.h" -#include "hfile.h" +#include "hfile_priv.h" #define MAXBUFF 8192 diff --git a/hdf/util/hdfpack.c b/hdf/util/hdfpack.c index 82b91e1abb..c455acab69 100644 --- a/hdf/util/hdfpack.c +++ b/hdf/util/hdfpack.c @@ -33,12 +33,13 @@ ** You must have enough additional disk space for the compacted file. */ -#include "hdf.h" -#include "herr.h" -#include "hfile.h" #include #include +#include "hdf.h" +#include "herr.h" +#include "hfile_priv.h" + typedef struct mydd_t { uint16 tag; uint16 ref; diff --git a/hdf/util/he_main.c b/hdf/util/he_main.c index eb11b66bba..b2db3c00bb 100644 --- a/hdf/util/he_main.c +++ b/hdf/util/he_main.c @@ -61,7 +61,7 @@ *****************************************************************************/ /* ------ he.c ------- main() main HDF interfacing routines */ -#include "hdfi.h" +#include "hdf_priv.h" #include "he.h" #include diff --git a/hdf/util/jpeg2hdf.c b/hdf/util/jpeg2hdf.c index 83ed201b2c..a440fd9c9f 100644 --- a/hdf/util/jpeg2hdf.c +++ b/hdf/util/jpeg2hdf.c @@ -15,7 +15,7 @@ #include #include -#include "hdfi.h" +#include "hdf_priv.h" /* Size of the file buffer to copy through */ #define MAX_FILE_BUF 16384 diff --git a/hdf/util/vshow.c b/hdf/util/vshow.c index 9fa3853e26..683f7c4889 100644 --- a/hdf/util/vshow.c +++ b/hdf/util/vshow.c @@ -28,7 +28,8 @@ ******************************************************************************/ #include "hdf.h" -#include "vgint.h" + +#include "vg_priv.h" static int condensed; diff --git a/java/src/jni/h4jni.h b/java/src/jni/h4jni.h index e793d34fa6..8e122820aa 100644 --- a/java/src/jni/h4jni.h +++ b/java/src/jni/h4jni.h @@ -17,9 +17,10 @@ * */ -#include #include +#include + #ifndef Included_h4jni #define Included_h4jni diff --git a/java/src/jni/hdfImp.c b/java/src/jni/hdfImp.c index 187395eb0d..6874d575c3 100644 --- a/java/src/jni/hdfImp.c +++ b/java/src/jni/hdfImp.c @@ -20,16 +20,19 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +#include #include -#include "hdfi.h" -#include "hfile.h" + +#include "hdf.h" +#include "hfile_priv.h" /* only needed for library version symbols */ #include "h4jni.h" #include "hdfImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* * Class: hdf_hdflib_HDFLibrary * Method: Hopen diff --git a/java/src/jni/hdfanImp.c b/java/src/jni/hdfanImp.c index f2b8545ec8..120f23779a 100644 --- a/java/src/jni/hdfanImp.c +++ b/java/src/jni/hdfanImp.c @@ -20,17 +20,19 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include #include #include -#include "hdfi.h" + +#include + +#include "hdf.h" #include "h4jni.h" #include "hdfanImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jlong JNICALL Java_hdf_hdflib_HDFLibrary_ANstart(JNIEnv *env, jclass clss, jlong file_id) { diff --git a/java/src/jni/hdfdfpalImp.c b/java/src/jni/hdfdfpalImp.c index a285d7c6b2..78681d87a0 100644 --- a/java/src/jni/hdfdfpalImp.c +++ b/java/src/jni/hdfdfpalImp.c @@ -20,17 +20,19 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include #include #include -#include "hdfi.h" + +#include + +#include "hdf.h" #include "h4jni.h" #include "hdfdfpalImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jboolean JNICALL Java_hdf_hdflib_HDFLibrary_DFPaddpal(JNIEnv *env, jclass clss, jstring filename, jbyteArray palette) { diff --git a/java/src/jni/hdfdfuImp.c b/java/src/jni/hdfdfuImp.c index 69380a9dbb..8aa3e2b0f7 100644 --- a/java/src/jni/hdfdfuImp.c +++ b/java/src/jni/hdfdfuImp.c @@ -20,15 +20,16 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfdfuImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jboolean JNICALL Java_hdf_hdflib_HDFLibrary_DFUfptoimage(JNIEnv *env, jclass clss, jint hdim, jint vdim, jfloat max, jfloat min, jfloatArray hscale, jfloatArray vscale, jfloatArray data, diff --git a/java/src/jni/hdfexceptionImp.c b/java/src/jni/hdfexceptionImp.c index 324507d148..5603e39424 100644 --- a/java/src/jni/hdfexceptionImp.c +++ b/java/src/jni/hdfexceptionImp.c @@ -18,12 +18,9 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfexceptionImp.h" @@ -86,6 +83,10 @@ extern "C" { /********************/ static jboolean H4JNIErrorClass(JNIEnv *env, const char *message, const char *className); +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* * Class: hdf_hdflib_HDFLibraryException * Method: printStackTrace0 diff --git a/java/src/jni/hdfgrImp.c b/java/src/jni/hdfgrImp.c index b1ac1c0fa6..6e8d4d8a07 100644 --- a/java/src/jni/hdfgrImp.c +++ b/java/src/jni/hdfgrImp.c @@ -20,16 +20,19 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +#include #include -#include "hdfi.h" + +#include "hdf.h" #include "mfhdf.h" #include "h4jni.h" #include "hdfgrImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + extern jboolean makeChunkInfo(JNIEnv *env, jobject chunkobj, int32 flgs, HDF_CHUNK_DEF *cinf); extern jboolean getNewCompInfo(JNIEnv *env, jobject ciobj, comp_info *cinf); extern jboolean setNewCompInfo(JNIEnv *env, jobject ciobj, comp_coder_t coder, comp_info *cinf); diff --git a/java/src/jni/hdfheImp.c b/java/src/jni/hdfheImp.c index 8f89d1577a..4d20cbc4a6 100644 --- a/java/src/jni/hdfheImp.c +++ b/java/src/jni/hdfheImp.c @@ -20,16 +20,16 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" -#include "hfile.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfheImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jint JNICALL Java_hdf_hdflib_HDFLibrary_HEvalue(JNIEnv *env, jclass clss, jint level) { diff --git a/java/src/jni/hdfhxImp.c b/java/src/jni/hdfhxImp.c index 6e95d16125..326b760837 100644 --- a/java/src/jni/hdfhxImp.c +++ b/java/src/jni/hdfhxImp.c @@ -20,15 +20,16 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfhxImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jboolean JNICALL Java_hdf_hdflib_HDFLibrary_HXsetcreatedir(JNIEnv *env, jclass clss, jstring dir) { diff --git a/java/src/jni/hdfnativeImp.c b/java/src/jni/hdfnativeImp.c index 276c446d02..1815297d0e 100644 --- a/java/src/jni/hdfnativeImp.c +++ b/java/src/jni/hdfnativeImp.c @@ -30,15 +30,16 @@ * but unavoidable performance hit. */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfnativeImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* returns int [] */ JNIEXPORT jintArray JNICALL Java_hdf_hdflib_HDFNativeData_byteToInt___3B(JNIEnv *env, jclass clss, jbyteArray bdata) diff --git a/java/src/jni/hdfr24Imp.c b/java/src/jni/hdfr24Imp.c index fd24c3000c..16e098ce94 100644 --- a/java/src/jni/hdfr24Imp.c +++ b/java/src/jni/hdfr24Imp.c @@ -20,15 +20,16 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfr24Imp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + extern jboolean getOldCompInfo(JNIEnv *env, jobject ciobj, comp_info *cinf); JNIEXPORT jboolean JNICALL diff --git a/java/src/jni/hdfr8Imp.c b/java/src/jni/hdfr8Imp.c index 54e372ef11..a24b9355ae 100644 --- a/java/src/jni/hdfr8Imp.c +++ b/java/src/jni/hdfr8Imp.c @@ -20,15 +20,16 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfr8Imp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + extern jboolean getOldCompInfo(JNIEnv *env, jobject ciobj, comp_info *cinf); JNIEXPORT jboolean JNICALL diff --git a/java/src/jni/hdfsdsImp.c b/java/src/jni/hdfsdsImp.c index 3cdcf1691b..65cd64839d 100644 --- a/java/src/jni/hdfsdsImp.c +++ b/java/src/jni/hdfsdsImp.c @@ -20,16 +20,19 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +#include #include -#include "hdfi.h" + +#include "hdf.h" #include "mfhdf.h" #include "h4jni.h" #include "hdfsdsImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + extern jboolean makeChunkInfo(JNIEnv *env, jobject chunkobj, int32 flgs, HDF_CHUNK_DEF *cinf); extern jboolean getNewCompInfo(JNIEnv *env, jobject ciobj, comp_info *cinf); extern jboolean setNewCompInfo(JNIEnv *env, jobject ciobj, comp_coder_t coder, comp_info *cinf); diff --git a/java/src/jni/hdfstructsutil.c b/java/src/jni/hdfstructsutil.c index 3178b3fd39..a90bd94ec0 100644 --- a/java/src/jni/hdfstructsutil.c +++ b/java/src/jni/hdfstructsutil.c @@ -19,15 +19,16 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfstructsutil.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /* * Get information from a Java HDFNewCompInfo object in to a C comp_info * struct. diff --git a/java/src/jni/hdfvdataImp.c b/java/src/jni/hdfvdataImp.c index 44999b779e..a04696b37d 100644 --- a/java/src/jni/hdfvdataImp.c +++ b/java/src/jni/hdfvdataImp.c @@ -20,15 +20,18 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +#include #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfvdataImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jlong JNICALL Java_hdf_hdflib_HDFLibrary_VSattach(JNIEnv *env, jclass clss, jlong fid, jint vdata_ref, jstring accessmode) { diff --git a/java/src/jni/hdfvfImp.c b/java/src/jni/hdfvfImp.c index 41c0764f99..af2ed17fa8 100644 --- a/java/src/jni/hdfvfImp.c +++ b/java/src/jni/hdfvfImp.c @@ -20,15 +20,16 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfvfImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jint JNICALL Java_hdf_hdflib_HDFLibrary_VFfieldesize(JNIEnv *env, jclass clss, jlong vdata_id, int field_index) { diff --git a/java/src/jni/hdfvgroupImp.c b/java/src/jni/hdfvgroupImp.c index 3c40fa8866..aedc94b3c1 100644 --- a/java/src/jni/hdfvgroupImp.c +++ b/java/src/jni/hdfvgroupImp.c @@ -20,15 +20,18 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +#include #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfvgroupImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jboolean JNICALL Java_hdf_hdflib_HDFLibrary_Vstart(JNIEnv *env, jclass clss, jlong fid) { diff --git a/java/src/jni/hdfvhImp.c b/java/src/jni/hdfvhImp.c index 6e308b1127..b5ddd5684c 100644 --- a/java/src/jni/hdfvhImp.c +++ b/java/src/jni/hdfvhImp.c @@ -20,15 +20,16 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfvhImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jint JNICALL Java_hdf_hdflib_HDFLibrary_VHmakegroup(JNIEnv *env, jclass clss, jlong file_id, jintArray tag_array, jintArray ref_array, jint n_objects, jstring vgroup_name, diff --git a/java/src/jni/hdfvqImp.c b/java/src/jni/hdfvqImp.c index 3a4bfb2a1a..08828b4de6 100644 --- a/java/src/jni/hdfvqImp.c +++ b/java/src/jni/hdfvqImp.c @@ -20,15 +20,16 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfvqImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jint JNICALL Java_hdf_hdflib_HDFLibrary_VQueryref(JNIEnv *env, jclass clss, jlong vkey) { diff --git a/java/src/jni/hdfvsqImp.c b/java/src/jni/hdfvsqImp.c index 80126cc3e2..42aac9da63 100644 --- a/java/src/jni/hdfvsqImp.c +++ b/java/src/jni/hdfvsqImp.c @@ -20,15 +20,18 @@ * */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +#include #include -#include "hdfi.h" + +#include "hdf.h" #include "h4jni.h" #include "hdfvsqImp.h" +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + JNIEXPORT jboolean JNICALL Java_hdf_hdflib_HDFLibrary_VSQuerycount(JNIEnv *env, jclass clss, jlong vdata_id, jintArray n_records) { diff --git a/mfhdf/dumper/hdp.c b/mfhdf/dumper/hdp.c index 43be0323fc..011b634372 100644 --- a/mfhdf/dumper/hdp.c +++ b/mfhdf/dumper/hdp.c @@ -12,8 +12,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "hdp.h" -#include "local_nc.h" -#include "vgint.h" + +#include "nc_priv.h" +#include "vg_priv.h" /********************/ /* Global Variables */ diff --git a/mfhdf/dumper/hdp.h b/mfhdf/dumper/hdp.h index a203fdbc8c..a6ccab9365 100644 --- a/mfhdf/dumper/hdp.h +++ b/mfhdf/dumper/hdp.h @@ -15,7 +15,7 @@ #define DUMPER_HDP_H #include "hdf.h" -#include "hfile.h" +#include "hfile_priv.h" /* Global Variables */ extern intn vinit_done; diff --git a/mfhdf/dumper/hdp_sds.c b/mfhdf/dumper/hdp_sds.c index 411fdf1a1f..59492c39b0 100644 --- a/mfhdf/dumper/hdp_sds.c +++ b/mfhdf/dumper/hdp_sds.c @@ -22,8 +22,8 @@ intn have_szip = 1; #else intn have_szip = 0; #endif -#include "cszip.h" -#include "local_nc.h" /* to use some definitions */ +#include "cszip_priv.h" +#include "nc_priv.h" /* to use some definitions */ void dumpsds_usage(intn argc, char *argv[]) diff --git a/mfhdf/dumper/show.c b/mfhdf/dumper/show.c index e42b562eab..9a3326b8ca 100644 --- a/mfhdf/dumper/show.c +++ b/mfhdf/dumper/show.c @@ -14,7 +14,8 @@ /* Modified from vshow.c by Eric Tsui, 12/25/1994. */ #include "hdp.h" -#include "vgint.h" + +#include "vg_priv.h" #define BUFFER 1000000 diff --git a/mfhdf/fortran/CMakeLists.txt b/mfhdf/fortran/CMakeLists.txt index 0eac84b7a4..09185fe709 100644 --- a/mfhdf/fortran/CMakeLists.txt +++ b/mfhdf/fortran/CMakeLists.txt @@ -17,7 +17,6 @@ endif () set (HDF4_MFHDF_LIBSRC_CSTUB_FHDRS ${HDF4_MFHDFSOURCE_DIR}/hdf2netcdf.h ${HDF4_MFHDFSOURCE_DIR}/mfhdf.h - ${HDF4_MFHDFSOURCE_DIR}/mfhdfi.h ) if (HDF4_ENABLE_NETCDF) # set (HDF4_MFHDF_LIBSRC_CSTUB_FSRCS ${HDF4_MFHDF_LIBSRC_CSTUB_FSRCS} ${HDF4_BINARY_DIR}/jackets.c) diff --git a/mfhdf/fortran/common.inc b/mfhdf/fortran/common.inc deleted file mode 100644 index 9f55f56ab1..0000000000 --- a/mfhdf/fortran/common.inc +++ /dev/null @@ -1,147 +0,0 @@ -c -c Functions in the FORTRAN interface - - integer nccre, ncopn, ncddef, ncdid, ncvdef, ncvid, nctlen - integer ncsfil - external nccre, ncopn, ncddef, ncdid, ncvdef, ncvid, nctlen - external ncsfil - - integer NCRDWR,NCCREAT,NCEXCL,NCINDEF,NCNSYNC,NCHSYNC - integer NCNDIRTY,NCHDIRTY,NCLINK,NCNOWRIT,NCWRITE - integer NCCLOB,NCNOCLOB,NCGLOBAL,NCFILL,NCNOFILL - integer MAXNCOP,MAXNCDIM,MAXNCATT,MAXNCVAR - integer MAXNCNAM,MAXVDIMS,NCNOERR,NCEBADID - integer NCENFILE,NCEEXIST,NCEINVAL,NCEPERM,NCENOTIN - integer NCEINDEF,NCECOORD,NCEMAXDS,NCENAME - integer NCENOATT,NCEMAXAT,NCEBADTY,NCEBADD, NCESTS - integer NCEUNLIM,NCEMAXVS,NCENOTVR,NCEGLOB,NCENOTNC - integer NCFOOBAR,NCSYSERR,NCFATAL,NCVERBOS, NCENTOOL - - integer NCBYTE,NCCHAR,NCSHORT,NCLONG,NCFLOAT,NCDOUBLE - - parameter(NCBYTE = 1) - parameter(NCCHAR = 2) - parameter(NCSHORT = 3) - parameter(NCLONG = 4) - parameter(NCFLOAT = 5) - parameter(NCDOUBLE = 6) - -c -c masks for the struct NC flag field; passed in as 'mode' arg to -c nccreate and ncopen. -c - -c read/write, 0 => readonly - parameter(NCRDWR = 1) -c in create phase, cleared by ncendef - parameter(NCCREAT = 2) -c on create destroy existing file - parameter(NCEXCL = 4) -c in define mode, cleared by ncendef - parameter(NCINDEF = 8) -c synchronise numrecs on change (X'10') - parameter(NCNSYNC = 16) -c synchronise whole header on change (X'20') - parameter(NCHSYNC = 32) -c numrecs has changed (X'40') - parameter(NCNDIRTY = 64) -c header info has changed (X'80') - parameter(NCHDIRTY = 128) -c prefill vars on endef and increase of record, the default behavior - parameter(NCFILL = 0) -c don't fill vars on endef and increase of record (X'100') - parameter(NCNOFILL = 256) -c isa link (X'8000') - parameter(NCLINK = 32768) - -c -c 'mode' arguments for nccreate and ncopen -c - - parameter(NCNOWRIT = 0) - parameter(NCWRITE = NCRDWR) - parameter(NCCLOB = 11) - parameter(NCNOCLOB = 15) -c -c 'size' argument to ncdimdef for an unlimited dimension -c - LONG_INT NCUNLIM - parameter(NCUNLIM = 0) - -c -c attribute id to put/get a global attribute -c - parameter(NCGLOBAL = 0) -c -c Advisory Maximums -c - parameter(MAXNCOP = 32) - parameter(MAXNCDIM = 32) - parameter(MAXNCATT = 512) - parameter(MAXNCVAR = 512) -c Not enforced - parameter(MAXNCNAM = 128) - parameter(MAXVDIMS = MAXNCDIM) - - -c -c The netcdf data types -c - -c -c Global netcdf error status variable -c Initialized in error.c -c - -c No Error - parameter(NCNOERR = 0) -c Not a netcdf id - parameter(NCEBADID = 1) -c Too many netcdfs open - parameter(NCENFILE = 2) -c netcdf file exists && NCNOCLOB - parameter(NCEEXIST = 3) -c Invalid Argument - parameter(NCEINVAL = 4) -c Write to read only - parameter(NCEPERM = 5) -c Operation not allowed in data mode - parameter(NCENOTIN = 6) -c Operation not allowed in define mode - parameter(NCEINDEF = 7) -c Coordinates out of Domain - parameter(NCECOORD = 8) -c MAXNCDIMS exceeded - parameter(NCEMAXDS = 9) -c String match to name in use - parameter(NCENAME = 10) -c Attribute not found - parameter(NCENOATT = 11) -c MAXNCATTRS exceeded - parameter(NCEMAXAT = 12) -c Not a netcdf data type - parameter(NCEBADTY = 13) -c Invalid dimension id - parameter(NCEBADD = 14) -c NCUNLIMITED in the wrong index - parameter(NCEUNLIM = 15) -c MAXNCVARS exceeded - parameter(NCEMAXVS = 16) -c Variable not found - parameter(NCENOTVR = 17) -c Action prohibited on NCGLOBAL varid - parameter(NCEGLOB = 18) -c Not a netcdf file - parameter(NCENOTNC = 19) - parameter(NCESTS = 20) - parameter (NCENTOOL = 21) - parameter(NCFOOBAR = 32) - parameter(NCSYSERR = -1) - - -c -c Global options variable. Used to determine behavior of error handler. -c Initialized in lerror.c -c - parameter(NCFATAL = 1) - parameter(NCVERBOS = 2) diff --git a/mfhdf/fortran/jackets.c.in b/mfhdf/fortran/jackets.c.in index f03c23c448..f5afdd80a3 100644 --- a/mfhdf/fortran/jackets.c.in +++ b/mfhdf/fortran/jackets.c.in @@ -14,11 +14,12 @@ * */ -#include -#include -#include -#include -#include "local_nc.h" +#include +#include +#include +#include + +#include "nc_priv.h" #if !NC_OLD_FILLVALUES diff --git a/mfhdf/hdfimport/hdfimport.c b/mfhdf/hdfimport/hdfimport.c index 5af88669ba..389e742ff9 100644 --- a/mfhdf/hdfimport/hdfimport.c +++ b/mfhdf/hdfimport/hdfimport.c @@ -177,7 +177,7 @@ #include #include "hdf.h" -#include "hfile.h" +#include "hfile_priv.h" #include "mfhdf.h" #ifdef H4_HAVE_SYS_STAT_H diff --git a/mfhdf/hdiff/hdiff_array.c b/mfhdf/hdiff/hdiff_array.c index dff1b9d5a5..4d75f70e76 100644 --- a/mfhdf/hdiff/hdiff_array.c +++ b/mfhdf/hdiff/hdiff_array.c @@ -20,10 +20,11 @@ #include #include #include + #include "hdf.h" #include "mfhdf.h" #include "hdiff.h" -#include "vgint.h" +#include "vg_priv.h" #ifndef ABS #define ABS(a) (((a) >= 0) ? (a) : -(a)) diff --git a/mfhdf/hdiff/hdiff_main.c b/mfhdf/hdiff/hdiff_main.c index 0bdbdd4863..8540bb0620 100644 --- a/mfhdf/hdiff/hdiff_main.c +++ b/mfhdf/hdiff/hdiff_main.c @@ -19,7 +19,7 @@ #include "h4getopt.h" #include "hdf.h" -#include "hfile.h" +#include "hfile_priv.h" #include "mfhdf.h" #include "hdiff.h" diff --git a/mfhdf/hdiff/hdiff_vs.c b/mfhdf/hdiff/hdiff_vs.c index 1cc834d8b4..80e4e13217 100644 --- a/mfhdf/hdiff/hdiff_vs.c +++ b/mfhdf/hdiff/hdiff_vs.c @@ -15,7 +15,7 @@ #include "hdiff_list.h" #include "hdiff_mattbl.h" -#include "vgint.h" +#include "vg_priv.h" static void fmt_print(uint8 *x, int32 type); static uint32 vdata_cmp(int32 vs1, int32 vs2, char *gname, char *cname, diff_opt_t *opt); diff --git a/mfhdf/hrepack/hrepack_main.c b/mfhdf/hrepack/hrepack_main.c index 56dfa589b5..c55b9351b7 100644 --- a/mfhdf/hrepack/hrepack_main.c +++ b/mfhdf/hrepack/hrepack_main.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "hdf.h" -#include "hfile.h" +#include "hfile_priv.h" #include "mfhdf.h" #include "hrepack.h" #include "hrepack_parse.h" diff --git a/mfhdf/libsrc/CMakeLists.txt b/mfhdf/libsrc/CMakeLists.txt index 6d17d7fc0f..56dc6539d1 100644 --- a/mfhdf/libsrc/CMakeLists.txt +++ b/mfhdf/libsrc/CMakeLists.txt @@ -5,7 +5,7 @@ project (HDF4_MFHDF_LIBSRC C) # Generate the netcdf.h file containing user settings needed by compilation #----------------------------------------------------------------------------- if (WIN32) - set (H4_WINDOWS_INCLUDE_FILE "#include ") + set (H4_WINDOWS_INCLUDE_FILE "#include ") set (NETCDF_EXTERN HDFLIBAPI) else () set (NETCDF_EXTERN extern) @@ -38,15 +38,14 @@ set (HDF4_MFHDF_LIBSRC_INSTALL_CHDRS ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/hdf2netcdf.h ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfdatainfo.h ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfhdf.h - ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfhdfi.h ) set (HDF4_MFHDF_LIBSRC_CHDRS ${HDF4_MFHDF_LIBSRC_INSTALL_CHDRS} - ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/error.h - ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/h4_xdr.h - ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/local_nc.h - ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mfprivate.h + ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/error_priv.h + ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/h4_xdr_priv.h + ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/mf_priv.h + ${HDF4_MFHDF_LIBSRC_SOURCE_DIR}/nc_priv.h ) if (HDF4_ENABLE_NETCDF) diff --git a/mfhdf/libsrc/Makefile.am b/mfhdf/libsrc/Makefile.am index dae0e31b7f..ffef141c44 100644 --- a/mfhdf/libsrc/Makefile.am +++ b/mfhdf/libsrc/Makefile.am @@ -36,11 +36,9 @@ endif libmfhdf_la_LIBADD = $(top_builddir)/hdf/src/libdf.la if HDF_BUILD_NETCDF -include_HEADERS = hdf2netcdf.h mfhdf.h netcdf.h mfdatainfo.h \ - mfhdfi.h +include_HEADERS = hdf2netcdf.h mfhdf.h netcdf.h mfdatainfo.h else -include_HEADERS = hdf2netcdf.h mfhdf.h hdf4_netcdf.h mfdatainfo.h \ - mfhdfi.h +include_HEADERS = hdf2netcdf.h mfhdf.h hdf4_netcdf.h mfdatainfo.h endif # The following is a workaround. Since Fortran is included in this diff --git a/mfhdf/libsrc/array.c b/mfhdf/libsrc/array.c index f821696965..5b7b105548 100644 --- a/mfhdf/libsrc/array.c +++ b/mfhdf/libsrc/array.c @@ -14,7 +14,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" +#include "nc_priv.h" /* * for a netcdf type diff --git a/mfhdf/libsrc/attr.c b/mfhdf/libsrc/attr.c index 762af6a562..5f3ddb9db4 100644 --- a/mfhdf/libsrc/attr.c +++ b/mfhdf/libsrc/attr.c @@ -14,7 +14,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" +#include "nc_priv.h" NC_attr * NC_new_attr(const char *name, nc_type type, unsigned count, const void *values) diff --git a/mfhdf/libsrc/cdf.c b/mfhdf/libsrc/cdf.c index b19edc59d5..595f7d9739 100644 --- a/mfhdf/libsrc/cdf.c +++ b/mfhdf/libsrc/cdf.c @@ -14,10 +14,10 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" -#include "herr.h" +#include "nc_priv.h" +#include "herr_priv.h" -#include "hfile.h" +#include "hfile_priv.h" int32 hdf_get_magicnum(const char *filename); diff --git a/mfhdf/libsrc/dim.c b/mfhdf/libsrc/dim.c index 73bc28794b..08ca191f66 100644 --- a/mfhdf/libsrc/dim.c +++ b/mfhdf/libsrc/dim.c @@ -14,7 +14,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" +#include "nc_priv.h" NC_dim * NC_new_dim(const char *name, long size) diff --git a/mfhdf/libsrc/error.c b/mfhdf/libsrc/error.c index 3b57466072..1e910c8e3e 100644 --- a/mfhdf/libsrc/error.c +++ b/mfhdf/libsrc/error.c @@ -22,7 +22,7 @@ #include #include -#include "local_nc.h" +#include "nc_priv.h" /* * Log SYSTEM errors diff --git a/mfhdf/libsrc/error.h b/mfhdf/libsrc/error_priv.h similarity index 100% rename from mfhdf/libsrc/error.h rename to mfhdf/libsrc/error_priv.h diff --git a/mfhdf/libsrc/file.c b/mfhdf/libsrc/file.c index d7a8d4766e..a2cf72074e 100644 --- a/mfhdf/libsrc/file.c +++ b/mfhdf/libsrc/file.c @@ -16,8 +16,8 @@ #include -#include "local_nc.h" -#include "herr.h" +#include "nc_priv.h" +#include "herr_priv.h" #if defined H4_HAVE_WIN32_API && !defined __MINGW32__ typedef int pid_t; diff --git a/mfhdf/libsrc/globdef.c b/mfhdf/libsrc/globdef.c index 49884fbf76..8a55f3d40d 100644 --- a/mfhdf/libsrc/globdef.c +++ b/mfhdf/libsrc/globdef.c @@ -19,7 +19,7 @@ * to allow the creation of SunOS sharable-libraries. */ -#include "local_nc.h" +#include "nc_priv.h" #ifdef H4_HAVE_NETCDF #include "netcdf.h" diff --git a/mfhdf/libsrc/h4_xdr.c b/mfhdf/libsrc/h4_xdr.c index 689a44ba2b..14bf7cc69c 100644 --- a/mfhdf/libsrc/h4_xdr.c +++ b/mfhdf/libsrc/h4_xdr.c @@ -36,14 +36,14 @@ * xdr. */ -#include "local_nc.h" +#include "nc_priv.h" /* Which header files include htonl() ? */ #ifdef H4_HAVE_WIN32_API /* Use winsock on Win32 (including MinGW) * - * This is included in hdfi.h to ensure winsock2.h is included before + * This is included in hdf_priv.h to ensure winsock2.h is included before * windows.h. */ #else @@ -56,7 +56,7 @@ #endif #endif -#include "h4_xdr.h" +#include "h4_xdr_priv.h" /* * This is the number of bytes per unit of external data. diff --git a/mfhdf/libsrc/h4_xdr.h b/mfhdf/libsrc/h4_xdr_priv.h similarity index 97% rename from mfhdf/libsrc/h4_xdr.h rename to mfhdf/libsrc/h4_xdr_priv.h index 1ea2cf27ba..1c8a1b2aca 100644 --- a/mfhdf/libsrc/h4_xdr.h +++ b/mfhdf/libsrc/h4_xdr_priv.h @@ -32,10 +32,10 @@ * Copyright (C) 1984, Sun Microsystems, Inc. */ -#ifndef H4_XDR_H -#define H4_XDR_H +#ifndef H4_XDR_PRIV_H +#define H4_XDR_PRIV_H -#include "local_nc.h" +#include "nc_priv.h" /* NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE * @@ -120,4 +120,4 @@ HDFLIBAPI void h4_xdr_setup_nofile(XDR *xdrs, int ncop); } #endif -#endif /* H4_XDR_H */ +#endif /* H4_XDR_PRIV_H */ diff --git a/mfhdf/libsrc/hdfsds.c b/mfhdf/libsrc/hdfsds.c index 3f17bd6784..5a5cf8847e 100644 --- a/mfhdf/libsrc/hdfsds.c +++ b/mfhdf/libsrc/hdfsds.c @@ -72,7 +72,7 @@ **************************************************************************/ -#include "local_nc.h" +#include "nc_priv.h" #define SDG_MAX_INITIAL 100 diff --git a/mfhdf/libsrc/iarray.c b/mfhdf/libsrc/iarray.c index 8d20ba81b8..aee9700b90 100644 --- a/mfhdf/libsrc/iarray.c +++ b/mfhdf/libsrc/iarray.c @@ -14,7 +14,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" +#include "nc_priv.h" /* values: VAX C doesn't like values[] */ NC_iarray * diff --git a/mfhdf/libsrc/mfprivate.h b/mfhdf/libsrc/mf_priv.h similarity index 93% rename from mfhdf/libsrc/mfprivate.h rename to mfhdf/libsrc/mf_priv.h index c1b0d0325b..22cf0f506d 100644 --- a/mfhdf/libsrc/mfprivate.h +++ b/mfhdf/libsrc/mf_priv.h @@ -11,7 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /****************************************************************************** -file - mfprivate.h +file - mf_priv.h This file contains prototypes of private functions that are implemented in mfsd.c. Some of them are used by new functions in mfdatainfo.c. @@ -19,13 +19,12 @@ file - mfprivate.h separately from the rest of the API. These functions were introduced by the hmap project. - Aug 8, 2010 -BMR ******************************************************************************/ -#ifndef MFH4_MFPRIVATE_H -#define MFH4_MFPRIVATE_H +#ifndef MFH4_MF_PRIV_H +#define MFH4_MF_PRIV_H -#include "local_nc.h" +#include "nc_priv.h" /* Get the dimension record */ NC_dim *SDIget_dim(NC *handle, int32 id); @@ -51,4 +50,4 @@ intn SDIapfromid(int32 id, NC **handlep, NC_array ***app); /* Check permission on the file */ int SDI_can_clobber(const char *name); -#endif /* MFH4_MFPRIVATE_H */ +#endif /* MFH4_MF_PRIV_H */ diff --git a/mfhdf/libsrc/mfdatainfo.c b/mfhdf/libsrc/mfdatainfo.c index fb51ebe829..2b8bd84186 100644 --- a/mfhdf/libsrc/mfdatainfo.c +++ b/mfhdf/libsrc/mfdatainfo.c @@ -41,7 +41,7 @@ LOCAL ROUTINES ******************************************************************************/ -#include "local_nc.h" +#include "nc_priv.h" #ifndef DATAINFO_MASTER #define DATAINFO_MASTER @@ -58,7 +58,7 @@ LOCAL ROUTINES #ifdef MFSD_INTERNAL /* Local function prototypes */ -#include "mfprivate.h" +#include "mf_priv.h" #endif static intn get_attr_tag(char *attr_name, uint16 *attr_tag); diff --git a/mfhdf/libsrc/mfhdf.h b/mfhdf/libsrc/mfhdf.h index 192426e2d9..c918dd2635 100644 --- a/mfhdf/libsrc/mfhdf.h +++ b/mfhdf/libsrc/mfhdf.h @@ -29,8 +29,6 @@ #include "hdf4_netcdf.h" #endif -#include "mfhdfi.h" - #define SD_UNLIMITED NC_UNLIMITED /* use this as marker for unlimited dimension */ #define SD_NOFILL NC_NOFILL #define SD_FILL NC_FILL @@ -38,6 +36,17 @@ #define SD_DIMVAL_BW_INCOMP 0 #define SD_RAGGED -1 /* marker for ragged dimension */ +/* enumerated type used to specify whether a variable is an SDS, coordinate + * variable, or its type is unknown because it was created before HDF4.2r2 + * + * NOTE: Formerly in mfhdfi.h + */ +typedef enum { + IS_SDSVAR = 0, /* variable is an actual SDS */ + IS_CRDVAR = 1, /* variable is a coordinate variable */ + UNKNOWN = 2 /* variable is created before HDF4.2r2, unknown type */ +} hdf_vartype_t; + /* used to indicate the type of the variable at an index */ typedef struct hdf_varlist { int32 var_index; /* index of the current variable */ diff --git a/mfhdf/libsrc/mfhdfi.h b/mfhdf/libsrc/mfhdfi.h deleted file mode 100644 index 84ecf2ae2a..0000000000 --- a/mfhdf/libsrc/mfhdfi.h +++ /dev/null @@ -1,25 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF. The full HDF copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. * - * If you do not have access to either file, you may request a copy from * - * help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifndef MFH4_MFHDFI_H -#define MFH4_MFHDFI_H - -/* enumerated type used to specify whether a variable is an SDS, coordinate - variable, or its type is unknown because it was created before HDF4.2r2 */ -typedef enum { - IS_SDSVAR = 0, /* variable is an actual SDS */ - IS_CRDVAR = 1, /* variable is a coordinate variable */ - UNKNOWN = 2 /* variable is created before HDF4.2r2, unknown type */ -} hdf_vartype_t; - -#endif /* MFH4_MFHDFI_H */ diff --git a/mfhdf/libsrc/mfsd.c b/mfhdf/libsrc/mfsd.c index 033abd0b5e..4ac005077a 100644 --- a/mfhdf/libsrc/mfsd.c +++ b/mfhdf/libsrc/mfsd.c @@ -83,10 +83,10 @@ NOTE: This file needs to have the comments cleaned up for most of the ******************************************************************************/ -#include "local_nc.h" +#include "nc_priv.h" #include "mfhdf.h" -#include "hfile.h" +#include "hfile_priv.h" #ifdef H4_HAVE_LIBSZ /* we have the szip library */ #include "szlib.h" @@ -101,7 +101,7 @@ NOTE: This file needs to have the comments cleaned up for most of the #ifdef MFSD_INTERNAL /* Private function prototypes */ -#include "mfprivate.h" +#include "mf_priv.h" #endif intn SDsetup_szip_parms(int32 id, NC *handle, comp_info *c_info, int32 *cdims); diff --git a/mfhdf/libsrc/local_nc.h b/mfhdf/libsrc/nc_priv.h similarity index 99% rename from mfhdf/libsrc/local_nc.h rename to mfhdf/libsrc/nc_priv.h index 4e7d710091..8bc0fdae02 100644 --- a/mfhdf/libsrc/local_nc.h +++ b/mfhdf/libsrc/nc_priv.h @@ -17,7 +17,7 @@ #ifndef MFH4_LOCAL_NC_H #define MFH4_LOCAL_NC_H -#include "hdfi.h" +#include "hdf_priv.h" /* * netcdf library 'private' data structures, objects and interfaces @@ -28,7 +28,7 @@ #endif /* HDF4's stripped-down XDR implementation */ -#include "h4_xdr.h" +#include "h4_xdr_priv.h" #ifdef H4_HAVE_NETCDF #include "netcdf.h" /* needed for defs of nc_type, ncvoid, ... */ @@ -53,8 +53,8 @@ */ #include "vg.h" -#include "hfile.h" -#include "mfhdfi.h" +#include "hfile_priv.h" +#include "mfhdf.h" #define ATTR_TAG DFTAG_VH #define DIM_TAG DFTAG_VG diff --git a/mfhdf/libsrc/nssdc.c b/mfhdf/libsrc/nssdc.c index 9f4bfc5719..19e9289b75 100644 --- a/mfhdf/libsrc/nssdc.c +++ b/mfhdf/libsrc/nssdc.c @@ -11,8 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" -#include "hfile.h" +#include "nc_priv.h" +#include "hfile_priv.h" /* constants/macros pulled out of the CDF library source */ #define V2_CDR_OFFSET 8 diff --git a/mfhdf/libsrc/putget.c b/mfhdf/libsrc/putget.c index 992bddbccd..bb81a35e14 100644 --- a/mfhdf/libsrc/putget.c +++ b/mfhdf/libsrc/putget.c @@ -14,8 +14,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" -#include "hfile.h" +#include "nc_priv.h" +#include "hfile_priv.h" /* Local function prototypes */ static bool_t nssdc_xdr_NCvdata(NC *handle, NC_var *vp, unsigned long where, nc_type type, uint32 count, diff --git a/mfhdf/libsrc/putgetg.c b/mfhdf/libsrc/putgetg.c index 8c31c6012f..288d7483b5 100644 --- a/mfhdf/libsrc/putgetg.c +++ b/mfhdf/libsrc/putgetg.c @@ -23,7 +23,7 @@ * */ -#include "local_nc.h" +#include "nc_priv.h" /* * Perform I/O on a generalized hyperslab. The efficiency of this diff --git a/mfhdf/libsrc/sharray.c b/mfhdf/libsrc/sharray.c index fa737a91ac..16bc17609f 100644 --- a/mfhdf/libsrc/sharray.c +++ b/mfhdf/libsrc/sharray.c @@ -14,7 +14,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" +#include "nc_priv.h" /* you may wish to tune this: big on a cray, small on a PC? */ #define NC_SHRT_BUFSIZ 8192 diff --git a/mfhdf/libsrc/string.c b/mfhdf/libsrc/string.c index 934bb8a5bb..413e6126c9 100644 --- a/mfhdf/libsrc/string.c +++ b/mfhdf/libsrc/string.c @@ -14,7 +14,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" +#include "nc_priv.h" static uint32 compute_hash(unsigned count, const char *str) diff --git a/mfhdf/libsrc/var.c b/mfhdf/libsrc/var.c index 830a168c45..38a0886055 100644 --- a/mfhdf/libsrc/var.c +++ b/mfhdf/libsrc/var.c @@ -14,7 +14,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "local_nc.h" +#include "nc_priv.h" NC_var * NC_new_var(const char *name, nc_type type, int ndims, const int *dims) diff --git a/mfhdf/ncdump/ncdump.c b/mfhdf/ncdump/ncdump.c index d77dcf149c..bff4267d50 100644 --- a/mfhdf/ncdump/ncdump.c +++ b/mfhdf/ncdump/ncdump.c @@ -8,7 +8,7 @@ #include #include -#include "local_nc.h" +#include "nc_priv.h" #include "ncdump.h" #include "h4getopt.h" diff --git a/mfhdf/ncgen/ncgen.h b/mfhdf/ncgen/ncgen.h index f874192042..746c225198 100644 --- a/mfhdf/ncgen/ncgen.h +++ b/mfhdf/ncgen/ncgen.h @@ -6,7 +6,7 @@ #ifndef H4NC_NCGEN_H #define H4NC_NCGEN_H -#include "local_nc.h" +#include "nc_priv.h" #include "generic.h" /* defines union generic */ #define H4_MAX_NC_ATTSIZE 2000 /* max size in bytes of an attribute */ diff --git a/mfhdf/test/tdatainfo.c b/mfhdf/test/tdatainfo.c index fa8937c8d1..77f6464e45 100644 --- a/mfhdf/test/tdatainfo.c +++ b/mfhdf/test/tdatainfo.c @@ -27,7 +27,7 @@ #include #include -#include "hdfi.h" +#include "hdf_priv.h" #include "mfhdf.h" #ifdef H4_HAVE_FCNTL_H diff --git a/mfhdf/test/texternal.c b/mfhdf/test/texternal.c index 56934c502c..1b4b075d64 100644 --- a/mfhdf/test/texternal.c +++ b/mfhdf/test/texternal.c @@ -15,7 +15,7 @@ #include /* Need to pick up H4_HAVE_SYS_STAT_H from mfhdf.h */ -#include "hdfi.h" +#include "hdf_priv.h" #include "mfhdf.h" #ifdef H4_HAVE_UNISTD_H diff --git a/mfhdf/test/tfile.c b/mfhdf/test/tfile.c index 8ef915fed4..72b1a4204b 100644 --- a/mfhdf/test/tfile.c +++ b/mfhdf/test/tfile.c @@ -14,7 +14,7 @@ #include "mfhdf.h" #include "hdftest.h" -#include "local_nc.h" +#include "nc_priv.h" /******************************************************************** Name: test_file_inuse() - tests preventing of an in-use file being diff --git a/mfhdf/test/tsd.c b/mfhdf/test/tsd.c index c3a14a838d..0ceac18e3e 100644 --- a/mfhdf/test/tsd.c +++ b/mfhdf/test/tsd.c @@ -18,7 +18,7 @@ #include "mfhdf.h" #include "hdftest.h" -#include "hfile.h" +#include "hfile_priv.h" #define FILE_NAME "sdtest.hdf" /* data file to test ID types */ diff --git a/release_notes/RELEASE.txt b/release_notes/RELEASE.txt index 7a282fa02a..9667e7a884 100644 --- a/release_notes/RELEASE.txt +++ b/release_notes/RELEASE.txt @@ -159,7 +159,6 @@ New features and changes hkit.h linklist.h local_nc.h - mfan.h mfani.h mfgri.h mstdio.h From 86435f0442db4a4f142754b2c408e3e56b7f4e39 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 21 Feb 2024 17:51:40 -0600 Subject: [PATCH 64/65] Add aocc workflows (#578) --- .github/workflows/aocc-auto.yml | 150 +++++++++++++++++++++++++++++++ .github/workflows/aocc-cmake.yml | 77 ++++++++++++++++ .github/workflows/autotools.yml | 6 ++ .github/workflows/cmake.yml | 6 ++ 4 files changed, 239 insertions(+) create mode 100644 .github/workflows/aocc-auto.yml create mode 100644 .github/workflows/aocc-cmake.yml diff --git a/.github/workflows/aocc-auto.yml b/.github/workflows/aocc-auto.yml new file mode 100644 index 0000000000..c9357090f6 --- /dev/null +++ b/.github/workflows/aocc-auto.yml @@ -0,0 +1,150 @@ +name: hdf4 autotools aocc + +on: + workflow_call: + inputs: + build_mode: + description: "release vs. debug build" + required: true + type: string + +permissions: + contents: read + +jobs: + aocc_build_and_test: + name: "aocc ${{ inputs.build_mode }}" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + + - name: Install System dependencies + run: | + sudo apt update + sudo apt install -y libaec-dev zlib1g-dev automake autoconf libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev doxygen openssl libtool libtool-bin build-essential libncurses-dev libquadmath0 libstdc++6 libxml2 + + - name: Install AOCC 4.1.0 + run: | + wget https://download.amd.com/developer/eula/aocc/aocc-4-1/aocc-compiler-4.1.0.tar + tar -xvf aocc-compiler-4.1.0.tar + cd aocc-compiler-4.1.0 + bash install.sh + source /home/runner/work/hdf4/hdf4/setenv_AOCC.sh + which clang + which flang + clang -v + echo "CC=/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/bin/clang" >> $GITHUB_ENV + echo "FC=/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/bin/flang" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/lib:/usr/local/lib" >> $GITHUB_ENV + echo "LD_RUN_PATH=/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/lib:/usr/local/lib" >> $GITHUB_ENV + echo "DESTDIR=/tmp" >> $GITHUB_ENV + + - name: Autotools Configure with aocc + shell: bash + run: | + source /home/runner/work/hdf4/hdf4/setenv_AOCC.sh + export PATH=/usr/local/bin:$PATH + sh ./autogen.sh + mkdir "${{ runner.workspace }}/build" + cd "${{ runner.workspace }}/build" + $GITHUB_WORKSPACE/configure \ + --enable-build-mode=${{ inputs.build_mode }} \ + --enable-netcdf \ + --enable-shared \ + --disable-fortran \ + LDFLAGS="-L/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/lib" + + # BUILD + - name: Autotools Build + shell: bash + run: | + source /home/runner/work/hdf4/hdf4/setenv_AOCC.sh + export PATH=/usr/local/bin:$PATH + make -j3 + working-directory: ${{ runner.workspace }}/build + + # RUN TESTS + # NORMAL + - name: Autotools Run Tests + run: | + source /home/runner/work/hdf4/hdf4/setenv_AOCC.sh + export PATH=/usr/local/bin:$PATH + make check -j2 + working-directory: ${{ runner.workspace }}/build + + # INSTALL (note that this runs even when we don't run the tests) + - name: Autotools Install + run: | + source /home/runner/work/hdf4/hdf4/setenv_AOCC.sh + export PATH=/usr/local/bin:$PATH + make install + working-directory: ${{ runner.workspace }}/build + + aocc_static_build_and_test: + name: "aocc static ${{ inputs.build_mode }}" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + + - name: Install System dependencies + run: | + sudo apt update + sudo apt install -y libaec-dev zlib1g-dev automake autoconf libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev doxygen openssl libtool libtool-bin build-essential libncurses-dev libquadmath0 libstdc++6 libxml2 + + - name: Install AOCC 4.1.0 + run: | + wget https://download.amd.com/developer/eula/aocc/aocc-4-1/aocc-compiler-4.1.0.tar + tar -xvf aocc-compiler-4.1.0.tar + cd aocc-compiler-4.1.0 + bash install.sh + source /home/runner/work/hdf4/hdf4/setenv_AOCC.sh + which clang + which flang + clang -v + echo "CC=/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/bin/clang" >> $GITHUB_ENV + echo "FC=/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/bin/flang" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/lib:/usr/local/lib" >> $GITHUB_ENV + echo "LD_RUN_PATH=/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/lib:/usr/local/lib" >> $GITHUB_ENV + echo "DESTDIR=/tmp" >> $GITHUB_ENV + + - name: Autotools Configure with aocc + shell: bash + run: | + source /home/runner/work/hdf4/hdf4/setenv_AOCC.sh + export PATH=/usr/local/bin:$PATH + sh ./autogen.sh + mkdir "${{ runner.workspace }}/build" + cd "${{ runner.workspace }}/build" + $GITHUB_WORKSPACE/configure \ + --enable-build-mode=${{ inputs.build_mode }} \ + --enable-netcdf \ + --disable-shared \ + --enable-fortran \ + LDFLAGS="-L/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/lib" + + # BUILD + - name: Autotools Build + shell: bash + run: | + source /home/runner/work/hdf4/hdf4/setenv_AOCC.sh + export PATH=/usr/local/bin:$PATH + make -j3 + working-directory: ${{ runner.workspace }}/build + + # RUN TESTS + # NORMAL + - name: Autotools Run Tests + run: | + source /home/runner/work/hdf4/hdf4/setenv_AOCC.sh + export PATH=/usr/local/bin:$PATH + make check -j2 + working-directory: ${{ runner.workspace }}/build + + # INSTALL (note that this runs even when we don't run the tests) + - name: Autotools Install + run: | + source /home/runner/work/hdf4/hdf4/setenv_AOCC.sh + export PATH=/usr/local/bin:$PATH + make install + working-directory: ${{ runner.workspace }}/build + diff --git a/.github/workflows/aocc-cmake.yml b/.github/workflows/aocc-cmake.yml new file mode 100644 index 0000000000..b44bf8a328 --- /dev/null +++ b/.github/workflows/aocc-cmake.yml @@ -0,0 +1,77 @@ +name: hdf4 CMake aocc + +on: + workflow_call: + inputs: + build_mode: + description: "release vs. debug build" + required: true + type: string + +permissions: + contents: read + +jobs: + aocc_build_and_test: + name: "aocc ${{ inputs.build_mode }}" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.1 + + - name: Install Linux dependencies + shell: bash + run: | + sudo apt update + sudo apt-get install ninja-build doxygen graphviz + sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev + sudo apt install -y libaec-dev zlib1g-dev wget curl bzip2 flex bison cmake libzip-dev openssl build-essential + + - name: Install AOCC 4.1.0 + run: | + wget https://download.amd.com/developer/eula/aocc/aocc-4-1/aocc-compiler-4.1.0.tar + tar -xvf aocc-compiler-4.1.0.tar + cd aocc-compiler-4.1.0 + bash install.sh + source /home/runner/work/hdf4/hdf4/setenv_AOCC.sh + which clang + which flang + clang -v + echo "CC=/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/bin/clang" >> $GITHUB_ENV + echo "FC=/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/bin/flang" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/lib:/usr/local/lib" >> $GITHUB_ENV + echo "LD_RUN_PATH=/home/runner/work/hdf4/hdf4/aocc-compiler-4.1.0/lib:/usr/local/lib" >> $GITHUB_ENV + echo "DESTDIR=/tmp" >> $GITHUB_ENV + + - name: CMake Configure with aocc + shell: bash + run: | + source /home/runner/work/hdf4/hdf4/setenv_AOCC.sh + export PATH=/usr/local/bin:$PATH + mkdir "${{ runner.workspace }}/build" + cd "${{ runner.workspace }}/build" + cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake -G Ninja \ + -DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} \ + -DJPEG_USE_LOCALCONTENT=OFF \ + -DLIBAEC_USE_LOCALCONTENT=OFF \ + -DZLIB_USE_LOCALCONTENT=OFF \ + -DHDF4_BUILD_FORTRAN:BOOL=ON \ + -DHDF4_BUILD_JAVA:BOOL=OFF \ + $GITHUB_WORKSPACE + + # BUILD + - name: CMake Build + shell: bash + run: | + source /home/runner/work/hdf4/hdf4/setenv_AOCC.sh + export PATH=/usr/local/bin:$PATH + cmake --build . --parallel 3 --config ${{ inputs.build_mode }} + working-directory: ${{ runner.workspace }}/build + + # RUN TESTS + - name: CMake Run Tests + shell: bash + run: | + source /home/runner/work/hdf4/hdf4/setenv_AOCC.sh + export PATH=/usr/local/bin:$PATH + ctest . --parallel 2 -C ${{ inputs.build_mode }} -V + working-directory: ${{ runner.workspace }}/build diff --git a/.github/workflows/autotools.yml b/.github/workflows/autotools.yml index 8b8c473060..0a5a6ea10f 100644 --- a/.github/workflows/autotools.yml +++ b/.github/workflows/autotools.yml @@ -54,3 +54,9 @@ jobs: uses: ./.github/workflows/nvhpc-auto.yml with: build_mode: "production" + + call-release-auto-aocc: + name: "Autotools aocc Workflows" + uses: ./.github/workflows/aocc-auto.yml + with: + build_mode: "production" diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 04331642b6..d8c3f40487 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -77,3 +77,9 @@ jobs: uses: ./.github/workflows/nvhpc-cmake.yml with: build_mode: "Release" + + call-release-cmake-aocc: + name: "CMake aocc Workflows" + uses: ./.github/workflows/aocc-cmake.yml + with: + build_mode: "Release" From 0ab5dab632533574061e3a14c0eb7e39d918c836 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" Date: Wed, 21 Feb 2024 17:52:10 -0600 Subject: [PATCH 65/65] Fix typo stolen^Wborrowed. (#575) --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index ba69238b00..f897235493 100644 --- a/configure.ac +++ b/configure.ac @@ -989,7 +989,7 @@ AC_CHECK_FUNCS([fork getrusage system wait]) ## Copy NetCDF header files. # -## FIXME: This is code stolen^Wborrowed from the old HDF4 configure. +## FIXME: This is code borrowed from the old HDF4 configure. ## These header files should probably be generated by autoconf instead ## of being copied depending upon the host. case "$host" in