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 6 55 #define LIBVER_SUBRELEASE "" 57 #define LIBVER_STRING "HDF Version 4.2 Release 6, June 14, 2011" 58 #define LIBVSTR_LEN 80 67 # define FILELIB UNIXBUFIO 70 #if (FILELIB == UNIXBUFIO) 76 # define HI_OPEN(p, a) (((a) & DFACC_WRITE) ? \ 77 fopen((p), "r+", "mbc=64") : \ 78 fopen((p), "r", "mbc=64")) 79 # define HI_CREATE(p) (fopen((p), "w+", "mbc=64")) 81 #if defined SUN && defined (__GNUC__) 82 # define HI_OPEN(p, a) (((a) & DFACC_WRITE) ? \ 83 fopen((p), "r+") : fopen((p), "r")) 84 # define HI_CREATE(p) (fopen((p), "w+")) 86 # define HI_OPEN(p, a) (((a) & DFACC_WRITE) ? \ 87 fopen((p), "rb+") : fopen((p), "rb")) 88 # define HI_CREATE(p) (fopen((p), "wb+")) 91 # define HI_READ(f, b, n) (((size_t)(n) == (size_t)fread((b), 1, (size_t)(n), (f))) ? \ 93 # define HI_WRITE(f, b, n) (((size_t)(n) == (size_t)fwrite((b), 1, (size_t)(n), (f))) ? \ 95 # define HI_CLOSE(f) (((f = ((fclose(f)==0) ? NULL : f))==NULL) ? SUCCEED:FAIL) 96 # define HI_FLUSH(f) (fflush(f)==0 ? SUCCEED : FAIL) 97 # define HI_SEEK(f,o) (fseek((f), (long)(o), SEEK_SET)==0 ? SUCCEED : FAIL) 98 # define HI_SEEK_CUR(f,o) (fseek((f), (long)(o), SEEK_CUR)==0 ? SUCCEED : FAIL) 99 # define HI_SEEKEND(f) (fseek((f), (long)0, SEEK_END)==0 ? SUCCEED : FAIL) 100 # define HI_TELL(f) (ftell(f)) 101 # define OPENERR(f) ((f) == (FILE *)NULL) 104 #if (FILELIB == UNIXUNBUFIO) 107 # define HI_OPEN(p, a) (((a) & DFACC_WRITE) ? \ 108 open((p), O_RDWR) : open((p), O_RDONLY)) 109 # define HI_CREATE(p) (open((p), O_RDWR | O_CREAT | O_TRUNC, 0666)) 110 # define HI_CLOSE(f) (((f = ((close(f)==0) ? NULL : f))==NULL) ? SUCCEED:FAIL) 111 # define HI_FLUSH(f) (SUCCEED) 112 # define HI_READ(f, b, n) (((n)==read((f), (char *)(b), (n))) ? SUCCEED : FAIL) 113 # define HI_WRITE(f, b, n) (((n)==write((f), (char *)(b), (n))) ? SUCCEED : FAIL) 114 # define HI_SEEK(f, o) (lseek((f), (off_t)(o), SEEK_SET)!=(-1) ? SUCCEED : FAIL) 115 # define HI_SEEKEND(f) (lseek((f), (off_t)0, SEEK_END)!=(-1) ? SUCCEED : FAIL) 116 # define HI_TELL(f) (lseek((f), (off_t)0, SEEK_CUR)) 117 # define OPENERR(f) (f < 0) 120 #if (FILELIB == MACIO) 123 # define HI_OPEN(x,y) mopen(x,y) 124 # define HI_CREATE(name) mopen(name, DFACC_CREATE) 125 # define HI_CLOSE(x) (((x = ((mclose(x)==0) ? NULL : x))==NULL) ? SUCCEED:FAIL) 126 # define HI_FLUSH(a) (SUCCEED) 127 # define HI_READ(a,b,c) mread(a, (char *) b, (int32) c) 128 # define HI_WRITE(a,b,c) mwrite(a, (char *) b, (int32) c) 129 # define HI_SEEK(x,y) mlseek(x, (int32 )y, 0) 130 # define HI_SEEKEND(x) mlseek(x, 0L, 2) 131 # define HI_TELL(x) mlseek(x,0L,1) 132 # define DF_OPENERR(f) ((f) == -1) 133 # define OPENERR(f) (f < 0) 319 #define DDLIST_DIRTY 0x01 320 #define FILE_END_DIRTY 0x02 347 static accrec_t *accrec_free_list=NULL;
393 int32 (*inquire) (
accrec_t * access_rec, int32 *pfile_id,
394 uint16 *ptag, uint16 *pref, int32 *plength,
395 int32 *poffset, int32 *pposn, int16 *paccess,
430 #define BADFREC(r) ((r)==NULL || (r)->refcount==0) 444 #define BASETAG(t) (HDbase_tag(t)) 445 #define SPECIALTAG(t) (HDis_special_tag(t)) 446 #define MKSPECIALTAG(t) (HDmake_special_tag(t)) 449 #define BASETAG(t) (uint16)((~(t) & 0x8000) ? ((t) & ~0x4000) : (t)) 451 #define SPECIALTAG(t) (uint16)((~(t) & 0x8000) && ((t) & 0x4000)) 453 #define MKSPECIALTAG(t) (uint16)((~(t) & 0x8000) ? ((t) | 0x4000) : DFTAG_NULL) 464 #if defined c_plusplus || defined __cplusplus 478 (
const void * obj,
const void * key);
481 (
const void * rec1,
const void * rec2);
487 (
filerec_t * file_rec, int32 block_offset, int32 block_size);
493 (int32 file_id, uint16
tag, uint16
ref, intn *emptySDS);
511 (
filerec_t *file_rec,
const void * buf,int32 bytes);
514 (int32 file_id,
atom_t data_id, uint8** drec_buf);
517 (
void * k1,
void * k2, intn cmparg);
538 (
accrec_t * access_rec, int32 length,
const void * data);
541 (
accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
542 int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
564 (
accrec_t * access_rec, int32 offset,
int origin);
567 (
accrec_t * access_rec, int32 length,
void * data);
570 (
accrec_t * access_rec, int32 length,
const void * data);
573 (
accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
574 int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
606 (
accrec_t * access_rec, int32 offset,
int origin);
609 (
accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
610 int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
614 (
accrec_t * access_rec, int32 length,
void * data);
617 (
accrec_t * access_rec, int32 length,
const void * data);
636 #if defined (MAC) || defined (macintosh) || defined (SYMANTEC_C) 667 (
accrec_t * access_rec, int32 offset,
int origin);
670 (
accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
671 int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
675 (
accrec_t * access_rec, int32 length,
void * data);
678 (
accrec_t * access_rec, int32 length,
const void * data);
700 (
accrec_t * access_rec, int32 offset,
int origin);
703 (
accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
704 int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
708 (
accrec_t * access_rec, int32 length,
void * data);
711 (
accrec_t * access_rec, int32 length,
const void * data);
925 #if defined c_plusplus || defined __cplusplus 930 #ifdef DISKBLOCK_DEBUG 935 const uint8 diskblock_header[4]
937 ={0xde, 0xad, 0xbe, 0xef}
944 const uint8 diskblock_tail[4]
946 ={0xfe, 0xeb, 0xda, 0xed}
949 #define DISKBLOCK_HSIZE sizeof(diskblock_header) 950 #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 * block_size
HDFLIBAPI intn HXPendaccess(accrec_t *access_rec)
HDFLIBAPI int32 HBPcloseAID(accrec_t *access_rec)
struct ddblock_t * ddnull
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)
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)
struct ddblock_t * ddlast
int32(* info)(accrec_t *access_rec, sp_info_block_t *info)
struct funclist_t * special_func
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 ddblock_t * ddhead
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)
HDFLIBAPI intn HDgetspecinfo(intn file_id, uint16 tag, uint16 ref, sp_info_block_t *info)
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)
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)