HDF example README file



An example of reading and writing hdf files, using a perl program (hdfgen.pl)
to help accomplish this.
 
The program hdfgen.pl takes a C-structure as input and generates all
the HDF calls needed to read and write a full C structure. The user
interacts with the data at the level of read_Cstruct, write_Cstruct
instead of the more detailed level that HDF requires.
 
We are using HDF 4.1r2 and perl 5.005_02.

To use this system you will need to have the HDF libraries and perl
installed on your system.  

HDF is available from: http://hdf.ncsa.uiuc.edu/

The source code for perl is at: http://perl.com/perl/info/software.html

The ingredients are:
 
	structure.h	A header file that contains a c structure.
 
	hdfgen.pl	A perl program that uses the struct in structure.h
                        to create functions that simplify creating read
                        and write code for hdf files.
                        In this example it will create the file: hdf_test.c
 
        wr_test.c       Simple write code that uses the functions in
                        hdf_test.c generated by hdfgen.pl to write a data
                        file in hdf format.
 
        rd_test.c       Simple read code that uses the functions in
                        hdf_test.c generated by hdfgen.pl to read a data
                        file in hdf format.
 
You will need to change some items in the Makefile to get the programs
to compile.  HDFHOME is one, and you may need to change the compiler to
something else if you don't have gcc.
 
Then compile the code using the Makefile (type make).
 
Typing, 'wr_test Ex1.hdf' will run the writing program and will
create an HDF file named Ex1.hdf.
 
Typing, 'rd_test Ex1.hdf' will run the reading program and will
output the written data to the screen.
 
The structure is defined in the structure.h file and is what all the HDF
data IO is based on.  If there is a question about the structures
let us know.
 
If you don't use the GNU version of make, this makefile may not
work for you.  The shorthand values $^ and $< mean 'all the dependency
items' and 'the first listed dependency item' respectively.  The value
$@ is equivalent to the object to be made.
 
In gmake:
test: test.o test2.o
 
$@ = test
$^ = test.o test2.o
$< = test.o
 

asc@srl.caltech.edu

Back to ASC Home Page