[svn-r15025] Purpose:

Cleaned up unused code (i.e. commented out) and removed extraneous output to standard out.

Tested:
N/A - No critical executable source lines were modified, only comments and write statements.
This commit is contained in:
Scot Breitenfeld 2008-05-16 15:46:10 -05:00
parent 6c787d56aa
commit 5c122eeb8b
4 changed files with 149 additions and 1934 deletions

View File

@ -395,41 +395,6 @@ SUBROUTINE test_h5s_encode(cleanup, total_error)
CALL h5sclose_f(decoded_sid1, error)
CALL check("h5sclose_f", error, total_error)
!!$
!!$ ret = H5Sclose(decoded_sid1);
!!$ CHECK(ret, FAIL, "H5Sclose");
!!$
!!$ /*-------------------------------------------------------------------------
!!$ * Test encoding and decoding of null dataspace.
!!$ *-------------------------------------------------------------------------
!!$ */
!!$ sid2 = H5Screate(H5S_NULL);
!!$ CHECK(sid2, FAIL, "H5Screate");
!!$
!!$ /* Encode null data space in a buffer */
!!$ ret = H5Sencode(sid2, NULL, &null_size);
!!$ CHECK(ret, FAIL, "H5Sencode");
!!$
!!$ if(null_size>0)
!!$ null_sbuf = (unsigned char*)HDcalloc((size_t)1, null_size);
!!$
!!$ ret = H5Sencode(sid2, null_sbuf, &null_size);
!!$ CHECK(ret, FAIL, "H5Sencode");
!!$
!!$ /* Decode from the dataspace buffer and return an object handle */
!!$ decoded_sid2=H5Sdecode(null_sbuf);
!!$ CHECK(decoded_sid2, FAIL, "H5Sdecode");
!!$
!!$ /* Verify decoded dataspace */
!!$ space_type = H5Sget_simple_extent_type(decoded_sid2);
!!$ VERIFY(space_type, H5S_NULL, "H5Sget_simple_extent_type");
!!$
!!$ ret = H5Sclose(sid2);
!!$ CHECK(ret, FAIL, "H5Sclose");
!!$
!!$ ret = H5Sclose(decoded_sid2);
!!$ CHECK(ret, FAIL, "H5Sclose");
!!$
! /*-------------------------------------------------------------------------
! * Test encoding and decoding of scalar dataspace.
! *-------------------------------------------------------------------------
@ -480,477 +445,3 @@ SUBROUTINE test_h5s_encode(cleanup, total_error)
END SUBROUTINE test_h5s_encode
!/*-------------------------------------------------------------------------
! * Function: test_hard_query
! *
! * Purpose: Tests H5Tcompiler_conv() for querying whether a conversion is
! * a hard one.
! *
! * Return: Success: 0
! *
! * Failure: number of errors
! *
! * Programmer: Raymond Lu
! * Friday, Sept 2, 2005
! *
! * Modifications:
! *
! *-------------------------------------------------------------------------
! */
!!$SUBROUTINE test_hard_query(total_error)
!!$
!!$ USE HDF5 ! This module contains all necessary modules
!!$
!!$ IMPLICIT NONE
!!$ INTEGER, INTENT(INOUT) :: total_error
!!$
!!$ INTEGER :: error
!!$ LOGICAL :: flag
!!$
!!$ WRITE(*,*) "query functions of compiler conversion"
!!$
!!$ ! /* Verify the conversion from int to float is a hard conversion. */
!!$
!!$ CALL H5Tcompiler_conv_f(H5T_INTEGER_F, H5T_FLOAT_F, flag, error)
!!$ CALL check("H5Tcompiler_conv", error, total_error)
!!$ CALL VerifyLogical("H5Tcompiler_conv", flag, .TRUE.,total_error)
!!$ if((ret = H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT))!=TRUE) {
!!$ H5_FAILED();
!!$ printf("Can't query conversion function\n");
!!$ goto error;
!!$ }
!!$ /* Unregister the hard conversion from int to float. Verify the conversion
!!$ * is a soft conversion. */
!!$ H5Tunregister(H5T_PERS_HARD, NULL, H5T_NATIVE_INT, H5T_NATIVE_FLOAT, H5T_conv_int_float);
!!$ if((ret = H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT))!=FALSE) {
!!$ H5_FAILED();
!!$ printf("Can't query conversion function\n");
!!$ goto error;
!!$ }
!!$
!!$ /* Register the hard conversion from int to float. Verify the conversion
!!$ * is a hard conversion. */
!!$ H5Tregister(H5T_PERS_HARD, "int_flt", H5T_NATIVE_INT, H5T_NATIVE_FLOAT, H5T_conv_int_float);
!!$ if((ret = H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT))!=TRUE) {
!!$ H5_FAILED();
!!$ printf("Can't query conversion function\n");
!!$ goto error;
!!$ }
!!$
!!$ PASSED();
!!$ reset_hdf5();
!!$
!!$ return 0;
!!$
!!$END SUBROUTINE test_hard_query
!/*-------------------------------------------------------------------------
! * Function: test_encode
! *
! * Purpose: Tests functions of encoding and decoding datatype.
! *
! * Return: Success: 0
! *
! * Failure: number of errors
! *
! * Programmer: Raymond Lu
! * July 14, 2004
! *
! * Modifications:
! *
! *-------------------------------------------------------------------------
! */
!!$SUBROUTINE test_encode(total_error)
!!$
!!$ USE HDF5 ! This module contains all necessary modules
!!$ struct s1 {
!!$ int a;
!!$ float b;
!!$ long c;
!!$ double d;
!!$ };
!!$ IMPLICIT NONE
!!$ INTEGER, INTENT(INOUT) :: total_error
!!$ INTEGER(SIZE_T), PARAMETER :: sizechar = 1024
!!$ INTEGER :: error
!!$ INTEGER(hid_t) :: file=-1, tid1=-1, tid2=-1
!!$ INTEGER(hid_t) :: decoded_tid1=-1, decoded_tid2=-1
!!$ CHARACTER(LEN=1024) :: filename = 'encode.h5'
!!$ char compnd_type[]="Compound_type", enum_type[]="Enum_type";
!!$ short enum_val;
!!$ size_t cmpd_buf_size = 0;
!!$ size_t enum_buf_size = 0;
!!$ unsigned char *cmpd_buf=NULL, *enum_buf=NULL;
!!$ herr_t ret;
!!$ INTEGER(HID_T) :: dt5_id ! Memory datatype identifier
!!$
!!$ INTEGER(SIZE_T) :: type_sizec ! Size of the character datatype
!!$
!!$ WRITE(*,*) "functions of encoding and decoding datatypes"
!!$
!!$ !/* Create File */
!!$
!!$ CALL H5Fcreate_f(filename, H5F_ACC_TRUNC_F, file, error)
!!$ CALL check("H5Fcreate_f", error, total_error)
!!$
!!$ !/*-----------------------------------------------------------------------
!!$ ! * Create compound and enumerate datatypes
!!$ ! *-----------------------------------------------------------------------
!!$ ! */
!!$
!!$ ! /* Create a compound datatype */
!!$ CALL h5tcopy_f(H5T_NATIVE_CHARACTER, dt5_id, error)
!!$ CALL check("h5tcopy_f", error, total_error)
!!$ sizechar = 2
!!$ CALL h5tset_size_f(dt5_id, sizechar, error)
!!$ CALL check("h5tset_size_f", error, total_error)
!!$ CALL h5tget_size_f(dt5_id, type_sizec, error)
!!$ CALL check("h5tget_size_f", error, total_error)
!!$
!!$ CALL h5tget_size_f(H5T_NATIVE_INTEGER, type_sizec, error)
!!$ CALL check("h5tget_size_f", error, total_error)
!!$ CALL h5tcreate_f(H5T_COMPOUND_F, type_sizec, dtype_id, error)
!!$
!!$
!!$ if((tid1=H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't create datatype!\n");
!!$ goto error;
!!$ } /* end if */
!!$ if(H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_INT) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't insert field 'a'\n");
!!$ goto error;
!!$ } /* end if */
!!$ if(H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_FLOAT) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't insert field 'b'\n");
!!$ goto error;
!!$ } /* end if */
!!$ if(H5Tinsert(tid1, "c", HOFFSET(struct s1, c), H5T_NATIVE_LONG) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't insert field 'c'\n");
!!$ goto error;
!!$ } /* end if */
!!$ if(H5Tinsert(tid1, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't insert field 'd'\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ /* Create a enumerate datatype */
!!$ if((tid2=H5Tcreate(H5T_ENUM, sizeof(short))) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't create enumerate type\n");
!!$ goto error;
!!$ } /* end if */
!!$ if(H5Tenum_insert(tid2, "RED", (enum_val=0,&enum_val)) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't insert field into enumeration type\n");
!!$ goto error;
!!$ } /* end if */
!!$ if(H5Tenum_insert(tid2, "GREEN", (enum_val=1,&enum_val)) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't insert field into enumeration type\n");
!!$ goto error;
!!$ } /* end if */
!!$ if(H5Tenum_insert(tid2, "BLUE", (enum_val=2,&enum_val)) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't insert field into enumeration type\n");
!!$ goto error;
!!$ } /* end if */
!!$ if(H5Tenum_insert(tid2, "ORANGE", (enum_val=3,&enum_val)) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't insert field into enumeration type\n");
!!$ goto error;
!!$ } /* end if */
!!$ if(H5Tenum_insert(tid2, "YELLOW", (enum_val=4,&enum_val)) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't insert field into enumeration type\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ /*-----------------------------------------------------------------------
!!$ * Test encoding and decoding compound and enumerate datatypes
!!$ *-----------------------------------------------------------------------
!!$ */
!!$ /* Encode compound type in a buffer */
!!$ if(H5Tencode(tid1, NULL, &cmpd_buf_size) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't encode compound type\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ if(cmpd_buf_size>0)
!!$ cmpd_buf = (unsigned char*)calloc(1, cmpd_buf_size);
!!$
!!$ /* Try decoding bogus buffer */
!!$ H5E_BEGIN_TRY {
!!$ ret = H5Tdecode(cmpd_buf);
!!$ } H5E_END_TRY;
!!$ if(ret!=FAIL) {
!!$ H5_FAILED();
!!$ printf("Decoded bogus buffer!\n");
!!$ goto error;
!!$ }
!!$
!!$ if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't encode compound type\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ /* Decode from the compound buffer and return an object handle */
!!$ if((decoded_tid1 = H5Tdecode(cmpd_buf)) < 0)
!!$ FAIL_PUTS_ERROR("Can't decode compound type\n")
!!$
!!$ /* Verify that the datatype was copied exactly */
!!$ if(H5Tequal(decoded_tid1, tid1)<=0) {
!!$ H5_FAILED();
!!$ printf("Datatype wasn't encoded & decoded identically\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ /* Query member number and member index by name, for compound type. */
!!$ if(H5Tget_nmembers(decoded_tid1)!=4) {
!!$ H5_FAILED();
!!$ printf("Can't get member number\n");
!!$ goto error;
!!$ } /* end if */
!!$ if(H5Tget_member_index(decoded_tid1, "c")!=2) {
!!$ H5_FAILED();
!!$ printf("Can't get correct index number\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$
!!$ /* Encode enumerate type in a buffer */
!!$ if(H5Tencode(tid2, NULL, &enum_buf_size) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't encode enumerate type\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ if(enum_buf_size>0)
!!$ enum_buf = (unsigned char*)calloc(1, enum_buf_size);
!!$
!!$ if(H5Tencode(tid2, enum_buf, &enum_buf_size) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't encode enumerate type\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ /* Decode from the enumerate buffer and return an object handle */
!!$ if((decoded_tid2=H5Tdecode(enum_buf)) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't decode enumerate type\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ /* Verify that the datatype was copied exactly */
!!$ if(H5Tequal(decoded_tid2, tid2)<=0) {
!!$ H5_FAILED();
!!$ printf("Datatype wasn't encoded & decoded identically\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ /* Query member number and member index by name, for enumeration type. */
!!$ if(H5Tget_nmembers(decoded_tid2)!=5) {
!!$ H5_FAILED();
!!$ printf("Can't get member number\n");
!!$ goto error;
!!$ } /* end if */
!!$ if(H5Tget_member_index(decoded_tid2, "ORANGE") != 3) {
!!$ H5_FAILED();
!!$ printf("Can't get correct index number\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ /*-----------------------------------------------------------------------
!!$ * Commit and reopen the compound and enumerate datatypes
!!$ *-----------------------------------------------------------------------
!!$ */
!!$ /* Commit compound datatype and close it */
!!$ if(H5Tcommit2(file, compnd_type, tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't commit compound datatype\n");
!!$ goto error;
!!$ } /* end if */
!!$ if(H5Tclose(tid1) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't close datatype\n");
!!$ goto error;
!!$ } /* end if */
!!$ if(H5Tclose(decoded_tid1) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't close datatype\n");
!!$ goto error;
!!$ } /* end if */
!!$ free(cmpd_buf);
!!$ cmpd_buf_size = 0;
!!$
!!$ /* Commit enumeration datatype and close it */
!!$ if(H5Tcommit2(file, enum_type, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't commit compound datatype\n");
!!$ goto error;
!!$ } /* end if */
!!$ if(H5Tclose(tid2) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't close datatype\n");
!!$ goto error;
!!$ } /* end if */
!!$ if(H5Tclose(decoded_tid2) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't close datatype\n");
!!$ goto error;
!!$ } /* end if */
!!$ free(enum_buf);
!!$ enum_buf_size = 0;
!!$
!!$ /* Open the dataytpe for query */
!!$ if((tid1 = H5Topen2(file, compnd_type, H5P_DEFAULT)) < 0)
!!$ FAIL_STACK_ERROR
!!$ if((tid2 = H5Topen2(file, enum_type, H5P_DEFAULT)) < 0)
!!$ FAIL_STACK_ERROR
!!$
!!$
!!$ /* Encode compound type in a buffer */
!!$ if(H5Tencode(tid1, NULL, &cmpd_buf_size) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't encode compound type\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ if(cmpd_buf_size>0)
!!$ cmpd_buf = (unsigned char*)calloc(1, cmpd_buf_size);
!!$
!!$ if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't encode compound type\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ /* Decode from the compound buffer and return an object handle */
!!$ if((decoded_tid1 = H5Tdecode(cmpd_buf)) < 0)
!!$ FAIL_PUTS_ERROR("Can't decode compound type\n")
!!$
!!$ /* Verify that the datatype was copied exactly */
!!$ if(H5Tequal(decoded_tid1, tid1)<=0) {
!!$ H5_FAILED();
!!$ printf("Datatype wasn't encoded & decoded identically\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ /* Query member number and member index by name, for compound type. */
!!$ if(H5Tget_nmembers(decoded_tid1)!=4) {
!!$ H5_FAILED();
!!$ printf("Can't get member number\n");
!!$ goto error;
!!$ } /* end if */
!!$ if(H5Tget_member_index(decoded_tid1, "c")!=2) {
!!$ H5_FAILED();
!!$ printf("Can't get correct index number\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ /*-----------------------------------------------------------------------
!!$ * Test encoding and decoding compound and enumerate datatypes
!!$ *-----------------------------------------------------------------------
!!$ */
!!$ /* Encode enumerate type in a buffer */
!!$ if(H5Tencode(tid2, NULL, &enum_buf_size) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't encode enumerate type\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ if(enum_buf_size>0)
!!$ enum_buf = (unsigned char*)calloc(1, enum_buf_size);
!!$
!!$ if(H5Tencode(tid2, enum_buf, &enum_buf_size) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't encode enumerate type\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ /* Decode from the enumerate buffer and return an object handle */
!!$ if((decoded_tid2=H5Tdecode(enum_buf)) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't decode enumerate type\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ /* Verify that the datatype was copied exactly */
!!$ if(H5Tequal(decoded_tid2, tid2)<=0) {
!!$ H5_FAILED();
!!$ printf("Datatype wasn't encoded & decoded identically\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ /* Query member number and member index by name, for enumeration type. */
!!$ if(H5Tget_nmembers(decoded_tid2)!=5) {
!!$ H5_FAILED();
!!$ printf("Can't get member number\n");
!!$ goto error;
!!$ } /* end if */
!!$ if(H5Tget_member_index(decoded_tid2, "ORANGE")!=3) {
!!$ H5_FAILED();
!!$ printf("Can't get correct index number\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ /*-----------------------------------------------------------------------
!!$ * Close and release
!!$ *-----------------------------------------------------------------------
!!$ */
!!$ /* Close datatype and file */
!!$ if(H5Tclose(tid1) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't close datatype\n");
!!$ goto error;
!!$ } /* end if */
!!$ if(H5Tclose(tid2) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't close datatype\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ if(H5Tclose(decoded_tid1) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't close datatype\n");
!!$ goto error;
!!$ } /* end if */
!!$ if(H5Tclose(decoded_tid2) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't close datatype\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ if(H5Fclose(file) < 0) {
!!$ H5_FAILED();
!!$ printf("Can't close file\n");
!!$ goto error;
!!$ } /* end if */
!!$
!!$ free(cmpd_buf);
!!$ free(enum_buf);
!!$
!!$ PASSED();
!!$ return 0;
!!$
!!$ error:
!!$ H5E_BEGIN_TRY {
!!$ H5Tclose (tid1);
!!$ H5Tclose (tid2);
!!$ H5Tclose (decoded_tid1);
!!$ H5Tclose (decoded_tid2);
!!$ H5Fclose (file);
!!$ } H5E_END_TRY;
!!$ return 1;
!!$}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -236,7 +236,7 @@ SUBROUTINE test_h5o_plist(total_error)
CHARACTER(LEN=7), PARAMETER :: TEST_FILENAME = 'test.h5'
PRINT*,'Testing object creation properties'
! PRINT*,'Testing object creation properties'
!/* Make a FAPL that uses the "use the latest version of the format" flag */
CALL H5Pcreate_f(H5P_FILE_ACCESS_F, fapl, error)