summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/h5cc.in16
-rw-r--r--c++/examples/testh5c++.sh.in32
-rw-r--r--c++/src/h5c++.in16
-rw-r--r--examples/testh5cc.sh.in79
-rw-r--r--fortran/examples/testh5fc.sh.in35
-rw-r--r--fortran/src/h5fc.in16
6 files changed, 156 insertions, 38 deletions
diff --git a/bin/h5cc.in b/bin/h5cc.in
index e3dc988..e4d4368 100644
--- a/bin/h5cc.in
+++ b/bin/h5cc.in
@@ -62,7 +62,7 @@ host_os="@host_os@"
prog_name="`basename $0`"
-allargs=""
+misc_args=""
compile_args=""
libraries=""
link_args=""
@@ -202,7 +202,6 @@ for arg in $@ ; do
case "$arg" in
-c)
- allargs="$allargs $arg"
compile_args="$compile_args $arg"
if test "x$do_link" = "xyes" -a -n "$output_file"; then
@@ -213,7 +212,6 @@ for arg in $@ ; do
dash_c="yes"
;;
-o)
- allargs="$allargs $arg"
dash_o="yes"
if test "x$dash_c" = "xyes"; then
@@ -225,14 +223,12 @@ for arg in $@ ; do
fi
;;
-E|-M|-MT)
- allargs="$allargs $arg"
compile_args="$compile_args $arg"
dash_c="yes"
do_link="no"
;;
-l*)
libraries=" $libraries $arg "
- allargs="$allargs $arg"
;;
-prefix=*)
prefix="`expr "$arg" : '-prefix=\(.*\)'`"
@@ -264,14 +260,14 @@ for arg in $@ ; do
;;
*\"*)
qarg="'"$arg"'"
- allargs="$allargs $qarg"
+ misc_args="$misc_args $qarg"
;;
*\'*)
- qarg='\"'"$arg"'\"'
- allargs="$allargs $qarg"
+ qarg='"'"$arg"'"'
+ misc_args="$misc_args $qarg"
;;
*)
- allargs="$allargs $qarg"
+ misc_args="$misc_args $qarg"
if test -s "$arg"; then
ext=`expr "$arg" : '.*\(\..*\)'`
@@ -313,7 +309,7 @@ if test "x$do_compile" = "xyes"; then
compile_args="-c $compile_args"
fi
- $SHOW $CC -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $compile_args
+ $SHOW $CC -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $misc_args $compile_args
status=$?
if test "$status" != "0"; then
diff --git a/c++/examples/testh5c++.sh.in b/c++/examples/testh5c++.sh.in
index 84c7752..f3a973c 100644
--- a/c++/examples/testh5c++.sh.in
+++ b/c++/examples/testh5c++.sh.in
@@ -47,6 +47,8 @@ prog1_o=${H5TOOL}_prog1.o
prog2=${H5TOOL}_prog2.$suffix
prog2_o=${H5TOOL}_prog2.o
applib=libapp${H5TOOL}.a
+args=${H5TOOL}_args.$suffix
+args_o=${H5TOOL}_args.o
# short hands
# Caution: if some *.h5 files must be cleaned here, list them by names.
@@ -134,16 +136,38 @@ int main (void)
}
EOF
+# Generate args:
+# An application main that test misc command line arguments being passed.
+cat > $args <<EOF
+#include <string>
+#include <iostream>
+#include "H5Cpp.h"
+#ifndef H5_NO_NAMESPACE
+using namespace H5;
+#endif
+
+const H5std_string FILE_NAME( "args.h5" );
+
+int main (void)
+{
+ char c = SGL_QUOTE; // 'H'
+ char *s = DBL_QUOTE; // "HDF"
+ int val = MISC; // 42
+
+ H5File file( FILE_NAME, H5F_ACC_TRUNC );
+ return 0;
+}
+EOF
# Parse option
# None
-# Print a line-line message left justified in a field of 70 characters
+# Print a line-line message left justified in a field of 74 characters
# beginning with the word "Testing".
#
TESTING() {
SPACES=" "
- echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+ echo "Testing $* $SPACES" | cut -c1-74 | tr -d '\012'
}
@@ -231,6 +255,10 @@ echo "***"Just preprocess, no compile, no link.
TOOLTEST -E $hdf5main
TOOLTEST -E $appmain $prog1 $prog2
+# HDF5 program that depends on input args.
+echo "***"Simple Compile and Link in one step with user-supplied arguments.
+TOOLTEST -DSGL_QUOTE=\'H\' -DDBL_QUOTE=\"HDF\" -DMISC=42 $args
+
##############################################################################
# END
##############################################################################
diff --git a/c++/src/h5c++.in b/c++/src/h5c++.in
index 078fa73..e666ba9 100644
--- a/c++/src/h5c++.in
+++ b/c++/src/h5c++.in
@@ -60,7 +60,7 @@ host_os="@host_os@"
prog_name="`basename $0`"
-allargs=""
+misc_args=""
compile_args=""
libraries=""
link_args=""
@@ -198,7 +198,6 @@ for arg in $@ ; do
case "$arg" in
-c)
- allargs="$allargs $arg"
compile_args="$compile_args $arg"
if test "x$do_link" = "xyes" -a -n "$output_file"; then
@@ -209,7 +208,6 @@ for arg in $@ ; do
dash_c="yes"
;;
-o)
- allargs="$allargs $arg"
dash_o="yes"
if test "x$dash_c" = "xyes"; then
@@ -221,14 +219,12 @@ for arg in $@ ; do
fi
;;
-E|-M|-MT)
- allargs="$allargs $arg"
compile_args="$compile_args $arg"
dash_c="yes"
do_link="no"
;;
-l*)
libraries=" $libraries $arg "
- allargs="$allargs $arg"
;;
-prefix=*)
prefix="`expr "$arg" : '-prefix=\(.*\)'`"
@@ -254,15 +250,15 @@ for arg in $@ ; do
;;
*\"*)
qarg="'"$arg"'"
- allargs="$allargs $qarg"
+ misc_args="$misc_args $qarg"
;;
*\'*)
- qarg='\"'"$arg"'\"'
- allargs="$allargs $qarg"
+ qarg='"'"$arg"'"'
+ misc_args="$misc_args $qarg"
;;
*)
- allargs="$allargs $qarg"
+ misc_args="$misc_args $qarg"
if [ -s "$arg" ] ; then
ext=`expr "$arg" : '.*\(\..*\)'`
@@ -300,7 +296,7 @@ if test "x$do_compile" = "xyes"; then
compile_args="-c $compile_args"
fi
- $SHOW $CXX -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CXXFLAGS $CXXFLAGS $compile_args
+ $SHOW $CXX -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CXXFLAGS $CXXFLAGS $misc_args $compile_args
status=$?
if test "$status" != "0"; then
diff --git a/examples/testh5cc.sh.in b/examples/testh5cc.sh.in
index 17b2563..291aaf6 100644
--- a/examples/testh5cc.sh.in
+++ b/examples/testh5cc.sh.in
@@ -66,6 +66,8 @@ prog1=${H5TOOL}_prog1.$suffix
prog1_o=${H5TOOL}_prog1.o
prog2=${H5TOOL}_prog2.$suffix
prog2_o=${H5TOOL}_prog2.o
+args=${H5TOOL}_args.$suffix
+args_o=${H5TOOL}_args.o
applib=libapp${H5TOOL}.a
# short hands
@@ -277,16 +279,85 @@ main (void)
}
EOF
+# Generate HDF5 v1.14 Main Program:
+# This makes unique V1.14 API calls.
+cat > $v114main <<EOF
+/* This is a V1.14 API calls example Program. */
+#include "hdf5.h"
+#define H5FILE_NAME "tmp.h5"
+#define SPACE1_RANK 3
+int
+main (void)
+{
+ hid_t sid; /* Dataspace ID */
+ hid_t fapl = -1; /* File access property list ID */
+ int rank; /* Logical rank of dataspace */
+ hsize_t dims[] = {3, 3, 15};
+ size_t sbuf_size=0;
+ herr_t ret; /* Generic return value */
+ hsize_t start[] = {0, 0, 0};
+ hsize_t stride[] = {2, 5, 3};
+ hsize_t count[] = {2, 2, 2};
+ hsize_t block[] = {1, 3, 1};
+
+ /* Create the file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+
+ /* Set low/high bounds in the fapl */
+ ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST,
+ H5F_LIBVER_LATEST);
+
+ /* Create the dataspace */
+ sid = H5Screate_simple(SPACE1_RANK, dims, NULL);
+
+ /* Set the hyperslab selection */
+ ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block);
+
+ /* Encode simple dataspace in a buffer with the fapl setting */
+ ret = H5Sencode(sid, NULL, &sbuf_size, fapl);
+
+ /* Encode simple dataspace in a buffer with the fapl setting */
+ ret = H5Sencode2(sid, NULL, &sbuf_size, fapl);
+
+ printf("HDF5 C program created with V1.14 API ran successfully. ");
+/* "File %s generated.\n", H5FILE_NAME);
+ remove(H5FILE_NAME); */
+ return 0;
+}
+EOF
+
+# Generate args:
+# An application main that test misc command line arguments being passed.
+cat > $args <<EOF
+#include "hdf5.h"
+#define H5FILE_NAME "check_args.h5"
+int
+main (void)
+{
+ char c = SGL_QUOTE; /* 'H' */
+ char *s = DBL_QUOTE; /* "HDF" */
+ int val = MISC; /* 42 */
+ hid_t file; /* file and dataset handles */
+
+ file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ H5Fclose(file);
+
+ printf("HDF5 C Sample program ran successfully. File %s generated.\n", H5FILE_NAME);
+ remove(H5FILE_NAME);
+
+ return 0;
+}
+EOF
# Parse option
# None
-# Print a line-line message left justified in a field of 70 characters
+# Print a line-line message left justified in a field of 71 characters
# beginning with the word "Testing".
#
TESTING() {
SPACES=" "
- echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+ echo "Testing $* $SPACES" | cut -c1-71 | tr -d '\012'
}
@@ -450,6 +521,10 @@ else
TOOLTEST $v112main
fi
+# Group 6: # HDF5 program that depends on input args.
+echo "***"Simple Compile and Link in one step with user-supplied arguments.
+TOOLTEST -DSGL_QUOTE=\'H\' -DDBL_QUOTE=\"HDF\" -DMISC=42 $args
+
##############################################################################
# END
##############################################################################
diff --git a/fortran/examples/testh5fc.sh.in b/fortran/examples/testh5fc.sh.in
index 0328bbb..5b6a9de 100644
--- a/fortran/examples/testh5fc.sh.in
+++ b/fortran/examples/testh5fc.sh.in
@@ -42,11 +42,13 @@ myos=`uname -s`
myhostnama=`uname -n`
# Generate some source files and library for tests.
-suffix=f90 # source file suffix
+suffix=F90 # source file suffix
hdf5main=${H5TOOL}_hdf5main.$suffix
hdf5main_o=${H5TOOL}_hdf5main.o
appmain=${H5TOOL}_appmain.$suffix
appmain_o=${H5TOOL}_appmain.o
+args=${H5TOOL}_args.$suffix
+args_o=${H5TOOL}_args.o
prog1=${H5TOOL}_prog1.$suffix
prog1_o=${H5TOOL}_prog1.o
prog2=${H5TOOL}_prog2.$suffix
@@ -106,7 +108,7 @@ cat > $hdf5main <<EOF
IMPLICIT NONE
- CHARACTER(LEN=8), PARAMETER :: filename = "apptmp.h5" ! File name
+ CHARACTER(LEN=9), PARAMETER :: filename = "apptmp.h5" ! File name
INTEGER(HID_T) :: file_id ! File identifier
INTEGER :: error ! Error flag
@@ -118,17 +120,38 @@ cat > $hdf5main <<EOF
END PROGRAM FILEEXAMPLE
EOF
+# Generate an args Main Program:
+# An application main that test misc command line arguments being passed.
+cat > $args <<EOF
+ PROGRAM ARGS
+ USE HDF5 ! This module contains all necessary modules
+
+ IMPLICIT NONE
+ CHARACTER(LEN=1), PARAMETER :: chr1 = SGL_QUOTE ! 'H'
+ CHARACTER(LEN=3), PARAMETER :: chr3 = DBL_QUOTE ! "HDF"
+ INTEGER, PARAMETER :: val = MISC ! 42
+ CHARACTER(LEN=9), PARAMETER :: filename = "argtmp.h5" ! File name
+ INTEGER(HID_T) :: file_id ! File identifier
+
+ INTEGER :: error ! Error flag
+
+ CALL h5open_f (error)
+ CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error)
+ CALL h5fclose_f(file_id, error)
+ CALL h5close_f(error)
+ END PROGRAM ARGS
+EOF
# Parse option
# None
-# Print a line-line message left justified in a field of 70 characters
+# Print a line-line message left justified in a field of 73 characters
# beginning with the word "Testing".
#
TESTING() {
SPACES=" "
- echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+ echo "Testing $* $SPACES" | cut -c1-73 | tr -d '\012'
}
@@ -199,6 +222,10 @@ $RANLIB $applib
TOOLTEST $appmain $applib
TOOLTEST $appmain_o $applib
+# HDF5 program that depends on input args.
+echo "***"Simple Compile and Link in one step with user-supplied arguments.
+TOOLTEST -DSGL_QUOTE=\'H\' -DDBL_QUOTE=\"HDF\" -DMISC=42 $args
+
# No preprocess test since -E is not a common option for Fortran compilers.
##############################################################################
diff --git a/fortran/src/h5fc.in b/fortran/src/h5fc.in
index c5da815..6d7329a 100644
--- a/fortran/src/h5fc.in
+++ b/fortran/src/h5fc.in
@@ -60,7 +60,7 @@ host_os="@host_os@"
prog_name="`basename $0`"
-allargs=""
+misc_args=""
compile_args=""
link_args=""
link_objs=""
@@ -176,7 +176,6 @@ for arg in $@ ; do
case "$arg" in
-c)
- allargs="$allargs $arg"
compile_args="$compile_args $arg"
if test "x$do_link" = "xyes" -a -n "$output_file"; then
@@ -187,7 +186,6 @@ for arg in $@ ; do
dash_c="yes"
;;
-o)
- allargs="$allargs $arg"
dash_o="yes"
if test "x$dash_c" = "xyes"; then
@@ -199,14 +197,12 @@ for arg in $@ ; do
fi
;;
-E|-M|-MT)
- allargs="$allargs $arg"
compile_args="$compile_args $arg"
dash_c="yes"
do_link="no"
;;
-l*)
link_args="$link_args $arg"
- allargs="$allargs $arg"
;;
-prefix=*)
prefix="`expr "$arg" : '-prefix=\(.*\)'`"
@@ -238,14 +234,14 @@ for arg in $@ ; do
;;
*\"*)
qarg="'"$arg"'"
- allargs="$allargs $qarg"
+ misc_args="$misc_args $qarg"
;;
*\'*)
- qarg='\"'"$arg"'\"'
- allargs="$allargs $qarg"
+ qarg='"'"$arg"'"'
+ misc_args="$misc_args $qarg"
;;
- *) allargs="$allargs $arg"
+ *) misc_args="$misc_args $arg"
if [ -s "$arg" ] ; then
ext=`expr "$arg" : '.*\(\..*\)'`
if [ "$ext" = ".f" -o "$ext" = ".F" -o \
@@ -293,7 +289,7 @@ if test "x$do_compile" = "xyes"; then
fi
- $SHOW $FC $H5BLD_FCFLAGS $FCFLAGS ${F9XSUFFIXFLAG} ${fmodules} $compile_args
+ $SHOW $FC $H5BLD_FCFLAGS $FCFLAGS ${F9XSUFFIXFLAG} ${fmodules} $misc_args $compile_args
status=$?
if test "$status" != "0"; then