33 #define HDFMAGIC "\016\003\023\001" 45 #define INVALID_OFFSET -1 46 #define INVALID_LENGTH -1 52 #define LIBVER_MAJOR 4 53 #define LIBVER_MINOR 2 54 #define LIBVER_RELEASE 14 55 #define LIBVER_SUBRELEASE "" 57 #define LIBVER_STRING "HDF Version 4.2 Release 14, June 26, 2018" 58 #define LIBVSTR_LEN 80 67 # define FILELIB UNIXBUFIO 70 #if (FILELIB == UNIXBUFIO) 74 #if defined SUN && defined (__GNUC__) 75 # define HI_OPEN(p, a) (((a) & DFACC_WRITE) ? \ 76 fopen((p), "r+") : fopen((p), "r")) 77 # define HI_CREATE(p) (fopen((p), "w+")) 79 # define HI_OPEN(p, a) (((a) & DFACC_WRITE) ? \ 80 fopen((p), "rb+") : fopen((p), "rb")) 81 # define HI_CREATE(p) (fopen((p), "wb+")) 83 # define HI_READ(f, b, n) (((size_t)(n) == (size_t)fread((b), 1, (size_t)(n), (f))) ? \ 85 # define HI_WRITE(f, b, n) (((size_t)(n) == (size_t)fwrite((b), 1, (size_t)(n), (f))) ? \ 87 # define HI_CLOSE(f) (((f = ((fclose(f)==0) ? NULL : f))==NULL) ? SUCCEED:FAIL) 88 # define HI_FLUSH(f) (fflush(f)==0 ? SUCCEED : FAIL) 89 # define HI_SEEK(f,o) (fseek((f), (long)(o), SEEK_SET)==0 ? SUCCEED : FAIL) 90 # define HI_SEEK_CUR(f,o) (fseek((f), (long)(o), SEEK_CUR)==0 ? SUCCEED : FAIL) 91 # define HI_SEEKEND(f) (fseek((f), (long)0, SEEK_END)==0 ? SUCCEED : FAIL) 92 # define HI_TELL(f) (ftell(f)) 93 # define OPENERR(f) ((f) == (FILE *)NULL) 96 #if (FILELIB == UNIXUNBUFIO) 99 # define HI_OPEN(p, a) (((a) & DFACC_WRITE) ? \ 100 open((p), O_RDWR) : open((p), O_RDONLY)) 101 # define HI_CREATE(p) (open((p), O_RDWR | O_CREAT | O_TRUNC, 0666)) 102 # define HI_CLOSE(f) (((f = ((close(f)==0) ? NULL : f))==NULL) ? SUCCEED:FAIL) 103 # define HI_FLUSH(f) (SUCCEED) 104 # define HI_READ(f, b, n) (((n)==read((f), (char *)(b), (n))) ? SUCCEED : FAIL) 105 # define HI_WRITE(f, b, n) (((n)==write((f), (char *)(b), (n))) ? SUCCEED : FAIL) 106 # define HI_SEEK(f, o) (lseek((f), (off_t)(o), SEEK_SET)!=(-1) ? SUCCEED : FAIL) 107 # define HI_SEEKEND(f) (lseek((f), (off_t)0, SEEK_END)!=(-1) ? SUCCEED : FAIL) 108 # define HI_TELL(f) (lseek((f), (off_t)0, SEEK_CUR)) 109 # define OPENERR(f) (f < 0) 112 #if (FILELIB == MACIO) 115 # define HI_OPEN(x,y) mopen(x,y) 116 # define HI_CREATE(name) mopen(name, DFACC_CREATE) 117 # define HI_CLOSE(x) (((x = ((mclose(x)==0) ? NULL : x))==NULL) ? SUCCEED:FAIL) 118 # define HI_FLUSH(a) (SUCCEED) 119 # define HI_READ(a,b,c) mread(a, (char *) b, (int32) c) 120 # define HI_WRITE(a,b,c) mwrite(a, (char *) b, (int32) c) 121 # define HI_SEEK(x,y) mlseek(x, (int32 )y, 0) 122 # define HI_SEEKEND(x) mlseek(x, 0L, 2) 123 # define HI_TELL(x) mlseek(x,0L,1) 124 # define DF_OPENERR(f) ((f) == -1) 125 # define OPENERR(f) (f < 0) 311 #define DDLIST_DIRTY 0x01 312 #define FILE_END_DIRTY 0x02 339 static accrec_t *accrec_free_list=NULL;
389 int32 (*inquire) (
accrec_t * access_rec, int32 *pfile_id,
390 uint16 *ptag, uint16 *pref, int32 *plength,
391 int32 *poffset, int32 *pposn, int16 *paccess,
395 intn (*endaccess) (
accrec_t * access_rec);
426 #define BADFREC(r) ((r)==NULL || (r)->refcount==0) 440 #define BASETAG(t) (HDbase_tag(t)) 441 #define SPECIALTAG(t) (HDis_special_tag(t)) 442 #define MKSPECIALTAG(t) (HDmake_special_tag(t)) 445 #define BASETAG(t) (uint16)((~(t) & 0x8000) ? ((t) & ~0x4000) : (t)) 447 #define SPECIALTAG(t) (uint16)((~(t) & 0x8000) && ((t) & 0x4000)) 449 #define MKSPECIALTAG(t) (uint16)((~(t) & 0x8000) ? ((t) | 0x4000) : DFTAG_NULL) 460 #if defined c_plusplus || defined __cplusplus 474 (
const void * obj,
const void * key);
477 (
const void * rec1,
const void * rec2);
483 (
filerec_t * file_rec, int32 block_offset, int32 block_size);
489 (int32 file_id, uint16
tag, uint16
ref, intn *emptySDS);
504 (
filerec_t *file_rec,
const void * buf,int32 bytes);
507 (int32 file_id,
atom_t data_id, uint8** drec_buf);
510 (
void * k1,
void * k2, intn cmparg);
531 (
accrec_t * access_rec, int32 length,
const void * data);
534 (
accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
535 int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
557 (
accrec_t * access_rec, int32 offset,
int origin);
560 (
accrec_t * access_rec, int32 length,
void * data);
563 (
accrec_t * access_rec, int32 length,
const void * data);
566 (
accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
567 int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
599 (
accrec_t * access_rec, int32 offset,
int origin);
602 (
accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
603 int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
607 (
accrec_t * access_rec, int32 length,
void * data);
610 (
accrec_t * access_rec, int32 length,
const void * data);
641 (
accrec_t * access_rec, int32 offset,
int origin);
644 (
accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
645 int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
649 (
accrec_t * access_rec, int32 length,
void * data);
652 (
accrec_t * access_rec, int32 length,
const void * data);
674 (
accrec_t * access_rec, int32 offset,
int origin);
677 (
accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
678 int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
682 (
accrec_t * access_rec, int32 length,
void * data);
685 (
accrec_t * access_rec, int32 length,
const void * data);
899 #if defined c_plusplus || defined __cplusplus 904 #ifdef DISKBLOCK_DEBUG 909 const uint8 diskblock_header[4]
911 ={0xde, 0xad, 0xbe, 0xef}
918 const uint8 diskblock_tail[4]
920 ={0xfe, 0xeb, 0xda, 0xed}
923 #define DISKBLOCK_HSIZE sizeof(diskblock_header) 924 #define DISKBLOCK_TSIZE sizeof(diskblock_tail) HDFLIBAPI int32 get_comp_len(accrec_t *access_rec)
HDFLIBAPI intn HXPshutdown(void)
HDFLIBAPI int32 HPgetdiskblock(filerec_t *file_rec, int32 block_size, intn moveto)
HDFLIBAPI int32 HXPread(accrec_t *access_rec, int32 length, void *data)
HDFLIBAPI int32 HCPcloseAID(accrec_t *access_rec)
HDFLIBAPI intn HPcompare_filerec_path(const void *obj, const void *key)
HDFFCLIBAPI intf intf * release
HDFFCLIBAPI intf * block_size
HDFLIBAPI intn HXPendaccess(accrec_t *access_rec)
HDFLIBAPI int32 HBPcloseAID(accrec_t *access_rec)
intn HTPdump_dds(int32 file_id, FILE *fout)
HDFLIBAPI intn HBPendaccess(accrec_t *access_rec)
intn HTPsync(filerec_t *file_rec)
intn HTPinit(filerec_t *file_rec, int16 ndds)
HDFLIBAPI int32 HCPseek(accrec_t *access_rec, int32 offset, int origin)
struct ddblock_t ddblock_t
HDFLIBAPI int32 HRPstread(accrec_t *rec)
HDFFCLIBAPI intf intf * comp_type
HDFLIBAPI int32 HBPinquire(accrec_t *access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref, int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess, int16 *pspecial)
HDFLIBAPI intn HP_read(filerec_t *file_rec, void *buf, int32 bytes)
intn HTPis_special(atom_t ddid)
HDFLIBAPI int32 HLPread(accrec_t *access_rec, int32 length, void *data)
HDFLIBAPI int32 HDset_special_info(int32 access_id, sp_info_block_t *info_block)
HDFLIBAPI accrec_t * HIget_access_rec(void)
HDFLIBAPI int32 HRPseek(accrec_t *access_rec, int32 offset, int origin)
HDFLIBAPI int32 HBPinfo(accrec_t *access_rec, sp_info_block_t *info_block)
HDFLIBAPI intn HCPendaccess(accrec_t *access_rec)
HDFLIBAPI int32 HCPread(accrec_t *access_rec, int32 length, void *data)
HDFLIBAPI int32 HXPinfo(accrec_t *access_rec, sp_info_block_t *info_block)
HDFLIBAPI intn HLPendaccess(accrec_t *access_rec)
HDFLIBAPI int32 HBPstread(accrec_t *rec)
HDFLIBAPI int32 HXPseek(accrec_t *access_rec, int32 offset, int origin)
intn HTPupdate(atom_t ddid, int32 new_off, int32 new_len)
HDFLIBAPI int32 HBPseek(accrec_t *access_rec, int32 offset, int origin)
HDFLIBAPI intn tagcompare(void *k1, void *k2, intn cmparg)
HDFLIBAPI void * HIgetspinfo(accrec_t *access_rec)
HDFLIBAPI int32 HBPstwrite(accrec_t *rec)
struct filerec_t filerec_t
intn HTPstart(filerec_t *file_rec)
atom_t HTPcreate(filerec_t *file_rec, uint16 tag, uint16 ref)
HDFLIBAPI int32 HRPinfo(accrec_t *access_rec, sp_info_block_t *info_block)
HDFLIBAPI int32 HRPstwrite(accrec_t *rec)
HDFLIBAPI int32 HRPcloseAID(accrec_t *access_rec)
intn HTPend(filerec_t *file_rec)
struct version_t version_t
HDFLIBAPI intn HPcompare_accrec_tagref(const void *rec1, const void *rec2)
HDFLIBAPI int32 HLPstread(accrec_t *access_rec)
HDFLIBAPI intn HP_write(filerec_t *file_rec, const void *buf, int32 bytes)
HDFFCLIBAPI intf * num_blocks
HDFLIBAPI int32 HDcheck_empty(int32 file_id, uint16 tag, uint16 ref, intn *emptySDS)
HDFLIBAPI int32 HPread_drec(int32 file_id, atom_t data_id, uint8 **drec_buf)
HDFLIBAPI VOID tagdestroynode(void *n)
HDFLIBAPI int32 HXPreset(accrec_t *access_rec, sp_info_block_t *info_block)
HDFLIBAPI int32 HCPinfo(accrec_t *access_rec, sp_info_block_t *info_block)
atom_t HTPselect(filerec_t *file_rec, uint16 tag, uint16 ref)
HDFFCLIBAPI _fcd _fcd intf * n
intn HTPinquire(atom_t ddid, uint16 *tag, uint16 *ref, int32 *off, int32 *len)
HDFLIBAPI intn HXPsetaccesstype(accrec_t *access_rec)
struct tag_info_str tag_info
HDFLIBAPI int32 HXPstread(accrec_t *rec)
HDFLIBAPI int32 HLPstwrite(accrec_t *access_rec)
HDFLIBAPI intn HPseek(filerec_t *file_rec, int32 offset)
struct bv_struct_tag * bv_ptr
HDFLIBAPI int32 HCPstread(accrec_t *rec)
struct funclist_t funclist_t
struct functab_t functab_t
HDFLIBAPI int32 HXPinquire(accrec_t *access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref, int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess, int16 *pspecial)
struct dynarray_tag * dynarr_p
HDFLIBAPI int32 HLPwrite(accrec_t *access_rec, int32 length, const void *data)
struct sp_info_block_t sp_info_block_t
HDFLIBAPI int32 HRPread(accrec_t *access_rec, int32 length, void *data)
HDFLIBAPI int32 HLPseek(accrec_t *access_rec, int32 offset, int origin)
HDFLIBAPI int32 HXPstwrite(accrec_t *rec)
HDFLIBAPI int32 HDget_special_info(int32 access_id, sp_info_block_t *info_block)
HDFLIBAPI int32 HXPcloseAID(accrec_t *access_rec)
HDFLIBAPI int32 HLPcloseAID(accrec_t *access_rec)
HDFLIBAPI int32 HBPread(accrec_t *access_rec, int32 length, void *data)
HDFLIBAPI int32 HBPwrite(accrec_t *access_rec, int32 length, const void *data)
HDFLIBAPI int32 HLPinquire(accrec_t *access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref, int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess, int16 *pspecial)
HDFLIBAPI int32 HCPwrite(accrec_t *access_rec, int32 length, const void *data)
HDFLIBAPI int32 HCPstwrite(accrec_t *rec)
intn HTPendaccess(atom_t ddid)
HDFLIBAPI intn HPisfile_in_use(const char *path)
HDFLIBAPI int32 HRPwrite(accrec_t *access_rec, int32 length, const void *data)
intn HTPdelete(atom_t ddid)
HDFLIBAPI intn HPfreediskblock(filerec_t *file_rec, int32 block_offset, int32 block_size)
HDFLIBAPI void HIrelease_accrec_node(accrec_t *acc)
HDFLIBAPI int32 HXPwrite(accrec_t *access_rec, int32 length, const void *data)
HDFLIBAPI intn HRPendaccess(accrec_t *access_rec)
HDFLIBAPI int32 HLPinfo(accrec_t *access_rec, sp_info_block_t *info_block)
HDFLIBAPI int32 HRPinquire(accrec_t *access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref, int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess, int16 *pspecial)
HDFLIBAPI int32 HCPinquire(accrec_t *access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref, int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess, int16 *pspecial)