/*------------------------------------------------------------------------- * Function: H5O_fill_copy_dyn * * Purpose: Copy dynamic fill value fields * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Thursday, May 31, 2007 * *------------------------------------------------------------------------- */ static herr_t H5O_fill_copy_dyn(H5O_fill_t *dest, const H5O_fill_t *mesg) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5O_fill_copy_dyn) HDassert(dest); HDassert(mesg); /* Copy data type of fill value */ if(mesg->type) { if(NULL == (dest->type = H5T_copy(mesg->type, H5T_COPY_TRANSIENT))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy fill value data type"); } /* end if */ else dest->type = NULL; /* Copy fill value and its size */ if(mesg->buf) { H5_CHECK_OVERFLOW(mesg->size,ssize_t,size_t); if(NULL == (dest->buf = H5MM_malloc((size_t)mesg->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill value"); HDmemcpy(dest->buf, mesg->buf, (size_t)mesg->size); /* Check for needing to convert/copy fill value */ if(mesg->type) { H5T_path_t *tpath; /* Conversion information */ /* Set up type conversion function */ if(NULL == (tpath = H5T_path_find(mesg->type, dest->type, NULL, NULL, H5AC_ind_dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types") /* If necessary, convert fill value datatypes (which copies VL components, etc.) */ if(!H5T_path_noop(tpath)) { hid_t dst_id, src_id; /* Source & destination datatypes for type conversion */ uint8_t *bkg_buf = NULL; /* Background conversion buffer */ size_t bkg_size; /* Size of background buffer */ /* Wrap copies of types to convert */ dst_id = H5I_register(H5I_DATATYPE, H5T_copy(dest->type, H5T_COPY_TRANSIENT)); if(dst_id < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register datatype") src_id = H5I_register(H5I_DATATYPE, H5T_copy(mesg->type, H5T_COPY_ALL)); if(src_id < 0) { H5I_dec_ref(dst_id); HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register datatype") } /* end if */
/*------------------------------------------------------------------------- * Function: H5G_traverse_link_ud * * Purpose: Callback for user-defined link traversal. Sets up a * location ID and passes it to the user traversal callback. * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Tuesday, September 13, 2005 * *------------------------------------------------------------------------- */ static herr_t H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, H5G_loc_t *obj_loc/*in,out*/, size_t *nlinks/*in,out*/, hid_t _lapl_id, hid_t dxpl_id) { const H5L_class_t *link_class; /* User-defined link class */ hid_t cb_return = -1; /* The ID the user-defined callback returned */ H5G_loc_t grp_loc_copy; H5G_name_t grp_path_copy; H5O_loc_t grp_oloc_copy; H5O_loc_t *new_oloc = NULL; H5F_t *temp_file = NULL; H5G_t *grp; hid_t lapl_id = (-1); /* LAPL local to this routine */ H5P_genplist_t *lapl; /* LAPL with nlinks set */ hid_t cur_grp = (-1); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5G_traverse_ud) /* Sanity check */ HDassert(grp_loc); HDassert(lnk); HDassert(lnk->type >= H5L_TYPE_UD_MIN); HDassert(obj_loc); HDassert(nlinks); HDassert(_lapl_id >= 0); /* Reset the object's path information, because we can't detect any changes * in the "path" the user-defined callback takes */ H5G_name_free(obj_loc->path); /* Get the link class for this type of link. */ if(NULL == (link_class = H5L_find_class(lnk->type))) HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to get UD link class") /* Set up location for user-defined callback. Use a copy of our current * grp_loc. */ grp_loc_copy.path = &grp_path_copy; grp_loc_copy.oloc = &grp_oloc_copy; H5G_loc_reset(&grp_loc_copy); if(H5G_loc_copy(&grp_loc_copy, grp_loc, H5_COPY_DEEP) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "unable to copy object location") /* Create a group to pass to the user-defined callback */ if((grp = H5G_open(&grp_loc_copy, dxpl_id)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") if((cur_grp = H5I_register(H5I_GROUP, grp)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") /* Check for generic default property list and use link access default if so */ if(_lapl_id == H5P_DEFAULT) { HDassert(H5P_LINK_ACCESS_DEFAULT != -1); if(NULL == (lapl = H5I_object(H5P_LINK_ACCESS_DEFAULT))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "unable to get default property list") } /* end if */
/*------------------------------------------------------------------------- * Function: H5D_compact_fill * * Purpose: Write fill values to a compactly stored dataset. * * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * May 6, 2007 * *------------------------------------------------------------------------- */ herr_t H5D_compact_fill(H5D_t *dset, hid_t dxpl_id) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5D_compact_fill, FAIL) /* Check args */ HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER)); HDassert(dset && H5D_COMPACT == dset->shared->layout.type); HDassert(dset->shared->layout.u.compact.buf); HDassert(dset->shared->type); HDassert(dset->shared->space); /* If the fill value is defined, initialize the data buffer with it */ if(dset->shared->fill.buf) { hssize_t snpoints; /* Number of points in space (for error checking) */ size_t npoints; /* Number of points in space */ /* Get the number of elements in the dataset's dataspace */ snpoints = H5S_GET_EXTENT_NPOINTS(dset->shared->space); HDassert(snpoints >= 0); H5_ASSIGN_OVERFLOW(npoints, snpoints, hssize_t, size_t); /* If necessary, convert fill value datatypes (which copies VL components, etc.) */ if(H5T_detect_class(dset->shared->type, H5T_VLEN) > 0) { H5T_path_t *tpath; /* Datatype conversion path */ uint8_t *bkg_buf = NULL; /* Background conversion buffer */ H5T_t *mem_type; /* Pointer to memory datatype */ size_t mem_type_size, file_type_size; /* Size of datatype in memory and on disk */ hid_t mem_tid; /* Memory version of disk datatype */ /* Create temporary datatype for conversion operation */ if(NULL == (mem_type = H5T_copy(dset->shared->type, H5T_COPY_REOPEN))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy file datatype") if((mem_tid = H5I_register(H5I_DATATYPE, mem_type)) < 0) { H5T_close(mem_type); HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype") } /* end if */
/*------------------------------------------------------------------------- * Function: H5TN_init_interface * * Purpose: Initialize pre-defined native datatypes from code generated * during the library configuration by H5detect. * * Return: Success: non-negative * Failure: negative * * Programmer: Robb Matzke * Wednesday, December 16, 1998 * *------------------------------------------------------------------------- */ herr_t H5TN_init_interface(void) { H5T_t *dt = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) /* * 0 * IIIIIIII * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 1; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 8; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_2; if((H5T_NATIVE_SCHAR_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_SCHAR_ALIGN_g = 1; H5T_NATIVE_SCHAR_COMP_ALIGN_g = 1; /* * 0 * UUUUUUUU * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 1; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 8; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE; if((H5T_NATIVE_UCHAR_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_UCHAR_ALIGN_g = 1; /* * 1 0 * IIIIIIII IIIIIIII * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 2; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 16; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_2; if((H5T_NATIVE_SHORT_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_SHORT_ALIGN_g = 1; H5T_NATIVE_SHORT_COMP_ALIGN_g = 2; /* * 1 0 * UUUUUUUU UUUUUUUU * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 2; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 16; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE; if((H5T_NATIVE_USHORT_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_USHORT_ALIGN_g = 1; /* * 3 2 1 0 * IIIIIIII IIIIIIII IIIIIIII IIIIIIII * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 4; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 32; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_2; if((H5T_NATIVE_INT_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_INT_ALIGN_g = 1; H5T_NATIVE_INT_COMP_ALIGN_g = 4; /* * 3 2 1 0 * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 4; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 32; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE; if((H5T_NATIVE_UINT_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_UINT_ALIGN_g = 1; /* * 3 2 1 0 * IIIIIIII IIIIIIII IIIIIIII IIIIIIII * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 4; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 32; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_2; if((H5T_NATIVE_LONG_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_LONG_ALIGN_g = 1; H5T_NATIVE_LONG_COMP_ALIGN_g = 4; /* * 3 2 1 0 * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 4; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 32; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE; if((H5T_NATIVE_ULONG_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_ULONG_ALIGN_g = 1; /* * 0 * IIIIIIII * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 1; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 8; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_2; if((H5T_NATIVE_INT8_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_INT8_ALIGN_g = 1; /* * 0 * UUUUUUUU * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 1; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 8; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE; if((H5T_NATIVE_UINT8_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_UINT8_ALIGN_g = 1; /* * 0 * IIIIIIII * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 1; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 8; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_2; if((H5T_NATIVE_INT_LEAST8_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_INT_LEAST8_ALIGN_g = 1; /* * 0 * UUUUUUUU * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 1; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 8; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE; if((H5T_NATIVE_UINT_LEAST8_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_UINT_LEAST8_ALIGN_g = 1; /* * 0 * IIIIIIII * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 1; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 8; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_2; if((H5T_NATIVE_INT_FAST8_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_INT_FAST8_ALIGN_g = 1; /* * 0 * UUUUUUUU * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 1; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 8; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE; if((H5T_NATIVE_UINT_FAST8_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_UINT_FAST8_ALIGN_g = 1; /* * 1 0 * IIIIIIII IIIIIIII * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 2; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 16; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_2; if((H5T_NATIVE_INT16_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_INT16_ALIGN_g = 1; /* * 1 0 * UUUUUUUU UUUUUUUU * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 2; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 16; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE; if((H5T_NATIVE_UINT16_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_UINT16_ALIGN_g = 1; /* * 1 0 * IIIIIIII IIIIIIII * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 2; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 16; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_2; if((H5T_NATIVE_INT_LEAST16_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_INT_LEAST16_ALIGN_g = 1; /* * 1 0 * UUUUUUUU UUUUUUUU * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 2; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 16; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE; if((H5T_NATIVE_UINT_LEAST16_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_UINT_LEAST16_ALIGN_g = 1; /* * 3 2 1 0 * IIIIIIII IIIIIIII IIIIIIII IIIIIIII * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 4; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 32; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_2; if((H5T_NATIVE_INT_FAST16_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_INT_FAST16_ALIGN_g = 1; /* * 3 2 1 0 * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 4; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 32; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE; if((H5T_NATIVE_UINT_FAST16_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_UINT_FAST16_ALIGN_g = 1; /* * 3 2 1 0 * IIIIIIII IIIIIIII IIIIIIII IIIIIIII * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 4; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 32; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_2; if((H5T_NATIVE_INT32_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_INT32_ALIGN_g = 1; /* * 3 2 1 0 * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 4; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 32; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE; if((H5T_NATIVE_UINT32_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_UINT32_ALIGN_g = 1; /* * 3 2 1 0 * IIIIIIII IIIIIIII IIIIIIII IIIIIIII * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 4; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 32; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_2; if((H5T_NATIVE_INT_LEAST32_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_INT_LEAST32_ALIGN_g = 1; /* * 3 2 1 0 * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 4; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 32; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE; if((H5T_NATIVE_UINT_LEAST32_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_UINT_LEAST32_ALIGN_g = 1; /* * 3 2 1 0 * IIIIIIII IIIIIIII IIIIIIII IIIIIIII * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 4; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 32; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_2; if((H5T_NATIVE_INT_FAST32_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_INT_FAST32_ALIGN_g = 1; /* * 3 2 1 0 * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 4; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 32; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE; if((H5T_NATIVE_UINT_FAST32_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_UINT_FAST32_ALIGN_g = 1; /* * 7 6 5 4 * IIIIIIII IIIIIIII IIIIIIII IIIIIIII * 3 2 1 0 * IIIIIIII IIIIIIII IIIIIIII IIIIIIII * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 8; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 64; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_2; if((H5T_NATIVE_INT64_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_INT64_ALIGN_g = 1; /* * 7 6 5 4 * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU * 3 2 1 0 * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 8; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 64; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE; if((H5T_NATIVE_UINT64_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_UINT64_ALIGN_g = 1; /* * 7 6 5 4 * IIIIIIII IIIIIIII IIIIIIII IIIIIIII * 3 2 1 0 * IIIIIIII IIIIIIII IIIIIIII IIIIIIII * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 8; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 64; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_2; if((H5T_NATIVE_INT_LEAST64_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_INT_LEAST64_ALIGN_g = 1; /* * 7 6 5 4 * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU * 3 2 1 0 * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 8; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 64; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE; if((H5T_NATIVE_UINT_LEAST64_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_UINT_LEAST64_ALIGN_g = 1; /* * 7 6 5 4 * IIIIIIII IIIIIIII IIIIIIII IIIIIIII * 3 2 1 0 * IIIIIIII IIIIIIII IIIIIIII IIIIIIII * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 8; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 64; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_2; if((H5T_NATIVE_INT_FAST64_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_INT_FAST64_ALIGN_g = 1; /* * 7 6 5 4 * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU * 3 2 1 0 * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 8; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 64; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE; if((H5T_NATIVE_UINT_FAST64_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_UINT_FAST64_ALIGN_g = 1; /* * 7 6 5 4 * IIIIIIII IIIIIIII IIIIIIII IIIIIIII * 3 2 1 0 * IIIIIIII IIIIIIII IIIIIIII IIIIIIII * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 8; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 64; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_2; if((H5T_NATIVE_LLONG_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_LLONG_ALIGN_g = 1; H5T_NATIVE_LLONG_COMP_ALIGN_g = 4; /* * 7 6 5 4 * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU * 3 2 1 0 * UUUUUUUU UUUUUUUU UUUUUUUU UUUUUUUU * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_INTEGER; dt->shared->size = 8; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 64; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = H5T_SGN_NONE; if((H5T_NATIVE_ULLONG_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_ULLONG_ALIGN_g = 1; /* * 3 2 1 0 * SEEEEEEE EMMMMMMM MMMMMMMM MMMMMMMM * Implicit bit? yes * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_FLOAT; dt->shared->size = 4; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 32; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.f.sign = 31; dt->shared->u.atomic.u.f.epos = 23; dt->shared->u.atomic.u.f.esize = 8; dt->shared->u.atomic.u.f.ebias = 0x0000007f; dt->shared->u.atomic.u.f.mpos = 0; dt->shared->u.atomic.u.f.msize = 23; dt->shared->u.atomic.u.f.norm = H5T_NORM_IMPLIED; dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO; if((H5T_NATIVE_FLOAT_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_FLOAT_ALIGN_g = 1; H5T_NATIVE_FLOAT_COMP_ALIGN_g = 4; /* * 7 6 5 4 * SEEEEEEE EEEEMMMM MMMMMMMM MMMMMMMM * 3 2 1 0 * MMMMMMMM MMMMMMMM MMMMMMMM MMMMMMMM * Implicit bit? yes * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_FLOAT; dt->shared->size = 8; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 64; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.f.sign = 63; dt->shared->u.atomic.u.f.epos = 52; dt->shared->u.atomic.u.f.esize = 11; dt->shared->u.atomic.u.f.ebias = 0x000003ff; dt->shared->u.atomic.u.f.mpos = 0; dt->shared->u.atomic.u.f.msize = 52; dt->shared->u.atomic.u.f.norm = H5T_NORM_IMPLIED; dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO; if((H5T_NATIVE_DOUBLE_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_DOUBLE_ALIGN_g = 1; H5T_NATIVE_DOUBLE_COMP_ALIGN_g = 4; /* * 11 10 9 8 * ???????? ???????? SEEEEEEE EEEEEEEE * 7 6 5 4 * MMMMMMMM MMMMMMMM MMMMMMMM MMMMMMMM * 3 2 1 0 * MMMMMMMM MMMMMMMM MMMMMMMM MMMMMMMM * Implicit bit? no * Alignment: none */ if(NULL == (dt = H5T__alloc())) HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_FLOAT; dt->shared->size = 12; dt->shared->u.atomic.order = H5T_ORDER_LE; dt->shared->u.atomic.offset = 0; dt->shared->u.atomic.prec = 80; dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; dt->shared->u.atomic.u.f.sign = 79; dt->shared->u.atomic.u.f.epos = 64; dt->shared->u.atomic.u.f.esize = 15; dt->shared->u.atomic.u.f.ebias = 0x00003fff; dt->shared->u.atomic.u.f.mpos = 0; dt->shared->u.atomic.u.f.msize = 64; dt->shared->u.atomic.u.f.norm = H5T_NORM_NONE; dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO; if((H5T_NATIVE_LDOUBLE_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") H5T_NATIVE_LDOUBLE_ALIGN_g = 1; H5T_NATIVE_LDOUBLE_COMP_ALIGN_g = 4; /* Set the native order for this machine */ H5T_native_order_g = H5T_ORDER_LE; /* Structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */ H5T_POINTER_COMP_ALIGN_g = 4; H5T_HVL_COMP_ALIGN_g = 4; H5T_HOBJREF_COMP_ALIGN_g = 4; H5T_HDSETREGREF_COMP_ALIGN_g = 1; done: if(ret_value < 0) { if(dt != NULL) { dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); dt = H5FL_FREE(H5T_t, dt); } /* end if */ } /* end if */ FUNC_LEAVE_NOAPI(ret_value); } /* end H5TN_init_interface() */
/*-------------------------------------------------------------------------- NAME H5R__dereference PURPOSE Opens the HDF5 object referenced. USAGE hid_t H5R__dereference(ref, oapl_id, ref_type, ref) H5F_t *file; IN: File the object being dereferenced is within hid_t oapl_id; IN: Object access property list ID H5R_type_t ref_type; IN: Type of reference void *ref; IN: Reference to open. RETURNS Valid ID on success, Negative on failure DESCRIPTION Given a reference to some object, open that object and return an ID for that object. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS Currently only set up to work with references to datasets EXAMPLES REVISION LOG Raymond Lu 13 July 2011 I added the OAPL_ID parameter for the object being referenced. It only supports dataset access property list currently. M. Scot Breitenfeld 3 March 2015 Added a check for undefined reference pointer. --------------------------------------------------------------------------*/ hid_t H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, const void *_ref) { H5O_loc_t oloc; /* Object location */ H5G_name_t path; /* Path of object */ H5G_loc_t loc; /* Group location */ unsigned rc; /* Reference count of object */ H5O_type_t obj_type; /* Type of object */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_PACKAGE_VOL HDassert(_ref); HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE); HDassert(file); /* Initialize the object location */ H5O_loc_reset(&oloc); oloc.file = file; switch (ref_type) { case H5R_OBJECT: { oloc.addr = *(const hobj_ref_t *)_ref; /* Only object references currently supported */ if (!H5F_addr_defined(oloc.addr) || oloc.addr == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "Undefined reference pointer") break; } case H5R_DATASET_REGION: { H5HG_t hobjid; /* Heap object ID */ uint8_t *buf; /* Buffer to store serialized selection in */ const uint8_t *p; /* Pointer to OID to store */ /* Get the heap ID for the dataset region */ p = (const uint8_t *)_ref; H5F_addr_decode(oloc.file, &p, &(hobjid.addr)); UINT32DECODE(p, hobjid.idx); if (!H5F_addr_defined(hobjid.addr) || hobjid.addr == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "Undefined reference pointer") /* Get the dataset region from the heap (allocate inside routine) */ if(NULL == (buf = (uint8_t *)H5HG_read(oloc.file, &hobjid, NULL, NULL))) HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, H5I_INVALID_HID, "Unable to read dataset region information") /* Get the object oid for the dataset */ p = buf; H5F_addr_decode(oloc.file, &p, &(oloc.addr)); /* Free the buffer allocated in H5HG_read() */ H5MM_xfree(buf); break; } /* end case H5R_DATASET_REGION */ case H5R_BADTYPE: case H5R_MAXTYPE: default: HDassert("unknown reference type" && 0); HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, H5I_INVALID_HID, "internal error (unknown reference type)") } /* end switch */ /* Get the # of links for object, and its type * (To check to make certain that this object hasn't been deleted * since the reference was created) */ if(H5O_get_rc_and_type(&oloc, &rc, &obj_type) < 0 || 0 == rc) HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, H5I_INVALID_HID, "dereferencing deleted object") /* Construct a group location for opening the object */ H5G_name_reset(&path); loc.oloc = &oloc; loc.path = &path; /* Open the object */ switch (obj_type) { case H5O_TYPE_GROUP: { H5G_t *group; /* Pointer to group to open */ if(NULL == (group = H5G_open(&loc))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5I_INVALID_HID, "not found") /* Create an atom for the group */ if((ret_value = H5I_register(H5I_GROUP, group, TRUE)) < 0) { H5G_close(group); HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register group") } /* end if */ break; } case H5O_TYPE_NAMED_DATATYPE: { H5T_t *type; /* Pointer to datatype to open */ if(NULL == (type = H5T_open(&loc))) HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, H5I_INVALID_HID, "not found") /* Create an atom for the datatype */ if((ret_value = H5I_register(H5I_DATATYPE, type, TRUE)) < 0) { H5T_close(type); HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register datatype") } /* end if */ break; }