hdf5/fortran/test/t.c
Quincey Koziol a6f6462541 [svn-r12700] Alert:
File format is not stable, don't keep files produced!

Description:
    First stage of checkins modifying the format of groups to support creation
order.  Implement "dense" storage for links in groups.

    Try to clarify some of the symbols for the H5L API.

    Add the H5Pset_latest_format() flag for FAPLs, to choose to use the newest
file format options (including "dense" link storage in groups)

    Add the H5Pset_track_creation_order() flag for GCPLs, to enable creation
order tracking in groups (although no index on creation order yet).

    Remove --enable-group-revision configure flag, as file format issues are
now handled in a backwardly/forwardly compatible way.

    Clean up lots of compiler warnings and other minor formatting issues.

Tested on:
    FreeBSD/32 4.11 (sleipnir) w/threadsafe
    Linux/32 2.4 (heping) w/FORTRAN & C++
    Linux/64 2.4 (mir) w/enable-v1.6 compa
    Mac OSX/32 10.4.8 (amazon)
    AIX 5.3 (copper) w/parallel & FORTRAN
2006-10-02 05:24:03 -05:00

131 lines
4.6 KiB
C

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "t.h"
/*----------------------------------------------------------------------------
* Name: h5_fixname_c
* Purpose: Call h5_fixname to modify file name
* Inputs: base_name - name of the file
* base_namelen - name length
* fapl - file access property list
* full_name - buffer to return full name
* full_namelen - name length
* Returns: 0 on success, -1 on failure
* Programmer: Elena Pourmal
* Friday, September 13, 2002
* Modifications:
*---------------------------------------------------------------------------*/
int_f
nh5_fixname_c(_fcd base_name, size_t_f *base_namelen, hid_t_f* fapl, _fcd full_name, size_t_f *full_namelen)
{
int ret_value = -1;
char *c_base_name;
char *c_full_name;
hid_t c_fapl;
/*
* Define ifile access property list
*/
c_fapl = (hid_t)*fapl;
/*
* Convert FORTRAN name to C name
*/
c_base_name = (char *)HD5f2cstring(base_name, (size_t)*base_namelen);
if (c_base_name == NULL) goto DONE;
c_full_name = (char *) HDmalloc((size_t)*full_namelen + 1);
if (c_full_name == NULL) goto DONE;
/*
* Call h5_fixname function.
*/
if (NULL != h5_fixname(c_base_name, c_fapl, c_full_name, (size_t)*full_namelen + 1)) {
HD5packFstring(c_full_name, _fcdtocp(full_name), (size_t)*full_namelen);
ret_value = 0;
goto DONE;
}
DONE:
if (NULL != c_base_name) HDfree(c_base_name);
if (NULL != c_full_name) HDfree(c_full_name);
return ret_value;
}
/*----------------------------------------------------------------------------
* Name: h5_cleanup_c
* Purpose: Call h5_cleanup to clean temporary files.
* Inputs: base_name - name of the file
* base_namelen - name length
* fapl - file access property list
* Returns: 0 on success, -1 on failure
* Programmer: Elena Pourmal
* Thursday, September 19, 2002
* Modifications:
*---------------------------------------------------------------------------*/
int_f
nh5_cleanup_c(_fcd base_name, size_t_f *base_namelen, hid_t_f* fapl)
{
char filename[1024];
int ret_value = -1;
char *c_base_name[1];
hid_t c_fapl;
/*
* Define ifile access property list
*/
c_fapl = (hid_t)*fapl;
/*c_fapl = H5Pcreate(H5P_FILE_ACCESS);*/
/*
* Convert FORTRAN name to C name
*/
c_base_name[0] = (char *)HD5f2cstring(base_name, (size_t)*base_namelen);
if (c_base_name[0] == NULL) goto DONE;
/*
* Call h5_cleanup function.
*/
/*if (h5_cleanup(c_base_name, c_fapl) != 0) {
ret_value = 0;
goto DONE;
}
*/
h5_fixname(c_base_name[0], c_fapl, filename, sizeof(filename));
HDremove(filename);
ret_value =0;
DONE:
if (NULL != c_base_name[0]) HDfree(c_base_name[0]);
return ret_value;
}
/*----------------------------------------------------------------------------
* Name: h5_exit_c
* Purpose: Call 'exit()' to terminate application. Be careful not to
* overflow the exit value range since UNIX supports a very
* small range such as 1 byte. Therefore, exit(256) may end
* up as exit(0).
* Inputs: status - status for exit() to return
* Returns: none
* Programmer: Quincey Koziol
* Tuesday, December 14, 2004
* Modifications:
*---------------------------------------------------------------------------*/
void
nh5_exit_c(int_f *status)
{
HDexit((int)*status);
} /* h5_exit_c */